cross-spawn-cb 1.5.3 → 1.5.4
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-6.0.5.js +506 -3914
- package/dist/cjs/spawn.js +1 -1
- package/dist/cjs/spawn.js.map +1 -1
- package/dist/cjs/spawnCompat/index.js +36 -0
- package/dist/cjs/spawnCompat/index.js.map +1 -0
- package/dist/cjs/spawnCompat/polyfills.js +19 -0
- package/dist/cjs/spawnCompat/polyfills.js.map +1 -0
- package/dist/types/spawnCompat/index.d.cts +9 -0
- package/dist/types/spawnCompat/polyfills.d.cts +1 -0
- package/package.json +4 -3
|
@@ -1,4085 +1,677 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var require$$0 = require('path');
|
|
5
|
-
var require$$5 = require('child_process');
|
|
6
|
-
var require$$6 = require('function-exec-sync');
|
|
7
|
-
var require$$0$1 = require('fs');
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Object.defineProperty(exports, '__esModule', {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
var require$$0$2 = require('child_process');
|
|
10
|
+
|
|
11
|
+
var require$$0$1 = require('path');
|
|
12
|
+
|
|
13
|
+
var require$$0 = require('fs');
|
|
14
|
+
|
|
15
|
+
var require$$5 = require('semver');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy(e) {
|
|
18
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
19
|
+
'default': e
|
|
20
|
+
};
|
|
12
21
|
}
|
|
13
22
|
|
|
14
|
-
var
|
|
23
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
24
|
+
|
|
25
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
26
|
+
|
|
27
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
28
|
+
|
|
29
|
+
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5);
|
|
30
|
+
|
|
31
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
32
|
+
var crossSpawn = {
|
|
15
33
|
exports: {}
|
|
16
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Tries to execute a function and discards any error that occurs.
|
|
37
|
+
* @param {Function} fn - Function that might or might not throw an error.
|
|
38
|
+
* @returns {?*} Return-value of the function when no error occurred.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
var src = function src(fn) {
|
|
42
|
+
try {
|
|
43
|
+
return fn();
|
|
44
|
+
} catch (e) { }
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var windows;
|
|
48
|
+
var hasRequiredWindows;
|
|
17
49
|
|
|
18
|
-
|
|
50
|
+
function requireWindows() {
|
|
51
|
+
if (hasRequiredWindows) return windows;
|
|
52
|
+
hasRequiredWindows = 1;
|
|
53
|
+
windows = isexe;
|
|
54
|
+
isexe.sync = sync;
|
|
55
|
+
var fs = require$$0__default["default"];
|
|
19
56
|
|
|
20
|
-
|
|
57
|
+
function checkPathExt(path, options) {
|
|
58
|
+
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
21
59
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
var globalThis_1;
|
|
27
|
-
var hasRequiredGlobalThis;
|
|
28
|
-
function requireGlobalThis() {
|
|
29
|
-
if (hasRequiredGlobalThis) return globalThis_1;
|
|
30
|
-
hasRequiredGlobalThis = 1;
|
|
31
|
-
var check = function check(it) {
|
|
32
|
-
return it && it.Math === Math && it;
|
|
33
|
-
};
|
|
34
|
-
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
35
|
-
globalThis_1 = // eslint-disable-next-line es/no-global-this -- safe
|
|
36
|
-
check((typeof globalThis === "undefined" ? "undefined" : _type_of$6(globalThis)) == 'object' && globalThis) || check((typeof window === "undefined" ? "undefined" : _type_of$6(window)) == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe
|
|
37
|
-
check((typeof self === "undefined" ? "undefined" : _type_of$6(self)) == 'object' && self) || check(_type_of$6(commonjsGlobal) == 'object' && commonjsGlobal) || check((typeof globalThis_1 === "undefined" ? "undefined" : _type_of$6(globalThis_1)) == 'object' && globalThis_1) || // eslint-disable-next-line no-new-func -- fallback
|
|
38
|
-
function() {
|
|
39
|
-
return this;
|
|
40
|
-
}() || Function('return this')();
|
|
41
|
-
return globalThis_1;
|
|
42
|
-
}
|
|
60
|
+
if (!pathext) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
pathext = pathext.split(';');
|
|
45
65
|
|
|
46
|
-
|
|
47
|
-
var hasRequiredFails;
|
|
48
|
-
function requireFails() {
|
|
49
|
-
if (hasRequiredFails) return fails;
|
|
50
|
-
hasRequiredFails = 1;
|
|
51
|
-
fails = function fails(exec) {
|
|
52
|
-
try {
|
|
53
|
-
return !!exec();
|
|
54
|
-
} catch (error) {
|
|
66
|
+
if (pathext.indexOf('') !== -1) {
|
|
55
67
|
return true;
|
|
56
68
|
}
|
|
57
|
-
};
|
|
58
|
-
return fails;
|
|
59
|
-
}
|
|
60
69
|
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var fails = requireFails();
|
|
67
|
-
// Detect IE8's incomplete defineProperty implementation
|
|
68
|
-
descriptors = !fails(function() {
|
|
69
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
70
|
-
return Object.defineProperty({}, 1, {
|
|
71
|
-
get: function get() {
|
|
72
|
-
return 7;
|
|
70
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
71
|
+
var p = pathext[i].toLowerCase();
|
|
72
|
+
|
|
73
|
+
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
74
|
+
return true;
|
|
73
75
|
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return descriptors;
|
|
77
|
-
}
|
|
76
|
+
}
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
function requireFunctionBindNative() {
|
|
82
|
-
if (hasRequiredFunctionBindNative) return functionBindNative;
|
|
83
|
-
hasRequiredFunctionBindNative = 1;
|
|
84
|
-
var fails = requireFails();
|
|
85
|
-
functionBindNative = !fails(function() {
|
|
86
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
87
|
-
var test = (function() {}).bind();
|
|
88
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
89
|
-
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
90
|
-
});
|
|
91
|
-
return functionBindNative;
|
|
92
|
-
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
93
80
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
hasRequiredFunctionCall = 1;
|
|
99
|
-
var NATIVE_BIND = requireFunctionBindNative();
|
|
100
|
-
var call = Function.prototype.call;
|
|
101
|
-
functionCall = NATIVE_BIND ? call.bind(call) : function functionCall() {
|
|
102
|
-
return call.apply(call, arguments);
|
|
103
|
-
};
|
|
104
|
-
return functionCall;
|
|
105
|
-
}
|
|
81
|
+
function checkStat(stat, path, options) {
|
|
82
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
106
85
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var hasRequiredObjectPropertyIsEnumerable;
|
|
110
|
-
function requireObjectPropertyIsEnumerable() {
|
|
111
|
-
if (hasRequiredObjectPropertyIsEnumerable) return objectPropertyIsEnumerable;
|
|
112
|
-
hasRequiredObjectPropertyIsEnumerable = 1;
|
|
113
|
-
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
114
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
115
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
116
|
-
// Nashorn ~ JDK8 bug
|
|
117
|
-
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({
|
|
118
|
-
1: 2
|
|
119
|
-
}, 1);
|
|
120
|
-
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
121
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
122
|
-
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
123
|
-
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
124
|
-
return !!descriptor && descriptor.enumerable;
|
|
125
|
-
} : $propertyIsEnumerable;
|
|
126
|
-
return objectPropertyIsEnumerable;
|
|
127
|
-
}
|
|
86
|
+
return checkPathExt(path, options);
|
|
87
|
+
}
|
|
128
88
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
createPropertyDescriptor = function createPropertyDescriptor(bitmap, value) {
|
|
135
|
-
return {
|
|
136
|
-
enumerable: !(bitmap & 1),
|
|
137
|
-
configurable: !(bitmap & 2),
|
|
138
|
-
writable: !(bitmap & 4),
|
|
139
|
-
value: value
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
return createPropertyDescriptor;
|
|
143
|
-
}
|
|
89
|
+
function isexe(path, options, cb) {
|
|
90
|
+
fs.stat(path, function (er, stat) {
|
|
91
|
+
cb(er, er ? false : checkStat(stat, path, options));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
144
94
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (hasRequiredFunctionUncurryThis) return functionUncurryThis;
|
|
149
|
-
hasRequiredFunctionUncurryThis = 1;
|
|
150
|
-
var NATIVE_BIND = requireFunctionBindNative();
|
|
151
|
-
var FunctionPrototype = Function.prototype;
|
|
152
|
-
var call = FunctionPrototype.call;
|
|
153
|
-
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
|
|
154
|
-
functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function functionUncurryThis(fn) {
|
|
155
|
-
return function() {
|
|
156
|
-
return call.apply(fn, arguments);
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
return functionUncurryThis;
|
|
160
|
-
}
|
|
95
|
+
function sync(path, options) {
|
|
96
|
+
return checkStat(fs.statSync(path), path, options);
|
|
97
|
+
}
|
|
161
98
|
|
|
162
|
-
|
|
163
|
-
var hasRequiredClassofRaw;
|
|
164
|
-
function requireClassofRaw() {
|
|
165
|
-
if (hasRequiredClassofRaw) return classofRaw;
|
|
166
|
-
hasRequiredClassofRaw = 1;
|
|
167
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
168
|
-
var toString = uncurryThis({}.toString);
|
|
169
|
-
var stringSlice = uncurryThis(''.slice);
|
|
170
|
-
classofRaw = function classofRaw(it) {
|
|
171
|
-
return stringSlice(toString(it), 8, -1);
|
|
172
|
-
};
|
|
173
|
-
return classofRaw;
|
|
99
|
+
return windows;
|
|
174
100
|
}
|
|
175
101
|
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
function requireIndexedObject() {
|
|
179
|
-
if (hasRequiredIndexedObject) return indexedObject;
|
|
180
|
-
hasRequiredIndexedObject = 1;
|
|
181
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
182
|
-
var fails = requireFails();
|
|
183
|
-
var classof = requireClassofRaw();
|
|
184
|
-
var $Object = Object;
|
|
185
|
-
var split = uncurryThis(''.split);
|
|
186
|
-
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
187
|
-
indexedObject = fails(function() {
|
|
188
|
-
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
189
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
190
|
-
return !$Object('z').propertyIsEnumerable(0);
|
|
191
|
-
}) ? function indexedObject(it) {
|
|
192
|
-
return classof(it) === 'String' ? split(it, '') : $Object(it);
|
|
193
|
-
} : $Object;
|
|
194
|
-
return indexedObject;
|
|
195
|
-
}
|
|
102
|
+
var mode;
|
|
103
|
+
var hasRequiredMode;
|
|
196
104
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
204
|
-
isNullOrUndefined = function isNullOrUndefined(it) {
|
|
205
|
-
return it === null || it === undefined;
|
|
206
|
-
};
|
|
207
|
-
return isNullOrUndefined;
|
|
208
|
-
}
|
|
105
|
+
function requireMode() {
|
|
106
|
+
if (hasRequiredMode) return mode;
|
|
107
|
+
hasRequiredMode = 1;
|
|
108
|
+
mode = isexe;
|
|
109
|
+
isexe.sync = sync;
|
|
110
|
+
var fs = require$$0__default["default"];
|
|
209
111
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
var isNullOrUndefined = requireIsNullOrUndefined();
|
|
216
|
-
var $TypeError = TypeError;
|
|
217
|
-
// `RequireObjectCoercible` abstract operation
|
|
218
|
-
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
219
|
-
requireObjectCoercible = function requireObjectCoercible(it) {
|
|
220
|
-
if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
|
|
221
|
-
return it;
|
|
222
|
-
};
|
|
223
|
-
return requireObjectCoercible;
|
|
224
|
-
}
|
|
112
|
+
function isexe(path, options, cb) {
|
|
113
|
+
fs.stat(path, function (er, stat) {
|
|
114
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
225
117
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (hasRequiredToIndexedObject) return toIndexedObject;
|
|
230
|
-
hasRequiredToIndexedObject = 1;
|
|
231
|
-
// toObject with fallback for non-array-like ES3 strings
|
|
232
|
-
var IndexedObject = requireIndexedObject();
|
|
233
|
-
var requireObjectCoercible = requireRequireObjectCoercible();
|
|
234
|
-
toIndexedObject = function toIndexedObject(it) {
|
|
235
|
-
return IndexedObject(requireObjectCoercible(it));
|
|
236
|
-
};
|
|
237
|
-
return toIndexedObject;
|
|
238
|
-
}
|
|
118
|
+
function sync(path, options) {
|
|
119
|
+
return checkStat(fs.statSync(path), options);
|
|
120
|
+
}
|
|
239
121
|
|
|
240
|
-
function
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
var isCallable;
|
|
245
|
-
var hasRequiredIsCallable;
|
|
246
|
-
function requireIsCallable() {
|
|
247
|
-
if (hasRequiredIsCallable) return isCallable;
|
|
248
|
-
hasRequiredIsCallable = 1;
|
|
249
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
250
|
-
var documentAll = (typeof document === "undefined" ? "undefined" : _type_of$5(document)) == 'object' && document.all;
|
|
251
|
-
// `IsCallable` abstract operation
|
|
252
|
-
// https://tc39.es/ecma262/#sec-iscallable
|
|
253
|
-
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
254
|
-
isCallable = typeof documentAll == 'undefined' && documentAll !== undefined ? function isCallable(argument) {
|
|
255
|
-
return typeof argument == 'function' || argument === documentAll;
|
|
256
|
-
} : function(argument) {
|
|
257
|
-
return typeof argument == 'function';
|
|
258
|
-
};
|
|
259
|
-
return isCallable;
|
|
260
|
-
}
|
|
122
|
+
function checkStat(stat, options) {
|
|
123
|
+
return stat.isFile() && checkMode(stat, options);
|
|
124
|
+
}
|
|
261
125
|
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return
|
|
274
|
-
}
|
|
275
|
-
return isObject;
|
|
276
|
-
}
|
|
126
|
+
function checkMode(stat, options) {
|
|
127
|
+
var mod = stat.mode;
|
|
128
|
+
var uid = stat.uid;
|
|
129
|
+
var gid = stat.gid;
|
|
130
|
+
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
131
|
+
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
132
|
+
var u = parseInt('100', 8);
|
|
133
|
+
var g = parseInt('010', 8);
|
|
134
|
+
var o = parseInt('001', 8);
|
|
135
|
+
var ug = u | g;
|
|
136
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
137
|
+
return ret;
|
|
138
|
+
}
|
|
277
139
|
|
|
278
|
-
|
|
279
|
-
var hasRequiredGetBuiltIn;
|
|
280
|
-
function requireGetBuiltIn() {
|
|
281
|
-
if (hasRequiredGetBuiltIn) return getBuiltIn;
|
|
282
|
-
hasRequiredGetBuiltIn = 1;
|
|
283
|
-
var globalThis = requireGlobalThis();
|
|
284
|
-
var isCallable = requireIsCallable();
|
|
285
|
-
var aFunction = function aFunction(argument) {
|
|
286
|
-
return isCallable(argument) ? argument : undefined;
|
|
287
|
-
};
|
|
288
|
-
getBuiltIn = function getBuiltIn(namespace, method) {
|
|
289
|
-
return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
|
|
290
|
-
};
|
|
291
|
-
return getBuiltIn;
|
|
140
|
+
return mode;
|
|
292
141
|
}
|
|
293
142
|
|
|
294
|
-
var
|
|
295
|
-
var hasRequiredObjectIsPrototypeOf;
|
|
296
|
-
function requireObjectIsPrototypeOf() {
|
|
297
|
-
if (hasRequiredObjectIsPrototypeOf) return objectIsPrototypeOf;
|
|
298
|
-
hasRequiredObjectIsPrototypeOf = 1;
|
|
299
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
300
|
-
objectIsPrototypeOf = uncurryThis({}.isPrototypeOf);
|
|
301
|
-
return objectIsPrototypeOf;
|
|
302
|
-
}
|
|
143
|
+
var core;
|
|
303
144
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
hasRequiredEnvironmentUserAgent = 1;
|
|
309
|
-
var globalThis = requireGlobalThis();
|
|
310
|
-
var navigator = globalThis.navigator;
|
|
311
|
-
var userAgent = navigator && navigator.userAgent;
|
|
312
|
-
environmentUserAgent = userAgent ? String(userAgent) : '';
|
|
313
|
-
return environmentUserAgent;
|
|
145
|
+
if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
|
|
146
|
+
core = requireWindows();
|
|
147
|
+
} else {
|
|
148
|
+
core = requireMode();
|
|
314
149
|
}
|
|
315
150
|
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
var process = globalThis.process;
|
|
324
|
-
var Deno = globalThis.Deno;
|
|
325
|
-
var versions = process && process.versions || Deno && Deno.version;
|
|
326
|
-
var v8 = versions && versions.v8;
|
|
327
|
-
var match, version;
|
|
328
|
-
if (v8) {
|
|
329
|
-
match = v8.split('.');
|
|
330
|
-
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
331
|
-
// but their correct versions are not interesting for us
|
|
332
|
-
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
151
|
+
var isexe_1 = isexe$1;
|
|
152
|
+
isexe$1.sync = sync$1;
|
|
153
|
+
|
|
154
|
+
function isexe$1(path, options, cb) {
|
|
155
|
+
if (typeof options === 'function') {
|
|
156
|
+
cb = options;
|
|
157
|
+
options = {};
|
|
333
158
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (!match || match[1] >= 74) {
|
|
339
|
-
match = userAgent.match(/Chrome\/(\d+)/);
|
|
340
|
-
if (match) version = +match[1];
|
|
159
|
+
|
|
160
|
+
if (!cb) {
|
|
161
|
+
if (typeof Promise !== 'function') {
|
|
162
|
+
throw new TypeError('callback not provided');
|
|
341
163
|
}
|
|
342
|
-
}
|
|
343
|
-
environmentV8Version = version;
|
|
344
|
-
return environmentV8Version;
|
|
345
|
-
}
|
|
346
164
|
|
|
347
|
-
function
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
165
|
+
return new Promise(function (resolve, reject) {
|
|
166
|
+
isexe$1(path, options || {}, function (er, is) {
|
|
167
|
+
if (er) {
|
|
168
|
+
reject(er);
|
|
169
|
+
} else {
|
|
170
|
+
resolve(is);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
352
174
|
}
|
|
353
|
-
}
|
|
354
|
-
var symbolConstructorDetection;
|
|
355
|
-
var hasRequiredSymbolConstructorDetection;
|
|
356
|
-
function requireSymbolConstructorDetection() {
|
|
357
|
-
if (hasRequiredSymbolConstructorDetection) return symbolConstructorDetection;
|
|
358
|
-
hasRequiredSymbolConstructorDetection = 1;
|
|
359
|
-
/* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = requireEnvironmentV8Version();
|
|
360
|
-
var fails = requireFails();
|
|
361
|
-
var globalThis = requireGlobalThis();
|
|
362
|
-
var $String = globalThis.String;
|
|
363
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
364
|
-
symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function() {
|
|
365
|
-
var symbol = Symbol('symbol detection');
|
|
366
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
367
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
368
|
-
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
369
|
-
// of course, fail.
|
|
370
|
-
return !$String(symbol) || !_instanceof$1(Object(symbol), Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
371
|
-
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
372
|
-
});
|
|
373
|
-
return symbolConstructorDetection;
|
|
374
|
-
}
|
|
375
175
|
|
|
376
|
-
function
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
hasRequiredUseSymbolAsUid = 1;
|
|
385
|
-
/* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
|
|
386
|
-
useSymbolAsUid = NATIVE_SYMBOL && !Symbol.sham && _type_of$3(Symbol.iterator) == 'symbol';
|
|
387
|
-
return useSymbolAsUid;
|
|
388
|
-
}
|
|
176
|
+
core(path, options || {}, function (er, is) {
|
|
177
|
+
// ignore EACCES because that just means we aren't allowed to run it
|
|
178
|
+
if (er) {
|
|
179
|
+
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
180
|
+
er = null;
|
|
181
|
+
is = false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
389
184
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
393
|
-
}
|
|
394
|
-
var isSymbol;
|
|
395
|
-
var hasRequiredIsSymbol;
|
|
396
|
-
function requireIsSymbol() {
|
|
397
|
-
if (hasRequiredIsSymbol) return isSymbol;
|
|
398
|
-
hasRequiredIsSymbol = 1;
|
|
399
|
-
var getBuiltIn = requireGetBuiltIn();
|
|
400
|
-
var isCallable = requireIsCallable();
|
|
401
|
-
var isPrototypeOf = requireObjectIsPrototypeOf();
|
|
402
|
-
var USE_SYMBOL_AS_UID = requireUseSymbolAsUid();
|
|
403
|
-
var $Object = Object;
|
|
404
|
-
isSymbol = USE_SYMBOL_AS_UID ? function isSymbol(it) {
|
|
405
|
-
return (typeof it === "undefined" ? "undefined" : _type_of$2(it)) == 'symbol';
|
|
406
|
-
} : function(it) {
|
|
407
|
-
var $Symbol = getBuiltIn('Symbol');
|
|
408
|
-
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
|
|
409
|
-
};
|
|
410
|
-
return isSymbol;
|
|
185
|
+
cb(er, is);
|
|
186
|
+
});
|
|
411
187
|
}
|
|
412
188
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
} catch (error) {
|
|
423
|
-
return 'Object';
|
|
189
|
+
function sync$1(path, options) {
|
|
190
|
+
// my kingdom for a filtered catch
|
|
191
|
+
try {
|
|
192
|
+
return core.sync(path, options || {});
|
|
193
|
+
} catch (er) {
|
|
194
|
+
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
|
195
|
+
return false;
|
|
196
|
+
} else {
|
|
197
|
+
throw er;
|
|
424
198
|
}
|
|
425
|
-
}
|
|
426
|
-
return tryToString;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
var aCallable;
|
|
430
|
-
var hasRequiredACallable;
|
|
431
|
-
function requireACallable() {
|
|
432
|
-
if (hasRequiredACallable) return aCallable;
|
|
433
|
-
hasRequiredACallable = 1;
|
|
434
|
-
var isCallable = requireIsCallable();
|
|
435
|
-
var tryToString = requireTryToString();
|
|
436
|
-
var $TypeError = TypeError;
|
|
437
|
-
// `Assert: IsCallable(argument) is true`
|
|
438
|
-
aCallable = function aCallable(argument) {
|
|
439
|
-
if (isCallable(argument)) return argument;
|
|
440
|
-
throw new $TypeError(tryToString(argument) + ' is not a function');
|
|
441
|
-
};
|
|
442
|
-
return aCallable;
|
|
199
|
+
}
|
|
443
200
|
}
|
|
444
201
|
|
|
445
|
-
var
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
var isNullOrUndefined = requireIsNullOrUndefined();
|
|
452
|
-
// `GetMethod` abstract operation
|
|
453
|
-
// https://tc39.es/ecma262/#sec-getmethod
|
|
454
|
-
getMethod = function getMethod(V, P) {
|
|
455
|
-
var func = V[P];
|
|
456
|
-
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
|
457
|
-
};
|
|
458
|
-
return getMethod;
|
|
459
|
-
}
|
|
202
|
+
var which_1 = which$1;
|
|
203
|
+
which$1.sync = whichSync;
|
|
204
|
+
var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
|
|
205
|
+
var path$2 = require$$0__default$1["default"];
|
|
206
|
+
var COLON = isWindows ? ';' : ':';
|
|
207
|
+
var isexe = isexe_1;
|
|
460
208
|
|
|
461
|
-
|
|
462
|
-
var
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
hasRequiredOrdinaryToPrimitive = 1;
|
|
466
|
-
var call = requireFunctionCall();
|
|
467
|
-
var isCallable = requireIsCallable();
|
|
468
|
-
var isObject = requireIsObject();
|
|
469
|
-
var $TypeError = TypeError;
|
|
470
|
-
// `OrdinaryToPrimitive` abstract operation
|
|
471
|
-
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
472
|
-
ordinaryToPrimitive = function ordinaryToPrimitive(input, pref) {
|
|
473
|
-
var fn, val;
|
|
474
|
-
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
|
475
|
-
if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
|
|
476
|
-
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
|
477
|
-
throw new $TypeError("Can't convert object to primitive value");
|
|
478
|
-
};
|
|
479
|
-
return ordinaryToPrimitive;
|
|
209
|
+
function getNotFoundError(cmd) {
|
|
210
|
+
var er = new Error('not found: ' + cmd);
|
|
211
|
+
er.code = 'ENOENT';
|
|
212
|
+
return er;
|
|
480
213
|
}
|
|
481
214
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
var
|
|
488
|
-
function requireIsPure() {
|
|
489
|
-
if (hasRequiredIsPure) return isPure;
|
|
490
|
-
hasRequiredIsPure = 1;
|
|
491
|
-
isPure = false;
|
|
492
|
-
return isPure;
|
|
493
|
-
}
|
|
215
|
+
function getPathInfo(cmd, opt) {
|
|
216
|
+
var colon = opt.colon || COLON;
|
|
217
|
+
var pathEnv = opt.path || process.env.PATH || '';
|
|
218
|
+
var pathExt = [''];
|
|
219
|
+
pathEnv = pathEnv.split(colon);
|
|
220
|
+
var pathExtExe = '';
|
|
494
221
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
var globalThis = requireGlobalThis();
|
|
501
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
502
|
-
var defineProperty = Object.defineProperty;
|
|
503
|
-
defineGlobalProperty = function defineGlobalProperty(key, value) {
|
|
504
|
-
try {
|
|
505
|
-
defineProperty(globalThis, key, {
|
|
506
|
-
value: value,
|
|
507
|
-
configurable: true,
|
|
508
|
-
writable: true
|
|
509
|
-
});
|
|
510
|
-
} catch (error) {
|
|
511
|
-
globalThis[key] = value;
|
|
512
|
-
}
|
|
513
|
-
return value;
|
|
514
|
-
};
|
|
515
|
-
return defineGlobalProperty;
|
|
516
|
-
}
|
|
222
|
+
if (isWindows) {
|
|
223
|
+
pathEnv.unshift(process.cwd());
|
|
224
|
+
pathExtExe = opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM';
|
|
225
|
+
pathExt = pathExtExe.split(colon); // Always test the cmd itself first. isexe will check to make sure
|
|
226
|
+
// it's found in the pathExt set.
|
|
517
227
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
hasRequiredSharedStore = 1;
|
|
522
|
-
var IS_PURE = requireIsPure();
|
|
523
|
-
var globalThis = requireGlobalThis();
|
|
524
|
-
var defineGlobalProperty = requireDefineGlobalProperty();
|
|
525
|
-
var SHARED = '__core-js_shared__';
|
|
526
|
-
var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
527
|
-
(store.versions || (store.versions = [])).push({
|
|
528
|
-
version: '3.39.0',
|
|
529
|
-
mode: IS_PURE ? 'pure' : 'global',
|
|
530
|
-
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
531
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE',
|
|
532
|
-
source: 'https://github.com/zloirock/core-js'
|
|
533
|
-
});
|
|
534
|
-
return sharedStore.exports;
|
|
535
|
-
}
|
|
228
|
+
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
|
|
229
|
+
} // If it has a slash, then we don't bother searching the pathenv.
|
|
230
|
+
// just check the file itself, and that's it.
|
|
536
231
|
|
|
537
|
-
var shared;
|
|
538
|
-
var hasRequiredShared;
|
|
539
|
-
function requireShared() {
|
|
540
|
-
if (hasRequiredShared) return shared;
|
|
541
|
-
hasRequiredShared = 1;
|
|
542
|
-
var store = requireSharedStore();
|
|
543
|
-
shared = function shared(key, value) {
|
|
544
|
-
return store[key] || (store[key] = value || {});
|
|
545
|
-
};
|
|
546
|
-
return shared;
|
|
547
|
-
}
|
|
548
232
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var requireObjectCoercible = requireRequireObjectCoercible();
|
|
555
|
-
var $Object = Object;
|
|
556
|
-
// `ToObject` abstract operation
|
|
557
|
-
// https://tc39.es/ecma262/#sec-toobject
|
|
558
|
-
toObject = function toObject(argument) {
|
|
559
|
-
return $Object(requireObjectCoercible(argument));
|
|
233
|
+
if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) pathEnv = [''];
|
|
234
|
+
return {
|
|
235
|
+
env: pathEnv,
|
|
236
|
+
ext: pathExt,
|
|
237
|
+
extExe: pathExtExe
|
|
560
238
|
};
|
|
561
|
-
return toObject;
|
|
562
239
|
}
|
|
563
240
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
570
|
-
var toObject = requireToObject();
|
|
571
|
-
var hasOwnProperty = uncurryThis({}.hasOwnProperty);
|
|
572
|
-
// `HasOwnProperty` abstract operation
|
|
573
|
-
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
574
|
-
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
575
|
-
hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
576
|
-
return hasOwnProperty(toObject(it), key);
|
|
577
|
-
};
|
|
578
|
-
return hasOwnProperty_1;
|
|
579
|
-
}
|
|
241
|
+
function which$1(cmd, opt, cb) {
|
|
242
|
+
if (typeof opt === 'function') {
|
|
243
|
+
cb = opt;
|
|
244
|
+
opt = {};
|
|
245
|
+
}
|
|
580
246
|
|
|
581
|
-
var
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
587
|
-
var id = 0;
|
|
588
|
-
var postfix = Math.random();
|
|
589
|
-
var toString = uncurryThis(1.0.toString);
|
|
590
|
-
uid = function uid(key) {
|
|
591
|
-
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
592
|
-
};
|
|
593
|
-
return uid;
|
|
594
|
-
}
|
|
247
|
+
var info = getPathInfo(cmd, opt);
|
|
248
|
+
var pathEnv = info.env;
|
|
249
|
+
var pathExt = info.ext;
|
|
250
|
+
var pathExtExe = info.extExe;
|
|
251
|
+
var found = [];
|
|
595
252
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
if (hasRequiredWellKnownSymbol) return wellKnownSymbol;
|
|
600
|
-
hasRequiredWellKnownSymbol = 1;
|
|
601
|
-
var globalThis = requireGlobalThis();
|
|
602
|
-
var shared = requireShared();
|
|
603
|
-
var hasOwn = requireHasOwnProperty();
|
|
604
|
-
var uid = requireUid();
|
|
605
|
-
var NATIVE_SYMBOL = requireSymbolConstructorDetection();
|
|
606
|
-
var USE_SYMBOL_AS_UID = requireUseSymbolAsUid();
|
|
607
|
-
var Symbol = globalThis.Symbol;
|
|
608
|
-
var WellKnownSymbolsStore = shared('wks');
|
|
609
|
-
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
|
|
610
|
-
wellKnownSymbol = function wellKnownSymbol(name) {
|
|
611
|
-
if (!hasOwn(WellKnownSymbolsStore, name)) {
|
|
612
|
-
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol('Symbol.' + name);
|
|
253
|
+
(function F(i, l) {
|
|
254
|
+
if (i === l) {
|
|
255
|
+
if (opt.all && found.length) return cb(null, found); else return cb(getNotFoundError(cmd));
|
|
613
256
|
}
|
|
614
|
-
return WellKnownSymbolsStore[name];
|
|
615
|
-
};
|
|
616
|
-
return wellKnownSymbol;
|
|
617
|
-
}
|
|
618
257
|
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
var isObject = requireIsObject();
|
|
626
|
-
var isSymbol = requireIsSymbol();
|
|
627
|
-
var getMethod = requireGetMethod();
|
|
628
|
-
var ordinaryToPrimitive = requireOrdinaryToPrimitive();
|
|
629
|
-
var wellKnownSymbol = requireWellKnownSymbol();
|
|
630
|
-
var $TypeError = TypeError;
|
|
631
|
-
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
632
|
-
// `ToPrimitive` abstract operation
|
|
633
|
-
// https://tc39.es/ecma262/#sec-toprimitive
|
|
634
|
-
toPrimitive = function toPrimitive(input, pref) {
|
|
635
|
-
if (!isObject(input) || isSymbol(input)) return input;
|
|
636
|
-
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
637
|
-
var result;
|
|
638
|
-
if (exoticToPrim) {
|
|
639
|
-
if (pref === undefined) pref = 'default';
|
|
640
|
-
result = call(exoticToPrim, input, pref);
|
|
641
|
-
if (!isObject(result) || isSymbol(result)) return result;
|
|
642
|
-
throw new $TypeError("Can't convert object to primitive value");
|
|
258
|
+
var pathPart = pathEnv[i];
|
|
259
|
+
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
260
|
+
var p = path$2.join(pathPart, cmd);
|
|
261
|
+
|
|
262
|
+
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
263
|
+
p = cmd.slice(0, 2) + p;
|
|
643
264
|
}
|
|
644
|
-
if (pref === undefined) pref = 'number';
|
|
645
|
-
return ordinaryToPrimitive(input, pref);
|
|
646
|
-
};
|
|
647
|
-
return toPrimitive;
|
|
648
|
-
}
|
|
649
265
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
toPropertyKey = function toPropertyKey(argument) {
|
|
660
|
-
var key = toPrimitive(argument, 'string');
|
|
661
|
-
return isSymbol(key) ? key : key + '';
|
|
662
|
-
};
|
|
663
|
-
return toPropertyKey;
|
|
664
|
-
}
|
|
266
|
+
(function E(ii, ll) {
|
|
267
|
+
if (ii === ll) return F(i + 1, l);
|
|
268
|
+
var ext = pathExt[ii];
|
|
269
|
+
isexe(p + ext, {
|
|
270
|
+
pathExt: pathExtExe
|
|
271
|
+
}, function (er, is) {
|
|
272
|
+
if (!er && is) {
|
|
273
|
+
if (opt.all) found.push(p + ext); else return cb(null, p + ext);
|
|
274
|
+
}
|
|
665
275
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
hasRequiredDocumentCreateElement = 1;
|
|
671
|
-
var globalThis = requireGlobalThis();
|
|
672
|
-
var isObject = requireIsObject();
|
|
673
|
-
var document = globalThis.document;
|
|
674
|
-
// typeof document.createElement is 'object' in old IE
|
|
675
|
-
var EXISTS = isObject(document) && isObject(document.createElement);
|
|
676
|
-
documentCreateElement = function documentCreateElement(it) {
|
|
677
|
-
return EXISTS ? document.createElement(it) : {};
|
|
678
|
-
};
|
|
679
|
-
return documentCreateElement;
|
|
276
|
+
return E(ii + 1, ll);
|
|
277
|
+
});
|
|
278
|
+
})(0, pathExt.length);
|
|
279
|
+
})(0, pathEnv.length);
|
|
680
280
|
}
|
|
681
281
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
var
|
|
688
|
-
var
|
|
689
|
-
var createElement = requireDocumentCreateElement();
|
|
690
|
-
// Thanks to IE8 for its funny defineProperty
|
|
691
|
-
ie8DomDefine = !DESCRIPTORS && !fails(function() {
|
|
692
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
693
|
-
return Object.defineProperty(createElement('div'), 'a', {
|
|
694
|
-
get: function get() {
|
|
695
|
-
return 7;
|
|
696
|
-
}
|
|
697
|
-
}).a !== 7;
|
|
698
|
-
});
|
|
699
|
-
return ie8DomDefine;
|
|
700
|
-
}
|
|
282
|
+
function whichSync(cmd, opt) {
|
|
283
|
+
opt = opt || {};
|
|
284
|
+
var info = getPathInfo(cmd, opt);
|
|
285
|
+
var pathEnv = info.env;
|
|
286
|
+
var pathExt = info.ext;
|
|
287
|
+
var pathExtExe = info.extExe;
|
|
288
|
+
var found = [];
|
|
701
289
|
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
var DESCRIPTORS = requireDescriptors();
|
|
707
|
-
var call = requireFunctionCall();
|
|
708
|
-
var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable();
|
|
709
|
-
var createPropertyDescriptor = requireCreatePropertyDescriptor();
|
|
710
|
-
var toIndexedObject = requireToIndexedObject();
|
|
711
|
-
var toPropertyKey = requireToPropertyKey();
|
|
712
|
-
var hasOwn = requireHasOwnProperty();
|
|
713
|
-
var IE8_DOM_DEFINE = requireIe8DomDefine();
|
|
714
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
715
|
-
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
716
|
-
// `Object.getOwnPropertyDescriptor` method
|
|
717
|
-
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
718
|
-
objectGetOwnPropertyDescriptor.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
719
|
-
O = toIndexedObject(O);
|
|
720
|
-
P = toPropertyKey(P);
|
|
721
|
-
if (IE8_DOM_DEFINE) try {
|
|
722
|
-
return $getOwnPropertyDescriptor(O, P);
|
|
723
|
-
} catch (error) {}
|
|
724
|
-
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
725
|
-
};
|
|
726
|
-
return objectGetOwnPropertyDescriptor;
|
|
727
|
-
}
|
|
290
|
+
for (var i = 0, l = pathEnv.length; i < l; i++) {
|
|
291
|
+
var pathPart = pathEnv[i];
|
|
292
|
+
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
293
|
+
var p = path$2.join(pathPart, cmd);
|
|
728
294
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
var hasRequiredV8PrototypeDefineBug;
|
|
733
|
-
function requireV8PrototypeDefineBug() {
|
|
734
|
-
if (hasRequiredV8PrototypeDefineBug) return v8PrototypeDefineBug;
|
|
735
|
-
hasRequiredV8PrototypeDefineBug = 1;
|
|
736
|
-
var DESCRIPTORS = requireDescriptors();
|
|
737
|
-
var fails = requireFails();
|
|
738
|
-
// V8 ~ Chrome 36-
|
|
739
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
740
|
-
v8PrototypeDefineBug = DESCRIPTORS && fails(function() {
|
|
741
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
742
|
-
return Object.defineProperty(function() {}, 'prototype', {
|
|
743
|
-
value: 42,
|
|
744
|
-
writable: false
|
|
745
|
-
}).prototype !== 42;
|
|
746
|
-
});
|
|
747
|
-
return v8PrototypeDefineBug;
|
|
748
|
-
}
|
|
295
|
+
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
296
|
+
p = cmd.slice(0, 2) + p;
|
|
297
|
+
}
|
|
749
298
|
|
|
750
|
-
var
|
|
751
|
-
var
|
|
752
|
-
|
|
753
|
-
if (hasRequiredAnObject) return anObject;
|
|
754
|
-
hasRequiredAnObject = 1;
|
|
755
|
-
var isObject = requireIsObject();
|
|
756
|
-
var $String = String;
|
|
757
|
-
var $TypeError = TypeError;
|
|
758
|
-
// `Assert: Type(argument) is Object`
|
|
759
|
-
anObject = function anObject(argument) {
|
|
760
|
-
if (isObject(argument)) return argument;
|
|
761
|
-
throw new $TypeError($String(argument) + ' is not an object');
|
|
762
|
-
};
|
|
763
|
-
return anObject;
|
|
764
|
-
}
|
|
299
|
+
for (var j = 0, ll = pathExt.length; j < ll; j++) {
|
|
300
|
+
var cur = p + pathExt[j];
|
|
301
|
+
var is;
|
|
765
302
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
var $TypeError = TypeError;
|
|
776
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
777
|
-
var $defineProperty = Object.defineProperty;
|
|
778
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
779
|
-
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
780
|
-
var ENUMERABLE = 'enumerable';
|
|
781
|
-
var CONFIGURABLE = 'configurable';
|
|
782
|
-
var WRITABLE = 'writable';
|
|
783
|
-
// `Object.defineProperty` method
|
|
784
|
-
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
785
|
-
objectDefineProperty.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
|
786
|
-
anObject(O);
|
|
787
|
-
P = toPropertyKey(P);
|
|
788
|
-
anObject(Attributes);
|
|
789
|
-
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
790
|
-
var current = $getOwnPropertyDescriptor(O, P);
|
|
791
|
-
if (current && current[WRITABLE]) {
|
|
792
|
-
O[P] = Attributes.value;
|
|
793
|
-
Attributes = {
|
|
794
|
-
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
|
795
|
-
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
796
|
-
writable: false
|
|
797
|
-
};
|
|
798
|
-
}
|
|
303
|
+
try {
|
|
304
|
+
is = isexe.sync(cur, {
|
|
305
|
+
pathExt: pathExtExe
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
if (is) {
|
|
309
|
+
if (opt.all) found.push(cur); else return cur;
|
|
310
|
+
}
|
|
311
|
+
} catch (ex) { }
|
|
799
312
|
}
|
|
800
|
-
|
|
801
|
-
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
802
|
-
anObject(O);
|
|
803
|
-
P = toPropertyKey(P);
|
|
804
|
-
anObject(Attributes);
|
|
805
|
-
if (IE8_DOM_DEFINE) try {
|
|
806
|
-
return $defineProperty(O, P, Attributes);
|
|
807
|
-
} catch (error) {}
|
|
808
|
-
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
|
|
809
|
-
if ('value' in Attributes) O[P] = Attributes.value;
|
|
810
|
-
return O;
|
|
811
|
-
};
|
|
812
|
-
return objectDefineProperty;
|
|
813
|
-
}
|
|
313
|
+
}
|
|
814
314
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
if (hasRequiredCreateNonEnumerableProperty) return createNonEnumerableProperty;
|
|
819
|
-
hasRequiredCreateNonEnumerableProperty = 1;
|
|
820
|
-
var DESCRIPTORS = requireDescriptors();
|
|
821
|
-
var definePropertyModule = requireObjectDefineProperty();
|
|
822
|
-
var createPropertyDescriptor = requireCreatePropertyDescriptor();
|
|
823
|
-
createNonEnumerableProperty = DESCRIPTORS ? function createNonEnumerableProperty(object, key, value) {
|
|
824
|
-
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
825
|
-
} : function(object, key, value) {
|
|
826
|
-
object[key] = value;
|
|
827
|
-
return object;
|
|
828
|
-
};
|
|
829
|
-
return createNonEnumerableProperty;
|
|
315
|
+
if (opt.all && found.length) return found;
|
|
316
|
+
if (opt.nothrow) return null;
|
|
317
|
+
throw getNotFoundError(cmd);
|
|
830
318
|
}
|
|
831
319
|
|
|
832
|
-
var
|
|
833
|
-
|
|
320
|
+
var pathKey$1 = function pathKey$1(opts) {
|
|
321
|
+
opts = opts || {};
|
|
322
|
+
var env = opts.env || process.env;
|
|
323
|
+
var platform = opts.platform || process.platform;
|
|
324
|
+
|
|
325
|
+
if (platform !== 'win32') {
|
|
326
|
+
return 'PATH';
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return Object.keys(env).find(function (x) {
|
|
330
|
+
return x.toUpperCase() === 'PATH';
|
|
331
|
+
}) || 'Path';
|
|
834
332
|
};
|
|
835
333
|
|
|
836
|
-
var
|
|
837
|
-
var
|
|
838
|
-
|
|
839
|
-
if (hasRequiredFunctionName) return functionName;
|
|
840
|
-
hasRequiredFunctionName = 1;
|
|
841
|
-
var DESCRIPTORS = requireDescriptors();
|
|
842
|
-
var hasOwn = requireHasOwnProperty();
|
|
843
|
-
var FunctionPrototype = Function.prototype;
|
|
844
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
845
|
-
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
|
846
|
-
var EXISTS = hasOwn(FunctionPrototype, 'name');
|
|
847
|
-
// additional protection from minified / mangled / dropped function names
|
|
848
|
-
var PROPER = EXISTS && (function something() {}).name === 'something';
|
|
849
|
-
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
|
|
850
|
-
functionName = {
|
|
851
|
-
EXISTS: EXISTS,
|
|
852
|
-
PROPER: PROPER,
|
|
853
|
-
CONFIGURABLE: CONFIGURABLE
|
|
854
|
-
};
|
|
855
|
-
return functionName;
|
|
856
|
-
}
|
|
334
|
+
var path$1 = require$$0__default$1["default"];
|
|
335
|
+
var which = which_1;
|
|
336
|
+
var pathKey = pathKey$1();
|
|
857
337
|
|
|
858
|
-
|
|
859
|
-
var
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
store.inspectSource = function(it) {
|
|
870
|
-
return functionToString(it);
|
|
871
|
-
};
|
|
338
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
339
|
+
var cwd = process.cwd();
|
|
340
|
+
var hasCustomCwd = parsed.options.cwd != null; // If a custom `cwd` was specified, we need to change the process cwd
|
|
341
|
+
// because `which` will do stat calls but does not support a custom cwd
|
|
342
|
+
|
|
343
|
+
if (hasCustomCwd) {
|
|
344
|
+
try {
|
|
345
|
+
process.chdir(parsed.options.cwd);
|
|
346
|
+
} catch (err) {
|
|
347
|
+
/* Empty */
|
|
348
|
+
}
|
|
872
349
|
}
|
|
873
|
-
inspectSource = store.inspectSource;
|
|
874
|
-
return inspectSource;
|
|
875
|
-
}
|
|
876
350
|
|
|
877
|
-
var
|
|
878
|
-
var hasRequiredWeakMapBasicDetection;
|
|
879
|
-
function requireWeakMapBasicDetection() {
|
|
880
|
-
if (hasRequiredWeakMapBasicDetection) return weakMapBasicDetection;
|
|
881
|
-
hasRequiredWeakMapBasicDetection = 1;
|
|
882
|
-
var globalThis = requireGlobalThis();
|
|
883
|
-
var isCallable = requireIsCallable();
|
|
884
|
-
var WeakMap = globalThis.WeakMap;
|
|
885
|
-
weakMapBasicDetection = isCallable(WeakMap) && /native code/.test(String(WeakMap));
|
|
886
|
-
return weakMapBasicDetection;
|
|
887
|
-
}
|
|
351
|
+
var resolved;
|
|
888
352
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
return sharedKey;
|
|
901
|
-
}
|
|
353
|
+
try {
|
|
354
|
+
resolved = which.sync(parsed.command, {
|
|
355
|
+
path: (parsed.options.env || process.env)[pathKey],
|
|
356
|
+
pathExt: withoutPathExt ? path$1.delimiter : undefined
|
|
357
|
+
});
|
|
358
|
+
} catch (e) {
|
|
359
|
+
/* Empty */
|
|
360
|
+
} finally {
|
|
361
|
+
process.chdir(cwd);
|
|
362
|
+
} // If we successfully resolved, ensure that an absolute path is returned
|
|
363
|
+
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
902
364
|
|
|
903
|
-
var hiddenKeys;
|
|
904
|
-
var hasRequiredHiddenKeys;
|
|
905
|
-
function requireHiddenKeys() {
|
|
906
|
-
if (hasRequiredHiddenKeys) return hiddenKeys;
|
|
907
|
-
hasRequiredHiddenKeys = 1;
|
|
908
|
-
hiddenKeys = {};
|
|
909
|
-
return hiddenKeys;
|
|
910
|
-
}
|
|
911
365
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
function requireInternalState() {
|
|
915
|
-
if (hasRequiredInternalState) return internalState;
|
|
916
|
-
hasRequiredInternalState = 1;
|
|
917
|
-
var NATIVE_WEAK_MAP = requireWeakMapBasicDetection();
|
|
918
|
-
var globalThis = requireGlobalThis();
|
|
919
|
-
var isObject = requireIsObject();
|
|
920
|
-
var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
|
|
921
|
-
var hasOwn = requireHasOwnProperty();
|
|
922
|
-
var shared = requireSharedStore();
|
|
923
|
-
var sharedKey = requireSharedKey();
|
|
924
|
-
var hiddenKeys = requireHiddenKeys();
|
|
925
|
-
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
926
|
-
var TypeError = globalThis.TypeError;
|
|
927
|
-
var WeakMap = globalThis.WeakMap;
|
|
928
|
-
var set, get, has;
|
|
929
|
-
var enforce = function enforce(it) {
|
|
930
|
-
return has(it) ? get(it) : set(it, {});
|
|
931
|
-
};
|
|
932
|
-
var getterFor = function getterFor(TYPE) {
|
|
933
|
-
return function(it) {
|
|
934
|
-
var state;
|
|
935
|
-
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
936
|
-
throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
|
|
937
|
-
}
|
|
938
|
-
return state;
|
|
939
|
-
};
|
|
940
|
-
};
|
|
941
|
-
if (NATIVE_WEAK_MAP || shared.state) {
|
|
942
|
-
var store = shared.state || (shared.state = new WeakMap());
|
|
943
|
-
/* eslint-disable no-self-assign -- prototype methods protection */ store.get = store.get;
|
|
944
|
-
store.has = store.has;
|
|
945
|
-
store.set = store.set;
|
|
946
|
-
/* eslint-enable no-self-assign -- prototype methods protection */ set = function set(it, metadata) {
|
|
947
|
-
if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
|
948
|
-
metadata.facade = it;
|
|
949
|
-
store.set(it, metadata);
|
|
950
|
-
return metadata;
|
|
951
|
-
};
|
|
952
|
-
get = function get(it) {
|
|
953
|
-
return store.get(it) || {};
|
|
954
|
-
};
|
|
955
|
-
has = function has(it) {
|
|
956
|
-
return store.has(it);
|
|
957
|
-
};
|
|
958
|
-
} else {
|
|
959
|
-
var STATE = sharedKey('state');
|
|
960
|
-
hiddenKeys[STATE] = true;
|
|
961
|
-
set = function set(it, metadata) {
|
|
962
|
-
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
|
963
|
-
metadata.facade = it;
|
|
964
|
-
createNonEnumerableProperty(it, STATE, metadata);
|
|
965
|
-
return metadata;
|
|
966
|
-
};
|
|
967
|
-
get = function get(it) {
|
|
968
|
-
return hasOwn(it, STATE) ? it[STATE] : {};
|
|
969
|
-
};
|
|
970
|
-
has = function has(it) {
|
|
971
|
-
return hasOwn(it, STATE);
|
|
972
|
-
};
|
|
366
|
+
if (resolved) {
|
|
367
|
+
resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
973
368
|
}
|
|
974
|
-
internalState = {
|
|
975
|
-
set: set,
|
|
976
|
-
get: get,
|
|
977
|
-
has: has,
|
|
978
|
-
enforce: enforce,
|
|
979
|
-
getterFor: getterFor
|
|
980
|
-
};
|
|
981
|
-
return internalState;
|
|
982
|
-
}
|
|
983
369
|
|
|
984
|
-
|
|
985
|
-
function requireMakeBuiltIn() {
|
|
986
|
-
if (hasRequiredMakeBuiltIn) return makeBuiltIn.exports;
|
|
987
|
-
hasRequiredMakeBuiltIn = 1;
|
|
988
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
989
|
-
var fails = requireFails();
|
|
990
|
-
var isCallable = requireIsCallable();
|
|
991
|
-
var hasOwn = requireHasOwnProperty();
|
|
992
|
-
var DESCRIPTORS = requireDescriptors();
|
|
993
|
-
var CONFIGURABLE_FUNCTION_NAME = requireFunctionName().CONFIGURABLE;
|
|
994
|
-
var inspectSource = requireInspectSource();
|
|
995
|
-
var InternalStateModule = requireInternalState();
|
|
996
|
-
var enforceInternalState = InternalStateModule.enforce;
|
|
997
|
-
var getInternalState = InternalStateModule.get;
|
|
998
|
-
var $String = String;
|
|
999
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
1000
|
-
var defineProperty = Object.defineProperty;
|
|
1001
|
-
var stringSlice = uncurryThis(''.slice);
|
|
1002
|
-
var replace = uncurryThis(''.replace);
|
|
1003
|
-
var join = uncurryThis([].join);
|
|
1004
|
-
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
1005
|
-
return defineProperty(function() {}, 'length', {
|
|
1006
|
-
value: 8
|
|
1007
|
-
}).length !== 8;
|
|
1008
|
-
});
|
|
1009
|
-
var TEMPLATE = String(String).split('String');
|
|
1010
|
-
var makeBuiltIn$1 = makeBuiltIn.exports = function makeBuiltIn(value, name, options) {
|
|
1011
|
-
if (stringSlice($String(name), 0, 7) === 'Symbol(') {
|
|
1012
|
-
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
|
1013
|
-
}
|
|
1014
|
-
if (options && options.getter) name = 'get ' + name;
|
|
1015
|
-
if (options && options.setter) name = 'set ' + name;
|
|
1016
|
-
if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
|
|
1017
|
-
if (DESCRIPTORS) defineProperty(value, 'name', {
|
|
1018
|
-
value: name,
|
|
1019
|
-
configurable: true
|
|
1020
|
-
});
|
|
1021
|
-
else value.name = name;
|
|
1022
|
-
}
|
|
1023
|
-
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
|
|
1024
|
-
defineProperty(value, 'length', {
|
|
1025
|
-
value: options.arity
|
|
1026
|
-
});
|
|
1027
|
-
}
|
|
1028
|
-
try {
|
|
1029
|
-
if (options && hasOwn(options, 'constructor') && options.constructor) {
|
|
1030
|
-
if (DESCRIPTORS) defineProperty(value, 'prototype', {
|
|
1031
|
-
writable: false
|
|
1032
|
-
});
|
|
1033
|
-
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
1034
|
-
} else if (value.prototype) value.prototype = undefined;
|
|
1035
|
-
} catch (error) {}
|
|
1036
|
-
var state = enforceInternalState(value);
|
|
1037
|
-
if (!hasOwn(state, 'source')) {
|
|
1038
|
-
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
|
1039
|
-
}
|
|
1040
|
-
return value;
|
|
1041
|
-
};
|
|
1042
|
-
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
1043
|
-
// eslint-disable-next-line no-extend-native -- required
|
|
1044
|
-
Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
1045
|
-
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
1046
|
-
}, 'toString');
|
|
1047
|
-
return makeBuiltIn.exports;
|
|
370
|
+
return resolved;
|
|
1048
371
|
}
|
|
1049
372
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
function requireDefineBuiltIn() {
|
|
1053
|
-
if (hasRequiredDefineBuiltIn) return defineBuiltIn;
|
|
1054
|
-
hasRequiredDefineBuiltIn = 1;
|
|
1055
|
-
var isCallable = requireIsCallable();
|
|
1056
|
-
var definePropertyModule = requireObjectDefineProperty();
|
|
1057
|
-
var makeBuiltIn = requireMakeBuiltIn();
|
|
1058
|
-
var defineGlobalProperty = requireDefineGlobalProperty();
|
|
1059
|
-
defineBuiltIn = function defineBuiltIn(O, key, value, options) {
|
|
1060
|
-
if (!options) options = {};
|
|
1061
|
-
var simple = options.enumerable;
|
|
1062
|
-
var name = options.name !== undefined ? options.name : key;
|
|
1063
|
-
if (isCallable(value)) makeBuiltIn(value, name, options);
|
|
1064
|
-
if (options.global) {
|
|
1065
|
-
if (simple) O[key] = value;
|
|
1066
|
-
else defineGlobalProperty(key, value);
|
|
1067
|
-
} else {
|
|
1068
|
-
try {
|
|
1069
|
-
if (!options.unsafe) delete O[key];
|
|
1070
|
-
else if (O[key]) simple = true;
|
|
1071
|
-
} catch (error) {}
|
|
1072
|
-
if (simple) O[key] = value;
|
|
1073
|
-
else definePropertyModule.f(O, key, {
|
|
1074
|
-
value: value,
|
|
1075
|
-
enumerable: false,
|
|
1076
|
-
configurable: !options.nonConfigurable,
|
|
1077
|
-
writable: !options.nonWritable
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
return O;
|
|
1081
|
-
};
|
|
1082
|
-
return defineBuiltIn;
|
|
373
|
+
function resolveCommand$1(parsed) {
|
|
374
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
1083
375
|
}
|
|
1084
376
|
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
var mathTrunc;
|
|
1088
|
-
var hasRequiredMathTrunc;
|
|
1089
|
-
function requireMathTrunc() {
|
|
1090
|
-
if (hasRequiredMathTrunc) return mathTrunc;
|
|
1091
|
-
hasRequiredMathTrunc = 1;
|
|
1092
|
-
var ceil = Math.ceil;
|
|
1093
|
-
var floor = Math.floor;
|
|
1094
|
-
// `Math.trunc` method
|
|
1095
|
-
// https://tc39.es/ecma262/#sec-math.trunc
|
|
1096
|
-
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
1097
|
-
mathTrunc = Math.trunc || function trunc(x) {
|
|
1098
|
-
var n = +x;
|
|
1099
|
-
return (n > 0 ? floor : ceil)(n);
|
|
1100
|
-
};
|
|
1101
|
-
return mathTrunc;
|
|
1102
|
-
}
|
|
377
|
+
var resolveCommand_1 = resolveCommand$1;
|
|
378
|
+
var _escape = {}; // See http://www.robvanderwoude.com/escapechars.php
|
|
1103
379
|
|
|
1104
|
-
var
|
|
1105
|
-
var hasRequiredToIntegerOrInfinity;
|
|
1106
|
-
function requireToIntegerOrInfinity() {
|
|
1107
|
-
if (hasRequiredToIntegerOrInfinity) return toIntegerOrInfinity;
|
|
1108
|
-
hasRequiredToIntegerOrInfinity = 1;
|
|
1109
|
-
var trunc = requireMathTrunc();
|
|
1110
|
-
// `ToIntegerOrInfinity` abstract operation
|
|
1111
|
-
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
1112
|
-
toIntegerOrInfinity = function toIntegerOrInfinity(argument) {
|
|
1113
|
-
var number = +argument;
|
|
1114
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1115
|
-
return number !== number || number === 0 ? 0 : trunc(number);
|
|
1116
|
-
};
|
|
1117
|
-
return toIntegerOrInfinity;
|
|
1118
|
-
}
|
|
380
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
1119
381
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
hasRequiredToAbsoluteIndex = 1;
|
|
1125
|
-
var toIntegerOrInfinity = requireToIntegerOrInfinity();
|
|
1126
|
-
var max = Math.max;
|
|
1127
|
-
var min = Math.min;
|
|
1128
|
-
// Helper for a popular repeating case of the spec:
|
|
1129
|
-
// Let integer be ? ToInteger(index).
|
|
1130
|
-
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
1131
|
-
toAbsoluteIndex = function toAbsoluteIndex(index, length) {
|
|
1132
|
-
var integer = toIntegerOrInfinity(index);
|
|
1133
|
-
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
|
1134
|
-
};
|
|
1135
|
-
return toAbsoluteIndex;
|
|
382
|
+
function escapeCommand(arg) {
|
|
383
|
+
// Escape meta chars
|
|
384
|
+
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
385
|
+
return arg;
|
|
1136
386
|
}
|
|
1137
387
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
var toIntegerOrInfinity = requireToIntegerOrInfinity();
|
|
1144
|
-
var min = Math.min;
|
|
1145
|
-
// `ToLength` abstract operation
|
|
1146
|
-
// https://tc39.es/ecma262/#sec-tolength
|
|
1147
|
-
toLength = function toLength(argument) {
|
|
1148
|
-
var len = toIntegerOrInfinity(argument);
|
|
1149
|
-
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
1150
|
-
};
|
|
1151
|
-
return toLength;
|
|
1152
|
-
}
|
|
388
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
389
|
+
// Convert to string
|
|
390
|
+
arg = "".concat(arg); // Algorithm below is based on https://qntm.org/cmd
|
|
391
|
+
// Sequence of backslashes followed by a double quote:
|
|
392
|
+
// double up all the backslashes and escape the double quote
|
|
1153
393
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
if (hasRequiredLengthOfArrayLike) return lengthOfArrayLike;
|
|
1158
|
-
hasRequiredLengthOfArrayLike = 1;
|
|
1159
|
-
var toLength = requireToLength();
|
|
1160
|
-
// `LengthOfArrayLike` abstract operation
|
|
1161
|
-
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
1162
|
-
lengthOfArrayLike = function lengthOfArrayLike(obj) {
|
|
1163
|
-
return toLength(obj.length);
|
|
1164
|
-
};
|
|
1165
|
-
return lengthOfArrayLike;
|
|
1166
|
-
}
|
|
394
|
+
arg = arg.replace(/(\\*)"/g, '$1$1\\"'); // Sequence of backslashes followed by the end of the string
|
|
395
|
+
// (which will become a double quote later):
|
|
396
|
+
// double up all the backslashes
|
|
1167
397
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
function requireArrayIncludes() {
|
|
1171
|
-
if (hasRequiredArrayIncludes) return arrayIncludes;
|
|
1172
|
-
hasRequiredArrayIncludes = 1;
|
|
1173
|
-
var toIndexedObject = requireToIndexedObject();
|
|
1174
|
-
var toAbsoluteIndex = requireToAbsoluteIndex();
|
|
1175
|
-
var lengthOfArrayLike = requireLengthOfArrayLike();
|
|
1176
|
-
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
1177
|
-
var createMethod = function createMethod(IS_INCLUDES) {
|
|
1178
|
-
return function($this, el, fromIndex) {
|
|
1179
|
-
var O = toIndexedObject($this);
|
|
1180
|
-
var length = lengthOfArrayLike(O);
|
|
1181
|
-
if (length === 0) return !IS_INCLUDES && -1;
|
|
1182
|
-
var index = toAbsoluteIndex(fromIndex, length);
|
|
1183
|
-
var value;
|
|
1184
|
-
// Array#includes uses SameValueZero equality algorithm
|
|
1185
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1186
|
-
if (IS_INCLUDES && el !== el) while(length > index){
|
|
1187
|
-
value = O[index++];
|
|
1188
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1189
|
-
if (value !== value) return true;
|
|
1190
|
-
// Array#indexOf ignores holes, Array#includes - not
|
|
1191
|
-
}
|
|
1192
|
-
else for(; length > index; index++){
|
|
1193
|
-
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
1194
|
-
}
|
|
1195
|
-
return !IS_INCLUDES && -1;
|
|
1196
|
-
};
|
|
1197
|
-
};
|
|
1198
|
-
arrayIncludes = {
|
|
1199
|
-
// `Array.prototype.includes` method
|
|
1200
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1201
|
-
includes: createMethod(true),
|
|
1202
|
-
// `Array.prototype.indexOf` method
|
|
1203
|
-
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
1204
|
-
indexOf: createMethod(false)
|
|
1205
|
-
};
|
|
1206
|
-
return arrayIncludes;
|
|
1207
|
-
}
|
|
398
|
+
arg = arg.replace(/(\\*)$/, '$1$1'); // All other backslashes occur literally
|
|
399
|
+
// Quote the whole thing:
|
|
1208
400
|
|
|
1209
|
-
|
|
1210
|
-
var hasRequiredObjectKeysInternal;
|
|
1211
|
-
function requireObjectKeysInternal() {
|
|
1212
|
-
if (hasRequiredObjectKeysInternal) return objectKeysInternal;
|
|
1213
|
-
hasRequiredObjectKeysInternal = 1;
|
|
1214
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1215
|
-
var hasOwn = requireHasOwnProperty();
|
|
1216
|
-
var toIndexedObject = requireToIndexedObject();
|
|
1217
|
-
var indexOf = requireArrayIncludes().indexOf;
|
|
1218
|
-
var hiddenKeys = requireHiddenKeys();
|
|
1219
|
-
var push = uncurryThis([].push);
|
|
1220
|
-
objectKeysInternal = function objectKeysInternal(object, names) {
|
|
1221
|
-
var O = toIndexedObject(object);
|
|
1222
|
-
var i = 0;
|
|
1223
|
-
var result = [];
|
|
1224
|
-
var key;
|
|
1225
|
-
for(key in O)!hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
|
1226
|
-
// Don't enum bug & hidden keys
|
|
1227
|
-
while(names.length > i)if (hasOwn(O, key = names[i++])) {
|
|
1228
|
-
~indexOf(result, key) || push(result, key);
|
|
1229
|
-
}
|
|
1230
|
-
return result;
|
|
1231
|
-
};
|
|
1232
|
-
return objectKeysInternal;
|
|
1233
|
-
}
|
|
401
|
+
arg = "\"".concat(arg, "\""); // Escape meta chars
|
|
1234
402
|
|
|
1235
|
-
|
|
1236
|
-
var hasRequiredEnumBugKeys;
|
|
1237
|
-
function requireEnumBugKeys() {
|
|
1238
|
-
if (hasRequiredEnumBugKeys) return enumBugKeys;
|
|
1239
|
-
hasRequiredEnumBugKeys = 1;
|
|
1240
|
-
// IE8- don't enum bug keys
|
|
1241
|
-
enumBugKeys = [
|
|
1242
|
-
'constructor',
|
|
1243
|
-
'hasOwnProperty',
|
|
1244
|
-
'isPrototypeOf',
|
|
1245
|
-
'propertyIsEnumerable',
|
|
1246
|
-
'toLocaleString',
|
|
1247
|
-
'toString',
|
|
1248
|
-
'valueOf'
|
|
1249
|
-
];
|
|
1250
|
-
return enumBugKeys;
|
|
1251
|
-
}
|
|
403
|
+
arg = arg.replace(metaCharsRegExp, '^$1'); // Double escape meta chars if necessary
|
|
1252
404
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
var enumBugKeys = requireEnumBugKeys();
|
|
1259
|
-
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
1260
|
-
// `Object.getOwnPropertyNames` method
|
|
1261
|
-
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
1262
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
1263
|
-
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
1264
|
-
return internalObjectKeys(O, hiddenKeys);
|
|
1265
|
-
};
|
|
1266
|
-
return objectGetOwnPropertyNames;
|
|
405
|
+
if (doubleEscapeMetaChars) {
|
|
406
|
+
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return arg;
|
|
1267
410
|
}
|
|
1268
411
|
|
|
1269
|
-
|
|
412
|
+
_escape.command = escapeCommand;
|
|
413
|
+
_escape.argument = escapeArgument;
|
|
414
|
+
var shebangRegex$1 = /^#!.*/;
|
|
415
|
+
var shebangRegex = shebangRegex$1;
|
|
1270
416
|
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1273
|
-
if (hasRequiredObjectGetOwnPropertySymbols) return objectGetOwnPropertySymbols;
|
|
1274
|
-
hasRequiredObjectGetOwnPropertySymbols = 1;
|
|
1275
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
1276
|
-
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
1277
|
-
return objectGetOwnPropertySymbols;
|
|
1278
|
-
}
|
|
417
|
+
var shebangCommand$1 = function shebangCommand$1(str) {
|
|
418
|
+
var match = str.match(shebangRegex);
|
|
1279
419
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
if (hasRequiredOwnKeys) return ownKeys;
|
|
1284
|
-
hasRequiredOwnKeys = 1;
|
|
1285
|
-
var getBuiltIn = requireGetBuiltIn();
|
|
1286
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1287
|
-
var getOwnPropertyNamesModule = requireObjectGetOwnPropertyNames();
|
|
1288
|
-
var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
|
|
1289
|
-
var anObject = requireAnObject();
|
|
1290
|
-
var concat = uncurryThis([].concat);
|
|
1291
|
-
// all object keys, includes non-enumerable and symbols
|
|
1292
|
-
ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
1293
|
-
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
1294
|
-
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
1295
|
-
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
1296
|
-
};
|
|
1297
|
-
return ownKeys;
|
|
1298
|
-
}
|
|
420
|
+
if (!match) {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
1299
423
|
|
|
1300
|
-
var
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
var hasOwn = requireHasOwnProperty();
|
|
1306
|
-
var ownKeys = requireOwnKeys();
|
|
1307
|
-
var getOwnPropertyDescriptorModule = requireObjectGetOwnPropertyDescriptor();
|
|
1308
|
-
var definePropertyModule = requireObjectDefineProperty();
|
|
1309
|
-
copyConstructorProperties = function copyConstructorProperties(target, source, exceptions) {
|
|
1310
|
-
var keys = ownKeys(source);
|
|
1311
|
-
var defineProperty = definePropertyModule.f;
|
|
1312
|
-
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
1313
|
-
for(var i = 0; i < keys.length; i++){
|
|
1314
|
-
var key = keys[i];
|
|
1315
|
-
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
|
1316
|
-
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
return copyConstructorProperties;
|
|
1321
|
-
}
|
|
424
|
+
var arr = match[0].replace(/#! ?/, '').split(' ');
|
|
425
|
+
var bin = arr[0].split('/').pop();
|
|
426
|
+
var arg = arr[1];
|
|
427
|
+
return bin === 'env' ? arg : bin + (arg ? ' ' + arg : '');
|
|
428
|
+
};
|
|
1322
429
|
|
|
1323
|
-
var
|
|
1324
|
-
var
|
|
1325
|
-
function requireIsForced() {
|
|
1326
|
-
if (hasRequiredIsForced) return isForced_1;
|
|
1327
|
-
hasRequiredIsForced = 1;
|
|
1328
|
-
var fails = requireFails();
|
|
1329
|
-
var isCallable = requireIsCallable();
|
|
1330
|
-
var replacement = /#|\.prototype\./;
|
|
1331
|
-
var isForced = function isForced(feature, detection) {
|
|
1332
|
-
var value = data[normalize(feature)];
|
|
1333
|
-
return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
|
|
1334
|
-
};
|
|
1335
|
-
var normalize = isForced.normalize = function normalize(string) {
|
|
1336
|
-
return String(string).replace(replacement, '.').toLowerCase();
|
|
1337
|
-
};
|
|
1338
|
-
var data = isForced.data = {};
|
|
1339
|
-
var NATIVE = isForced.NATIVE = 'N';
|
|
1340
|
-
var POLYFILL = isForced.POLYFILL = 'P';
|
|
1341
|
-
isForced_1 = isForced;
|
|
1342
|
-
return isForced_1;
|
|
1343
|
-
}
|
|
430
|
+
var fs = require$$0__default["default"];
|
|
431
|
+
var shebangCommand = shebangCommand$1;
|
|
1344
432
|
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
var _export;
|
|
1350
|
-
var hasRequired_export;
|
|
1351
|
-
function require_export() {
|
|
1352
|
-
if (hasRequired_export) return _export;
|
|
1353
|
-
hasRequired_export = 1;
|
|
1354
|
-
var globalThis = requireGlobalThis();
|
|
1355
|
-
var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f;
|
|
1356
|
-
var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
|
|
1357
|
-
var defineBuiltIn = requireDefineBuiltIn();
|
|
1358
|
-
var defineGlobalProperty = requireDefineGlobalProperty();
|
|
1359
|
-
var copyConstructorProperties = requireCopyConstructorProperties();
|
|
1360
|
-
var isForced = requireIsForced();
|
|
1361
|
-
/*
|
|
1362
|
-
options.target - name of the target object
|
|
1363
|
-
options.global - target is the global object
|
|
1364
|
-
options.stat - export as static methods of target
|
|
1365
|
-
options.proto - export as prototype methods of target
|
|
1366
|
-
options.real - real prototype method for the `pure` version
|
|
1367
|
-
options.forced - export even if the native feature is available
|
|
1368
|
-
options.bind - bind methods to the target, required for the `pure` version
|
|
1369
|
-
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
1370
|
-
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
1371
|
-
options.sham - add a flag to not completely full polyfills
|
|
1372
|
-
options.enumerable - export as enumerable property
|
|
1373
|
-
options.dontCallGetSet - prevent calling a getter on target
|
|
1374
|
-
options.name - the .name of the function if it does not match the key
|
|
1375
|
-
*/ _export = function _export(options, source) {
|
|
1376
|
-
var TARGET = options.target;
|
|
1377
|
-
var GLOBAL = options.global;
|
|
1378
|
-
var STATIC = options.stat;
|
|
1379
|
-
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
1380
|
-
if (GLOBAL) {
|
|
1381
|
-
target = globalThis;
|
|
1382
|
-
} else if (STATIC) {
|
|
1383
|
-
target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
|
|
1384
|
-
} else {
|
|
1385
|
-
target = globalThis[TARGET] && globalThis[TARGET].prototype;
|
|
1386
|
-
}
|
|
1387
|
-
if (target) for(key in source){
|
|
1388
|
-
sourceProperty = source[key];
|
|
1389
|
-
if (options.dontCallGetSet) {
|
|
1390
|
-
descriptor = getOwnPropertyDescriptor(target, key);
|
|
1391
|
-
targetProperty = descriptor && descriptor.value;
|
|
1392
|
-
} else targetProperty = target[key];
|
|
1393
|
-
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
1394
|
-
// contained in target
|
|
1395
|
-
if (!FORCED && targetProperty !== undefined) {
|
|
1396
|
-
if ((typeof sourceProperty === "undefined" ? "undefined" : _type_of$1(sourceProperty)) == (typeof targetProperty === "undefined" ? "undefined" : _type_of$1(targetProperty))) continue;
|
|
1397
|
-
copyConstructorProperties(sourceProperty, targetProperty);
|
|
1398
|
-
}
|
|
1399
|
-
// add a flag to not completely full polyfills
|
|
1400
|
-
if (options.sham || targetProperty && targetProperty.sham) {
|
|
1401
|
-
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
1402
|
-
}
|
|
1403
|
-
defineBuiltIn(target, key, sourceProperty, options);
|
|
1404
|
-
}
|
|
1405
|
-
};
|
|
1406
|
-
return _export;
|
|
1407
|
-
}
|
|
433
|
+
function readShebang$1(command) {
|
|
434
|
+
// Read the first 150 bytes from the file
|
|
435
|
+
var size = 150;
|
|
436
|
+
var buffer;
|
|
1408
437
|
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
1418
|
-
// eslint-disable-next-line es/no-object-keys -- safe
|
|
1419
|
-
objectKeys = Object.keys || function keys(O) {
|
|
1420
|
-
return internalObjectKeys(O, enumBugKeys);
|
|
1421
|
-
};
|
|
1422
|
-
return objectKeys;
|
|
1423
|
-
}
|
|
438
|
+
if (Buffer.alloc) {
|
|
439
|
+
// Node.js v4.5+ / v5.10+
|
|
440
|
+
buffer = Buffer.alloc(size);
|
|
441
|
+
} else {
|
|
442
|
+
// Old Node.js API
|
|
443
|
+
buffer = new Buffer(size);
|
|
444
|
+
buffer.fill(0); // zero-fill
|
|
445
|
+
}
|
|
1424
446
|
|
|
1425
|
-
var
|
|
1426
|
-
var hasRequiredObjectAssign;
|
|
1427
|
-
function requireObjectAssign() {
|
|
1428
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
1429
|
-
hasRequiredObjectAssign = 1;
|
|
1430
|
-
var DESCRIPTORS = requireDescriptors();
|
|
1431
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1432
|
-
var call = requireFunctionCall();
|
|
1433
|
-
var fails = requireFails();
|
|
1434
|
-
var objectKeys = requireObjectKeys();
|
|
1435
|
-
var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
|
|
1436
|
-
var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable();
|
|
1437
|
-
var toObject = requireToObject();
|
|
1438
|
-
var IndexedObject = requireIndexedObject();
|
|
1439
|
-
// eslint-disable-next-line es/no-object-assign -- safe
|
|
1440
|
-
var $assign = Object.assign;
|
|
1441
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1442
|
-
var defineProperty = Object.defineProperty;
|
|
1443
|
-
var concat = uncurryThis([].concat);
|
|
1444
|
-
// `Object.assign` method
|
|
1445
|
-
// https://tc39.es/ecma262/#sec-object.assign
|
|
1446
|
-
objectAssign = !$assign || fails(function() {
|
|
1447
|
-
// should have correct order of operations (Edge bug)
|
|
1448
|
-
if (DESCRIPTORS && $assign({
|
|
1449
|
-
b: 1
|
|
1450
|
-
}, $assign(defineProperty({}, 'a', {
|
|
1451
|
-
enumerable: true,
|
|
1452
|
-
get: function get() {
|
|
1453
|
-
defineProperty(this, 'b', {
|
|
1454
|
-
value: 3,
|
|
1455
|
-
enumerable: false
|
|
1456
|
-
});
|
|
1457
|
-
}
|
|
1458
|
-
}), {
|
|
1459
|
-
b: 2
|
|
1460
|
-
})).b !== 1) return true;
|
|
1461
|
-
// should work with symbols and should have deterministic property order (V8 bug)
|
|
1462
|
-
var A = {};
|
|
1463
|
-
var B = {};
|
|
1464
|
-
// eslint-disable-next-line es/no-symbol -- safe
|
|
1465
|
-
var symbol = Symbol('assign detection');
|
|
1466
|
-
var alphabet = 'abcdefghijklmnopqrst';
|
|
1467
|
-
A[symbol] = 7;
|
|
1468
|
-
alphabet.split('').forEach(function(chr) {
|
|
1469
|
-
B[chr] = chr;
|
|
1470
|
-
});
|
|
1471
|
-
return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
|
|
1472
|
-
}) ? function assign(target, source) {
|
|
1473
|
-
var T = toObject(target);
|
|
1474
|
-
var argumentsLength = arguments.length;
|
|
1475
|
-
var index = 1;
|
|
1476
|
-
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
1477
|
-
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
|
1478
|
-
while(argumentsLength > index){
|
|
1479
|
-
var S = IndexedObject(arguments[index++]);
|
|
1480
|
-
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
|
1481
|
-
var length = keys.length;
|
|
1482
|
-
var j = 0;
|
|
1483
|
-
var key;
|
|
1484
|
-
while(length > j){
|
|
1485
|
-
key = keys[j++];
|
|
1486
|
-
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
return T;
|
|
1490
|
-
} : $assign;
|
|
1491
|
-
return objectAssign;
|
|
1492
|
-
}
|
|
447
|
+
var fd;
|
|
1493
448
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
//
|
|
1501
|
-
// https://tc39.es/ecma262/#sec-object.assign
|
|
1502
|
-
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1503
|
-
$({
|
|
1504
|
-
target: 'Object',
|
|
1505
|
-
stat: true,
|
|
1506
|
-
arity: 2,
|
|
1507
|
-
forced: Object.assign !== assign
|
|
1508
|
-
}, {
|
|
1509
|
-
assign: assign
|
|
1510
|
-
});
|
|
1511
|
-
return es_object_assign;
|
|
1512
|
-
}
|
|
449
|
+
try {
|
|
450
|
+
fd = fs.openSync(command, 'r');
|
|
451
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
452
|
+
fs.closeSync(fd);
|
|
453
|
+
} catch (e) {
|
|
454
|
+
/* Empty */
|
|
455
|
+
} // Attempt to extract shebang (null is returned if not a shebang)
|
|
1513
456
|
|
|
1514
|
-
var path;
|
|
1515
|
-
var hasRequiredPath;
|
|
1516
|
-
function requirePath() {
|
|
1517
|
-
if (hasRequiredPath) return path;
|
|
1518
|
-
hasRequiredPath = 1;
|
|
1519
|
-
var globalThis = requireGlobalThis();
|
|
1520
|
-
path = globalThis;
|
|
1521
|
-
return path;
|
|
1522
|
-
}
|
|
1523
457
|
|
|
1524
|
-
|
|
1525
|
-
var hasRequiredAssign$2;
|
|
1526
|
-
function requireAssign$2() {
|
|
1527
|
-
if (hasRequiredAssign$2) return assign$2;
|
|
1528
|
-
hasRequiredAssign$2 = 1;
|
|
1529
|
-
requireEs_object_assign();
|
|
1530
|
-
var path = requirePath();
|
|
1531
|
-
assign$2 = path.Object.assign;
|
|
1532
|
-
return assign$2;
|
|
458
|
+
return shebangCommand(buffer.toString());
|
|
1533
459
|
}
|
|
1534
460
|
|
|
1535
|
-
var
|
|
1536
|
-
var
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
461
|
+
var readShebang_1 = readShebang$1;
|
|
462
|
+
var path = require$$0__default$1["default"];
|
|
463
|
+
var niceTry = src;
|
|
464
|
+
var resolveCommand = resolveCommand_1;
|
|
465
|
+
var escape = _escape;
|
|
466
|
+
var readShebang = readShebang_1;
|
|
467
|
+
var semver = require$$5__default["default"];
|
|
468
|
+
var isWin$1 = process.platform === 'win32';
|
|
469
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
470
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; // `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
|
1544
471
|
|
|
1545
|
-
var
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
if (hasRequiredAssign) return assign;
|
|
1549
|
-
hasRequiredAssign = 1;
|
|
1550
|
-
var parent = requireAssign$1();
|
|
1551
|
-
assign = parent;
|
|
1552
|
-
return assign;
|
|
1553
|
-
}
|
|
472
|
+
var supportsShellOption = niceTry(function () {
|
|
473
|
+
return semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true);
|
|
474
|
+
}) || false;
|
|
1554
475
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
var
|
|
1558
|
-
function requireEs_object_keys() {
|
|
1559
|
-
if (hasRequiredEs_object_keys) return es_object_keys;
|
|
1560
|
-
hasRequiredEs_object_keys = 1;
|
|
1561
|
-
var $ = require_export();
|
|
1562
|
-
var toObject = requireToObject();
|
|
1563
|
-
var nativeKeys = requireObjectKeys();
|
|
1564
|
-
var fails = requireFails();
|
|
1565
|
-
var FAILS_ON_PRIMITIVES = fails(function() {
|
|
1566
|
-
nativeKeys(1);
|
|
1567
|
-
});
|
|
1568
|
-
// `Object.keys` method
|
|
1569
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
1570
|
-
$({
|
|
1571
|
-
target: 'Object',
|
|
1572
|
-
stat: true,
|
|
1573
|
-
forced: FAILS_ON_PRIMITIVES
|
|
1574
|
-
}, {
|
|
1575
|
-
keys: function keys(it) {
|
|
1576
|
-
return nativeKeys(toObject(it));
|
|
1577
|
-
}
|
|
1578
|
-
});
|
|
1579
|
-
return es_object_keys;
|
|
1580
|
-
}
|
|
476
|
+
function detectShebang(parsed) {
|
|
477
|
+
parsed.file = resolveCommand(parsed);
|
|
478
|
+
var shebang = parsed.file && readShebang(parsed.file);
|
|
1581
479
|
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
requireEs_object_keys();
|
|
1588
|
-
var path = requirePath();
|
|
1589
|
-
keys$2 = path.Object.keys;
|
|
1590
|
-
return keys$2;
|
|
1591
|
-
}
|
|
480
|
+
if (shebang) {
|
|
481
|
+
parsed.args.unshift(parsed.file);
|
|
482
|
+
parsed.command = shebang;
|
|
483
|
+
return resolveCommand(parsed);
|
|
484
|
+
}
|
|
1592
485
|
|
|
1593
|
-
|
|
1594
|
-
var hasRequiredKeys$1;
|
|
1595
|
-
function requireKeys$1() {
|
|
1596
|
-
if (hasRequiredKeys$1) return keys$1;
|
|
1597
|
-
hasRequiredKeys$1 = 1;
|
|
1598
|
-
var parent = requireKeys$2();
|
|
1599
|
-
keys$1 = parent;
|
|
1600
|
-
return keys$1;
|
|
486
|
+
return parsed.file;
|
|
1601
487
|
}
|
|
1602
488
|
|
|
1603
|
-
var
|
|
1604
|
-
var hasRequiredKeys;
|
|
1605
|
-
function requireKeys() {
|
|
1606
|
-
if (hasRequiredKeys) return keys;
|
|
1607
|
-
hasRequiredKeys = 1;
|
|
1608
|
-
var parent = requireKeys$1();
|
|
1609
|
-
keys = parent;
|
|
1610
|
-
return keys;
|
|
1611
|
-
}
|
|
489
|
+
var NODES = ['node', 'node.exe', 'node.cmd'];
|
|
1612
490
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
function requireFunctionUncurryThisClause() {
|
|
1618
|
-
if (hasRequiredFunctionUncurryThisClause) return functionUncurryThisClause;
|
|
1619
|
-
hasRequiredFunctionUncurryThisClause = 1;
|
|
1620
|
-
var classofRaw = requireClassofRaw();
|
|
1621
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1622
|
-
functionUncurryThisClause = function functionUncurryThisClause(fn) {
|
|
1623
|
-
// Nashorn bug:
|
|
1624
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
1625
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
1626
|
-
if (classofRaw(fn) === 'Function') return uncurryThis(fn);
|
|
1627
|
-
};
|
|
1628
|
-
return functionUncurryThisClause;
|
|
1629
|
-
}
|
|
491
|
+
function parseNonShell(parsed) {
|
|
492
|
+
if (!isWin$1) {
|
|
493
|
+
return parsed;
|
|
494
|
+
} // Detect & add support for shebangs
|
|
1630
495
|
|
|
1631
|
-
var
|
|
1632
|
-
var hasRequiredFunctionBindContext;
|
|
1633
|
-
function requireFunctionBindContext() {
|
|
1634
|
-
if (hasRequiredFunctionBindContext) return functionBindContext;
|
|
1635
|
-
hasRequiredFunctionBindContext = 1;
|
|
1636
|
-
var uncurryThis = requireFunctionUncurryThisClause();
|
|
1637
|
-
var aCallable = requireACallable();
|
|
1638
|
-
var NATIVE_BIND = requireFunctionBindNative();
|
|
1639
|
-
var bind = uncurryThis(uncurryThis.bind);
|
|
1640
|
-
// optional / simple context binding
|
|
1641
|
-
functionBindContext = function functionBindContext(fn, that) {
|
|
1642
|
-
aCallable(fn);
|
|
1643
|
-
return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function() {
|
|
1644
|
-
return fn.apply(that, arguments);
|
|
1645
|
-
};
|
|
1646
|
-
};
|
|
1647
|
-
return functionBindContext;
|
|
1648
|
-
}
|
|
496
|
+
var commandFile = detectShebang(parsed); // We don't need a shell if the command filename is an executable
|
|
1649
497
|
|
|
1650
|
-
var
|
|
1651
|
-
|
|
1652
|
-
function requireIsArray() {
|
|
1653
|
-
if (hasRequiredIsArray) return isArray;
|
|
1654
|
-
hasRequiredIsArray = 1;
|
|
1655
|
-
var classof = requireClassofRaw();
|
|
1656
|
-
// `IsArray` abstract operation
|
|
1657
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
1658
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
1659
|
-
isArray = Array.isArray || function isArray(argument) {
|
|
1660
|
-
return classof(argument) === 'Array';
|
|
1661
|
-
};
|
|
1662
|
-
return isArray;
|
|
1663
|
-
}
|
|
498
|
+
var needsShell = !isExecutableRegExp.test(commandFile); // If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
499
|
+
// Note that `forceShell` is an hidden option used only in tests
|
|
1664
500
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
function requireToStringTagSupport() {
|
|
1668
|
-
if (hasRequiredToStringTagSupport) return toStringTagSupport;
|
|
1669
|
-
hasRequiredToStringTagSupport = 1;
|
|
1670
|
-
var wellKnownSymbol = requireWellKnownSymbol();
|
|
1671
|
-
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1672
|
-
var test = {};
|
|
1673
|
-
test[TO_STRING_TAG] = 'z';
|
|
1674
|
-
toStringTagSupport = String(test) === '[object z]';
|
|
1675
|
-
return toStringTagSupport;
|
|
1676
|
-
}
|
|
501
|
+
// KM: force node to use the shell
|
|
502
|
+
if (!needsShell && NODES.indexOf(path.basename(commandFile).toLowerCase()) >= 0) needsShell = true;
|
|
1677
503
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
var classofRaw = requireClassofRaw();
|
|
1686
|
-
var wellKnownSymbol = requireWellKnownSymbol();
|
|
1687
|
-
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1688
|
-
var $Object = Object;
|
|
1689
|
-
// ES3 wrong here
|
|
1690
|
-
var CORRECT_ARGUMENTS = classofRaw(function() {
|
|
1691
|
-
return arguments;
|
|
1692
|
-
}()) === 'Arguments';
|
|
1693
|
-
// fallback for IE11 Script Access Denied error
|
|
1694
|
-
var tryGet = function tryGet(it, key) {
|
|
1695
|
-
try {
|
|
1696
|
-
return it[key];
|
|
1697
|
-
} catch (error) {}
|
|
1698
|
-
};
|
|
1699
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
1700
|
-
classof = TO_STRING_TAG_SUPPORT ? classofRaw : function classof(it) {
|
|
1701
|
-
var O, tag, result;
|
|
1702
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
1703
|
-
};
|
|
1704
|
-
return classof;
|
|
1705
|
-
}
|
|
504
|
+
if (parsed.options.forceShell || needsShell) {
|
|
505
|
+
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
506
|
+
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
507
|
+
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
|
508
|
+
// we need to double escape them
|
|
509
|
+
var needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
510
|
+
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
1706
511
|
|
|
1707
|
-
|
|
1708
|
-
var hasRequiredIsConstructor;
|
|
1709
|
-
function requireIsConstructor() {
|
|
1710
|
-
if (hasRequiredIsConstructor) return isConstructor;
|
|
1711
|
-
hasRequiredIsConstructor = 1;
|
|
1712
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1713
|
-
var fails = requireFails();
|
|
1714
|
-
var isCallable = requireIsCallable();
|
|
1715
|
-
var classof = requireClassof();
|
|
1716
|
-
var getBuiltIn = requireGetBuiltIn();
|
|
1717
|
-
var inspectSource = requireInspectSource();
|
|
1718
|
-
var noop = function noop() {};
|
|
1719
|
-
var construct = getBuiltIn('Reflect', 'construct');
|
|
1720
|
-
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1721
|
-
var exec = uncurryThis(constructorRegExp.exec);
|
|
1722
|
-
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
|
|
1723
|
-
var isConstructorModern = function isConstructor(argument) {
|
|
1724
|
-
if (!isCallable(argument)) return false;
|
|
1725
|
-
try {
|
|
1726
|
-
construct(noop, [], argument);
|
|
1727
|
-
return true;
|
|
1728
|
-
} catch (error) {
|
|
1729
|
-
return false;
|
|
1730
|
-
}
|
|
1731
|
-
};
|
|
1732
|
-
var isConstructorLegacy = function isConstructor(argument) {
|
|
1733
|
-
if (!isCallable(argument)) return false;
|
|
1734
|
-
switch(classof(argument)){
|
|
1735
|
-
case 'AsyncFunction':
|
|
1736
|
-
case 'GeneratorFunction':
|
|
1737
|
-
case 'AsyncGeneratorFunction':
|
|
1738
|
-
return false;
|
|
1739
|
-
}
|
|
1740
|
-
try {
|
|
1741
|
-
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1742
|
-
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1743
|
-
// (for example, `DOMQuad` and similar in FF41-)
|
|
1744
|
-
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
1745
|
-
} catch (error) {
|
|
1746
|
-
return true;
|
|
1747
|
-
}
|
|
1748
|
-
};
|
|
1749
|
-
isConstructorLegacy.sham = true;
|
|
1750
|
-
// `IsConstructor` abstract operation
|
|
1751
|
-
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1752
|
-
isConstructor = !construct || fails(function() {
|
|
1753
|
-
var called;
|
|
1754
|
-
return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
|
|
1755
|
-
called = true;
|
|
1756
|
-
}) || called;
|
|
1757
|
-
}) ? isConstructorLegacy : isConstructorModern;
|
|
1758
|
-
return isConstructor;
|
|
1759
|
-
}
|
|
512
|
+
parsed.command = path.normalize(parsed.command); // Escape command & arguments
|
|
1760
513
|
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
var SPECIES = wellKnownSymbol('species');
|
|
1771
|
-
var $Array = Array;
|
|
1772
|
-
// a part of `ArraySpeciesCreate` abstract operation
|
|
1773
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1774
|
-
arraySpeciesConstructor = function arraySpeciesConstructor(originalArray) {
|
|
1775
|
-
var C;
|
|
1776
|
-
if (isArray(originalArray)) {
|
|
1777
|
-
C = originalArray.constructor;
|
|
1778
|
-
// cross-realm fallback
|
|
1779
|
-
if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
|
|
1780
|
-
else if (isObject(C)) {
|
|
1781
|
-
C = C[SPECIES];
|
|
1782
|
-
if (C === null) C = undefined;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
return C === undefined ? $Array : C;
|
|
1786
|
-
};
|
|
1787
|
-
return arraySpeciesConstructor;
|
|
1788
|
-
}
|
|
514
|
+
parsed.command = escape.command(parsed.command);
|
|
515
|
+
parsed.args = parsed.args.map(function (arg) {
|
|
516
|
+
return escape.argument(arg, needsDoubleEscapeMetaChars);
|
|
517
|
+
});
|
|
518
|
+
var shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
519
|
+
parsed.args = ['/d', '/s', '/c', "\"".concat(shellCommand, "\"")];
|
|
520
|
+
parsed.command = process.env.comspec || 'cmd.exe';
|
|
521
|
+
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
522
|
+
}
|
|
1789
523
|
|
|
1790
|
-
|
|
1791
|
-
var hasRequiredArraySpeciesCreate;
|
|
1792
|
-
function requireArraySpeciesCreate() {
|
|
1793
|
-
if (hasRequiredArraySpeciesCreate) return arraySpeciesCreate;
|
|
1794
|
-
hasRequiredArraySpeciesCreate = 1;
|
|
1795
|
-
var arraySpeciesConstructor = requireArraySpeciesConstructor();
|
|
1796
|
-
// `ArraySpeciesCreate` abstract operation
|
|
1797
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1798
|
-
arraySpeciesCreate = function arraySpeciesCreate(originalArray, length) {
|
|
1799
|
-
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
1800
|
-
};
|
|
1801
|
-
return arraySpeciesCreate;
|
|
524
|
+
return parsed;
|
|
1802
525
|
}
|
|
1803
526
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
1811
|
-
var IndexedObject = requireIndexedObject();
|
|
1812
|
-
var toObject = requireToObject();
|
|
1813
|
-
var lengthOfArrayLike = requireLengthOfArrayLike();
|
|
1814
|
-
var arraySpeciesCreate = requireArraySpeciesCreate();
|
|
1815
|
-
var push = uncurryThis([].push);
|
|
1816
|
-
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
|
1817
|
-
var createMethod = function createMethod(TYPE) {
|
|
1818
|
-
var IS_MAP = TYPE === 1;
|
|
1819
|
-
var IS_FILTER = TYPE === 2;
|
|
1820
|
-
var IS_SOME = TYPE === 3;
|
|
1821
|
-
var IS_EVERY = TYPE === 4;
|
|
1822
|
-
var IS_FIND_INDEX = TYPE === 6;
|
|
1823
|
-
var IS_FILTER_REJECT = TYPE === 7;
|
|
1824
|
-
var NO_HOLES = TYPE === 5 || IS_FIND_INDEX;
|
|
1825
|
-
return function($this, callbackfn, that, specificCreate) {
|
|
1826
|
-
var O = toObject($this);
|
|
1827
|
-
var self = IndexedObject(O);
|
|
1828
|
-
var length = lengthOfArrayLike(self);
|
|
1829
|
-
var boundFunction = bind(callbackfn, that);
|
|
1830
|
-
var index = 0;
|
|
1831
|
-
var create = specificCreate || arraySpeciesCreate;
|
|
1832
|
-
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
|
1833
|
-
var value, result;
|
|
1834
|
-
for(; length > index; index++)if (NO_HOLES || index in self) {
|
|
1835
|
-
value = self[index];
|
|
1836
|
-
result = boundFunction(value, index, O);
|
|
1837
|
-
if (TYPE) {
|
|
1838
|
-
if (IS_MAP) target[index] = result; // map
|
|
1839
|
-
else if (result) switch(TYPE){
|
|
1840
|
-
case 3:
|
|
1841
|
-
return true; // some
|
|
1842
|
-
case 5:
|
|
1843
|
-
return value; // find
|
|
1844
|
-
case 6:
|
|
1845
|
-
return index; // findIndex
|
|
1846
|
-
case 2:
|
|
1847
|
-
push(target, value); // filter
|
|
1848
|
-
}
|
|
1849
|
-
else switch(TYPE){
|
|
1850
|
-
case 4:
|
|
1851
|
-
return false; // every
|
|
1852
|
-
case 7:
|
|
1853
|
-
push(target, value); // filterReject
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
|
1858
|
-
};
|
|
1859
|
-
};
|
|
1860
|
-
arrayIteration = {
|
|
1861
|
-
// `Array.prototype.forEach` method
|
|
1862
|
-
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
1863
|
-
forEach: createMethod(0),
|
|
1864
|
-
// `Array.prototype.map` method
|
|
1865
|
-
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
1866
|
-
map: createMethod(1),
|
|
1867
|
-
// `Array.prototype.filter` method
|
|
1868
|
-
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
1869
|
-
filter: createMethod(2),
|
|
1870
|
-
// `Array.prototype.some` method
|
|
1871
|
-
// https://tc39.es/ecma262/#sec-array.prototype.some
|
|
1872
|
-
some: createMethod(3),
|
|
1873
|
-
// `Array.prototype.every` method
|
|
1874
|
-
// https://tc39.es/ecma262/#sec-array.prototype.every
|
|
1875
|
-
every: createMethod(4),
|
|
1876
|
-
// `Array.prototype.find` method
|
|
1877
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
1878
|
-
find: createMethod(5),
|
|
1879
|
-
// `Array.prototype.findIndex` method
|
|
1880
|
-
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
|
1881
|
-
findIndex: createMethod(6),
|
|
1882
|
-
// `Array.prototype.filterReject` method
|
|
1883
|
-
// https://github.com/tc39/proposal-array-filtering
|
|
1884
|
-
filterReject: createMethod(7)
|
|
1885
|
-
};
|
|
1886
|
-
return arrayIteration;
|
|
1887
|
-
}
|
|
527
|
+
function parseShell(parsed) {
|
|
528
|
+
// If node supports the shell option, there's no need to mimic its behavior
|
|
529
|
+
if (supportsShellOption) {
|
|
530
|
+
return parsed;
|
|
531
|
+
} // Mimic node shell option
|
|
532
|
+
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
|
1888
533
|
|
|
1889
|
-
var objectDefineProperties = {};
|
|
1890
|
-
|
|
1891
|
-
var hasRequiredObjectDefineProperties;
|
|
1892
|
-
function requireObjectDefineProperties() {
|
|
1893
|
-
if (hasRequiredObjectDefineProperties) return objectDefineProperties;
|
|
1894
|
-
hasRequiredObjectDefineProperties = 1;
|
|
1895
|
-
var DESCRIPTORS = requireDescriptors();
|
|
1896
|
-
var V8_PROTOTYPE_DEFINE_BUG = requireV8PrototypeDefineBug();
|
|
1897
|
-
var definePropertyModule = requireObjectDefineProperty();
|
|
1898
|
-
var anObject = requireAnObject();
|
|
1899
|
-
var toIndexedObject = requireToIndexedObject();
|
|
1900
|
-
var objectKeys = requireObjectKeys();
|
|
1901
|
-
// `Object.defineProperties` method
|
|
1902
|
-
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
1903
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
1904
|
-
objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
1905
|
-
anObject(O);
|
|
1906
|
-
var props = toIndexedObject(Properties);
|
|
1907
|
-
var keys = objectKeys(Properties);
|
|
1908
|
-
var length = keys.length;
|
|
1909
|
-
var index = 0;
|
|
1910
|
-
var key;
|
|
1911
|
-
while(length > index)definePropertyModule.f(O, key = keys[index++], props[key]);
|
|
1912
|
-
return O;
|
|
1913
|
-
};
|
|
1914
|
-
return objectDefineProperties;
|
|
1915
|
-
}
|
|
1916
534
|
|
|
1917
|
-
var
|
|
1918
|
-
var hasRequiredHtml;
|
|
1919
|
-
function requireHtml() {
|
|
1920
|
-
if (hasRequiredHtml) return html;
|
|
1921
|
-
hasRequiredHtml = 1;
|
|
1922
|
-
var getBuiltIn = requireGetBuiltIn();
|
|
1923
|
-
html = getBuiltIn('document', 'documentElement');
|
|
1924
|
-
return html;
|
|
1925
|
-
}
|
|
535
|
+
var shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
1926
536
|
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
var GT = '>';
|
|
1940
|
-
var LT = '<';
|
|
1941
|
-
var PROTOTYPE = 'prototype';
|
|
1942
|
-
var SCRIPT = 'script';
|
|
1943
|
-
var IE_PROTO = sharedKey('IE_PROTO');
|
|
1944
|
-
var EmptyConstructor = function EmptyConstructor() {};
|
|
1945
|
-
var scriptTag = function scriptTag(content) {
|
|
1946
|
-
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
1947
|
-
};
|
|
1948
|
-
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
1949
|
-
var NullProtoObjectViaActiveX = function NullProtoObjectViaActiveX(activeXDocument) {
|
|
1950
|
-
activeXDocument.write(scriptTag(''));
|
|
1951
|
-
activeXDocument.close();
|
|
1952
|
-
var temp = activeXDocument.parentWindow.Object;
|
|
1953
|
-
// eslint-disable-next-line no-useless-assignment -- avoid memory leak
|
|
1954
|
-
activeXDocument = null;
|
|
1955
|
-
return temp;
|
|
1956
|
-
};
|
|
1957
|
-
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
1958
|
-
var NullProtoObjectViaIFrame = function NullProtoObjectViaIFrame() {
|
|
1959
|
-
// Thrash, waste and sodomy: IE GC bug
|
|
1960
|
-
var iframe = documentCreateElement('iframe');
|
|
1961
|
-
var JS = 'java' + SCRIPT + ':';
|
|
1962
|
-
var iframeDocument;
|
|
1963
|
-
iframe.style.display = 'none';
|
|
1964
|
-
html.appendChild(iframe);
|
|
1965
|
-
// https://github.com/zloirock/core-js/issues/475
|
|
1966
|
-
iframe.src = String(JS);
|
|
1967
|
-
iframeDocument = iframe.contentWindow.document;
|
|
1968
|
-
iframeDocument.open();
|
|
1969
|
-
iframeDocument.write(scriptTag('document.F=Object'));
|
|
1970
|
-
iframeDocument.close();
|
|
1971
|
-
return iframeDocument.F;
|
|
1972
|
-
};
|
|
1973
|
-
// Check for document.domain and active x support
|
|
1974
|
-
// No need to use active x approach when document.domain is not set
|
|
1975
|
-
// see https://github.com/es-shims/es5-shim/issues/150
|
|
1976
|
-
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
1977
|
-
// avoid IE GC bug
|
|
1978
|
-
var activeXDocument;
|
|
1979
|
-
var NullProtoObject = function NullProtoObject1() {
|
|
1980
|
-
try {
|
|
1981
|
-
activeXDocument = new ActiveXObject('htmlfile');
|
|
1982
|
-
} catch (error) {}
|
|
1983
|
-
NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
1984
|
-
: NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
1985
|
-
var length = enumBugKeys.length;
|
|
1986
|
-
while(length--)delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
1987
|
-
return NullProtoObject();
|
|
1988
|
-
};
|
|
1989
|
-
hiddenKeys[IE_PROTO] = true;
|
|
1990
|
-
// `Object.create` method
|
|
1991
|
-
// https://tc39.es/ecma262/#sec-object.create
|
|
1992
|
-
// eslint-disable-next-line es/no-object-create -- safe
|
|
1993
|
-
objectCreate = Object.create || function create(O, Properties) {
|
|
1994
|
-
var result;
|
|
1995
|
-
if (O !== null) {
|
|
1996
|
-
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
1997
|
-
result = new EmptyConstructor();
|
|
1998
|
-
EmptyConstructor[PROTOTYPE] = null;
|
|
1999
|
-
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
2000
|
-
result[IE_PROTO] = O;
|
|
2001
|
-
} else result = NullProtoObject();
|
|
2002
|
-
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
|
2003
|
-
};
|
|
2004
|
-
return objectCreate;
|
|
2005
|
-
}
|
|
537
|
+
if (isWin$1) {
|
|
538
|
+
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
|
539
|
+
parsed.args = ['/d', '/s', '/c', "\"".concat(shellCommand, "\"")];
|
|
540
|
+
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
541
|
+
} else {
|
|
542
|
+
if (typeof parsed.options.shell === 'string') {
|
|
543
|
+
parsed.command = parsed.options.shell;
|
|
544
|
+
} else if (process.platform === 'android') {
|
|
545
|
+
parsed.command = '/system/bin/sh';
|
|
546
|
+
} else {
|
|
547
|
+
parsed.command = '/bin/sh';
|
|
548
|
+
}
|
|
2006
549
|
|
|
2007
|
-
|
|
2008
|
-
var hasRequiredAddToUnscopables;
|
|
2009
|
-
function requireAddToUnscopables() {
|
|
2010
|
-
if (hasRequiredAddToUnscopables) return addToUnscopables;
|
|
2011
|
-
hasRequiredAddToUnscopables = 1;
|
|
2012
|
-
var wellKnownSymbol = requireWellKnownSymbol();
|
|
2013
|
-
var create = requireObjectCreate();
|
|
2014
|
-
var defineProperty = requireObjectDefineProperty().f;
|
|
2015
|
-
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
2016
|
-
var ArrayPrototype = Array.prototype;
|
|
2017
|
-
// Array.prototype[@@unscopables]
|
|
2018
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2019
|
-
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
2020
|
-
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
2021
|
-
configurable: true,
|
|
2022
|
-
value: create(null)
|
|
2023
|
-
});
|
|
550
|
+
parsed.args = ['-c', shellCommand];
|
|
2024
551
|
}
|
|
2025
|
-
// add a key to Array.prototype[@@unscopables]
|
|
2026
|
-
addToUnscopables = function addToUnscopables(key) {
|
|
2027
|
-
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
2028
|
-
};
|
|
2029
|
-
return addToUnscopables;
|
|
2030
|
-
}
|
|
2031
552
|
|
|
2032
|
-
|
|
2033
|
-
function requireEs_array_find() {
|
|
2034
|
-
if (hasRequiredEs_array_find) return es_array_find;
|
|
2035
|
-
hasRequiredEs_array_find = 1;
|
|
2036
|
-
var $ = require_export();
|
|
2037
|
-
var $find = requireArrayIteration().find;
|
|
2038
|
-
var addToUnscopables = requireAddToUnscopables();
|
|
2039
|
-
var FIND = 'find';
|
|
2040
|
-
var SKIPS_HOLES = true;
|
|
2041
|
-
// Shouldn't skip holes
|
|
2042
|
-
// eslint-disable-next-line es/no-array-prototype-find -- testing
|
|
2043
|
-
if (FIND in []) Array(1)[FIND](function() {
|
|
2044
|
-
SKIPS_HOLES = false;
|
|
2045
|
-
});
|
|
2046
|
-
// `Array.prototype.find` method
|
|
2047
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
2048
|
-
$({
|
|
2049
|
-
target: 'Array',
|
|
2050
|
-
proto: true,
|
|
2051
|
-
forced: SKIPS_HOLES
|
|
2052
|
-
}, {
|
|
2053
|
-
find: function find(callbackfn /* , that = undefined */ ) {
|
|
2054
|
-
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2055
|
-
}
|
|
2056
|
-
});
|
|
2057
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2058
|
-
addToUnscopables(FIND);
|
|
2059
|
-
return es_array_find;
|
|
553
|
+
return parsed;
|
|
2060
554
|
}
|
|
2061
555
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
var uncurryThis = requireFunctionUncurryThis();
|
|
2069
|
-
entryUnbind = function entryUnbind(CONSTRUCTOR, METHOD) {
|
|
2070
|
-
return uncurryThis(globalThis[CONSTRUCTOR].prototype[METHOD]);
|
|
2071
|
-
};
|
|
2072
|
-
return entryUnbind;
|
|
2073
|
-
}
|
|
556
|
+
function parse$1(command, args, options) {
|
|
557
|
+
// Normalize arguments, similar to nodejs
|
|
558
|
+
if (args && !Array.isArray(args)) {
|
|
559
|
+
options = args;
|
|
560
|
+
args = null;
|
|
561
|
+
}
|
|
2074
562
|
|
|
2075
|
-
|
|
2076
|
-
var hasRequiredFind$2;
|
|
2077
|
-
function requireFind$2() {
|
|
2078
|
-
if (hasRequiredFind$2) return find$2;
|
|
2079
|
-
hasRequiredFind$2 = 1;
|
|
2080
|
-
requireEs_array_find();
|
|
2081
|
-
var entryUnbind = requireEntryUnbind();
|
|
2082
|
-
find$2 = entryUnbind('Array', 'find');
|
|
2083
|
-
return find$2;
|
|
2084
|
-
}
|
|
563
|
+
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
2085
564
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
function requireFind$1() {
|
|
2089
|
-
if (hasRequiredFind$1) return find$1;
|
|
2090
|
-
hasRequiredFind$1 = 1;
|
|
2091
|
-
var parent = requireFind$2();
|
|
2092
|
-
find$1 = parent;
|
|
2093
|
-
return find$1;
|
|
2094
|
-
}
|
|
565
|
+
options = Object.assign({}, options); // Clone object to avoid changing the original
|
|
566
|
+
// Build our parsed object
|
|
2095
567
|
|
|
2096
|
-
var
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
}
|
|
568
|
+
var parsed = {
|
|
569
|
+
command: command,
|
|
570
|
+
args: args,
|
|
571
|
+
options: options,
|
|
572
|
+
file: undefined,
|
|
573
|
+
original: {
|
|
574
|
+
command: command,
|
|
575
|
+
args: args
|
|
576
|
+
}
|
|
577
|
+
}; // Delegate further parsing to shell or non-shell
|
|
2105
578
|
|
|
2106
|
-
|
|
2107
|
-
function requirePolyfills() {
|
|
2108
|
-
if (hasRequiredPolyfills) return polyfills;
|
|
2109
|
-
hasRequiredPolyfills = 1;
|
|
2110
|
-
requireAssign();
|
|
2111
|
-
requireKeys();
|
|
2112
|
-
requireFind();
|
|
2113
|
-
var path = require$$0;
|
|
2114
|
-
if (!path.delimiter) {
|
|
2115
|
-
var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
2116
|
-
path.delimiter = isWindows ? ';' : ':';
|
|
2117
|
-
}
|
|
2118
|
-
// early node is missing spawnSync
|
|
2119
|
-
var cp = require$$5;
|
|
2120
|
-
if (!cp.spawnSync) {
|
|
2121
|
-
var path1 = require$$0;
|
|
2122
|
-
var spawnCallback = path1.join(__dirname, '..', 'dist', 'cjs', 'spawnCallback.js');
|
|
2123
|
-
var functionExec = null; // break dependencies
|
|
2124
|
-
cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {
|
|
2125
|
-
if (!functionExec) functionExec = require$$6;
|
|
2126
|
-
return functionExec({
|
|
2127
|
-
callbacks: true
|
|
2128
|
-
}, spawnCallback, cmd, args, options || {});
|
|
2129
|
-
};
|
|
2130
|
-
}
|
|
2131
|
-
return polyfills;
|
|
579
|
+
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
|
2132
580
|
}
|
|
2133
581
|
|
|
2134
|
-
var
|
|
2135
|
-
|
|
2136
|
-
};
|
|
582
|
+
var parse_1 = parse$1;
|
|
583
|
+
var isWin = process.platform === 'win32';
|
|
2137
584
|
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
* @returns {?*} Return-value of the function when no error occurred.
|
|
2147
|
-
*/ src = function src(fn) {
|
|
2148
|
-
try {
|
|
2149
|
-
return fn();
|
|
2150
|
-
} catch (e) {}
|
|
2151
|
-
};
|
|
2152
|
-
return src;
|
|
585
|
+
function notFoundError(original, syscall) {
|
|
586
|
+
return Object.assign(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
|
|
587
|
+
code: 'ENOENT',
|
|
588
|
+
errno: 'ENOENT',
|
|
589
|
+
syscall: "".concat(syscall, " ").concat(original.command),
|
|
590
|
+
path: original.command,
|
|
591
|
+
spawnargs: original.args
|
|
592
|
+
});
|
|
2153
593
|
}
|
|
2154
594
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
if (hasRequiredWindows) return windows;
|
|
2159
|
-
hasRequiredWindows = 1;
|
|
2160
|
-
windows = isexe;
|
|
2161
|
-
isexe.sync = sync;
|
|
2162
|
-
var fs = require$$0$1;
|
|
2163
|
-
function checkPathExt(path, options) {
|
|
2164
|
-
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
2165
|
-
if (!pathext) {
|
|
2166
|
-
return true;
|
|
2167
|
-
}
|
|
2168
|
-
pathext = pathext.split(';');
|
|
2169
|
-
if (pathext.indexOf('') !== -1) {
|
|
2170
|
-
return true;
|
|
2171
|
-
}
|
|
2172
|
-
for(var i = 0; i < pathext.length; i++){
|
|
2173
|
-
var p = pathext[i].toLowerCase();
|
|
2174
|
-
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
2175
|
-
return true;
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
return false;
|
|
2179
|
-
}
|
|
2180
|
-
function checkStat(stat, path, options) {
|
|
2181
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
2182
|
-
return false;
|
|
2183
|
-
}
|
|
2184
|
-
return checkPathExt(path, options);
|
|
2185
|
-
}
|
|
2186
|
-
function isexe(path, options, cb) {
|
|
2187
|
-
fs.stat(path, function(er, stat) {
|
|
2188
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
2189
|
-
});
|
|
2190
|
-
}
|
|
2191
|
-
function sync(path, options) {
|
|
2192
|
-
return checkStat(fs.statSync(path), path, options);
|
|
595
|
+
function hookChildProcess(cp, parsed) {
|
|
596
|
+
if (!isWin) {
|
|
597
|
+
return;
|
|
2193
598
|
}
|
|
2194
|
-
return windows;
|
|
2195
|
-
}
|
|
2196
599
|
|
|
2197
|
-
var
|
|
2198
|
-
var hasRequiredMode;
|
|
2199
|
-
function requireMode() {
|
|
2200
|
-
if (hasRequiredMode) return mode;
|
|
2201
|
-
hasRequiredMode = 1;
|
|
2202
|
-
mode = isexe;
|
|
2203
|
-
isexe.sync = sync;
|
|
2204
|
-
var fs = require$$0$1;
|
|
2205
|
-
function isexe(path, options, cb) {
|
|
2206
|
-
fs.stat(path, function(er, stat) {
|
|
2207
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
function sync(path, options) {
|
|
2211
|
-
return checkStat(fs.statSync(path), options);
|
|
2212
|
-
}
|
|
2213
|
-
function checkStat(stat, options) {
|
|
2214
|
-
return stat.isFile() && checkMode(stat, options);
|
|
2215
|
-
}
|
|
2216
|
-
function checkMode(stat, options) {
|
|
2217
|
-
var mod = stat.mode;
|
|
2218
|
-
var uid = stat.uid;
|
|
2219
|
-
var gid = stat.gid;
|
|
2220
|
-
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
2221
|
-
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
2222
|
-
var u = parseInt('100', 8);
|
|
2223
|
-
var g = parseInt('010', 8);
|
|
2224
|
-
var o = parseInt('001', 8);
|
|
2225
|
-
var ug = u | g;
|
|
2226
|
-
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
2227
|
-
return ret;
|
|
2228
|
-
}
|
|
2229
|
-
return mode;
|
|
2230
|
-
}
|
|
600
|
+
var originalEmit = cp.emit;
|
|
2231
601
|
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
|
|
2239
|
-
core = requireWindows();
|
|
2240
|
-
} else {
|
|
2241
|
-
core = requireMode();
|
|
2242
|
-
}
|
|
2243
|
-
isexe_1 = isexe;
|
|
2244
|
-
isexe.sync = sync;
|
|
2245
|
-
function isexe(path, options, cb) {
|
|
2246
|
-
if (typeof options === 'function') {
|
|
2247
|
-
cb = options;
|
|
2248
|
-
options = {};
|
|
2249
|
-
}
|
|
2250
|
-
if (!cb) {
|
|
2251
|
-
if (typeof Promise !== 'function') {
|
|
2252
|
-
throw new TypeError('callback not provided');
|
|
2253
|
-
}
|
|
2254
|
-
return new Promise(function(resolve, reject) {
|
|
2255
|
-
isexe(path, options || {}, function(er, is) {
|
|
2256
|
-
if (er) {
|
|
2257
|
-
reject(er);
|
|
2258
|
-
} else {
|
|
2259
|
-
resolve(is);
|
|
2260
|
-
}
|
|
2261
|
-
});
|
|
2262
|
-
});
|
|
2263
|
-
}
|
|
2264
|
-
core(path, options || {}, function(er, is) {
|
|
2265
|
-
// ignore EACCES because that just means we aren't allowed to run it
|
|
2266
|
-
if (er) {
|
|
2267
|
-
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
2268
|
-
er = null;
|
|
2269
|
-
is = false;
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
cb(er, is);
|
|
2273
|
-
});
|
|
2274
|
-
}
|
|
2275
|
-
function sync(path, options) {
|
|
2276
|
-
// my kingdom for a filtered catch
|
|
2277
|
-
try {
|
|
2278
|
-
return core.sync(path, options || {});
|
|
2279
|
-
} catch (er) {
|
|
2280
|
-
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
|
2281
|
-
return false;
|
|
2282
|
-
} else {
|
|
2283
|
-
throw er;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
return isexe_1;
|
|
2288
|
-
}
|
|
602
|
+
cp.emit = function (name, arg1) {
|
|
603
|
+
// If emitting "exit" event and exit code is 1, we need to check if
|
|
604
|
+
// the command exists and emit an "error" instead
|
|
605
|
+
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
606
|
+
if (name === 'exit') {
|
|
607
|
+
var err = verifyENOENT(arg1, parsed);
|
|
2289
608
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
function requireWhich() {
|
|
2293
|
-
if (hasRequiredWhich) return which_1;
|
|
2294
|
-
hasRequiredWhich = 1;
|
|
2295
|
-
which_1 = which;
|
|
2296
|
-
which.sync = whichSync;
|
|
2297
|
-
var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
|
|
2298
|
-
var path = require$$0;
|
|
2299
|
-
var COLON = isWindows ? ';' : ':';
|
|
2300
|
-
var isexe = requireIsexe();
|
|
2301
|
-
function getNotFoundError(cmd) {
|
|
2302
|
-
var er = new Error('not found: ' + cmd);
|
|
2303
|
-
er.code = 'ENOENT';
|
|
2304
|
-
return er;
|
|
2305
|
-
}
|
|
2306
|
-
function getPathInfo(cmd, opt) {
|
|
2307
|
-
var colon = opt.colon || COLON;
|
|
2308
|
-
var pathEnv = opt.path || process.env.PATH || '';
|
|
2309
|
-
var pathExt = [
|
|
2310
|
-
''
|
|
2311
|
-
];
|
|
2312
|
-
pathEnv = pathEnv.split(colon);
|
|
2313
|
-
var pathExtExe = '';
|
|
2314
|
-
if (isWindows) {
|
|
2315
|
-
pathEnv.unshift(process.cwd());
|
|
2316
|
-
pathExtExe = opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM';
|
|
2317
|
-
pathExt = pathExtExe.split(colon);
|
|
2318
|
-
// Always test the cmd itself first. isexe will check to make sure
|
|
2319
|
-
// it's found in the pathExt set.
|
|
2320
|
-
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
|
|
2321
|
-
}
|
|
2322
|
-
// If it has a slash, then we don't bother searching the pathenv.
|
|
2323
|
-
// just check the file itself, and that's it.
|
|
2324
|
-
if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) pathEnv = [
|
|
2325
|
-
''
|
|
2326
|
-
];
|
|
2327
|
-
return {
|
|
2328
|
-
env: pathEnv,
|
|
2329
|
-
ext: pathExt,
|
|
2330
|
-
extExe: pathExtExe
|
|
2331
|
-
};
|
|
2332
|
-
}
|
|
2333
|
-
function which(cmd, opt, cb) {
|
|
2334
|
-
if (typeof opt === 'function') {
|
|
2335
|
-
cb = opt;
|
|
2336
|
-
opt = {};
|
|
2337
|
-
}
|
|
2338
|
-
var info = getPathInfo(cmd, opt);
|
|
2339
|
-
var pathEnv = info.env;
|
|
2340
|
-
var pathExt = info.ext;
|
|
2341
|
-
var pathExtExe = info.extExe;
|
|
2342
|
-
var found = [];
|
|
2343
|
-
(function F(i, l) {
|
|
2344
|
-
if (i === l) {
|
|
2345
|
-
if (opt.all && found.length) return cb(null, found);
|
|
2346
|
-
else return cb(getNotFoundError(cmd));
|
|
2347
|
-
}
|
|
2348
|
-
var pathPart = pathEnv[i];
|
|
2349
|
-
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
2350
|
-
var p = path.join(pathPart, cmd);
|
|
2351
|
-
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
2352
|
-
p = cmd.slice(0, 2) + p;
|
|
2353
|
-
}
|
|
2354
|
-
(function E(ii, ll) {
|
|
2355
|
-
if (ii === ll) return F(i + 1, l);
|
|
2356
|
-
var ext = pathExt[ii];
|
|
2357
|
-
isexe(p + ext, {
|
|
2358
|
-
pathExt: pathExtExe
|
|
2359
|
-
}, function(er, is) {
|
|
2360
|
-
if (!er && is) {
|
|
2361
|
-
if (opt.all) found.push(p + ext);
|
|
2362
|
-
else return cb(null, p + ext);
|
|
2363
|
-
}
|
|
2364
|
-
return E(ii + 1, ll);
|
|
2365
|
-
});
|
|
2366
|
-
})(0, pathExt.length);
|
|
2367
|
-
})(0, pathEnv.length);
|
|
2368
|
-
}
|
|
2369
|
-
function whichSync(cmd, opt) {
|
|
2370
|
-
opt = opt || {};
|
|
2371
|
-
var info = getPathInfo(cmd, opt);
|
|
2372
|
-
var pathEnv = info.env;
|
|
2373
|
-
var pathExt = info.ext;
|
|
2374
|
-
var pathExtExe = info.extExe;
|
|
2375
|
-
var found = [];
|
|
2376
|
-
for(var i = 0, l = pathEnv.length; i < l; i++){
|
|
2377
|
-
var pathPart = pathEnv[i];
|
|
2378
|
-
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
2379
|
-
var p = path.join(pathPart, cmd);
|
|
2380
|
-
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
2381
|
-
p = cmd.slice(0, 2) + p;
|
|
2382
|
-
}
|
|
2383
|
-
for(var j = 0, ll = pathExt.length; j < ll; j++){
|
|
2384
|
-
var cur = p + pathExt[j];
|
|
2385
|
-
var is;
|
|
2386
|
-
try {
|
|
2387
|
-
is = isexe.sync(cur, {
|
|
2388
|
-
pathExt: pathExtExe
|
|
2389
|
-
});
|
|
2390
|
-
if (is) {
|
|
2391
|
-
if (opt.all) found.push(cur);
|
|
2392
|
-
else return cur;
|
|
2393
|
-
}
|
|
2394
|
-
} catch (ex) {}
|
|
609
|
+
if (err) {
|
|
610
|
+
return originalEmit.call(cp, 'error', err);
|
|
2395
611
|
}
|
|
2396
612
|
}
|
|
2397
|
-
if (opt.all && found.length) return found;
|
|
2398
|
-
if (opt.nothrow) return null;
|
|
2399
|
-
throw getNotFoundError(cmd);
|
|
2400
|
-
}
|
|
2401
|
-
return which_1;
|
|
2402
|
-
}
|
|
2403
613
|
|
|
2404
|
-
|
|
2405
|
-
var hasRequiredPathKey;
|
|
2406
|
-
function requirePathKey() {
|
|
2407
|
-
if (hasRequiredPathKey) return pathKey;
|
|
2408
|
-
hasRequiredPathKey = 1;
|
|
2409
|
-
pathKey = function(opts) {
|
|
2410
|
-
opts = opts || {};
|
|
2411
|
-
var env = opts.env || process.env;
|
|
2412
|
-
var platform = opts.platform || process.platform;
|
|
2413
|
-
if (platform !== 'win32') {
|
|
2414
|
-
return 'PATH';
|
|
2415
|
-
}
|
|
2416
|
-
return Object.keys(env).find(function(x) {
|
|
2417
|
-
return x.toUpperCase() === 'PATH';
|
|
2418
|
-
}) || 'Path';
|
|
614
|
+
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
|
2419
615
|
};
|
|
2420
|
-
return pathKey;
|
|
2421
616
|
}
|
|
2422
617
|
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
if (hasRequiredResolveCommand) return resolveCommand_1;
|
|
2427
|
-
hasRequiredResolveCommand = 1;
|
|
2428
|
-
var path = require$$0;
|
|
2429
|
-
var which = requireWhich();
|
|
2430
|
-
var pathKey = requirePathKey()();
|
|
2431
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
2432
|
-
var cwd = process.cwd();
|
|
2433
|
-
var hasCustomCwd = parsed.options.cwd != null;
|
|
2434
|
-
// If a custom `cwd` was specified, we need to change the process cwd
|
|
2435
|
-
// because `which` will do stat calls but does not support a custom cwd
|
|
2436
|
-
if (hasCustomCwd) {
|
|
2437
|
-
try {
|
|
2438
|
-
process.chdir(parsed.options.cwd);
|
|
2439
|
-
} catch (err) {
|
|
2440
|
-
/* Empty */ }
|
|
2441
|
-
}
|
|
2442
|
-
var resolved;
|
|
2443
|
-
try {
|
|
2444
|
-
resolved = which.sync(parsed.command, {
|
|
2445
|
-
path: (parsed.options.env || process.env)[pathKey],
|
|
2446
|
-
pathExt: withoutPathExt ? path.delimiter : undefined
|
|
2447
|
-
});
|
|
2448
|
-
} catch (e) {
|
|
2449
|
-
/* Empty */ } finally{
|
|
2450
|
-
process.chdir(cwd);
|
|
2451
|
-
}
|
|
2452
|
-
// If we successfully resolved, ensure that an absolute path is returned
|
|
2453
|
-
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
2454
|
-
if (resolved) {
|
|
2455
|
-
resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
2456
|
-
}
|
|
2457
|
-
return resolved;
|
|
618
|
+
function verifyENOENT(status, parsed) {
|
|
619
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
620
|
+
return notFoundError(parsed.original, 'spawn');
|
|
2458
621
|
}
|
|
2459
|
-
function resolveCommand(parsed) {
|
|
2460
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
2461
|
-
}
|
|
2462
|
-
resolveCommand_1 = resolveCommand;
|
|
2463
|
-
return resolveCommand_1;
|
|
2464
|
-
}
|
|
2465
622
|
|
|
2466
|
-
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
2467
625
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
hasRequired_escape = 1;
|
|
2472
|
-
// See http://www.robvanderwoude.com/escapechars.php
|
|
2473
|
-
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
2474
|
-
function escapeCommand(arg) {
|
|
2475
|
-
// Escape meta chars
|
|
2476
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
2477
|
-
return arg;
|
|
2478
|
-
}
|
|
2479
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
2480
|
-
// Convert to string
|
|
2481
|
-
arg = "".concat(arg);
|
|
2482
|
-
// Algorithm below is based on https://qntm.org/cmd
|
|
2483
|
-
// Sequence of backslashes followed by a double quote:
|
|
2484
|
-
// double up all the backslashes and escape the double quote
|
|
2485
|
-
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
2486
|
-
// Sequence of backslashes followed by the end of the string
|
|
2487
|
-
// (which will become a double quote later):
|
|
2488
|
-
// double up all the backslashes
|
|
2489
|
-
arg = arg.replace(/(\\*)$/, '$1$1');
|
|
2490
|
-
// All other backslashes occur literally
|
|
2491
|
-
// Quote the whole thing:
|
|
2492
|
-
arg = '"'.concat(arg, '"');
|
|
2493
|
-
// Escape meta chars
|
|
2494
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
2495
|
-
// Double escape meta chars if necessary
|
|
2496
|
-
if (doubleEscapeMetaChars) {
|
|
2497
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
2498
|
-
}
|
|
2499
|
-
return arg;
|
|
626
|
+
function verifyENOENTSync(status, parsed) {
|
|
627
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
628
|
+
return notFoundError(parsed.original, 'spawnSync');
|
|
2500
629
|
}
|
|
2501
|
-
_escape.command = escapeCommand;
|
|
2502
|
-
_escape.argument = escapeArgument;
|
|
2503
|
-
return _escape;
|
|
2504
|
-
}
|
|
2505
630
|
|
|
2506
|
-
|
|
2507
|
-
var hasRequiredShebangRegex;
|
|
2508
|
-
function requireShebangRegex() {
|
|
2509
|
-
if (hasRequiredShebangRegex) return shebangRegex;
|
|
2510
|
-
hasRequiredShebangRegex = 1;
|
|
2511
|
-
shebangRegex = /^#!.*/;
|
|
2512
|
-
return shebangRegex;
|
|
631
|
+
return null;
|
|
2513
632
|
}
|
|
2514
633
|
|
|
2515
|
-
var
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
return null;
|
|
2525
|
-
}
|
|
2526
|
-
var arr = match[0].replace(/#! ?/, '').split(' ');
|
|
2527
|
-
var bin = arr[0].split('/').pop();
|
|
2528
|
-
var arg = arr[1];
|
|
2529
|
-
return bin === 'env' ? arg : bin + (arg ? ' ' + arg : '');
|
|
2530
|
-
};
|
|
2531
|
-
return shebangCommand;
|
|
2532
|
-
}
|
|
634
|
+
var enoent$1 = {
|
|
635
|
+
hookChildProcess: hookChildProcess,
|
|
636
|
+
verifyENOENT: verifyENOENT,
|
|
637
|
+
verifyENOENTSync: verifyENOENTSync,
|
|
638
|
+
notFoundError: notFoundError
|
|
639
|
+
};
|
|
640
|
+
var cp = require$$0__default$2["default"];
|
|
641
|
+
var parse = parse_1;
|
|
642
|
+
var enoent = enoent$1;
|
|
2533
643
|
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
if (hasRequiredReadShebang) return readShebang_1;
|
|
2538
|
-
hasRequiredReadShebang = 1;
|
|
2539
|
-
var fs = require$$0$1;
|
|
2540
|
-
var shebangCommand = requireShebangCommand();
|
|
2541
|
-
function readShebang(command) {
|
|
2542
|
-
// Read the first 150 bytes from the file
|
|
2543
|
-
var size = 150;
|
|
2544
|
-
var buffer;
|
|
2545
|
-
if (Buffer.alloc) {
|
|
2546
|
-
// Node.js v4.5+ / v5.10+
|
|
2547
|
-
buffer = Buffer.alloc(size);
|
|
2548
|
-
} else {
|
|
2549
|
-
// Old Node.js API
|
|
2550
|
-
buffer = new Buffer(size);
|
|
2551
|
-
buffer.fill(0); // zero-fill
|
|
2552
|
-
}
|
|
2553
|
-
var fd;
|
|
2554
|
-
try {
|
|
2555
|
-
fd = fs.openSync(command, 'r');
|
|
2556
|
-
fs.readSync(fd, buffer, 0, size, 0);
|
|
2557
|
-
fs.closeSync(fd);
|
|
2558
|
-
} catch (e) {}
|
|
2559
|
-
// Attempt to extract shebang (null is returned if not a shebang)
|
|
2560
|
-
return shebangCommand(buffer.toString());
|
|
2561
|
-
}
|
|
2562
|
-
readShebang_1 = readShebang;
|
|
2563
|
-
return readShebang_1;
|
|
2564
|
-
}
|
|
644
|
+
function spawn(command, args, options) {
|
|
645
|
+
// Parse the arguments
|
|
646
|
+
var parsed = parse(command, args, options); // Spawn the child process
|
|
2565
647
|
|
|
2566
|
-
var
|
|
2567
|
-
|
|
2568
|
-
};
|
|
648
|
+
var spawned = cp.spawn(parsed.command, parsed.args, parsed.options); // Hook into child process "exit" event to emit an error if the command
|
|
649
|
+
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
2569
650
|
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
return !!right[Symbol.hasInstance](left);
|
|
2573
|
-
} else {
|
|
2574
|
-
return left instanceof right;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
function _type_of(obj) {
|
|
2578
|
-
"@swc/helpers - typeof";
|
|
2579
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2580
|
-
}
|
|
2581
|
-
var hasRequiredSemver;
|
|
2582
|
-
function requireSemver() {
|
|
2583
|
-
if (hasRequiredSemver) return semver.exports;
|
|
2584
|
-
hasRequiredSemver = 1;
|
|
2585
|
-
(function(module, exports) {
|
|
2586
|
-
exports = module.exports = SemVer;
|
|
2587
|
-
var debug;
|
|
2588
|
-
/* 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)) {
|
|
2589
|
-
debug = function debug() {
|
|
2590
|
-
var args = Array.prototype.slice.call(arguments, 0);
|
|
2591
|
-
args.unshift('SEMVER');
|
|
2592
|
-
console.log.apply(console, args);
|
|
2593
|
-
};
|
|
2594
|
-
} else {
|
|
2595
|
-
debug = function debug() {};
|
|
2596
|
-
}
|
|
2597
|
-
// Note: this is the semver.org version of the spec that it implements
|
|
2598
|
-
// Not necessarily the package version of this code.
|
|
2599
|
-
exports.SEMVER_SPEC_VERSION = '2.0.0';
|
|
2600
|
-
var MAX_LENGTH = 256;
|
|
2601
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ 9007199254740991;
|
|
2602
|
-
// Max safe segment length for coercion.
|
|
2603
|
-
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
2604
|
-
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
2605
|
-
// The actual regexps go on exports.re
|
|
2606
|
-
var re = exports.re = [];
|
|
2607
|
-
var safeRe = exports.safeRe = [];
|
|
2608
|
-
var src = exports.src = [];
|
|
2609
|
-
var R = 0;
|
|
2610
|
-
var LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
2611
|
-
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
2612
|
-
// used internally via the safeRe object since all inputs in this library get
|
|
2613
|
-
// normalized first to trim and collapse all extra whitespace. The original
|
|
2614
|
-
// regexes are exported for userland consumption and lower level usage. A
|
|
2615
|
-
// future breaking change could export the safer regex only with a note that
|
|
2616
|
-
// all input should have extra whitespace removed.
|
|
2617
|
-
var safeRegexReplacements = [
|
|
2618
|
-
[
|
|
2619
|
-
'\\s',
|
|
2620
|
-
1
|
|
2621
|
-
],
|
|
2622
|
-
[
|
|
2623
|
-
'\\d',
|
|
2624
|
-
MAX_LENGTH
|
|
2625
|
-
],
|
|
2626
|
-
[
|
|
2627
|
-
LETTERDASHNUMBER,
|
|
2628
|
-
MAX_SAFE_BUILD_LENGTH
|
|
2629
|
-
]
|
|
2630
|
-
];
|
|
2631
|
-
function makeSafeRe(value) {
|
|
2632
|
-
for(var i = 0; i < safeRegexReplacements.length; i++){
|
|
2633
|
-
var token = safeRegexReplacements[i][0];
|
|
2634
|
-
var max = safeRegexReplacements[i][1];
|
|
2635
|
-
value = value.split(token + '*').join(token + '{0,' + max + '}').split(token + '+').join(token + '{1,' + max + '}');
|
|
2636
|
-
}
|
|
2637
|
-
return value;
|
|
2638
|
-
}
|
|
2639
|
-
// The following Regular Expressions can be used for tokenizing,
|
|
2640
|
-
// validating, and parsing SemVer version strings.
|
|
2641
|
-
// ## Numeric Identifier
|
|
2642
|
-
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
2643
|
-
var NUMERICIDENTIFIER = R++;
|
|
2644
|
-
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
|
2645
|
-
var NUMERICIDENTIFIERLOOSE = R++;
|
|
2646
|
-
src[NUMERICIDENTIFIERLOOSE] = '\\d+';
|
|
2647
|
-
// ## Non-numeric Identifier
|
|
2648
|
-
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
2649
|
-
// more letters, digits, or hyphens.
|
|
2650
|
-
var NONNUMERICIDENTIFIER = R++;
|
|
2651
|
-
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*';
|
|
2652
|
-
// ## Main Version
|
|
2653
|
-
// Three dot-separated numeric identifiers.
|
|
2654
|
-
var MAINVERSION = R++;
|
|
2655
|
-
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')';
|
|
2656
|
-
var MAINVERSIONLOOSE = R++;
|
|
2657
|
-
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
|
|
2658
|
-
// ## Pre-release Version Identifier
|
|
2659
|
-
// A numeric identifier, or a non-numeric identifier.
|
|
2660
|
-
var PRERELEASEIDENTIFIER = R++;
|
|
2661
|
-
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + '|' + src[NONNUMERICIDENTIFIER] + ')';
|
|
2662
|
-
var PRERELEASEIDENTIFIERLOOSE = R++;
|
|
2663
|
-
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + '|' + src[NONNUMERICIDENTIFIER] + ')';
|
|
2664
|
-
// ## Pre-release Version
|
|
2665
|
-
// Hyphen, followed by one or more dot-separated pre-release version
|
|
2666
|
-
// identifiers.
|
|
2667
|
-
var PRERELEASE = R++;
|
|
2668
|
-
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
|
|
2669
|
-
var PRERELEASELOOSE = R++;
|
|
2670
|
-
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
|
2671
|
-
// ## Build Metadata Identifier
|
|
2672
|
-
// Any combination of digits, letters, or hyphens.
|
|
2673
|
-
var BUILDIDENTIFIER = R++;
|
|
2674
|
-
src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+';
|
|
2675
|
-
// ## Build Metadata
|
|
2676
|
-
// Plus sign, followed by one or more period-separated build metadata
|
|
2677
|
-
// identifiers.
|
|
2678
|
-
var BUILD = R++;
|
|
2679
|
-
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
|
|
2680
|
-
// ## Full Version String
|
|
2681
|
-
// A main version, followed optionally by a pre-release version and
|
|
2682
|
-
// build metadata.
|
|
2683
|
-
// Note that the only major, minor, patch, and pre-release sections of
|
|
2684
|
-
// the version string are capturing groups. The build metadata is not a
|
|
2685
|
-
// capturing group, because it should not ever be used in version
|
|
2686
|
-
// comparison.
|
|
2687
|
-
var FULL = R++;
|
|
2688
|
-
var FULLPLAIN = 'v?' + src[MAINVERSION] + src[PRERELEASE] + '?' + src[BUILD] + '?';
|
|
2689
|
-
src[FULL] = '^' + FULLPLAIN + '$';
|
|
2690
|
-
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
2691
|
-
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
2692
|
-
// common in the npm registry.
|
|
2693
|
-
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + '?' + src[BUILD] + '?';
|
|
2694
|
-
var LOOSE = R++;
|
|
2695
|
-
src[LOOSE] = '^' + LOOSEPLAIN + '$';
|
|
2696
|
-
var GTLT = R++;
|
|
2697
|
-
src[GTLT] = '((?:<|>)?=?)';
|
|
2698
|
-
// Something like "2.*" or "1.2.x".
|
|
2699
|
-
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
2700
|
-
// Only the first item is strictly required.
|
|
2701
|
-
var XRANGEIDENTIFIERLOOSE = R++;
|
|
2702
|
-
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
|
2703
|
-
var XRANGEIDENTIFIER = R++;
|
|
2704
|
-
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
|
|
2705
|
-
var XRANGEPLAIN = R++;
|
|
2706
|
-
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:' + src[PRERELEASE] + ')?' + src[BUILD] + '?' + ')?)?';
|
|
2707
|
-
var XRANGEPLAINLOOSE = R++;
|
|
2708
|
-
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[PRERELEASELOOSE] + ')?' + src[BUILD] + '?' + ')?)?';
|
|
2709
|
-
var XRANGE = R++;
|
|
2710
|
-
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
|
|
2711
|
-
var XRANGELOOSE = R++;
|
|
2712
|
-
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
|
|
2713
|
-
// Coercion.
|
|
2714
|
-
// Extract anything that could conceivably be a part of a valid semver
|
|
2715
|
-
var COERCE = R++;
|
|
2716
|
-
src[COERCE] = '(?:^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
|
|
2717
|
-
// Tilde ranges.
|
|
2718
|
-
// Meaning is "reasonably at or greater than"
|
|
2719
|
-
var LONETILDE = R++;
|
|
2720
|
-
src[LONETILDE] = '(?:~>?)';
|
|
2721
|
-
var TILDETRIM = R++;
|
|
2722
|
-
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
|
|
2723
|
-
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
|
|
2724
|
-
safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g');
|
|
2725
|
-
var tildeTrimReplace = '$1~';
|
|
2726
|
-
var TILDE = R++;
|
|
2727
|
-
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
|
|
2728
|
-
var TILDELOOSE = R++;
|
|
2729
|
-
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
|
|
2730
|
-
// Caret ranges.
|
|
2731
|
-
// Meaning is "at least and backwards compatible with"
|
|
2732
|
-
var LONECARET = R++;
|
|
2733
|
-
src[LONECARET] = '(?:\\^)';
|
|
2734
|
-
var CARETTRIM = R++;
|
|
2735
|
-
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
|
|
2736
|
-
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
|
|
2737
|
-
safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g');
|
|
2738
|
-
var caretTrimReplace = '$1^';
|
|
2739
|
-
var CARET = R++;
|
|
2740
|
-
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
|
|
2741
|
-
var CARETLOOSE = R++;
|
|
2742
|
-
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
|
|
2743
|
-
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
2744
|
-
var COMPARATORLOOSE = R++;
|
|
2745
|
-
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
|
|
2746
|
-
var COMPARATOR = R++;
|
|
2747
|
-
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
|
|
2748
|
-
// An expression to strip any whitespace between the gtlt and the thing
|
|
2749
|
-
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
2750
|
-
var COMPARATORTRIM = R++;
|
|
2751
|
-
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
|
|
2752
|
-
// this one has to use the /g flag
|
|
2753
|
-
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
|
|
2754
|
-
safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g');
|
|
2755
|
-
var comparatorTrimReplace = '$1$2$3';
|
|
2756
|
-
// Something like `1.2.3 - 1.2.4`
|
|
2757
|
-
// Note that these all use the loose form, because they'll be
|
|
2758
|
-
// checked against either the strict or loose comparator form
|
|
2759
|
-
// later.
|
|
2760
|
-
var HYPHENRANGE = R++;
|
|
2761
|
-
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAIN] + ')' + '\\s*$';
|
|
2762
|
-
var HYPHENRANGELOOSE = R++;
|
|
2763
|
-
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAINLOOSE] + ')' + '\\s*$';
|
|
2764
|
-
// Star ranges basically just allow anything at all.
|
|
2765
|
-
var STAR = R++;
|
|
2766
|
-
src[STAR] = '(<|>)?=?\\s*\\*';
|
|
2767
|
-
// Compile to actual regexp objects.
|
|
2768
|
-
// All are flag-free, unless they were created above with a flag.
|
|
2769
|
-
for(var i = 0; i < R; i++){
|
|
2770
|
-
debug(i, src[i]);
|
|
2771
|
-
if (!re[i]) {
|
|
2772
|
-
re[i] = new RegExp(src[i]);
|
|
2773
|
-
// Replace all greedy whitespace to prevent regex dos issues. These regex are
|
|
2774
|
-
// used internally via the safeRe object since all inputs in this library get
|
|
2775
|
-
// normalized first to trim and collapse all extra whitespace. The original
|
|
2776
|
-
// regexes are exported for userland consumption and lower level usage. A
|
|
2777
|
-
// future breaking change could export the safer regex only with a note that
|
|
2778
|
-
// all input should have extra whitespace removed.
|
|
2779
|
-
safeRe[i] = new RegExp(makeSafeRe(src[i]));
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
exports.parse = parse;
|
|
2783
|
-
function parse(version, options) {
|
|
2784
|
-
if (!options || (typeof options === "undefined" ? "undefined" : _type_of(options)) !== 'object') {
|
|
2785
|
-
options = {
|
|
2786
|
-
loose: !!options,
|
|
2787
|
-
includePrerelease: false
|
|
2788
|
-
};
|
|
2789
|
-
}
|
|
2790
|
-
if (_instanceof(version, SemVer)) {
|
|
2791
|
-
return version;
|
|
2792
|
-
}
|
|
2793
|
-
if (typeof version !== 'string') {
|
|
2794
|
-
return null;
|
|
2795
|
-
}
|
|
2796
|
-
if (version.length > MAX_LENGTH) {
|
|
2797
|
-
return null;
|
|
2798
|
-
}
|
|
2799
|
-
var r = options.loose ? safeRe[LOOSE] : safeRe[FULL];
|
|
2800
|
-
if (!r.test(version)) {
|
|
2801
|
-
return null;
|
|
2802
|
-
}
|
|
2803
|
-
try {
|
|
2804
|
-
return new SemVer(version, options);
|
|
2805
|
-
} catch (er) {
|
|
2806
|
-
return null;
|
|
2807
|
-
}
|
|
2808
|
-
}
|
|
2809
|
-
exports.valid = valid;
|
|
2810
|
-
function valid(version, options) {
|
|
2811
|
-
var v = parse(version, options);
|
|
2812
|
-
return v ? v.version : null;
|
|
2813
|
-
}
|
|
2814
|
-
exports.clean = clean;
|
|
2815
|
-
function clean(version, options) {
|
|
2816
|
-
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
|
2817
|
-
return s ? s.version : null;
|
|
2818
|
-
}
|
|
2819
|
-
exports.SemVer = SemVer;
|
|
2820
|
-
function SemVer(version, options) {
|
|
2821
|
-
if (!options || (typeof options === "undefined" ? "undefined" : _type_of(options)) !== 'object') {
|
|
2822
|
-
options = {
|
|
2823
|
-
loose: !!options,
|
|
2824
|
-
includePrerelease: false
|
|
2825
|
-
};
|
|
2826
|
-
}
|
|
2827
|
-
if (_instanceof(version, SemVer)) {
|
|
2828
|
-
if (version.loose === options.loose) {
|
|
2829
|
-
return version;
|
|
2830
|
-
} else {
|
|
2831
|
-
version = version.version;
|
|
2832
|
-
}
|
|
2833
|
-
} else if (typeof version !== 'string') {
|
|
2834
|
-
throw new TypeError('Invalid Version: ' + version);
|
|
2835
|
-
}
|
|
2836
|
-
if (version.length > MAX_LENGTH) {
|
|
2837
|
-
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
|
|
2838
|
-
}
|
|
2839
|
-
if (!_instanceof(this, SemVer)) {
|
|
2840
|
-
return new SemVer(version, options);
|
|
2841
|
-
}
|
|
2842
|
-
debug('SemVer', version, options);
|
|
2843
|
-
this.options = options;
|
|
2844
|
-
this.loose = !!options.loose;
|
|
2845
|
-
var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]);
|
|
2846
|
-
if (!m) {
|
|
2847
|
-
throw new TypeError('Invalid Version: ' + version);
|
|
2848
|
-
}
|
|
2849
|
-
this.raw = version;
|
|
2850
|
-
// these are actually numbers
|
|
2851
|
-
this.major = +m[1];
|
|
2852
|
-
this.minor = +m[2];
|
|
2853
|
-
this.patch = +m[3];
|
|
2854
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
2855
|
-
throw new TypeError('Invalid major version');
|
|
2856
|
-
}
|
|
2857
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
2858
|
-
throw new TypeError('Invalid minor version');
|
|
2859
|
-
}
|
|
2860
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
2861
|
-
throw new TypeError('Invalid patch version');
|
|
2862
|
-
}
|
|
2863
|
-
// numberify any prerelease numeric ids
|
|
2864
|
-
if (!m[4]) {
|
|
2865
|
-
this.prerelease = [];
|
|
2866
|
-
} else {
|
|
2867
|
-
this.prerelease = m[4].split('.').map(function(id) {
|
|
2868
|
-
if (/^[0-9]+$/.test(id)) {
|
|
2869
|
-
var num = +id;
|
|
2870
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
2871
|
-
return num;
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
return id;
|
|
2875
|
-
});
|
|
2876
|
-
}
|
|
2877
|
-
this.build = m[5] ? m[5].split('.') : [];
|
|
2878
|
-
this.format();
|
|
2879
|
-
}
|
|
2880
|
-
SemVer.prototype.format = function() {
|
|
2881
|
-
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
2882
|
-
if (this.prerelease.length) {
|
|
2883
|
-
this.version += '-' + this.prerelease.join('.');
|
|
2884
|
-
}
|
|
2885
|
-
return this.version;
|
|
2886
|
-
};
|
|
2887
|
-
SemVer.prototype.toString = function() {
|
|
2888
|
-
return this.version;
|
|
2889
|
-
};
|
|
2890
|
-
SemVer.prototype.compare = function(other) {
|
|
2891
|
-
debug('SemVer.compare', this.version, this.options, other);
|
|
2892
|
-
if (!_instanceof(other, SemVer)) {
|
|
2893
|
-
other = new SemVer(other, this.options);
|
|
2894
|
-
}
|
|
2895
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
2896
|
-
};
|
|
2897
|
-
SemVer.prototype.compareMain = function(other) {
|
|
2898
|
-
if (!_instanceof(other, SemVer)) {
|
|
2899
|
-
other = new SemVer(other, this.options);
|
|
2900
|
-
}
|
|
2901
|
-
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
2902
|
-
};
|
|
2903
|
-
SemVer.prototype.comparePre = function(other) {
|
|
2904
|
-
if (!_instanceof(other, SemVer)) {
|
|
2905
|
-
other = new SemVer(other, this.options);
|
|
2906
|
-
}
|
|
2907
|
-
// NOT having a prerelease is > having one
|
|
2908
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
2909
|
-
return -1;
|
|
2910
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
2911
|
-
return 1;
|
|
2912
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
2913
|
-
return 0;
|
|
2914
|
-
}
|
|
2915
|
-
var i = 0;
|
|
2916
|
-
do {
|
|
2917
|
-
var a = this.prerelease[i];
|
|
2918
|
-
var b = other.prerelease[i];
|
|
2919
|
-
debug('prerelease compare', i, a, b);
|
|
2920
|
-
if (a === undefined && b === undefined) {
|
|
2921
|
-
return 0;
|
|
2922
|
-
} else if (b === undefined) {
|
|
2923
|
-
return 1;
|
|
2924
|
-
} else if (a === undefined) {
|
|
2925
|
-
return -1;
|
|
2926
|
-
} else if (a === b) {
|
|
2927
|
-
continue;
|
|
2928
|
-
} else {
|
|
2929
|
-
return compareIdentifiers(a, b);
|
|
2930
|
-
}
|
|
2931
|
-
}while (++i);
|
|
2932
|
-
};
|
|
2933
|
-
// preminor will bump the version up to the next minor release, and immediately
|
|
2934
|
-
// down to pre-release. premajor and prepatch work the same way.
|
|
2935
|
-
SemVer.prototype.inc = function(release, identifier) {
|
|
2936
|
-
switch(release){
|
|
2937
|
-
case 'premajor':
|
|
2938
|
-
this.prerelease.length = 0;
|
|
2939
|
-
this.patch = 0;
|
|
2940
|
-
this.minor = 0;
|
|
2941
|
-
this.major++;
|
|
2942
|
-
this.inc('pre', identifier);
|
|
2943
|
-
break;
|
|
2944
|
-
case 'preminor':
|
|
2945
|
-
this.prerelease.length = 0;
|
|
2946
|
-
this.patch = 0;
|
|
2947
|
-
this.minor++;
|
|
2948
|
-
this.inc('pre', identifier);
|
|
2949
|
-
break;
|
|
2950
|
-
case 'prepatch':
|
|
2951
|
-
// If this is already a prerelease, it will bump to the next version
|
|
2952
|
-
// drop any prereleases that might already exist, since they are not
|
|
2953
|
-
// relevant at this point.
|
|
2954
|
-
this.prerelease.length = 0;
|
|
2955
|
-
this.inc('patch', identifier);
|
|
2956
|
-
this.inc('pre', identifier);
|
|
2957
|
-
break;
|
|
2958
|
-
// If the input is a non-prerelease version, this acts the same as
|
|
2959
|
-
// prepatch.
|
|
2960
|
-
case 'prerelease':
|
|
2961
|
-
if (this.prerelease.length === 0) {
|
|
2962
|
-
this.inc('patch', identifier);
|
|
2963
|
-
}
|
|
2964
|
-
this.inc('pre', identifier);
|
|
2965
|
-
break;
|
|
2966
|
-
case 'major':
|
|
2967
|
-
// If this is a pre-major version, bump up to the same major version.
|
|
2968
|
-
// Otherwise increment major.
|
|
2969
|
-
// 1.0.0-5 bumps to 1.0.0
|
|
2970
|
-
// 1.1.0 bumps to 2.0.0
|
|
2971
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
2972
|
-
this.major++;
|
|
2973
|
-
}
|
|
2974
|
-
this.minor = 0;
|
|
2975
|
-
this.patch = 0;
|
|
2976
|
-
this.prerelease = [];
|
|
2977
|
-
break;
|
|
2978
|
-
case 'minor':
|
|
2979
|
-
// If this is a pre-minor version, bump up to the same minor version.
|
|
2980
|
-
// Otherwise increment minor.
|
|
2981
|
-
// 1.2.0-5 bumps to 1.2.0
|
|
2982
|
-
// 1.2.1 bumps to 1.3.0
|
|
2983
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
2984
|
-
this.minor++;
|
|
2985
|
-
}
|
|
2986
|
-
this.patch = 0;
|
|
2987
|
-
this.prerelease = [];
|
|
2988
|
-
break;
|
|
2989
|
-
case 'patch':
|
|
2990
|
-
// If this is not a pre-release version, it will increment the patch.
|
|
2991
|
-
// If it is a pre-release it will bump up to the same patch version.
|
|
2992
|
-
// 1.2.0-5 patches to 1.2.0
|
|
2993
|
-
// 1.2.0 patches to 1.2.1
|
|
2994
|
-
if (this.prerelease.length === 0) {
|
|
2995
|
-
this.patch++;
|
|
2996
|
-
}
|
|
2997
|
-
this.prerelease = [];
|
|
2998
|
-
break;
|
|
2999
|
-
// This probably shouldn't be used publicly.
|
|
3000
|
-
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
3001
|
-
case 'pre':
|
|
3002
|
-
if (this.prerelease.length === 0) {
|
|
3003
|
-
this.prerelease = [
|
|
3004
|
-
0
|
|
3005
|
-
];
|
|
3006
|
-
} else {
|
|
3007
|
-
var i = this.prerelease.length;
|
|
3008
|
-
while(--i >= 0){
|
|
3009
|
-
if (typeof this.prerelease[i] === 'number') {
|
|
3010
|
-
this.prerelease[i]++;
|
|
3011
|
-
i = -2;
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
if (i === -1) {
|
|
3015
|
-
// didn't increment anything
|
|
3016
|
-
this.prerelease.push(0);
|
|
3017
|
-
}
|
|
3018
|
-
}
|
|
3019
|
-
if (identifier) {
|
|
3020
|
-
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
3021
|
-
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
3022
|
-
if (this.prerelease[0] === identifier) {
|
|
3023
|
-
if (isNaN(this.prerelease[1])) {
|
|
3024
|
-
this.prerelease = [
|
|
3025
|
-
identifier,
|
|
3026
|
-
0
|
|
3027
|
-
];
|
|
3028
|
-
}
|
|
3029
|
-
} else {
|
|
3030
|
-
this.prerelease = [
|
|
3031
|
-
identifier,
|
|
3032
|
-
0
|
|
3033
|
-
];
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
break;
|
|
3037
|
-
default:
|
|
3038
|
-
throw new Error('invalid increment argument: ' + release);
|
|
3039
|
-
}
|
|
3040
|
-
this.format();
|
|
3041
|
-
this.raw = this.version;
|
|
3042
|
-
return this;
|
|
3043
|
-
};
|
|
3044
|
-
exports.inc = inc;
|
|
3045
|
-
function inc(version, release, loose, identifier) {
|
|
3046
|
-
if (typeof loose === 'string') {
|
|
3047
|
-
identifier = loose;
|
|
3048
|
-
loose = undefined;
|
|
3049
|
-
}
|
|
3050
|
-
try {
|
|
3051
|
-
return new SemVer(version, loose).inc(release, identifier).version;
|
|
3052
|
-
} catch (er) {
|
|
3053
|
-
return null;
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
exports.diff = diff;
|
|
3057
|
-
function diff(version1, version2) {
|
|
3058
|
-
if (eq(version1, version2)) {
|
|
3059
|
-
return null;
|
|
3060
|
-
} else {
|
|
3061
|
-
var v1 = parse(version1);
|
|
3062
|
-
var v2 = parse(version2);
|
|
3063
|
-
var prefix = '';
|
|
3064
|
-
if (v1.prerelease.length || v2.prerelease.length) {
|
|
3065
|
-
prefix = 'pre';
|
|
3066
|
-
var defaultResult = 'prerelease';
|
|
3067
|
-
}
|
|
3068
|
-
for(var key in v1){
|
|
3069
|
-
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
3070
|
-
if (v1[key] !== v2[key]) {
|
|
3071
|
-
return prefix + key;
|
|
3072
|
-
}
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
return defaultResult // may be undefined
|
|
3076
|
-
;
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
exports.compareIdentifiers = compareIdentifiers;
|
|
3080
|
-
var numeric = /^[0-9]+$/;
|
|
3081
|
-
function compareIdentifiers(a, b) {
|
|
3082
|
-
var anum = numeric.test(a);
|
|
3083
|
-
var bnum = numeric.test(b);
|
|
3084
|
-
if (anum && bnum) {
|
|
3085
|
-
a = +a;
|
|
3086
|
-
b = +b;
|
|
3087
|
-
}
|
|
3088
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
3089
|
-
}
|
|
3090
|
-
exports.rcompareIdentifiers = rcompareIdentifiers;
|
|
3091
|
-
function rcompareIdentifiers(a, b) {
|
|
3092
|
-
return compareIdentifiers(b, a);
|
|
3093
|
-
}
|
|
3094
|
-
exports.major = major;
|
|
3095
|
-
function major(a, loose) {
|
|
3096
|
-
return new SemVer(a, loose).major;
|
|
3097
|
-
}
|
|
3098
|
-
exports.minor = minor;
|
|
3099
|
-
function minor(a, loose) {
|
|
3100
|
-
return new SemVer(a, loose).minor;
|
|
3101
|
-
}
|
|
3102
|
-
exports.patch = patch;
|
|
3103
|
-
function patch(a, loose) {
|
|
3104
|
-
return new SemVer(a, loose).patch;
|
|
3105
|
-
}
|
|
3106
|
-
exports.compare = compare;
|
|
3107
|
-
function compare(a, b, loose) {
|
|
3108
|
-
return new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
3109
|
-
}
|
|
3110
|
-
exports.compareLoose = compareLoose;
|
|
3111
|
-
function compareLoose(a, b) {
|
|
3112
|
-
return compare(a, b, true);
|
|
3113
|
-
}
|
|
3114
|
-
exports.rcompare = rcompare;
|
|
3115
|
-
function rcompare(a, b, loose) {
|
|
3116
|
-
return compare(b, a, loose);
|
|
3117
|
-
}
|
|
3118
|
-
exports.sort = sort;
|
|
3119
|
-
function sort(list, loose) {
|
|
3120
|
-
return list.sort(function(a, b) {
|
|
3121
|
-
return exports.compare(a, b, loose);
|
|
3122
|
-
});
|
|
3123
|
-
}
|
|
3124
|
-
exports.rsort = rsort;
|
|
3125
|
-
function rsort(list, loose) {
|
|
3126
|
-
return list.sort(function(a, b) {
|
|
3127
|
-
return exports.rcompare(a, b, loose);
|
|
3128
|
-
});
|
|
3129
|
-
}
|
|
3130
|
-
exports.gt = gt;
|
|
3131
|
-
function gt(a, b, loose) {
|
|
3132
|
-
return compare(a, b, loose) > 0;
|
|
3133
|
-
}
|
|
3134
|
-
exports.lt = lt;
|
|
3135
|
-
function lt(a, b, loose) {
|
|
3136
|
-
return compare(a, b, loose) < 0;
|
|
3137
|
-
}
|
|
3138
|
-
exports.eq = eq;
|
|
3139
|
-
function eq(a, b, loose) {
|
|
3140
|
-
return compare(a, b, loose) === 0;
|
|
3141
|
-
}
|
|
3142
|
-
exports.neq = neq;
|
|
3143
|
-
function neq(a, b, loose) {
|
|
3144
|
-
return compare(a, b, loose) !== 0;
|
|
3145
|
-
}
|
|
3146
|
-
exports.gte = gte;
|
|
3147
|
-
function gte(a, b, loose) {
|
|
3148
|
-
return compare(a, b, loose) >= 0;
|
|
3149
|
-
}
|
|
3150
|
-
exports.lte = lte;
|
|
3151
|
-
function lte(a, b, loose) {
|
|
3152
|
-
return compare(a, b, loose) <= 0;
|
|
3153
|
-
}
|
|
3154
|
-
exports.cmp = cmp;
|
|
3155
|
-
function cmp(a, op, b, loose) {
|
|
3156
|
-
switch(op){
|
|
3157
|
-
case '===':
|
|
3158
|
-
if ((typeof a === "undefined" ? "undefined" : _type_of(a)) === 'object') a = a.version;
|
|
3159
|
-
if ((typeof b === "undefined" ? "undefined" : _type_of(b)) === 'object') b = b.version;
|
|
3160
|
-
return a === b;
|
|
3161
|
-
case '!==':
|
|
3162
|
-
if ((typeof a === "undefined" ? "undefined" : _type_of(a)) === 'object') a = a.version;
|
|
3163
|
-
if ((typeof b === "undefined" ? "undefined" : _type_of(b)) === 'object') b = b.version;
|
|
3164
|
-
return a !== b;
|
|
3165
|
-
case '':
|
|
3166
|
-
case '=':
|
|
3167
|
-
case '==':
|
|
3168
|
-
return eq(a, b, loose);
|
|
3169
|
-
case '!=':
|
|
3170
|
-
return neq(a, b, loose);
|
|
3171
|
-
case '>':
|
|
3172
|
-
return gt(a, b, loose);
|
|
3173
|
-
case '>=':
|
|
3174
|
-
return gte(a, b, loose);
|
|
3175
|
-
case '<':
|
|
3176
|
-
return lt(a, b, loose);
|
|
3177
|
-
case '<=':
|
|
3178
|
-
return lte(a, b, loose);
|
|
3179
|
-
default:
|
|
3180
|
-
throw new TypeError('Invalid operator: ' + op);
|
|
3181
|
-
}
|
|
3182
|
-
}
|
|
3183
|
-
exports.Comparator = Comparator;
|
|
3184
|
-
function Comparator(comp, options) {
|
|
3185
|
-
if (!options || (typeof options === "undefined" ? "undefined" : _type_of(options)) !== 'object') {
|
|
3186
|
-
options = {
|
|
3187
|
-
loose: !!options,
|
|
3188
|
-
includePrerelease: false
|
|
3189
|
-
};
|
|
3190
|
-
}
|
|
3191
|
-
if (_instanceof(comp, Comparator)) {
|
|
3192
|
-
if (comp.loose === !!options.loose) {
|
|
3193
|
-
return comp;
|
|
3194
|
-
} else {
|
|
3195
|
-
comp = comp.value;
|
|
3196
|
-
}
|
|
3197
|
-
}
|
|
3198
|
-
if (!_instanceof(this, Comparator)) {
|
|
3199
|
-
return new Comparator(comp, options);
|
|
3200
|
-
}
|
|
3201
|
-
comp = comp.trim().split(/\s+/).join(' ');
|
|
3202
|
-
debug('comparator', comp, options);
|
|
3203
|
-
this.options = options;
|
|
3204
|
-
this.loose = !!options.loose;
|
|
3205
|
-
this.parse(comp);
|
|
3206
|
-
if (this.semver === ANY) {
|
|
3207
|
-
this.value = '';
|
|
3208
|
-
} else {
|
|
3209
|
-
this.value = this.operator + this.semver.version;
|
|
3210
|
-
}
|
|
3211
|
-
debug('comp', this);
|
|
3212
|
-
}
|
|
3213
|
-
var ANY = {};
|
|
3214
|
-
Comparator.prototype.parse = function(comp) {
|
|
3215
|
-
var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
|
|
3216
|
-
var m = comp.match(r);
|
|
3217
|
-
if (!m) {
|
|
3218
|
-
throw new TypeError('Invalid comparator: ' + comp);
|
|
3219
|
-
}
|
|
3220
|
-
this.operator = m[1];
|
|
3221
|
-
if (this.operator === '=') {
|
|
3222
|
-
this.operator = '';
|
|
3223
|
-
}
|
|
3224
|
-
// if it literally is just '>' or '' then allow anything.
|
|
3225
|
-
if (!m[2]) {
|
|
3226
|
-
this.semver = ANY;
|
|
3227
|
-
} else {
|
|
3228
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
3229
|
-
}
|
|
3230
|
-
};
|
|
3231
|
-
Comparator.prototype.toString = function() {
|
|
3232
|
-
return this.value;
|
|
3233
|
-
};
|
|
3234
|
-
Comparator.prototype.test = function(version) {
|
|
3235
|
-
debug('Comparator.test', version, this.options.loose);
|
|
3236
|
-
if (this.semver === ANY) {
|
|
3237
|
-
return true;
|
|
3238
|
-
}
|
|
3239
|
-
if (typeof version === 'string') {
|
|
3240
|
-
version = new SemVer(version, this.options);
|
|
3241
|
-
}
|
|
3242
|
-
return cmp(version, this.operator, this.semver, this.options);
|
|
3243
|
-
};
|
|
3244
|
-
Comparator.prototype.intersects = function(comp, options) {
|
|
3245
|
-
if (!_instanceof(comp, Comparator)) {
|
|
3246
|
-
throw new TypeError('a Comparator is required');
|
|
3247
|
-
}
|
|
3248
|
-
if (!options || (typeof options === "undefined" ? "undefined" : _type_of(options)) !== 'object') {
|
|
3249
|
-
options = {
|
|
3250
|
-
loose: !!options,
|
|
3251
|
-
includePrerelease: false
|
|
3252
|
-
};
|
|
3253
|
-
}
|
|
3254
|
-
var rangeTmp;
|
|
3255
|
-
if (this.operator === '') {
|
|
3256
|
-
rangeTmp = new Range(comp.value, options);
|
|
3257
|
-
return satisfies(this.value, rangeTmp, options);
|
|
3258
|
-
} else if (comp.operator === '') {
|
|
3259
|
-
rangeTmp = new Range(this.value, options);
|
|
3260
|
-
return satisfies(comp.semver, rangeTmp, options);
|
|
3261
|
-
}
|
|
3262
|
-
var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
|
|
3263
|
-
var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
|
|
3264
|
-
var sameSemVer = this.semver.version === comp.semver.version;
|
|
3265
|
-
var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
|
|
3266
|
-
var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
|
|
3267
|
-
var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
|
|
3268
|
-
return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
|
|
3269
|
-
};
|
|
3270
|
-
exports.Range = Range;
|
|
3271
|
-
function Range(range, options) {
|
|
3272
|
-
if (!options || (typeof options === "undefined" ? "undefined" : _type_of(options)) !== 'object') {
|
|
3273
|
-
options = {
|
|
3274
|
-
loose: !!options,
|
|
3275
|
-
includePrerelease: false
|
|
3276
|
-
};
|
|
3277
|
-
}
|
|
3278
|
-
if (_instanceof(range, Range)) {
|
|
3279
|
-
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
3280
|
-
return range;
|
|
3281
|
-
} else {
|
|
3282
|
-
return new Range(range.raw, options);
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
if (_instanceof(range, Comparator)) {
|
|
3286
|
-
return new Range(range.value, options);
|
|
3287
|
-
}
|
|
3288
|
-
if (!_instanceof(this, Range)) {
|
|
3289
|
-
return new Range(range, options);
|
|
3290
|
-
}
|
|
3291
|
-
this.options = options;
|
|
3292
|
-
this.loose = !!options.loose;
|
|
3293
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
3294
|
-
// First reduce all whitespace as much as possible so we do not have to rely
|
|
3295
|
-
// on potentially slow regexes like \s*. This is then stored and used for
|
|
3296
|
-
// future error messages as well.
|
|
3297
|
-
this.raw = range.trim().split(/\s+/).join(' ');
|
|
3298
|
-
// First, split based on boolean or ||
|
|
3299
|
-
this.set = this.raw.split('||').map(function(range) {
|
|
3300
|
-
return this.parseRange(range.trim());
|
|
3301
|
-
}, this).filter(function(c) {
|
|
3302
|
-
// throw out any that are not relevant for whatever reason
|
|
3303
|
-
return c.length;
|
|
3304
|
-
});
|
|
3305
|
-
if (!this.set.length) {
|
|
3306
|
-
throw new TypeError('Invalid SemVer Range: ' + this.raw);
|
|
3307
|
-
}
|
|
3308
|
-
this.format();
|
|
3309
|
-
}
|
|
3310
|
-
Range.prototype.format = function() {
|
|
3311
|
-
this.range = this.set.map(function(comps) {
|
|
3312
|
-
return comps.join(' ').trim();
|
|
3313
|
-
}).join('||').trim();
|
|
3314
|
-
return this.range;
|
|
3315
|
-
};
|
|
3316
|
-
Range.prototype.toString = function() {
|
|
3317
|
-
return this.range;
|
|
3318
|
-
};
|
|
3319
|
-
Range.prototype.parseRange = function(range) {
|
|
3320
|
-
var loose = this.options.loose;
|
|
3321
|
-
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
3322
|
-
var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE];
|
|
3323
|
-
range = range.replace(hr, hyphenReplace);
|
|
3324
|
-
debug('hyphen replace', range);
|
|
3325
|
-
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
3326
|
-
range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace);
|
|
3327
|
-
debug('comparator trim', range, safeRe[COMPARATORTRIM]);
|
|
3328
|
-
// `~ 1.2.3` => `~1.2.3`
|
|
3329
|
-
range = range.replace(safeRe[TILDETRIM], tildeTrimReplace);
|
|
3330
|
-
// `^ 1.2.3` => `^1.2.3`
|
|
3331
|
-
range = range.replace(safeRe[CARETTRIM], caretTrimReplace);
|
|
3332
|
-
// At this point, the range is completely trimmed and
|
|
3333
|
-
// ready to be split into comparators.
|
|
3334
|
-
var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
|
|
3335
|
-
var set = range.split(' ').map(function(comp) {
|
|
3336
|
-
return parseComparator(comp, this.options);
|
|
3337
|
-
}, this).join(' ').split(/\s+/);
|
|
3338
|
-
if (this.options.loose) {
|
|
3339
|
-
// in loose mode, throw out any that are not valid comparators
|
|
3340
|
-
set = set.filter(function(comp) {
|
|
3341
|
-
return !!comp.match(compRe);
|
|
3342
|
-
});
|
|
3343
|
-
}
|
|
3344
|
-
set = set.map(function(comp) {
|
|
3345
|
-
return new Comparator(comp, this.options);
|
|
3346
|
-
}, this);
|
|
3347
|
-
return set;
|
|
3348
|
-
};
|
|
3349
|
-
Range.prototype.intersects = function(range, options) {
|
|
3350
|
-
if (!_instanceof(range, Range)) {
|
|
3351
|
-
throw new TypeError('a Range is required');
|
|
3352
|
-
}
|
|
3353
|
-
return this.set.some(function(thisComparators) {
|
|
3354
|
-
return thisComparators.every(function(thisComparator) {
|
|
3355
|
-
return range.set.some(function(rangeComparators) {
|
|
3356
|
-
return rangeComparators.every(function(rangeComparator) {
|
|
3357
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
3358
|
-
});
|
|
3359
|
-
});
|
|
3360
|
-
});
|
|
3361
|
-
});
|
|
3362
|
-
};
|
|
3363
|
-
// Mostly just for testing and legacy API reasons
|
|
3364
|
-
exports.toComparators = toComparators;
|
|
3365
|
-
function toComparators(range, options) {
|
|
3366
|
-
return new Range(range, options).set.map(function(comp) {
|
|
3367
|
-
return comp.map(function(c) {
|
|
3368
|
-
return c.value;
|
|
3369
|
-
}).join(' ').trim().split(' ');
|
|
3370
|
-
});
|
|
3371
|
-
}
|
|
3372
|
-
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
3373
|
-
// already replaced the hyphen ranges
|
|
3374
|
-
// turn into a set of JUST comparators.
|
|
3375
|
-
function parseComparator(comp, options) {
|
|
3376
|
-
debug('comp', comp, options);
|
|
3377
|
-
comp = replaceCarets(comp, options);
|
|
3378
|
-
debug('caret', comp);
|
|
3379
|
-
comp = replaceTildes(comp, options);
|
|
3380
|
-
debug('tildes', comp);
|
|
3381
|
-
comp = replaceXRanges(comp, options);
|
|
3382
|
-
debug('xrange', comp);
|
|
3383
|
-
comp = replaceStars(comp, options);
|
|
3384
|
-
debug('stars', comp);
|
|
3385
|
-
return comp;
|
|
3386
|
-
}
|
|
3387
|
-
function isX(id) {
|
|
3388
|
-
return !id || id.toLowerCase() === 'x' || id === '*';
|
|
3389
|
-
}
|
|
3390
|
-
// ~, ~> --> * (any, kinda silly)
|
|
3391
|
-
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
3392
|
-
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
3393
|
-
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
3394
|
-
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
3395
|
-
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
3396
|
-
function replaceTildes(comp, options) {
|
|
3397
|
-
return comp.trim().split(/\s+/).map(function(comp) {
|
|
3398
|
-
return replaceTilde(comp, options);
|
|
3399
|
-
}).join(' ');
|
|
3400
|
-
}
|
|
3401
|
-
function replaceTilde(comp, options) {
|
|
3402
|
-
var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE];
|
|
3403
|
-
return comp.replace(r, function(_, M, m, p, pr) {
|
|
3404
|
-
debug('tilde', comp, _, M, m, p, pr);
|
|
3405
|
-
var ret;
|
|
3406
|
-
if (isX(M)) {
|
|
3407
|
-
ret = '';
|
|
3408
|
-
} else if (isX(m)) {
|
|
3409
|
-
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
3410
|
-
} else if (isX(p)) {
|
|
3411
|
-
// ~1.2 == >=1.2.0 <1.3.0
|
|
3412
|
-
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
3413
|
-
} else if (pr) {
|
|
3414
|
-
debug('replaceTilde pr', pr);
|
|
3415
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
3416
|
-
} else {
|
|
3417
|
-
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
3418
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
3419
|
-
}
|
|
3420
|
-
debug('tilde return', ret);
|
|
3421
|
-
return ret;
|
|
3422
|
-
});
|
|
3423
|
-
}
|
|
3424
|
-
// ^ --> * (any, kinda silly)
|
|
3425
|
-
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
|
3426
|
-
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
|
3427
|
-
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
|
3428
|
-
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
3429
|
-
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
3430
|
-
function replaceCarets(comp, options) {
|
|
3431
|
-
return comp.trim().split(/\s+/).map(function(comp) {
|
|
3432
|
-
return replaceCaret(comp, options);
|
|
3433
|
-
}).join(' ');
|
|
3434
|
-
}
|
|
3435
|
-
function replaceCaret(comp, options) {
|
|
3436
|
-
debug('caret', comp, options);
|
|
3437
|
-
var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET];
|
|
3438
|
-
return comp.replace(r, function(_, M, m, p, pr) {
|
|
3439
|
-
debug('caret', comp, _, M, m, p, pr);
|
|
3440
|
-
var ret;
|
|
3441
|
-
if (isX(M)) {
|
|
3442
|
-
ret = '';
|
|
3443
|
-
} else if (isX(m)) {
|
|
3444
|
-
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
3445
|
-
} else if (isX(p)) {
|
|
3446
|
-
if (M === '0') {
|
|
3447
|
-
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
3448
|
-
} else {
|
|
3449
|
-
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
|
|
3450
|
-
}
|
|
3451
|
-
} else if (pr) {
|
|
3452
|
-
debug('replaceCaret pr', pr);
|
|
3453
|
-
if (M === '0') {
|
|
3454
|
-
if (m === '0') {
|
|
3455
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
3456
|
-
} else {
|
|
3457
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
3458
|
-
}
|
|
3459
|
-
} else {
|
|
3460
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
|
|
3461
|
-
}
|
|
3462
|
-
} else {
|
|
3463
|
-
debug('no pr');
|
|
3464
|
-
if (M === '0') {
|
|
3465
|
-
if (m === '0') {
|
|
3466
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
3467
|
-
} else {
|
|
3468
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
3469
|
-
}
|
|
3470
|
-
} else {
|
|
3471
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
debug('caret return', ret);
|
|
3475
|
-
return ret;
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3478
|
-
function replaceXRanges(comp, options) {
|
|
3479
|
-
debug('replaceXRanges', comp, options);
|
|
3480
|
-
return comp.split(/\s+/).map(function(comp) {
|
|
3481
|
-
return replaceXRange(comp, options);
|
|
3482
|
-
}).join(' ');
|
|
3483
|
-
}
|
|
3484
|
-
function replaceXRange(comp, options) {
|
|
3485
|
-
comp = comp.trim();
|
|
3486
|
-
var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE];
|
|
3487
|
-
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
|
3488
|
-
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
3489
|
-
var xM = isX(M);
|
|
3490
|
-
var xm = xM || isX(m);
|
|
3491
|
-
var xp = xm || isX(p);
|
|
3492
|
-
var anyX = xp;
|
|
3493
|
-
if (gtlt === '=' && anyX) {
|
|
3494
|
-
gtlt = '';
|
|
3495
|
-
}
|
|
3496
|
-
if (xM) {
|
|
3497
|
-
if (gtlt === '>' || gtlt === '<') {
|
|
3498
|
-
// nothing is allowed
|
|
3499
|
-
ret = '<0.0.0';
|
|
3500
|
-
} else {
|
|
3501
|
-
// nothing is forbidden
|
|
3502
|
-
ret = '*';
|
|
3503
|
-
}
|
|
3504
|
-
} else if (gtlt && anyX) {
|
|
3505
|
-
// we know patch is an x, because we have any x at all.
|
|
3506
|
-
// replace X with 0
|
|
3507
|
-
if (xm) {
|
|
3508
|
-
m = 0;
|
|
3509
|
-
}
|
|
3510
|
-
p = 0;
|
|
3511
|
-
if (gtlt === '>') {
|
|
3512
|
-
// >1 => >=2.0.0
|
|
3513
|
-
// >1.2 => >=1.3.0
|
|
3514
|
-
// >1.2.3 => >= 1.2.4
|
|
3515
|
-
gtlt = '>=';
|
|
3516
|
-
if (xm) {
|
|
3517
|
-
M = +M + 1;
|
|
3518
|
-
m = 0;
|
|
3519
|
-
p = 0;
|
|
3520
|
-
} else {
|
|
3521
|
-
m = +m + 1;
|
|
3522
|
-
p = 0;
|
|
3523
|
-
}
|
|
3524
|
-
} else if (gtlt === '<=') {
|
|
3525
|
-
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
3526
|
-
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
3527
|
-
gtlt = '<';
|
|
3528
|
-
if (xm) {
|
|
3529
|
-
M = +M + 1;
|
|
3530
|
-
} else {
|
|
3531
|
-
m = +m + 1;
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
ret = gtlt + M + '.' + m + '.' + p;
|
|
3535
|
-
} else if (xm) {
|
|
3536
|
-
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
3537
|
-
} else if (xp) {
|
|
3538
|
-
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
3539
|
-
}
|
|
3540
|
-
debug('xRange return', ret);
|
|
3541
|
-
return ret;
|
|
3542
|
-
});
|
|
3543
|
-
}
|
|
3544
|
-
// Because * is AND-ed with everything else in the comparator,
|
|
3545
|
-
// and '' means "any version", just remove the *s entirely.
|
|
3546
|
-
function replaceStars(comp, options) {
|
|
3547
|
-
debug('replaceStars', comp, options);
|
|
3548
|
-
// Looseness is ignored here. star is always as loose as it gets!
|
|
3549
|
-
return comp.trim().replace(safeRe[STAR], '');
|
|
3550
|
-
}
|
|
3551
|
-
// This function is passed to string.replace(safeRe[HYPHENRANGE])
|
|
3552
|
-
// M, m, patch, prerelease, build
|
|
3553
|
-
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
3554
|
-
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
|
3555
|
-
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
|
3556
|
-
function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
|
|
3557
|
-
if (isX(fM)) {
|
|
3558
|
-
from = '';
|
|
3559
|
-
} else if (isX(fm)) {
|
|
3560
|
-
from = '>=' + fM + '.0.0';
|
|
3561
|
-
} else if (isX(fp)) {
|
|
3562
|
-
from = '>=' + fM + '.' + fm + '.0';
|
|
3563
|
-
} else {
|
|
3564
|
-
from = '>=' + from;
|
|
3565
|
-
}
|
|
3566
|
-
if (isX(tM)) {
|
|
3567
|
-
to = '';
|
|
3568
|
-
} else if (isX(tm)) {
|
|
3569
|
-
to = '<' + (+tM + 1) + '.0.0';
|
|
3570
|
-
} else if (isX(tp)) {
|
|
3571
|
-
to = '<' + tM + '.' + (+tm + 1) + '.0';
|
|
3572
|
-
} else if (tpr) {
|
|
3573
|
-
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
|
3574
|
-
} else {
|
|
3575
|
-
to = '<=' + to;
|
|
3576
|
-
}
|
|
3577
|
-
return (from + ' ' + to).trim();
|
|
3578
|
-
}
|
|
3579
|
-
// if ANY of the sets match ALL of its comparators, then pass
|
|
3580
|
-
Range.prototype.test = function(version) {
|
|
3581
|
-
if (!version) {
|
|
3582
|
-
return false;
|
|
3583
|
-
}
|
|
3584
|
-
if (typeof version === 'string') {
|
|
3585
|
-
version = new SemVer(version, this.options);
|
|
3586
|
-
}
|
|
3587
|
-
for(var i = 0; i < this.set.length; i++){
|
|
3588
|
-
if (testSet(this.set[i], version, this.options)) {
|
|
3589
|
-
return true;
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
return false;
|
|
3593
|
-
};
|
|
3594
|
-
function testSet(set, version, options) {
|
|
3595
|
-
for(var i = 0; i < set.length; i++){
|
|
3596
|
-
if (!set[i].test(version)) {
|
|
3597
|
-
return false;
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
3601
|
-
// Find the set of versions that are allowed to have prereleases
|
|
3602
|
-
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
3603
|
-
// That should allow `1.2.3-pr.2` to pass.
|
|
3604
|
-
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
3605
|
-
// even though it's within the range set by the comparators.
|
|
3606
|
-
for(i = 0; i < set.length; i++){
|
|
3607
|
-
debug(set[i].semver);
|
|
3608
|
-
if (set[i].semver === ANY) {
|
|
3609
|
-
continue;
|
|
3610
|
-
}
|
|
3611
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
3612
|
-
var allowed = set[i].semver;
|
|
3613
|
-
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
3614
|
-
return true;
|
|
3615
|
-
}
|
|
3616
|
-
}
|
|
3617
|
-
}
|
|
3618
|
-
// Version has a -pre, but it's not one of the ones we like.
|
|
3619
|
-
return false;
|
|
3620
|
-
}
|
|
3621
|
-
return true;
|
|
3622
|
-
}
|
|
3623
|
-
exports.satisfies = satisfies;
|
|
3624
|
-
function satisfies(version, range, options) {
|
|
3625
|
-
try {
|
|
3626
|
-
range = new Range(range, options);
|
|
3627
|
-
} catch (er) {
|
|
3628
|
-
return false;
|
|
3629
|
-
}
|
|
3630
|
-
return range.test(version);
|
|
3631
|
-
}
|
|
3632
|
-
exports.maxSatisfying = maxSatisfying;
|
|
3633
|
-
function maxSatisfying(versions, range, options) {
|
|
3634
|
-
var max = null;
|
|
3635
|
-
var maxSV = null;
|
|
3636
|
-
try {
|
|
3637
|
-
var rangeObj = new Range(range, options);
|
|
3638
|
-
} catch (er) {
|
|
3639
|
-
return null;
|
|
3640
|
-
}
|
|
3641
|
-
versions.forEach(function(v) {
|
|
3642
|
-
if (rangeObj.test(v)) {
|
|
3643
|
-
// satisfies(v, range, options)
|
|
3644
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
3645
|
-
// compare(max, v, true)
|
|
3646
|
-
max = v;
|
|
3647
|
-
maxSV = new SemVer(max, options);
|
|
3648
|
-
}
|
|
3649
|
-
}
|
|
3650
|
-
});
|
|
3651
|
-
return max;
|
|
3652
|
-
}
|
|
3653
|
-
exports.minSatisfying = minSatisfying;
|
|
3654
|
-
function minSatisfying(versions, range, options) {
|
|
3655
|
-
var min = null;
|
|
3656
|
-
var minSV = null;
|
|
3657
|
-
try {
|
|
3658
|
-
var rangeObj = new Range(range, options);
|
|
3659
|
-
} catch (er) {
|
|
3660
|
-
return null;
|
|
3661
|
-
}
|
|
3662
|
-
versions.forEach(function(v) {
|
|
3663
|
-
if (rangeObj.test(v)) {
|
|
3664
|
-
// satisfies(v, range, options)
|
|
3665
|
-
if (!min || minSV.compare(v) === 1) {
|
|
3666
|
-
// compare(min, v, true)
|
|
3667
|
-
min = v;
|
|
3668
|
-
minSV = new SemVer(min, options);
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
3671
|
-
});
|
|
3672
|
-
return min;
|
|
3673
|
-
}
|
|
3674
|
-
exports.minVersion = minVersion;
|
|
3675
|
-
function minVersion(range, loose) {
|
|
3676
|
-
range = new Range(range, loose);
|
|
3677
|
-
var minver = new SemVer('0.0.0');
|
|
3678
|
-
if (range.test(minver)) {
|
|
3679
|
-
return minver;
|
|
3680
|
-
}
|
|
3681
|
-
minver = new SemVer('0.0.0-0');
|
|
3682
|
-
if (range.test(minver)) {
|
|
3683
|
-
return minver;
|
|
3684
|
-
}
|
|
3685
|
-
minver = null;
|
|
3686
|
-
for(var i = 0; i < range.set.length; ++i){
|
|
3687
|
-
var comparators = range.set[i];
|
|
3688
|
-
comparators.forEach(function(comparator) {
|
|
3689
|
-
// Clone to avoid manipulating the comparator's semver object.
|
|
3690
|
-
var compver = new SemVer(comparator.semver.version);
|
|
3691
|
-
switch(comparator.operator){
|
|
3692
|
-
case '>':
|
|
3693
|
-
if (compver.prerelease.length === 0) {
|
|
3694
|
-
compver.patch++;
|
|
3695
|
-
} else {
|
|
3696
|
-
compver.prerelease.push(0);
|
|
3697
|
-
}
|
|
3698
|
-
compver.raw = compver.format();
|
|
3699
|
-
/* fallthrough */ case '':
|
|
3700
|
-
case '>=':
|
|
3701
|
-
if (!minver || gt(minver, compver)) {
|
|
3702
|
-
minver = compver;
|
|
3703
|
-
}
|
|
3704
|
-
break;
|
|
3705
|
-
case '<':
|
|
3706
|
-
case '<=':
|
|
3707
|
-
break;
|
|
3708
|
-
/* istanbul ignore next */ default:
|
|
3709
|
-
throw new Error('Unexpected operation: ' + comparator.operator);
|
|
3710
|
-
}
|
|
3711
|
-
});
|
|
3712
|
-
}
|
|
3713
|
-
if (minver && range.test(minver)) {
|
|
3714
|
-
return minver;
|
|
3715
|
-
}
|
|
3716
|
-
return null;
|
|
3717
|
-
}
|
|
3718
|
-
exports.validRange = validRange;
|
|
3719
|
-
function validRange(range, options) {
|
|
3720
|
-
try {
|
|
3721
|
-
// Return '*' instead of '' so that truthiness works.
|
|
3722
|
-
// This will throw if it's invalid anyway
|
|
3723
|
-
return new Range(range, options).range || '*';
|
|
3724
|
-
} catch (er) {
|
|
3725
|
-
return null;
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
// Determine if version is less than all the versions possible in the range
|
|
3729
|
-
exports.ltr = ltr;
|
|
3730
|
-
function ltr(version, range, options) {
|
|
3731
|
-
return outside(version, range, '<', options);
|
|
3732
|
-
}
|
|
3733
|
-
// Determine if version is greater than all the versions possible in the range.
|
|
3734
|
-
exports.gtr = gtr;
|
|
3735
|
-
function gtr(version, range, options) {
|
|
3736
|
-
return outside(version, range, '>', options);
|
|
3737
|
-
}
|
|
3738
|
-
exports.outside = outside;
|
|
3739
|
-
function outside(version, range, hilo, options) {
|
|
3740
|
-
version = new SemVer(version, options);
|
|
3741
|
-
range = new Range(range, options);
|
|
3742
|
-
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
3743
|
-
switch(hilo){
|
|
3744
|
-
case '>':
|
|
3745
|
-
gtfn = gt;
|
|
3746
|
-
ltefn = lte;
|
|
3747
|
-
ltfn = lt;
|
|
3748
|
-
comp = '>';
|
|
3749
|
-
ecomp = '>=';
|
|
3750
|
-
break;
|
|
3751
|
-
case '<':
|
|
3752
|
-
gtfn = lt;
|
|
3753
|
-
ltefn = gte;
|
|
3754
|
-
ltfn = gt;
|
|
3755
|
-
comp = '<';
|
|
3756
|
-
ecomp = '<=';
|
|
3757
|
-
break;
|
|
3758
|
-
default:
|
|
3759
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
3760
|
-
}
|
|
3761
|
-
// If it satisifes the range it is not outside
|
|
3762
|
-
if (satisfies(version, range, options)) {
|
|
3763
|
-
return false;
|
|
3764
|
-
}
|
|
3765
|
-
// From now on, variable terms are as if we're in "gtr" mode.
|
|
3766
|
-
// but note that everything is flipped for the "ltr" function.
|
|
3767
|
-
for(var i = 0; i < range.set.length; ++i){
|
|
3768
|
-
var comparators = range.set[i];
|
|
3769
|
-
var high = null;
|
|
3770
|
-
var low = null;
|
|
3771
|
-
comparators.forEach(function(comparator) {
|
|
3772
|
-
if (comparator.semver === ANY) {
|
|
3773
|
-
comparator = new Comparator('>=0.0.0');
|
|
3774
|
-
}
|
|
3775
|
-
high = high || comparator;
|
|
3776
|
-
low = low || comparator;
|
|
3777
|
-
if (gtfn(comparator.semver, high.semver, options)) {
|
|
3778
|
-
high = comparator;
|
|
3779
|
-
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
3780
|
-
low = comparator;
|
|
3781
|
-
}
|
|
3782
|
-
});
|
|
3783
|
-
// If the edge version comparator has a operator then our version
|
|
3784
|
-
// isn't outside it
|
|
3785
|
-
if (high.operator === comp || high.operator === ecomp) {
|
|
3786
|
-
return false;
|
|
3787
|
-
}
|
|
3788
|
-
// If the lowest version comparator has an operator and our version
|
|
3789
|
-
// is less than it then it isn't higher than the range
|
|
3790
|
-
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
3791
|
-
return false;
|
|
3792
|
-
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
3793
|
-
return false;
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
return true;
|
|
3797
|
-
}
|
|
3798
|
-
exports.prerelease = prerelease;
|
|
3799
|
-
function prerelease(version, options) {
|
|
3800
|
-
var parsed = parse(version, options);
|
|
3801
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
3802
|
-
}
|
|
3803
|
-
exports.intersects = intersects;
|
|
3804
|
-
function intersects(r1, r2, options) {
|
|
3805
|
-
r1 = new Range(r1, options);
|
|
3806
|
-
r2 = new Range(r2, options);
|
|
3807
|
-
return r1.intersects(r2);
|
|
3808
|
-
}
|
|
3809
|
-
exports.coerce = coerce;
|
|
3810
|
-
function coerce(version) {
|
|
3811
|
-
if (_instanceof(version, SemVer)) {
|
|
3812
|
-
return version;
|
|
3813
|
-
}
|
|
3814
|
-
if (typeof version !== 'string') {
|
|
3815
|
-
return null;
|
|
3816
|
-
}
|
|
3817
|
-
var match = version.match(safeRe[COERCE]);
|
|
3818
|
-
if (match == null) {
|
|
3819
|
-
return null;
|
|
3820
|
-
}
|
|
3821
|
-
return parse(match[1] + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
|
|
3822
|
-
}
|
|
3823
|
-
})(semver, semver.exports);
|
|
3824
|
-
return semver.exports;
|
|
651
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
652
|
+
return spawned;
|
|
3825
653
|
}
|
|
3826
654
|
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
if (hasRequiredParse) return parse_1;
|
|
3831
|
-
hasRequiredParse = 1;
|
|
3832
|
-
var path = require$$0;
|
|
3833
|
-
var niceTry = requireSrc$1();
|
|
3834
|
-
var resolveCommand = requireResolveCommand();
|
|
3835
|
-
var escape = require_escape();
|
|
3836
|
-
var readShebang = requireReadShebang();
|
|
3837
|
-
var semver = requireSemver();
|
|
3838
|
-
var isWin = process.platform === 'win32';
|
|
3839
|
-
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
3840
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
3841
|
-
// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
|
3842
|
-
var supportsShellOption = niceTry(function() {
|
|
3843
|
-
return semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true);
|
|
3844
|
-
}) || false;
|
|
3845
|
-
function detectShebang(parsed) {
|
|
3846
|
-
parsed.file = resolveCommand(parsed);
|
|
3847
|
-
var shebang = parsed.file && readShebang(parsed.file);
|
|
3848
|
-
if (shebang) {
|
|
3849
|
-
parsed.args.unshift(parsed.file);
|
|
3850
|
-
parsed.command = shebang;
|
|
3851
|
-
return resolveCommand(parsed);
|
|
3852
|
-
}
|
|
3853
|
-
return parsed.file;
|
|
3854
|
-
}
|
|
3855
|
-
function parseNonShell(parsed) {
|
|
3856
|
-
if (!isWin) {
|
|
3857
|
-
return parsed;
|
|
3858
|
-
}
|
|
3859
|
-
// Detect & add support for shebangs
|
|
3860
|
-
var commandFile = detectShebang(parsed);
|
|
3861
|
-
// We don't need a shell if the command filename is an executable
|
|
3862
|
-
var needsShell = !isExecutableRegExp.test(commandFile);
|
|
3863
|
-
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
3864
|
-
// Note that `forceShell` is an hidden option used only in tests
|
|
3865
|
-
if (parsed.options.forceShell || needsShell) {
|
|
3866
|
-
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
3867
|
-
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
3868
|
-
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
|
3869
|
-
// we need to double escape them
|
|
3870
|
-
var needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
3871
|
-
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
3872
|
-
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
3873
|
-
parsed.command = path.normalize(parsed.command);
|
|
3874
|
-
// Escape command & arguments
|
|
3875
|
-
parsed.command = escape.command(parsed.command);
|
|
3876
|
-
parsed.args = parsed.args.map(function(arg) {
|
|
3877
|
-
return escape.argument(arg, needsDoubleEscapeMetaChars);
|
|
3878
|
-
});
|
|
3879
|
-
var shellCommand = [
|
|
3880
|
-
parsed.command
|
|
3881
|
-
].concat(parsed.args).join(' ');
|
|
3882
|
-
parsed.args = [
|
|
3883
|
-
'/d',
|
|
3884
|
-
'/s',
|
|
3885
|
-
'/c',
|
|
3886
|
-
'"'.concat(shellCommand, '"')
|
|
3887
|
-
];
|
|
3888
|
-
parsed.command = process.env.comspec || 'cmd.exe';
|
|
3889
|
-
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
3890
|
-
}
|
|
3891
|
-
return parsed;
|
|
3892
|
-
}
|
|
3893
|
-
function parseShell(parsed) {
|
|
3894
|
-
// If node supports the shell option, there's no need to mimic its behavior
|
|
3895
|
-
if (supportsShellOption) {
|
|
3896
|
-
return parsed;
|
|
3897
|
-
}
|
|
3898
|
-
// Mimic node shell option
|
|
3899
|
-
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
|
3900
|
-
var shellCommand = [
|
|
3901
|
-
parsed.command
|
|
3902
|
-
].concat(parsed.args).join(' ');
|
|
3903
|
-
if (isWin) {
|
|
3904
|
-
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
|
3905
|
-
parsed.args = [
|
|
3906
|
-
'/d',
|
|
3907
|
-
'/s',
|
|
3908
|
-
'/c',
|
|
3909
|
-
'"'.concat(shellCommand, '"')
|
|
3910
|
-
];
|
|
3911
|
-
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
3912
|
-
} else {
|
|
3913
|
-
if (typeof parsed.options.shell === 'string') {
|
|
3914
|
-
parsed.command = parsed.options.shell;
|
|
3915
|
-
} else if (process.platform === 'android') {
|
|
3916
|
-
parsed.command = '/system/bin/sh';
|
|
3917
|
-
} else {
|
|
3918
|
-
parsed.command = '/bin/sh';
|
|
3919
|
-
}
|
|
3920
|
-
parsed.args = [
|
|
3921
|
-
'-c',
|
|
3922
|
-
shellCommand
|
|
3923
|
-
];
|
|
3924
|
-
}
|
|
3925
|
-
return parsed;
|
|
3926
|
-
}
|
|
3927
|
-
function parse(command, args, options) {
|
|
3928
|
-
// Normalize arguments, similar to nodejs
|
|
3929
|
-
if (args && !Array.isArray(args)) {
|
|
3930
|
-
options = args;
|
|
3931
|
-
args = null;
|
|
3932
|
-
}
|
|
3933
|
-
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
3934
|
-
options = require('core-js/actual/object/assign')({}, options); // Clone object to avoid changing the original
|
|
3935
|
-
// Build our parsed object
|
|
3936
|
-
var parsed = {
|
|
3937
|
-
command: command,
|
|
3938
|
-
args: args,
|
|
3939
|
-
options: options,
|
|
3940
|
-
file: undefined,
|
|
3941
|
-
original: {
|
|
3942
|
-
command: command,
|
|
3943
|
-
args: args
|
|
3944
|
-
}
|
|
3945
|
-
};
|
|
3946
|
-
// Delegate further parsing to shell or non-shell
|
|
3947
|
-
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
|
3948
|
-
}
|
|
3949
|
-
parse_1 = parse;
|
|
3950
|
-
return parse_1;
|
|
3951
|
-
}
|
|
655
|
+
function spawnSync(command, args, options) {
|
|
656
|
+
// Parse the arguments
|
|
657
|
+
var parsed = parse(command, args, options); // Spawn the child process
|
|
3952
658
|
|
|
3953
|
-
var
|
|
3954
|
-
var hasRequiredEnoent;
|
|
3955
|
-
function requireEnoent() {
|
|
3956
|
-
if (hasRequiredEnoent) return enoent;
|
|
3957
|
-
hasRequiredEnoent = 1;
|
|
3958
|
-
var isWin = process.platform === 'win32';
|
|
3959
|
-
function notFoundError(original, syscall) {
|
|
3960
|
-
return Object.assign(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
|
|
3961
|
-
code: 'ENOENT',
|
|
3962
|
-
errno: 'ENOENT',
|
|
3963
|
-
syscall: "".concat(syscall, " ").concat(original.command),
|
|
3964
|
-
path: original.command,
|
|
3965
|
-
spawnargs: original.args
|
|
3966
|
-
});
|
|
3967
|
-
}
|
|
3968
|
-
function hookChildProcess(cp, parsed) {
|
|
3969
|
-
if (!isWin) {
|
|
3970
|
-
return;
|
|
3971
|
-
}
|
|
3972
|
-
var originalEmit = cp.emit;
|
|
3973
|
-
cp.emit = function(name, arg1) {
|
|
3974
|
-
// If emitting "exit" event and exit code is 1, we need to check if
|
|
3975
|
-
// the command exists and emit an "error" instead
|
|
3976
|
-
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
3977
|
-
if (name === 'exit') {
|
|
3978
|
-
var err = verifyENOENT(arg1, parsed);
|
|
3979
|
-
if (err) {
|
|
3980
|
-
return originalEmit.call(cp, 'error', err);
|
|
3981
|
-
}
|
|
3982
|
-
}
|
|
3983
|
-
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
|
3984
|
-
};
|
|
3985
|
-
}
|
|
3986
|
-
function verifyENOENT(status, parsed) {
|
|
3987
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
3988
|
-
return notFoundError(parsed.original, 'spawn');
|
|
3989
|
-
}
|
|
3990
|
-
return null;
|
|
3991
|
-
}
|
|
3992
|
-
function verifyENOENTSync(status, parsed) {
|
|
3993
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
3994
|
-
return notFoundError(parsed.original, 'spawnSync');
|
|
3995
|
-
}
|
|
3996
|
-
return null;
|
|
3997
|
-
}
|
|
3998
|
-
enoent = {
|
|
3999
|
-
hookChildProcess: hookChildProcess,
|
|
4000
|
-
verifyENOENT: verifyENOENT,
|
|
4001
|
-
verifyENOENTSync: verifyENOENTSync,
|
|
4002
|
-
notFoundError: notFoundError
|
|
4003
|
-
};
|
|
4004
|
-
return enoent;
|
|
4005
|
-
}
|
|
659
|
+
var result = cp.spawnSync(parsed.command, parsed.args, parsed.options); // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
4006
660
|
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
if (hasRequiredCrossSpawn6_0_5) return crossSpawn6_0_5.exports;
|
|
4010
|
-
hasRequiredCrossSpawn6_0_5 = 1;
|
|
4011
|
-
var cp = require$$5;
|
|
4012
|
-
var parse = requireParse();
|
|
4013
|
-
var enoent = requireEnoent();
|
|
4014
|
-
function spawn(command, args, options) {
|
|
4015
|
-
// Parse the arguments
|
|
4016
|
-
var parsed = parse(command, args, options);
|
|
4017
|
-
// Spawn the child process
|
|
4018
|
-
var spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
4019
|
-
// Hook into child process "exit" event to emit an error if the command
|
|
4020
|
-
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
4021
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
4022
|
-
return spawned;
|
|
4023
|
-
}
|
|
4024
|
-
function spawnSync(command, args, options) {
|
|
4025
|
-
// Parse the arguments
|
|
4026
|
-
var parsed = parse(command, args, options);
|
|
4027
|
-
// Spawn the child process
|
|
4028
|
-
var result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
4029
|
-
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
4030
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
4031
|
-
return result;
|
|
4032
|
-
}
|
|
4033
|
-
crossSpawn6_0_5.exports = spawn;
|
|
4034
|
-
crossSpawn6_0_5.exports.spawn = spawn;
|
|
4035
|
-
crossSpawn6_0_5.exports.sync = spawnSync;
|
|
4036
|
-
crossSpawn6_0_5.exports._parse = parse;
|
|
4037
|
-
crossSpawn6_0_5.exports._enoent = enoent;
|
|
4038
|
-
return crossSpawn6_0_5.exports;
|
|
661
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
662
|
+
return result;
|
|
4039
663
|
}
|
|
4040
664
|
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
var path = require$$0;
|
|
4047
|
-
var cp = require$$5;
|
|
4048
|
-
var spawn_ = requireCrossSpawn6_0_5();
|
|
4049
|
-
var NODES = [
|
|
4050
|
-
'node',
|
|
4051
|
-
'node.exe',
|
|
4052
|
-
'node.cmd'
|
|
4053
|
-
];
|
|
4054
|
-
function parse(command, args, options) {
|
|
4055
|
-
if (NODES.indexOf(path.basename(command).toLowerCase()) >= 0) {
|
|
4056
|
-
var env = options ? options.env || process.env : process.env;
|
|
4057
|
-
command = env.NODE || env.npm_node_execpath;
|
|
4058
|
-
}
|
|
4059
|
-
return spawn_._parse(command, args, options);
|
|
4060
|
-
}
|
|
4061
|
-
var enoent = spawn_._enoent;
|
|
4062
|
-
function spawn(command, args, options) {
|
|
4063
|
-
var parsed = parse(command, args, options);
|
|
4064
|
-
var spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
4065
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
4066
|
-
return spawned;
|
|
4067
|
-
}
|
|
4068
|
-
function spawnSync(command, args, options) {
|
|
4069
|
-
var parsed = parse(command, args, options);
|
|
4070
|
-
var result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
4071
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
4072
|
-
return result;
|
|
4073
|
-
}
|
|
4074
|
-
src$1.exports = spawn;
|
|
4075
|
-
src$1.exports.spawn = spawn;
|
|
4076
|
-
src$1.exports.sync = spawnSync;
|
|
4077
|
-
src$1.exports._parse = parse;
|
|
4078
|
-
src$1.exports._enoent = enoent;
|
|
4079
|
-
return src$1.exports;
|
|
4080
|
-
}
|
|
665
|
+
crossSpawn.exports = spawn;
|
|
666
|
+
var spawn_1 = crossSpawn.exports.spawn = spawn;
|
|
667
|
+
var sync = crossSpawn.exports.sync = spawnSync;
|
|
668
|
+
|
|
669
|
+
var _parse = crossSpawn.exports._parse = parse;
|
|
4081
670
|
|
|
4082
|
-
var
|
|
4083
|
-
var index = /*@__PURE__*/ getDefaultExportFromCjs(srcExports);
|
|
671
|
+
var _enoent = crossSpawn.exports._enoent = enoent;
|
|
4084
672
|
|
|
4085
|
-
|
|
673
|
+
exports._enoent = _enoent;
|
|
674
|
+
exports._parse = _parse;
|
|
675
|
+
exports["default"] = crossSpawn.exports;
|
|
676
|
+
exports.spawn = spawn_1;
|
|
677
|
+
exports.sync = sync;
|