@alphahydrae/exec 1.1.0 → 2.0.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
@@ -41,7 +41,7 @@ npm i @alphahydrae/exec
41
41
 
42
42
  ## Support matrix
43
43
 
44
- | OS & Architecture | Node.js 18 | Node.js 20 | Node.js 22 |
44
+ | OS & Architecture | Node.js 20 | Node.js 22 | Node.js 24 |
45
45
  | :---------------- | :--------: | :--------: | :--------: |
46
46
  | macOS x64 | ✅ | ✅ | ✅ |
47
47
  | macOS arm64 | ✅ | ✅ | ✅ |
package/exec.d.ts CHANGED
@@ -1,18 +1,29 @@
1
+ export type ExecvpOptions = {
2
+ readonly arg0?: string | null;
3
+ };
4
+
1
5
  /**
2
6
  * Performs the execvp system call with the given file and arguments, replacing
3
7
  * the current process image with the new one.
4
8
  *
5
- * execvp('ls', ['-l', '.']);
6
- *
7
- * This function does not return if successful, as the current process is
9
+ * This function does not return if successful, as the current process image is
8
10
  * replaced by the new one. An error may be thrown, with an error message
9
11
  * containing the error code returned by execvp.
10
12
  *
13
+ * @example
14
+ * import { execvp } from '@alphahydrae/exec';
15
+ * execvp('ls', ['-l', '.']);
16
+ *
11
17
  * @param {string} file The file to execute. If not a path, the PATH environment
12
18
  * variable is searched.
13
- * @param {string[]} args The arguments to pass to the new process.
14
- * `process.argv0` is automatically prepended to the
15
- * arguments.
19
+ * @param {string[]} args The arguments to pass to the new process. The `file`
20
+ * argument is automatically prepended to the arguments
21
+ * and passed as the first argument to the `execvp`
22
+ * system call.
23
+ * @param {Object} [options] Optional options.
24
+ * @param {string} [options.arg0=file] The value to pass as the first argument
25
+ * to the `execvp` system call. Defaults to
26
+ * the `file` argument.
16
27
  * @throws {Error} If the execvp system call fails.
17
28
  */
18
- export declare function execvp(file: string, args: string[]): void;
29
+ export declare function execvp(file: string, args: string[], options?: ExecvpOptions): void;
package/index.d.ts CHANGED
@@ -18,13 +18,13 @@
18
18
  *
19
19
  * @example
20
20
  * import { execvp } from '@alphahydrae/exec';
21
- * execvp('ls', ['ls', '-l', '.']);
21
+ * execvp('ls', ['/bin/ls', '-l', '.']);
22
22
  *
23
23
  * @param {string} file The file to execute. If not a path, the PATH environment
24
24
  * variable is searched.
25
25
  * @param {string[]} args The arguments to pass to the new process. Note that
26
- * the first argument should be the name of the file
27
- * being executed.
26
+ * the first argument, by convention, should point to
27
+ * the filename associated with the file being executed.
28
28
  * @throws {Error} If the execvp system call fails.
29
29
  */
30
30
  export declare function execvp(file: string, args: Array<string>): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphahydrae/exec",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "The execvp function for Node.js",
5
5
  "main": "exec.js",
6
6
  "repository": {
@@ -38,9 +38,10 @@
38
38
  "build": "napi build --platform --release",
39
39
  "build:debug": "napi build --platform",
40
40
  "build:package": "node scripts/build-packages.mjs",
41
- "check": "npm run lint && npm run format",
42
- "check:write": "npm run lint && npm run format:write",
41
+ "check": "npm test && npm run lint && npm run format",
42
+ "check:write": "npm test && npm run lint && npm run format:write",
43
43
  "doctoc": "doctoc --github --notitle README.md && prettier --write README.md",
44
+ "docs": "jsdoc --destination docs --readme README.md exec.js",
44
45
  "format": "npm run format:cargo && npm run format:prettier",
45
46
  "format:cargo": "cargo fmt --check",
46
47
  "format:cargo:write": "cargo fmt",
@@ -59,19 +60,20 @@
59
60
  "chalk": "^5.3.0",
60
61
  "doctoc": "^2.2.1",
61
62
  "jest": "^29.7.0",
63
+ "jsdoc": "^4.0.4",
62
64
  "npm-run-all2": "^7.0.0",
63
65
  "prettier": "^3.4.2",
64
66
  "typescript": "^5.5.3"
65
67
  },
66
68
  "engines": {
67
- "node": "^18 || ^20 || ^22"
69
+ "node": "^20 || ^22 || ^24"
68
70
  },
69
71
  "optionalDependencies": {
70
- "@alphahydrae/exec-darwin-x64": "1.1.0",
71
- "@alphahydrae/exec-linux-x64-gnu": "1.1.0",
72
- "@alphahydrae/exec-linux-x64-musl": "1.1.0",
73
- "@alphahydrae/exec-darwin-arm64": "1.1.0",
74
- "@alphahydrae/exec-linux-arm64-gnu": "1.1.0",
75
- "@alphahydrae/exec-linux-arm64-musl": "1.1.0"
72
+ "@alphahydrae/exec-darwin-x64": "2.0.0",
73
+ "@alphahydrae/exec-linux-x64-gnu": "2.0.0",
74
+ "@alphahydrae/exec-linux-x64-musl": "2.0.0",
75
+ "@alphahydrae/exec-darwin-arm64": "2.0.0",
76
+ "@alphahydrae/exec-linux-arm64-gnu": "2.0.0",
77
+ "@alphahydrae/exec-linux-arm64-musl": "2.0.0"
76
78
  }
77
79
  }