nw-builder 4.16.2 → 4.17.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
@@ -194,7 +194,7 @@ Options
194
194
  | platform | `"linux" \| "osx" \| "win"` | | Host platform |
195
195
  | arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
196
196
  | downloadUrl | `"https://dl.nwjs.io" \| "https://npm.taobao.org/mirrors/nwjs" \| https://npmmirror.com/mirrors/nwjs \| "https://github.com/corwin-of-amber/nw.js/releases/"` | `"https://dl.nwjs.io"` | Download server. Supports file systems too (for example `file:///home/localghost/nwjs_mirror`) |
197
- | manifestUrl | `"https://nwjs.io/versions.json" \| "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json"` | `"https://nwjs.io/versions.json"` | Versions manifest |
197
+ | manifestUrl | `"https://nwjs.io/versions.json" \| "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json"` | `"https://nwjs.io/versions.json"` | Versions manifest URI, gotten via https or local file |
198
198
  | cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
199
199
  | cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. |
200
200
  | ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.16.2",
3
+ "version": "4.17.0",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -60,7 +60,7 @@
60
60
  "base-volta-off-of-nwjs": "^1.0.5",
61
61
  "eslint": "^9.39.2",
62
62
  "eslint-plugin-jsdoc": "^61.5.0",
63
- "globals": "^16.5.0",
63
+ "globals": "^17.0.0",
64
64
  "nw": "^0.106.1",
65
65
  "selenium-webdriver": "^4.39.0",
66
66
  "vitest": "^4.0.14"
@@ -78,6 +78,6 @@
78
78
  },
79
79
  "volta": {
80
80
  "node": "25.2.1",
81
- "npm": "11.6.4"
81
+ "npm": "11.7.0"
82
82
  }
83
83
  }
package/src/bld.js CHANGED
@@ -89,7 +89,7 @@ import setOsxConfig from './bld/osx.js';
89
89
  * @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
90
90
  * @property {"linux" | "osx" | "win"} [platform] Target platform
91
91
  * @property {"ia32" | "x64" | "arm64"} [arch] Target arch
92
- * @property {string} [manifestUrl = "https://nwjs.io/versions.json"] Manifest URL
92
+ * @property {string} [manifestUrl = "https://nwjs.io/versions.json"] Versions manifest URI, https or file path
93
93
  * @property {string} [srcDir = "./src"] Source directory
94
94
  * @property {string} [cacheDir = "./cache"] Cache directory
95
95
  * @property {string} [outDir = "./out"] Out directory
package/src/cli.js CHANGED
@@ -14,7 +14,7 @@ program
14
14
  .option('--platform <string>', 'NW.js supported platform', util.PLATFORM_KV[process.platform])
15
15
  .option('--arch <string>', 'NW.js supported architecture', util.ARCH_KV[process.arch])
16
16
  .option('--downloadUrl <string>', 'NW.js download server', 'https://dl.nwjs.io')
17
- .option('--manifestUrl <string>', 'NW.js version info', 'https://nwjs.io/versions.json')
17
+ .option('--manifestUrl <string>', 'NW.js versions manifest URI', 'https://nwjs.io/versions.json')
18
18
  .option('--cacheDir <string>', 'Cache NW.js binaries', './cache')
19
19
  .option('--outDir <string>', 'NW.js build artifacts', './out')
20
20
  .option('--app <object>', 'Platform specific app metadata. Refer to docs for more info', {})
package/src/index.js CHANGED
@@ -16,7 +16,7 @@ import util from './util.js';
16
16
  * @property {"linux" | "osx" | "win"} platform Host platform
17
17
  * @property {"ia32" | "x64" | "arm64"} arch Host architecture
18
18
  * @property {"https://dl.nwjs.io" | string} [downloadUrl="https://dl.nwjs.io"] Download server
19
- * @property {"https://nwjs.io/versions.json" | string} [manifestUrl="https://nwjs.io/versions.json"] Versions manifest
19
+ * @property {"https://nwjs.io/versions.json" | string} [manifestUrl="https://nwjs.io/versions.json"] Versions manifest URI, https or file path
20
20
  * @property {"./cache" | string} [cacheDir="./cache"] Directory to cache NW binaries
21
21
  * @property {"./" | string} [srcDir="./"] File paths to application code
22
22
  * @property {"./out" | string} [outDir="./out"] Directory to store build artifacts
package/src/util.js CHANGED
@@ -3,17 +3,23 @@ import fs from 'node:fs';
3
3
  import https from 'node:https';
4
4
  import path from 'node:path';
5
5
  import process from 'node:process';
6
+ import url from 'node:url';
6
7
 
7
8
  import * as GlobModule from 'glob';
8
9
 
9
10
  /**
10
11
  * Get manifest (array of NW release metadata) from URL.
11
- * @param {string} manifestUrl Url to manifest
12
- * @returns {Promise<string>} - Manifest object
12
+ * @param {string} manifestUrl Versions manifest URI, https or file path
13
+ * @returns {string} - Manifest object
13
14
  */
14
15
  function getManifest(manifestUrl) {
15
16
  let chunks = '';
16
17
 
18
+ if (manifestUrl.startsWith('file://')) {
19
+ const filePath = url.fileURLToPath(manifestUrl);
20
+ return fs.readFileSync(filePath, 'utf-8');
21
+ }
22
+
17
23
  return new Promise((resolve) => {
18
24
  const req = https.get(manifestUrl, (response) => {
19
25
  response.on('data', (chunk) => {
@@ -42,8 +48,8 @@ function getManifest(manifestUrl) {
42
48
  * @param {string} platform NW platform
43
49
  * @param {string} arch NW architecture
44
50
  * @param {string} cacheDir Directory to store NW binaries
45
- * @param {string} manifestUrl Url to manifest
46
- * @returns {object} Version specific release info
51
+ * @param {string} manifestUrl Versions manifest URI, https or file path
52
+ * @returns {Promise<object>} Version specific release info
47
53
  */
48
54
  async function getReleaseInfo(
49
55
  version,
@@ -343,8 +349,8 @@ export const validate = async (options, releaseInfo) => {
343
349
  if (typeof options.downloadUrl === 'string' && !options.downloadUrl.startsWith('http') && !options.downloadUrl.startsWith('file')) {
344
350
  throw new Error('Expected options.downloadUrl to be a string and starts with `http` or `file`.');
345
351
  }
346
- if (typeof options.manifestUrl === 'string' && !options.manifestUrl.startsWith('http') && !options.manifestUrl.startsWith('file')) {
347
- throw new Error('Expected options.manifestUrl to be a string and starts with `http` or `file`.');
352
+ if (typeof options.manifestUrl === 'string' && !options.manifestUrl.startsWith('https') && !options.manifestUrl.startsWith('file')) {
353
+ throw new Error('Expected options.manifestUrl to be a string and starts with `https` or `file`.');
348
354
  }
349
355
  if (typeof options.cacheDir !== 'string') {
350
356
  throw new Error('Expected options.cacheDir to be a string. Got ' + typeof options.cacheDir);
@@ -425,15 +431,15 @@ export const validate = async (options, releaseInfo) => {
425
431
  }
426
432
 
427
433
  if (typeof options.nativeAddon !== 'boolean') {
428
- throw new Error('Expected options.nativeAddon to be a boolean. Got ' + typeof options.nativeAddon);
434
+ throw new Error('Expected options.nativeAddon to be a boolean. Got ' + typeof options.nativeAddon);
429
435
  }
430
436
 
431
437
  if (typeof options.zip !== 'boolean' &
432
- options.zip !== 'zip' &&
433
- options.zip !== 'tar' &&
434
- options.zip !== 'tgz') {
435
- throw new Error('Expected options.zip to be a boolean, `zip`, `tar` or `tgz`. Got ' + typeof options.zip);
436
- }
438
+ options.zip !== 'zip' &&
439
+ options.zip !== 'tar' &&
440
+ options.zip !== 'tgz') {
441
+ throw new Error('Expected options.zip to be a boolean, `zip`, `tar` or `tgz`. Got ' + typeof options.zip);
442
+ }
437
443
 
438
444
  if (options.platform === 'linux') {
439
445
  if (options.app.name && typeof options.app.name !== 'string') {
@@ -664,4 +670,4 @@ function log(severity, logLevel, message) {
664
670
  return stdout;
665
671
  }
666
672
 
667
- export default { fileExists, getReleaseInfo, getPath, PLATFORM_KV, ARCH_KV, EXE_NAME, globFiles, getNodeManifest, parse, validate, log };
673
+ export default { fileExists, getReleaseInfo, getManifest, getPath, PLATFORM_KV, ARCH_KV, EXE_NAME, globFiles, getNodeManifest, parse, validate, log };