nw 0.87.0-3 → 0.87.0-4

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
@@ -66,6 +66,10 @@ Set `nwjs_native_addon` in `.npmrc` or `NWJS_NATIVE_ADDON` environment variable
66
66
 
67
67
  Set `nwjs_urlbase` in `.npmrc`or `NWJS_URLBASE` environment variable. Defaults to `https://dl.nwjs.io`. The file system (`file://`) is also supported (for example, `file:///home/localghost/local_mirror`).
68
68
 
69
+ ### Specify unref flag
70
+
71
+ Set `nwjs_unref` in `.npmrc` or `NWJS_UNREF` environment variable. Default to `false`. This is useful if you're using `nw` package to call the executable and want to prevent zombie processes eating up memory.
72
+
69
73
  ## Usage
70
74
 
71
75
  Add a script in your `package.json`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw",
3
- "version": "0.87.0-3",
3
+ "version": "0.87.0-4",
4
4
  "description": "An installer for nw.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,8 +34,8 @@
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
36
  "axios": "^1.6.8",
37
- "commander": "^12.0.0",
38
- "semver": "^7.6.1",
37
+ "commander": "^12.1.0",
38
+ "semver": "^7.6.2",
39
39
  "tar": "^7.1.0",
40
40
  "yauzl-promise": "^4.0.0"
41
41
  },
@@ -52,7 +52,7 @@
52
52
  "application"
53
53
  ],
54
54
  "devDependencies": {
55
- "selenium-webdriver": "^4.20.0",
55
+ "selenium-webdriver": "^4.21.0",
56
56
  "vitest": "^1.6.0"
57
57
  }
58
58
  }
package/src/parse.js CHANGED
@@ -18,7 +18,8 @@ import util from '../src/util.js';
18
18
  * @property {string} srcDir Source directory
19
19
  * @property {boolean} cache If false, remove cache and redownload.
20
20
  * @property {boolean} ffmpeg If true, ffmpeg is not downloaded.
21
- * @property {false | "gyp"} nativeAddon Rebuild native modules
21
+ * @property {false | "gyp"} nativeAddon Rebuild native modules
22
+ * @property {boolean} unref Unref the child process and unblock the caller
22
23
  */
23
24
 
24
25
  /**
@@ -73,6 +74,7 @@ export default async function parse(options) {
73
74
  options.cache = options.cache || process.env.npm_config_nwjs_cache || process.env.NWJS_CACHE || true;
74
75
  options.ffmpeg = options.ffmpeg || process.env.npm_config_nwjs_ffmpeg || process.env.NWJS_FFMPEG || false;
75
76
  options.nativeAddon = options.nativeAddon || process.env.npm_config_nwjs_native_addon || process.env.NWJS_NATIVE_ADDON || false;
77
+ options.unref = options.unref || process.env.npm_config_nwjs_unref || process.env.NWJS_UNREF || false;
76
78
 
77
79
  return { ...options };
78
80
  }
package/src/run.js CHANGED
@@ -13,6 +13,7 @@ import util from "./util.js";
13
13
  * @property {"ia32" | "x64" | "arm64"} [arch] Target arch
14
14
  * @property {string} [srcDir = "./src"] Source directory
15
15
  * @property {string} [cacheDir = "./cache"] Cache directory
16
+ * @property {boolean} [unref = false] Unref the child process and unblock the caller
16
17
  * @property {string[]} [args = []] Command line arguments
17
18
  */
18
19
 
@@ -32,6 +33,7 @@ async function run({
32
33
  arch = util.ARCH_KV[process.arch],
33
34
  srcDir = ".",
34
35
  cacheDir = "./cache",
36
+ unref = false,
35
37
  args = [],
36
38
  }) {
37
39
 
@@ -64,6 +66,10 @@ async function run({
64
66
  console.error(error);
65
67
  rej(error);
66
68
  });
69
+
70
+ if (unref) {
71
+ nwProcess.unref();
72
+ }
67
73
  });
68
74
  } catch (error) {
69
75
  console.error(error);