cross-spawn-cb 2.2.4 → 2.2.5
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 +90 -88
- package/dist/cjs/crossSpawn.d.cts +14 -0
- package/dist/cjs/crossSpawn.d.ts +14 -0
- package/dist/cjs/crossSpawn.js +62 -0
- package/dist/cjs/crossSpawn.js.map +1 -0
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/spawn.d.cts +1 -1
- package/dist/cjs/spawn.d.ts +1 -1
- package/dist/cjs/spawn.js +3 -3
- package/dist/cjs/spawn.js.map +1 -1
- package/dist/cjs/spawnSync.d.cts +2 -2
- package/dist/cjs/spawnSync.d.ts +2 -2
- package/dist/cjs/spawnSync.js +2 -2
- package/dist/cjs/spawnSync.js.map +1 -1
- package/dist/cjs/types.d.cts +17 -1
- package/dist/cjs/types.d.ts +17 -1
- package/dist/cjs/workers/async.js.map +1 -1
- package/dist/esm/crossSpawn.d.ts +14 -0
- package/dist/esm/crossSpawn.js +46 -0
- package/dist/esm/crossSpawn.js.map +1 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/spawn.d.ts +1 -1
- package/dist/esm/spawn.js +1 -1
- package/dist/esm/spawn.js.map +1 -1
- package/dist/esm/spawnSync.d.ts +2 -2
- package/dist/esm/spawnSync.js +1 -1
- package/dist/esm/spawnSync.js.map +1 -1
- package/dist/esm/types.d.ts +17 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/workers/async.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/lib/crossSpawn.cjs +0 -4
- package/dist/cjs/lib/crossSpawn.cjs.map +0 -1
- package/dist/cjs/lib/crossSpawn.d.cts +0 -2
- package/dist/cjs/lib/crossSpawnCompat.cjs +0 -36
- package/dist/cjs/lib/crossSpawnCompat.cjs.map +0 -1
- package/dist/cjs/lib/crossSpawnCompat.d.cts +0 -9
- package/dist/esm/lib/crossSpawn.cjs +0 -2
- package/dist/esm/lib/crossSpawn.cjs.map +0 -1
- package/dist/esm/lib/crossSpawn.d.cts +0 -2
- package/dist/esm/lib/crossSpawnCompat.cjs +0 -34
- package/dist/esm/lib/crossSpawnCompat.cjs.map +0 -1
- package/dist/esm/lib/crossSpawnCompat.d.cts +0 -9
package/assets/cross-spawn.cjs
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
/* COMPATIBILITY POLYFILLS */
|
|
4
4
|
|
|
5
5
|
function objectAssign(target) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
// biome-ignore lint/style/noArguments: <explanation>
|
|
7
|
+
var objects = Array.prototype.slice.call(arguments, 1);
|
|
8
|
+
while (objects.length) {
|
|
9
|
+
var object = objects.pop();
|
|
10
|
+
for (var key in object) {
|
|
11
|
+
target[key] = object[key];
|
|
12
|
+
}
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
return target;
|
|
14
|
+
return target;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function findKey(obj, fn) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
for (var key in obj) {
|
|
19
|
+
if (fn(key)) return key;
|
|
20
|
+
}
|
|
21
|
+
return null
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
var pathDelimiter = process.platform === 'win32' ? ';' : ':';
|
|
@@ -51,7 +51,7 @@ function requireSrc() {
|
|
|
51
51
|
*/ src = function src(fn) {
|
|
52
52
|
try {
|
|
53
53
|
return fn();
|
|
54
|
-
} catch (e) {}
|
|
54
|
+
} catch (e) { }
|
|
55
55
|
};
|
|
56
56
|
return src;
|
|
57
57
|
}
|
|
@@ -73,7 +73,7 @@ function requireWindows() {
|
|
|
73
73
|
if (pathext.indexOf('') !== -1) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
|
-
for(var i = 0; i < pathext.length; i++){
|
|
76
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
77
77
|
var p = pathext[i].toLowerCase();
|
|
78
78
|
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
79
79
|
return true;
|
|
@@ -88,7 +88,7 @@ function requireWindows() {
|
|
|
88
88
|
return checkPathExt(path, options);
|
|
89
89
|
}
|
|
90
90
|
function isexe(path, options, cb) {
|
|
91
|
-
fs.stat(path, function(er, stat) {
|
|
91
|
+
fs.stat(path, function (er, stat) {
|
|
92
92
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -107,7 +107,7 @@ function requireMode() {
|
|
|
107
107
|
isexe.sync = sync;
|
|
108
108
|
var fs = require$$0;
|
|
109
109
|
function isexe(path, options, cb) {
|
|
110
|
-
fs.stat(path, function(er, stat) {
|
|
110
|
+
fs.stat(path, function (er, stat) {
|
|
111
111
|
cb(er, er ? false : checkStat(stat, options));
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -155,8 +155,8 @@ function requireIsexe() {
|
|
|
155
155
|
if (typeof Promise !== 'function') {
|
|
156
156
|
throw new TypeError('callback not provided');
|
|
157
157
|
}
|
|
158
|
-
return new Promise(function(resolve, reject) {
|
|
159
|
-
isexe(path, options || {}, function(er, is) {
|
|
158
|
+
return new Promise(function (resolve, reject) {
|
|
159
|
+
isexe(path, options || {}, function (er, is) {
|
|
160
160
|
if (er) {
|
|
161
161
|
reject(er);
|
|
162
162
|
} else {
|
|
@@ -165,7 +165,7 @@ function requireIsexe() {
|
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
core(path, options || {}, function(er, is) {
|
|
168
|
+
core(path, options || {}, function (er, is) {
|
|
169
169
|
// ignore EACCES because that just means we aren't allowed to run it
|
|
170
170
|
if (er) {
|
|
171
171
|
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
@@ -260,7 +260,7 @@ function requireWhich() {
|
|
|
260
260
|
var ext = pathExt[ii];
|
|
261
261
|
isexe(p + ext, {
|
|
262
262
|
pathExt: pathExtExe
|
|
263
|
-
}, function(er, is) {
|
|
263
|
+
}, function (er, is) {
|
|
264
264
|
if (!er && is) {
|
|
265
265
|
if (opt.all) found.push(p + ext);
|
|
266
266
|
else return cb(null, p + ext);
|
|
@@ -277,14 +277,14 @@ function requireWhich() {
|
|
|
277
277
|
var pathExt = info.ext;
|
|
278
278
|
var pathExtExe = info.extExe;
|
|
279
279
|
var found = [];
|
|
280
|
-
for(var i = 0, l = pathEnv.length; i < l; i++){
|
|
280
|
+
for (var i = 0, l = pathEnv.length; i < l; i++) {
|
|
281
281
|
var pathPart = pathEnv[i];
|
|
282
282
|
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
283
283
|
var p = path.join(pathPart, cmd);
|
|
284
284
|
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
285
285
|
p = cmd.slice(0, 2) + p;
|
|
286
286
|
}
|
|
287
|
-
for(var j = 0, ll = pathExt.length; j < ll; j++){
|
|
287
|
+
for (var j = 0, ll = pathExt.length; j < ll; j++) {
|
|
288
288
|
var cur = p + pathExt[j];
|
|
289
289
|
var is;
|
|
290
290
|
try {
|
|
@@ -295,7 +295,7 @@ function requireWhich() {
|
|
|
295
295
|
if (opt.all) found.push(cur);
|
|
296
296
|
else return cur;
|
|
297
297
|
}
|
|
298
|
-
} catch (ex) {}
|
|
298
|
+
} catch (ex) { }
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
if (opt.all && found.length) return found;
|
|
@@ -310,14 +310,14 @@ var hasRequiredPathKey;
|
|
|
310
310
|
function requirePathKey() {
|
|
311
311
|
if (hasRequiredPathKey) return pathKey;
|
|
312
312
|
hasRequiredPathKey = 1;
|
|
313
|
-
pathKey = function(opts) {
|
|
313
|
+
pathKey = function (opts) {
|
|
314
314
|
opts = opts || {};
|
|
315
315
|
var env = opts.env || process.env;
|
|
316
316
|
var platform = opts.platform || process.platform;
|
|
317
317
|
if (platform !== 'win32') {
|
|
318
318
|
return 'PATH';
|
|
319
319
|
}
|
|
320
|
-
return findKey(env, function(x) {
|
|
320
|
+
return findKey(env, function (x) {
|
|
321
321
|
return x.toUpperCase() === 'PATH';
|
|
322
322
|
}) || 'Path';
|
|
323
323
|
};
|
|
@@ -341,7 +341,8 @@ function requireResolveCommand() {
|
|
|
341
341
|
try {
|
|
342
342
|
process.chdir(parsed.options.cwd);
|
|
343
343
|
} catch (err) {
|
|
344
|
-
|
|
344
|
+
/* Empty */
|
|
345
|
+
}
|
|
345
346
|
}
|
|
346
347
|
var resolved;
|
|
347
348
|
try {
|
|
@@ -350,7 +351,8 @@ function requireResolveCommand() {
|
|
|
350
351
|
pathExt: withoutPathExt ? pathDelimiter : undefined
|
|
351
352
|
});
|
|
352
353
|
} catch (e) {
|
|
353
|
-
|
|
354
|
+
/* Empty */
|
|
355
|
+
} finally {
|
|
354
356
|
process.chdir(cwd);
|
|
355
357
|
}
|
|
356
358
|
// If we successfully resolved, ensure that an absolute path is returned
|
|
@@ -459,7 +461,7 @@ function requireReadShebang() {
|
|
|
459
461
|
fd = fs.openSync(command, 'r');
|
|
460
462
|
fs.readSync(fd, buffer, 0, size, 0);
|
|
461
463
|
fs.closeSync(fd);
|
|
462
|
-
} catch (e) {}
|
|
464
|
+
} catch (e) { }
|
|
463
465
|
// Attempt to extract shebang (null is returned if not a shebang)
|
|
464
466
|
return shebangCommand(buffer.toString());
|
|
465
467
|
}
|
|
@@ -486,7 +488,7 @@ var hasRequiredSemver;
|
|
|
486
488
|
function requireSemver() {
|
|
487
489
|
if (hasRequiredSemver) return semver.exports;
|
|
488
490
|
hasRequiredSemver = 1;
|
|
489
|
-
(function(module, exports) {
|
|
491
|
+
(function (module, exports) {
|
|
490
492
|
exports = module.exports = SemVer;
|
|
491
493
|
var debug;
|
|
492
494
|
/* istanbul ignore next */ if ((typeof process === "undefined" ? "undefined" : _type_of(process)) === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
@@ -496,7 +498,7 @@ function requireSemver() {
|
|
|
496
498
|
console.log.apply(console, args);
|
|
497
499
|
};
|
|
498
500
|
} else {
|
|
499
|
-
debug = function debug() {};
|
|
501
|
+
debug = function debug() { };
|
|
500
502
|
}
|
|
501
503
|
// Note: this is the semver.org version of the spec that it implements
|
|
502
504
|
// Not necessarily the package version of this code.
|
|
@@ -533,7 +535,7 @@ function requireSemver() {
|
|
|
533
535
|
]
|
|
534
536
|
];
|
|
535
537
|
function makeSafeRe(value) {
|
|
536
|
-
for(var i = 0; i < safeRegexReplacements.length; i++){
|
|
538
|
+
for (var i = 0; i < safeRegexReplacements.length; i++) {
|
|
537
539
|
var token = safeRegexReplacements[i][0];
|
|
538
540
|
var max = safeRegexReplacements[i][1];
|
|
539
541
|
value = value.split(token + '*').join(token + '{0,' + max + '}').split(token + '+').join(token + '{1,' + max + '}');
|
|
@@ -670,7 +672,7 @@ function requireSemver() {
|
|
|
670
672
|
src[STAR] = '(<|>)?=?\\s*\\*';
|
|
671
673
|
// Compile to actual regexp objects.
|
|
672
674
|
// All are flag-free, unless they were created above with a flag.
|
|
673
|
-
for(var i = 0; i < R; i++){
|
|
675
|
+
for (var i = 0; i < R; i++) {
|
|
674
676
|
debug(i, src[i]);
|
|
675
677
|
if (!re[i]) {
|
|
676
678
|
re[i] = new RegExp(src[i]);
|
|
@@ -768,7 +770,7 @@ function requireSemver() {
|
|
|
768
770
|
if (!m[4]) {
|
|
769
771
|
this.prerelease = [];
|
|
770
772
|
} else {
|
|
771
|
-
this.prerelease = m[4].split('.').map(function(id) {
|
|
773
|
+
this.prerelease = m[4].split('.').map(function (id) {
|
|
772
774
|
if (/^[0-9]+$/.test(id)) {
|
|
773
775
|
var num = +id;
|
|
774
776
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
@@ -781,30 +783,30 @@ function requireSemver() {
|
|
|
781
783
|
this.build = m[5] ? m[5].split('.') : [];
|
|
782
784
|
this.format();
|
|
783
785
|
}
|
|
784
|
-
SemVer.prototype.format = function() {
|
|
786
|
+
SemVer.prototype.format = function () {
|
|
785
787
|
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
786
788
|
if (this.prerelease.length) {
|
|
787
789
|
this.version += '-' + this.prerelease.join('.');
|
|
788
790
|
}
|
|
789
791
|
return this.version;
|
|
790
792
|
};
|
|
791
|
-
SemVer.prototype.toString = function() {
|
|
793
|
+
SemVer.prototype.toString = function () {
|
|
792
794
|
return this.version;
|
|
793
795
|
};
|
|
794
|
-
SemVer.prototype.compare = function(other) {
|
|
796
|
+
SemVer.prototype.compare = function (other) {
|
|
795
797
|
debug('SemVer.compare', this.version, this.options, other);
|
|
796
798
|
if (!_instanceof(other, SemVer)) {
|
|
797
799
|
other = new SemVer(other, this.options);
|
|
798
800
|
}
|
|
799
801
|
return this.compareMain(other) || this.comparePre(other);
|
|
800
802
|
};
|
|
801
|
-
SemVer.prototype.compareMain = function(other) {
|
|
803
|
+
SemVer.prototype.compareMain = function (other) {
|
|
802
804
|
if (!_instanceof(other, SemVer)) {
|
|
803
805
|
other = new SemVer(other, this.options);
|
|
804
806
|
}
|
|
805
807
|
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
806
808
|
};
|
|
807
|
-
SemVer.prototype.comparePre = function(other) {
|
|
809
|
+
SemVer.prototype.comparePre = function (other) {
|
|
808
810
|
if (!_instanceof(other, SemVer)) {
|
|
809
811
|
other = new SemVer(other, this.options);
|
|
810
812
|
}
|
|
@@ -832,12 +834,12 @@ function requireSemver() {
|
|
|
832
834
|
} else {
|
|
833
835
|
return compareIdentifiers(a, b);
|
|
834
836
|
}
|
|
835
|
-
}while (++i);
|
|
837
|
+
} while (++i);
|
|
836
838
|
};
|
|
837
839
|
// preminor will bump the version up to the next minor release, and immediately
|
|
838
840
|
// down to pre-release. premajor and prepatch work the same way.
|
|
839
|
-
SemVer.prototype.inc = function(release, identifier) {
|
|
840
|
-
switch(release){
|
|
841
|
+
SemVer.prototype.inc = function (release, identifier) {
|
|
842
|
+
switch (release) {
|
|
841
843
|
case 'premajor':
|
|
842
844
|
this.prerelease.length = 0;
|
|
843
845
|
this.patch = 0;
|
|
@@ -909,7 +911,7 @@ function requireSemver() {
|
|
|
909
911
|
];
|
|
910
912
|
} else {
|
|
911
913
|
var i = this.prerelease.length;
|
|
912
|
-
while(--i >= 0){
|
|
914
|
+
while (--i >= 0) {
|
|
913
915
|
if (typeof this.prerelease[i] === 'number') {
|
|
914
916
|
this.prerelease[i]++;
|
|
915
917
|
i = -2;
|
|
@@ -969,7 +971,7 @@ function requireSemver() {
|
|
|
969
971
|
prefix = 'pre';
|
|
970
972
|
var defaultResult = 'prerelease';
|
|
971
973
|
}
|
|
972
|
-
for(var key in v1){
|
|
974
|
+
for (var key in v1) {
|
|
973
975
|
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
974
976
|
if (v1[key] !== v2[key]) {
|
|
975
977
|
return prefix + key;
|
|
@@ -977,7 +979,7 @@ function requireSemver() {
|
|
|
977
979
|
}
|
|
978
980
|
}
|
|
979
981
|
return defaultResult // may be undefined
|
|
980
|
-
|
|
982
|
+
;
|
|
981
983
|
}
|
|
982
984
|
}
|
|
983
985
|
exports.compareIdentifiers = compareIdentifiers;
|
|
@@ -1021,13 +1023,13 @@ function requireSemver() {
|
|
|
1021
1023
|
}
|
|
1022
1024
|
exports.sort = sort;
|
|
1023
1025
|
function sort(list, loose) {
|
|
1024
|
-
return list.sort(function(a, b) {
|
|
1026
|
+
return list.sort(function (a, b) {
|
|
1025
1027
|
return exports.compare(a, b, loose);
|
|
1026
1028
|
});
|
|
1027
1029
|
}
|
|
1028
1030
|
exports.rsort = rsort;
|
|
1029
1031
|
function rsort(list, loose) {
|
|
1030
|
-
return list.sort(function(a, b) {
|
|
1032
|
+
return list.sort(function (a, b) {
|
|
1031
1033
|
return exports.rcompare(a, b, loose);
|
|
1032
1034
|
});
|
|
1033
1035
|
}
|
|
@@ -1057,7 +1059,7 @@ function requireSemver() {
|
|
|
1057
1059
|
}
|
|
1058
1060
|
exports.cmp = cmp;
|
|
1059
1061
|
function cmp(a, op, b, loose) {
|
|
1060
|
-
switch(op){
|
|
1062
|
+
switch (op) {
|
|
1061
1063
|
case '===':
|
|
1062
1064
|
if ((typeof a === "undefined" ? "undefined" : _type_of(a)) === 'object') a = a.version;
|
|
1063
1065
|
if ((typeof b === "undefined" ? "undefined" : _type_of(b)) === 'object') b = b.version;
|
|
@@ -1115,7 +1117,7 @@ function requireSemver() {
|
|
|
1115
1117
|
debug('comp', this);
|
|
1116
1118
|
}
|
|
1117
1119
|
var ANY = {};
|
|
1118
|
-
Comparator.prototype.parse = function(comp) {
|
|
1120
|
+
Comparator.prototype.parse = function (comp) {
|
|
1119
1121
|
var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
|
|
1120
1122
|
var m = comp.match(r);
|
|
1121
1123
|
if (!m) {
|
|
@@ -1132,10 +1134,10 @@ function requireSemver() {
|
|
|
1132
1134
|
this.semver = new SemVer(m[2], this.options.loose);
|
|
1133
1135
|
}
|
|
1134
1136
|
};
|
|
1135
|
-
Comparator.prototype.toString = function() {
|
|
1137
|
+
Comparator.prototype.toString = function () {
|
|
1136
1138
|
return this.value;
|
|
1137
1139
|
};
|
|
1138
|
-
Comparator.prototype.test = function(version) {
|
|
1140
|
+
Comparator.prototype.test = function (version) {
|
|
1139
1141
|
debug('Comparator.test', version, this.options.loose);
|
|
1140
1142
|
if (this.semver === ANY) {
|
|
1141
1143
|
return true;
|
|
@@ -1145,7 +1147,7 @@ function requireSemver() {
|
|
|
1145
1147
|
}
|
|
1146
1148
|
return cmp(version, this.operator, this.semver, this.options);
|
|
1147
1149
|
};
|
|
1148
|
-
Comparator.prototype.intersects = function(comp, options) {
|
|
1150
|
+
Comparator.prototype.intersects = function (comp, options) {
|
|
1149
1151
|
if (!_instanceof(comp, Comparator)) {
|
|
1150
1152
|
throw new TypeError('a Comparator is required');
|
|
1151
1153
|
}
|
|
@@ -1200,9 +1202,9 @@ function requireSemver() {
|
|
|
1200
1202
|
// future error messages as well.
|
|
1201
1203
|
this.raw = range.trim().split(/\s+/).join(' ');
|
|
1202
1204
|
// First, split based on boolean or ||
|
|
1203
|
-
this.set = this.raw.split('||').map(function(range) {
|
|
1205
|
+
this.set = this.raw.split('||').map(function (range) {
|
|
1204
1206
|
return this.parseRange(range.trim());
|
|
1205
|
-
}, this).filter(function(c) {
|
|
1207
|
+
}, this).filter(function (c) {
|
|
1206
1208
|
// throw out any that are not relevant for whatever reason
|
|
1207
1209
|
return c.length;
|
|
1208
1210
|
});
|
|
@@ -1211,16 +1213,16 @@ function requireSemver() {
|
|
|
1211
1213
|
}
|
|
1212
1214
|
this.format();
|
|
1213
1215
|
}
|
|
1214
|
-
Range.prototype.format = function() {
|
|
1215
|
-
this.range = this.set.map(function(comps) {
|
|
1216
|
+
Range.prototype.format = function () {
|
|
1217
|
+
this.range = this.set.map(function (comps) {
|
|
1216
1218
|
return comps.join(' ').trim();
|
|
1217
1219
|
}).join('||').trim();
|
|
1218
1220
|
return this.range;
|
|
1219
1221
|
};
|
|
1220
|
-
Range.prototype.toString = function() {
|
|
1222
|
+
Range.prototype.toString = function () {
|
|
1221
1223
|
return this.range;
|
|
1222
1224
|
};
|
|
1223
|
-
Range.prototype.parseRange = function(range) {
|
|
1225
|
+
Range.prototype.parseRange = function (range) {
|
|
1224
1226
|
var loose = this.options.loose;
|
|
1225
1227
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
1226
1228
|
var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE];
|
|
@@ -1236,28 +1238,28 @@ function requireSemver() {
|
|
|
1236
1238
|
// At this point, the range is completely trimmed and
|
|
1237
1239
|
// ready to be split into comparators.
|
|
1238
1240
|
var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
|
|
1239
|
-
var set = range.split(' ').map(function(comp) {
|
|
1241
|
+
var set = range.split(' ').map(function (comp) {
|
|
1240
1242
|
return parseComparator(comp, this.options);
|
|
1241
1243
|
}, this).join(' ').split(/\s+/);
|
|
1242
1244
|
if (this.options.loose) {
|
|
1243
1245
|
// in loose mode, throw out any that are not valid comparators
|
|
1244
|
-
set = set.filter(function(comp) {
|
|
1246
|
+
set = set.filter(function (comp) {
|
|
1245
1247
|
return !!comp.match(compRe);
|
|
1246
1248
|
});
|
|
1247
1249
|
}
|
|
1248
|
-
set = set.map(function(comp) {
|
|
1250
|
+
set = set.map(function (comp) {
|
|
1249
1251
|
return new Comparator(comp, this.options);
|
|
1250
1252
|
}, this);
|
|
1251
1253
|
return set;
|
|
1252
1254
|
};
|
|
1253
|
-
Range.prototype.intersects = function(range, options) {
|
|
1255
|
+
Range.prototype.intersects = function (range, options) {
|
|
1254
1256
|
if (!_instanceof(range, Range)) {
|
|
1255
1257
|
throw new TypeError('a Range is required');
|
|
1256
1258
|
}
|
|
1257
|
-
return this.set.some(function(thisComparators) {
|
|
1258
|
-
return thisComparators.every(function(thisComparator) {
|
|
1259
|
-
return range.set.some(function(rangeComparators) {
|
|
1260
|
-
return rangeComparators.every(function(rangeComparator) {
|
|
1259
|
+
return this.set.some(function (thisComparators) {
|
|
1260
|
+
return thisComparators.every(function (thisComparator) {
|
|
1261
|
+
return range.set.some(function (rangeComparators) {
|
|
1262
|
+
return rangeComparators.every(function (rangeComparator) {
|
|
1261
1263
|
return thisComparator.intersects(rangeComparator, options);
|
|
1262
1264
|
});
|
|
1263
1265
|
});
|
|
@@ -1267,8 +1269,8 @@ function requireSemver() {
|
|
|
1267
1269
|
// Mostly just for testing and legacy API reasons
|
|
1268
1270
|
exports.toComparators = toComparators;
|
|
1269
1271
|
function toComparators(range, options) {
|
|
1270
|
-
return new Range(range, options).set.map(function(comp) {
|
|
1271
|
-
return comp.map(function(c) {
|
|
1272
|
+
return new Range(range, options).set.map(function (comp) {
|
|
1273
|
+
return comp.map(function (c) {
|
|
1272
1274
|
return c.value;
|
|
1273
1275
|
}).join(' ').trim().split(' ');
|
|
1274
1276
|
});
|
|
@@ -1298,13 +1300,13 @@ function requireSemver() {
|
|
|
1298
1300
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
1299
1301
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
1300
1302
|
function replaceTildes(comp, options) {
|
|
1301
|
-
return comp.trim().split(/\s+/).map(function(comp) {
|
|
1303
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
1302
1304
|
return replaceTilde(comp, options);
|
|
1303
1305
|
}).join(' ');
|
|
1304
1306
|
}
|
|
1305
1307
|
function replaceTilde(comp, options) {
|
|
1306
1308
|
var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE];
|
|
1307
|
-
return comp.replace(r, function(_, M, m, p, pr) {
|
|
1309
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
1308
1310
|
debug('tilde', comp, _, M, m, p, pr);
|
|
1309
1311
|
var ret;
|
|
1310
1312
|
if (isX(M)) {
|
|
@@ -1332,14 +1334,14 @@ function requireSemver() {
|
|
|
1332
1334
|
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
1333
1335
|
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
1334
1336
|
function replaceCarets(comp, options) {
|
|
1335
|
-
return comp.trim().split(/\s+/).map(function(comp) {
|
|
1337
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
1336
1338
|
return replaceCaret(comp, options);
|
|
1337
1339
|
}).join(' ');
|
|
1338
1340
|
}
|
|
1339
1341
|
function replaceCaret(comp, options) {
|
|
1340
1342
|
debug('caret', comp, options);
|
|
1341
1343
|
var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET];
|
|
1342
|
-
return comp.replace(r, function(_, M, m, p, pr) {
|
|
1344
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
1343
1345
|
debug('caret', comp, _, M, m, p, pr);
|
|
1344
1346
|
var ret;
|
|
1345
1347
|
if (isX(M)) {
|
|
@@ -1381,14 +1383,14 @@ function requireSemver() {
|
|
|
1381
1383
|
}
|
|
1382
1384
|
function replaceXRanges(comp, options) {
|
|
1383
1385
|
debug('replaceXRanges', comp, options);
|
|
1384
|
-
return comp.split(/\s+/).map(function(comp) {
|
|
1386
|
+
return comp.split(/\s+/).map(function (comp) {
|
|
1385
1387
|
return replaceXRange(comp, options);
|
|
1386
1388
|
}).join(' ');
|
|
1387
1389
|
}
|
|
1388
1390
|
function replaceXRange(comp, options) {
|
|
1389
1391
|
comp = comp.trim();
|
|
1390
1392
|
var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE];
|
|
1391
|
-
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
|
1393
|
+
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
|
1392
1394
|
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
1393
1395
|
var xM = isX(M);
|
|
1394
1396
|
var xm = xM || isX(m);
|
|
@@ -1481,14 +1483,14 @@ function requireSemver() {
|
|
|
1481
1483
|
return (from + ' ' + to).trim();
|
|
1482
1484
|
}
|
|
1483
1485
|
// if ANY of the sets match ALL of its comparators, then pass
|
|
1484
|
-
Range.prototype.test = function(version) {
|
|
1486
|
+
Range.prototype.test = function (version) {
|
|
1485
1487
|
if (!version) {
|
|
1486
1488
|
return false;
|
|
1487
1489
|
}
|
|
1488
1490
|
if (typeof version === 'string') {
|
|
1489
1491
|
version = new SemVer(version, this.options);
|
|
1490
1492
|
}
|
|
1491
|
-
for(var i = 0; i < this.set.length; i++){
|
|
1493
|
+
for (var i = 0; i < this.set.length; i++) {
|
|
1492
1494
|
if (testSet(this.set[i], version, this.options)) {
|
|
1493
1495
|
return true;
|
|
1494
1496
|
}
|
|
@@ -1496,7 +1498,7 @@ function requireSemver() {
|
|
|
1496
1498
|
return false;
|
|
1497
1499
|
};
|
|
1498
1500
|
function testSet(set, version, options) {
|
|
1499
|
-
for(var i = 0; i < set.length; i++){
|
|
1501
|
+
for (var i = 0; i < set.length; i++) {
|
|
1500
1502
|
if (!set[i].test(version)) {
|
|
1501
1503
|
return false;
|
|
1502
1504
|
}
|
|
@@ -1507,7 +1509,7 @@ function requireSemver() {
|
|
|
1507
1509
|
// That should allow `1.2.3-pr.2` to pass.
|
|
1508
1510
|
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
1509
1511
|
// even though it's within the range set by the comparators.
|
|
1510
|
-
for(i = 0; i < set.length; i++){
|
|
1512
|
+
for (i = 0; i < set.length; i++) {
|
|
1511
1513
|
debug(set[i].semver);
|
|
1512
1514
|
if (set[i].semver === ANY) {
|
|
1513
1515
|
continue;
|
|
@@ -1542,7 +1544,7 @@ function requireSemver() {
|
|
|
1542
1544
|
} catch (er) {
|
|
1543
1545
|
return null;
|
|
1544
1546
|
}
|
|
1545
|
-
versions.forEach(function(v) {
|
|
1547
|
+
versions.forEach(function (v) {
|
|
1546
1548
|
if (rangeObj.test(v)) {
|
|
1547
1549
|
// satisfies(v, range, options)
|
|
1548
1550
|
if (!max || maxSV.compare(v) === -1) {
|
|
@@ -1563,7 +1565,7 @@ function requireSemver() {
|
|
|
1563
1565
|
} catch (er) {
|
|
1564
1566
|
return null;
|
|
1565
1567
|
}
|
|
1566
|
-
versions.forEach(function(v) {
|
|
1568
|
+
versions.forEach(function (v) {
|
|
1567
1569
|
if (rangeObj.test(v)) {
|
|
1568
1570
|
// satisfies(v, range, options)
|
|
1569
1571
|
if (!min || minSV.compare(v) === 1) {
|
|
@@ -1587,12 +1589,12 @@ function requireSemver() {
|
|
|
1587
1589
|
return minver;
|
|
1588
1590
|
}
|
|
1589
1591
|
minver = null;
|
|
1590
|
-
for(var i = 0; i < range.set.length; ++i){
|
|
1592
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
1591
1593
|
var comparators = range.set[i];
|
|
1592
|
-
comparators.forEach(function(comparator) {
|
|
1594
|
+
comparators.forEach(function (comparator) {
|
|
1593
1595
|
// Clone to avoid manipulating the comparator's semver object.
|
|
1594
1596
|
var compver = new SemVer(comparator.semver.version);
|
|
1595
|
-
switch(comparator.operator){
|
|
1597
|
+
switch (comparator.operator) {
|
|
1596
1598
|
case '>':
|
|
1597
1599
|
if (compver.prerelease.length === 0) {
|
|
1598
1600
|
compver.patch++;
|
|
@@ -1644,7 +1646,7 @@ function requireSemver() {
|
|
|
1644
1646
|
version = new SemVer(version, options);
|
|
1645
1647
|
range = new Range(range, options);
|
|
1646
1648
|
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
1647
|
-
switch(hilo){
|
|
1649
|
+
switch (hilo) {
|
|
1648
1650
|
case '>':
|
|
1649
1651
|
gtfn = gt;
|
|
1650
1652
|
ltefn = lte;
|
|
@@ -1668,11 +1670,11 @@ function requireSemver() {
|
|
|
1668
1670
|
}
|
|
1669
1671
|
// From now on, variable terms are as if we're in "gtr" mode.
|
|
1670
1672
|
// but note that everything is flipped for the "ltr" function.
|
|
1671
|
-
for(var i = 0; i < range.set.length; ++i){
|
|
1673
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
1672
1674
|
var comparators = range.set[i];
|
|
1673
1675
|
var high = null;
|
|
1674
1676
|
var low = null;
|
|
1675
|
-
comparators.forEach(function(comparator) {
|
|
1677
|
+
comparators.forEach(function (comparator) {
|
|
1676
1678
|
if (comparator.semver === ANY) {
|
|
1677
1679
|
comparator = new Comparator('>=0.0.0');
|
|
1678
1680
|
}
|
|
@@ -1743,7 +1745,7 @@ function requireParse() {
|
|
|
1743
1745
|
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
1744
1746
|
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
1745
1747
|
// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
|
1746
|
-
var supportsShellOption = niceTry(function() {
|
|
1748
|
+
var supportsShellOption = niceTry(function () {
|
|
1747
1749
|
return semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true);
|
|
1748
1750
|
}) || false;
|
|
1749
1751
|
function detectShebang(parsed) {
|
|
@@ -1777,7 +1779,7 @@ function requireParse() {
|
|
|
1777
1779
|
parsed.command = path.normalize(parsed.command);
|
|
1778
1780
|
// Escape command & arguments
|
|
1779
1781
|
parsed.command = escape.command(parsed.command);
|
|
1780
|
-
parsed.args = parsed.args.map(function(arg) {
|
|
1782
|
+
parsed.args = parsed.args.map(function (arg) {
|
|
1781
1783
|
return escape.argument(arg, needsDoubleEscapeMetaChars);
|
|
1782
1784
|
});
|
|
1783
1785
|
var shellCommand = [
|
|
@@ -1874,7 +1876,7 @@ function requireEnoent() {
|
|
|
1874
1876
|
return;
|
|
1875
1877
|
}
|
|
1876
1878
|
var originalEmit = cp.emit;
|
|
1877
|
-
cp.emit = function(name, arg1) {
|
|
1879
|
+
cp.emit = function (name, arg1) {
|
|
1878
1880
|
// If emitting "exit" event and exit code is 1, we need to check if
|
|
1879
1881
|
// the command exists and emit an "error" instead
|
|
1880
1882
|
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { NotFoundError, Parsed, SpawnOptions, SpawnResult, SpawnSyncOptions } from './types.js';
|
|
3
|
+
declare function spawn(command: string, args: string[], options?: SpawnOptions): ChildProcess;
|
|
4
|
+
declare namespace spawn {
|
|
5
|
+
var _parse: (command: string, args: string[], options?: SpawnOptions | SpawnSyncOptions) => Parsed;
|
|
6
|
+
var _enoent: {
|
|
7
|
+
hookChildProcess(cp: ChildProcess, parsed: Parsed): undefined;
|
|
8
|
+
verifyENOENT(status: number, parsed: Parsed): NotFoundError | null;
|
|
9
|
+
verifyENOENTSync(status: number, parsed: Parsed): NotFoundError | null;
|
|
10
|
+
notFoundError(cp: ChildProcess, parsed: Parsed): NotFoundError;
|
|
11
|
+
};
|
|
12
|
+
var sync: (command: string, args: string[], options?: SpawnSyncOptions) => SpawnResult;
|
|
13
|
+
}
|
|
14
|
+
export default spawn;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { NotFoundError, Parsed, SpawnOptions, SpawnResult, SpawnSyncOptions } from './types.js';
|
|
3
|
+
declare function spawn(command: string, args: string[], options?: SpawnOptions): ChildProcess;
|
|
4
|
+
declare namespace spawn {
|
|
5
|
+
var _parse: (command: string, args: string[], options?: SpawnOptions | SpawnSyncOptions) => Parsed;
|
|
6
|
+
var _enoent: {
|
|
7
|
+
hookChildProcess(cp: ChildProcess, parsed: Parsed): undefined;
|
|
8
|
+
verifyENOENT(status: number, parsed: Parsed): NotFoundError | null;
|
|
9
|
+
verifyENOENTSync(status: number, parsed: Parsed): NotFoundError | null;
|
|
10
|
+
notFoundError(cp: ChildProcess, parsed: Parsed): NotFoundError;
|
|
11
|
+
};
|
|
12
|
+
var sync: (command: string, args: string[], options?: SpawnSyncOptions) => SpawnResult;
|
|
13
|
+
}
|
|
14
|
+
export default spawn;
|