cross-spawn-cb 2.4.14 → 2.5.1
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/cjs/compat.d.cts +6 -0
- package/dist/cjs/compat.d.ts +6 -0
- package/dist/cjs/compat.js +47 -0
- package/dist/cjs/compat.js.map +1 -0
- package/dist/cjs/constants.d.cts +1 -0
- package/dist/cjs/constants.d.ts +1 -0
- package/dist/cjs/constants.js +12 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/crossSpawn.js +2 -1
- package/dist/cjs/crossSpawn.js.map +1 -1
- package/dist/cjs/shim/enoent.d.cts +10 -0
- package/dist/cjs/shim/enoent.d.ts +10 -0
- package/dist/cjs/shim/enoent.js +93 -0
- package/dist/cjs/shim/enoent.js.map +1 -0
- package/dist/cjs/shim/escape.d.cts +6 -0
- package/dist/cjs/shim/escape.d.ts +6 -0
- package/dist/cjs/shim/escape.js +45 -0
- package/dist/cjs/shim/escape.js.map +1 -0
- package/dist/cjs/shim/index.d.cts +25 -0
- package/dist/cjs/shim/index.d.ts +25 -0
- package/dist/cjs/shim/index.js +65 -0
- package/dist/cjs/shim/index.js.map +1 -0
- package/dist/cjs/shim/parse.d.cts +6 -0
- package/dist/cjs/shim/parse.d.ts +6 -0
- package/dist/cjs/shim/parse.js +120 -0
- package/dist/cjs/shim/parse.js.map +1 -0
- package/dist/cjs/shim/resolve.d.cts +6 -0
- package/dist/cjs/shim/resolve.d.ts +6 -0
- package/dist/cjs/shim/resolve.js +78 -0
- package/dist/cjs/shim/resolve.js.map +1 -0
- package/dist/cjs/shim/shebang.d.cts +5 -0
- package/dist/cjs/shim/shebang.d.ts +5 -0
- package/dist/cjs/shim/shebang.js +43 -0
- package/dist/cjs/shim/shebang.js.map +1 -0
- package/dist/cjs/shim/types.d.cts +24 -0
- package/dist/cjs/shim/types.d.ts +24 -0
- package/dist/cjs/shim/types.js +7 -0
- package/dist/cjs/shim/types.js.map +1 -0
- package/dist/esm/compat.d.ts +6 -0
- package/dist/esm/compat.js +28 -0
- package/dist/esm/compat.js.map +1 -0
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/crossSpawn.js +2 -1
- package/dist/esm/crossSpawn.js.map +1 -1
- package/dist/esm/shim/enoent.d.ts +10 -0
- package/dist/esm/shim/enoent.js +38 -0
- package/dist/esm/shim/enoent.js.map +1 -0
- package/dist/esm/shim/escape.d.ts +6 -0
- package/dist/esm/shim/escape.js +26 -0
- package/dist/esm/shim/escape.js.map +1 -0
- package/dist/esm/shim/index.d.ts +25 -0
- package/dist/esm/shim/index.js +37 -0
- package/dist/esm/shim/index.js.map +1 -0
- package/dist/esm/shim/parse.d.ts +6 -0
- package/dist/esm/shim/parse.js +102 -0
- package/dist/esm/shim/parse.js.map +1 -0
- package/dist/esm/shim/resolve.d.ts +6 -0
- package/dist/esm/shim/resolve.js +63 -0
- package/dist/esm/shim/resolve.js.map +1 -0
- package/dist/esm/shim/shebang.d.ts +5 -0
- package/dist/esm/shim/shebang.js +27 -0
- package/dist/esm/shim/shebang.js.map +1 -0
- package/dist/esm/shim/types.d.ts +24 -0
- package/dist/esm/shim/types.js +3 -0
- package/dist/esm/shim/types.js.map +1 -0
- package/package.json +15 -14
- package/assets/cross-spawn.cjs +0 -1947
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command resolution using which
|
|
3
|
+
* Simplified from cross-spawn v6.0.5
|
|
4
|
+
*/ import envPathKey from 'env-path-key';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import which from 'which';
|
|
7
|
+
import { isWindows } from '../constants.js';
|
|
8
|
+
const pathDelimiter = isWindows ? ';' : ':';
|
|
9
|
+
const NODES = [
|
|
10
|
+
'node',
|
|
11
|
+
'node.exe',
|
|
12
|
+
'node.cmd'
|
|
13
|
+
];
|
|
14
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
15
|
+
const command = parsed.command;
|
|
16
|
+
const options = parsed.options;
|
|
17
|
+
const env = options.env || process.env;
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
const hasCustomCwd = options.cwd != null;
|
|
20
|
+
// Handle NODE/npm_node_execpath env vars for node commands
|
|
21
|
+
// This is needed because shebang detection may change the command to 'node'
|
|
22
|
+
// after the initial NODE env check in crossSpawn.ts has already passed
|
|
23
|
+
if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {
|
|
24
|
+
const nodeFromEnv = env.NODE || env.npm_node_execpath;
|
|
25
|
+
if (nodeFromEnv) {
|
|
26
|
+
return nodeFromEnv;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// If a custom cwd was specified, we need to change the process cwd
|
|
30
|
+
// because which will do stat calls but does not support a custom cwd
|
|
31
|
+
if (hasCustomCwd) {
|
|
32
|
+
try {
|
|
33
|
+
process.chdir(options.cwd);
|
|
34
|
+
} catch (_err) {
|
|
35
|
+
/* ignore */ }
|
|
36
|
+
}
|
|
37
|
+
let resolved = null;
|
|
38
|
+
const pathKey = envPathKey({
|
|
39
|
+
env: options.env || process.env
|
|
40
|
+
}) || 'PATH';
|
|
41
|
+
try {
|
|
42
|
+
resolved = which.sync(command, {
|
|
43
|
+
path: (options.env || process.env)[pathKey],
|
|
44
|
+
// On Windows: undefined uses PATHEXT, pathDelimiter bypasses it
|
|
45
|
+
// withoutPathExt fallback is needed to find files without extensions
|
|
46
|
+
pathExt: withoutPathExt ? pathDelimiter : undefined
|
|
47
|
+
});
|
|
48
|
+
} catch (_e) {
|
|
49
|
+
/* not found */ } finally{
|
|
50
|
+
if (hasCustomCwd) {
|
|
51
|
+
process.chdir(cwd);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Ensure absolute path
|
|
55
|
+
if (resolved) {
|
|
56
|
+
resolved = path.resolve(hasCustomCwd ? options.cwd : '', resolved);
|
|
57
|
+
}
|
|
58
|
+
return resolved;
|
|
59
|
+
}
|
|
60
|
+
// Try twice: first with PATHEXT (finds .cmd/.bat/.exe), then without (finds extensionless files)
|
|
61
|
+
export function resolveCommand(parsed) {
|
|
62
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/shim/resolve.ts"],"sourcesContent":["/**\n * Command resolution using which\n * Simplified from cross-spawn v6.0.5\n */\n\nimport envPathKey from 'env-path-key';\nimport path from 'path';\nimport which from 'which';\nimport { isWindows } from '../constants.ts';\nimport type { Parsed } from './types.ts';\n\nconst pathDelimiter = isWindows ? ';' : ':';\nconst NODES = ['node', 'node.exe', 'node.cmd'];\n\nfunction resolveCommandAttempt(parsed: Parsed, withoutPathExt?: boolean): string | null {\n const command = parsed.command;\n const options = parsed.options;\n const env = options.env || process.env;\n const cwd = process.cwd();\n const hasCustomCwd = options.cwd != null;\n\n // Handle NODE/npm_node_execpath env vars for node commands\n // This is needed because shebang detection may change the command to 'node'\n // after the initial NODE env check in crossSpawn.ts has already passed\n if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {\n const nodeFromEnv = env.NODE || env.npm_node_execpath;\n if (nodeFromEnv) {\n return nodeFromEnv;\n }\n }\n\n // If a custom cwd was specified, we need to change the process cwd\n // because which will do stat calls but does not support a custom cwd\n if (hasCustomCwd) {\n try {\n process.chdir(options.cwd as string);\n } catch (_err) {\n /* ignore */\n }\n }\n\n let resolved: string | null = null;\n const pathKey = envPathKey({ env: options.env || process.env }) || 'PATH';\n\n try {\n resolved = which.sync(command, {\n path: (options.env || process.env)[pathKey],\n // On Windows: undefined uses PATHEXT, pathDelimiter bypasses it\n // withoutPathExt fallback is needed to find files without extensions\n pathExt: withoutPathExt ? pathDelimiter : undefined,\n });\n } catch (_e) {\n /* not found */\n } finally {\n if (hasCustomCwd) {\n process.chdir(cwd);\n }\n }\n\n // Ensure absolute path\n if (resolved) {\n resolved = path.resolve(hasCustomCwd ? (options.cwd as string) : '', resolved);\n }\n\n return resolved;\n}\n\n// Try twice: first with PATHEXT (finds .cmd/.bat/.exe), then without (finds extensionless files)\nexport function resolveCommand(parsed: Parsed): string | null {\n return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);\n}\n"],"names":["envPathKey","path","which","isWindows","pathDelimiter","NODES","resolveCommandAttempt","parsed","withoutPathExt","command","options","env","process","cwd","hasCustomCwd","indexOf","basename","toLowerCase","nodeFromEnv","NODE","npm_node_execpath","chdir","_err","resolved","pathKey","sync","pathExt","undefined","_e","resolve","resolveCommand"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,gBAAgB,eAAe;AACtC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,QAAQ;AAC1B,SAASC,SAAS,QAAQ,kBAAkB;AAG5C,MAAMC,gBAAgBD,YAAY,MAAM;AACxC,MAAME,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAE9C,SAASC,sBAAsBC,MAAc,EAAEC,cAAwB;IACrE,MAAMC,UAAUF,OAAOE,OAAO;IAC9B,MAAMC,UAAUH,OAAOG,OAAO;IAC9B,MAAMC,MAAMD,QAAQC,GAAG,IAAIC,QAAQD,GAAG;IACtC,MAAME,MAAMD,QAAQC,GAAG;IACvB,MAAMC,eAAeJ,QAAQG,GAAG,IAAI;IAEpC,2DAA2D;IAC3D,4EAA4E;IAC5E,uEAAuE;IACvE,IAAIR,MAAMU,OAAO,CAACd,KAAKe,QAAQ,CAACP,SAASQ,WAAW,OAAO,GAAG;QAC5D,MAAMC,cAAcP,IAAIQ,IAAI,IAAIR,IAAIS,iBAAiB;QACrD,IAAIF,aAAa;YACf,OAAOA;QACT;IACF;IAEA,mEAAmE;IACnE,qEAAqE;IACrE,IAAIJ,cAAc;QAChB,IAAI;YACFF,QAAQS,KAAK,CAACX,QAAQG,GAAG;QAC3B,EAAE,OAAOS,MAAM;QACb,UAAU,GACZ;IACF;IAEA,IAAIC,WAA0B;IAC9B,MAAMC,UAAUxB,WAAW;QAAEW,KAAKD,QAAQC,GAAG,IAAIC,QAAQD,GAAG;IAAC,MAAM;IAEnE,IAAI;QACFY,WAAWrB,MAAMuB,IAAI,CAAChB,SAAS;YAC7BR,MAAM,AAACS,CAAAA,QAAQC,GAAG,IAAIC,QAAQD,GAAG,AAAD,CAAE,CAACa,QAAQ;YAC3C,gEAAgE;YAChE,qEAAqE;YACrEE,SAASlB,iBAAiBJ,gBAAgBuB;QAC5C;IACF,EAAE,OAAOC,IAAI;IACX,aAAa,GACf,SAAU;QACR,IAAId,cAAc;YAChBF,QAAQS,KAAK,CAACR;QAChB;IACF;IAEA,uBAAuB;IACvB,IAAIU,UAAU;QACZA,WAAWtB,KAAK4B,OAAO,CAACf,eAAgBJ,QAAQG,GAAG,GAAc,IAAIU;IACvE;IAEA,OAAOA;AACT;AAEA,iGAAiG;AACjG,OAAO,SAASO,eAAevB,MAAc;IAC3C,OAAOD,sBAAsBC,WAAWD,sBAAsBC,QAAQ;AACxE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shebang detection for cross-platform script execution
|
|
3
|
+
* Extracted from cross-spawn v6.0.5
|
|
4
|
+
*/ import fs from 'fs';
|
|
5
|
+
import { allocBuffer } from '../compat.js';
|
|
6
|
+
const shebangRegex = /^#!.*/;
|
|
7
|
+
function parseShebang(str) {
|
|
8
|
+
const match = str.match(shebangRegex);
|
|
9
|
+
if (!match) return null;
|
|
10
|
+
const arr = match[0].replace(/#! ?/, '').split(' ');
|
|
11
|
+
const bin = arr[0].split('/').pop();
|
|
12
|
+
const arg = arr[1];
|
|
13
|
+
return bin === 'env' ? arg : bin + (arg ? ` ${arg}` : '');
|
|
14
|
+
}
|
|
15
|
+
export function readShebang(command) {
|
|
16
|
+
const size = 150;
|
|
17
|
+
const buffer = allocBuffer(size);
|
|
18
|
+
let fd;
|
|
19
|
+
try {
|
|
20
|
+
fd = fs.openSync(command, 'r');
|
|
21
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
22
|
+
fs.closeSync(fd);
|
|
23
|
+
} catch (_e) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return parseShebang(buffer.toString());
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/shim/shebang.ts"],"sourcesContent":["/**\n * Shebang detection for cross-platform script execution\n * Extracted from cross-spawn v6.0.5\n */\n\nimport fs from 'fs';\nimport { allocBuffer } from '../compat.ts';\n\nconst shebangRegex = /^#!.*/;\n\nfunction parseShebang(str: string): string | null {\n const match = str.match(shebangRegex);\n if (!match) return null;\n\n const arr = match[0].replace(/#! ?/, '').split(' ');\n const bin = arr[0].split('/').pop();\n const arg = arr[1];\n\n return bin === 'env' ? arg : bin + (arg ? ` ${arg}` : '');\n}\n\nexport function readShebang(command: string): string | null {\n const size = 150;\n const buffer = allocBuffer(size);\n\n let fd: number | undefined;\n try {\n fd = fs.openSync(command, 'r');\n fs.readSync(fd, buffer, 0, size, 0);\n fs.closeSync(fd);\n } catch (_e) {\n return null;\n }\n\n return parseShebang(buffer.toString());\n}\n"],"names":["fs","allocBuffer","shebangRegex","parseShebang","str","match","arr","replace","split","bin","pop","arg","readShebang","command","size","buffer","fd","openSync","readSync","closeSync","_e","toString"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,QAAQ,KAAK;AACpB,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,eAAe;AAErB,SAASC,aAAaC,GAAW;IAC/B,MAAMC,QAAQD,IAAIC,KAAK,CAACH;IACxB,IAAI,CAACG,OAAO,OAAO;IAEnB,MAAMC,MAAMD,KAAK,CAAC,EAAE,CAACE,OAAO,CAAC,QAAQ,IAAIC,KAAK,CAAC;IAC/C,MAAMC,MAAMH,GAAG,CAAC,EAAE,CAACE,KAAK,CAAC,KAAKE,GAAG;IACjC,MAAMC,MAAML,GAAG,CAAC,EAAE;IAElB,OAAOG,QAAQ,QAAQE,MAAMF,MAAOE,CAAAA,MAAM,CAAC,CAAC,EAAEA,KAAK,GAAG,EAAC;AACzD;AAEA,OAAO,SAASC,YAAYC,OAAe;IACzC,MAAMC,OAAO;IACb,MAAMC,SAASd,YAAYa;IAE3B,IAAIE;IACJ,IAAI;QACFA,KAAKhB,GAAGiB,QAAQ,CAACJ,SAAS;QAC1Bb,GAAGkB,QAAQ,CAACF,IAAID,QAAQ,GAAGD,MAAM;QACjCd,GAAGmB,SAAS,CAACH;IACf,EAAE,OAAOI,IAAI;QACX,OAAO;IACT;IAEA,OAAOjB,aAAaY,OAAOM,QAAQ;AACrC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the cross-spawn shim
|
|
3
|
+
*/
|
|
4
|
+
import type { SpawnOptions } from 'child_process';
|
|
5
|
+
export interface ShimSpawnOptions extends SpawnOptions {
|
|
6
|
+
forceShell?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Parsed {
|
|
9
|
+
command: string;
|
|
10
|
+
args: string[];
|
|
11
|
+
options: ShimSpawnOptions;
|
|
12
|
+
file: string | null | undefined;
|
|
13
|
+
original: {
|
|
14
|
+
command: string;
|
|
15
|
+
args: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ENOENTError extends Error {
|
|
19
|
+
code: string;
|
|
20
|
+
errno: string;
|
|
21
|
+
syscall: string;
|
|
22
|
+
path: string;
|
|
23
|
+
spawnargs: string[];
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/shim/types.ts"],"sourcesContent":["/**\n * Types for the cross-spawn shim\n */\n\nimport type { SpawnOptions } from 'child_process';\n\nexport interface ShimSpawnOptions extends SpawnOptions {\n forceShell?: boolean;\n}\n\nexport interface Parsed {\n command: string;\n args: string[];\n options: ShimSpawnOptions;\n file: string | null | undefined;\n original: {\n command: string;\n args: string[];\n };\n}\n\nexport interface ENOENTError extends Error {\n code: string;\n errno: string;\n syscall: string;\n path: string;\n spawnargs: string[];\n}\n"],"names":[],"mappings":"AAAA;;CAEC,GAmBD,WAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"source": "src/index.ts",
|
|
25
25
|
"types": "dist/cjs/index.d.ts",
|
|
26
26
|
"files": [
|
|
27
|
-
"dist"
|
|
28
|
-
"assets"
|
|
27
|
+
"dist"
|
|
29
28
|
],
|
|
30
29
|
"scripts": {
|
|
31
30
|
"build": "tsds build",
|
|
@@ -37,21 +36,23 @@
|
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"cross-spawn": "^7.0.6",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
39
|
+
"env-path-key": "^1.0.0",
|
|
40
|
+
"function-exec-sync": "^1.0.0",
|
|
41
|
+
"on-one": "^1.0.0",
|
|
42
|
+
"which": "^1.0.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@types/mocha": "
|
|
45
|
-
"@types/node": "
|
|
45
|
+
"@types/mocha": "*",
|
|
46
|
+
"@types/node": "*",
|
|
46
47
|
"cr": "^0.1.0",
|
|
47
48
|
"is-version": "^1.0.9",
|
|
48
|
-
"node-install-release": "^1.
|
|
49
|
-
"node-resolve-versions": "^1.
|
|
50
|
-
"node-version-use": "
|
|
51
|
-
"node-version-utils": "^1.
|
|
52
|
-
"pinkie-promise": "
|
|
53
|
-
"ts-dev-stack": "
|
|
54
|
-
"tsds-config": "
|
|
49
|
+
"node-install-release": "^1.7.5",
|
|
50
|
+
"node-resolve-versions": "^1.0.0",
|
|
51
|
+
"node-version-use": "*",
|
|
52
|
+
"node-version-utils": "^1.0.2",
|
|
53
|
+
"pinkie-promise": "*",
|
|
54
|
+
"ts-dev-stack": "*",
|
|
55
|
+
"tsds-config": "*"
|
|
55
56
|
},
|
|
56
57
|
"engines": {
|
|
57
58
|
"node": ">=0.8"
|