cross-spawn-esm 1.1.1 → 1.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/README.md CHANGED
@@ -8,8 +8,8 @@
8
8
  This is a "fork" of [cross-spawn](https://www.npmjs.com/package/cross-spawn?activeTab=readme) ( a cross-platform solution to node's spawn
9
9
  and spawnSync ) which ports its codebase to modern ESM and TypeScript.
10
10
 
11
- This package isn't a 100% drop-in replacement for **cross-spawn** ( the API differs slightly ) but it tries to behave the same as the
12
- original package. Please refer to the [Migration guide](#migration-guide) for further explanation.
11
+ This package is a drop-in replacement for **cross-spawn** which tries to behave the same as the original package. Please refer to the
12
+ [Migration guide](#migration-guide) for further explanation.
13
13
 
14
14
  ## Installation
15
15
 
@@ -60,7 +60,7 @@ const result = spawnSync("npm", ["list", "-g", "-depth", "0"], { stdio: "inherit
60
60
 
61
61
  ## Benefits
62
62
 
63
- - Overall smaller bundle size
63
+ - Overall smaller bundle size (**~50% smaller**)
64
64
  - Tree-shaking friendly
65
65
  - Zero dependencies
66
66
  - No need for an additional types package (`@types/cross-spawn`)
@@ -144,7 +144,7 @@ Beyond the API surface, a few implementation details intentionally differ:
144
144
 
145
145
  The following behaviors are intentionally kept identical to `cross-spawn`:
146
146
 
147
- - When `options.shell` is used, parsing, escaping, and shebang enhancements are disabled matching both the original and Node.js behavior.
147
+ - When `options.shell` is used, parsing, escaping, and shebang enhancements are disabled - matching both the original and Node.js behavior.
148
148
  - Windows-only ENOENT detection: when the process exits with code `1` and the command could not be resolved, an `error` event (async) or
149
149
  `result.error` (sync) is produced.
150
150
 
package/dist/index.d.ts CHANGED
@@ -159,7 +159,7 @@ interface PathKeyOptions {
159
159
  * const PATH = process.env[key];
160
160
  * //=> '/usr/local/bin:/usr/bin:/bin'
161
161
  */
162
- declare function pathKey({ env, platform }: PathKeyOptions): string;
162
+ declare function pathKey({ env, platform }?: PathKeyOptions): string;
163
163
  //#endregion
164
164
  //#region src/parse.d.ts
165
165
  /**
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ const executableRegExp = /\.(?:exe)$/i;
13
13
  const cmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
14
14
  //#endregion
15
15
  //#region src/utils/path-key.ts
16
- function pathKey({ env = _env, platform = _platform }) {
16
+ function pathKey({ env = _env, platform = _platform } = {}) {
17
17
  return platform === "win32" ? Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") ?? "Path" : "PATH";
18
18
  }
19
19
  //#endregion
@@ -39,7 +39,7 @@ function isExecutableMode(stat) {
39
39
  const { mode, uid, gid } = stat;
40
40
  return !!(mode & execOther || mode & execGroup && groups.has(gid) || mode & execOwner && uid === myUid || mode & execOwnerOrGroup && myUid === 0);
41
41
  }
42
- function isexeSync(file, { pathExt = process.env.PATHEXT ?? "" } = {}) {
42
+ function isexeSync(file, { pathExt = _env.PATHEXT ?? "" } = {}) {
43
43
  try {
44
44
  const stat = fs.statSync(file);
45
45
  if (!stat.isFile()) return false;
@@ -186,11 +186,11 @@ function parseNonShell(parsed) {
186
186
  return parsed;
187
187
  }
188
188
  function parse(command, args, options) {
189
- if (!Array.isArray(args)) {
189
+ if (args && !Array.isArray(args)) {
190
190
  options = args;
191
191
  args = [];
192
192
  }
193
- const argsCopy = args.slice(0);
193
+ const argsCopy = args ? args.slice(0) : [];
194
194
  options = Object.assign({}, options);
195
195
  const parsed = {
196
196
  command,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cross-spawn-esm",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.3",
5
5
  "description": "ESM version of cross-spawn package",
6
6
  "author": "Timur Bikmuhametov <tim.bic22@gmail.com>",
7
7
  "license": "MIT",
@@ -37,12 +37,15 @@
37
37
  "@timbic/prettier-config": "1.2.3",
38
38
  "@types/node": "26.6.1",
39
39
  "bumpp": "12.3.0",
40
- "eslint": "10.10.0",
40
+ "eslint": "10.11.0",
41
41
  "husky": "9.1.7",
42
42
  "lint-staged": "17.5.1",
43
- "prettier": "3.9.6",
43
+ "mkdirp": "3.0.1",
44
+ "prettier": "3.9.8",
45
+ "rimraf": "6.1.3",
44
46
  "tsdown": "0.23.0",
45
- "typescript": "6.0.3"
47
+ "typescript": "6.0.3",
48
+ "vitest": "5.0.1"
46
49
  },
47
50
  "lint-staged": {
48
51
  "*/**/*.{js,ts,md,json}": [
@@ -58,6 +61,8 @@
58
61
  "lint": "eslint --cache",
59
62
  "lint:fix": "eslint --cache --fix",
60
63
  "typecheck": "tsc --noEmit",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
61
66
  "release": "bumpp"
62
67
  }
63
68
  }