Skip to content

Commit 00e62d1

Browse files
authored
Merge pull request #13 from deamme/v4
v4 release for Inferno v6
2 parents d3beee6 + 1375b70 commit 00e62d1

File tree

86 files changed

+787
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+787
-454
lines changed

examples/fuse-box/fuse.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const {
55
CSSPlugin,
66
WebIndexPlugin,
77
QuantumPlugin,
8-
} = require('fuse-box');
9-
// const transformInferno = require('../../dist').default
10-
const transformInferno = require('ts-transform-inferno').default;
11-
const transformClasscat = require('ts-transform-classcat').default;
12-
let fuse, app;
13-
let isProduction = false;
8+
} = require('fuse-box')
9+
const transformInferno = require('../../dist').default
10+
// const transformInferno = require('ts-transform-inferno').default;
11+
const transformClasscat = require('ts-transform-classcat').default
12+
let fuse, app
13+
let isProduction = false
1414

1515
Sparky.task('config', _ => {
1616
fuse = new FuseBox({
@@ -31,23 +31,23 @@ Sparky.task('config', _ => {
3131
template: 'src/index.html',
3232
}),
3333
isProduction &&
34-
QuantumPlugin({
35-
bakeApiIntoBundle: 'app',
36-
treeshake: true,
37-
uglify: true,
38-
}),
34+
QuantumPlugin({
35+
bakeApiIntoBundle: 'app',
36+
treeshake: true,
37+
uglify: true,
38+
}),
3939
],
40-
});
41-
app = fuse.bundle('app').instructions('>index.tsx');
42-
});
43-
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
44-
Sparky.task('env', _ => (isProduction = true));
40+
})
41+
app = fuse.bundle('app').instructions('>index.tsx')
42+
})
43+
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'))
44+
Sparky.task('env', _ => (isProduction = true))
4545
Sparky.task('dev', ['clean', 'config'], _ => {
46-
fuse.dev();
47-
app.hmr().watch();
48-
return fuse.run();
49-
});
46+
fuse.dev()
47+
app.hmr().watch()
48+
return fuse.run()
49+
})
5050
Sparky.task('prod', ['clean', 'env', 'config'], _ => {
51-
fuse.dev({ reload: true }); // remove after demo
52-
return fuse.run();
53-
});
51+
fuse.dev({ reload: true }) // remove after demo
52+
return fuse.run()
53+
})

examples/fuse-box/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"fuse-box": "^3.1.3",
1818
"ts-transform-classcat": "^0.0.2",
1919
"ts-transform-inferno": "^3.0.2",
20-
"typescript": "^2.7.1",
20+
"typescript": "^3.1.3",
2121
"uglify-es": "^3.3.9"
2222
}
2323
}

examples/fuse-box/src/index.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
import { render, version, Component } from "inferno";
2-
import { Incrementer } from "./components/Incrementer";
1+
import { render, version, Component } from 'inferno'
2+
import { Incrementer } from './components/Incrementer'
33

44
import './main.css'
55

6-
const container = document.getElementById("app");
6+
const container = document.getElementById('app')
77

88
class MyComponent extends Component<any, any> {
9-
private tsxVersion: number;
9+
private tsxVersion: number
1010

1111
constructor(props, context) {
12-
super(props, context);
12+
super(props, context)
1313

14-
this.tsxVersion = 2.71; /* This is typed value */
14+
this.tsxVersion = 2.71 /* This is typed value */
1515
}
1616

1717
public render() {
1818
return (
1919
<div>
2020
<h1>{`Welcome to Inferno ${version} TSX ${this.tsxVersion}`}</h1>
21-
<Incrementer name={"Crazy button"} />
21+
<Incrementer name={'Crazy button'} />
22+
<>
23+
<div>Fragment test</div>
24+
</>
2225
</div>
23-
);
26+
)
2427
}
2528
}
2629

27-
render(<MyComponent />, container);
30+
render(<MyComponent />, container)

examples/rollup/rollup.config.js

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
import nodeResolve from 'rollup-plugin-node-resolve';
2-
import commonjs from 'rollup-plugin-commonjs';
3-
import replace from 'rollup-plugin-replace';
4-
import typescript from 'rollup-plugin-typescript2';
5-
import transformInferno from 'ts-transform-inferno';
6-
import serve from 'rollup-plugin-serve';
7-
import livereload from 'rollup-plugin-livereload';
8-
import { uglify } from 'rollup-plugin-uglify';
1+
import nodeResolve from 'rollup-plugin-node-resolve'
2+
import commonjs from 'rollup-plugin-commonjs'
3+
import replace from 'rollup-plugin-replace'
4+
import typescript from 'rollup-plugin-typescript2'
5+
const transformInferno = require('../../dist').default
6+
// import transformInferno from '../../dist/index'
7+
// import transformInferno from 'ts-transform-inferno'
8+
console.log(transformInferno)
9+
import serve from 'rollup-plugin-serve'
10+
import livereload from 'rollup-plugin-livereload'
11+
import { uglify } from 'rollup-plugin-uglify'
912

10-
const isProd = process.env.NODE_ENV === 'production';
13+
const isProd = process.env.NODE_ENV === 'production'
1114

1215
const tsTransformer = () => ({
13-
before: [
14-
transformInferno()
15-
],
16-
after: []
16+
before: [transformInferno()],
17+
after: [],
1718
})
1819

1920
const config = {
@@ -25,31 +26,33 @@ const config = {
2526
customResolveOptions: {
2627
packageFilter(pkg) {
2728
if (!isProd && pkg['dev:module'] != null) {
28-
pkg.main = pkg['dev:module'];
29+
pkg.main = pkg['dev:module']
2930
} else if (pkg.module != null) {
30-
pkg.main = pkg.module;
31+
pkg.main = pkg.module
3132
} else if (pkg['js:next'] != null) {
32-
pkg.main = pkg['js:next'];
33+
pkg.main = pkg['js:next']
3334
}
34-
return pkg;
35+
return pkg
3536
},
3637
},
3738
}),
3839
commonjs({
3940
include: 'node_modules/**',
4041
}),
4142
replace({
42-
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
43+
'process.env.NODE_ENV': JSON.stringify(
44+
process.env.NODE_ENV || 'production'
45+
),
4346
}),
4447
typescript({
45-
transformers: [tsTransformer]
48+
transformers: [tsTransformer],
4649
}),
4750
],
4851
output: {
4952
file: 'dist/app.js',
5053
format: 'iife',
5154
},
52-
};
55+
}
5356

5457
if (!isProd) {
5558
config.plugins.push(
@@ -65,12 +68,10 @@ if (!isProd) {
6568
}),
6669
livereload({
6770
watch: 'dist',
68-
}),
69-
);
71+
})
72+
)
7073
} else {
71-
config.plugins.push(
72-
uglify(),
73-
);
74+
config.plugins.push(uglify())
7475
}
7576

76-
export default config;
77+
export default config

examples/rollup/src/index.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
import { render, version, Component } from "inferno";
2-
import { Incrementer } from "./components/Incrementer";
1+
import { render, version, Component } from 'inferno'
2+
import { Incrementer } from './components/Incrementer'
33

4-
const container = document.getElementById("app");
4+
const container = document.getElementById('app')
55

66
class MyComponent extends Component<any, any> {
7-
private tsxVersion: number;
7+
private tsxVersion: number
88

99
constructor(props, context) {
10-
super(props, context);
10+
super(props, context)
1111

12-
this.tsxVersion = 2.71; /* This is typed value */
12+
this.tsxVersion = 2.71 /* This is typed value */
1313
}
1414

1515
public render() {
1616
return (
1717
<div>
1818
<h1>{`Welcome to Inferno ${version} TSX ${this.tsxVersion}`}</h1>
19-
<Incrementer name={"Crazy button"} />
19+
<Incrementer name={'Crazy button'} />
20+
<>
21+
<div>Fragment test</div>
22+
</>
2023
</div>
21-
);
24+
)
2225
}
2326
}
2427

25-
render(<MyComponent />, container);
28+
render(<MyComponent />, container)

examples/rollup/src/main.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/webpack/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
"author": "Deam Hansen",
1212
"license": "MIT",
1313
"dependencies": {
14-
"classcat": "^3.0.0",
1514
"inferno": "^6.0.3"
1615
},
1716
"devDependencies": {
18-
"clean-webpack-plugin": "^0.1.17",
19-
"html-webpack-plugin": "^2.30.1",
20-
"ts-loader": "^3.5.0",
21-
"ts-transform-classcat": "^0.0.2",
17+
"clean-webpack-plugin": "^0.1.19",
18+
"html-webpack-plugin": "^3.2.0",
19+
"ts-loader": "^5.2.2",
20+
"ts-transform-classcat": "^0.1.1",
2221
"ts-transform-inferno": "^3.0.2",
23-
"webpack": "^3.11.0",
24-
"webpack-dev-server": "^2.9.5"
22+
"webpack": "^4.22.0",
23+
"webpack-cli": "^3.1.2",
24+
"webpack-dev-server": "^3.1.10"
2525
}
2626
}

examples/webpack/src/components/Visualizer.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
* Functional components provide great performance but does not have state
44
*/
55
export function Visualizer({ number: number }) {
6-
return (
7-
<div className={{visualizer: true, test: true}}>
8-
{number}
9-
</div>
10-
);
6+
return <div className="test">{number}</div>
117
}

examples/webpack/webpack.config.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
const webpack = require('webpack');
2-
const CleanWebpackPlugin = require("clean-webpack-plugin");
3-
const HtmlWebpackPlugin = require("html-webpack-plugin");
1+
const webpack = require('webpack')
2+
const CleanWebpackPlugin = require('clean-webpack-plugin')
3+
const HtmlWebpackPlugin = require('html-webpack-plugin')
44

5-
const path = require("path");
6-
const transformInferno = require("ts-transform-inferno").default;
7-
// const transformInferno = require('../../dist').default
8-
const transformClasscat = require('ts-transform-classcat').default;
5+
const path = require('path')
6+
// const transformInferno = require("ts-transform-inferno").default;
7+
const transformInferno = require('../../dist').default
8+
const transformClasscat = require('ts-transform-classcat').default
99

1010
module.exports = {
11-
entry: "./src/index.tsx",
11+
entry: './src/index.tsx',
1212
output: {
13-
path: path.resolve(__dirname, "dist/"),
14-
filename: "bundle.js"
13+
path: path.resolve(__dirname, 'dist/'),
14+
filename: 'bundle.js',
1515
},
1616
resolve: {
1717
mainFields: ['main'], // Important so Webpack resolves the main field of package.json for Classcat
18-
extensions: [".js", ".jsx", ".ts", ".tsx"]
18+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
1919
},
2020
module: {
2121
rules: [
2222
{
2323
test: /\.tsx$/,
24-
loader: "ts-loader",
24+
loader: 'ts-loader',
2525
options: {
2626
getCustomTransformers: () => ({
27-
before: [transformClasscat(), transformInferno()]
28-
})
29-
}
27+
before: [transformClasscat(), transformInferno()],
28+
}),
29+
},
3030
},
3131
{
3232
test: /\.ts$/,
33-
loader: "ts-loader"
34-
}
35-
]
33+
loader: 'ts-loader',
34+
},
35+
],
3636
},
3737
devServer: {
38-
contentBase: "src/",
39-
historyApiFallback: true
38+
contentBase: 'src/',
39+
historyApiFallback: true,
4040
},
4141
plugins: [
4242
new HtmlWebpackPlugin({
43-
template: "./src/index.html",
44-
inject: "body"
43+
template: './src/index.html',
44+
inject: 'body',
4545
}),
46-
new CleanWebpackPlugin(["dist"], {
47-
verbose: true
46+
new CleanWebpackPlugin(['dist'], {
47+
verbose: true,
4848
}),
4949
// By default, webpack does `n=>n` compilation with entry files. This concatenates
5050
// them into a single chunk.
5151
new webpack.optimize.LimitChunkCountPlugin({
52-
maxChunks: 1
52+
maxChunks: 1,
5353
}),
54-
new webpack.HotModuleReplacementPlugin()
55-
]
56-
};
54+
new webpack.HotModuleReplacementPlugin(),
55+
],
56+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-transform-inferno",
3-
"version": "3.0.2",
3+
"version": "4.0.0",
44
"description": "A typescript transformer for InfernoJS",
55
"bugs": {
66
"url": "https://github.com/deamme/ts-transform-inferno/issues"
@@ -29,11 +29,11 @@
2929
"typescript": ">=2.7.1"
3030
},
3131
"devDependencies": {
32-
"typescript": "^2.7.1",
3332
"@types/node": "^8.0.53",
3433
"fs-extra": "^4.0.2",
3534
"glob": "^7.1.2",
3635
"rimraf": "^2.6.2",
37-
"ts-node": "^3.3.0"
36+
"ts-node": "^3.3.0",
37+
"typescript": "^3.1.3"
3838
}
3939
}

0 commit comments

Comments
 (0)