cross-spawn-cb 2.1.8 → 2.1.10
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/assets/cross-spawn.cjs +14 -30
- package/dist/cjs/crossSpawn.cjs +1 -1
- package/dist/cjs/crossSpawn.cjs.map +1 -1
- package/dist/cjs/{polyfills/crossSpawnCompat.cjs → crossSpawnCompat.cjs} +13 -4
- package/dist/cjs/crossSpawnCompat.cjs.map +1 -0
- package/dist/cjs/lib/once.cjs +20 -0
- package/dist/cjs/lib/once.cjs.map +1 -0
- package/dist/cjs/spawnSync.cjs +1 -1
- package/dist/cjs/spawnSync.cjs.map +1 -1
- package/dist/cjs/workers/async.cjs +12 -24
- package/dist/cjs/workers/async.cjs.map +1 -1
- package/dist/cjs/workers/sync.cjs +3 -4
- package/dist/cjs/workers/sync.cjs.map +1 -1
- package/dist/esm/crossSpawn.cjs +1 -1
- package/dist/esm/crossSpawn.cjs.map +1 -1
- package/dist/esm/{polyfills/crossSpawnCompat.cjs → crossSpawnCompat.cjs} +13 -4
- package/dist/esm/crossSpawnCompat.cjs.map +1 -0
- package/dist/esm/lib/once.mjs +9 -0
- package/dist/esm/lib/once.mjs.map +1 -0
- package/dist/esm/spawnSync.mjs +1 -1
- package/dist/esm/spawnSync.mjs.map +1 -1
- package/dist/esm/workers/async.mjs +12 -24
- package/dist/esm/workers/async.mjs.map +1 -1
- package/dist/esm/workers/sync.mjs +3 -4
- package/dist/esm/workers/sync.mjs.map +1 -1
- package/dist/types/lib/once.d.ts +1 -0
- package/package.json +2 -6
- package/dist/cjs/polyfills/crossSpawnCompat.cjs.map +0 -1
- package/dist/cjs/polyfills/patch.cjs +0 -18
- package/dist/cjs/polyfills/patch.cjs.map +0 -1
- package/dist/esm/polyfills/crossSpawnCompat.cjs.map +0 -1
- package/dist/esm/polyfills/patch.cjs +0 -16
- package/dist/esm/polyfills/patch.cjs.map +0 -1
- package/dist/types/polyfills/patch.d.cts +0 -1
- /package/dist/types/{polyfills/crossSpawnCompat.d.cts → crossSpawnCompat.d.cts} +0 -0
package/assets/cross-spawn.cjs
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(obj, key, {
|
|
5
|
-
value: value,
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true
|
|
9
|
-
});
|
|
10
|
-
} else {
|
|
11
|
-
obj[key] = value;
|
|
1
|
+
function objectAssign(target, obj) {
|
|
2
|
+
for (var key in obj) {
|
|
3
|
+
if (!target.hasOwnProperty(key)) target[key] = obj[key];
|
|
12
4
|
}
|
|
13
|
-
return
|
|
5
|
+
return target;
|
|
14
6
|
}
|
|
15
7
|
|
|
16
|
-
function
|
|
17
|
-
for (var
|
|
18
|
-
|
|
19
|
-
var ownKeys = Object.keys(source);
|
|
20
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
21
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
22
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
ownKeys.forEach(function (key) {
|
|
26
|
-
_define_property(target, key, source[key]);
|
|
27
|
-
});
|
|
8
|
+
function findKey(obj, fn) {
|
|
9
|
+
for (var key in obj) {
|
|
10
|
+
if (fn(key)) return key;
|
|
28
11
|
}
|
|
29
|
-
return
|
|
12
|
+
return null
|
|
30
13
|
}
|
|
31
|
-
|
|
14
|
+
|
|
15
|
+
var pathDelimiter = process.platform === 'win32' ? ';' : ':';
|
|
32
16
|
'use strict';
|
|
33
17
|
|
|
34
18
|
var require$$0$2 = require('child_process');
|
|
@@ -322,7 +306,7 @@ function requirePathKey() {
|
|
|
322
306
|
if (platform !== 'win32') {
|
|
323
307
|
return 'PATH';
|
|
324
308
|
}
|
|
325
|
-
return
|
|
309
|
+
return findKey(env,function(x) {
|
|
326
310
|
return x.toUpperCase() === 'PATH';
|
|
327
311
|
}) || 'Path';
|
|
328
312
|
};
|
|
@@ -352,7 +336,7 @@ function requireResolveCommand() {
|
|
|
352
336
|
try {
|
|
353
337
|
resolved = which.sync(parsed.command, {
|
|
354
338
|
path: (parsed.options.env || process.env)[pathKey],
|
|
355
|
-
pathExt: withoutPathExt ?
|
|
339
|
+
pathExt: withoutPathExt ? pathDelimiter : undefined
|
|
356
340
|
});
|
|
357
341
|
} catch (e) {
|
|
358
342
|
/* Empty */ } finally{
|
|
@@ -1840,7 +1824,7 @@ function requireParse() {
|
|
|
1840
1824
|
args = null;
|
|
1841
1825
|
}
|
|
1842
1826
|
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
1843
|
-
options =
|
|
1827
|
+
options = objectAssign({}, options); // Clone object to avoid changing the original
|
|
1844
1828
|
// Build our parsed object
|
|
1845
1829
|
var parsed = {
|
|
1846
1830
|
command: command,
|
|
@@ -1866,7 +1850,7 @@ function requireEnoent() {
|
|
|
1866
1850
|
hasRequiredEnoent = 1;
|
|
1867
1851
|
var isWin = process.platform === 'win32';
|
|
1868
1852
|
function notFoundError(original, syscall) {
|
|
1869
|
-
return
|
|
1853
|
+
return objectAssign(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
|
|
1870
1854
|
code: 'ENOENT',
|
|
1871
1855
|
errno: 'ENOENT',
|
|
1872
1856
|
syscall: "".concat(syscall, " ").concat(original.command),
|
package/dist/cjs/crossSpawn.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var major = +process.versions.node.split('.')[0];
|
|
3
|
-
module.exports = major <= 7 ? require('./
|
|
3
|
+
module.exports = major <= 7 ? require('./crossSpawnCompat.cjs') : require('cross-spawn');
|
|
4
4
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawn.cjs"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\n\nmodule.exports = major <= 7 ? require('./
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawn.cjs"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\n\nmodule.exports = major <= 7 ? require('./crossSpawnCompat.cjs') : require('cross-spawn');\n"],"names":["major","process","versions","node","split","module","exports","require"],"mappings":";AAAA,IAAMA,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAElDC,OAAOC,OAAO,GAAGN,SAAS,IAAIO,QAAQ,4BAA4BA,QAAQ"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
require('./patch.cjs');
|
|
3
2
|
var path = require('path');
|
|
4
3
|
var cp = require('child_process');
|
|
5
|
-
var
|
|
4
|
+
var crossSpawn = require('../../assets/cross-spawn.cjs');
|
|
5
|
+
if (!cp.spawnSync) {
|
|
6
|
+
var workerPath = path.join(__dirname, '..', 'cjs', 'spawn.cjs');
|
|
7
|
+
var functionExec = null; // break dependencies
|
|
8
|
+
cp.spawnSync = function spawnSync(cmd, args, options) {
|
|
9
|
+
if (!functionExec) functionExec = require('function-exec-sync');
|
|
10
|
+
return functionExec({
|
|
11
|
+
callbacks: true
|
|
12
|
+
}, workerPath, cmd, args, options || {});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
6
15
|
var NODES = [
|
|
7
16
|
'node',
|
|
8
17
|
'node.exe',
|
|
@@ -13,9 +22,9 @@ function parse(command, args, options) {
|
|
|
13
22
|
var env = options ? options.env || process.env : process.env;
|
|
14
23
|
command = env.NODE || env.npm_node_execpath;
|
|
15
24
|
}
|
|
16
|
-
return
|
|
25
|
+
return crossSpawn._parse(command, args, options);
|
|
17
26
|
}
|
|
18
|
-
var enoent =
|
|
27
|
+
var enoent = crossSpawn._enoent;
|
|
19
28
|
function spawn(command, args, options) {
|
|
20
29
|
var parsed = parse(command, args, options);
|
|
21
30
|
var spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawnCompat.cjs"],"sourcesContent":["const path = require('path');\nconst cp = require('child_process');\nconst crossSpawn = require('../../assets/cross-spawn.cjs');\n\nif (!cp.spawnSync) {\n const workerPath = path.join(__dirname, '..', 'cjs', 'spawn.cjs');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSync(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n return functionExec({ callbacks: true }, workerPath, cmd, args, options || {});\n };\n}\n\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nfunction parse(command, args, options) {\n if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {\n const env = options ? options.env || process.env : process.env;\n command = env.NODE || env.npm_node_execpath;\n }\n return crossSpawn._parse(command, args, options);\n}\nconst enoent = crossSpawn._enoent;\n\nfunction spawn(command, args, options) {\n const parsed = parse(command, args, options);\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n enoent.hookChildProcess(spawned, parsed);\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n const parsed = parse(command, args, options);\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n"],"names":["path","require","cp","crossSpawn","spawnSync","workerPath","join","__dirname","functionExec","cmd","args","options","callbacks","NODES","parse","command","indexOf","basename","toLowerCase","env","process","NODE","npm_node_execpath","_parse","enoent","_enoent","spawn","parsed","spawned","hookChildProcess","result","error","verifyENOENTSync","status","module","exports","sync"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,aAAaF,QAAQ;AAE3B,IAAI,CAACC,GAAGE,SAAS,EAAE;IACjB,IAAMC,aAAaL,KAAKM,IAAI,CAACC,WAAW,MAAM,OAAO;IAErD,IAAIC,eAAe,MAAM,qBAAqB;IAC9CN,GAAGE,SAAS,GAAG,SAASA,UAAUK,GAAG,EAAEC,IAAI,EAAEC,OAAO;QAClD,IAAI,CAACH,cAAcA,eAAeP,QAAQ;QAC1C,OAAOO,aAAa;YAAEI,WAAW;QAAK,GAAGP,YAAYI,KAAKC,MAAMC,WAAW,CAAC;IAC9E;AACF;AAEA,IAAME,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAC9C,SAASC,MAAMC,OAAO,EAAEL,IAAI,EAAEC,OAAO;IACnC,IAAIE,MAAMG,OAAO,CAAChB,KAAKiB,QAAQ,CAACF,SAASG,WAAW,OAAO,GAAG;QAC5D,IAAMC,MAAMR,UAAUA,QAAQQ,GAAG,IAAIC,QAAQD,GAAG,GAAGC,QAAQD,GAAG;QAC9DJ,UAAUI,IAAIE,IAAI,IAAIF,IAAIG,iBAAiB;IAC7C;IACA,OAAOnB,WAAWoB,MAAM,CAACR,SAASL,MAAMC;AAC1C;AACA,IAAMa,SAASrB,WAAWsB,OAAO;AAEjC,SAASC,MAAMX,OAAO,EAAEL,IAAI,EAAEC,OAAO;IACnC,IAAMgB,SAASb,MAAMC,SAASL,MAAMC;IACpC,IAAMiB,UAAU1B,GAAGwB,KAAK,CAACC,OAAOZ,OAAO,EAAEY,OAAOjB,IAAI,EAAEiB,OAAOhB,OAAO;IACpEa,OAAOK,gBAAgB,CAACD,SAASD;IACjC,OAAOC;AACT;AAEA,SAASxB,UAAUW,OAAO,EAAEL,IAAI,EAAEC,OAAO;IACvC,IAAMgB,SAASb,MAAMC,SAASL,MAAMC;IACpC,IAAMmB,SAAS5B,GAAGE,SAAS,CAACuB,OAAOZ,OAAO,EAAEY,OAAOjB,IAAI,EAAEiB,OAAOhB,OAAO;IACvEmB,OAAOC,KAAK,GAAGD,OAAOC,KAAK,IAAIP,OAAOQ,gBAAgB,CAACF,OAAOG,MAAM,EAAEN;IACtE,OAAOG;AACT;AAEAI,OAAOC,OAAO,GAAGT;AACjBQ,OAAOC,OAAO,CAACT,KAAK,GAAGA;AACvBQ,OAAOC,OAAO,CAACC,IAAI,GAAGhC;AACtB8B,OAAOC,OAAO,CAACZ,MAAM,GAAGT;AACxBoB,OAAOC,OAAO,CAACV,OAAO,GAAGD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return once;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function once(callback) {
|
|
12
|
+
var called = false;
|
|
13
|
+
return function wrapper() {
|
|
14
|
+
if (called) return;
|
|
15
|
+
called = true;
|
|
16
|
+
// biome-ignore lint/style/noArguments: <explanation>
|
|
17
|
+
return callback.apply(null, arguments);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/lib/once.ts"],"sourcesContent":["export default function once(callback) {\n let called = false;\n return function wrapper() {\n if (called) return;\n called = true;\n // biome-ignore lint/style/noArguments: <explanation>\n return callback.apply(null, arguments);\n };\n}\n"],"names":["once","callback","called","wrapper","apply","arguments"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA,KAAKC,QAAQ;IACnC,IAAIC,SAAS;IACb,OAAO,SAASC;QACd,IAAID,QAAQ;QACZA,SAAS;QACT,qDAAqD;QACrD,OAAOD,SAASG,KAAK,CAAC,MAAMC;IAC9B;AACF"}
|
package/dist/cjs/spawnSync.cjs
CHANGED
|
@@ -72,7 +72,7 @@ function spawnSync(command, args, options) {
|
|
|
72
72
|
var syncOptions = _object_spread_props(_object_spread({}, options), {
|
|
73
73
|
env: options.env || process.env,
|
|
74
74
|
stdio: 'pipe',
|
|
75
|
-
encoding: 'utf8'
|
|
75
|
+
encoding: options.encoding || 'utf8'
|
|
76
76
|
});
|
|
77
77
|
var res = _crossSpawncjs.default.sync(command, args, syncOptions);
|
|
78
78
|
return (0, _sync.default)(res, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/spawnSync.ts"],"sourcesContent":["import crossSpawn from './crossSpawn.cjs';\nimport worker from './workers/sync';\n\nimport type { SpawnOptions, SpawnResult } from './types';\n\nexport default function spawnSync(command: string, args: string[], options?: SpawnOptions): SpawnResult {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: 'utf8' };\n const res = crossSpawn.sync(command, args, syncOptions);\n return worker(res, options as SpawnOptions);\n}\nspawnSync.worker = worker;\n"],"names":["spawnSync","command","args","options","syncOptions","env","process","stdio","encoding","res","crossSpawn","sync","worker"],"mappings":";;;;+BAKA;;;eAAwBA;;;oEALD;2DACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIJ,SAASA,UAAUC,OAAe,EAAEC,IAAc,EAAEC,OAAsB;IACvFA,UAAUA,WAAW,CAAC;IACtB,IAAMC,cAAc,wCAAKD;QAASE,KAAKF,QAAQE,GAAG,IAAIC,QAAQD,GAAG;QAAEE,OAAO;QAAQC,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/spawnSync.ts"],"sourcesContent":["import crossSpawn from './crossSpawn.cjs';\nimport worker from './workers/sync';\n\nimport type { SpawnOptions, SpawnResult } from './types';\n\nexport default function spawnSync(command: string, args: string[], options?: SpawnOptions): SpawnResult {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: options.encoding || 'utf8' };\n const res = crossSpawn.sync(command, args, syncOptions);\n return worker(res, options as SpawnOptions);\n}\nspawnSync.worker = worker;\n"],"names":["spawnSync","command","args","options","syncOptions","env","process","stdio","encoding","res","crossSpawn","sync","worker"],"mappings":";;;;+BAKA;;;eAAwBA;;;oEALD;2DACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIJ,SAASA,UAAUC,OAAe,EAAEC,IAAc,EAAEC,OAAsB;IACvFA,UAAUA,WAAW,CAAC;IACtB,IAAMC,cAAc,wCAAKD;QAASE,KAAKF,QAAQE,GAAG,IAAIC,QAAQD,GAAG;QAAEE,OAAO;QAAQC,UAAUL,QAAQK,QAAQ,IAAI;;IAChH,IAAMC,MAAMC,sBAAU,CAACC,IAAI,CAACV,SAASC,MAAME;IAC3C,OAAOQ,IAAAA,aAAM,EAACH,KAAKN;AACrB;AACAH,UAAUY,MAAM,GAAGA,aAAM"}
|
|
@@ -8,9 +8,8 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return worker;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _calloncefn = /*#__PURE__*/ _interop_require_default(require("call-once-fn"));
|
|
12
|
-
var _nexttick = /*#__PURE__*/ _interop_require_default(require("next-tick"));
|
|
13
11
|
var _constants = require("../constants.cjs");
|
|
12
|
+
var _once = /*#__PURE__*/ _interop_require_default(require("../lib/once.cjs"));
|
|
14
13
|
function _interop_require_default(obj) {
|
|
15
14
|
return obj && obj.__esModule ? obj : {
|
|
16
15
|
default: obj
|
|
@@ -22,9 +21,7 @@ function worker(cp, options, callback) {
|
|
|
22
21
|
options = {};
|
|
23
22
|
}
|
|
24
23
|
options = options || {};
|
|
25
|
-
callback = (0,
|
|
26
|
-
var stdout = null;
|
|
27
|
-
var stderr = null;
|
|
24
|
+
callback = (0, _once.default)(callback); // some versions of node emit both an error and close
|
|
28
25
|
// collect output
|
|
29
26
|
var res = {
|
|
30
27
|
pid: 0,
|
|
@@ -34,32 +31,24 @@ function worker(cp, options, callback) {
|
|
|
34
31
|
status: null,
|
|
35
32
|
signal: null
|
|
36
33
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
if (cp.stderr) {
|
|
43
|
-
stderr = [];
|
|
44
|
-
cp.stderr.on('data', stderr.push.bind(stderr));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// some versions of node emit both an error and close
|
|
34
|
+
var stdout = [];
|
|
35
|
+
var stderr = [];
|
|
36
|
+
if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));
|
|
37
|
+
if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));
|
|
48
38
|
cp.on('error', function(err) {
|
|
49
39
|
return err.code === 'OK' || callback(err);
|
|
50
40
|
});
|
|
51
|
-
// done
|
|
52
41
|
cp.on('close', function(status, signal) {
|
|
53
|
-
(
|
|
42
|
+
setTimeout(function close() {
|
|
54
43
|
// prepare result
|
|
55
44
|
res.pid = cp.pid;
|
|
56
45
|
res.status = status;
|
|
57
46
|
res.signal = signal;
|
|
58
|
-
if (stdout) {
|
|
47
|
+
if (options.encoding && cp.stdout) {
|
|
59
48
|
res.stdout = Buffer.concat(stdout);
|
|
60
49
|
if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);
|
|
61
50
|
}
|
|
62
|
-
if (stderr) {
|
|
51
|
+
if (options.encoding && cp.stderr) {
|
|
63
52
|
res.stderr = Buffer.concat(stderr);
|
|
64
53
|
if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);
|
|
65
54
|
}
|
|
@@ -68,18 +57,17 @@ function worker(cp, options, callback) {
|
|
|
68
57
|
res.stdout,
|
|
69
58
|
res.stderr
|
|
70
59
|
];
|
|
71
|
-
// patch: early node on windows could return null
|
|
72
|
-
if (res.status === null) res.status = 0;
|
|
60
|
+
if (res.status === null) res.status = 0; // patch: early node on windows could return null
|
|
73
61
|
// process errors
|
|
74
62
|
var err = res.status !== 0 ? new Error("Non-zero exit code: ".concat(res.status)) : null;
|
|
75
63
|
if (err) {
|
|
76
64
|
for(var key in res){
|
|
77
65
|
if (_constants.spawnKeys.indexOf(key) < 0) continue;
|
|
78
|
-
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];
|
|
66
|
+
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
69
|
err ? callback(err) : callback(null, res);
|
|
82
|
-
});
|
|
70
|
+
}, 0);
|
|
83
71
|
});
|
|
84
72
|
// pipe input
|
|
85
73
|
if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\nimport once from '../lib/once';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback); // some versions of node emit both an error and close\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n cp.on('error', (err: SpawnError) => err.code === 'OK' || callback(err));\n cp.on('close', (status, signal) => {\n setTimeout(function close() {\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n }, 0);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["worker","cp","options","callback","once","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","err","code","setTimeout","close","Buffer","concat","toString","Error","key","spawnKeys","indexOf","isBuffer","input","stdin","end"],"mappings":";;;;+BAKA;;;eAAwBA;;;yBALE;2DACT;;;;;;AAIF,SAASA,OAAOC,EAAgB,EAAEC,OAAsC,EAAEC,QAAwB;IAC/G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWC,IAAAA,aAAI,EAACD,WAAW,qDAAqD;IAEhF,iBAAiB;IACjB,IAAME,MAAM;QAAEC,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,GAAG,iDAAiD;YAE1F,iBAAiB;YACjB,IAAMM,MAAMX,IAAIK,MAAM,KAAK,IAAI,IAAIa,MAAM,AAAC,uBAAiC,OAAXlB,IAAIK,MAAM,KAAM;YAChF,IAAIM,KAAK;gBACP,IAAK,IAAMQ,OAAOnB,IAAK;oBACrB,IAAIoB,oBAAS,CAACC,OAAO,CAACF,OAAO,GAAG;oBAChCR,GAAG,CAACQ,IAAI,GAAGJ,OAAOO,QAAQ,CAACtB,GAAG,CAACmB,IAAI,IAAInB,GAAG,CAACmB,IAAI,CAACF,QAAQ,CAACpB,QAAQU,QAAQ,IAAI,UAAUP,GAAG,CAACmB,IAAI;gBACjG;YACF;YACAR,MAAMb,SAASa,OAAOb,SAAS,MAAME;QACvC,GAAG;IACL;IAEA,aAAa;IACb,IAAIH,QAAQ0B,KAAK,IAAK,CAAA,OAAO1B,QAAQ0B,KAAK,KAAK,YAAYR,OAAOO,QAAQ,CAACzB,QAAQ0B,KAAK,CAAA,GAAI;QAC1F3B,GAAG4B,KAAK,CAACC,GAAG,CAAC5B,QAAQ0B,KAAK;IAC5B;AACF"}
|
|
@@ -20,17 +20,16 @@ function worker(res, options) {
|
|
|
20
20
|
process.stderr.write(res.stderr);
|
|
21
21
|
res.stderr = null;
|
|
22
22
|
}
|
|
23
|
-
// patch: early node on windows could return null
|
|
24
|
-
if (res.status === null) res.status = 0;
|
|
23
|
+
if (res.status === null) res.status = 0; // patch: early node on windows could return null
|
|
25
24
|
// process errors
|
|
26
25
|
var err = res.status !== 0 ? new Error("Non-zero exit code: ".concat(res.status)) : null;
|
|
27
26
|
if (err) {
|
|
28
27
|
for(var key in res){
|
|
29
28
|
if (_constants.spawnKeys.indexOf(key) < 0) continue;
|
|
30
|
-
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];
|
|
29
|
+
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];
|
|
31
30
|
}
|
|
31
|
+
throw err;
|
|
32
32
|
}
|
|
33
|
-
if (err) throw err;
|
|
34
33
|
return res;
|
|
35
34
|
}
|
|
36
35
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/sync.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\n\nimport type { SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(res: SpawnResult, options?: SpawnOptions): SpawnResult {\n options = options || {};\n\n // pipe if inherited\n if (res.stdout && options.stdio === 'inherit') {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && options.stdio === 'inherit') {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/sync.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\n\nimport type { SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(res: SpawnResult, options?: SpawnOptions): SpawnResult {\n options = options || {};\n\n // pipe if inherited\n if (res.stdout && options.stdio === 'inherit') {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && options.stdio === 'inherit') {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n throw err;\n }\n return res;\n}\n"],"names":["worker","res","options","stdout","stdio","process","write","stderr","status","err","Error","key","spawnKeys","indexOf","Buffer","isBuffer","toString","encoding"],"mappings":";;;;+BAIA;;;eAAwBA;;;yBAJE;AAIX,SAASA,OAAOC,GAAgB,EAAEC,OAAsB;IACrEA,UAAUA,WAAW,CAAC;IAEtB,oBAAoB;IACpB,IAAID,IAAIE,MAAM,IAAID,QAAQE,KAAK,KAAK,WAAW;QAC7CC,QAAQF,MAAM,CAACG,KAAK,CAACL,IAAIE,MAAM;QAC/BF,IAAIE,MAAM,GAAG;IACf;IACA,IAAIF,IAAIM,MAAM,IAAIL,QAAQE,KAAK,KAAK,WAAW;QAC7CC,QAAQE,MAAM,CAACD,KAAK,CAACL,IAAIM,MAAM;QAC/BN,IAAIM,MAAM,GAAG;IACf;IACA,IAAIN,IAAIO,MAAM,KAAK,MAAMP,IAAIO,MAAM,GAAG,GAAG,iDAAiD;IAE1F,iBAAiB;IACjB,IAAMC,MAAMR,IAAIO,MAAM,KAAK,IAAI,IAAIE,MAAM,AAAC,uBAAiC,OAAXT,IAAIO,MAAM,KAAM;IAChF,IAAIC,KAAK;QACP,IAAK,IAAME,OAAOV,IAAK;YACrB,IAAIW,oBAAS,CAACC,OAAO,CAACF,OAAO,GAAG;YAChCF,GAAG,CAACE,IAAI,GAAGG,OAAOC,QAAQ,CAACd,GAAG,CAACU,IAAI,IAAIV,GAAG,CAACU,IAAI,CAACK,QAAQ,CAACd,QAAQe,QAAQ,IAAI,UAAUhB,GAAG,CAACU,IAAI;QACjG;QACA,MAAMF;IACR;IACA,OAAOR;AACT"}
|
package/dist/esm/crossSpawn.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const major = +process.versions.node.split('.')[0];
|
|
2
|
-
module.exports = major <= 7 ? require('./
|
|
2
|
+
module.exports = major <= 7 ? require('./crossSpawnCompat.cjs') : require('cross-spawn');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawn.cjs"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\n\nmodule.exports = major <= 7 ? require('./
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawn.cjs"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\n\nmodule.exports = major <= 7 ? require('./crossSpawnCompat.cjs') : require('cross-spawn');\n"],"names":["major","process","versions","node","split","module","exports","require"],"mappings":"AAAA,MAAMA,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAElDC,OAAOC,OAAO,GAAGN,SAAS,IAAIO,QAAQ,4BAA4BA,QAAQ"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
require('./patch.cjs');
|
|
2
1
|
const path = require('path');
|
|
3
2
|
const cp = require('child_process');
|
|
4
|
-
const
|
|
3
|
+
const crossSpawn = require('../../assets/cross-spawn.cjs');
|
|
4
|
+
if (!cp.spawnSync) {
|
|
5
|
+
const workerPath = path.join(__dirname, '..', 'cjs', 'spawn.cjs');
|
|
6
|
+
let functionExec = null; // break dependencies
|
|
7
|
+
cp.spawnSync = function spawnSync(cmd, args, options) {
|
|
8
|
+
if (!functionExec) functionExec = require('function-exec-sync');
|
|
9
|
+
return functionExec({
|
|
10
|
+
callbacks: true
|
|
11
|
+
}, workerPath, cmd, args, options || {});
|
|
12
|
+
};
|
|
13
|
+
}
|
|
5
14
|
const NODES = [
|
|
6
15
|
'node',
|
|
7
16
|
'node.exe',
|
|
@@ -12,9 +21,9 @@ function parse(command, args, options) {
|
|
|
12
21
|
const env = options ? options.env || process.env : process.env;
|
|
13
22
|
command = env.NODE || env.npm_node_execpath;
|
|
14
23
|
}
|
|
15
|
-
return
|
|
24
|
+
return crossSpawn._parse(command, args, options);
|
|
16
25
|
}
|
|
17
|
-
const enoent =
|
|
26
|
+
const enoent = crossSpawn._enoent;
|
|
18
27
|
function spawn(command, args, options) {
|
|
19
28
|
const parsed = parse(command, args, options);
|
|
20
29
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/crossSpawnCompat.cjs"],"sourcesContent":["const path = require('path');\nconst cp = require('child_process');\nconst crossSpawn = require('../../assets/cross-spawn.cjs');\n\nif (!cp.spawnSync) {\n const workerPath = path.join(__dirname, '..', 'cjs', 'spawn.cjs');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSync(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n return functionExec({ callbacks: true }, workerPath, cmd, args, options || {});\n };\n}\n\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nfunction parse(command, args, options) {\n if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {\n const env = options ? options.env || process.env : process.env;\n command = env.NODE || env.npm_node_execpath;\n }\n return crossSpawn._parse(command, args, options);\n}\nconst enoent = crossSpawn._enoent;\n\nfunction spawn(command, args, options) {\n const parsed = parse(command, args, options);\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n enoent.hookChildProcess(spawned, parsed);\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n const parsed = parse(command, args, options);\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n"],"names":["path","require","cp","crossSpawn","spawnSync","workerPath","join","__dirname","functionExec","cmd","args","options","callbacks","NODES","parse","command","indexOf","basename","toLowerCase","env","process","NODE","npm_node_execpath","_parse","enoent","_enoent","spawn","parsed","spawned","hookChildProcess","result","error","verifyENOENTSync","status","module","exports","sync"],"mappings":"AAAA,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,KAAKD,QAAQ;AACnB,MAAME,aAAaF,QAAQ;AAE3B,IAAI,CAACC,GAAGE,SAAS,EAAE;IACjB,MAAMC,aAAaL,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AOG;AACT;AAEAI,OAAOC,OAAO,GAAGT;AACjBQ,OAAOC,OAAO,CAACT,KAAK,GAAGA;AACvBQ,OAAOC,OAAO,CAACC,IAAI,GAAGhC;AACtB8B,OAAOC,OAAO,CAACZ,MAAM,GAAGT;AACxBoB,OAAOC,OAAO,CAACV,OAAO,GAAGD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/lib/once.ts"],"sourcesContent":["export default function once(callback) {\n let called = false;\n return function wrapper() {\n if (called) return;\n called = true;\n // biome-ignore lint/style/noArguments: <explanation>\n return callback.apply(null, arguments);\n };\n}\n"],"names":["once","callback","called","wrapper","apply","arguments"],"mappings":"AAAA,eAAe,SAASA,KAAKC,QAAQ;IACnC,IAAIC,SAAS;IACb,OAAO,SAASC;QACd,IAAID,QAAQ;QACZA,SAAS;QACT,qDAAqD;QACrD,OAAOD,SAASG,KAAK,CAAC,MAAMC;IAC9B;AACF"}
|
package/dist/esm/spawnSync.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export default function spawnSync(command, args, options) {
|
|
|
6
6
|
...options,
|
|
7
7
|
env: options.env || process.env,
|
|
8
8
|
stdio: 'pipe',
|
|
9
|
-
encoding: 'utf8'
|
|
9
|
+
encoding: options.encoding || 'utf8'
|
|
10
10
|
};
|
|
11
11
|
const res = crossSpawn.sync(command, args, syncOptions);
|
|
12
12
|
return worker(res, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/spawnSync.ts"],"sourcesContent":["import crossSpawn from './crossSpawn.cjs';\nimport worker from './workers/sync';\n\nimport type { SpawnOptions, SpawnResult } from './types';\n\nexport default function spawnSync(command: string, args: string[], options?: SpawnOptions): SpawnResult {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: 'utf8' };\n const res = crossSpawn.sync(command, args, syncOptions);\n return worker(res, options as SpawnOptions);\n}\nspawnSync.worker = worker;\n"],"names":["crossSpawn","worker","spawnSync","command","args","options","syncOptions","env","process","stdio","encoding","res","sync"],"mappings":"AAAA,OAAOA,gBAAgB,mBAAmB;AAC1C,OAAOC,YAAY,iBAAiB;AAIpC,eAAe,SAASC,UAAUC,OAAe,EAAEC,IAAc,EAAEC,OAAsB;IACvFA,UAAUA,WAAW,CAAC;IACtB,MAAMC,cAAc;QAAE,GAAGD,OAAO;QAAEE,KAAKF,QAAQE,GAAG,IAAIC,QAAQD,GAAG;QAAEE,OAAO;QAAQC,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/spawnSync.ts"],"sourcesContent":["import crossSpawn from './crossSpawn.cjs';\nimport worker from './workers/sync';\n\nimport type { SpawnOptions, SpawnResult } from './types';\n\nexport default function spawnSync(command: string, args: string[], options?: SpawnOptions): SpawnResult {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: options.encoding || 'utf8' };\n const res = crossSpawn.sync(command, args, syncOptions);\n return worker(res, options as SpawnOptions);\n}\nspawnSync.worker = worker;\n"],"names":["crossSpawn","worker","spawnSync","command","args","options","syncOptions","env","process","stdio","encoding","res","sync"],"mappings":"AAAA,OAAOA,gBAAgB,mBAAmB;AAC1C,OAAOC,YAAY,iBAAiB;AAIpC,eAAe,SAASC,UAAUC,OAAe,EAAEC,IAAc,EAAEC,OAAsB;IACvFA,UAAUA,WAAW,CAAC;IACtB,MAAMC,cAAc;QAAE,GAAGD,OAAO;QAAEE,KAAKF,QAAQE,GAAG,IAAIC,QAAQD,GAAG;QAAEE,OAAO;QAAQC,UAAUL,QAAQK,QAAQ,IAAI;IAAO;IACvH,MAAMC,MAAMX,WAAWY,IAAI,CAACT,SAASC,MAAME;IAC3C,OAAOL,OAAOU,KAAKN;AACrB;AACAH,UAAUD,MAAM,GAAGA"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import once from 'call-once-fn';
|
|
2
|
-
import nextTick from 'next-tick';
|
|
3
1
|
import { spawnKeys } from '../constants.mjs';
|
|
2
|
+
import once from '../lib/once.mjs';
|
|
4
3
|
export default function worker(cp, options, callback) {
|
|
5
4
|
if (typeof options === 'function') {
|
|
6
5
|
callback = options;
|
|
7
6
|
options = {};
|
|
8
7
|
}
|
|
9
8
|
options = options || {};
|
|
10
|
-
callback = once(callback);
|
|
11
|
-
let stdout = null;
|
|
12
|
-
let stderr = null;
|
|
9
|
+
callback = once(callback); // some versions of node emit both an error and close
|
|
13
10
|
// collect output
|
|
14
11
|
const res = {
|
|
15
12
|
pid: 0,
|
|
@@ -19,30 +16,22 @@ export default function worker(cp, options, callback) {
|
|
|
19
16
|
status: null,
|
|
20
17
|
signal: null
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
if (cp.stderr) {
|
|
28
|
-
stderr = [];
|
|
29
|
-
cp.stderr.on('data', stderr.push.bind(stderr));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// some versions of node emit both an error and close
|
|
19
|
+
const stdout = [];
|
|
20
|
+
const stderr = [];
|
|
21
|
+
if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));
|
|
22
|
+
if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));
|
|
33
23
|
cp.on('error', (err)=>err.code === 'OK' || callback(err));
|
|
34
|
-
// done
|
|
35
24
|
cp.on('close', (status, signal)=>{
|
|
36
|
-
|
|
25
|
+
setTimeout(function close() {
|
|
37
26
|
// prepare result
|
|
38
27
|
res.pid = cp.pid;
|
|
39
28
|
res.status = status;
|
|
40
29
|
res.signal = signal;
|
|
41
|
-
if (stdout) {
|
|
30
|
+
if (options.encoding && cp.stdout) {
|
|
42
31
|
res.stdout = Buffer.concat(stdout);
|
|
43
32
|
if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);
|
|
44
33
|
}
|
|
45
|
-
if (stderr) {
|
|
34
|
+
if (options.encoding && cp.stderr) {
|
|
46
35
|
res.stderr = Buffer.concat(stderr);
|
|
47
36
|
if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);
|
|
48
37
|
}
|
|
@@ -51,18 +40,17 @@ export default function worker(cp, options, callback) {
|
|
|
51
40
|
res.stdout,
|
|
52
41
|
res.stderr
|
|
53
42
|
];
|
|
54
|
-
// patch: early node on windows could return null
|
|
55
|
-
if (res.status === null) res.status = 0;
|
|
43
|
+
if (res.status === null) res.status = 0; // patch: early node on windows could return null
|
|
56
44
|
// process errors
|
|
57
45
|
const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;
|
|
58
46
|
if (err) {
|
|
59
47
|
for(const key in res){
|
|
60
48
|
if (spawnKeys.indexOf(key) < 0) continue;
|
|
61
|
-
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];
|
|
49
|
+
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
52
|
err ? callback(err) : callback(null, res);
|
|
65
|
-
});
|
|
53
|
+
}, 0);
|
|
66
54
|
});
|
|
67
55
|
// pipe input
|
|
68
56
|
if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\nimport once from '../lib/once';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback); // some versions of node emit both an error and close\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n cp.on('error', (err: SpawnError) => err.code === 'OK' || callback(err));\n cp.on('close', (status, signal) => {\n setTimeout(function close() {\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n }, 0);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["spawnKeys","once","worker","cp","options","callback","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","err","code","setTimeout","close","Buffer","concat","toString","Error","key","indexOf","isBuffer","input","stdin","end"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAe;AACzC,OAAOC,UAAU,cAAc;AAI/B,eAAe,SAASC,OAAOC,EAAgB,EAAEC,OAAsC,EAAEC,QAAwB;IAC/G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC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C;gBAAMF,IAAIG,MAAM;gBAAEH,IAAII,MAAM;aAAC;YAC3C,IAAIJ,IAAIK,MAAM,KAAK,MAAML,IAAIK,MAAM,GAAG,GAAG,iDAAiD;YAE1F,iBAAiB;YACjB,MAAMM,MAAMX,IAAIK,MAAM,KAAK,IAAI,IAAIa,MAAM,CAAC,oBAAoB,EAAElB,IAAIK,MAAM,EAAE,IAAI;YAChF,IAAIM,KAAK;gBACP,IAAK,MAAMQ,OAAOnB,IAAK;oBACrB,IAAIN,UAAU0B,OAAO,CAACD,OAAO,GAAG;oBAChCR,GAAG,CAACQ,IAAI,GAAGJ,OAAOM,QAAQ,CAACrB,GAAG,CAACmB,IAAI,IAAInB,GAAG,CAACmB,IAAI,CAACF,QAAQ,CAACnB,QAAQS,QAAQ,IAAI,UAAUP,GAAG,CAACmB,IAAI;gBACjG;YACF;YACAR,MAAMZ,SAASY,OAAOZ,SAAS,MAAMC;QACvC,GAAG;IACL;IAEA,aAAa;IACb,IAAIF,QAAQwB,KAAK,IAAK,CAAA,OAAOxB,QAAQwB,KAAK,KAAK,YAAYP,OAAOM,QAAQ,CAACvB,QAAQwB,KAAK,CAAA,GAAI;QAC1FzB,GAAG0B,KAAK,CAACC,GAAG,CAAC1B,QAAQwB,KAAK;IAC5B;AACF"}
|
|
@@ -10,16 +10,15 @@ export default function worker(res, options) {
|
|
|
10
10
|
process.stderr.write(res.stderr);
|
|
11
11
|
res.stderr = null;
|
|
12
12
|
}
|
|
13
|
-
// patch: early node on windows could return null
|
|
14
|
-
if (res.status === null) res.status = 0;
|
|
13
|
+
if (res.status === null) res.status = 0; // patch: early node on windows could return null
|
|
15
14
|
// process errors
|
|
16
15
|
const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;
|
|
17
16
|
if (err) {
|
|
18
17
|
for(const key in res){
|
|
19
18
|
if (spawnKeys.indexOf(key) < 0) continue;
|
|
20
|
-
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];
|
|
19
|
+
err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];
|
|
21
20
|
}
|
|
21
|
+
throw err;
|
|
22
22
|
}
|
|
23
|
-
if (err) throw err;
|
|
24
23
|
return res;
|
|
25
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/sync.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\n\nimport type { SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(res: SpawnResult, options?: SpawnOptions): SpawnResult {\n options = options || {};\n\n // pipe if inherited\n if (res.stdout && options.stdio === 'inherit') {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && options.stdio === 'inherit') {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/sync.ts"],"sourcesContent":["import { spawnKeys } from '../constants';\n\nimport type { SpawnOptions, SpawnResult } from '../types';\n\nexport default function worker(res: SpawnResult, options?: SpawnOptions): SpawnResult {\n options = options || {};\n\n // pipe if inherited\n if (res.stdout && options.stdio === 'inherit') {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && options.stdio === 'inherit') {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n throw err;\n }\n return res;\n}\n"],"names":["spawnKeys","worker","res","options","stdout","stdio","process","write","stderr","status","err","Error","key","indexOf","Buffer","isBuffer","toString","encoding"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAe;AAIzC,eAAe,SAASC,OAAOC,GAAgB,EAAEC,OAAsB;IACrEA,UAAUA,WAAW,CAAC;IAEtB,oBAAoB;IACpB,IAAID,IAAIE,MAAM,IAAID,QAAQE,KAAK,KAAK,WAAW;QAC7CC,QAAQF,MAAM,CAACG,KAAK,CAACL,IAAIE,MAAM;QAC/BF,IAAIE,MAAM,GAAG;IACf;IACA,IAAIF,IAAIM,MAAM,IAAIL,QAAQE,KAAK,KAAK,WAAW;QAC7CC,QAAQE,MAAM,CAACD,KAAK,CAACL,IAAIM,MAAM;QAC/BN,IAAIM,MAAM,GAAG;IACf;IACA,IAAIN,IAAIO,MAAM,KAAK,MAAMP,IAAIO,MAAM,GAAG,GAAG,iDAAiD;IAE1F,iBAAiB;IACjB,MAAMC,MAAMR,IAAIO,MAAM,KAAK,IAAI,IAAIE,MAAM,CAAC,oBAAoB,EAAET,IAAIO,MAAM,EAAE,IAAI;IAChF,IAAIC,KAAK;QACP,IAAK,MAAME,OAAOV,IAAK;YACrB,IAAIF,UAAUa,OAAO,CAACD,OAAO,GAAG;YAChCF,GAAG,CAACE,IAAI,GAAGE,OAAOC,QAAQ,CAACb,GAAG,CAACU,IAAI,IAAIV,GAAG,CAACU,IAAI,CAACI,QAAQ,CAACb,QAAQc,QAAQ,IAAI,UAAUf,GAAG,CAACU,IAAI;QACjG;QACA,MAAMF;IACR;IACA,OAAOR;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function once(callback: any): () => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -33,12 +33,8 @@
|
|
|
33
33
|
"version": "tsds version"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"buffer-v6-polyfill": "^1.0.5",
|
|
37
|
-
"call-once-fn": "^1.0.9",
|
|
38
|
-
"core-js": "^3.40.0",
|
|
39
36
|
"cross-spawn": "^7.0.6",
|
|
40
|
-
"function-exec-sync": "^1.2.11"
|
|
41
|
-
"next-tick": "^1.1.0"
|
|
37
|
+
"function-exec-sync": "^1.2.11"
|
|
42
38
|
},
|
|
43
39
|
"devDependencies": {
|
|
44
40
|
"@types/mocha": "*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/polyfills/crossSpawnCompat.cjs"],"sourcesContent":["require('./patch.cjs');\nconst path = require('path');\nconst cp = require('child_process');\nconst spawn_ = require('../../../assets/cross-spawn.cjs');\n\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nfunction parse(command, args, options) {\n if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {\n const env = options ? options.env || process.env : process.env;\n command = env.NODE || env.npm_node_execpath;\n }\n return spawn_._parse(command, args, options);\n}\nconst enoent = spawn_._enoent;\n\nfunction spawn(command, args, options) {\n const parsed = parse(command, args, options);\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n enoent.hookChildProcess(spawned, parsed);\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n const parsed = parse(command, args, options);\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n"],"names":["require","path","cp","spawn_","NODES","parse","command","args","options","indexOf","basename","toLowerCase","env","process","NODE","npm_node_execpath","_parse","enoent","_enoent","spawn","parsed","spawned","hookChildProcess","spawnSync","result","error","verifyENOENTSync","status","module","exports","sync"],"mappings":";AAAAA,QAAQ;AACR,IAAMC,OAAOD,QAAQ;AACrB,IAAME,KAAKF,QAAQ;AACnB,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
|
|
3
|
-
require('core-js/actual/array/find');
|
|
4
|
-
require('buffer-v6-polyfill');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
if (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';
|
|
7
|
-
var cp = require('child_process');
|
|
8
|
-
if (!cp.spawnSync) {
|
|
9
|
-
var workerPath = path.join(__dirname, '..', 'spawn.cjs');
|
|
10
|
-
var functionExec = null; // break dependencies
|
|
11
|
-
cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {
|
|
12
|
-
if (!functionExec) functionExec = require('function-exec-sync');
|
|
13
|
-
return functionExec({
|
|
14
|
-
callbacks: true
|
|
15
|
-
}, workerPath, cmd, args, options || {});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/polyfills/patch.cjs"],"sourcesContent":["require('core-js/actual/object/keys');\nrequire('core-js/actual/array/find');\nrequire('buffer-v6-polyfill');\n\nconst path = require('path');\nif (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';\n\nconst cp = require('child_process');\nif (!cp.spawnSync) {\n const workerPath = path.join(__dirname, '..', 'spawn.cjs');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n\n return functionExec({ callbacks: true }, workerPath, cmd, args, options || {});\n };\n}\n"],"names":["require","path","delimiter","process","platform","cp","spawnSync","workerPath","join","__dirname","functionExec","spawnSyncPolyfill","cmd","args","options","callbacks"],"mappings":";AAAAA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AAER,IAAMC,OAAOD,QAAQ;AACrB,IAAI,CAACC,KAAKC,SAAS,EAAED,KAAKC,SAAS,GAAGC,QAAQC,QAAQ,KAAK,UAAU,MAAM;AAE3E,IAAMC,KAAKL,QAAQ;AACnB,IAAI,CAACK,GAAGC,SAAS,EAAE;IACjB,IAAMC,aAAaN,KAAKO,IAAI,CAACC,WAAW,MAAM;IAE9C,IAAIC,eAAe,MAAM,qBAAqB;IAC9CL,GAAGC,SAAS,GAAG,SAASK,kBAAkBC,GAAG,EAAEC,IAAI,EAAEC,OAAO;QAC1D,IAAI,CAACJ,cAAcA,eAAeV,QAAQ;QAE1C,OAAOU,aAAa;YAAEK,WAAW;QAAK,GAAGR,YAAYK,KAAKC,MAAMC,WAAW,CAAC;IAC9E;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/polyfills/crossSpawnCompat.cjs"],"sourcesContent":["require('./patch.cjs');\nconst path = require('path');\nconst cp = require('child_process');\nconst spawn_ = require('../../../assets/cross-spawn.cjs');\n\nconst NODES = ['node', 'node.exe', 'node.cmd'];\nfunction parse(command, args, options) {\n if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {\n const env = options ? options.env || process.env : process.env;\n command = env.NODE || env.npm_node_execpath;\n }\n return spawn_._parse(command, args, options);\n}\nconst enoent = spawn_._enoent;\n\nfunction spawn(command, args, options) {\n const parsed = parse(command, args, options);\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n enoent.hookChildProcess(spawned, parsed);\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n const parsed = parse(command, args, options);\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n"],"names":["require","path","cp","spawn_","NODES","parse","command","args","options","indexOf","basename","toLowerCase","env","process","NODE","npm_node_execpath","_parse","enoent","_enoent","spawn","parsed","spawned","hookChildProcess","spawnSync","result","error","verifyENOENTSync","status","module","exports","sync"],"mappings":"AAAAA,QAAQ;AACR,MAAMC,OAAOD,QAAQ;AACrB,MAAME,KAAKF,QAAQ;AACnB,MAAMG,SAASH,QAAQ;AAEvB,MAAMI,QAAQ;IAAC;IAAQ;IAAY;CAAW;AAC9C,SAASC,MAAMC,OAAO,EAAEC,IAAI,EAAEC,OAAO;IACnC,IAAIJ,MAAMK,OAAO,CAACR,KAAKS,QAAQ,CAACJ,SAASK,WAAW,OAAO,GAAG;QAC5D,MAAMC,MAAMJ,UAAUA,QAAQI,GAAG,IAAIC,QAAQD,GAAG,GAAGC,QAAQD,GAAG;QAC9DN,UAAUM,IAAIE,IAAI,IAAIF,IAAIG,iBAAiB;IAC7C;IACA,OAAOZ,OAAOa,MAAM,CAACV,SAASC,MAAMC;AACtC;AACA,MAAMS,SAASd,OAAOe,OAAO;AAE7B,SAASC,MAAMb,OAAO,EAAEC,IAAI,EAAEC,OAAO;IACnC,MAAMY,SAASf,MAAMC,SAASC,MAAMC;IACpC,MAAMa,UAAUnB,GAAGiB,KAAK,CAACC,OAAOd,OAAO,EAAEc,OAAOb,IAAI,EAAEa,OAAOZ,OAAO;IACpES,OAAOK,gBAAgB,CAACD,SAASD;IACjC,OAAOC;AACT;AAEA,SAASE,UAAUjB,OAAO,EAAEC,IAAI,EAAEC,OAAO;IACvC,MAAMY,SAASf,MAAMC,SAASC,MAAMC;IACpC,MAAMgB,SAAStB,GAAGqB,SAAS,CAACH,OAAOd,OAAO,EAAEc,OAAOb,IAAI,EAAEa,OAAOZ,OAAO;IACvEgB,OAAOC,KAAK,GAAGD,OAAOC,KAAK,IAAIR,OAAOS,gBAAgB,CAACF,OAAOG,MAAM,EAAEP;IACtE,OAAOI;AACT;AAEAI,OAAOC,OAAO,GAAGV;AACjBS,OAAOC,OAAO,CAACV,KAAK,GAAGA;AACvBS,OAAOC,OAAO,CAACC,IAAI,GAAGP;AACtBK,OAAOC,OAAO,CAACb,MAAM,GAAGX;AACxBuB,OAAOC,OAAO,CAACX,OAAO,GAAGD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require('core-js/actual/object/keys');
|
|
2
|
-
require('core-js/actual/array/find');
|
|
3
|
-
require('buffer-v6-polyfill');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
if (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';
|
|
6
|
-
const cp = require('child_process');
|
|
7
|
-
if (!cp.spawnSync) {
|
|
8
|
-
const workerPath = path.join(__dirname, '..', 'spawn.cjs');
|
|
9
|
-
let functionExec = null; // break dependencies
|
|
10
|
-
cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {
|
|
11
|
-
if (!functionExec) functionExec = require('function-exec-sync');
|
|
12
|
-
return functionExec({
|
|
13
|
-
callbacks: true
|
|
14
|
-
}, workerPath, cmd, args, options || {});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/polyfills/patch.cjs"],"sourcesContent":["require('core-js/actual/object/keys');\nrequire('core-js/actual/array/find');\nrequire('buffer-v6-polyfill');\n\nconst path = require('path');\nif (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';\n\nconst cp = require('child_process');\nif (!cp.spawnSync) {\n const workerPath = path.join(__dirname, '..', 'spawn.cjs');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n\n return functionExec({ callbacks: true }, workerPath, cmd, args, options || {});\n };\n}\n"],"names":["require","path","delimiter","process","platform","cp","spawnSync","workerPath","join","__dirname","functionExec","spawnSyncPolyfill","cmd","args","options","callbacks"],"mappings":"AAAAA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AAER,MAAMC,OAAOD,QAAQ;AACrB,IAAI,CAACC,KAAKC,SAAS,EAAED,KAAKC,SAAS,GAAGC,QAAQC,QAAQ,KAAK,UAAU,MAAM;AAE3E,MAAMC,KAAKL,QAAQ;AACnB,IAAI,CAACK,GAAGC,SAAS,EAAE;IACjB,MAAMC,aAAaN,KAAKO,IAAI,CAACC,WAAW,MAAM;IAE9C,IAAIC,eAAe,MAAM,qBAAqB;IAC9CL,GAAGC,SAAS,GAAG,SAASK,kBAAkBC,GAAG,EAAEC,IAAI,EAAEC,OAAO;QAC1D,IAAI,CAACJ,cAAcA,eAAeV,QAAQ;QAE1C,OAAOU,aAAa;YAAEK,WAAW;QAAK,GAAGR,YAAYK,KAAKC,MAAMC,WAAW,CAAC;IAC9E;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|