nw-builder 4.16.0 → 4.16.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
@@ -122,7 +122,7 @@ Get Node headers if you have to rebuild Node addons.
122
122
  ```javascript
123
123
  nwbuild({
124
124
  mode: "get",
125
- nativeAddon: "gyp"
125
+ nativeAddon: true,
126
126
  });
127
127
  ```
128
128
 
@@ -182,27 +182,6 @@ nwbuild({
182
182
  });
183
183
  ```
184
184
 
185
- #### Rebuild Node addons
186
-
187
- > Currently this feature is disabled and it may be removed in the future.
188
-
189
- It only builds node addons which have a `binding.gyp` file in the `srcDir`. There are plans to support nan, cmake, ffi and gn and auto rebuild native addons which are installed as node modules.
190
-
191
- ```javascript
192
- nwbuild({
193
- mode: "build",
194
- nodeAddon: "gyp",
195
- });
196
- ```
197
-
198
- We recommend rebuilding Node addons for NW.js via `node-gyp` if you are using NW.js v0.83.0 or above.
199
-
200
- ```shell
201
- node-gyp rebuild --target=22.2.0 --nodedir=/path/to/nw/node/headers
202
- ```
203
-
204
- NW.js's Node version should match the Node version on the host machine due to [ABI differences in V8](https://github.com/nwjs/nw.js/issues/5025).
205
-
206
185
  ## API Reference
207
186
 
208
187
  Options
@@ -226,7 +205,7 @@ Options
226
205
  | glob | `boolean` | `true`| If true file globbing is enabled when parsing `srcDir`. |
227
206
  | outDir | `string` | `"./out"` | Directory to store build artifacts |
228
207
  | managedManifest | `boolean \| string \| object` | `false` | Managed manifest |
229
- | nodeAddon | `false \| "gyp"` | `false` | Rebuild Node native addons |
208
+ | nodeAddon | `boolean` | `false` | Rebuild Node native addons |
230
209
  | zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false`| If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
231
210
  | app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.)
232
211
 
@@ -343,18 +322,6 @@ nwbuild({
343
322
  });
344
323
  ```
345
324
 
346
- ### Let `nw-builder` manage your native addons
347
-
348
- > Note: this behaviour is buggy and quite limited. This guide is to show what will be possible in the coming minor releases.
349
-
350
- ```javascript
351
- nwbuild({
352
- mode: "build",
353
- managedManifest: true,
354
- nativeAddon: "gyp",
355
- });
356
- ```
357
-
358
325
  ## Contributing
359
326
 
360
327
  ### External contributor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.16.0",
3
+ "version": "4.16.2",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -55,30 +55,29 @@
55
55
  "demo:cli": "nwbuild --mode=build --flavor=sdk --glob=false --cacheDir=./node_modules/nw --logLevel=debug --managedManifest=./tests/fixtures/app/package.json --outDir=./tests/fixtures/out/linux --app.name=Demo --app.icon=./tests/fixtures/app/icon.png ./tests/fixtures/app"
56
56
  },
57
57
  "devDependencies": {
58
- "@eslint/js": "^9.37.0",
59
- "@vitest/coverage-v8": "^3.2.4",
58
+ "@eslint/js": "^9.39.2",
59
+ "@vitest/coverage-v8": "^4.0.16",
60
60
  "base-volta-off-of-nwjs": "^1.0.5",
61
- "eslint": "^9.37.0",
62
- "eslint-plugin-jsdoc": "^60.8.1",
63
- "globals": "^16.4.0",
64
- "nw": "^0.104.0",
65
- "selenium-webdriver": "^4.36.0",
66
- "vitest": "^3.0.7"
61
+ "eslint": "^9.39.2",
62
+ "eslint-plugin-jsdoc": "^61.5.0",
63
+ "globals": "^16.5.0",
64
+ "nw": "^0.106.1",
65
+ "selenium-webdriver": "^4.39.0",
66
+ "vitest": "^4.0.14"
67
67
  },
68
68
  "dependencies": {
69
69
  "archiver": "^7.0.1",
70
- "axios": "^1.12.2",
71
- "commander": "^14.0.1",
72
- "glob": "^11.0.3",
73
- "node-gyp": "^11.4.2",
70
+ "axios": "^1.13.2",
71
+ "commander": "^14.0.2",
72
+ "glob": "^13.0.0",
74
73
  "plist": "^3.1.0",
75
- "resedit": "^2.0.3",
76
- "semver": "^7.7.2",
77
- "tar": "^7.5.1",
74
+ "resedit": "^3.0.1",
75
+ "semver": "^7.7.3",
76
+ "tar": "^7.5.2",
78
77
  "yauzl-promise": "^4.0.0"
79
78
  },
80
79
  "volta": {
81
- "node": "24.7.0",
82
- "npm": "11.5.2"
80
+ "node": "25.2.1",
81
+ "npm": "11.6.4"
83
82
  }
84
83
  }
package/src/bld.js CHANGED
@@ -96,7 +96,6 @@ import setOsxConfig from './bld/osx.js';
96
96
  * @property {LinuxRc | WinRc | OsxRc} [app] Platform specific rc
97
97
  * @property {boolean} [glob = true] File globbing
98
98
  * @property {boolean | string | object} [managedManifest = false] Manage manifest
99
- * @property {false | "gyp"} [nativeAddon = false] Rebuild native modules
100
99
  * @property {false | "zip" | "tar" | "tgz"} [zip = false] Compress built artifacts
101
100
  * @property {object} [releaseInfo = {}] Version specific release metadata.
102
101
  */
@@ -119,7 +118,6 @@ async function bld({
119
118
  app,
120
119
  glob = true,
121
120
  managedManifest = false,
122
- nativeAddon = false,
123
121
  zip = false,
124
122
  releaseInfo = {},
125
123
  }) {
@@ -190,11 +188,6 @@ async function bld({
190
188
  await setOsxConfig({ app, outDir, releaseInfo });
191
189
  }
192
190
 
193
- if (nativeAddon === 'gyp') {
194
- throw new Error('Rebuilding Node addons functionality is broken and has been disabled. This functionality may be removed in the future.');
195
- // buildNativeAddon({ cacheDir, version, platform, arch, outDir, nodeVersion });
196
- }
197
-
198
191
  if (zip !== false) {
199
192
  await compress({ zip, outDir });
200
193
  }
@@ -354,20 +347,6 @@ const setWinConfig = async ({ app, outDir }) => {
354
347
  await fs.promises.writeFile(outDirAppExe, outBuffer);
355
348
  };
356
349
 
357
- /*
358
- const buildNativeAddon = ({ cacheDir, version, platform, arch, outDir, nodeVersion }) => {
359
- let nodePath = path.resolve(cacheDir, `node-v${version}-${platform}-${arch}`);
360
- const cwd = path.resolve(
361
- outDir,
362
- platform !== 'osx'
363
- ? 'package.nw'
364
- : 'nwjs.app/Contents/Resources/app.nw',
365
- );
366
-
367
- child_process.execFileSync('node-gyp', ['rebuild', `--target=${nodeVersion}`, `--nodedir=${nodePath}`], { cwd });
368
- };
369
- */
370
-
371
350
  const compress = async ({
372
351
  zip,
373
352
  outDir,
package/src/cli.js CHANGED
@@ -22,7 +22,7 @@ program
22
22
  .option('--ffmpeg <boolean>', 'Enable/disable community ffmpeg', false)
23
23
  .option('--glob <boolean>', 'Enable/disable globbing', true)
24
24
  .option('--logLevel <string>', 'Specify log level', 'info')
25
- .option('--shaSum <string>', 'Enable/disable shasum', true)
25
+ .option('--shaSum <boolean>', 'Enable/disable shasum', true)
26
26
  .option('--zip <string>', 'Enable/disable compression', false)
27
27
  .option('--managedManifest <string>', 'Managed manifest mode', false)
28
28
  .option('--nodeAddon <boolean>', 'Download NW.js Node headers', false)
package/src/get/index.js CHANGED
@@ -20,7 +20,7 @@ import util from '../util.js';
20
20
  * @property {string} [cacheDir = "./cache"] Cache directory
21
21
  * @property {boolean} [cache = true] If false, remove cache and redownload.
22
22
  * @property {boolean} [ffmpeg = false] If true, ffmpeg is not downloaded.
23
- * @property {false | "gyp"} [nativeAddon = false] Rebuild native modules
23
+ * @property {boolean} [nativeAddon = false] Download Node headers for native addons.
24
24
  * @property {string} [logLevel = 'info'] User defined log level.
25
25
  * @property {boolean} [shaSum = true] If true shasum is enabled, otherwise disabled.
26
26
  */
@@ -183,7 +183,7 @@ async function get(options) {
183
183
 
184
184
  }
185
185
 
186
- if (options.nativeAddon === 'gyp') {
186
+ if (options.nativeAddon === true) {
187
187
 
188
188
  /**
189
189
  * File path to NW'js Node headers tarball.
package/src/index.js CHANGED
@@ -28,7 +28,7 @@ import util from './util.js';
28
28
  * @property {boolean} [shaSum = true] If true, shasum is enabled. Otherwise, disabled.
29
29
  * @property {boolean | "zip" | "tar" | "tgz"} [zip=false] If true, "zip", "tar" or "tgz" the outDir directory is compressed.
30
30
  * @property {boolean | string | object} [managedManifest = false] Managed manifest mode
31
- * @property {false | "gyp"} [nodeAddon = false] Rebuild Node native addons
31
+ * @property {boolean} [nodeAddon = false] Get Node native addons
32
32
  * @property {boolean} [cli=false] If true the CLI is used to parse options. This option is used internally.
33
33
  */
34
34
 
@@ -139,7 +139,6 @@ async function nwbuild(options) {
139
139
  app: options.app,
140
140
  glob: options.glob,
141
141
  managedManifest: options.managedManifest,
142
- nativeAddon: options.nativeAddon,
143
142
  zip: options.zip,
144
143
  releaseInfo: releaseInfo,
145
144
  });
package/src/util.js CHANGED
@@ -5,7 +5,6 @@ import path from 'node:path';
5
5
  import process from 'node:process';
6
6
 
7
7
  import * as GlobModule from 'glob';
8
- import semver from 'semver';
9
8
 
10
9
  /**
11
10
  * Get manifest (array of NW release metadata) from URL.
@@ -209,7 +208,7 @@ export const parse = async (options, pkg) => {
209
208
  options.cache = str2Bool(options.cache ?? true);
210
209
  options.ffmpeg = str2Bool(options.ffmpeg ?? false);
211
210
  options.logLevel = options.logLevel ?? 'info';
212
- options.shaSum = options.shaSum ?? true;
211
+ options.shaSum = str2Bool(options.shaSum ?? true);
213
212
 
214
213
  if (options.mode === 'get') {
215
214
  return { ...options };
@@ -426,21 +425,15 @@ export const validate = async (options, releaseInfo) => {
426
425
  }
427
426
 
428
427
  if (typeof options.nativeAddon !== 'boolean') {
429
- if (typeof options.nativeAddon !== 'boolean' && typeof options.nativeAddon !== 'string') {
430
- throw new Error('Expected options.nativeAddon to be a boolean or string type. Got ' + typeof options.nativeAddon);
431
- }
432
-
433
- if (semver.parse(options.version).minor >= '83' && options.nativeAddon !== false) {
434
- throw new Error('Native addons are not supported for NW.js v0.82.0 and below');
435
- }
428
+ throw new Error('Expected options.nativeAddon to be a boolean. Got ' + typeof options.nativeAddon);
429
+ }
436
430
 
437
- if (typeof options.zip !== 'boolean' &
431
+ if (typeof options.zip !== 'boolean' &
438
432
  options.zip !== 'zip' &&
439
433
  options.zip !== 'tar' &&
440
434
  options.zip !== 'tgz') {
441
435
  throw new Error('Expected options.zip to be a boolean, `zip`, `tar` or `tgz`. Got ' + typeof options.zip);
442
436
  }
443
- }
444
437
 
445
438
  if (options.platform === 'linux') {
446
439
  if (options.app.name && typeof options.app.name !== 'string') {