@nebula.js/cli-build 4.0.0 → 4.0.2

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
@@ -26,6 +26,8 @@ Options:
26
26
  [string] [choices: "production", "development"]
27
27
  --core Set a core build target [string] [default: "core"]
28
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]
29
31
  ```
30
32
 
31
33
  ## Example
package/lib/build.js CHANGED
@@ -71,15 +71,15 @@ async function build(argv = {}) {
71
71
  await esm(buildConfig);
72
72
  console.timeEnd('Create ESM bundle');
73
73
 
74
- if (argv.systemjs) {
74
+ if (buildConfig.systemjs) {
75
75
  console.time('Support native format of the SystemJS loader');
76
76
  await systemjs(buildConfig);
77
77
  console.timeEnd('Support native format of the SystemJS loader');
78
78
  }
79
79
 
80
- if (argv.core) {
80
+ if (buildConfig.core) {
81
81
  console.time('Create ESM bundle into core');
82
- const core = path.resolve(process.cwd(), argv.core);
82
+ const core = path.resolve(process.cwd(), buildConfig.core);
83
83
  await esm(buildConfig, core);
84
84
  console.timeEnd('Create ESM bundle into core');
85
85
  }
package/lib/config.js CHANGED
@@ -77,7 +77,7 @@ const config = ({
77
77
  let pkg = require(path.resolve(CWD, 'package.json')); // eslint-disable-line
78
78
  const corePkg = core ? require(path.resolve(core, 'package.json')) : null; // eslint-disable-line
79
79
  pkg = reactNative ? require(path.resolve(reactNativePath, 'package.json')) : pkg; // eslint-disable-line
80
- const { sourcemap, replacementStrings = {}, typescript } = argv;
80
+ const { sourcemap, replacementStrings = {}, typescript, preferBuiltins, browser } = argv;
81
81
  const banner = getBanner({ pkg });
82
82
  const outputName = getOutputName({ pkg, config: argv });
83
83
 
@@ -126,6 +126,8 @@ const config = ({
126
126
  }),
127
127
  nodeResolve({
128
128
  extensions,
129
+ browser,
130
+ preferBuiltins,
129
131
  }),
130
132
  commonjs({
131
133
  ignoreTryCatch: false, // Avoids problems with require() inside try catch (https://github.com/rollup/plugins/issues/1004)
@@ -149,7 +151,7 @@ const config = ({
149
151
  ],
150
152
  plugins: [[jsxPlugin]],
151
153
  }),
152
- sourcemaps(),
154
+ ...[sourcemap ? sourcemaps() : undefined],
153
155
  postcss({}),
154
156
  ...[typescript ? typescriptPlugin() : false],
155
157
  ...[
@@ -42,6 +42,18 @@ const options = {
42
42
  type: 'boolean',
43
43
  default: false,
44
44
  },
45
+ preferBuiltins: {
46
+ description:
47
+ 'In Rollup, preferBuiltins is a configuration option that specifies whether to use Node.js built-in modules (such as fs or path) when bundling for Node.js environment.',
48
+ type: 'boolean',
49
+ default: true,
50
+ },
51
+ browser: {
52
+ description:
53
+ 'In Rollup, the browser option is a configuration option that specifies whether the bundle is intended to run in a browser environment.',
54
+ type: 'boolean',
55
+ default: false,
56
+ },
45
57
  };
46
58
 
47
59
  // 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.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "QlikTech International AB",
@@ -44,5 +44,5 @@
44
44
  "tslib": "*",
45
45
  "typescript": ">=5.0.4"
46
46
  },
47
- "gitHead": "25856057bb28d545839e8118b0fd96db1af6f4aa"
47
+ "gitHead": "a00241510f1e1fd9a6bc94900204e70c55c0a065"
48
48
  }