vitest 0.29.8 → 0.30.1
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/LICENSE.md +372 -451
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +5 -6
- package/dist/child.js +12 -16
- package/dist/{chunk-api-setup.3aabe9ac.js → chunk-api-setup.c93e5069.js} +58 -51
- package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.ee5cc9a8.js} +32 -32
- package/dist/chunk-integrations-globals.d419838f.js +26 -0
- package/dist/{chunk-node-git.ed5bded8.js → chunk-node-git.4c43bd73.js} +4 -2
- package/dist/cli-wrapper.js +6 -5
- package/dist/cli.js +26 -26
- package/dist/config.cjs +15 -2
- package/dist/config.d.ts +18 -4
- package/dist/config.js +10 -1
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +35 -34
- package/dist/environments.d.ts +5 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +9 -11
- package/dist/loader.js +396 -13
- package/dist/node.d.ts +9 -7
- package/dist/node.js +27 -30
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +35 -31
- package/dist/{types-94cfe4b4.d.ts → types-e3c9754d.d.ts} +224 -305
- package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.70680cd5.js} +3849 -3330
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.70609f6f.js} +9 -12
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/vendor-index.7dcbfa46.js +167 -0
- package/dist/{chunk-integrations-utils.23c19408.js → vendor-index.81b9e499.js} +22 -21
- package/dist/{vendor-index.2cbcdd1e.js → vendor-index.c1e09929.js} +458 -373
- package/dist/vendor-index.fad2598b.js +44 -0
- package/dist/{vendor-index.534e612c.js → vendor-index.fc98d30f.js} +2 -2
- package/dist/{chunk-runtime-inspector.b1427a10.js → vendor-inspector.47fc8cbb.js} +5 -2
- package/dist/{chunk-runtime-rpc.d6aa57f8.js → vendor-rpc.4d3d7a54.js} +5 -5
- package/dist/{chunk-integrations-run-once.ea614f17.js → vendor-run-once.69ce7172.js} +3 -3
- package/dist/{chunk-runtime-setup.5d504677.js → vendor-setup.common.cef38f4e.js} +2 -2
- package/dist/vendor-tasks.042d6084.js +14 -0
- package/dist/{chunk-utils-import.e488ace3.js → vendor-vi.a3ff54b1.js} +73 -2957
- package/dist/worker.js +14 -18
- package/package.json +29 -34
- package/dist/chunk-constants.bc18a549.js +0 -36
- package/dist/chunk-integrations-globals.49802775.js +0 -28
- package/dist/chunk-snapshot-env.a347d647.js +0 -11
- package/dist/chunk-utils-base.b5ddfcc9.js +0 -91
- package/dist/chunk-utils-env.6b856dbf.js +0 -64
- package/dist/chunk-utils-tasks.8781fd71.js +0 -107
- package/dist/env-afee91f0.d.ts +0 -10
- package/dist/vendor-index.783e7f3e.js +0 -71
- package/dist/vendor-index.bdee400f.js +0 -396
- package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
- /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
- /package/dist/{chunk-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
- /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.js} +0 -0
- /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
|
@@ -1,18 +1,290 @@
|
|
|
1
1
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
2
2
|
import path$3 from 'node:path';
|
|
3
|
-
import childProcess from 'node:child_process';
|
|
3
|
+
import childProcess, { ChildProcess } from 'node:child_process';
|
|
4
4
|
import process$2 from 'node:process';
|
|
5
|
-
import require$$0$
|
|
6
|
-
import
|
|
7
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.
|
|
8
|
-
import require$$0 from 'fs';
|
|
5
|
+
import require$$0$2 from 'child_process';
|
|
6
|
+
import p from 'path';
|
|
7
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
|
|
8
|
+
import require$$0$1 from 'fs';
|
|
9
9
|
import url from 'node:url';
|
|
10
10
|
import os, { constants } from 'node:os';
|
|
11
|
-
import require$$0
|
|
11
|
+
import require$$0 from 'assert';
|
|
12
12
|
import require$$2 from 'events';
|
|
13
|
+
import { createWriteStream, createReadStream } from 'node:fs';
|
|
13
14
|
import require$$0$5 from 'buffer';
|
|
14
15
|
import require$$0$3 from 'stream';
|
|
15
16
|
import require$$0$4 from 'util';
|
|
17
|
+
import { debuglog } from 'node:util';
|
|
18
|
+
|
|
19
|
+
var signalExit = {exports: {}};
|
|
20
|
+
|
|
21
|
+
var signals$1 = {exports: {}};
|
|
22
|
+
|
|
23
|
+
var hasRequiredSignals;
|
|
24
|
+
|
|
25
|
+
function requireSignals () {
|
|
26
|
+
if (hasRequiredSignals) return signals$1.exports;
|
|
27
|
+
hasRequiredSignals = 1;
|
|
28
|
+
(function (module) {
|
|
29
|
+
// This is not the set of all possible signals.
|
|
30
|
+
//
|
|
31
|
+
// It IS, however, the set of all signals that trigger
|
|
32
|
+
// an exit on either Linux or BSD systems. Linux is a
|
|
33
|
+
// superset of the signal names supported on BSD, and
|
|
34
|
+
// the unknown signals just fail to register, so we can
|
|
35
|
+
// catch that easily enough.
|
|
36
|
+
//
|
|
37
|
+
// Don't bother with SIGKILL. It's uncatchable, which
|
|
38
|
+
// means that we can't fire any callbacks anyway.
|
|
39
|
+
//
|
|
40
|
+
// If a user does happen to register a handler on a non-
|
|
41
|
+
// fatal signal like SIGWINCH or something, and then
|
|
42
|
+
// exit, it'll end up firing `process.emit('exit')`, so
|
|
43
|
+
// the handler will be fired anyway.
|
|
44
|
+
//
|
|
45
|
+
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
46
|
+
// artificially, inherently leave the process in a
|
|
47
|
+
// state from which it is not safe to try and enter JS
|
|
48
|
+
// listeners.
|
|
49
|
+
module.exports = [
|
|
50
|
+
'SIGABRT',
|
|
51
|
+
'SIGALRM',
|
|
52
|
+
'SIGHUP',
|
|
53
|
+
'SIGINT',
|
|
54
|
+
'SIGTERM'
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
if (process.platform !== 'win32') {
|
|
58
|
+
module.exports.push(
|
|
59
|
+
'SIGVTALRM',
|
|
60
|
+
'SIGXCPU',
|
|
61
|
+
'SIGXFSZ',
|
|
62
|
+
'SIGUSR2',
|
|
63
|
+
'SIGTRAP',
|
|
64
|
+
'SIGSYS',
|
|
65
|
+
'SIGQUIT',
|
|
66
|
+
'SIGIOT'
|
|
67
|
+
// should detect profiler and enable/disable accordingly.
|
|
68
|
+
// see #21
|
|
69
|
+
// 'SIGPROF'
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (process.platform === 'linux') {
|
|
74
|
+
module.exports.push(
|
|
75
|
+
'SIGIO',
|
|
76
|
+
'SIGPOLL',
|
|
77
|
+
'SIGPWR',
|
|
78
|
+
'SIGSTKFLT',
|
|
79
|
+
'SIGUNUSED'
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
} (signals$1));
|
|
83
|
+
return signals$1.exports;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Note: since nyc uses this module to output coverage, any lines
|
|
87
|
+
// that are in the direct sync flow of nyc's outputCoverage are
|
|
88
|
+
// ignored, since we can never get coverage for them.
|
|
89
|
+
// grab a reference to node's real process object right away
|
|
90
|
+
var process$1 = commonjsGlobal.process;
|
|
91
|
+
|
|
92
|
+
const processOk = function (process) {
|
|
93
|
+
return process &&
|
|
94
|
+
typeof process === 'object' &&
|
|
95
|
+
typeof process.removeListener === 'function' &&
|
|
96
|
+
typeof process.emit === 'function' &&
|
|
97
|
+
typeof process.reallyExit === 'function' &&
|
|
98
|
+
typeof process.listeners === 'function' &&
|
|
99
|
+
typeof process.kill === 'function' &&
|
|
100
|
+
typeof process.pid === 'number' &&
|
|
101
|
+
typeof process.on === 'function'
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// some kind of non-node environment, just no-op
|
|
105
|
+
/* istanbul ignore if */
|
|
106
|
+
if (!processOk(process$1)) {
|
|
107
|
+
signalExit.exports = function () {
|
|
108
|
+
return function () {}
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
var assert = require$$0;
|
|
112
|
+
var signals = requireSignals();
|
|
113
|
+
var isWin$2 = /^win/i.test(process$1.platform);
|
|
114
|
+
|
|
115
|
+
var EE = require$$2;
|
|
116
|
+
/* istanbul ignore if */
|
|
117
|
+
if (typeof EE !== 'function') {
|
|
118
|
+
EE = EE.EventEmitter;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var emitter;
|
|
122
|
+
if (process$1.__signal_exit_emitter__) {
|
|
123
|
+
emitter = process$1.__signal_exit_emitter__;
|
|
124
|
+
} else {
|
|
125
|
+
emitter = process$1.__signal_exit_emitter__ = new EE();
|
|
126
|
+
emitter.count = 0;
|
|
127
|
+
emitter.emitted = {};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Because this emitter is a global, we have to check to see if a
|
|
131
|
+
// previous version of this library failed to enable infinite listeners.
|
|
132
|
+
// I know what you're about to say. But literally everything about
|
|
133
|
+
// signal-exit is a compromise with evil. Get used to it.
|
|
134
|
+
if (!emitter.infinite) {
|
|
135
|
+
emitter.setMaxListeners(Infinity);
|
|
136
|
+
emitter.infinite = true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
signalExit.exports = function (cb, opts) {
|
|
140
|
+
/* istanbul ignore if */
|
|
141
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
142
|
+
return function () {}
|
|
143
|
+
}
|
|
144
|
+
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
|
|
145
|
+
|
|
146
|
+
if (loaded === false) {
|
|
147
|
+
load();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
var ev = 'exit';
|
|
151
|
+
if (opts && opts.alwaysLast) {
|
|
152
|
+
ev = 'afterexit';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
var remove = function () {
|
|
156
|
+
emitter.removeListener(ev, cb);
|
|
157
|
+
if (emitter.listeners('exit').length === 0 &&
|
|
158
|
+
emitter.listeners('afterexit').length === 0) {
|
|
159
|
+
unload();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
emitter.on(ev, cb);
|
|
163
|
+
|
|
164
|
+
return remove
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var unload = function unload () {
|
|
168
|
+
if (!loaded || !processOk(commonjsGlobal.process)) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
loaded = false;
|
|
172
|
+
|
|
173
|
+
signals.forEach(function (sig) {
|
|
174
|
+
try {
|
|
175
|
+
process$1.removeListener(sig, sigListeners[sig]);
|
|
176
|
+
} catch (er) {}
|
|
177
|
+
});
|
|
178
|
+
process$1.emit = originalProcessEmit;
|
|
179
|
+
process$1.reallyExit = originalProcessReallyExit;
|
|
180
|
+
emitter.count -= 1;
|
|
181
|
+
};
|
|
182
|
+
signalExit.exports.unload = unload;
|
|
183
|
+
|
|
184
|
+
var emit = function emit (event, code, signal) {
|
|
185
|
+
/* istanbul ignore if */
|
|
186
|
+
if (emitter.emitted[event]) {
|
|
187
|
+
return
|
|
188
|
+
}
|
|
189
|
+
emitter.emitted[event] = true;
|
|
190
|
+
emitter.emit(event, code, signal);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// { <signal>: <listener fn>, ... }
|
|
194
|
+
var sigListeners = {};
|
|
195
|
+
signals.forEach(function (sig) {
|
|
196
|
+
sigListeners[sig] = function listener () {
|
|
197
|
+
/* istanbul ignore if */
|
|
198
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
// If there are no other listeners, an exit is coming!
|
|
202
|
+
// Simplest way: remove us and then re-send the signal.
|
|
203
|
+
// We know that this will kill the process, so we can
|
|
204
|
+
// safely emit now.
|
|
205
|
+
var listeners = process$1.listeners(sig);
|
|
206
|
+
if (listeners.length === emitter.count) {
|
|
207
|
+
unload();
|
|
208
|
+
emit('exit', null, sig);
|
|
209
|
+
/* istanbul ignore next */
|
|
210
|
+
emit('afterexit', null, sig);
|
|
211
|
+
/* istanbul ignore next */
|
|
212
|
+
if (isWin$2 && sig === 'SIGHUP') {
|
|
213
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
214
|
+
// so use a supported signal instead
|
|
215
|
+
sig = 'SIGINT';
|
|
216
|
+
}
|
|
217
|
+
/* istanbul ignore next */
|
|
218
|
+
process$1.kill(process$1.pid, sig);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
signalExit.exports.signals = function () {
|
|
224
|
+
return signals
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
var loaded = false;
|
|
228
|
+
|
|
229
|
+
var load = function load () {
|
|
230
|
+
if (loaded || !processOk(commonjsGlobal.process)) {
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
loaded = true;
|
|
234
|
+
|
|
235
|
+
// This is the number of onSignalExit's that are in play.
|
|
236
|
+
// It's important so that we can count the correct number of
|
|
237
|
+
// listeners on signals, and don't wait for the other one to
|
|
238
|
+
// handle it instead of us.
|
|
239
|
+
emitter.count += 1;
|
|
240
|
+
|
|
241
|
+
signals = signals.filter(function (sig) {
|
|
242
|
+
try {
|
|
243
|
+
process$1.on(sig, sigListeners[sig]);
|
|
244
|
+
return true
|
|
245
|
+
} catch (er) {
|
|
246
|
+
return false
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
process$1.emit = processEmit;
|
|
251
|
+
process$1.reallyExit = processReallyExit;
|
|
252
|
+
};
|
|
253
|
+
signalExit.exports.load = load;
|
|
254
|
+
|
|
255
|
+
var originalProcessReallyExit = process$1.reallyExit;
|
|
256
|
+
var processReallyExit = function processReallyExit (code) {
|
|
257
|
+
/* istanbul ignore if */
|
|
258
|
+
if (!processOk(commonjsGlobal.process)) {
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
process$1.exitCode = code || /* istanbul ignore next */ 0;
|
|
262
|
+
emit('exit', process$1.exitCode, null);
|
|
263
|
+
/* istanbul ignore next */
|
|
264
|
+
emit('afterexit', process$1.exitCode, null);
|
|
265
|
+
/* istanbul ignore next */
|
|
266
|
+
originalProcessReallyExit.call(process$1, process$1.exitCode);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var originalProcessEmit = process$1.emit;
|
|
270
|
+
var processEmit = function processEmit (ev, arg) {
|
|
271
|
+
if (ev === 'exit' && processOk(commonjsGlobal.process)) {
|
|
272
|
+
/* istanbul ignore else */
|
|
273
|
+
if (arg !== undefined) {
|
|
274
|
+
process$1.exitCode = arg;
|
|
275
|
+
}
|
|
276
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
277
|
+
/* istanbul ignore next */
|
|
278
|
+
emit('exit', process$1.exitCode, null);
|
|
279
|
+
/* istanbul ignore next */
|
|
280
|
+
emit('afterexit', process$1.exitCode, null);
|
|
281
|
+
/* istanbul ignore next */
|
|
282
|
+
return ret
|
|
283
|
+
} else {
|
|
284
|
+
return originalProcessEmit.apply(this, arguments)
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
16
288
|
|
|
17
289
|
var crossSpawn = {exports: {}};
|
|
18
290
|
|
|
@@ -25,7 +297,7 @@ function requireWindows () {
|
|
|
25
297
|
windows = isexe;
|
|
26
298
|
isexe.sync = sync;
|
|
27
299
|
|
|
28
|
-
var fs = require$$0;
|
|
300
|
+
var fs = require$$0$1;
|
|
29
301
|
|
|
30
302
|
function checkPathExt (path, options) {
|
|
31
303
|
var pathext = options.pathExt !== undefined ?
|
|
@@ -76,7 +348,7 @@ function requireMode () {
|
|
|
76
348
|
mode = isexe;
|
|
77
349
|
isexe.sync = sync;
|
|
78
350
|
|
|
79
|
-
var fs = require$$0;
|
|
351
|
+
var fs = require$$0$1;
|
|
80
352
|
|
|
81
353
|
function isexe (path, options, cb) {
|
|
82
354
|
fs.stat(path, function (er, stat) {
|
|
@@ -178,7 +450,7 @@ const isWindows = process.platform === 'win32' ||
|
|
|
178
450
|
process.env.OSTYPE === 'cygwin' ||
|
|
179
451
|
process.env.OSTYPE === 'msys';
|
|
180
452
|
|
|
181
|
-
const path$2 =
|
|
453
|
+
const path$2 = p;
|
|
182
454
|
const COLON = isWindows ? ';' : ':';
|
|
183
455
|
const isexe = isexe_1;
|
|
184
456
|
|
|
@@ -317,7 +589,7 @@ pathKey$2.exports = pathKey$1;
|
|
|
317
589
|
// TODO: Remove this for the next major release
|
|
318
590
|
pathKey$2.exports.default = pathKey$1;
|
|
319
591
|
|
|
320
|
-
const path$1 =
|
|
592
|
+
const path$1 = p;
|
|
321
593
|
const which = which_1;
|
|
322
594
|
const getPathKey = pathKey$2.exports;
|
|
323
595
|
|
|
@@ -435,7 +707,7 @@ var shebangCommand$1 = (string = '') => {
|
|
|
435
707
|
return argument ? `${binary} ${argument}` : binary;
|
|
436
708
|
};
|
|
437
709
|
|
|
438
|
-
const fs = require$$0;
|
|
710
|
+
const fs = require$$0$1;
|
|
439
711
|
const shebangCommand = shebangCommand$1;
|
|
440
712
|
|
|
441
713
|
function readShebang$1(command) {
|
|
@@ -457,12 +729,12 @@ function readShebang$1(command) {
|
|
|
457
729
|
|
|
458
730
|
var readShebang_1 = readShebang$1;
|
|
459
731
|
|
|
460
|
-
const path =
|
|
732
|
+
const path = p;
|
|
461
733
|
const resolveCommand = resolveCommand_1;
|
|
462
734
|
const escape = _escape;
|
|
463
735
|
const readShebang = readShebang_1;
|
|
464
736
|
|
|
465
|
-
const isWin$
|
|
737
|
+
const isWin$1 = process.platform === 'win32';
|
|
466
738
|
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
467
739
|
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
468
740
|
|
|
@@ -482,7 +754,7 @@ function detectShebang(parsed) {
|
|
|
482
754
|
}
|
|
483
755
|
|
|
484
756
|
function parseNonShell(parsed) {
|
|
485
|
-
if (!isWin$
|
|
757
|
+
if (!isWin$1) {
|
|
486
758
|
return parsed;
|
|
487
759
|
}
|
|
488
760
|
|
|
@@ -547,7 +819,7 @@ function parse$1(command, args, options) {
|
|
|
547
819
|
|
|
548
820
|
var parse_1 = parse$1;
|
|
549
821
|
|
|
550
|
-
const isWin
|
|
822
|
+
const isWin = process.platform === 'win32';
|
|
551
823
|
|
|
552
824
|
function notFoundError(original, syscall) {
|
|
553
825
|
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
@@ -560,7 +832,7 @@ function notFoundError(original, syscall) {
|
|
|
560
832
|
}
|
|
561
833
|
|
|
562
834
|
function hookChildProcess(cp, parsed) {
|
|
563
|
-
if (!isWin
|
|
835
|
+
if (!isWin) {
|
|
564
836
|
return;
|
|
565
837
|
}
|
|
566
838
|
|
|
@@ -583,7 +855,7 @@ function hookChildProcess(cp, parsed) {
|
|
|
583
855
|
}
|
|
584
856
|
|
|
585
857
|
function verifyENOENT(status, parsed) {
|
|
586
|
-
if (isWin
|
|
858
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
587
859
|
return notFoundError(parsed.original, 'spawn');
|
|
588
860
|
}
|
|
589
861
|
|
|
@@ -591,7 +863,7 @@ function verifyENOENT(status, parsed) {
|
|
|
591
863
|
}
|
|
592
864
|
|
|
593
865
|
function verifyENOENTSync(status, parsed) {
|
|
594
|
-
if (isWin
|
|
866
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
595
867
|
return notFoundError(parsed.original, 'spawnSync');
|
|
596
868
|
}
|
|
597
869
|
|
|
@@ -605,7 +877,7 @@ var enoent$1 = {
|
|
|
605
877
|
notFoundError,
|
|
606
878
|
};
|
|
607
879
|
|
|
608
|
-
const cp = require$$0$
|
|
880
|
+
const cp = require$$0$2;
|
|
609
881
|
const parse = parse_1;
|
|
610
882
|
const enoent = enoent$1;
|
|
611
883
|
|
|
@@ -1222,369 +1494,99 @@ const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription
|
|
|
1222
1494
|
return `failed with exit code ${exitCode}`;
|
|
1223
1495
|
}
|
|
1224
1496
|
|
|
1225
|
-
return 'failed';
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
const makeError = ({
|
|
1229
|
-
stdout,
|
|
1230
|
-
stderr,
|
|
1231
|
-
all,
|
|
1232
|
-
error,
|
|
1233
|
-
signal,
|
|
1234
|
-
exitCode,
|
|
1235
|
-
command,
|
|
1236
|
-
escapedCommand,
|
|
1237
|
-
timedOut,
|
|
1238
|
-
isCanceled,
|
|
1239
|
-
killed,
|
|
1240
|
-
parsed: {options: {timeout}},
|
|
1241
|
-
}) => {
|
|
1242
|
-
// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
|
|
1243
|
-
// We normalize them to `undefined`
|
|
1244
|
-
exitCode = exitCode === null ? undefined : exitCode;
|
|
1245
|
-
signal = signal === null ? undefined : signal;
|
|
1246
|
-
const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
|
|
1247
|
-
|
|
1248
|
-
const errorCode = error && error.code;
|
|
1249
|
-
|
|
1250
|
-
const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
|
|
1251
|
-
const execaMessage = `Command ${prefix}: ${command}`;
|
|
1252
|
-
const isError = Object.prototype.toString.call(error) === '[object Error]';
|
|
1253
|
-
const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
|
|
1254
|
-
const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
|
|
1255
|
-
|
|
1256
|
-
if (isError) {
|
|
1257
|
-
error.originalMessage = error.message;
|
|
1258
|
-
error.message = message;
|
|
1259
|
-
} else {
|
|
1260
|
-
error = new Error(message);
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
error.shortMessage = shortMessage;
|
|
1264
|
-
error.command = command;
|
|
1265
|
-
error.escapedCommand = escapedCommand;
|
|
1266
|
-
error.exitCode = exitCode;
|
|
1267
|
-
error.signal = signal;
|
|
1268
|
-
error.signalDescription = signalDescription;
|
|
1269
|
-
error.stdout = stdout;
|
|
1270
|
-
error.stderr = stderr;
|
|
1271
|
-
|
|
1272
|
-
if (all !== undefined) {
|
|
1273
|
-
error.all = all;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
if ('bufferedData' in error) {
|
|
1277
|
-
delete error.bufferedData;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
error.failed = true;
|
|
1281
|
-
error.timedOut = Boolean(timedOut);
|
|
1282
|
-
error.isCanceled = isCanceled;
|
|
1283
|
-
error.killed = killed && !timedOut;
|
|
1284
|
-
|
|
1285
|
-
return error;
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
const aliases = ['stdin', 'stdout', 'stderr'];
|
|
1289
|
-
|
|
1290
|
-
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
|
|
1291
|
-
|
|
1292
|
-
const normalizeStdio = options => {
|
|
1293
|
-
if (!options) {
|
|
1294
|
-
return;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
const {stdio} = options;
|
|
1298
|
-
|
|
1299
|
-
if (stdio === undefined) {
|
|
1300
|
-
return aliases.map(alias => options[alias]);
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
if (hasAlias(options)) {
|
|
1304
|
-
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
if (typeof stdio === 'string') {
|
|
1308
|
-
return stdio;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
if (!Array.isArray(stdio)) {
|
|
1312
|
-
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
const length = Math.max(stdio.length, aliases.length);
|
|
1316
|
-
return Array.from({length}, (value, index) => stdio[index]);
|
|
1317
|
-
};
|
|
1318
|
-
|
|
1319
|
-
var signalExit = {exports: {}};
|
|
1320
|
-
|
|
1321
|
-
var signals$1 = {exports: {}};
|
|
1322
|
-
|
|
1323
|
-
var hasRequiredSignals;
|
|
1324
|
-
|
|
1325
|
-
function requireSignals () {
|
|
1326
|
-
if (hasRequiredSignals) return signals$1.exports;
|
|
1327
|
-
hasRequiredSignals = 1;
|
|
1328
|
-
(function (module) {
|
|
1329
|
-
// This is not the set of all possible signals.
|
|
1330
|
-
//
|
|
1331
|
-
// It IS, however, the set of all signals that trigger
|
|
1332
|
-
// an exit on either Linux or BSD systems. Linux is a
|
|
1333
|
-
// superset of the signal names supported on BSD, and
|
|
1334
|
-
// the unknown signals just fail to register, so we can
|
|
1335
|
-
// catch that easily enough.
|
|
1336
|
-
//
|
|
1337
|
-
// Don't bother with SIGKILL. It's uncatchable, which
|
|
1338
|
-
// means that we can't fire any callbacks anyway.
|
|
1339
|
-
//
|
|
1340
|
-
// If a user does happen to register a handler on a non-
|
|
1341
|
-
// fatal signal like SIGWINCH or something, and then
|
|
1342
|
-
// exit, it'll end up firing `process.emit('exit')`, so
|
|
1343
|
-
// the handler will be fired anyway.
|
|
1344
|
-
//
|
|
1345
|
-
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1346
|
-
// artificially, inherently leave the process in a
|
|
1347
|
-
// state from which it is not safe to try and enter JS
|
|
1348
|
-
// listeners.
|
|
1349
|
-
module.exports = [
|
|
1350
|
-
'SIGABRT',
|
|
1351
|
-
'SIGALRM',
|
|
1352
|
-
'SIGHUP',
|
|
1353
|
-
'SIGINT',
|
|
1354
|
-
'SIGTERM'
|
|
1355
|
-
];
|
|
1356
|
-
|
|
1357
|
-
if (process.platform !== 'win32') {
|
|
1358
|
-
module.exports.push(
|
|
1359
|
-
'SIGVTALRM',
|
|
1360
|
-
'SIGXCPU',
|
|
1361
|
-
'SIGXFSZ',
|
|
1362
|
-
'SIGUSR2',
|
|
1363
|
-
'SIGTRAP',
|
|
1364
|
-
'SIGSYS',
|
|
1365
|
-
'SIGQUIT',
|
|
1366
|
-
'SIGIOT'
|
|
1367
|
-
// should detect profiler and enable/disable accordingly.
|
|
1368
|
-
// see #21
|
|
1369
|
-
// 'SIGPROF'
|
|
1370
|
-
);
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
if (process.platform === 'linux') {
|
|
1374
|
-
module.exports.push(
|
|
1375
|
-
'SIGIO',
|
|
1376
|
-
'SIGPOLL',
|
|
1377
|
-
'SIGPWR',
|
|
1378
|
-
'SIGSTKFLT',
|
|
1379
|
-
'SIGUNUSED'
|
|
1380
|
-
);
|
|
1381
|
-
}
|
|
1382
|
-
} (signals$1));
|
|
1383
|
-
return signals$1.exports;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
// Note: since nyc uses this module to output coverage, any lines
|
|
1387
|
-
// that are in the direct sync flow of nyc's outputCoverage are
|
|
1388
|
-
// ignored, since we can never get coverage for them.
|
|
1389
|
-
// grab a reference to node's real process object right away
|
|
1390
|
-
var process$1 = commonjsGlobal.process;
|
|
1391
|
-
|
|
1392
|
-
const processOk = function (process) {
|
|
1393
|
-
return process &&
|
|
1394
|
-
typeof process === 'object' &&
|
|
1395
|
-
typeof process.removeListener === 'function' &&
|
|
1396
|
-
typeof process.emit === 'function' &&
|
|
1397
|
-
typeof process.reallyExit === 'function' &&
|
|
1398
|
-
typeof process.listeners === 'function' &&
|
|
1399
|
-
typeof process.kill === 'function' &&
|
|
1400
|
-
typeof process.pid === 'number' &&
|
|
1401
|
-
typeof process.on === 'function'
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
// some kind of non-node environment, just no-op
|
|
1405
|
-
/* istanbul ignore if */
|
|
1406
|
-
if (!processOk(process$1)) {
|
|
1407
|
-
signalExit.exports = function () {
|
|
1408
|
-
return function () {}
|
|
1409
|
-
};
|
|
1410
|
-
} else {
|
|
1411
|
-
var assert = require$$0$2;
|
|
1412
|
-
var signals = requireSignals();
|
|
1413
|
-
var isWin = /^win/i.test(process$1.platform);
|
|
1414
|
-
|
|
1415
|
-
var EE = require$$2;
|
|
1416
|
-
/* istanbul ignore if */
|
|
1417
|
-
if (typeof EE !== 'function') {
|
|
1418
|
-
EE = EE.EventEmitter;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
var emitter;
|
|
1422
|
-
if (process$1.__signal_exit_emitter__) {
|
|
1423
|
-
emitter = process$1.__signal_exit_emitter__;
|
|
1424
|
-
} else {
|
|
1425
|
-
emitter = process$1.__signal_exit_emitter__ = new EE();
|
|
1426
|
-
emitter.count = 0;
|
|
1427
|
-
emitter.emitted = {};
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
// Because this emitter is a global, we have to check to see if a
|
|
1431
|
-
// previous version of this library failed to enable infinite listeners.
|
|
1432
|
-
// I know what you're about to say. But literally everything about
|
|
1433
|
-
// signal-exit is a compromise with evil. Get used to it.
|
|
1434
|
-
if (!emitter.infinite) {
|
|
1435
|
-
emitter.setMaxListeners(Infinity);
|
|
1436
|
-
emitter.infinite = true;
|
|
1437
|
-
}
|
|
1497
|
+
return 'failed';
|
|
1498
|
+
};
|
|
1438
1499
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1500
|
+
const makeError = ({
|
|
1501
|
+
stdout,
|
|
1502
|
+
stderr,
|
|
1503
|
+
all,
|
|
1504
|
+
error,
|
|
1505
|
+
signal,
|
|
1506
|
+
exitCode,
|
|
1507
|
+
command,
|
|
1508
|
+
escapedCommand,
|
|
1509
|
+
timedOut,
|
|
1510
|
+
isCanceled,
|
|
1511
|
+
killed,
|
|
1512
|
+
parsed: {options: {timeout}},
|
|
1513
|
+
}) => {
|
|
1514
|
+
// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
|
|
1515
|
+
// We normalize them to `undefined`
|
|
1516
|
+
exitCode = exitCode === null ? undefined : exitCode;
|
|
1517
|
+
signal = signal === null ? undefined : signal;
|
|
1518
|
+
const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
|
|
1445
1519
|
|
|
1446
|
-
|
|
1447
|
-
load();
|
|
1448
|
-
}
|
|
1520
|
+
const errorCode = error && error.code;
|
|
1449
1521
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1522
|
+
const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
|
|
1523
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
1524
|
+
const isError = Object.prototype.toString.call(error) === '[object Error]';
|
|
1525
|
+
const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
|
|
1526
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
|
|
1454
1527
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
};
|
|
1462
|
-
emitter.on(ev, cb);
|
|
1528
|
+
if (isError) {
|
|
1529
|
+
error.originalMessage = error.message;
|
|
1530
|
+
error.message = message;
|
|
1531
|
+
} else {
|
|
1532
|
+
error = new Error(message);
|
|
1533
|
+
}
|
|
1463
1534
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1535
|
+
error.shortMessage = shortMessage;
|
|
1536
|
+
error.command = command;
|
|
1537
|
+
error.escapedCommand = escapedCommand;
|
|
1538
|
+
error.exitCode = exitCode;
|
|
1539
|
+
error.signal = signal;
|
|
1540
|
+
error.signalDescription = signalDescription;
|
|
1541
|
+
error.stdout = stdout;
|
|
1542
|
+
error.stderr = stderr;
|
|
1466
1543
|
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
}
|
|
1471
|
-
loaded = false;
|
|
1544
|
+
if (all !== undefined) {
|
|
1545
|
+
error.all = all;
|
|
1546
|
+
}
|
|
1472
1547
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
} catch (er) {}
|
|
1477
|
-
});
|
|
1478
|
-
process$1.emit = originalProcessEmit;
|
|
1479
|
-
process$1.reallyExit = originalProcessReallyExit;
|
|
1480
|
-
emitter.count -= 1;
|
|
1481
|
-
};
|
|
1482
|
-
signalExit.exports.unload = unload;
|
|
1548
|
+
if ('bufferedData' in error) {
|
|
1549
|
+
delete error.bufferedData;
|
|
1550
|
+
}
|
|
1483
1551
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
}
|
|
1489
|
-
emitter.emitted[event] = true;
|
|
1490
|
-
emitter.emit(event, code, signal);
|
|
1491
|
-
};
|
|
1552
|
+
error.failed = true;
|
|
1553
|
+
error.timedOut = Boolean(timedOut);
|
|
1554
|
+
error.isCanceled = isCanceled;
|
|
1555
|
+
error.killed = killed && !timedOut;
|
|
1492
1556
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
signals.forEach(function (sig) {
|
|
1496
|
-
sigListeners[sig] = function listener () {
|
|
1497
|
-
/* istanbul ignore if */
|
|
1498
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
1499
|
-
return
|
|
1500
|
-
}
|
|
1501
|
-
// If there are no other listeners, an exit is coming!
|
|
1502
|
-
// Simplest way: remove us and then re-send the signal.
|
|
1503
|
-
// We know that this will kill the process, so we can
|
|
1504
|
-
// safely emit now.
|
|
1505
|
-
var listeners = process$1.listeners(sig);
|
|
1506
|
-
if (listeners.length === emitter.count) {
|
|
1507
|
-
unload();
|
|
1508
|
-
emit('exit', null, sig);
|
|
1509
|
-
/* istanbul ignore next */
|
|
1510
|
-
emit('afterexit', null, sig);
|
|
1511
|
-
/* istanbul ignore next */
|
|
1512
|
-
if (isWin && sig === 'SIGHUP') {
|
|
1513
|
-
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
1514
|
-
// so use a supported signal instead
|
|
1515
|
-
sig = 'SIGINT';
|
|
1516
|
-
}
|
|
1517
|
-
/* istanbul ignore next */
|
|
1518
|
-
process$1.kill(process$1.pid, sig);
|
|
1519
|
-
}
|
|
1520
|
-
};
|
|
1521
|
-
});
|
|
1557
|
+
return error;
|
|
1558
|
+
};
|
|
1522
1559
|
|
|
1523
|
-
|
|
1524
|
-
return signals
|
|
1525
|
-
};
|
|
1560
|
+
const aliases = ['stdin', 'stdout', 'stderr'];
|
|
1526
1561
|
|
|
1527
|
-
|
|
1562
|
+
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
|
|
1528
1563
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
loaded = true;
|
|
1564
|
+
const normalizeStdio = options => {
|
|
1565
|
+
if (!options) {
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1534
1568
|
|
|
1535
|
-
|
|
1536
|
-
// It's important so that we can count the correct number of
|
|
1537
|
-
// listeners on signals, and don't wait for the other one to
|
|
1538
|
-
// handle it instead of us.
|
|
1539
|
-
emitter.count += 1;
|
|
1569
|
+
const {stdio} = options;
|
|
1540
1570
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
return true
|
|
1545
|
-
} catch (er) {
|
|
1546
|
-
return false
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1571
|
+
if (stdio === undefined) {
|
|
1572
|
+
return aliases.map(alias => options[alias]);
|
|
1573
|
+
}
|
|
1549
1574
|
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
signalExit.exports.load = load;
|
|
1575
|
+
if (hasAlias(options)) {
|
|
1576
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
|
|
1577
|
+
}
|
|
1554
1578
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
1559
|
-
return
|
|
1560
|
-
}
|
|
1561
|
-
process$1.exitCode = code || /* istanbul ignore next */ 0;
|
|
1562
|
-
emit('exit', process$1.exitCode, null);
|
|
1563
|
-
/* istanbul ignore next */
|
|
1564
|
-
emit('afterexit', process$1.exitCode, null);
|
|
1565
|
-
/* istanbul ignore next */
|
|
1566
|
-
originalProcessReallyExit.call(process$1, process$1.exitCode);
|
|
1567
|
-
};
|
|
1579
|
+
if (typeof stdio === 'string') {
|
|
1580
|
+
return stdio;
|
|
1581
|
+
}
|
|
1568
1582
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
var ret = originalProcessEmit.apply(this, arguments);
|
|
1577
|
-
/* istanbul ignore next */
|
|
1578
|
-
emit('exit', process$1.exitCode, null);
|
|
1579
|
-
/* istanbul ignore next */
|
|
1580
|
-
emit('afterexit', process$1.exitCode, null);
|
|
1581
|
-
/* istanbul ignore next */
|
|
1582
|
-
return ret
|
|
1583
|
-
} else {
|
|
1584
|
-
return originalProcessEmit.apply(this, arguments)
|
|
1585
|
-
}
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1583
|
+
if (!Array.isArray(stdio)) {
|
|
1584
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
1588
|
+
return Array.from({length}, (value, index) => stdio[index]);
|
|
1589
|
+
};
|
|
1588
1590
|
|
|
1589
1591
|
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
|
1590
1592
|
|
|
@@ -1692,6 +1694,52 @@ function isStream(stream) {
|
|
|
1692
1694
|
&& typeof stream.pipe === 'function';
|
|
1693
1695
|
}
|
|
1694
1696
|
|
|
1697
|
+
function isWritableStream(stream) {
|
|
1698
|
+
return isStream(stream)
|
|
1699
|
+
&& stream.writable !== false
|
|
1700
|
+
&& typeof stream._write === 'function'
|
|
1701
|
+
&& typeof stream._writableState === 'object';
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
const isExecaChildProcess = target => target instanceof ChildProcess && typeof target.then === 'function';
|
|
1705
|
+
|
|
1706
|
+
const pipeToTarget = (spawned, streamName, target) => {
|
|
1707
|
+
if (typeof target === 'string') {
|
|
1708
|
+
spawned[streamName].pipe(createWriteStream(target));
|
|
1709
|
+
return spawned;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
if (isWritableStream(target)) {
|
|
1713
|
+
spawned[streamName].pipe(target);
|
|
1714
|
+
return spawned;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
if (!isExecaChildProcess(target)) {
|
|
1718
|
+
throw new TypeError('The second argument must be a string, a stream or an Execa child process.');
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
if (!isWritableStream(target.stdin)) {
|
|
1722
|
+
throw new TypeError('The target child process\'s stdin must be available.');
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
spawned[streamName].pipe(target.stdin);
|
|
1726
|
+
return target;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
const addPipeMethods = spawned => {
|
|
1730
|
+
if (spawned.stdout !== null) {
|
|
1731
|
+
spawned.pipeStdout = pipeToTarget.bind(undefined, spawned, 'stdout');
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
if (spawned.stderr !== null) {
|
|
1735
|
+
spawned.pipeStderr = pipeToTarget.bind(undefined, spawned, 'stderr');
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
if (spawned.all !== undefined) {
|
|
1739
|
+
spawned.pipeAll = pipeToTarget.bind(undefined, spawned, 'all');
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1695
1743
|
var getStream$1 = {exports: {}};
|
|
1696
1744
|
|
|
1697
1745
|
const {PassThrough: PassThroughStream} = require$$0$3;
|
|
@@ -1847,8 +1895,25 @@ var mergeStream = function (/*streams...*/) {
|
|
|
1847
1895
|
}
|
|
1848
1896
|
};
|
|
1849
1897
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1898
|
+
const validateInputOptions = input => {
|
|
1899
|
+
if (input !== undefined) {
|
|
1900
|
+
throw new TypeError('The `input` and `inputFile` options cannot be both set.');
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
const getInput = ({input, inputFile}) => {
|
|
1905
|
+
if (typeof inputFile !== 'string') {
|
|
1906
|
+
return input;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
validateInputOptions(input);
|
|
1910
|
+
return createReadStream(inputFile);
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1913
|
+
// `input` and `inputFile` option in async mode
|
|
1914
|
+
const handleInput = (spawned, options) => {
|
|
1915
|
+
const input = getInput(options);
|
|
1916
|
+
|
|
1852
1917
|
if (input === undefined) {
|
|
1853
1918
|
return;
|
|
1854
1919
|
}
|
|
@@ -1943,8 +2008,6 @@ const mergePromise = (spawned, promise) => {
|
|
|
1943
2008
|
|
|
1944
2009
|
Reflect.defineProperty(spawned, property, {...descriptor, value});
|
|
1945
2010
|
}
|
|
1946
|
-
|
|
1947
|
-
return spawned;
|
|
1948
2011
|
};
|
|
1949
2012
|
|
|
1950
2013
|
// Use promises instead of `child_process` events
|
|
@@ -1987,6 +2050,23 @@ const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');
|
|
|
1987
2050
|
|
|
1988
2051
|
const getEscapedCommand = (file, args) => normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
|
1989
2052
|
|
|
2053
|
+
const verboseDefault = debuglog('execa').enabled;
|
|
2054
|
+
|
|
2055
|
+
const padField = (field, padding) => String(field).padStart(padding, '0');
|
|
2056
|
+
|
|
2057
|
+
const getTimestamp = () => {
|
|
2058
|
+
const date = new Date();
|
|
2059
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
const logCommand = (escapedCommand, {verbose}) => {
|
|
2063
|
+
if (!verbose) {
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
process$2.stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
|
|
2068
|
+
};
|
|
2069
|
+
|
|
1990
2070
|
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
|
|
1991
2071
|
|
|
1992
2072
|
const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
|
|
@@ -2018,6 +2098,7 @@ const handleArguments = (file, args, options = {}) => {
|
|
|
2018
2098
|
cleanup: true,
|
|
2019
2099
|
all: false,
|
|
2020
2100
|
windowsHide: true,
|
|
2101
|
+
verbose: verboseDefault,
|
|
2021
2102
|
...options,
|
|
2022
2103
|
};
|
|
2023
2104
|
|
|
@@ -2050,6 +2131,7 @@ function execa(file, args, options) {
|
|
|
2050
2131
|
const parsed = handleArguments(file, args, options);
|
|
2051
2132
|
const command = joinCommand(file, args);
|
|
2052
2133
|
const escapedCommand = getEscapedCommand(file, args);
|
|
2134
|
+
logCommand(escapedCommand, parsed.options);
|
|
2053
2135
|
|
|
2054
2136
|
validateTimeout(parsed.options);
|
|
2055
2137
|
|
|
@@ -2071,7 +2153,8 @@ function execa(file, args, options) {
|
|
|
2071
2153
|
isCanceled: false,
|
|
2072
2154
|
killed: false,
|
|
2073
2155
|
}));
|
|
2074
|
-
|
|
2156
|
+
mergePromise(dummySpawned, errorPromise);
|
|
2157
|
+
return dummySpawned;
|
|
2075
2158
|
}
|
|
2076
2159
|
|
|
2077
2160
|
const spawnedPromise = getSpawnedPromise(spawned);
|
|
@@ -2101,7 +2184,7 @@ function execa(file, args, options) {
|
|
|
2101
2184
|
escapedCommand,
|
|
2102
2185
|
parsed,
|
|
2103
2186
|
timedOut,
|
|
2104
|
-
isCanceled:
|
|
2187
|
+
isCanceled: (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
2105
2188
|
killed: spawned.killed,
|
|
2106
2189
|
});
|
|
2107
2190
|
|
|
@@ -2128,11 +2211,13 @@ function execa(file, args, options) {
|
|
|
2128
2211
|
|
|
2129
2212
|
const handlePromiseOnce = onetime(handlePromise);
|
|
2130
2213
|
|
|
2131
|
-
handleInput(spawned, parsed.options
|
|
2214
|
+
handleInput(spawned, parsed.options);
|
|
2132
2215
|
|
|
2133
2216
|
spawned.all = makeAllStream(spawned, parsed.options);
|
|
2134
2217
|
|
|
2135
|
-
|
|
2218
|
+
addPipeMethods(spawned);
|
|
2219
|
+
mergePromise(spawned, handlePromiseOnce);
|
|
2220
|
+
return spawned;
|
|
2136
2221
|
}
|
|
2137
2222
|
|
|
2138
2223
|
export { crossSpawn as c, execa as e, getStream$1 as g, mergeStream as m, pathKey$2 as p, signalExit as s };
|