vitest 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -498
- package/dist/browser.d.ts +1 -2
- package/dist/browser.js +4 -4
- package/dist/child.js +15 -18
- package/dist/{chunk-api-setup.37a43981.js → chunks/api-setup.jHV5vgr2.js} +101 -39
- package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
- package/dist/chunks/integrations-globals.-pds_Gug.js +29 -0
- package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
- package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.iCAG0Yz3.js} +1 -1
- package/dist/cli-wrapper.js +2 -18
- package/dist/cli.js +21 -23
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +4 -7
- package/dist/config.js +2 -1
- package/dist/coverage.d.ts +25 -16
- package/dist/coverage.js +118 -49
- package/dist/entry-vm.js +13 -13
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -3
- package/dist/execute.js +3 -4
- package/dist/index.d.ts +396 -95
- package/dist/index.js +10 -10
- package/dist/node.d.ts +10 -6
- package/dist/node.js +17 -22
- package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
- package/dist/{reporters-1678fe04.d.ts → reporters-ANEBTnOh.d.ts} +336 -340
- package/dist/reporters.d.ts +1 -2
- package/dist/reporters.js +7 -8
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +8 -9
- package/dist/{suite-0579b50d.d.ts → suite-C1OmA61l.d.ts} +1 -1
- package/dist/suite.d.ts +2 -3
- package/dist/suite.js +3 -3
- package/dist/{vendor-benchmark.44931cfa.js → vendor/benchmark.WVm6DARl.js} +1 -1
- package/dist/{vendor-execute.e6e4e89b.js → vendor/execute.aMjV5C9u.js} +4 -7
- package/dist/vendor/global.L7JRz1qU.js +14 -0
- package/dist/{vendor-index.68ecee35.js → vendor/index.Npc-eff0.js} +11 -4
- package/dist/{vendor-index.29282562.js → vendor/index.XU72Rmy8.js} +1 -1
- package/dist/{vendor-index.3d079eea.js → vendor/index.h0j9y5vy.js} +5 -5
- package/dist/vendor/index.xL8XjTLv.js +3962 -0
- package/dist/vendor/loader.CU0NY2Is.js +39 -0
- package/dist/{vendor-node.327f8f1f.js → vendor/node.c-kzGvOB.js} +2192 -5614
- package/dist/{vendor-reporters.b9600369.js → vendor/reporters.1xKxm8im.js} +424 -374
- package/dist/{vendor-rpc.cbd8e972.js → vendor/rpc.Bl-ysZIr.js} +1 -1
- package/dist/{vendor-run-once.3e5ef7d7.js → vendor/run-once.X3E7xx3F.js} +1 -1
- package/dist/{vendor-vi.d30b47ae.js → vendor/vi.voNYQWB_.js} +35 -38
- package/dist/vm.js +16 -20
- package/dist/worker.js +16 -20
- package/index.cjs +5 -0
- package/package.json +50 -54
- package/dist/chunk-install-pkg.6349b322.js +0 -1740
- package/dist/chunk-integrations-globals.9df12d91.js +0 -29
- package/dist/vendor-global.97e4527c.js +0 -9
- package/dist/vendor-index.8efe7746.js +0 -2236
- package/dist/vendor-loader.9c966f23.js +0 -2089
- /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
- /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
- /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
- /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
- /package/dist/{vendor-date.6e993429.js → vendor/date.W90-E5kF.js} +0 -0
- /package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.hpEVJZPC.js} +0 -0
- /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
- /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
- /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
|
@@ -1,1740 +0,0 @@
|
|
|
1
|
-
import $ from 'fs';
|
|
2
|
-
import f from 'path';
|
|
3
|
-
import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8.js';
|
|
4
|
-
import require$$0 from 'util';
|
|
5
|
-
import require$$0$2 from 'child_process';
|
|
6
|
-
import { p as pathKeyExports, s as signalExitExports, m as mergeStream$1, g as getStreamExports, c as crossSpawnExports } from './vendor-index.8efe7746.js';
|
|
7
|
-
import { o as onetimeExports } from './vendor-node.327f8f1f.js';
|
|
8
|
-
import require$$0$1 from 'os';
|
|
9
|
-
import 'node:buffer';
|
|
10
|
-
import 'node:path';
|
|
11
|
-
import 'node:child_process';
|
|
12
|
-
import 'node:process';
|
|
13
|
-
import 'node:url';
|
|
14
|
-
import 'node:os';
|
|
15
|
-
import 'assert';
|
|
16
|
-
import 'events';
|
|
17
|
-
import 'node:fs';
|
|
18
|
-
import 'buffer';
|
|
19
|
-
import 'stream';
|
|
20
|
-
import 'node:util';
|
|
21
|
-
import 'pathe';
|
|
22
|
-
import 'vite';
|
|
23
|
-
import './vendor-constants.538d9b49.js';
|
|
24
|
-
import 'picocolors';
|
|
25
|
-
import 'vite-node/utils';
|
|
26
|
-
import 'vite-node/client';
|
|
27
|
-
import '@vitest/snapshot/manager';
|
|
28
|
-
import 'vite-node/server';
|
|
29
|
-
import './vendor-index.29282562.js';
|
|
30
|
-
import 'std-env';
|
|
31
|
-
import '@vitest/runner/utils';
|
|
32
|
-
import '@vitest/utils';
|
|
33
|
-
import './vendor-global.97e4527c.js';
|
|
34
|
-
import './vendor-coverage.78040316.js';
|
|
35
|
-
import './vendor-paths.84fc7a99.js';
|
|
36
|
-
import 'node:v8';
|
|
37
|
-
import 'node:events';
|
|
38
|
-
import 'tinypool';
|
|
39
|
-
import './vendor-index.1ca68bd5.js';
|
|
40
|
-
import './vendor-base.9c08bbd0.js';
|
|
41
|
-
import 'node:worker_threads';
|
|
42
|
-
import 'node:fs/promises';
|
|
43
|
-
import 'node:perf_hooks';
|
|
44
|
-
import '@vitest/utils/source-map';
|
|
45
|
-
import 'local-pkg';
|
|
46
|
-
import 'module';
|
|
47
|
-
import 'acorn';
|
|
48
|
-
import 'acorn-walk';
|
|
49
|
-
import './vendor-reporters.b9600369.js';
|
|
50
|
-
import './chunk-runtime-console.f3263f87.js';
|
|
51
|
-
import 'node:stream';
|
|
52
|
-
import 'node:console';
|
|
53
|
-
import './vendor-date.6e993429.js';
|
|
54
|
-
import './vendor-tasks.f9d75aed.js';
|
|
55
|
-
import 'node:module';
|
|
56
|
-
import 'node:crypto';
|
|
57
|
-
import 'magic-string';
|
|
58
|
-
import 'strip-literal';
|
|
59
|
-
import './vendor-environments.dcc4a34e.js';
|
|
60
|
-
import 'node:readline';
|
|
61
|
-
import 'readline';
|
|
62
|
-
|
|
63
|
-
var findUp$1 = {exports: {}};
|
|
64
|
-
|
|
65
|
-
var locatePath = {exports: {}};
|
|
66
|
-
|
|
67
|
-
class Node {
|
|
68
|
-
/// value;
|
|
69
|
-
/// next;
|
|
70
|
-
|
|
71
|
-
constructor(value) {
|
|
72
|
-
this.value = value;
|
|
73
|
-
|
|
74
|
-
// TODO: Remove this when targeting Node.js 12.
|
|
75
|
-
this.next = undefined;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let Queue$1 = class Queue {
|
|
80
|
-
// TODO: Use private class fields when targeting Node.js 12.
|
|
81
|
-
// #_head;
|
|
82
|
-
// #_tail;
|
|
83
|
-
// #_size;
|
|
84
|
-
|
|
85
|
-
constructor() {
|
|
86
|
-
this.clear();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
enqueue(value) {
|
|
90
|
-
const node = new Node(value);
|
|
91
|
-
|
|
92
|
-
if (this._head) {
|
|
93
|
-
this._tail.next = node;
|
|
94
|
-
this._tail = node;
|
|
95
|
-
} else {
|
|
96
|
-
this._head = node;
|
|
97
|
-
this._tail = node;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this._size++;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
dequeue() {
|
|
104
|
-
const current = this._head;
|
|
105
|
-
if (!current) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
this._head = this._head.next;
|
|
110
|
-
this._size--;
|
|
111
|
-
return current.value;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
clear() {
|
|
115
|
-
this._head = undefined;
|
|
116
|
-
this._tail = undefined;
|
|
117
|
-
this._size = 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
get size() {
|
|
121
|
-
return this._size;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
* [Symbol.iterator]() {
|
|
125
|
-
let current = this._head;
|
|
126
|
-
|
|
127
|
-
while (current) {
|
|
128
|
-
yield current.value;
|
|
129
|
-
current = current.next;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
var yoctoQueue = Queue$1;
|
|
135
|
-
|
|
136
|
-
const Queue = yoctoQueue;
|
|
137
|
-
|
|
138
|
-
const pLimit$1 = concurrency => {
|
|
139
|
-
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
140
|
-
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const queue = new Queue();
|
|
144
|
-
let activeCount = 0;
|
|
145
|
-
|
|
146
|
-
const next = () => {
|
|
147
|
-
activeCount--;
|
|
148
|
-
|
|
149
|
-
if (queue.size > 0) {
|
|
150
|
-
queue.dequeue()();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const run = async (fn, resolve, ...args) => {
|
|
155
|
-
activeCount++;
|
|
156
|
-
|
|
157
|
-
const result = (async () => fn(...args))();
|
|
158
|
-
|
|
159
|
-
resolve(result);
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
await result;
|
|
163
|
-
} catch {}
|
|
164
|
-
|
|
165
|
-
next();
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
169
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
170
|
-
|
|
171
|
-
(async () => {
|
|
172
|
-
// This function needs to wait until the next microtask before comparing
|
|
173
|
-
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
|
174
|
-
// when the run function is dequeued and called. The comparison in the if-statement
|
|
175
|
-
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
|
176
|
-
await Promise.resolve();
|
|
177
|
-
|
|
178
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
179
|
-
queue.dequeue()();
|
|
180
|
-
}
|
|
181
|
-
})();
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
const generator = (fn, ...args) => new Promise(resolve => {
|
|
185
|
-
enqueue(fn, resolve, ...args);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
Object.defineProperties(generator, {
|
|
189
|
-
activeCount: {
|
|
190
|
-
get: () => activeCount
|
|
191
|
-
},
|
|
192
|
-
pendingCount: {
|
|
193
|
-
get: () => queue.size
|
|
194
|
-
},
|
|
195
|
-
clearQueue: {
|
|
196
|
-
value: () => {
|
|
197
|
-
queue.clear();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
return generator;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
var pLimit_1 = pLimit$1;
|
|
206
|
-
|
|
207
|
-
const pLimit = pLimit_1;
|
|
208
|
-
|
|
209
|
-
class EndError extends Error {
|
|
210
|
-
constructor(value) {
|
|
211
|
-
super();
|
|
212
|
-
this.value = value;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// The input can also be a promise, so we await it
|
|
217
|
-
const testElement = async (element, tester) => tester(await element);
|
|
218
|
-
|
|
219
|
-
// The input can also be a promise, so we `Promise.all()` them both
|
|
220
|
-
const finder = async element => {
|
|
221
|
-
const values = await Promise.all(element);
|
|
222
|
-
if (values[1] === true) {
|
|
223
|
-
throw new EndError(values[0]);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return false;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const pLocate$1 = async (iterable, tester, options) => {
|
|
230
|
-
options = {
|
|
231
|
-
concurrency: Infinity,
|
|
232
|
-
preserveOrder: true,
|
|
233
|
-
...options
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const limit = pLimit(options.concurrency);
|
|
237
|
-
|
|
238
|
-
// Start all the promises concurrently with optional limit
|
|
239
|
-
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
|
|
240
|
-
|
|
241
|
-
// Check the promises either serially or concurrently
|
|
242
|
-
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
|
|
243
|
-
|
|
244
|
-
try {
|
|
245
|
-
await Promise.all(items.map(element => checkLimit(finder, element)));
|
|
246
|
-
} catch (error) {
|
|
247
|
-
if (error instanceof EndError) {
|
|
248
|
-
return error.value;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
throw error;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
var pLocate_1 = pLocate$1;
|
|
256
|
-
|
|
257
|
-
const path$1 = f;
|
|
258
|
-
const fs$1 = $;
|
|
259
|
-
const {promisify: promisify$1} = require$$0;
|
|
260
|
-
const pLocate = pLocate_1;
|
|
261
|
-
|
|
262
|
-
const fsStat = promisify$1(fs$1.stat);
|
|
263
|
-
const fsLStat = promisify$1(fs$1.lstat);
|
|
264
|
-
|
|
265
|
-
const typeMappings = {
|
|
266
|
-
directory: 'isDirectory',
|
|
267
|
-
file: 'isFile'
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
function checkType({type}) {
|
|
271
|
-
if (type in typeMappings) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
|
|
279
|
-
|
|
280
|
-
locatePath.exports = async (paths, options) => {
|
|
281
|
-
options = {
|
|
282
|
-
cwd: process.cwd(),
|
|
283
|
-
type: 'file',
|
|
284
|
-
allowSymlinks: true,
|
|
285
|
-
...options
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
checkType(options);
|
|
289
|
-
|
|
290
|
-
const statFn = options.allowSymlinks ? fsStat : fsLStat;
|
|
291
|
-
|
|
292
|
-
return pLocate(paths, async path_ => {
|
|
293
|
-
try {
|
|
294
|
-
const stat = await statFn(path$1.resolve(options.cwd, path_));
|
|
295
|
-
return matchType(options.type, stat);
|
|
296
|
-
} catch {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
}, options);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
locatePath.exports.sync = (paths, options) => {
|
|
303
|
-
options = {
|
|
304
|
-
cwd: process.cwd(),
|
|
305
|
-
allowSymlinks: true,
|
|
306
|
-
type: 'file',
|
|
307
|
-
...options
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
checkType(options);
|
|
311
|
-
|
|
312
|
-
const statFn = options.allowSymlinks ? fs$1.statSync : fs$1.lstatSync;
|
|
313
|
-
|
|
314
|
-
for (const path_ of paths) {
|
|
315
|
-
try {
|
|
316
|
-
const stat = statFn(path$1.resolve(options.cwd, path_));
|
|
317
|
-
|
|
318
|
-
if (matchType(options.type, stat)) {
|
|
319
|
-
return path_;
|
|
320
|
-
}
|
|
321
|
-
} catch {}
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
var locatePathExports = locatePath.exports;
|
|
326
|
-
|
|
327
|
-
var pathExists = {exports: {}};
|
|
328
|
-
|
|
329
|
-
const fs = $;
|
|
330
|
-
const {promisify} = require$$0;
|
|
331
|
-
|
|
332
|
-
const pAccess = promisify(fs.access);
|
|
333
|
-
|
|
334
|
-
pathExists.exports = async path => {
|
|
335
|
-
try {
|
|
336
|
-
await pAccess(path);
|
|
337
|
-
return true;
|
|
338
|
-
} catch (_) {
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
pathExists.exports.sync = path => {
|
|
344
|
-
try {
|
|
345
|
-
fs.accessSync(path);
|
|
346
|
-
return true;
|
|
347
|
-
} catch (_) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
var pathExistsExports = pathExists.exports;
|
|
353
|
-
|
|
354
|
-
(function (module) {
|
|
355
|
-
const path = f;
|
|
356
|
-
const locatePath = locatePathExports;
|
|
357
|
-
const pathExists = pathExistsExports;
|
|
358
|
-
|
|
359
|
-
const stop = Symbol('findUp.stop');
|
|
360
|
-
|
|
361
|
-
module.exports = async (name, options = {}) => {
|
|
362
|
-
let directory = path.resolve(options.cwd || '');
|
|
363
|
-
const {root} = path.parse(directory);
|
|
364
|
-
const paths = [].concat(name);
|
|
365
|
-
|
|
366
|
-
const runMatcher = async locateOptions => {
|
|
367
|
-
if (typeof name !== 'function') {
|
|
368
|
-
return locatePath(paths, locateOptions);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const foundPath = await name(locateOptions.cwd);
|
|
372
|
-
if (typeof foundPath === 'string') {
|
|
373
|
-
return locatePath([foundPath], locateOptions);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return foundPath;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
// eslint-disable-next-line no-constant-condition
|
|
380
|
-
while (true) {
|
|
381
|
-
// eslint-disable-next-line no-await-in-loop
|
|
382
|
-
const foundPath = await runMatcher({...options, cwd: directory});
|
|
383
|
-
|
|
384
|
-
if (foundPath === stop) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (foundPath) {
|
|
389
|
-
return path.resolve(directory, foundPath);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
if (directory === root) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
directory = path.dirname(directory);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
module.exports.sync = (name, options = {}) => {
|
|
401
|
-
let directory = path.resolve(options.cwd || '');
|
|
402
|
-
const {root} = path.parse(directory);
|
|
403
|
-
const paths = [].concat(name);
|
|
404
|
-
|
|
405
|
-
const runMatcher = locateOptions => {
|
|
406
|
-
if (typeof name !== 'function') {
|
|
407
|
-
return locatePath.sync(paths, locateOptions);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const foundPath = name(locateOptions.cwd);
|
|
411
|
-
if (typeof foundPath === 'string') {
|
|
412
|
-
return locatePath.sync([foundPath], locateOptions);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return foundPath;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// eslint-disable-next-line no-constant-condition
|
|
419
|
-
while (true) {
|
|
420
|
-
const foundPath = runMatcher({...options, cwd: directory});
|
|
421
|
-
|
|
422
|
-
if (foundPath === stop) {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (foundPath) {
|
|
427
|
-
return path.resolve(directory, foundPath);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (directory === root) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
directory = path.dirname(directory);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
module.exports.exists = pathExists;
|
|
439
|
-
|
|
440
|
-
module.exports.sync.exists = pathExists.sync;
|
|
441
|
-
|
|
442
|
-
module.exports.stop = stop;
|
|
443
|
-
} (findUp$1));
|
|
444
|
-
|
|
445
|
-
var findUpExports = findUp$1.exports;
|
|
446
|
-
var findUp = /*@__PURE__*/getDefaultExportFromCjs(findUpExports);
|
|
447
|
-
|
|
448
|
-
var execa$2 = {exports: {}};
|
|
449
|
-
|
|
450
|
-
var stripFinalNewline$1 = input => {
|
|
451
|
-
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
452
|
-
const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
|
|
453
|
-
|
|
454
|
-
if (input[input.length - 1] === LF) {
|
|
455
|
-
input = input.slice(0, input.length - 1);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (input[input.length - 1] === CR) {
|
|
459
|
-
input = input.slice(0, input.length - 1);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return input;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
var npmRunPath$1 = {exports: {}};
|
|
466
|
-
|
|
467
|
-
npmRunPath$1.exports;
|
|
468
|
-
|
|
469
|
-
(function (module) {
|
|
470
|
-
const path = f;
|
|
471
|
-
const pathKey = pathKeyExports;
|
|
472
|
-
|
|
473
|
-
const npmRunPath = options => {
|
|
474
|
-
options = {
|
|
475
|
-
cwd: process.cwd(),
|
|
476
|
-
path: process.env[pathKey()],
|
|
477
|
-
execPath: process.execPath,
|
|
478
|
-
...options
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
let previous;
|
|
482
|
-
let cwdPath = path.resolve(options.cwd);
|
|
483
|
-
const result = [];
|
|
484
|
-
|
|
485
|
-
while (previous !== cwdPath) {
|
|
486
|
-
result.push(path.join(cwdPath, 'node_modules/.bin'));
|
|
487
|
-
previous = cwdPath;
|
|
488
|
-
cwdPath = path.resolve(cwdPath, '..');
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// Ensure the running `node` binary is used
|
|
492
|
-
const execPathDir = path.resolve(options.cwd, options.execPath, '..');
|
|
493
|
-
result.push(execPathDir);
|
|
494
|
-
|
|
495
|
-
return result.concat(options.path).join(path.delimiter);
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
module.exports = npmRunPath;
|
|
499
|
-
// TODO: Remove this for the next major release
|
|
500
|
-
module.exports.default = npmRunPath;
|
|
501
|
-
|
|
502
|
-
module.exports.env = options => {
|
|
503
|
-
options = {
|
|
504
|
-
env: process.env,
|
|
505
|
-
...options
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
const env = {...options.env};
|
|
509
|
-
const path = pathKey({env});
|
|
510
|
-
|
|
511
|
-
options.path = env[path];
|
|
512
|
-
env[path] = module.exports(options);
|
|
513
|
-
|
|
514
|
-
return env;
|
|
515
|
-
};
|
|
516
|
-
} (npmRunPath$1));
|
|
517
|
-
|
|
518
|
-
var npmRunPathExports = npmRunPath$1.exports;
|
|
519
|
-
|
|
520
|
-
var main = {};
|
|
521
|
-
|
|
522
|
-
var signals = {};
|
|
523
|
-
|
|
524
|
-
var core = {};
|
|
525
|
-
|
|
526
|
-
Object.defineProperty(core,"__esModule",{value:true});core.SIGNALS=void 0;
|
|
527
|
-
|
|
528
|
-
const SIGNALS=[
|
|
529
|
-
{
|
|
530
|
-
name:"SIGHUP",
|
|
531
|
-
number:1,
|
|
532
|
-
action:"terminate",
|
|
533
|
-
description:"Terminal closed",
|
|
534
|
-
standard:"posix"},
|
|
535
|
-
|
|
536
|
-
{
|
|
537
|
-
name:"SIGINT",
|
|
538
|
-
number:2,
|
|
539
|
-
action:"terminate",
|
|
540
|
-
description:"User interruption with CTRL-C",
|
|
541
|
-
standard:"ansi"},
|
|
542
|
-
|
|
543
|
-
{
|
|
544
|
-
name:"SIGQUIT",
|
|
545
|
-
number:3,
|
|
546
|
-
action:"core",
|
|
547
|
-
description:"User interruption with CTRL-\\",
|
|
548
|
-
standard:"posix"},
|
|
549
|
-
|
|
550
|
-
{
|
|
551
|
-
name:"SIGILL",
|
|
552
|
-
number:4,
|
|
553
|
-
action:"core",
|
|
554
|
-
description:"Invalid machine instruction",
|
|
555
|
-
standard:"ansi"},
|
|
556
|
-
|
|
557
|
-
{
|
|
558
|
-
name:"SIGTRAP",
|
|
559
|
-
number:5,
|
|
560
|
-
action:"core",
|
|
561
|
-
description:"Debugger breakpoint",
|
|
562
|
-
standard:"posix"},
|
|
563
|
-
|
|
564
|
-
{
|
|
565
|
-
name:"SIGABRT",
|
|
566
|
-
number:6,
|
|
567
|
-
action:"core",
|
|
568
|
-
description:"Aborted",
|
|
569
|
-
standard:"ansi"},
|
|
570
|
-
|
|
571
|
-
{
|
|
572
|
-
name:"SIGIOT",
|
|
573
|
-
number:6,
|
|
574
|
-
action:"core",
|
|
575
|
-
description:"Aborted",
|
|
576
|
-
standard:"bsd"},
|
|
577
|
-
|
|
578
|
-
{
|
|
579
|
-
name:"SIGBUS",
|
|
580
|
-
number:7,
|
|
581
|
-
action:"core",
|
|
582
|
-
description:
|
|
583
|
-
"Bus error due to misaligned, non-existing address or paging error",
|
|
584
|
-
standard:"bsd"},
|
|
585
|
-
|
|
586
|
-
{
|
|
587
|
-
name:"SIGEMT",
|
|
588
|
-
number:7,
|
|
589
|
-
action:"terminate",
|
|
590
|
-
description:"Command should be emulated but is not implemented",
|
|
591
|
-
standard:"other"},
|
|
592
|
-
|
|
593
|
-
{
|
|
594
|
-
name:"SIGFPE",
|
|
595
|
-
number:8,
|
|
596
|
-
action:"core",
|
|
597
|
-
description:"Floating point arithmetic error",
|
|
598
|
-
standard:"ansi"},
|
|
599
|
-
|
|
600
|
-
{
|
|
601
|
-
name:"SIGKILL",
|
|
602
|
-
number:9,
|
|
603
|
-
action:"terminate",
|
|
604
|
-
description:"Forced termination",
|
|
605
|
-
standard:"posix",
|
|
606
|
-
forced:true},
|
|
607
|
-
|
|
608
|
-
{
|
|
609
|
-
name:"SIGUSR1",
|
|
610
|
-
number:10,
|
|
611
|
-
action:"terminate",
|
|
612
|
-
description:"Application-specific signal",
|
|
613
|
-
standard:"posix"},
|
|
614
|
-
|
|
615
|
-
{
|
|
616
|
-
name:"SIGSEGV",
|
|
617
|
-
number:11,
|
|
618
|
-
action:"core",
|
|
619
|
-
description:"Segmentation fault",
|
|
620
|
-
standard:"ansi"},
|
|
621
|
-
|
|
622
|
-
{
|
|
623
|
-
name:"SIGUSR2",
|
|
624
|
-
number:12,
|
|
625
|
-
action:"terminate",
|
|
626
|
-
description:"Application-specific signal",
|
|
627
|
-
standard:"posix"},
|
|
628
|
-
|
|
629
|
-
{
|
|
630
|
-
name:"SIGPIPE",
|
|
631
|
-
number:13,
|
|
632
|
-
action:"terminate",
|
|
633
|
-
description:"Broken pipe or socket",
|
|
634
|
-
standard:"posix"},
|
|
635
|
-
|
|
636
|
-
{
|
|
637
|
-
name:"SIGALRM",
|
|
638
|
-
number:14,
|
|
639
|
-
action:"terminate",
|
|
640
|
-
description:"Timeout or timer",
|
|
641
|
-
standard:"posix"},
|
|
642
|
-
|
|
643
|
-
{
|
|
644
|
-
name:"SIGTERM",
|
|
645
|
-
number:15,
|
|
646
|
-
action:"terminate",
|
|
647
|
-
description:"Termination",
|
|
648
|
-
standard:"ansi"},
|
|
649
|
-
|
|
650
|
-
{
|
|
651
|
-
name:"SIGSTKFLT",
|
|
652
|
-
number:16,
|
|
653
|
-
action:"terminate",
|
|
654
|
-
description:"Stack is empty or overflowed",
|
|
655
|
-
standard:"other"},
|
|
656
|
-
|
|
657
|
-
{
|
|
658
|
-
name:"SIGCHLD",
|
|
659
|
-
number:17,
|
|
660
|
-
action:"ignore",
|
|
661
|
-
description:"Child process terminated, paused or unpaused",
|
|
662
|
-
standard:"posix"},
|
|
663
|
-
|
|
664
|
-
{
|
|
665
|
-
name:"SIGCLD",
|
|
666
|
-
number:17,
|
|
667
|
-
action:"ignore",
|
|
668
|
-
description:"Child process terminated, paused or unpaused",
|
|
669
|
-
standard:"other"},
|
|
670
|
-
|
|
671
|
-
{
|
|
672
|
-
name:"SIGCONT",
|
|
673
|
-
number:18,
|
|
674
|
-
action:"unpause",
|
|
675
|
-
description:"Unpaused",
|
|
676
|
-
standard:"posix",
|
|
677
|
-
forced:true},
|
|
678
|
-
|
|
679
|
-
{
|
|
680
|
-
name:"SIGSTOP",
|
|
681
|
-
number:19,
|
|
682
|
-
action:"pause",
|
|
683
|
-
description:"Paused",
|
|
684
|
-
standard:"posix",
|
|
685
|
-
forced:true},
|
|
686
|
-
|
|
687
|
-
{
|
|
688
|
-
name:"SIGTSTP",
|
|
689
|
-
number:20,
|
|
690
|
-
action:"pause",
|
|
691
|
-
description:"Paused using CTRL-Z or \"suspend\"",
|
|
692
|
-
standard:"posix"},
|
|
693
|
-
|
|
694
|
-
{
|
|
695
|
-
name:"SIGTTIN",
|
|
696
|
-
number:21,
|
|
697
|
-
action:"pause",
|
|
698
|
-
description:"Background process cannot read terminal input",
|
|
699
|
-
standard:"posix"},
|
|
700
|
-
|
|
701
|
-
{
|
|
702
|
-
name:"SIGBREAK",
|
|
703
|
-
number:21,
|
|
704
|
-
action:"terminate",
|
|
705
|
-
description:"User interruption with CTRL-BREAK",
|
|
706
|
-
standard:"other"},
|
|
707
|
-
|
|
708
|
-
{
|
|
709
|
-
name:"SIGTTOU",
|
|
710
|
-
number:22,
|
|
711
|
-
action:"pause",
|
|
712
|
-
description:"Background process cannot write to terminal output",
|
|
713
|
-
standard:"posix"},
|
|
714
|
-
|
|
715
|
-
{
|
|
716
|
-
name:"SIGURG",
|
|
717
|
-
number:23,
|
|
718
|
-
action:"ignore",
|
|
719
|
-
description:"Socket received out-of-band data",
|
|
720
|
-
standard:"bsd"},
|
|
721
|
-
|
|
722
|
-
{
|
|
723
|
-
name:"SIGXCPU",
|
|
724
|
-
number:24,
|
|
725
|
-
action:"core",
|
|
726
|
-
description:"Process timed out",
|
|
727
|
-
standard:"bsd"},
|
|
728
|
-
|
|
729
|
-
{
|
|
730
|
-
name:"SIGXFSZ",
|
|
731
|
-
number:25,
|
|
732
|
-
action:"core",
|
|
733
|
-
description:"File too big",
|
|
734
|
-
standard:"bsd"},
|
|
735
|
-
|
|
736
|
-
{
|
|
737
|
-
name:"SIGVTALRM",
|
|
738
|
-
number:26,
|
|
739
|
-
action:"terminate",
|
|
740
|
-
description:"Timeout or timer",
|
|
741
|
-
standard:"bsd"},
|
|
742
|
-
|
|
743
|
-
{
|
|
744
|
-
name:"SIGPROF",
|
|
745
|
-
number:27,
|
|
746
|
-
action:"terminate",
|
|
747
|
-
description:"Timeout or timer",
|
|
748
|
-
standard:"bsd"},
|
|
749
|
-
|
|
750
|
-
{
|
|
751
|
-
name:"SIGWINCH",
|
|
752
|
-
number:28,
|
|
753
|
-
action:"ignore",
|
|
754
|
-
description:"Terminal window size changed",
|
|
755
|
-
standard:"bsd"},
|
|
756
|
-
|
|
757
|
-
{
|
|
758
|
-
name:"SIGIO",
|
|
759
|
-
number:29,
|
|
760
|
-
action:"terminate",
|
|
761
|
-
description:"I/O is available",
|
|
762
|
-
standard:"other"},
|
|
763
|
-
|
|
764
|
-
{
|
|
765
|
-
name:"SIGPOLL",
|
|
766
|
-
number:29,
|
|
767
|
-
action:"terminate",
|
|
768
|
-
description:"Watched event",
|
|
769
|
-
standard:"other"},
|
|
770
|
-
|
|
771
|
-
{
|
|
772
|
-
name:"SIGINFO",
|
|
773
|
-
number:29,
|
|
774
|
-
action:"ignore",
|
|
775
|
-
description:"Request for process information",
|
|
776
|
-
standard:"other"},
|
|
777
|
-
|
|
778
|
-
{
|
|
779
|
-
name:"SIGPWR",
|
|
780
|
-
number:30,
|
|
781
|
-
action:"terminate",
|
|
782
|
-
description:"Device running out of power",
|
|
783
|
-
standard:"systemv"},
|
|
784
|
-
|
|
785
|
-
{
|
|
786
|
-
name:"SIGSYS",
|
|
787
|
-
number:31,
|
|
788
|
-
action:"core",
|
|
789
|
-
description:"Invalid system call",
|
|
790
|
-
standard:"other"},
|
|
791
|
-
|
|
792
|
-
{
|
|
793
|
-
name:"SIGUNUSED",
|
|
794
|
-
number:31,
|
|
795
|
-
action:"terminate",
|
|
796
|
-
description:"Invalid system call",
|
|
797
|
-
standard:"other"}];core.SIGNALS=SIGNALS;
|
|
798
|
-
|
|
799
|
-
var realtime = {};
|
|
800
|
-
|
|
801
|
-
Object.defineProperty(realtime,"__esModule",{value:true});realtime.SIGRTMAX=realtime.getRealtimeSignals=void 0;
|
|
802
|
-
const getRealtimeSignals=function(){
|
|
803
|
-
const length=SIGRTMAX-SIGRTMIN+1;
|
|
804
|
-
return Array.from({length},getRealtimeSignal);
|
|
805
|
-
};realtime.getRealtimeSignals=getRealtimeSignals;
|
|
806
|
-
|
|
807
|
-
const getRealtimeSignal=function(value,index){
|
|
808
|
-
return {
|
|
809
|
-
name:`SIGRT${index+1}`,
|
|
810
|
-
number:SIGRTMIN+index,
|
|
811
|
-
action:"terminate",
|
|
812
|
-
description:"Application-specific signal (realtime)",
|
|
813
|
-
standard:"posix"};
|
|
814
|
-
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
const SIGRTMIN=34;
|
|
818
|
-
const SIGRTMAX=64;realtime.SIGRTMAX=SIGRTMAX;
|
|
819
|
-
|
|
820
|
-
Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0$1;
|
|
821
|
-
|
|
822
|
-
var _core=core;
|
|
823
|
-
var _realtime$1=realtime;
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
const getSignals=function(){
|
|
828
|
-
const realtimeSignals=(0, _realtime$1.getRealtimeSignals)();
|
|
829
|
-
const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal);
|
|
830
|
-
return signals;
|
|
831
|
-
};signals.getSignals=getSignals;
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
const normalizeSignal=function({
|
|
840
|
-
name,
|
|
841
|
-
number:defaultNumber,
|
|
842
|
-
description,
|
|
843
|
-
action,
|
|
844
|
-
forced=false,
|
|
845
|
-
standard})
|
|
846
|
-
{
|
|
847
|
-
const{
|
|
848
|
-
signals:{[name]:constantSignal}}=
|
|
849
|
-
_os$1.constants;
|
|
850
|
-
const supported=constantSignal!==undefined;
|
|
851
|
-
const number=supported?constantSignal:defaultNumber;
|
|
852
|
-
return {name,number,description,supported,action,forced,standard};
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0$1;
|
|
856
|
-
|
|
857
|
-
var _signals=signals;
|
|
858
|
-
var _realtime=realtime;
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const getSignalsByName=function(){
|
|
863
|
-
const signals=(0, _signals.getSignals)();
|
|
864
|
-
return signals.reduce(getSignalByName,{});
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
const getSignalByName=function(
|
|
868
|
-
signalByNameMemo,
|
|
869
|
-
{name,number,description,supported,action,forced,standard})
|
|
870
|
-
{
|
|
871
|
-
return {
|
|
872
|
-
...signalByNameMemo,
|
|
873
|
-
[name]:{name,number,description,supported,action,forced,standard}};
|
|
874
|
-
|
|
875
|
-
};
|
|
876
|
-
|
|
877
|
-
const signalsByName$1=getSignalsByName();main.signalsByName=signalsByName$1;
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
const getSignalsByNumber=function(){
|
|
883
|
-
const signals=(0, _signals.getSignals)();
|
|
884
|
-
const length=_realtime.SIGRTMAX+1;
|
|
885
|
-
const signalsA=Array.from({length},(value,number)=>
|
|
886
|
-
getSignalByNumber(number,signals));
|
|
887
|
-
|
|
888
|
-
return Object.assign({},...signalsA);
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
const getSignalByNumber=function(number,signals){
|
|
892
|
-
const signal=findSignalByNumber(number,signals);
|
|
893
|
-
|
|
894
|
-
if(signal===undefined){
|
|
895
|
-
return {};
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
const{name,description,supported,action,forced,standard}=signal;
|
|
899
|
-
return {
|
|
900
|
-
[number]:{
|
|
901
|
-
name,
|
|
902
|
-
number,
|
|
903
|
-
description,
|
|
904
|
-
supported,
|
|
905
|
-
action,
|
|
906
|
-
forced,
|
|
907
|
-
standard}};
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
};
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
const findSignalByNumber=function(number,signals){
|
|
915
|
-
const signal=signals.find(({name})=>_os.constants.signals[name]===number);
|
|
916
|
-
|
|
917
|
-
if(signal!==undefined){
|
|
918
|
-
return signal;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
return signals.find(signalA=>signalA.number===number);
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
const signalsByNumber=getSignalsByNumber();main.signalsByNumber=signalsByNumber;
|
|
925
|
-
|
|
926
|
-
const {signalsByName} = main;
|
|
927
|
-
|
|
928
|
-
const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
|
|
929
|
-
if (timedOut) {
|
|
930
|
-
return `timed out after ${timeout} milliseconds`;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
if (isCanceled) {
|
|
934
|
-
return 'was canceled';
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
if (errorCode !== undefined) {
|
|
938
|
-
return `failed with ${errorCode}`;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
if (signal !== undefined) {
|
|
942
|
-
return `was killed with ${signal} (${signalDescription})`;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
if (exitCode !== undefined) {
|
|
946
|
-
return `failed with exit code ${exitCode}`;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
return 'failed';
|
|
950
|
-
};
|
|
951
|
-
|
|
952
|
-
const makeError$1 = ({
|
|
953
|
-
stdout,
|
|
954
|
-
stderr,
|
|
955
|
-
all,
|
|
956
|
-
error,
|
|
957
|
-
signal,
|
|
958
|
-
exitCode,
|
|
959
|
-
command,
|
|
960
|
-
escapedCommand,
|
|
961
|
-
timedOut,
|
|
962
|
-
isCanceled,
|
|
963
|
-
killed,
|
|
964
|
-
parsed: {options: {timeout}}
|
|
965
|
-
}) => {
|
|
966
|
-
// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
|
|
967
|
-
// We normalize them to `undefined`
|
|
968
|
-
exitCode = exitCode === null ? undefined : exitCode;
|
|
969
|
-
signal = signal === null ? undefined : signal;
|
|
970
|
-
const signalDescription = signal === undefined ? undefined : signalsByName[signal].description;
|
|
971
|
-
|
|
972
|
-
const errorCode = error && error.code;
|
|
973
|
-
|
|
974
|
-
const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled});
|
|
975
|
-
const execaMessage = `Command ${prefix}: ${command}`;
|
|
976
|
-
const isError = Object.prototype.toString.call(error) === '[object Error]';
|
|
977
|
-
const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
|
|
978
|
-
const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n');
|
|
979
|
-
|
|
980
|
-
if (isError) {
|
|
981
|
-
error.originalMessage = error.message;
|
|
982
|
-
error.message = message;
|
|
983
|
-
} else {
|
|
984
|
-
error = new Error(message);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
error.shortMessage = shortMessage;
|
|
988
|
-
error.command = command;
|
|
989
|
-
error.escapedCommand = escapedCommand;
|
|
990
|
-
error.exitCode = exitCode;
|
|
991
|
-
error.signal = signal;
|
|
992
|
-
error.signalDescription = signalDescription;
|
|
993
|
-
error.stdout = stdout;
|
|
994
|
-
error.stderr = stderr;
|
|
995
|
-
|
|
996
|
-
if (all !== undefined) {
|
|
997
|
-
error.all = all;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
if ('bufferedData' in error) {
|
|
1001
|
-
delete error.bufferedData;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
error.failed = true;
|
|
1005
|
-
error.timedOut = Boolean(timedOut);
|
|
1006
|
-
error.isCanceled = isCanceled;
|
|
1007
|
-
error.killed = killed && !timedOut;
|
|
1008
|
-
|
|
1009
|
-
return error;
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
|
-
var error = makeError$1;
|
|
1013
|
-
|
|
1014
|
-
var stdio = {exports: {}};
|
|
1015
|
-
|
|
1016
|
-
const aliases = ['stdin', 'stdout', 'stderr'];
|
|
1017
|
-
|
|
1018
|
-
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
|
|
1019
|
-
|
|
1020
|
-
const normalizeStdio$1 = options => {
|
|
1021
|
-
if (!options) {
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
const {stdio} = options;
|
|
1026
|
-
|
|
1027
|
-
if (stdio === undefined) {
|
|
1028
|
-
return aliases.map(alias => options[alias]);
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
if (hasAlias(options)) {
|
|
1032
|
-
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
if (typeof stdio === 'string') {
|
|
1036
|
-
return stdio;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
if (!Array.isArray(stdio)) {
|
|
1040
|
-
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
const length = Math.max(stdio.length, aliases.length);
|
|
1044
|
-
return Array.from({length}, (value, index) => stdio[index]);
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
stdio.exports = normalizeStdio$1;
|
|
1048
|
-
|
|
1049
|
-
// `ipc` is pushed unless it is already present
|
|
1050
|
-
stdio.exports.node = options => {
|
|
1051
|
-
const stdio = normalizeStdio$1(options);
|
|
1052
|
-
|
|
1053
|
-
if (stdio === 'ipc') {
|
|
1054
|
-
return 'ipc';
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
if (stdio === undefined || typeof stdio === 'string') {
|
|
1058
|
-
return [stdio, stdio, stdio, 'ipc'];
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
if (stdio.includes('ipc')) {
|
|
1062
|
-
return stdio;
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
return [...stdio, 'ipc'];
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
var stdioExports = stdio.exports;
|
|
1069
|
-
|
|
1070
|
-
const os = require$$0$1;
|
|
1071
|
-
const onExit = signalExitExports;
|
|
1072
|
-
|
|
1073
|
-
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
|
1074
|
-
|
|
1075
|
-
// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
|
|
1076
|
-
const spawnedKill$1 = (kill, signal = 'SIGTERM', options = {}) => {
|
|
1077
|
-
const killResult = kill(signal);
|
|
1078
|
-
setKillTimeout(kill, signal, options, killResult);
|
|
1079
|
-
return killResult;
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
|
-
const setKillTimeout = (kill, signal, options, killResult) => {
|
|
1083
|
-
if (!shouldForceKill(signal, options, killResult)) {
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
const timeout = getForceKillAfterTimeout(options);
|
|
1088
|
-
const t = setTimeout(() => {
|
|
1089
|
-
kill('SIGKILL');
|
|
1090
|
-
}, timeout);
|
|
1091
|
-
|
|
1092
|
-
// Guarded because there's no `.unref()` when `execa` is used in the renderer
|
|
1093
|
-
// process in Electron. This cannot be tested since we don't run tests in
|
|
1094
|
-
// Electron.
|
|
1095
|
-
// istanbul ignore else
|
|
1096
|
-
if (t.unref) {
|
|
1097
|
-
t.unref();
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
|
|
1102
|
-
return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
1103
|
-
};
|
|
1104
|
-
|
|
1105
|
-
const isSigterm = signal => {
|
|
1106
|
-
return signal === os.constants.signals.SIGTERM ||
|
|
1107
|
-
(typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1110
|
-
const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
|
1111
|
-
if (forceKillAfterTimeout === true) {
|
|
1112
|
-
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
1116
|
-
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
return forceKillAfterTimeout;
|
|
1120
|
-
};
|
|
1121
|
-
|
|
1122
|
-
// `childProcess.cancel()`
|
|
1123
|
-
const spawnedCancel$1 = (spawned, context) => {
|
|
1124
|
-
const killResult = spawned.kill();
|
|
1125
|
-
|
|
1126
|
-
if (killResult) {
|
|
1127
|
-
context.isCanceled = true;
|
|
1128
|
-
}
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
const timeoutKill = (spawned, signal, reject) => {
|
|
1132
|
-
spawned.kill(signal);
|
|
1133
|
-
reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
|
-
// `timeout` option handling
|
|
1137
|
-
const setupTimeout$1 = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
|
|
1138
|
-
if (timeout === 0 || timeout === undefined) {
|
|
1139
|
-
return spawnedPromise;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
let timeoutId;
|
|
1143
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
|
1144
|
-
timeoutId = setTimeout(() => {
|
|
1145
|
-
timeoutKill(spawned, killSignal, reject);
|
|
1146
|
-
}, timeout);
|
|
1147
|
-
});
|
|
1148
|
-
|
|
1149
|
-
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
1150
|
-
clearTimeout(timeoutId);
|
|
1151
|
-
});
|
|
1152
|
-
|
|
1153
|
-
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
1154
|
-
};
|
|
1155
|
-
|
|
1156
|
-
const validateTimeout$1 = ({timeout}) => {
|
|
1157
|
-
if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
1158
|
-
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
1159
|
-
}
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
// `cleanup` option handling
|
|
1163
|
-
const setExitHandler$1 = async (spawned, {cleanup, detached}, timedPromise) => {
|
|
1164
|
-
if (!cleanup || detached) {
|
|
1165
|
-
return timedPromise;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
const removeExitHandler = onExit(() => {
|
|
1169
|
-
spawned.kill();
|
|
1170
|
-
});
|
|
1171
|
-
|
|
1172
|
-
return timedPromise.finally(() => {
|
|
1173
|
-
removeExitHandler();
|
|
1174
|
-
});
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
var kill = {
|
|
1178
|
-
spawnedKill: spawnedKill$1,
|
|
1179
|
-
spawnedCancel: spawnedCancel$1,
|
|
1180
|
-
setupTimeout: setupTimeout$1,
|
|
1181
|
-
validateTimeout: validateTimeout$1,
|
|
1182
|
-
setExitHandler: setExitHandler$1
|
|
1183
|
-
};
|
|
1184
|
-
|
|
1185
|
-
const isStream$1 = stream =>
|
|
1186
|
-
stream !== null &&
|
|
1187
|
-
typeof stream === 'object' &&
|
|
1188
|
-
typeof stream.pipe === 'function';
|
|
1189
|
-
|
|
1190
|
-
isStream$1.writable = stream =>
|
|
1191
|
-
isStream$1(stream) &&
|
|
1192
|
-
stream.writable !== false &&
|
|
1193
|
-
typeof stream._write === 'function' &&
|
|
1194
|
-
typeof stream._writableState === 'object';
|
|
1195
|
-
|
|
1196
|
-
isStream$1.readable = stream =>
|
|
1197
|
-
isStream$1(stream) &&
|
|
1198
|
-
stream.readable !== false &&
|
|
1199
|
-
typeof stream._read === 'function' &&
|
|
1200
|
-
typeof stream._readableState === 'object';
|
|
1201
|
-
|
|
1202
|
-
isStream$1.duplex = stream =>
|
|
1203
|
-
isStream$1.writable(stream) &&
|
|
1204
|
-
isStream$1.readable(stream);
|
|
1205
|
-
|
|
1206
|
-
isStream$1.transform = stream =>
|
|
1207
|
-
isStream$1.duplex(stream) &&
|
|
1208
|
-
typeof stream._transform === 'function';
|
|
1209
|
-
|
|
1210
|
-
var isStream_1 = isStream$1;
|
|
1211
|
-
|
|
1212
|
-
const isStream = isStream_1;
|
|
1213
|
-
const getStream = getStreamExports;
|
|
1214
|
-
const mergeStream = mergeStream$1;
|
|
1215
|
-
|
|
1216
|
-
// `input` option
|
|
1217
|
-
const handleInput$1 = (spawned, input) => {
|
|
1218
|
-
// Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
|
|
1219
|
-
// @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
|
|
1220
|
-
if (input === undefined || spawned.stdin === undefined) {
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
if (isStream(input)) {
|
|
1225
|
-
input.pipe(spawned.stdin);
|
|
1226
|
-
} else {
|
|
1227
|
-
spawned.stdin.end(input);
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
// `all` interleaves `stdout` and `stderr`
|
|
1232
|
-
const makeAllStream$1 = (spawned, {all}) => {
|
|
1233
|
-
if (!all || (!spawned.stdout && !spawned.stderr)) {
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
const mixed = mergeStream();
|
|
1238
|
-
|
|
1239
|
-
if (spawned.stdout) {
|
|
1240
|
-
mixed.add(spawned.stdout);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
if (spawned.stderr) {
|
|
1244
|
-
mixed.add(spawned.stderr);
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
return mixed;
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
|
|
1251
|
-
const getBufferedData = async (stream, streamPromise) => {
|
|
1252
|
-
if (!stream) {
|
|
1253
|
-
return;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
stream.destroy();
|
|
1257
|
-
|
|
1258
|
-
try {
|
|
1259
|
-
return await streamPromise;
|
|
1260
|
-
} catch (error) {
|
|
1261
|
-
return error.bufferedData;
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
|
|
1266
|
-
if (!stream || !buffer) {
|
|
1267
|
-
return;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
if (encoding) {
|
|
1271
|
-
return getStream(stream, {encoding, maxBuffer});
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
return getStream.buffer(stream, {maxBuffer});
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
|
|
1278
|
-
const getSpawnedResult$1 = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
|
|
1279
|
-
const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
|
|
1280
|
-
const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
|
|
1281
|
-
const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
|
|
1282
|
-
|
|
1283
|
-
try {
|
|
1284
|
-
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
1285
|
-
} catch (error) {
|
|
1286
|
-
return Promise.all([
|
|
1287
|
-
{error, signal: error.signal, timedOut: error.timedOut},
|
|
1288
|
-
getBufferedData(stdout, stdoutPromise),
|
|
1289
|
-
getBufferedData(stderr, stderrPromise),
|
|
1290
|
-
getBufferedData(all, allPromise)
|
|
1291
|
-
]);
|
|
1292
|
-
}
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
const validateInputSync$1 = ({input}) => {
|
|
1296
|
-
if (isStream(input)) {
|
|
1297
|
-
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
-
|
|
1301
|
-
var stream = {
|
|
1302
|
-
handleInput: handleInput$1,
|
|
1303
|
-
makeAllStream: makeAllStream$1,
|
|
1304
|
-
getSpawnedResult: getSpawnedResult$1,
|
|
1305
|
-
validateInputSync: validateInputSync$1
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
const nativePromisePrototype = (async () => {})().constructor.prototype;
|
|
1309
|
-
const descriptors = ['then', 'catch', 'finally'].map(property => [
|
|
1310
|
-
property,
|
|
1311
|
-
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
1312
|
-
]);
|
|
1313
|
-
|
|
1314
|
-
// The return value is a mixin of `childProcess` and `Promise`
|
|
1315
|
-
const mergePromise$1 = (spawned, promise) => {
|
|
1316
|
-
for (const [property, descriptor] of descriptors) {
|
|
1317
|
-
// Starting the main `promise` is deferred to avoid consuming streams
|
|
1318
|
-
const value = typeof promise === 'function' ?
|
|
1319
|
-
(...args) => Reflect.apply(descriptor.value, promise(), args) :
|
|
1320
|
-
descriptor.value.bind(promise);
|
|
1321
|
-
|
|
1322
|
-
Reflect.defineProperty(spawned, property, {...descriptor, value});
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
return spawned;
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
|
-
// Use promises instead of `child_process` events
|
|
1329
|
-
const getSpawnedPromise$1 = spawned => {
|
|
1330
|
-
return new Promise((resolve, reject) => {
|
|
1331
|
-
spawned.on('exit', (exitCode, signal) => {
|
|
1332
|
-
resolve({exitCode, signal});
|
|
1333
|
-
});
|
|
1334
|
-
|
|
1335
|
-
spawned.on('error', error => {
|
|
1336
|
-
reject(error);
|
|
1337
|
-
});
|
|
1338
|
-
|
|
1339
|
-
if (spawned.stdin) {
|
|
1340
|
-
spawned.stdin.on('error', error => {
|
|
1341
|
-
reject(error);
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
var promise = {
|
|
1348
|
-
mergePromise: mergePromise$1,
|
|
1349
|
-
getSpawnedPromise: getSpawnedPromise$1
|
|
1350
|
-
};
|
|
1351
|
-
|
|
1352
|
-
const normalizeArgs = (file, args = []) => {
|
|
1353
|
-
if (!Array.isArray(args)) {
|
|
1354
|
-
return [file];
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
return [file, ...args];
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
1361
|
-
const DOUBLE_QUOTES_REGEXP = /"/g;
|
|
1362
|
-
|
|
1363
|
-
const escapeArg = arg => {
|
|
1364
|
-
if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {
|
|
1365
|
-
return arg;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
|
1369
|
-
};
|
|
1370
|
-
|
|
1371
|
-
const joinCommand$1 = (file, args) => {
|
|
1372
|
-
return normalizeArgs(file, args).join(' ');
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
const getEscapedCommand$1 = (file, args) => {
|
|
1376
|
-
return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
|
-
const SPACES_REGEXP = / +/g;
|
|
1380
|
-
|
|
1381
|
-
// Handle `execa.command()`
|
|
1382
|
-
const parseCommand$1 = command => {
|
|
1383
|
-
const tokens = [];
|
|
1384
|
-
for (const token of command.trim().split(SPACES_REGEXP)) {
|
|
1385
|
-
// Allow spaces to be escaped by a backslash if not meant as a delimiter
|
|
1386
|
-
const previousToken = tokens[tokens.length - 1];
|
|
1387
|
-
if (previousToken && previousToken.endsWith('\\')) {
|
|
1388
|
-
// Merge previous token with current one
|
|
1389
|
-
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
|
1390
|
-
} else {
|
|
1391
|
-
tokens.push(token);
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
return tokens;
|
|
1396
|
-
};
|
|
1397
|
-
|
|
1398
|
-
var command = {
|
|
1399
|
-
joinCommand: joinCommand$1,
|
|
1400
|
-
getEscapedCommand: getEscapedCommand$1,
|
|
1401
|
-
parseCommand: parseCommand$1
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
const path = f;
|
|
1405
|
-
const childProcess = require$$0$2;
|
|
1406
|
-
const crossSpawn = crossSpawnExports;
|
|
1407
|
-
const stripFinalNewline = stripFinalNewline$1;
|
|
1408
|
-
const npmRunPath = npmRunPathExports;
|
|
1409
|
-
const onetime = onetimeExports;
|
|
1410
|
-
const makeError = error;
|
|
1411
|
-
const normalizeStdio = stdioExports;
|
|
1412
|
-
const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = kill;
|
|
1413
|
-
const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = stream;
|
|
1414
|
-
const {mergePromise, getSpawnedPromise} = promise;
|
|
1415
|
-
const {joinCommand, parseCommand, getEscapedCommand} = command;
|
|
1416
|
-
|
|
1417
|
-
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
|
|
1418
|
-
|
|
1419
|
-
const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
|
|
1420
|
-
const env = extendEnv ? {...process.env, ...envOption} : envOption;
|
|
1421
|
-
|
|
1422
|
-
if (preferLocal) {
|
|
1423
|
-
return npmRunPath.env({env, cwd: localDir, execPath});
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
return env;
|
|
1427
|
-
};
|
|
1428
|
-
|
|
1429
|
-
const handleArguments = (file, args, options = {}) => {
|
|
1430
|
-
const parsed = crossSpawn._parse(file, args, options);
|
|
1431
|
-
file = parsed.command;
|
|
1432
|
-
args = parsed.args;
|
|
1433
|
-
options = parsed.options;
|
|
1434
|
-
|
|
1435
|
-
options = {
|
|
1436
|
-
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
1437
|
-
buffer: true,
|
|
1438
|
-
stripFinalNewline: true,
|
|
1439
|
-
extendEnv: true,
|
|
1440
|
-
preferLocal: false,
|
|
1441
|
-
localDir: options.cwd || process.cwd(),
|
|
1442
|
-
execPath: process.execPath,
|
|
1443
|
-
encoding: 'utf8',
|
|
1444
|
-
reject: true,
|
|
1445
|
-
cleanup: true,
|
|
1446
|
-
all: false,
|
|
1447
|
-
windowsHide: true,
|
|
1448
|
-
...options
|
|
1449
|
-
};
|
|
1450
|
-
|
|
1451
|
-
options.env = getEnv(options);
|
|
1452
|
-
|
|
1453
|
-
options.stdio = normalizeStdio(options);
|
|
1454
|
-
|
|
1455
|
-
if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
|
|
1456
|
-
// #116
|
|
1457
|
-
args.unshift('/q');
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
return {file, args, options, parsed};
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
const handleOutput = (options, value, error) => {
|
|
1464
|
-
if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
|
|
1465
|
-
// When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
|
|
1466
|
-
return error === undefined ? undefined : '';
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
if (options.stripFinalNewline) {
|
|
1470
|
-
return stripFinalNewline(value);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
return value;
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
|
-
const execa = (file, args, options) => {
|
|
1477
|
-
const parsed = handleArguments(file, args, options);
|
|
1478
|
-
const command = joinCommand(file, args);
|
|
1479
|
-
const escapedCommand = getEscapedCommand(file, args);
|
|
1480
|
-
|
|
1481
|
-
validateTimeout(parsed.options);
|
|
1482
|
-
|
|
1483
|
-
let spawned;
|
|
1484
|
-
try {
|
|
1485
|
-
spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
|
|
1486
|
-
} catch (error) {
|
|
1487
|
-
// Ensure the returned error is always both a promise and a child process
|
|
1488
|
-
const dummySpawned = new childProcess.ChildProcess();
|
|
1489
|
-
const errorPromise = Promise.reject(makeError({
|
|
1490
|
-
error,
|
|
1491
|
-
stdout: '',
|
|
1492
|
-
stderr: '',
|
|
1493
|
-
all: '',
|
|
1494
|
-
command,
|
|
1495
|
-
escapedCommand,
|
|
1496
|
-
parsed,
|
|
1497
|
-
timedOut: false,
|
|
1498
|
-
isCanceled: false,
|
|
1499
|
-
killed: false
|
|
1500
|
-
}));
|
|
1501
|
-
return mergePromise(dummySpawned, errorPromise);
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
const spawnedPromise = getSpawnedPromise(spawned);
|
|
1505
|
-
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
1506
|
-
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
1507
|
-
|
|
1508
|
-
const context = {isCanceled: false};
|
|
1509
|
-
|
|
1510
|
-
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
1511
|
-
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
1512
|
-
|
|
1513
|
-
const handlePromise = async () => {
|
|
1514
|
-
const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
1515
|
-
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
1516
|
-
const stderr = handleOutput(parsed.options, stderrResult);
|
|
1517
|
-
const all = handleOutput(parsed.options, allResult);
|
|
1518
|
-
|
|
1519
|
-
if (error || exitCode !== 0 || signal !== null) {
|
|
1520
|
-
const returnedError = makeError({
|
|
1521
|
-
error,
|
|
1522
|
-
exitCode,
|
|
1523
|
-
signal,
|
|
1524
|
-
stdout,
|
|
1525
|
-
stderr,
|
|
1526
|
-
all,
|
|
1527
|
-
command,
|
|
1528
|
-
escapedCommand,
|
|
1529
|
-
parsed,
|
|
1530
|
-
timedOut,
|
|
1531
|
-
isCanceled: context.isCanceled,
|
|
1532
|
-
killed: spawned.killed
|
|
1533
|
-
});
|
|
1534
|
-
|
|
1535
|
-
if (!parsed.options.reject) {
|
|
1536
|
-
return returnedError;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
throw returnedError;
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
return {
|
|
1543
|
-
command,
|
|
1544
|
-
escapedCommand,
|
|
1545
|
-
exitCode: 0,
|
|
1546
|
-
stdout,
|
|
1547
|
-
stderr,
|
|
1548
|
-
all,
|
|
1549
|
-
failed: false,
|
|
1550
|
-
timedOut: false,
|
|
1551
|
-
isCanceled: false,
|
|
1552
|
-
killed: false
|
|
1553
|
-
};
|
|
1554
|
-
};
|
|
1555
|
-
|
|
1556
|
-
const handlePromiseOnce = onetime(handlePromise);
|
|
1557
|
-
|
|
1558
|
-
handleInput(spawned, parsed.options.input);
|
|
1559
|
-
|
|
1560
|
-
spawned.all = makeAllStream(spawned, parsed.options);
|
|
1561
|
-
|
|
1562
|
-
return mergePromise(spawned, handlePromiseOnce);
|
|
1563
|
-
};
|
|
1564
|
-
|
|
1565
|
-
execa$2.exports = execa;
|
|
1566
|
-
|
|
1567
|
-
execa$2.exports.sync = (file, args, options) => {
|
|
1568
|
-
const parsed = handleArguments(file, args, options);
|
|
1569
|
-
const command = joinCommand(file, args);
|
|
1570
|
-
const escapedCommand = getEscapedCommand(file, args);
|
|
1571
|
-
|
|
1572
|
-
validateInputSync(parsed.options);
|
|
1573
|
-
|
|
1574
|
-
let result;
|
|
1575
|
-
try {
|
|
1576
|
-
result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
|
|
1577
|
-
} catch (error) {
|
|
1578
|
-
throw makeError({
|
|
1579
|
-
error,
|
|
1580
|
-
stdout: '',
|
|
1581
|
-
stderr: '',
|
|
1582
|
-
all: '',
|
|
1583
|
-
command,
|
|
1584
|
-
escapedCommand,
|
|
1585
|
-
parsed,
|
|
1586
|
-
timedOut: false,
|
|
1587
|
-
isCanceled: false,
|
|
1588
|
-
killed: false
|
|
1589
|
-
});
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
|
1593
|
-
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
|
1594
|
-
|
|
1595
|
-
if (result.error || result.status !== 0 || result.signal !== null) {
|
|
1596
|
-
const error = makeError({
|
|
1597
|
-
stdout,
|
|
1598
|
-
stderr,
|
|
1599
|
-
error: result.error,
|
|
1600
|
-
signal: result.signal,
|
|
1601
|
-
exitCode: result.status,
|
|
1602
|
-
command,
|
|
1603
|
-
escapedCommand,
|
|
1604
|
-
parsed,
|
|
1605
|
-
timedOut: result.error && result.error.code === 'ETIMEDOUT',
|
|
1606
|
-
isCanceled: false,
|
|
1607
|
-
killed: result.signal !== null
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
if (!parsed.options.reject) {
|
|
1611
|
-
return error;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
throw error;
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
return {
|
|
1618
|
-
command,
|
|
1619
|
-
escapedCommand,
|
|
1620
|
-
exitCode: 0,
|
|
1621
|
-
stdout,
|
|
1622
|
-
stderr,
|
|
1623
|
-
failed: false,
|
|
1624
|
-
timedOut: false,
|
|
1625
|
-
isCanceled: false,
|
|
1626
|
-
killed: false
|
|
1627
|
-
};
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
execa$2.exports.command = (command, options) => {
|
|
1631
|
-
const [file, ...args] = parseCommand(command);
|
|
1632
|
-
return execa(file, args, options);
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
|
-
execa$2.exports.commandSync = (command, options) => {
|
|
1636
|
-
const [file, ...args] = parseCommand(command);
|
|
1637
|
-
return execa.sync(file, args, options);
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
execa$2.exports.node = (scriptPath, args, options = {}) => {
|
|
1641
|
-
if (args && !Array.isArray(args) && typeof args === 'object') {
|
|
1642
|
-
options = args;
|
|
1643
|
-
args = [];
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
const stdio = normalizeStdio.node(options);
|
|
1647
|
-
const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
|
|
1648
|
-
|
|
1649
|
-
const {
|
|
1650
|
-
nodePath = process.execPath,
|
|
1651
|
-
nodeOptions = defaultExecArgv
|
|
1652
|
-
} = options;
|
|
1653
|
-
|
|
1654
|
-
return execa(
|
|
1655
|
-
nodePath,
|
|
1656
|
-
[
|
|
1657
|
-
...nodeOptions,
|
|
1658
|
-
scriptPath,
|
|
1659
|
-
...(Array.isArray(args) ? args : [])
|
|
1660
|
-
],
|
|
1661
|
-
{
|
|
1662
|
-
...options,
|
|
1663
|
-
stdin: undefined,
|
|
1664
|
-
stdout: undefined,
|
|
1665
|
-
stderr: undefined,
|
|
1666
|
-
stdio,
|
|
1667
|
-
shell: false
|
|
1668
|
-
}
|
|
1669
|
-
);
|
|
1670
|
-
};
|
|
1671
|
-
|
|
1672
|
-
var execaExports = execa$2.exports;
|
|
1673
|
-
var execa$1 = /*@__PURE__*/getDefaultExportFromCjs(execaExports);
|
|
1674
|
-
|
|
1675
|
-
// src/detect.ts
|
|
1676
|
-
var AGENTS = ["pnpm", "yarn", "npm", "pnpm@6", "yarn@berry", "bun"];
|
|
1677
|
-
var LOCKS = {
|
|
1678
|
-
"bun.lockb": "bun",
|
|
1679
|
-
"pnpm-lock.yaml": "pnpm",
|
|
1680
|
-
"yarn.lock": "yarn",
|
|
1681
|
-
"package-lock.json": "npm",
|
|
1682
|
-
"npm-shrinkwrap.json": "npm"
|
|
1683
|
-
};
|
|
1684
|
-
async function detectPackageManager(cwd = process.cwd()) {
|
|
1685
|
-
let agent = null;
|
|
1686
|
-
const lockPath = await findUp(Object.keys(LOCKS), { cwd });
|
|
1687
|
-
let packageJsonPath;
|
|
1688
|
-
if (lockPath)
|
|
1689
|
-
packageJsonPath = f.resolve(lockPath, "../package.json");
|
|
1690
|
-
else
|
|
1691
|
-
packageJsonPath = await findUp("package.json", { cwd });
|
|
1692
|
-
if (packageJsonPath && $.existsSync(packageJsonPath)) {
|
|
1693
|
-
try {
|
|
1694
|
-
const pkg = JSON.parse($.readFileSync(packageJsonPath, "utf8"));
|
|
1695
|
-
if (typeof pkg.packageManager === "string") {
|
|
1696
|
-
const [name, version] = pkg.packageManager.split("@");
|
|
1697
|
-
if (name === "yarn" && parseInt(version) > 1)
|
|
1698
|
-
agent = "yarn@berry";
|
|
1699
|
-
else if (name === "pnpm" && parseInt(version) < 7)
|
|
1700
|
-
agent = "pnpm@6";
|
|
1701
|
-
else if (name in AGENTS)
|
|
1702
|
-
agent = name;
|
|
1703
|
-
else
|
|
1704
|
-
console.warn("[ni] Unknown packageManager:", pkg.packageManager);
|
|
1705
|
-
}
|
|
1706
|
-
} catch {
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
if (!agent && lockPath)
|
|
1710
|
-
agent = LOCKS[f.basename(lockPath)];
|
|
1711
|
-
return agent;
|
|
1712
|
-
}
|
|
1713
|
-
async function installPackage(names, options = {}) {
|
|
1714
|
-
const detectedAgent = options.packageManager || await detectPackageManager(options.cwd) || "npm";
|
|
1715
|
-
const [agent] = detectedAgent.split("@");
|
|
1716
|
-
if (!Array.isArray(names))
|
|
1717
|
-
names = [names];
|
|
1718
|
-
const args = options.additionalArgs || [];
|
|
1719
|
-
if (options.preferOffline) {
|
|
1720
|
-
if (detectedAgent === "yarn@berry")
|
|
1721
|
-
args.unshift("--cached");
|
|
1722
|
-
else
|
|
1723
|
-
args.unshift("--prefer-offline");
|
|
1724
|
-
}
|
|
1725
|
-
return execa$1(
|
|
1726
|
-
agent,
|
|
1727
|
-
[
|
|
1728
|
-
agent === "yarn" ? "add" : "install",
|
|
1729
|
-
options.dev ? "-D" : "",
|
|
1730
|
-
...args,
|
|
1731
|
-
...names
|
|
1732
|
-
].filter(Boolean),
|
|
1733
|
-
{
|
|
1734
|
-
stdio: options.silent ? "ignore" : "inherit",
|
|
1735
|
-
cwd: options.cwd
|
|
1736
|
-
}
|
|
1737
|
-
);
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
export { detectPackageManager, installPackage };
|