@nebula.js/cli-build 4.9.0 → 4.11.0

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 CHANGED
@@ -16,18 +16,22 @@ nebula build
16
16
  Build nebula.js visualization
17
17
 
18
18
  Options:
19
- --version Show version number [boolean]
20
- --config, -c Path to a JavaScript config file
21
- [string] [default: "nebula.config.js"]
22
- --watch, -w Watch source files
23
- [choices: "umd", "systemjs"] [default: "umd"]
24
- --sourcemap, -m Generate source map [boolean] [default: true]
25
- --mode Explicitly set mode
26
- [string] [choices: "production", "development"]
27
- --core Set a core build target [string] [default: "core"]
28
- --typescript Enable typescript bundling [boolean] [default: false]
29
- --preferBuiltins Configuration option that specifies whether to use Node.js built-in modules [boolean] [default: true]
30
- --browser Instructs the build to use the browser module resolutions in package.json and adds 'browser' to exportConditions if it is not present so browser conditionals in exports are applied. [boolean] [default: false]
19
+ --version Show version number [boolean]
20
+ --config, -c Path to a JavaScript config file
21
+ [string] [default: "nebula.config.js"]
22
+ --watch, -w Watch source files
23
+ [choices: "umd", "systemjs"] [default: "umd"]
24
+ --sourcemap, -m Generate source map [boolean] [default: true]
25
+ --mode Explicitly set mode
26
+ [string] [choices: "production", "development"]
27
+ --core Set a core build target [string] [default: "core"]
28
+ --typescript Enable typescript bundling [boolean] [default: false]
29
+ --preferBuiltins Specify whether to use Node.js built-in modules.
30
+ [boolean] [default: true]
31
+ --browser Use the browser module resolutions in package.json and adds
32
+ 'browser' to exportConditions if it is not present so browser
33
+ conditionals in exports are applied.
34
+ [boolean] [default: false]
31
35
  ```
32
36
 
33
37
  ## Example
package/lib/config.js CHANGED
@@ -61,7 +61,7 @@ const config = ({
61
61
  mode = 'production',
62
62
  format = 'umd',
63
63
  cwd = process.cwd(),
64
- argv = { sourcemap: true },
64
+ argv = { sourcemap: true, codeSplit: false },
65
65
  core,
66
66
  behaviours: {
67
67
  getExternal = getExternalDefault,
@@ -113,6 +113,27 @@ const config = ({
113
113
  external.push('@nebula.js/stardust');
114
114
  }
115
115
 
116
+ const output = () => {
117
+ const outputConfig = {
118
+ banner,
119
+ format,
120
+ name: outputName,
121
+ sourcemap,
122
+ globals: {
123
+ '@nebula.js/stardust': 'stardust',
124
+ },
125
+ };
126
+ if (!argv.codeSplit || format === 'umd') {
127
+ outputConfig.file = path.resolve(dir, outputFile);
128
+ } else {
129
+ outputConfig.dir = path.resolve(dir, outputFile.split('/')[0]);
130
+ }
131
+ if (argv.codeSplit && format === 'umd') {
132
+ outputConfig.inlineDynamicImports = true;
133
+ }
134
+ return outputConfig;
135
+ };
136
+
116
137
  return {
117
138
  input: {
118
139
  onwarn(warning, warn) {
@@ -172,16 +193,7 @@ const config = ({
172
193
  ],
173
194
  ].filter(Boolean),
174
195
  },
175
- output: {
176
- banner,
177
- format,
178
- file: path.resolve(dir, outputFile),
179
- name: outputName,
180
- sourcemap,
181
- globals: {
182
- '@nebula.js/stardust': 'stardust',
183
- },
184
- },
196
+ output: output(),
185
197
  };
186
198
  };
187
199
 
@@ -54,6 +54,12 @@ const options = {
54
54
  type: 'boolean',
55
55
  default: false,
56
56
  },
57
+ codeSplit: {
58
+ description:
59
+ 'Sets output.dir instead of output.file for code-splitting builds. Sets inlineDynamicImports for umd builds to avoid throwing errors.',
60
+ type: 'boolean',
61
+ default: false,
62
+ },
57
63
  };
58
64
 
59
65
  // nebula build --watch - watch umd bundle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula.js/cli-build",
3
- "version": "4.9.0",
3
+ "version": "4.11.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "QlikTech International AB",
@@ -21,28 +21,28 @@
21
21
  "lint": "eslint src"
22
22
  },
23
23
  "dependencies": {
24
- "@babel/cli": "7.23.4",
25
- "@babel/core": "7.23.3",
24
+ "@babel/cli": "7.23.9",
25
+ "@babel/core": "7.23.9",
26
26
  "@babel/plugin-transform-react-jsx": "7.23.4",
27
- "@babel/preset-env": "7.23.3",
27
+ "@babel/preset-env": "7.23.9",
28
28
  "@rollup/plugin-babel": "6.0.4",
29
29
  "@rollup/plugin-commonjs": "25.0.7",
30
- "@rollup/plugin-json": "6.0.1",
30
+ "@rollup/plugin-json": "6.1.0",
31
31
  "@rollup/plugin-node-resolve": "15.2.3",
32
32
  "@rollup/plugin-replace": "5.0.5",
33
33
  "@rollup/plugin-terser": "0.4.4",
34
34
  "chalk": "4.1.2",
35
35
  "extend": "3.0.2",
36
- "postcss": "^8.4.31",
37
- "rollup": "4.6.0",
36
+ "postcss": "^8.4.35",
37
+ "rollup": "4.10.0",
38
38
  "rollup-plugin-postcss": "4.0.2",
39
39
  "rollup-plugin-sourcemaps": "0.6.3",
40
40
  "yargs": "17.7.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@rollup/plugin-typescript": "11.1.5",
43
+ "@rollup/plugin-typescript": "11.1.6",
44
44
  "tslib": "*",
45
- "typescript": ">=5.3.2"
45
+ "typescript": ">=5.3.3"
46
46
  },
47
- "gitHead": "45dbf5b8fae64c7774b8ebabd3a94af33c7d2283"
47
+ "gitHead": "f22c818690d2752b49033ac811052146a820e742"
48
48
  }