daemonize-process 4.1.1 → 4.1.3

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/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { SpawnOptions } from 'node:child_process';
1
+ import { SpawnOptions } from "node:child_process";
2
+ //#region index.d.ts
2
3
  type DaemonizeProcessOpts = {
3
- /** The path to the script to be executed. Default: The current script. */
4
- script?: string;
5
- /** The command line arguments to be used. Default: The current arguments. */
6
- arguments?: string[];
7
- /** The path to the Node.js binary to be used. Default: The current Node.js binary. */
8
- node?: string;
9
- /** The exit code to be used when exiting the parent process. Default: `0`. */
10
- exitCode?: number;
4
+ /** The path to the script to be executed. Default: The current script. */
5
+ script?: string;
6
+ /** The command line arguments to be used. Default: The current arguments. */
7
+ arguments?: string[];
8
+ /** The path to the Node.js binary to be used. Default: The current Node.js binary. */
9
+ node?: string;
10
+ /** The exit code to be used when exiting the parent process. Default: `0`. */
11
+ exitCode?: number;
11
12
  } & SpawnOptions;
12
13
  export declare function daemonizeProcess(opts?: DaemonizeProcessOpts): void;
13
- export {};
14
- //# sourceMappingURL=index.d.ts.map
14
+ //#endregion
package/dist/index.js CHANGED
@@ -1,29 +1,27 @@
1
1
  import { spawn } from "node:child_process";
2
- import { env, argv, cwd, execPath, exit } from "node:process";
2
+ import { argv, cwd, env, execPath, exit } from "node:process";
3
+
4
+ //#region index.ts
3
5
  const id = "_DAEMONIZE_PROCESS";
4
6
  function daemonizeProcess(opts = {}) {
5
- if (id in env) {
6
- delete env[id];
7
- } else {
8
- const o = {
9
- // spawn options
10
- env: Object.assign(env, opts.env, { [id]: "1" }),
11
- cwd: cwd(),
12
- stdio: "ignore",
13
- detached: true,
14
- // custom options
15
- node: execPath,
16
- script: argv[1],
17
- arguments: argv.slice(2),
18
- exitCode: 0,
19
- ...opts
20
- };
21
- const args = [o.script, ...o.arguments];
22
- const proc = spawn(o.node, args, o);
23
- proc?.unref?.();
24
- exit(o.exitCode);
25
- }
7
+ if (id in env) delete env[id];
8
+ else {
9
+ const o = {
10
+ env: Object.assign(env, opts.env, { [id]: "1" }),
11
+ cwd: cwd(),
12
+ stdio: "ignore",
13
+ detached: true,
14
+ node: execPath,
15
+ script: argv[1],
16
+ arguments: argv.slice(2),
17
+ exitCode: 0,
18
+ ...opts
19
+ };
20
+ const args = [o.script, ...o.arguments];
21
+ spawn(o.node, args, o)?.unref?.();
22
+ exit(o.exitCode);
23
+ }
26
24
  }
27
- export {
28
- daemonizeProcess
29
- };
25
+
26
+ //#endregion
27
+ export { daemonizeProcess };
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "daemonize-process",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "Daemonize the current Node.js process",
5
5
  "author": "silverwind <me@silverwind.io>",
6
- "repository": "silverwind/daemonize-process",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/silverwind/daemonize-process.git"
9
+ },
7
10
  "license": "BSD-2-Clause",
8
11
  "type": "module",
9
12
  "sideEffects": false,
@@ -14,20 +17,22 @@
14
17
  "dist"
15
18
  ],
16
19
  "engines": {
17
- "node": ">=18"
20
+ "node": ">=18",
21
+ "bun": "*"
18
22
  },
19
23
  "devDependencies": {
20
- "@types/node": "22.13.4",
21
- "eslint": "8.57.0",
22
- "eslint-config-silverwind": "99.0.0",
23
- "eslint-config-silverwind-typescript": "9.2.2",
24
- "jest-extended": "4.0.2",
25
- "typescript": "5.7.3",
26
- "typescript-config-silverwind": "7.0.0",
27
- "updates": "16.4.2",
28
- "versions": "12.1.3",
29
- "vite": "6.1.0",
30
- "vite-config-silverwind": "4.0.0",
31
- "vitest": "3.0.5"
24
+ "@types/node": "26.6.2",
25
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
26
+ "eslint": "9.39.2",
27
+ "eslint-config-silverwind": "151.0.0",
28
+ "jest-extended": "7.0.0",
29
+ "tsdown": "0.23.0",
30
+ "tsdown-config-silverwind": "4.1.1",
31
+ "typescript": "6.0.3",
32
+ "typescript-config-silverwind": "21.0.0",
33
+ "updates": "19.0.0",
34
+ "updates-config-silverwind": "4.0.6",
35
+ "versions": "15.5.0",
36
+ "vitest": "5.0.2"
32
37
  }
33
- }
38
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIrD,KAAK,oBAAoB,GAAG;IAC1B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,YAAY,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,oBAAyB,QAyB/D"}