Skip to content

Commit 949c02f

Browse files
committed
feat: Include individual bundles
Remove test bundle Signed-off-by: Gordon Smith <[email protected]>
1 parent 1cef439 commit 949c02f

File tree

2 files changed

+25
-53
lines changed

2 files changed

+25
-53
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"unpkg": "dist/index.min.js",
2323
"types": "types/index.d.ts",
2424
"files": [
25-
"dist/*",
25+
"dist/index*.*",
26+
"dist/expat*.*",
27+
"dist/graphviz*.*",
2628
"types/*",
2729
"src/*.css"
2830
],
@@ -102,4 +104,4 @@
102104
"url": "https://github.com/hpcc-systems/hpcc-js-wasm/issues"
103105
},
104106
"homepage": "https://github.com/hpcc-systems/hpcc-js-wasm#readme"
105-
}
107+
}

rollup.config.js

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ import replace from "@rollup/plugin-replace";
66

77
// eslint-disable-next-line @typescript-eslint/no-var-requires
88
const pkg = require("./package.json");
9-
10-
export default [{
11-
input: "lib-es6/index",
9+
const browserTpl = (input, umdOutput, esOutput) => ({
10+
input: input,
1211
output: [{
13-
file: pkg.browser,
12+
file: umdOutput,
1413
format: "umd",
1514
sourcemap: true,
1615
name: pkg.name
1716
}, {
18-
file: pkg.module + ".js",
17+
file: esOutput,
1918
format: "es",
2019
sourcemap: true
2120
}],
@@ -27,16 +26,17 @@ export default [{
2726
commonjs({}),
2827
sourcemaps()
2928
]
30-
}, {
31-
input: "lib-es6/index",
29+
});
30+
const nodeTpl = (input, cjsOutput, esOutput) => ({
31+
input: input,
3232
external: ["fs", "crypto", "path"],
3333
output: [{
34-
file: pkg.main,
34+
file: cjsOutput,
3535
format: "cjs",
3636
sourcemap: true,
3737
name: pkg.name
3838
}, {
39-
file: pkg["module-node"] + ".js",
39+
file: esOutput,
4040
format: "es",
4141
sourcemap: true
4242
}],
@@ -56,45 +56,15 @@ export default [{
5656
commonjs({}),
5757
sourcemaps()
5858
]
59-
}, {
60-
input: "lib-es6/__tests__/index",
61-
output: {
62-
file: "dist/test.js",
63-
format: "umd",
64-
sourcemap: true,
65-
name: pkg.name
66-
},
67-
plugins: [
68-
alias({}),
69-
nodeResolve({
70-
preferBuiltins: true
71-
}),
72-
commonjs({}),
73-
sourcemaps()
74-
]
75-
}, {
76-
input: "lib-es6/__tests__/index",
77-
external: ["fs", "crypto", "path"],
78-
output: {
79-
file: "dist/test.node.js",
80-
format: "commonjs",
81-
sourcemap: true,
82-
name: pkg.name
83-
},
84-
plugins: [
85-
alias({
86-
entries: [
87-
{ find: "../build/graphviz/graphvizlib/graphvizlib", replacement: "../build/graphviz/graphvizlib/graphvizlib.node" },
88-
{ find: "../build/expat/expatlib/expatlib", replacement: "../build/expat/expatlib/expatlib.node" }
89-
]
90-
}),
91-
replace({
92-
".node.wasm": ".wasm"
93-
}),
94-
nodeResolve({
95-
preferBuiltins: true
96-
}),
97-
commonjs({}),
98-
sourcemaps()
99-
]
100-
}];
59+
});
60+
61+
export default [
62+
browserTpl("lib-es6/index", pkg.browser, pkg.module + ".js"),
63+
browserTpl("lib-es6/graphviz", "dist/graphviz.js", "dist/graphviz.es6.js"),
64+
browserTpl("lib-es6/expat", "dist/expat.js", "dist/expat.es6.js"),
65+
nodeTpl("lib-es6/index", pkg.main, pkg["module-node"] + ".js"),
66+
nodeTpl("lib-es6/graphviz", "dist/graphviz.node.js", "dist/graphviz.node.es6.js"),
67+
nodeTpl("lib-es6/expat", "dist/expat.node.js", "dist/expat.node.es6.js"),
68+
browserTpl("lib-es6/__tests__/index", "dist/test.js", "dist/test.es6.js"),
69+
nodeTpl("lib-es6/__tests__/index", "dist/test.node.js", "dist/test.node.es6.js")
70+
];

0 commit comments

Comments
 (0)