@ixon-cdk/static-builder 1.0.0-alpha.4 → 1.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/browser.js +37 -41
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# IXON Component Development Kit
|
|
1
|
+
# IXON Component Development Kit Static Builder
|
|
2
2
|
|
|
3
|
-
This builder can be used with the IXON Component Development Kit (CDK). It contains build targets for building [webcomponents](https://developer.mozilla.org/en-US/docs/Web/Web_Components) (reusable custom elements) using [
|
|
3
|
+
This builder can be used with the IXON Component Development Kit (CDK). It contains build targets for building [webcomponents](https://developer.mozilla.org/en-US/docs/Web/Web_Components) (reusable custom elements) using [Vite](https://vitejs.dev/).
|
package/browser.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
const rollup = require("rollup");
|
|
2
|
-
const commonjs = require("@rollup/plugin-commonjs");
|
|
3
|
-
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
|
4
|
-
const { terser } = require("rollup-plugin-terser");
|
|
5
1
|
const path = require("path");
|
|
2
|
+
const { build } = require("vite");
|
|
6
3
|
const {
|
|
7
4
|
getRootDir,
|
|
8
5
|
cleanDir,
|
|
6
|
+
watchInputDir,
|
|
9
7
|
writeDemoFile,
|
|
10
8
|
copyAssets,
|
|
11
9
|
watchAssets,
|
|
@@ -18,48 +16,46 @@ async function _build(inputFile, outputFile, tag, assets, production, watch) {
|
|
|
18
16
|
cleanDir(outputDir);
|
|
19
17
|
writeDemoFile(tag, outputDir, outputFile);
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const config = {
|
|
20
|
+
root: getRootDir(),
|
|
21
|
+
mode: production ? "production" : "development",
|
|
22
|
+
build: {
|
|
23
|
+
lib: {
|
|
24
|
+
entry: inputFile,
|
|
25
|
+
formats: ["iife"],
|
|
26
|
+
name: "app",
|
|
27
|
+
fileName: () => `${tag}.min.js`,
|
|
28
|
+
},
|
|
29
|
+
sourcemap: true,
|
|
30
|
+
outDir: outputDir,
|
|
31
|
+
emptyOutDir: false,
|
|
32
|
+
rollupOptions: {
|
|
33
|
+
output: {
|
|
34
|
+
inlineDynamicImports: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
write: true,
|
|
39
|
+
plugins: [],
|
|
25
40
|
};
|
|
26
|
-
const outputOptions = {
|
|
27
|
-
sourcemap: true,
|
|
28
|
-
format: "iife",
|
|
29
|
-
name: "app",
|
|
30
|
-
file: outputFile,
|
|
31
|
-
inlineDynamicImports: true,
|
|
32
|
-
};
|
|
33
|
-
const productionOutputOptions = {
|
|
34
|
-
...outputOptions,
|
|
35
|
-
file: outputFile,
|
|
36
|
-
plugins: [terser()],
|
|
37
|
-
};
|
|
38
|
-
if (watch) {
|
|
39
|
-
const watchOptions = {
|
|
40
|
-
...inputOptions,
|
|
41
|
-
output: production
|
|
42
|
-
? [outputOptions, productionOutputOptions]
|
|
43
|
-
: [outputOptions],
|
|
44
|
-
watch: { exclude: ["node_modules/**"] },
|
|
45
|
-
};
|
|
46
|
-
const watcher = await rollup.watch(watchOptions);
|
|
47
|
-
watcher.close();
|
|
48
|
-
} else {
|
|
49
|
-
const bundle = await rollup.rollup(inputOptions);
|
|
50
|
-
await bundle.generate(outputOptions);
|
|
51
|
-
await bundle.write(outputOptions);
|
|
52
|
-
if (production) {
|
|
53
|
-
await bundle.generate(productionOutputOptions);
|
|
54
|
-
await bundle.write(productionOutputOptions);
|
|
55
|
-
}
|
|
56
|
-
await bundle.close();
|
|
57
|
-
}
|
|
58
41
|
|
|
59
|
-
//
|
|
42
|
+
// build
|
|
43
|
+
await build(config);
|
|
60
44
|
copyAssets(assets, inputDir, outputDir);
|
|
45
|
+
|
|
46
|
+
// watch source files
|
|
61
47
|
if (watch) {
|
|
62
48
|
watchAssets(assets, inputDir, outputDir);
|
|
49
|
+
await watchInputDir(inputDir, (isAsset) => {
|
|
50
|
+
if (isAsset) {
|
|
51
|
+
// do nothing
|
|
52
|
+
} else {
|
|
53
|
+
build(config);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
process.on("SIGINT", () => {
|
|
57
|
+
process.exit();
|
|
58
|
+
});
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/static-builder",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@rollup/plugin-commonjs": "^20.0.0",
|
|
10
|
-
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
11
9
|
"is-potential-custom-element-name": "^1.0.1",
|
|
12
|
-
"
|
|
13
|
-
"rollup-plugin-terser": "^7.0.2"
|
|
10
|
+
"vite": "^2.6.12"
|
|
14
11
|
},
|
|
15
12
|
"peerDependencies": {
|
|
16
|
-
"@ixon-cdk/core": "^1.0.0-alpha.
|
|
13
|
+
"@ixon-cdk/core": "^1.0.0-alpha.8"
|
|
17
14
|
}
|
|
18
15
|
}
|