cross-spawn-cb 0.4.1 → 0.5.2
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/lib/cross-spawn.js +654 -0
- package/lib/index.js +2 -0
- package/lib/json-buffer/LICENSE +22 -0
- package/lib/json-buffer/README.md +1 -0
- package/lib/json-buffer/index.js +49 -0
- package/lib/polyfills.js +17 -0
- package/lib/spawn-sync/spawn-sync.js +2 -11
- package/lib/spawn-sync/worker.js +4 -3
- package/{index.js → lib/spawnCallback.js} +5 -8
- package/lib/spawnSyncCallback.js +25 -0
- package/package.json +31 -18
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/main.yml +0 -22
- package/lib/sync.js +0 -25
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
8
|
+
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
+
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
+
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
+
|
|
23
|
+
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); }
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__esModule', {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
var require$$0$2 = require('child_process');
|
|
30
|
+
|
|
31
|
+
var require$$0$1 = require('path');
|
|
32
|
+
|
|
33
|
+
var require$$0 = require('fs');
|
|
34
|
+
|
|
35
|
+
function _interopDefaultLegacy(e) {
|
|
36
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
37
|
+
'default': e
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
42
|
+
|
|
43
|
+
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
44
|
+
|
|
45
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
46
|
+
|
|
47
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
48
|
+
var crossSpawn = {
|
|
49
|
+
exports: {}
|
|
50
|
+
};
|
|
51
|
+
var windows;
|
|
52
|
+
var hasRequiredWindows;
|
|
53
|
+
|
|
54
|
+
function requireWindows() {
|
|
55
|
+
if (hasRequiredWindows) return windows;
|
|
56
|
+
hasRequiredWindows = 1;
|
|
57
|
+
windows = isexe;
|
|
58
|
+
isexe.sync = sync;
|
|
59
|
+
var fs = require$$0__default["default"];
|
|
60
|
+
|
|
61
|
+
function checkPathExt(path, options) {
|
|
62
|
+
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
63
|
+
|
|
64
|
+
if (!pathext) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pathext = pathext.split(';');
|
|
69
|
+
|
|
70
|
+
if (pathext.indexOf('') !== -1) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
75
|
+
var p = pathext[i].toLowerCase();
|
|
76
|
+
|
|
77
|
+
if (p && path.substr(-p.length).toLowerCase() === p) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function checkStat(stat, path, options) {
|
|
86
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return checkPathExt(path, options);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function isexe(path, options, cb) {
|
|
94
|
+
fs.stat(path, function (er, stat) {
|
|
95
|
+
cb(er, er ? false : checkStat(stat, path, options));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function sync(path, options) {
|
|
100
|
+
return checkStat(fs.statSync(path), path, options);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return windows;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var mode;
|
|
107
|
+
var hasRequiredMode;
|
|
108
|
+
|
|
109
|
+
function requireMode() {
|
|
110
|
+
if (hasRequiredMode) return mode;
|
|
111
|
+
hasRequiredMode = 1;
|
|
112
|
+
mode = isexe;
|
|
113
|
+
isexe.sync = sync;
|
|
114
|
+
var fs = require$$0__default["default"];
|
|
115
|
+
|
|
116
|
+
function isexe(path, options, cb) {
|
|
117
|
+
fs.stat(path, function (er, stat) {
|
|
118
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function sync(path, options) {
|
|
123
|
+
return checkStat(fs.statSync(path), options);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function checkStat(stat, options) {
|
|
127
|
+
return stat.isFile() && checkMode(stat, options);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function checkMode(stat, options) {
|
|
131
|
+
var mod = stat.mode;
|
|
132
|
+
var uid = stat.uid;
|
|
133
|
+
var gid = stat.gid;
|
|
134
|
+
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
135
|
+
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
136
|
+
var u = parseInt('100', 8);
|
|
137
|
+
var g = parseInt('010', 8);
|
|
138
|
+
var o = parseInt('001', 8);
|
|
139
|
+
var ug = u | g;
|
|
140
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return mode;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var core;
|
|
148
|
+
|
|
149
|
+
if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
|
|
150
|
+
core = requireWindows();
|
|
151
|
+
} else {
|
|
152
|
+
core = requireMode();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
var isexe_1 = isexe$1;
|
|
156
|
+
isexe$1.sync = sync$1;
|
|
157
|
+
|
|
158
|
+
function isexe$1(path, options, cb) {
|
|
159
|
+
if (typeof options === 'function') {
|
|
160
|
+
cb = options;
|
|
161
|
+
options = {};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!cb) {
|
|
165
|
+
if (typeof Promise !== 'function') {
|
|
166
|
+
throw new TypeError('callback not provided');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return new Promise(function (resolve, reject) {
|
|
170
|
+
isexe$1(path, options || {}, function (er, is) {
|
|
171
|
+
if (er) {
|
|
172
|
+
reject(er);
|
|
173
|
+
} else {
|
|
174
|
+
resolve(is);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
core(path, options || {}, function (er, is) {
|
|
181
|
+
// ignore EACCES because that just means we aren't allowed to run it
|
|
182
|
+
if (er) {
|
|
183
|
+
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
|
184
|
+
er = null;
|
|
185
|
+
is = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
cb(er, is);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function sync$1(path, options) {
|
|
194
|
+
// my kingdom for a filtered catch
|
|
195
|
+
try {
|
|
196
|
+
return core.sync(path, options || {});
|
|
197
|
+
} catch (er) {
|
|
198
|
+
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
|
199
|
+
return false;
|
|
200
|
+
} else {
|
|
201
|
+
throw er;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
|
|
207
|
+
var path$2 = require$$0__default$1["default"];
|
|
208
|
+
var COLON = isWindows ? ';' : ':';
|
|
209
|
+
var isexe = isexe_1;
|
|
210
|
+
|
|
211
|
+
var getNotFoundError = function getNotFoundError(cmd) {
|
|
212
|
+
return Object.assign(new Error("not found: ".concat(cmd)), {
|
|
213
|
+
code: 'ENOENT'
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var getPathInfo = function getPathInfo(cmd, opt) {
|
|
218
|
+
var colon = opt.colon || COLON; // If it has a slash, then we don't bother searching the pathenv.
|
|
219
|
+
// just check the file itself, and that's it.
|
|
220
|
+
|
|
221
|
+
var pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] : [].concat(_toConsumableArray(isWindows ? [process.cwd()] : []), _toConsumableArray((opt.path || process.env.PATH ||
|
|
222
|
+
/* istanbul ignore next: very unusual */
|
|
223
|
+
'').split(colon)));
|
|
224
|
+
var pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
|
|
225
|
+
var pathExt = isWindows ? pathExtExe.split(colon) : [''];
|
|
226
|
+
|
|
227
|
+
if (isWindows) {
|
|
228
|
+
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
pathEnv: pathEnv,
|
|
233
|
+
pathExt: pathExt,
|
|
234
|
+
pathExtExe: pathExtExe
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
var which$1 = function which$1(cmd, opt, cb) {
|
|
239
|
+
if (typeof opt === 'function') {
|
|
240
|
+
cb = opt;
|
|
241
|
+
opt = {};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (!opt) opt = {};
|
|
245
|
+
|
|
246
|
+
var _getPathInfo = getPathInfo(cmd, opt),
|
|
247
|
+
pathEnv = _getPathInfo.pathEnv,
|
|
248
|
+
pathExt = _getPathInfo.pathExt,
|
|
249
|
+
pathExtExe = _getPathInfo.pathExtExe;
|
|
250
|
+
|
|
251
|
+
var found = [];
|
|
252
|
+
|
|
253
|
+
var step = function step(i) {
|
|
254
|
+
return new Promise(function (resolve, reject) {
|
|
255
|
+
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
256
|
+
var ppRaw = pathEnv[i];
|
|
257
|
+
var pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
258
|
+
var pCmd = path$2.join(pathPart, cmd);
|
|
259
|
+
var p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
260
|
+
resolve(subStep(p, i, 0));
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
var subStep = function subStep(p, i, ii) {
|
|
265
|
+
return new Promise(function (resolve, reject) {
|
|
266
|
+
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
267
|
+
var ext = pathExt[ii];
|
|
268
|
+
isexe(p + ext, {
|
|
269
|
+
pathExt: pathExtExe
|
|
270
|
+
}, function (er, is) {
|
|
271
|
+
if (!er && is) {
|
|
272
|
+
if (opt.all) found.push(p + ext);else return resolve(p + ext);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return resolve(subStep(p, i, ii + 1));
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return cb ? step(0).then(function (res) {
|
|
281
|
+
return cb(null, res);
|
|
282
|
+
}, cb) : step(0);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
var whichSync = function whichSync(cmd, opt) {
|
|
286
|
+
opt = opt || {};
|
|
287
|
+
|
|
288
|
+
var _getPathInfo2 = getPathInfo(cmd, opt),
|
|
289
|
+
pathEnv = _getPathInfo2.pathEnv,
|
|
290
|
+
pathExt = _getPathInfo2.pathExt,
|
|
291
|
+
pathExtExe = _getPathInfo2.pathExtExe;
|
|
292
|
+
|
|
293
|
+
var found = [];
|
|
294
|
+
|
|
295
|
+
for (var i = 0; i < pathEnv.length; i++) {
|
|
296
|
+
var ppRaw = pathEnv[i];
|
|
297
|
+
var pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
298
|
+
var pCmd = path$2.join(pathPart, cmd);
|
|
299
|
+
var p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
300
|
+
|
|
301
|
+
for (var j = 0; j < pathExt.length; j++) {
|
|
302
|
+
var cur = p + pathExt[j];
|
|
303
|
+
|
|
304
|
+
try {
|
|
305
|
+
var is = isexe.sync(cur, {
|
|
306
|
+
pathExt: pathExtExe
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
if (is) {
|
|
310
|
+
if (opt.all) found.push(cur);else return cur;
|
|
311
|
+
}
|
|
312
|
+
} catch (ex) {}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (opt.all && found.length) return found;
|
|
317
|
+
if (opt.nothrow) return null;
|
|
318
|
+
throw getNotFoundError(cmd);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
var which_1 = which$1;
|
|
322
|
+
which$1.sync = whichSync;
|
|
323
|
+
var pathKey$1 = {
|
|
324
|
+
exports: {}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
var pathKey = function pathKey() {
|
|
328
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
329
|
+
var environment = options.env || process.env;
|
|
330
|
+
var platform = options.platform || process.platform;
|
|
331
|
+
|
|
332
|
+
if (platform !== 'win32') {
|
|
333
|
+
return 'PATH';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return Object.keys(environment).reverse().find(function (key) {
|
|
337
|
+
return key.toUpperCase() === 'PATH';
|
|
338
|
+
}) || 'Path';
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
pathKey$1.exports = pathKey; // TODO: Remove this for the next major release
|
|
342
|
+
|
|
343
|
+
pathKey$1.exports["default"] = pathKey;
|
|
344
|
+
var path$1 = require$$0__default$1["default"];
|
|
345
|
+
var which = which_1;
|
|
346
|
+
var getPathKey = pathKey$1.exports;
|
|
347
|
+
|
|
348
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
349
|
+
var env = parsed.options.env || process.env;
|
|
350
|
+
var cwd = process.cwd();
|
|
351
|
+
var hasCustomCwd = parsed.options.cwd != null; // Worker threads do not have process.chdir()
|
|
352
|
+
|
|
353
|
+
var shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; // If a custom `cwd` was specified, we need to change the process cwd
|
|
354
|
+
// because `which` will do stat calls but does not support a custom cwd
|
|
355
|
+
|
|
356
|
+
if (shouldSwitchCwd) {
|
|
357
|
+
try {
|
|
358
|
+
process.chdir(parsed.options.cwd);
|
|
359
|
+
} catch (err) {
|
|
360
|
+
/* Empty */
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
var resolved;
|
|
365
|
+
|
|
366
|
+
try {
|
|
367
|
+
resolved = which.sync(parsed.command, {
|
|
368
|
+
path: env[getPathKey({
|
|
369
|
+
env: env
|
|
370
|
+
})],
|
|
371
|
+
pathExt: withoutPathExt ? path$1.delimiter : undefined
|
|
372
|
+
});
|
|
373
|
+
} catch (e) {
|
|
374
|
+
/* Empty */
|
|
375
|
+
} finally {
|
|
376
|
+
if (shouldSwitchCwd) {
|
|
377
|
+
process.chdir(cwd);
|
|
378
|
+
}
|
|
379
|
+
} // If we successfully resolved, ensure that an absolute path is returned
|
|
380
|
+
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
if (resolved) {
|
|
384
|
+
resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return resolved;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function resolveCommand$1(parsed) {
|
|
391
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
var resolveCommand_1 = resolveCommand$1;
|
|
395
|
+
var _escape = {}; // See http://www.robvanderwoude.com/escapechars.php
|
|
396
|
+
|
|
397
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
398
|
+
|
|
399
|
+
function escapeCommand(arg) {
|
|
400
|
+
// Escape meta chars
|
|
401
|
+
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
402
|
+
return arg;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
406
|
+
// Convert to string
|
|
407
|
+
arg = "".concat(arg); // Algorithm below is based on https://qntm.org/cmd
|
|
408
|
+
// Sequence of backslashes followed by a double quote:
|
|
409
|
+
// double up all the backslashes and escape the double quote
|
|
410
|
+
|
|
411
|
+
arg = arg.replace(/(\\*)"/g, '$1$1\\"'); // Sequence of backslashes followed by the end of the string
|
|
412
|
+
// (which will become a double quote later):
|
|
413
|
+
// double up all the backslashes
|
|
414
|
+
|
|
415
|
+
arg = arg.replace(/(\\*)$/, '$1$1'); // All other backslashes occur literally
|
|
416
|
+
// Quote the whole thing:
|
|
417
|
+
|
|
418
|
+
arg = "\"".concat(arg, "\""); // Escape meta chars
|
|
419
|
+
|
|
420
|
+
arg = arg.replace(metaCharsRegExp, '^$1'); // Double escape meta chars if necessary
|
|
421
|
+
|
|
422
|
+
if (doubleEscapeMetaChars) {
|
|
423
|
+
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return arg;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
_escape.command = escapeCommand;
|
|
430
|
+
_escape.argument = escapeArgument;
|
|
431
|
+
var shebangRegex$1 = /^#!(.*)/;
|
|
432
|
+
var shebangRegex = shebangRegex$1;
|
|
433
|
+
|
|
434
|
+
var shebangCommand$1 = function shebangCommand$1() {
|
|
435
|
+
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
436
|
+
var match = string.match(shebangRegex);
|
|
437
|
+
|
|
438
|
+
if (!match) {
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
var _match$0$replace$spli = match[0].replace(/#! ?/, '').split(' '),
|
|
443
|
+
_match$0$replace$spli2 = _slicedToArray(_match$0$replace$spli, 2),
|
|
444
|
+
path = _match$0$replace$spli2[0],
|
|
445
|
+
argument = _match$0$replace$spli2[1];
|
|
446
|
+
|
|
447
|
+
var binary = path.split('/').pop();
|
|
448
|
+
|
|
449
|
+
if (binary === 'env') {
|
|
450
|
+
return argument;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return argument ? "".concat(binary, " ").concat(argument) : binary;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
var fs = require$$0__default["default"];
|
|
457
|
+
var shebangCommand = shebangCommand$1;
|
|
458
|
+
|
|
459
|
+
function readShebang$1(command) {
|
|
460
|
+
// Read the first 150 bytes from the file
|
|
461
|
+
var size = 150;
|
|
462
|
+
var buffer = Buffer.alloc(size);
|
|
463
|
+
var fd;
|
|
464
|
+
|
|
465
|
+
try {
|
|
466
|
+
fd = fs.openSync(command, 'r');
|
|
467
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
468
|
+
fs.closeSync(fd);
|
|
469
|
+
} catch (e) {
|
|
470
|
+
/* Empty */
|
|
471
|
+
} // Attempt to extract shebang (null is returned if not a shebang)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
return shebangCommand(buffer.toString());
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
var readShebang_1 = readShebang$1;
|
|
478
|
+
var path = require$$0__default$1["default"];
|
|
479
|
+
var resolveCommand = resolveCommand_1;
|
|
480
|
+
var escape = _escape;
|
|
481
|
+
var readShebang = readShebang_1;
|
|
482
|
+
var isWin$1 = process.platform === 'win32';
|
|
483
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
484
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
485
|
+
|
|
486
|
+
function detectShebang(parsed) {
|
|
487
|
+
parsed.file = resolveCommand(parsed);
|
|
488
|
+
var shebang = parsed.file && readShebang(parsed.file);
|
|
489
|
+
|
|
490
|
+
if (shebang) {
|
|
491
|
+
parsed.args.unshift(parsed.file);
|
|
492
|
+
parsed.command = shebang;
|
|
493
|
+
return resolveCommand(parsed);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
return parsed.file;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function parseNonShell(parsed) {
|
|
500
|
+
if (!isWin$1) {
|
|
501
|
+
return parsed;
|
|
502
|
+
} // Detect & add support for shebangs
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
var commandFile = detectShebang(parsed); // We don't need a shell if the command filename is an executable
|
|
506
|
+
|
|
507
|
+
var needsShell = !isExecutableRegExp.test(commandFile); // If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
508
|
+
// Note that `forceShell` is an hidden option used only in tests
|
|
509
|
+
|
|
510
|
+
if (parsed.options.forceShell || needsShell) {
|
|
511
|
+
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
512
|
+
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
513
|
+
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
|
514
|
+
// we need to double escape them
|
|
515
|
+
var needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
516
|
+
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
517
|
+
|
|
518
|
+
parsed.command = path.normalize(parsed.command); // Escape command & arguments
|
|
519
|
+
|
|
520
|
+
parsed.command = escape.command(parsed.command);
|
|
521
|
+
parsed.args = parsed.args.map(function (arg) {
|
|
522
|
+
return escape.argument(arg, needsDoubleEscapeMetaChars);
|
|
523
|
+
});
|
|
524
|
+
var shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
525
|
+
parsed.args = ['/d', '/s', '/c', "\"".concat(shellCommand, "\"")];
|
|
526
|
+
parsed.command = process.env.comspec || 'cmd.exe';
|
|
527
|
+
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return parsed;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function parse$1(command, args, options) {
|
|
534
|
+
// Normalize arguments, similar to nodejs
|
|
535
|
+
if (args && !Array.isArray(args)) {
|
|
536
|
+
options = args;
|
|
537
|
+
args = null;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
541
|
+
|
|
542
|
+
options = Object.assign({}, options); // Clone object to avoid changing the original
|
|
543
|
+
// Build our parsed object
|
|
544
|
+
|
|
545
|
+
var parsed = {
|
|
546
|
+
command: command,
|
|
547
|
+
args: args,
|
|
548
|
+
options: options,
|
|
549
|
+
file: undefined,
|
|
550
|
+
original: {
|
|
551
|
+
command: command,
|
|
552
|
+
args: args
|
|
553
|
+
}
|
|
554
|
+
}; // Delegate further parsing to shell or non-shell
|
|
555
|
+
|
|
556
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
var parse_1 = parse$1;
|
|
560
|
+
var isWin = process.platform === 'win32';
|
|
561
|
+
|
|
562
|
+
function notFoundError(original, syscall) {
|
|
563
|
+
return Object.assign(new Error("".concat(syscall, " ").concat(original.command, " ENOENT")), {
|
|
564
|
+
code: 'ENOENT',
|
|
565
|
+
errno: 'ENOENT',
|
|
566
|
+
syscall: "".concat(syscall, " ").concat(original.command),
|
|
567
|
+
path: original.command,
|
|
568
|
+
spawnargs: original.args
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function hookChildProcess(cp, parsed) {
|
|
573
|
+
if (!isWin) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
var originalEmit = cp.emit;
|
|
578
|
+
|
|
579
|
+
cp.emit = function (name, arg1) {
|
|
580
|
+
// If emitting "exit" event and exit code is 1, we need to check if
|
|
581
|
+
// the command exists and emit an "error" instead
|
|
582
|
+
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
583
|
+
if (name === 'exit') {
|
|
584
|
+
var err = verifyENOENT(arg1, parsed);
|
|
585
|
+
|
|
586
|
+
if (err) {
|
|
587
|
+
return originalEmit.call(cp, 'error', err);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function verifyENOENT(status, parsed) {
|
|
596
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
597
|
+
return notFoundError(parsed.original, 'spawn');
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function verifyENOENTSync(status, parsed) {
|
|
604
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
605
|
+
return notFoundError(parsed.original, 'spawnSync');
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
var enoent$1 = {
|
|
612
|
+
hookChildProcess: hookChildProcess,
|
|
613
|
+
verifyENOENT: verifyENOENT,
|
|
614
|
+
verifyENOENTSync: verifyENOENTSync,
|
|
615
|
+
notFoundError: notFoundError
|
|
616
|
+
};
|
|
617
|
+
var cp = require$$0__default$2["default"];
|
|
618
|
+
var parse = parse_1;
|
|
619
|
+
var enoent = enoent$1;
|
|
620
|
+
|
|
621
|
+
function spawn(command, args, options) {
|
|
622
|
+
// Parse the arguments
|
|
623
|
+
var parsed = parse(command, args, options); // Spawn the child process
|
|
624
|
+
|
|
625
|
+
var spawned = cp.spawn(parsed.command, parsed.args, parsed.options); // Hook into child process "exit" event to emit an error if the command
|
|
626
|
+
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
627
|
+
|
|
628
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
629
|
+
return spawned;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function spawnSync(command, args, options) {
|
|
633
|
+
// Parse the arguments
|
|
634
|
+
var parsed = parse(command, args, options); // Spawn the child process
|
|
635
|
+
|
|
636
|
+
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
|
|
637
|
+
|
|
638
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
639
|
+
return result;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
crossSpawn.exports = spawn;
|
|
643
|
+
var spawn_1 = crossSpawn.exports.spawn = spawn;
|
|
644
|
+
var sync = crossSpawn.exports.sync = spawnSync;
|
|
645
|
+
|
|
646
|
+
var _parse = crossSpawn.exports._parse = parse;
|
|
647
|
+
|
|
648
|
+
var _enoent = crossSpawn.exports._enoent = enoent;
|
|
649
|
+
|
|
650
|
+
exports._enoent = _enoent;
|
|
651
|
+
exports._parse = _parse;
|
|
652
|
+
exports["default"] = crossSpawn.exports;
|
|
653
|
+
exports.spawn = spawn_1;
|
|
654
|
+
exports.sync = sync;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Dominic Tarr
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge,
|
|
4
|
+
to any person obtaining a copy of this software and
|
|
5
|
+
associated documentation files (the "Software"), to
|
|
6
|
+
deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify,
|
|
8
|
+
merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom
|
|
10
|
+
the Software is furnished to do so,
|
|
11
|
+
subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice
|
|
14
|
+
shall be included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
20
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Code based on https://github.com/dominictarr/json-buffer but adapted to be simpler to run in a purely node.js environment
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
//TODO: handle reviver/dehydrate function like normal
|
|
4
|
+
//and handle indentation, like normal.
|
|
5
|
+
//if anyone needs this... please send pull request.
|
|
6
|
+
|
|
7
|
+
exports.stringify = function stringify(o) {
|
|
8
|
+
if (o && Buffer.isBuffer(o)) return JSON.stringify(':base64:' + o.toString('base64'));
|
|
9
|
+
|
|
10
|
+
if (o && o.toJSON) o = o.toJSON();
|
|
11
|
+
|
|
12
|
+
if (o && 'object' === typeof o) {
|
|
13
|
+
var s = '';
|
|
14
|
+
var array = Array.isArray(o);
|
|
15
|
+
s = array ? '[' : '{';
|
|
16
|
+
var first = true;
|
|
17
|
+
|
|
18
|
+
for (var k in o) {
|
|
19
|
+
var ignore = 'function' == typeof o[k] || (!array && 'undefined' === typeof o[k]);
|
|
20
|
+
if (Object.hasOwnProperty.call(o, k) && !ignore) {
|
|
21
|
+
if (!first) s += ',';
|
|
22
|
+
first = false;
|
|
23
|
+
if (array) {
|
|
24
|
+
s += stringify(o[k]);
|
|
25
|
+
} else if (o[k] !== void 0) {
|
|
26
|
+
s += stringify(k) + ':' + stringify(o[k]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
s += array ? ']' : '}';
|
|
32
|
+
|
|
33
|
+
return s;
|
|
34
|
+
} else if ('string' === typeof o) {
|
|
35
|
+
return JSON.stringify(/^:/.test(o) ? ':' + o : o);
|
|
36
|
+
} else if ('undefined' === typeof o) {
|
|
37
|
+
return 'null';
|
|
38
|
+
} else return JSON.stringify(o);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.parse = function (s) {
|
|
42
|
+
return JSON.parse(s, function (key, value) {
|
|
43
|
+
if ('string' === typeof value) {
|
|
44
|
+
if (/^:base64:/.test(value)) return new Buffer(value.substring(8), 'base64');
|
|
45
|
+
else return /^:/.test(value) ? value.substring(1) : value;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
});
|
|
49
|
+
};
|
package/lib/polyfills.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
if (!Object.assign) Object.assign = require('just-extend');
|
|
2
|
+
if (!Object.keys) Object.keys = require('object-keys');
|
|
3
|
+
|
|
4
|
+
var path = require('path');
|
|
5
|
+
if (typeof path.delimiter === 'undefined') path.delimiter = process.platform === 'win32' ? ';' : ':';
|
|
6
|
+
|
|
7
|
+
var cp = require('child_process');
|
|
8
|
+
if (!cp.spawnSync) cp.spawnSync = require('./spawn-sync/spawn-sync.js');
|
|
9
|
+
|
|
10
|
+
if (!Array.prototype.find) {
|
|
11
|
+
Array.prototype.find = function find(fn) {
|
|
12
|
+
for (var i = 0; i < this.length; i++) {
|
|
13
|
+
if (fn(this[i])) return this[i];
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -5,17 +5,8 @@ var path = require('path');
|
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var tmpdir = require('os').tmpdir || require('os-shim').tmpdir;
|
|
7
7
|
var cp = require('child_process');
|
|
8
|
-
var sleep;
|
|
9
|
-
var JSON = require('
|
|
10
|
-
try {
|
|
11
|
-
sleep = require('try-thread-sleep');
|
|
12
|
-
} catch (ex) {
|
|
13
|
-
console.warn('Native thread-sleep not available.');
|
|
14
|
-
console.warn('This will result in much slower performance, but it will still work.');
|
|
15
|
-
console.warn('You should re-install spawn-sync or upgrade to the lastest version of node if possible.');
|
|
16
|
-
console.warn('Check ' + path.resolve(__dirname, '../error.log') + ' for more details');
|
|
17
|
-
sleep = function () {};
|
|
18
|
-
}
|
|
8
|
+
var sleep = function () {};
|
|
9
|
+
var JSON = require('../json-buffer');
|
|
19
10
|
|
|
20
11
|
var temp = path.normalize(path.join(tmpdir(), 'spawn-sync'));
|
|
21
12
|
|
package/lib/spawn-sync/worker.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
require('../polyfills');
|
|
5
|
+
|
|
6
|
+
var spawn = require('../cross-spawn.js').spawn;
|
|
5
7
|
var fs = require('fs');
|
|
6
8
|
var concat = require('concat-stream');
|
|
7
|
-
var JSON = require('
|
|
9
|
+
var JSON = require('../json-buffer');
|
|
8
10
|
|
|
9
11
|
var inputFile = process.argv[2];
|
|
10
12
|
var outputFile = process.argv[3];
|
|
@@ -17,7 +19,6 @@ function output(result) {
|
|
|
17
19
|
var child = spawn.apply(null, args);
|
|
18
20
|
var options = args[2] && typeof args[2] === 'object' ? args[2] : args[1] && typeof args[1] === 'object' && !Array.isArray(args[1]) ? args[1] : {};
|
|
19
21
|
|
|
20
|
-
var complete = false;
|
|
21
22
|
var stdout, stderr;
|
|
22
23
|
child.stdout &&
|
|
23
24
|
child.stdout.pipe(
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var assign = require('
|
|
1
|
+
require('./polyfills');
|
|
2
|
+
|
|
3
|
+
var assign = require('just-extend');
|
|
4
4
|
var once = require('once');
|
|
5
5
|
var nextTick = require('next-tick');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
if (typeof path.delimiter === 'undefined') path.delimiter = process.platform === 'win32' ? ';' : ':';
|
|
7
|
+
var spawn = require('./cross-spawn').spawn;
|
|
9
8
|
|
|
10
|
-
module.exports = function
|
|
9
|
+
module.exports = function spawnCallback(command, args, options, callback) {
|
|
11
10
|
if (typeof options === 'function') {
|
|
12
11
|
callback = options;
|
|
13
12
|
options = {};
|
|
@@ -56,5 +55,3 @@ module.exports = function crossSpawnCallback(command, args, options, callback) {
|
|
|
56
55
|
});
|
|
57
56
|
});
|
|
58
57
|
};
|
|
59
|
-
|
|
60
|
-
module.exports.sync = require('./lib/sync');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var spawnSync = require('./cross-spawn').sync;
|
|
2
|
+
|
|
3
|
+
module.exports = function spawnSyncCallback(command, args, options) {
|
|
4
|
+
options = options || {};
|
|
5
|
+
|
|
6
|
+
var result = spawnSync(command, args, {
|
|
7
|
+
stdio: 'pipe',
|
|
8
|
+
encoding: 'utf-8',
|
|
9
|
+
});
|
|
10
|
+
if (result.stdout && (options.stdout === 'inherit' || options.stdio === 'inherit')) {
|
|
11
|
+
process.stdout.write(result.stdout);
|
|
12
|
+
result.stdout = null;
|
|
13
|
+
}
|
|
14
|
+
if (result.stderr && (options.stderr === 'inherit' || options.stdio === 'inherit')) {
|
|
15
|
+
process.stderr.write(result.stderr);
|
|
16
|
+
result.stderr = null;
|
|
17
|
+
}
|
|
18
|
+
var err = result.status ? new Error('Non-zero exit code: ' + result.status) : null;
|
|
19
|
+
if (result.stderr && result.stderr.length) {
|
|
20
|
+
err = err || new Error('stderr has content');
|
|
21
|
+
err.stderr = result.stderr;
|
|
22
|
+
}
|
|
23
|
+
if (err) throw err;
|
|
24
|
+
return result;
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -12,36 +12,49 @@
|
|
|
12
12
|
"url": "git@github.com:kmalakoff/cross-spawn-cb.git"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"main": "index.js",
|
|
15
|
+
"main": "lib/index.js",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"format": "prettier --write .",
|
|
18
18
|
"lint": "eslint .",
|
|
19
19
|
"prepublishOnly": "dtd \"npm run lint\" \"depcheck\"",
|
|
20
20
|
"test": "mocha-compat test/spec/**/*.test.js",
|
|
21
|
-
"test:engines": "nvu engines npm test"
|
|
21
|
+
"test:engines": "nvu engines npm test",
|
|
22
|
+
"build": "rollup -c rollup.config.js"
|
|
22
23
|
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib"
|
|
26
|
+
],
|
|
23
27
|
"dependencies": {
|
|
24
|
-
"
|
|
28
|
+
"concat-stream": "^1.6.2",
|
|
29
|
+
"cross-spawn": "^7.0.3",
|
|
30
|
+
"just-extend": "^6.0.1",
|
|
25
31
|
"next-tick": "^1.1.0",
|
|
26
|
-
"object-
|
|
32
|
+
"object-keys": "^1.1.1",
|
|
27
33
|
"once": "^1.4.0",
|
|
28
|
-
"
|
|
29
|
-
"try-thread-sleep": "^1.0.2"
|
|
34
|
+
"os-shim": "^0.1.3"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"babel-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"eslint
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"@babel/preset-env": "^7.18.6",
|
|
38
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
39
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.30.0",
|
|
42
|
+
"depcheck": "^1.4.3",
|
|
43
|
+
"dis-dat": "^0.1.4",
|
|
44
|
+
"eslint": "^8.18.0",
|
|
45
|
+
"eslint-config-prettier": "^8.5.0",
|
|
46
|
+
"eslint-config-standard": "^17.0.0",
|
|
47
|
+
"eslint-plugin-import": "^2.26.0",
|
|
39
48
|
"eslint-plugin-node": "^11.1.0",
|
|
40
|
-
"eslint-plugin-promise": "^
|
|
41
|
-
"eslint-plugin-standard": "^4.0
|
|
49
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
50
|
+
"eslint-plugin-standard": "^4.1.0",
|
|
42
51
|
"mocha-compat": "^3.5.5",
|
|
43
|
-
"node-version-use": "^0.2.
|
|
44
|
-
"prettier": "^2.
|
|
52
|
+
"node-version-use": "^0.2.2",
|
|
53
|
+
"prettier": "^2.7.1",
|
|
54
|
+
"rollup": "^2.75.7",
|
|
55
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
56
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
57
|
+
"rollup-plugin-node-externals": "^4.1.0"
|
|
45
58
|
},
|
|
46
59
|
"engines": {
|
|
47
60
|
"node": ">=0.8"
|
package/.github/dependabot.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
- push
|
|
4
|
-
- pull_request
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
name: Node.js ${{ matrix.node-version }} ${{ matrix.os }}
|
|
8
|
-
runs-on: ${{ matrix.os }}
|
|
9
|
-
strategy:
|
|
10
|
-
matrix:
|
|
11
|
-
node: ['latest']
|
|
12
|
-
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
- uses: actions/setup-node@v2.4.1
|
|
16
|
-
with:
|
|
17
|
-
node-version: ${{ matrix.node-version }}
|
|
18
|
-
- run: git config --global user.name "Github Actions"
|
|
19
|
-
- run: git config --global user.email "actions@users.noreply.github.com"
|
|
20
|
-
- run: npm ci
|
|
21
|
-
- run: npm run lint
|
|
22
|
-
- run: npm run test:engines
|
package/lib/sync.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var spawnSync = require('cross-spawn').sync || require('./spawn-sync/spawn-sync.js');
|
|
2
|
-
var assign = require('object-assign');
|
|
3
|
-
|
|
4
|
-
module.exports = function crossSpawnSync(command, args, options) {
|
|
5
|
-
if (!options) options = {};
|
|
6
|
-
else options = assign({}, options);
|
|
7
|
-
if (options.stdio === 'string') {
|
|
8
|
-
options.stdio = 'pipe';
|
|
9
|
-
options.encoding = 'utf-8';
|
|
10
|
-
} else if (options.stdout === 'string') {
|
|
11
|
-
options.stdout = 'pipe';
|
|
12
|
-
options.encoding = 'utf-8';
|
|
13
|
-
} else if (options.stderr === 'string') {
|
|
14
|
-
options.stderr = 'pipe';
|
|
15
|
-
options.encoding = 'utf-8';
|
|
16
|
-
}
|
|
17
|
-
var result = spawnSync(command, args, options);
|
|
18
|
-
var err = result.status ? new Error('Non-zero exit code: ' + result.status) : null;
|
|
19
|
-
if (result.stderr && result.stderr.length) {
|
|
20
|
-
err = err || new Error('stderr has content');
|
|
21
|
-
err.stderr = result.stderr;
|
|
22
|
-
}
|
|
23
|
-
if (err) throw err;
|
|
24
|
-
return result;
|
|
25
|
-
};
|