cross-spawn-cb 1.5.5 → 1.5.6
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.js
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
// BEGIN SHIMS
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function _object_spread(target) {
|
|
17
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
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
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
}
|
|
31
|
+
// END SHIMS
|
|
1
32
|
'use strict';
|
|
2
33
|
|
|
3
34
|
var require$$0$2 = require('child_process');
|
|
@@ -30,7 +61,7 @@ function requireWindows() {
|
|
|
30
61
|
if (pathext.indexOf('') !== -1) {
|
|
31
62
|
return true;
|
|
32
63
|
}
|
|
33
|
-
for(var i = 0; i < pathext.length; i++){
|
|
64
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
34
65
|
var p = pathext[i].toLowerCase();
|
|
35
66
|
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
36
67
|
return true;
|
|
@@ -45,7 +76,7 @@ function requireWindows() {
|
|
|
45
76
|
return checkPathExt(path, options);
|
|
46
77
|
}
|
|
47
78
|
function isexe(path, options, cb) {
|
|
48
|
-
fs.stat(path, function(er, stat) {
|
|
79
|
+
fs.stat(path, function (er, stat) {
|
|
49
80
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
50
81
|
});
|
|
51
82
|
}
|
|
@@ -64,7 +95,7 @@ function requireMode() {
|
|
|
64
95
|
isexe.sync = sync;
|
|
65
96
|
var fs = require$$0;
|
|
66
97
|
function isexe(path, options, cb) {
|
|
67
|
-
fs.stat(path, function(er, stat) {
|
|
98
|
+
fs.stat(path, function (er, stat) {
|
|
68
99
|
cb(er, er ? false : checkStat(stat, options));
|
|
69
100
|
});
|
|
70
101
|
}
|
|
@@ -112,8 +143,8 @@ function requireIsexe() {
|
|
|
112
143
|
if (typeof Promise !== 'function') {
|
|
113
144
|
throw new TypeError('callback not provided');
|
|
114
145
|
}
|
|
115
|
-
return new Promise(function(resolve, reject) {
|
|
116
|
-
isexe(path, options || {}, function(er, is) {
|
|
146
|
+
return new Promise(function (resolve, reject) {
|
|
147
|
+
isexe(path, options || {}, function (er, is) {
|
|
117
148
|
if (er) {
|
|
118
149
|
reject(er);
|
|
119
150
|
} else {
|
|
@@ -122,7 +153,7 @@ function requireIsexe() {
|
|
|
122
153
|
});
|
|
123
154
|
});
|
|
124
155
|
}
|
|
125
|
-
core(path, options || {}, function(er, is) {
|
|
156
|
+
core(path, options || {}, function (er, is) {
|
|
126
157
|
// ignore EACCES because that just means we aren't allowed to run it
|
|
127
158
|
if (er) {
|
|
128
159
|
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
@@ -150,7 +181,7 @@ function requireIsexe() {
|
|
|
150
181
|
|
|
151
182
|
function _array_like_to_array$1(arr, len) {
|
|
152
183
|
if (len == null || len > arr.length) len = arr.length;
|
|
153
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
184
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
154
185
|
return arr2;
|
|
155
186
|
}
|
|
156
187
|
function _array_without_holes(arr) {
|
|
@@ -182,21 +213,21 @@ function requireWhich() {
|
|
|
182
213
|
var path = require$$0$1;
|
|
183
214
|
var COLON = isWindows ? ';' : ':';
|
|
184
215
|
var isexe = requireIsexe();
|
|
185
|
-
var getNotFoundError = function(cmd) {
|
|
186
|
-
return
|
|
216
|
+
var getNotFoundError = function (cmd) {
|
|
217
|
+
return _object_spread(new Error("not found: ".concat(cmd)), {
|
|
187
218
|
code: 'ENOENT'
|
|
188
219
|
});
|
|
189
220
|
};
|
|
190
|
-
var getPathInfo = function(cmd, opt) {
|
|
221
|
+
var getPathInfo = function (cmd, opt) {
|
|
191
222
|
var colon = opt.colon || COLON;
|
|
192
223
|
// If it has a slash, then we don't bother searching the pathenv.
|
|
193
224
|
// just check the file itself, and that's it.
|
|
194
225
|
var pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
|
|
195
226
|
''
|
|
196
227
|
] : // windows always checks the cwd first
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
228
|
+
_to_consumable_array(isWindows ? [
|
|
229
|
+
process.cwd()
|
|
230
|
+
] : []).concat(_to_consumable_array((opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ '').split(colon)));
|
|
200
231
|
var pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
|
|
201
232
|
var pathExt = isWindows ? pathExtExe.split(colon) : [
|
|
202
233
|
''
|
|
@@ -210,7 +241,7 @@ function requireWhich() {
|
|
|
210
241
|
pathExtExe: pathExtExe
|
|
211
242
|
};
|
|
212
243
|
};
|
|
213
|
-
var which = function(cmd, opt, cb) {
|
|
244
|
+
var which = function (cmd, opt, cb) {
|
|
214
245
|
if (typeof opt === 'function') {
|
|
215
246
|
cb = opt;
|
|
216
247
|
opt = {};
|
|
@@ -218,8 +249,8 @@ function requireWhich() {
|
|
|
218
249
|
if (!opt) opt = {};
|
|
219
250
|
var _getPathInfo = getPathInfo(cmd, opt), pathEnv = _getPathInfo.pathEnv, pathExt = _getPathInfo.pathExt, pathExtExe = _getPathInfo.pathExtExe;
|
|
220
251
|
var found = [];
|
|
221
|
-
var step = function(i) {
|
|
222
|
-
return new Promise(function(resolve, reject) {
|
|
252
|
+
var step = function (i) {
|
|
253
|
+
return new Promise(function (resolve, reject) {
|
|
223
254
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
224
255
|
var ppRaw = pathEnv[i];
|
|
225
256
|
var pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
@@ -228,13 +259,13 @@ function requireWhich() {
|
|
|
228
259
|
resolve(subStep(p, i, 0));
|
|
229
260
|
});
|
|
230
261
|
};
|
|
231
|
-
var subStep = function(p, i, ii) {
|
|
232
|
-
return new Promise(function(resolve, reject) {
|
|
262
|
+
var subStep = function (p, i, ii) {
|
|
263
|
+
return new Promise(function (resolve, reject) {
|
|
233
264
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
234
265
|
var ext = pathExt[ii];
|
|
235
266
|
isexe(p + ext, {
|
|
236
267
|
pathExt: pathExtExe
|
|
237
|
-
}, function(er, is) {
|
|
268
|
+
}, function (er, is) {
|
|
238
269
|
if (!er && is) {
|
|
239
270
|
if (opt.all) found.push(p + ext);
|
|
240
271
|
else return resolve(p + ext);
|
|
@@ -243,20 +274,20 @@ function requireWhich() {
|
|
|
243
274
|
});
|
|
244
275
|
});
|
|
245
276
|
};
|
|
246
|
-
return cb ? step(0).then(function(res) {
|
|
277
|
+
return cb ? step(0).then(function (res) {
|
|
247
278
|
return cb(null, res);
|
|
248
279
|
}, cb) : step(0);
|
|
249
280
|
};
|
|
250
|
-
var whichSync = function(cmd, opt) {
|
|
281
|
+
var whichSync = function (cmd, opt) {
|
|
251
282
|
opt = opt || {};
|
|
252
283
|
var _getPathInfo = getPathInfo(cmd, opt), pathEnv = _getPathInfo.pathEnv, pathExt = _getPathInfo.pathExt, pathExtExe = _getPathInfo.pathExtExe;
|
|
253
284
|
var found = [];
|
|
254
|
-
for(var i = 0; i < pathEnv.length; i++){
|
|
285
|
+
for (var i = 0; i < pathEnv.length; i++) {
|
|
255
286
|
var ppRaw = pathEnv[i];
|
|
256
287
|
var pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
257
288
|
var pCmd = path.join(pathPart, cmd);
|
|
258
289
|
var p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
259
|
-
for(var j = 0; j < pathExt.length; j++){
|
|
290
|
+
for (var j = 0; j < pathExt.length; j++) {
|
|
260
291
|
var cur = p + pathExt[j];
|
|
261
292
|
try {
|
|
262
293
|
var is = isexe.sync(cur, {
|
|
@@ -266,7 +297,7 @@ function requireWhich() {
|
|
|
266
297
|
if (opt.all) found.push(cur);
|
|
267
298
|
else return cur;
|
|
268
299
|
}
|
|
269
|
-
} catch (ex) {}
|
|
300
|
+
} catch (ex) { }
|
|
270
301
|
}
|
|
271
302
|
}
|
|
272
303
|
if (opt.all && found.length) return found;
|
|
@@ -286,14 +317,14 @@ var hasRequiredPathKey;
|
|
|
286
317
|
function requirePathKey() {
|
|
287
318
|
if (hasRequiredPathKey) return pathKey.exports;
|
|
288
319
|
hasRequiredPathKey = 1;
|
|
289
|
-
var pathKey$1 = function() {
|
|
320
|
+
var pathKey$1 = function () {
|
|
290
321
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
291
322
|
var environment = options.env || process.env;
|
|
292
323
|
var platform = options.platform || process.platform;
|
|
293
324
|
if (platform !== 'win32') {
|
|
294
325
|
return 'PATH';
|
|
295
326
|
}
|
|
296
|
-
return Object.keys(environment).reverse().find(function(key) {
|
|
327
|
+
return Object.keys(environment).reverse().find(function (key) {
|
|
297
328
|
return key.toUpperCase() === 'PATH';
|
|
298
329
|
}) || 'Path';
|
|
299
330
|
};
|
|
@@ -323,7 +354,8 @@ function requireResolveCommand() {
|
|
|
323
354
|
try {
|
|
324
355
|
process.chdir(parsed.options.cwd);
|
|
325
356
|
} catch (err) {
|
|
326
|
-
|
|
357
|
+
/* Empty */
|
|
358
|
+
}
|
|
327
359
|
}
|
|
328
360
|
var resolved;
|
|
329
361
|
try {
|
|
@@ -334,7 +366,8 @@ function requireResolveCommand() {
|
|
|
334
366
|
pathExt: withoutPathExt ? path.delimiter : undefined
|
|
335
367
|
});
|
|
336
368
|
} catch (e) {
|
|
337
|
-
|
|
369
|
+
/* Empty */
|
|
370
|
+
} finally {
|
|
338
371
|
if (shouldSwitchCwd) {
|
|
339
372
|
process.chdir(cwd);
|
|
340
373
|
}
|
|
@@ -406,7 +439,7 @@ function requireShebangRegex() {
|
|
|
406
439
|
|
|
407
440
|
function _array_like_to_array(arr, len) {
|
|
408
441
|
if (len == null || len > arr.length) len = arr.length;
|
|
409
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
442
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
410
443
|
return arr2;
|
|
411
444
|
}
|
|
412
445
|
function _array_with_holes(arr) {
|
|
@@ -420,17 +453,17 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
420
453
|
var _d = false;
|
|
421
454
|
var _s, _e;
|
|
422
455
|
try {
|
|
423
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
456
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
424
457
|
_arr.push(_s.value);
|
|
425
458
|
if (i && _arr.length === i) break;
|
|
426
459
|
}
|
|
427
460
|
} catch (err) {
|
|
428
461
|
_d = true;
|
|
429
462
|
_e = err;
|
|
430
|
-
} finally{
|
|
463
|
+
} finally {
|
|
431
464
|
try {
|
|
432
465
|
if (!_n && _i["return"] != null) _i["return"]();
|
|
433
|
-
} finally{
|
|
466
|
+
} finally {
|
|
434
467
|
if (_d) throw _e;
|
|
435
468
|
}
|
|
436
469
|
}
|
|
@@ -456,7 +489,7 @@ function requireShebangCommand() {
|
|
|
456
489
|
if (hasRequiredShebangCommand) return shebangCommand;
|
|
457
490
|
hasRequiredShebangCommand = 1;
|
|
458
491
|
var shebangRegex = requireShebangRegex();
|
|
459
|
-
shebangCommand = function() {
|
|
492
|
+
shebangCommand = function () {
|
|
460
493
|
var string = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
|
|
461
494
|
var match = string.match(shebangRegex);
|
|
462
495
|
if (!match) {
|
|
@@ -488,7 +521,7 @@ function requireReadShebang() {
|
|
|
488
521
|
fd = fs.openSync(command, 'r');
|
|
489
522
|
fs.readSync(fd, buffer, 0, size, 0);
|
|
490
523
|
fs.closeSync(fd);
|
|
491
|
-
} catch (e) {}
|
|
524
|
+
} catch (e) { }
|
|
492
525
|
// Attempt to extract shebang (null is returned if not a shebang)
|
|
493
526
|
return shebangCommand(buffer.toString());
|
|
494
527
|
}
|
|
@@ -539,7 +572,7 @@ function requireParse() {
|
|
|
539
572
|
parsed.command = path.normalize(parsed.command);
|
|
540
573
|
// Escape command & arguments
|
|
541
574
|
parsed.command = escape.command(parsed.command);
|
|
542
|
-
parsed.args = parsed.args.map(function(arg) {
|
|
575
|
+
parsed.args = parsed.args.map(function (arg) {
|
|
543
576
|
return escape.argument(arg, needsDoubleEscapeMetaChars);
|
|
544
577
|
});
|
|
545
578
|
var shellCommand = [
|
|
@@ -563,7 +596,7 @@ function requireParse() {
|
|
|
563
596
|
args = null;
|
|
564
597
|
}
|
|
565
598
|
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
566
|
-
options =
|
|
599
|
+
options = _object_spread({}, options); // Clone object to avoid changing the original
|
|
567
600
|
// Build our parsed object
|
|
568
601
|
var parsed = {
|
|
569
602
|
command: command,
|
|
@@ -589,7 +622,7 @@ function requireEnoent() {
|
|
|
589
622
|
hasRequiredEnoent = 1;
|
|
590
623
|
var isWin = process.platform === 'win32';
|
|
591
624
|
function notFoundError(original, syscall) {
|
|
592
|
-
return
|
|
625
|
+
return _object_spread(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
|
|
593
626
|
code: 'ENOENT',
|
|
594
627
|
errno: 'ENOENT',
|
|
595
628
|
syscall: "".concat(syscall, " ").concat(original.command),
|
|
@@ -602,7 +635,7 @@ function requireEnoent() {
|
|
|
602
635
|
return;
|
|
603
636
|
}
|
|
604
637
|
var originalEmit = cp.emit;
|
|
605
|
-
cp.emit = function(name, arg1) {
|
|
638
|
+
cp.emit = function (name, arg1) {
|
|
606
639
|
// If emitting "exit" event and exit code is 1, we need to check if
|
|
607
640
|
// the command exists and emit an "error" instead
|
|
608
641
|
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/spawnCompat/polyfills.cjs"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/spawnCompat/polyfills.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 spawnCallback = path.join(__dirname, '..', 'spawnCallback.js');\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 }, spawnCallback, cmd, args, options || {});\n };\n}\n"],"names":["require","path","delimiter","process","platform","cp","spawnSync","spawnCallback","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,gBAAgBN,KAAKO,IAAI,CAACC,WAAW,MAAM;IAEjD,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,eAAeK,KAAKC,MAAMC,WAAW,CAAC;IACjF;AACF"}
|