bililive-cli 1.4.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3582 +0,0 @@
1
- 'use strict';
2
-
3
- var os$3 = require('node:os');
4
- var path$5 = require('node:path');
5
- var fs$3 = require('node:fs');
6
- var index = require('./index.cjs');
7
- var require$$0 = require('fs');
8
- var require$$1 = require('path');
9
- var require$$0$1 = require('child_process');
10
- var require$$0$2 = require('os');
11
- var require$$1$1 = require('util');
12
- var require$$5 = require('assert');
13
- var require$$0$3 = require('events');
14
- var require$$0$5 = require('buffer');
15
- var require$$0$4 = require('stream');
16
- var process$2 = require('node:process');
17
- require('process');
18
- require('tty');
19
- require('zlib');
20
- require('url');
21
- require('crypto');
22
- require('http');
23
- require('net');
24
- require('querystring');
25
- require('async_hooks');
26
- require('string_decoder');
27
- require('constants');
28
- require('https');
29
- require('node:events');
30
- require('node:module');
31
- require('dns');
32
- require('tls');
33
- require('node:crypto');
34
- require('node:child_process');
35
- require('node:url');
36
- require('node:readline');
37
- require('@napi-rs/canvas');
38
-
39
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
40
- // require the crypto API and do not support built-in fallback to lower quality random number
41
- // generators (like Math.random()).
42
- var getRandomValues;
43
- var rnds8 = new Uint8Array(16);
44
- function rng() {
45
- // lazy load so that environments that need to polyfill have a chance to do so
46
- if (!getRandomValues) {
47
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
48
- // find the complete implementation of crypto (msCrypto) on IE11.
49
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
50
-
51
- if (!getRandomValues) {
52
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
53
- }
54
- }
55
-
56
- return getRandomValues(rnds8);
57
- }
58
-
59
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
60
-
61
- function validate(uuid) {
62
- return typeof uuid === 'string' && REGEX.test(uuid);
63
- }
64
-
65
- /**
66
- * Convert array of 16 byte values to UUID string format of the form:
67
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
68
- */
69
-
70
- var byteToHex = [];
71
-
72
- for (var i = 0; i < 256; ++i) {
73
- byteToHex.push((i + 0x100).toString(16).substr(1));
74
- }
75
-
76
- function stringify(arr) {
77
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
78
- // Note: Be careful editing this code! It's been tuned for performance
79
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
80
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
81
- // of the following:
82
- // - One or more input array values don't map to a hex octet (leading to
83
- // "undefined" in the uuid)
84
- // - Invalid input values for the RFC `version` or `variant` fields
85
-
86
- if (!validate(uuid)) {
87
- throw TypeError('Stringified UUID is invalid');
88
- }
89
-
90
- return uuid;
91
- }
92
-
93
- function v4(options, buf, offset) {
94
- options = options || {};
95
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
96
-
97
- rnds[6] = rnds[6] & 0x0f | 0x40;
98
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
99
-
100
- return stringify(rnds);
101
- }
102
-
103
- var xdgTrashdir$1 = {exports: {}};
104
-
105
- var df$5 = {exports: {}};
106
-
107
- var execa$2 = {exports: {}};
108
-
109
- var crossSpawn$1 = {exports: {}};
110
-
111
- const isWindows = process.platform === 'win32' ||
112
- process.env.OSTYPE === 'cygwin' ||
113
- process.env.OSTYPE === 'msys';
114
-
115
- const path$4 = require$$1;
116
- const COLON = isWindows ? ';' : ':';
117
- const isexe = index.isexe_1;
118
-
119
- const getNotFoundError = (cmd) =>
120
- Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' });
121
-
122
- const getPathInfo = (cmd, opt) => {
123
- const colon = opt.colon || COLON;
124
-
125
- // If it has a slash, then we don't bother searching the pathenv.
126
- // just check the file itself, and that's it.
127
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
128
- : (
129
- [
130
- // windows always checks the cwd first
131
- ...(isWindows ? [process.cwd()] : []),
132
- ...(opt.path || process.env.PATH ||
133
- /* istanbul ignore next: very unusual */ '').split(colon),
134
- ]
135
- );
136
- const pathExtExe = isWindows
137
- ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
138
- : '';
139
- const pathExt = isWindows ? pathExtExe.split(colon) : [''];
140
-
141
- if (isWindows) {
142
- if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
143
- pathExt.unshift('');
144
- }
145
-
146
- return {
147
- pathEnv,
148
- pathExt,
149
- pathExtExe,
150
- }
151
- };
152
-
153
- const which$1 = (cmd, opt, cb) => {
154
- if (typeof opt === 'function') {
155
- cb = opt;
156
- opt = {};
157
- }
158
- if (!opt)
159
- opt = {};
160
-
161
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
162
- const found = [];
163
-
164
- const step = i => new Promise((resolve, reject) => {
165
- if (i === pathEnv.length)
166
- return opt.all && found.length ? resolve(found)
167
- : reject(getNotFoundError(cmd))
168
-
169
- const ppRaw = pathEnv[i];
170
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
171
-
172
- const pCmd = path$4.join(pathPart, cmd);
173
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
174
- : pCmd;
175
-
176
- resolve(subStep(p, i, 0));
177
- });
178
-
179
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
180
- if (ii === pathExt.length)
181
- return resolve(step(i + 1))
182
- const ext = pathExt[ii];
183
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
184
- if (!er && is) {
185
- if (opt.all)
186
- found.push(p + ext);
187
- else
188
- return resolve(p + ext)
189
- }
190
- return resolve(subStep(p, i, ii + 1))
191
- });
192
- });
193
-
194
- return cb ? step(0).then(res => cb(null, res), cb) : step(0)
195
- };
196
-
197
- const whichSync = (cmd, opt) => {
198
- opt = opt || {};
199
-
200
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
201
- const found = [];
202
-
203
- for (let i = 0; i < pathEnv.length; i ++) {
204
- const ppRaw = pathEnv[i];
205
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
206
-
207
- const pCmd = path$4.join(pathPart, cmd);
208
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
209
- : pCmd;
210
-
211
- for (let j = 0; j < pathExt.length; j ++) {
212
- const cur = p + pathExt[j];
213
- try {
214
- const is = isexe.sync(cur, { pathExt: pathExtExe });
215
- if (is) {
216
- if (opt.all)
217
- found.push(cur);
218
- else
219
- return cur
220
- }
221
- } catch (ex) {}
222
- }
223
- }
224
-
225
- if (opt.all && found.length)
226
- return found
227
-
228
- if (opt.nothrow)
229
- return null
230
-
231
- throw getNotFoundError(cmd)
232
- };
233
-
234
- var which_1 = which$1;
235
- which$1.sync = whichSync;
236
-
237
- var pathKey$1 = {exports: {}};
238
-
239
- const pathKey = (options = {}) => {
240
- const environment = options.env || process.env;
241
- const platform = options.platform || process.platform;
242
-
243
- if (platform !== 'win32') {
244
- return 'PATH';
245
- }
246
-
247
- return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
248
- };
249
-
250
- pathKey$1.exports = pathKey;
251
- // TODO: Remove this for the next major release
252
- pathKey$1.exports.default = pathKey;
253
-
254
- var pathKeyExports = pathKey$1.exports;
255
-
256
- const path$3 = require$$1;
257
- const which = which_1;
258
- const getPathKey = pathKeyExports;
259
-
260
- function resolveCommandAttempt(parsed, withoutPathExt) {
261
- const env = parsed.options.env || process.env;
262
- const cwd = process.cwd();
263
- const hasCustomCwd = parsed.options.cwd != null;
264
- // Worker threads do not have process.chdir()
265
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
266
-
267
- // If a custom `cwd` was specified, we need to change the process cwd
268
- // because `which` will do stat calls but does not support a custom cwd
269
- if (shouldSwitchCwd) {
270
- try {
271
- process.chdir(parsed.options.cwd);
272
- } catch (err) {
273
- /* Empty */
274
- }
275
- }
276
-
277
- let resolved;
278
-
279
- try {
280
- resolved = which.sync(parsed.command, {
281
- path: env[getPathKey({ env })],
282
- pathExt: withoutPathExt ? path$3.delimiter : undefined,
283
- });
284
- } catch (e) {
285
- /* Empty */
286
- } finally {
287
- if (shouldSwitchCwd) {
288
- process.chdir(cwd);
289
- }
290
- }
291
-
292
- // If we successfully resolved, ensure that an absolute path is returned
293
- // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
294
- if (resolved) {
295
- resolved = path$3.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
296
- }
297
-
298
- return resolved;
299
- }
300
-
301
- function resolveCommand$1(parsed) {
302
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
303
- }
304
-
305
- var resolveCommand_1 = resolveCommand$1;
306
-
307
- var _escape = {};
308
-
309
- // See http://www.robvanderwoude.com/escapechars.php
310
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
311
-
312
- function escapeCommand(arg) {
313
- // Escape meta chars
314
- arg = arg.replace(metaCharsRegExp, '^$1');
315
-
316
- return arg;
317
- }
318
-
319
- function escapeArgument(arg, doubleEscapeMetaChars) {
320
- // Convert to string
321
- arg = `${arg}`;
322
-
323
- // Algorithm below is based on https://qntm.org/cmd
324
-
325
- // Sequence of backslashes followed by a double quote:
326
- // double up all the backslashes and escape the double quote
327
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
328
-
329
- // Sequence of backslashes followed by the end of the string
330
- // (which will become a double quote later):
331
- // double up all the backslashes
332
- arg = arg.replace(/(\\*)$/, '$1$1');
333
-
334
- // All other backslashes occur literally
335
-
336
- // Quote the whole thing:
337
- arg = `"${arg}"`;
338
-
339
- // Escape meta chars
340
- arg = arg.replace(metaCharsRegExp, '^$1');
341
-
342
- // Double escape meta chars if necessary
343
- if (doubleEscapeMetaChars) {
344
- arg = arg.replace(metaCharsRegExp, '^$1');
345
- }
346
-
347
- return arg;
348
- }
349
-
350
- _escape.command = escapeCommand;
351
- _escape.argument = escapeArgument;
352
-
353
- var shebangRegex$1 = /^#!(.*)/;
354
-
355
- const shebangRegex = shebangRegex$1;
356
-
357
- var shebangCommand$1 = (string = '') => {
358
- const match = string.match(shebangRegex);
359
-
360
- if (!match) {
361
- return null;
362
- }
363
-
364
- const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
365
- const binary = path.split('/').pop();
366
-
367
- if (binary === 'env') {
368
- return argument;
369
- }
370
-
371
- return argument ? `${binary} ${argument}` : binary;
372
- };
373
-
374
- const fs$2 = require$$0;
375
- const shebangCommand = shebangCommand$1;
376
-
377
- function readShebang$1(command) {
378
- // Read the first 150 bytes from the file
379
- const size = 150;
380
- const buffer = Buffer.alloc(size);
381
-
382
- let fd;
383
-
384
- try {
385
- fd = fs$2.openSync(command, 'r');
386
- fs$2.readSync(fd, buffer, 0, size, 0);
387
- fs$2.closeSync(fd);
388
- } catch (e) { /* Empty */ }
389
-
390
- // Attempt to extract shebang (null is returned if not a shebang)
391
- return shebangCommand(buffer.toString());
392
- }
393
-
394
- var readShebang_1 = readShebang$1;
395
-
396
- const path$2 = require$$1;
397
- const resolveCommand = resolveCommand_1;
398
- const escape = _escape;
399
- const readShebang = readShebang_1;
400
-
401
- const isWin$2 = process.platform === 'win32';
402
- const isExecutableRegExp = /\.(?:com|exe)$/i;
403
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
404
-
405
- function detectShebang(parsed) {
406
- parsed.file = resolveCommand(parsed);
407
-
408
- const shebang = parsed.file && readShebang(parsed.file);
409
-
410
- if (shebang) {
411
- parsed.args.unshift(parsed.file);
412
- parsed.command = shebang;
413
-
414
- return resolveCommand(parsed);
415
- }
416
-
417
- return parsed.file;
418
- }
419
-
420
- function parseNonShell(parsed) {
421
- if (!isWin$2) {
422
- return parsed;
423
- }
424
-
425
- // Detect & add support for shebangs
426
- const commandFile = detectShebang(parsed);
427
-
428
- // We don't need a shell if the command filename is an executable
429
- const needsShell = !isExecutableRegExp.test(commandFile);
430
-
431
- // If a shell is required, use cmd.exe and take care of escaping everything correctly
432
- // Note that `forceShell` is an hidden option used only in tests
433
- if (parsed.options.forceShell || needsShell) {
434
- // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
435
- // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
436
- // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
437
- // we need to double escape them
438
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
439
-
440
- // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
441
- // This is necessary otherwise it will always fail with ENOENT in those cases
442
- parsed.command = path$2.normalize(parsed.command);
443
-
444
- // Escape command & arguments
445
- parsed.command = escape.command(parsed.command);
446
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
447
-
448
- const shellCommand = [parsed.command].concat(parsed.args).join(' ');
449
-
450
- parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
451
- parsed.command = process.env.comspec || 'cmd.exe';
452
- parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
453
- }
454
-
455
- return parsed;
456
- }
457
-
458
- function parse$1(command, args, options) {
459
- // Normalize arguments, similar to nodejs
460
- if (args && !Array.isArray(args)) {
461
- options = args;
462
- args = null;
463
- }
464
-
465
- args = args ? args.slice(0) : []; // Clone array to avoid changing the original
466
- options = Object.assign({}, options); // Clone object to avoid changing the original
467
-
468
- // Build our parsed object
469
- const parsed = {
470
- command,
471
- args,
472
- options,
473
- file: undefined,
474
- original: {
475
- command,
476
- args,
477
- },
478
- };
479
-
480
- // Delegate further parsing to shell or non-shell
481
- return options.shell ? parsed : parseNonShell(parsed);
482
- }
483
-
484
- var parse_1 = parse$1;
485
-
486
- const isWin$1 = process.platform === 'win32';
487
-
488
- function notFoundError(original, syscall) {
489
- return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
490
- code: 'ENOENT',
491
- errno: 'ENOENT',
492
- syscall: `${syscall} ${original.command}`,
493
- path: original.command,
494
- spawnargs: original.args,
495
- });
496
- }
497
-
498
- function hookChildProcess(cp, parsed) {
499
- if (!isWin$1) {
500
- return;
501
- }
502
-
503
- const originalEmit = cp.emit;
504
-
505
- cp.emit = function (name, arg1) {
506
- // If emitting "exit" event and exit code is 1, we need to check if
507
- // the command exists and emit an "error" instead
508
- // See https://github.com/IndigoUnited/node-cross-spawn/issues/16
509
- if (name === 'exit') {
510
- const err = verifyENOENT(arg1, parsed);
511
-
512
- if (err) {
513
- return originalEmit.call(cp, 'error', err);
514
- }
515
- }
516
-
517
- return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
518
- };
519
- }
520
-
521
- function verifyENOENT(status, parsed) {
522
- if (isWin$1 && status === 1 && !parsed.file) {
523
- return notFoundError(parsed.original, 'spawn');
524
- }
525
-
526
- return null;
527
- }
528
-
529
- function verifyENOENTSync(status, parsed) {
530
- if (isWin$1 && status === 1 && !parsed.file) {
531
- return notFoundError(parsed.original, 'spawnSync');
532
- }
533
-
534
- return null;
535
- }
536
-
537
- var enoent$1 = {
538
- hookChildProcess,
539
- verifyENOENT,
540
- verifyENOENTSync,
541
- notFoundError,
542
- };
543
-
544
- const cp = require$$0$1;
545
- const parse = parse_1;
546
- const enoent = enoent$1;
547
-
548
- function spawn(command, args, options) {
549
- // Parse the arguments
550
- const parsed = parse(command, args, options);
551
-
552
- // Spawn the child process
553
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
554
-
555
- // Hook into child process "exit" event to emit an error if the command
556
- // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
557
- enoent.hookChildProcess(spawned, parsed);
558
-
559
- return spawned;
560
- }
561
-
562
- function spawnSync(command, args, options) {
563
- // Parse the arguments
564
- const parsed = parse(command, args, options);
565
-
566
- // Spawn the child process
567
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
568
-
569
- // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
570
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
571
-
572
- return result;
573
- }
574
-
575
- crossSpawn$1.exports = spawn;
576
- crossSpawn$1.exports.spawn = spawn;
577
- crossSpawn$1.exports.sync = spawnSync;
578
-
579
- crossSpawn$1.exports._parse = parse;
580
- crossSpawn$1.exports._enoent = enoent;
581
-
582
- var crossSpawnExports = crossSpawn$1.exports;
583
-
584
- var stripFinalNewline$1 = input => {
585
- const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
586
- const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
587
-
588
- if (input[input.length - 1] === LF) {
589
- input = input.slice(0, input.length - 1);
590
- }
591
-
592
- if (input[input.length - 1] === CR) {
593
- input = input.slice(0, input.length - 1);
594
- }
595
-
596
- return input;
597
- };
598
-
599
- var npmRunPath$1 = {exports: {}};
600
-
601
- npmRunPath$1.exports;
602
-
603
- (function (module) {
604
- const path = require$$1;
605
- const pathKey = pathKeyExports;
606
-
607
- const npmRunPath = options => {
608
- options = {
609
- cwd: process.cwd(),
610
- path: process.env[pathKey()],
611
- ...options
612
- };
613
-
614
- let previous;
615
- let cwdPath = path.resolve(options.cwd);
616
- const result = [];
617
-
618
- while (previous !== cwdPath) {
619
- result.push(path.join(cwdPath, 'node_modules/.bin'));
620
- previous = cwdPath;
621
- cwdPath = path.resolve(cwdPath, '..');
622
- }
623
-
624
- // Ensure the running `node` binary is used
625
- result.push(path.dirname(process.execPath));
626
-
627
- return result.concat(options.path).join(path.delimiter);
628
- };
629
-
630
- module.exports = npmRunPath;
631
- // TODO: Remove this for the next major release
632
- module.exports.default = npmRunPath;
633
-
634
- module.exports.env = options => {
635
- options = {
636
- env: process.env,
637
- ...options
638
- };
639
-
640
- const env = {...options.env};
641
- const path = pathKey({env});
642
-
643
- options.path = env[path];
644
- env[path] = module.exports(options);
645
-
646
- return env;
647
- };
648
- } (npmRunPath$1));
649
-
650
- var npmRunPathExports = npmRunPath$1.exports;
651
-
652
- var onetime$2 = {exports: {}};
653
-
654
- var mimicFn$2 = {exports: {}};
655
-
656
- const mimicFn$1 = (to, from) => {
657
- for (const prop of Reflect.ownKeys(from)) {
658
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
659
- }
660
-
661
- return to;
662
- };
663
-
664
- mimicFn$2.exports = mimicFn$1;
665
- // TODO: Remove this for the next major release
666
- mimicFn$2.exports.default = mimicFn$1;
667
-
668
- var mimicFnExports = mimicFn$2.exports;
669
-
670
- const mimicFn = mimicFnExports;
671
-
672
- const calledFunctions = new WeakMap();
673
-
674
- const onetime$1 = (function_, options = {}) => {
675
- if (typeof function_ !== 'function') {
676
- throw new TypeError('Expected a function');
677
- }
678
-
679
- let returnValue;
680
- let callCount = 0;
681
- const functionName = function_.displayName || function_.name || '<anonymous>';
682
-
683
- const onetime = function (...arguments_) {
684
- calledFunctions.set(onetime, ++callCount);
685
-
686
- if (callCount === 1) {
687
- returnValue = function_.apply(this, arguments_);
688
- function_ = null;
689
- } else if (options.throw === true) {
690
- throw new Error(`Function \`${functionName}\` can only be called once`);
691
- }
692
-
693
- return returnValue;
694
- };
695
-
696
- mimicFn(onetime, function_);
697
- calledFunctions.set(onetime, callCount);
698
-
699
- return onetime;
700
- };
701
-
702
- onetime$2.exports = onetime$1;
703
- // TODO: Remove this for the next major release
704
- onetime$2.exports.default = onetime$1;
705
-
706
- onetime$2.exports.callCount = function_ => {
707
- if (!calledFunctions.has(function_)) {
708
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
709
- }
710
-
711
- return calledFunctions.get(function_);
712
- };
713
-
714
- var onetimeExports = onetime$2.exports;
715
-
716
- const os$2 = require$$0$2;
717
- const util = require$$1$1;
718
-
719
- const getCode = (error, code) => {
720
- if (error && error.code) {
721
- return [error.code, os$2.constants.errno[error.code]];
722
- }
723
-
724
- if (Number.isInteger(code)) {
725
- return [util.getSystemErrorName(-code), code];
726
- }
727
-
728
- return [];
729
- };
730
-
731
- const getErrorPrefix = ({timedOut, timeout, signal, exitCodeName, exitCode, isCanceled}) => {
732
- if (timedOut) {
733
- return `timed out after ${timeout} milliseconds`;
734
- }
735
-
736
- if (isCanceled) {
737
- return 'was canceled';
738
- }
739
-
740
- if (signal) {
741
- return `was killed with ${signal}`;
742
- }
743
-
744
- if (exitCode !== undefined) {
745
- return `failed with exit code ${exitCode} (${exitCodeName})`;
746
- }
747
-
748
- return 'failed';
749
- };
750
-
751
- const makeError$1 = ({
752
- stdout,
753
- stderr,
754
- all,
755
- error,
756
- signal,
757
- code,
758
- command,
759
- timedOut,
760
- isCanceled,
761
- killed,
762
- parsed: {options: {timeout}}
763
- }) => {
764
- const [exitCodeName, exitCode] = getCode(error, code);
765
-
766
- const prefix = getErrorPrefix({timedOut, timeout, signal, exitCodeName, exitCode, isCanceled});
767
- const message = `Command ${prefix}: ${command}`;
768
-
769
- if (error instanceof Error) {
770
- error.originalMessage = error.message;
771
- error.message = `${message}\n${error.message}`;
772
- } else {
773
- error = new Error(message);
774
- }
775
-
776
- error.command = command;
777
- delete error.code;
778
- error.exitCode = exitCode;
779
- error.exitCodeName = exitCodeName;
780
- error.stdout = stdout;
781
- error.stderr = stderr;
782
-
783
- if (all !== undefined) {
784
- error.all = all;
785
- }
786
-
787
- if ('bufferedData' in error) {
788
- delete error.bufferedData;
789
- }
790
-
791
- error.failed = true;
792
- error.timedOut = Boolean(timedOut);
793
- error.isCanceled = isCanceled;
794
- error.killed = killed && !timedOut;
795
- // `signal` emitted on `spawned.on('exit')` event can be `null`. We normalize
796
- // it to `undefined`
797
- error.signal = signal || undefined;
798
-
799
- return error;
800
- };
801
-
802
- var error = makeError$1;
803
-
804
- var stdio = {exports: {}};
805
-
806
- const aliases = ['stdin', 'stdout', 'stderr'];
807
-
808
- const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined);
809
-
810
- const normalizeStdio$1 = opts => {
811
- if (!opts) {
812
- return;
813
- }
814
-
815
- const {stdio} = opts;
816
-
817
- if (stdio === undefined) {
818
- return aliases.map(alias => opts[alias]);
819
- }
820
-
821
- if (hasAlias(opts)) {
822
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
823
- }
824
-
825
- if (typeof stdio === 'string') {
826
- return stdio;
827
- }
828
-
829
- if (!Array.isArray(stdio)) {
830
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
831
- }
832
-
833
- const length = Math.max(stdio.length, aliases.length);
834
- return Array.from({length}, (value, index) => stdio[index]);
835
- };
836
-
837
- stdio.exports = normalizeStdio$1;
838
-
839
- // `ipc` is pushed unless it is already present
840
- stdio.exports.node = opts => {
841
- const stdio = normalizeStdio$1(opts);
842
-
843
- if (stdio === 'ipc') {
844
- return 'ipc';
845
- }
846
-
847
- if (stdio === undefined || typeof stdio === 'string') {
848
- return [stdio, stdio, stdio, 'ipc'];
849
- }
850
-
851
- if (stdio.includes('ipc')) {
852
- return stdio;
853
- }
854
-
855
- return [...stdio, 'ipc'];
856
- };
857
-
858
- var stdioExports = stdio.exports;
859
-
860
- var signalExit = {exports: {}};
861
-
862
- var signals$1 = {exports: {}};
863
-
864
- var hasRequiredSignals;
865
-
866
- function requireSignals () {
867
- if (hasRequiredSignals) return signals$1.exports;
868
- hasRequiredSignals = 1;
869
- (function (module) {
870
- // This is not the set of all possible signals.
871
- //
872
- // It IS, however, the set of all signals that trigger
873
- // an exit on either Linux or BSD systems. Linux is a
874
- // superset of the signal names supported on BSD, and
875
- // the unknown signals just fail to register, so we can
876
- // catch that easily enough.
877
- //
878
- // Don't bother with SIGKILL. It's uncatchable, which
879
- // means that we can't fire any callbacks anyway.
880
- //
881
- // If a user does happen to register a handler on a non-
882
- // fatal signal like SIGWINCH or something, and then
883
- // exit, it'll end up firing `process.emit('exit')`, so
884
- // the handler will be fired anyway.
885
- //
886
- // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
887
- // artificially, inherently leave the process in a
888
- // state from which it is not safe to try and enter JS
889
- // listeners.
890
- module.exports = [
891
- 'SIGABRT',
892
- 'SIGALRM',
893
- 'SIGHUP',
894
- 'SIGINT',
895
- 'SIGTERM'
896
- ];
897
-
898
- if (process.platform !== 'win32') {
899
- module.exports.push(
900
- 'SIGVTALRM',
901
- 'SIGXCPU',
902
- 'SIGXFSZ',
903
- 'SIGUSR2',
904
- 'SIGTRAP',
905
- 'SIGSYS',
906
- 'SIGQUIT',
907
- 'SIGIOT'
908
- // should detect profiler and enable/disable accordingly.
909
- // see #21
910
- // 'SIGPROF'
911
- );
912
- }
913
-
914
- if (process.platform === 'linux') {
915
- module.exports.push(
916
- 'SIGIO',
917
- 'SIGPOLL',
918
- 'SIGPWR',
919
- 'SIGSTKFLT',
920
- 'SIGUNUSED'
921
- );
922
- }
923
- } (signals$1));
924
- return signals$1.exports;
925
- }
926
-
927
- // Note: since nyc uses this module to output coverage, any lines
928
- // that are in the direct sync flow of nyc's outputCoverage are
929
- // ignored, since we can never get coverage for them.
930
- // grab a reference to node's real process object right away
931
- var process$1 = index.commonjsGlobal.process;
932
-
933
- const processOk = function (process) {
934
- return process &&
935
- typeof process === 'object' &&
936
- typeof process.removeListener === 'function' &&
937
- typeof process.emit === 'function' &&
938
- typeof process.reallyExit === 'function' &&
939
- typeof process.listeners === 'function' &&
940
- typeof process.kill === 'function' &&
941
- typeof process.pid === 'number' &&
942
- typeof process.on === 'function'
943
- };
944
-
945
- // some kind of non-node environment, just no-op
946
- /* istanbul ignore if */
947
- if (!processOk(process$1)) {
948
- signalExit.exports = function () {
949
- return function () {}
950
- };
951
- } else {
952
- var assert = require$$5;
953
- var signals = requireSignals();
954
- var isWin = /^win/i.test(process$1.platform);
955
-
956
- var EE = require$$0$3;
957
- /* istanbul ignore if */
958
- if (typeof EE !== 'function') {
959
- EE = EE.EventEmitter;
960
- }
961
-
962
- var emitter;
963
- if (process$1.__signal_exit_emitter__) {
964
- emitter = process$1.__signal_exit_emitter__;
965
- } else {
966
- emitter = process$1.__signal_exit_emitter__ = new EE();
967
- emitter.count = 0;
968
- emitter.emitted = {};
969
- }
970
-
971
- // Because this emitter is a global, we have to check to see if a
972
- // previous version of this library failed to enable infinite listeners.
973
- // I know what you're about to say. But literally everything about
974
- // signal-exit is a compromise with evil. Get used to it.
975
- if (!emitter.infinite) {
976
- emitter.setMaxListeners(Infinity);
977
- emitter.infinite = true;
978
- }
979
-
980
- signalExit.exports = function (cb, opts) {
981
- /* istanbul ignore if */
982
- if (!processOk(index.commonjsGlobal.process)) {
983
- return function () {}
984
- }
985
- assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
986
-
987
- if (loaded === false) {
988
- load();
989
- }
990
-
991
- var ev = 'exit';
992
- if (opts && opts.alwaysLast) {
993
- ev = 'afterexit';
994
- }
995
-
996
- var remove = function () {
997
- emitter.removeListener(ev, cb);
998
- if (emitter.listeners('exit').length === 0 &&
999
- emitter.listeners('afterexit').length === 0) {
1000
- unload();
1001
- }
1002
- };
1003
- emitter.on(ev, cb);
1004
-
1005
- return remove
1006
- };
1007
-
1008
- var unload = function unload () {
1009
- if (!loaded || !processOk(index.commonjsGlobal.process)) {
1010
- return
1011
- }
1012
- loaded = false;
1013
-
1014
- signals.forEach(function (sig) {
1015
- try {
1016
- process$1.removeListener(sig, sigListeners[sig]);
1017
- } catch (er) {}
1018
- });
1019
- process$1.emit = originalProcessEmit;
1020
- process$1.reallyExit = originalProcessReallyExit;
1021
- emitter.count -= 1;
1022
- };
1023
- signalExit.exports.unload = unload;
1024
-
1025
- var emit = function emit (event, code, signal) {
1026
- /* istanbul ignore if */
1027
- if (emitter.emitted[event]) {
1028
- return
1029
- }
1030
- emitter.emitted[event] = true;
1031
- emitter.emit(event, code, signal);
1032
- };
1033
-
1034
- // { <signal>: <listener fn>, ... }
1035
- var sigListeners = {};
1036
- signals.forEach(function (sig) {
1037
- sigListeners[sig] = function listener () {
1038
- /* istanbul ignore if */
1039
- if (!processOk(index.commonjsGlobal.process)) {
1040
- return
1041
- }
1042
- // If there are no other listeners, an exit is coming!
1043
- // Simplest way: remove us and then re-send the signal.
1044
- // We know that this will kill the process, so we can
1045
- // safely emit now.
1046
- var listeners = process$1.listeners(sig);
1047
- if (listeners.length === emitter.count) {
1048
- unload();
1049
- emit('exit', null, sig);
1050
- /* istanbul ignore next */
1051
- emit('afterexit', null, sig);
1052
- /* istanbul ignore next */
1053
- if (isWin && sig === 'SIGHUP') {
1054
- // "SIGHUP" throws an `ENOSYS` error on Windows,
1055
- // so use a supported signal instead
1056
- sig = 'SIGINT';
1057
- }
1058
- /* istanbul ignore next */
1059
- process$1.kill(process$1.pid, sig);
1060
- }
1061
- };
1062
- });
1063
-
1064
- signalExit.exports.signals = function () {
1065
- return signals
1066
- };
1067
-
1068
- var loaded = false;
1069
-
1070
- var load = function load () {
1071
- if (loaded || !processOk(index.commonjsGlobal.process)) {
1072
- return
1073
- }
1074
- loaded = true;
1075
-
1076
- // This is the number of onSignalExit's that are in play.
1077
- // It's important so that we can count the correct number of
1078
- // listeners on signals, and don't wait for the other one to
1079
- // handle it instead of us.
1080
- emitter.count += 1;
1081
-
1082
- signals = signals.filter(function (sig) {
1083
- try {
1084
- process$1.on(sig, sigListeners[sig]);
1085
- return true
1086
- } catch (er) {
1087
- return false
1088
- }
1089
- });
1090
-
1091
- process$1.emit = processEmit;
1092
- process$1.reallyExit = processReallyExit;
1093
- };
1094
- signalExit.exports.load = load;
1095
-
1096
- var originalProcessReallyExit = process$1.reallyExit;
1097
- var processReallyExit = function processReallyExit (code) {
1098
- /* istanbul ignore if */
1099
- if (!processOk(index.commonjsGlobal.process)) {
1100
- return
1101
- }
1102
- process$1.exitCode = code || /* istanbul ignore next */ 0;
1103
- emit('exit', process$1.exitCode, null);
1104
- /* istanbul ignore next */
1105
- emit('afterexit', process$1.exitCode, null);
1106
- /* istanbul ignore next */
1107
- originalProcessReallyExit.call(process$1, process$1.exitCode);
1108
- };
1109
-
1110
- var originalProcessEmit = process$1.emit;
1111
- var processEmit = function processEmit (ev, arg) {
1112
- if (ev === 'exit' && processOk(index.commonjsGlobal.process)) {
1113
- /* istanbul ignore else */
1114
- if (arg !== undefined) {
1115
- process$1.exitCode = arg;
1116
- }
1117
- var ret = originalProcessEmit.apply(this, arguments);
1118
- /* istanbul ignore next */
1119
- emit('exit', process$1.exitCode, null);
1120
- /* istanbul ignore next */
1121
- emit('afterexit', process$1.exitCode, null);
1122
- /* istanbul ignore next */
1123
- return ret
1124
- } else {
1125
- return originalProcessEmit.apply(this, arguments)
1126
- }
1127
- };
1128
- }
1129
-
1130
- var signalExitExports = signalExit.exports;
1131
-
1132
- var pFinally$1 = async (
1133
- promise,
1134
- onFinally = (() => {})
1135
- ) => {
1136
- let value;
1137
- try {
1138
- value = await promise;
1139
- } catch (error) {
1140
- await onFinally();
1141
- throw error;
1142
- }
1143
-
1144
- await onFinally();
1145
- return value;
1146
- };
1147
-
1148
- const os$1 = require$$0$2;
1149
- const onExit = signalExitExports;
1150
- const pFinally = pFinally$1;
1151
-
1152
- const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
1153
-
1154
- // Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
1155
- const spawnedKill$1 = (kill, signal = 'SIGTERM', options = {}) => {
1156
- const killResult = kill(signal);
1157
- setKillTimeout(kill, signal, options, killResult);
1158
- return killResult;
1159
- };
1160
-
1161
- const setKillTimeout = (kill, signal, options, killResult) => {
1162
- if (!shouldForceKill(signal, options, killResult)) {
1163
- return;
1164
- }
1165
-
1166
- const timeout = getForceKillAfterTimeout(options);
1167
- setTimeout(() => {
1168
- kill('SIGKILL');
1169
- }, timeout).unref();
1170
- };
1171
-
1172
- const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
1173
- return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1174
- };
1175
-
1176
- const isSigterm = signal => {
1177
- return signal === os$1.constants.signals.SIGTERM ||
1178
- (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
1179
- };
1180
-
1181
- const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
1182
- if (forceKillAfterTimeout === true) {
1183
- return DEFAULT_FORCE_KILL_TIMEOUT;
1184
- }
1185
-
1186
- if (!Number.isInteger(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1187
- throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1188
- }
1189
-
1190
- return forceKillAfterTimeout;
1191
- };
1192
-
1193
- // `childProcess.cancel()`
1194
- const spawnedCancel$1 = (spawned, context) => {
1195
- const killResult = spawned.kill();
1196
-
1197
- if (killResult) {
1198
- context.isCanceled = true;
1199
- }
1200
- };
1201
-
1202
- const timeoutKill = (spawned, signal, reject) => {
1203
- spawned.kill(signal);
1204
- reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
1205
- };
1206
-
1207
- // `timeout` option handling
1208
- const setupTimeout$1 = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
1209
- if (timeout === 0 || timeout === undefined) {
1210
- return spawnedPromise;
1211
- }
1212
-
1213
- if (!Number.isInteger(timeout) || timeout < 0) {
1214
- throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1215
- }
1216
-
1217
- let timeoutId;
1218
- const timeoutPromise = new Promise((resolve, reject) => {
1219
- timeoutId = setTimeout(() => {
1220
- timeoutKill(spawned, killSignal, reject);
1221
- }, timeout);
1222
- });
1223
-
1224
- const safeSpawnedPromise = pFinally(spawnedPromise, () => {
1225
- clearTimeout(timeoutId);
1226
- });
1227
-
1228
- return Promise.race([timeoutPromise, safeSpawnedPromise]);
1229
- };
1230
-
1231
- // `cleanup` option handling
1232
- const setExitHandler$1 = (spawned, {cleanup, detached}, timedPromise) => {
1233
- if (!cleanup || detached) {
1234
- return timedPromise;
1235
- }
1236
-
1237
- const removeExitHandler = onExit(() => {
1238
- spawned.kill();
1239
- });
1240
-
1241
- // TODO: Use native "finally" syntax when targeting Node.js 10
1242
- return pFinally(timedPromise, removeExitHandler);
1243
- };
1244
-
1245
- var kill = {
1246
- spawnedKill: spawnedKill$1,
1247
- spawnedCancel: spawnedCancel$1,
1248
- setupTimeout: setupTimeout$1,
1249
- setExitHandler: setExitHandler$1
1250
- };
1251
-
1252
- const isStream$1 = stream =>
1253
- stream !== null &&
1254
- typeof stream === 'object' &&
1255
- typeof stream.pipe === 'function';
1256
-
1257
- isStream$1.writable = stream =>
1258
- isStream$1(stream) &&
1259
- stream.writable !== false &&
1260
- typeof stream._write === 'function' &&
1261
- typeof stream._writableState === 'object';
1262
-
1263
- isStream$1.readable = stream =>
1264
- isStream$1(stream) &&
1265
- stream.readable !== false &&
1266
- typeof stream._read === 'function' &&
1267
- typeof stream._readableState === 'object';
1268
-
1269
- isStream$1.duplex = stream =>
1270
- isStream$1.writable(stream) &&
1271
- isStream$1.readable(stream);
1272
-
1273
- isStream$1.transform = stream =>
1274
- isStream$1.duplex(stream) &&
1275
- typeof stream._transform === 'function';
1276
-
1277
- var isStream_1 = isStream$1;
1278
-
1279
- var getStream$2 = {exports: {}};
1280
-
1281
- var once$1 = index.onceExports;
1282
-
1283
- var noop$1 = function() {};
1284
-
1285
- var isRequest$1 = function(stream) {
1286
- return stream.setHeader && typeof stream.abort === 'function';
1287
- };
1288
-
1289
- var isChildProcess = function(stream) {
1290
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
1291
- };
1292
-
1293
- var eos$1 = function(stream, opts, callback) {
1294
- if (typeof opts === 'function') return eos$1(stream, null, opts);
1295
- if (!opts) opts = {};
1296
-
1297
- callback = once$1(callback || noop$1);
1298
-
1299
- var ws = stream._writableState;
1300
- var rs = stream._readableState;
1301
- var readable = opts.readable || (opts.readable !== false && stream.readable);
1302
- var writable = opts.writable || (opts.writable !== false && stream.writable);
1303
- var cancelled = false;
1304
-
1305
- var onlegacyfinish = function() {
1306
- if (!stream.writable) onfinish();
1307
- };
1308
-
1309
- var onfinish = function() {
1310
- writable = false;
1311
- if (!readable) callback.call(stream);
1312
- };
1313
-
1314
- var onend = function() {
1315
- readable = false;
1316
- if (!writable) callback.call(stream);
1317
- };
1318
-
1319
- var onexit = function(exitCode) {
1320
- callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
1321
- };
1322
-
1323
- var onerror = function(err) {
1324
- callback.call(stream, err);
1325
- };
1326
-
1327
- var onclose = function() {
1328
- process.nextTick(onclosenexttick);
1329
- };
1330
-
1331
- var onclosenexttick = function() {
1332
- if (cancelled) return;
1333
- if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
1334
- if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
1335
- };
1336
-
1337
- var onrequest = function() {
1338
- stream.req.on('finish', onfinish);
1339
- };
1340
-
1341
- if (isRequest$1(stream)) {
1342
- stream.on('complete', onfinish);
1343
- stream.on('abort', onclose);
1344
- if (stream.req) onrequest();
1345
- else stream.on('request', onrequest);
1346
- } else if (writable && !ws) { // legacy streams
1347
- stream.on('end', onlegacyfinish);
1348
- stream.on('close', onlegacyfinish);
1349
- }
1350
-
1351
- if (isChildProcess(stream)) stream.on('exit', onexit);
1352
-
1353
- stream.on('end', onend);
1354
- stream.on('finish', onfinish);
1355
- if (opts.error !== false) stream.on('error', onerror);
1356
- stream.on('close', onclose);
1357
-
1358
- return function() {
1359
- cancelled = true;
1360
- stream.removeListener('complete', onfinish);
1361
- stream.removeListener('abort', onclose);
1362
- stream.removeListener('request', onrequest);
1363
- if (stream.req) stream.req.removeListener('finish', onfinish);
1364
- stream.removeListener('end', onlegacyfinish);
1365
- stream.removeListener('close', onlegacyfinish);
1366
- stream.removeListener('finish', onfinish);
1367
- stream.removeListener('exit', onexit);
1368
- stream.removeListener('end', onend);
1369
- stream.removeListener('error', onerror);
1370
- stream.removeListener('close', onclose);
1371
- };
1372
- };
1373
-
1374
- var endOfStream = eos$1;
1375
-
1376
- var once = index.onceExports;
1377
- var eos = endOfStream;
1378
- var fs$1 = require$$0; // we only need fs to get the ReadStream and WriteStream prototypes
1379
-
1380
- var noop = function () {};
1381
- var ancient = /^v?\.0/.test(process.version);
1382
-
1383
- var isFn = function (fn) {
1384
- return typeof fn === 'function'
1385
- };
1386
-
1387
- var isFS = function (stream) {
1388
- if (!ancient) return false // newer node version do not need to care about fs is a special way
1389
- if (!fs$1) return false // browser
1390
- return (stream instanceof (fs$1.ReadStream || noop) || stream instanceof (fs$1.WriteStream || noop)) && isFn(stream.close)
1391
- };
1392
-
1393
- var isRequest = function (stream) {
1394
- return stream.setHeader && isFn(stream.abort)
1395
- };
1396
-
1397
- var destroyer = function (stream, reading, writing, callback) {
1398
- callback = once(callback);
1399
-
1400
- var closed = false;
1401
- stream.on('close', function () {
1402
- closed = true;
1403
- });
1404
-
1405
- eos(stream, {readable: reading, writable: writing}, function (err) {
1406
- if (err) return callback(err)
1407
- closed = true;
1408
- callback();
1409
- });
1410
-
1411
- var destroyed = false;
1412
- return function (err) {
1413
- if (closed) return
1414
- if (destroyed) return
1415
- destroyed = true;
1416
-
1417
- if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks
1418
- if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want
1419
-
1420
- if (isFn(stream.destroy)) return stream.destroy()
1421
-
1422
- callback(err || new Error('stream was destroyed'));
1423
- }
1424
- };
1425
-
1426
- var call = function (fn) {
1427
- fn();
1428
- };
1429
-
1430
- var pipe = function (from, to) {
1431
- return from.pipe(to)
1432
- };
1433
-
1434
- var pump$1 = function () {
1435
- var streams = Array.prototype.slice.call(arguments);
1436
- var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop;
1437
-
1438
- if (Array.isArray(streams[0])) streams = streams[0];
1439
- if (streams.length < 2) throw new Error('pump requires two streams per minimum')
1440
-
1441
- var error;
1442
- var destroys = streams.map(function (stream, i) {
1443
- var reading = i < streams.length - 1;
1444
- var writing = i > 0;
1445
- return destroyer(stream, reading, writing, function (err) {
1446
- if (!error) error = err;
1447
- if (err) destroys.forEach(call);
1448
- if (reading) return
1449
- destroys.forEach(call);
1450
- callback(error);
1451
- })
1452
- });
1453
-
1454
- return streams.reduce(pipe)
1455
- };
1456
-
1457
- var pump_1 = pump$1;
1458
-
1459
- const {PassThrough: PassThroughStream} = require$$0$4;
1460
-
1461
- var bufferStream$1 = options => {
1462
- options = {...options};
1463
-
1464
- const {array} = options;
1465
- let {encoding} = options;
1466
- const isBuffer = encoding === 'buffer';
1467
- let objectMode = false;
1468
-
1469
- if (array) {
1470
- objectMode = !(encoding || isBuffer);
1471
- } else {
1472
- encoding = encoding || 'utf8';
1473
- }
1474
-
1475
- if (isBuffer) {
1476
- encoding = null;
1477
- }
1478
-
1479
- const stream = new PassThroughStream({objectMode});
1480
-
1481
- if (encoding) {
1482
- stream.setEncoding(encoding);
1483
- }
1484
-
1485
- let length = 0;
1486
- const chunks = [];
1487
-
1488
- stream.on('data', chunk => {
1489
- chunks.push(chunk);
1490
-
1491
- if (objectMode) {
1492
- length = chunks.length;
1493
- } else {
1494
- length += chunk.length;
1495
- }
1496
- });
1497
-
1498
- stream.getBufferedValue = () => {
1499
- if (array) {
1500
- return chunks;
1501
- }
1502
-
1503
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
1504
- };
1505
-
1506
- stream.getBufferedLength = () => length;
1507
-
1508
- return stream;
1509
- };
1510
-
1511
- const {constants: BufferConstants} = require$$0$5;
1512
- const pump = pump_1;
1513
- const bufferStream = bufferStream$1;
1514
-
1515
- class MaxBufferError extends Error {
1516
- constructor() {
1517
- super('maxBuffer exceeded');
1518
- this.name = 'MaxBufferError';
1519
- }
1520
- }
1521
-
1522
- async function getStream$1(inputStream, options) {
1523
- if (!inputStream) {
1524
- return Promise.reject(new Error('Expected a stream'));
1525
- }
1526
-
1527
- options = {
1528
- maxBuffer: Infinity,
1529
- ...options
1530
- };
1531
-
1532
- const {maxBuffer} = options;
1533
-
1534
- let stream;
1535
- await new Promise((resolve, reject) => {
1536
- const rejectPromise = error => {
1537
- // Don't retrieve an oversized buffer.
1538
- if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
1539
- error.bufferedData = stream.getBufferedValue();
1540
- }
1541
-
1542
- reject(error);
1543
- };
1544
-
1545
- stream = pump(inputStream, bufferStream(options), error => {
1546
- if (error) {
1547
- rejectPromise(error);
1548
- return;
1549
- }
1550
-
1551
- resolve();
1552
- });
1553
-
1554
- stream.on('data', () => {
1555
- if (stream.getBufferedLength() > maxBuffer) {
1556
- rejectPromise(new MaxBufferError());
1557
- }
1558
- });
1559
- });
1560
-
1561
- return stream.getBufferedValue();
1562
- }
1563
-
1564
- getStream$2.exports = getStream$1;
1565
- // TODO: Remove this for the next major release
1566
- getStream$2.exports.default = getStream$1;
1567
- getStream$2.exports.buffer = (stream, options) => getStream$1(stream, {...options, encoding: 'buffer'});
1568
- getStream$2.exports.array = (stream, options) => getStream$1(stream, {...options, array: true});
1569
- getStream$2.exports.MaxBufferError = MaxBufferError;
1570
-
1571
- var getStreamExports = getStream$2.exports;
1572
-
1573
- const { PassThrough } = require$$0$4;
1574
-
1575
- var mergeStream$1 = function (/*streams...*/) {
1576
- var sources = [];
1577
- var output = new PassThrough({objectMode: true});
1578
-
1579
- output.setMaxListeners(0);
1580
-
1581
- output.add = add;
1582
- output.isEmpty = isEmpty;
1583
-
1584
- output.on('unpipe', remove);
1585
-
1586
- Array.prototype.slice.call(arguments).forEach(add);
1587
-
1588
- return output
1589
-
1590
- function add (source) {
1591
- if (Array.isArray(source)) {
1592
- source.forEach(add);
1593
- return this
1594
- }
1595
-
1596
- sources.push(source);
1597
- source.once('end', remove.bind(null, source));
1598
- source.once('error', output.emit.bind(output, 'error'));
1599
- source.pipe(output, {end: false});
1600
- return this
1601
- }
1602
-
1603
- function isEmpty () {
1604
- return sources.length == 0;
1605
- }
1606
-
1607
- function remove (source) {
1608
- sources = sources.filter(function (it) { return it !== source });
1609
- if (!sources.length && output.readable) { output.end(); }
1610
- }
1611
- };
1612
-
1613
- const isStream = isStream_1;
1614
- const getStream = getStreamExports;
1615
- const mergeStream = mergeStream$1;
1616
-
1617
- // `input` option
1618
- const handleInput$1 = (spawned, input) => {
1619
- // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
1620
- // TODO: Remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
1621
- if (input === undefined || spawned.stdin === undefined) {
1622
- return;
1623
- }
1624
-
1625
- if (isStream(input)) {
1626
- input.pipe(spawned.stdin);
1627
- } else {
1628
- spawned.stdin.end(input);
1629
- }
1630
- };
1631
-
1632
- // `all` interleaves `stdout` and `stderr`
1633
- const makeAllStream$1 = spawned => {
1634
- if (!spawned.stdout && !spawned.stderr) {
1635
- return;
1636
- }
1637
-
1638
- const mixed = mergeStream();
1639
-
1640
- if (spawned.stdout) {
1641
- mixed.add(spawned.stdout);
1642
- }
1643
-
1644
- if (spawned.stderr) {
1645
- mixed.add(spawned.stderr);
1646
- }
1647
-
1648
- return mixed;
1649
- };
1650
-
1651
- // On failure, `result.stdout|stderr|all` should contain the currently buffered stream
1652
- const getBufferedData = async (stream, streamPromise) => {
1653
- if (!stream) {
1654
- return;
1655
- }
1656
-
1657
- stream.destroy();
1658
-
1659
- try {
1660
- return await streamPromise;
1661
- } catch (error) {
1662
- return error.bufferedData;
1663
- }
1664
- };
1665
-
1666
- const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
1667
- if (!stream) {
1668
- return;
1669
- }
1670
-
1671
- if (!buffer) {
1672
- // TODO: Use `ret = util.promisify(stream.finished)(stream);` when targeting Node.js 10
1673
- return new Promise((resolve, reject) => {
1674
- stream
1675
- .once('end', resolve)
1676
- .once('error', reject);
1677
- });
1678
- }
1679
-
1680
- if (encoding) {
1681
- return getStream(stream, {encoding, maxBuffer});
1682
- }
1683
-
1684
- return getStream.buffer(stream, {maxBuffer});
1685
- };
1686
-
1687
- // Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
1688
- const getSpawnedResult$1 = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
1689
- const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
1690
- const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
1691
- const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
1692
-
1693
- try {
1694
- return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1695
- } catch (error) {
1696
- return Promise.all([
1697
- {error, code: error.code, signal: error.signal, timedOut: error.timedOut},
1698
- getBufferedData(stdout, stdoutPromise),
1699
- getBufferedData(stderr, stderrPromise),
1700
- getBufferedData(all, allPromise)
1701
- ]);
1702
- }
1703
- };
1704
-
1705
- const validateInputSync$1 = ({input}) => {
1706
- if (isStream(input)) {
1707
- throw new TypeError('The `input` option cannot be a stream in sync mode');
1708
- }
1709
- };
1710
-
1711
- var stream = {
1712
- handleInput: handleInput$1,
1713
- makeAllStream: makeAllStream$1,
1714
- getSpawnedResult: getSpawnedResult$1,
1715
- validateInputSync: validateInputSync$1
1716
- };
1717
-
1718
- const mergePromiseProperty = (spawned, promise, property) => {
1719
- // Starting the main `promise` is deferred to avoid consuming streams
1720
- const value = typeof promise === 'function' ?
1721
- (...args) => promise()[property](...args) :
1722
- promise[property].bind(promise);
1723
-
1724
- Object.defineProperty(spawned, property, {
1725
- value,
1726
- writable: true,
1727
- enumerable: false,
1728
- configurable: true
1729
- });
1730
- };
1731
-
1732
- // The return value is a mixin of `childProcess` and `Promise`
1733
- const mergePromise$1 = (spawned, promise) => {
1734
- mergePromiseProperty(spawned, promise, 'then');
1735
- mergePromiseProperty(spawned, promise, 'catch');
1736
-
1737
- // TODO: Remove the `if`-guard when targeting Node.js 10
1738
- if (Promise.prototype.finally) {
1739
- mergePromiseProperty(spawned, promise, 'finally');
1740
- }
1741
-
1742
- return spawned;
1743
- };
1744
-
1745
- // Use promises instead of `child_process` events
1746
- const getSpawnedPromise$1 = spawned => {
1747
- return new Promise((resolve, reject) => {
1748
- spawned.on('exit', (code, signal) => {
1749
- resolve({code, signal});
1750
- });
1751
-
1752
- spawned.on('error', error => {
1753
- reject(error);
1754
- });
1755
-
1756
- if (spawned.stdin) {
1757
- spawned.stdin.on('error', error => {
1758
- reject(error);
1759
- });
1760
- }
1761
- });
1762
- };
1763
-
1764
- var promise = {
1765
- mergePromise: mergePromise$1,
1766
- getSpawnedPromise: getSpawnedPromise$1
1767
- };
1768
-
1769
- const SPACES_REGEXP = / +/g;
1770
-
1771
- const joinCommand$1 = (file, args = []) => {
1772
- if (!Array.isArray(args)) {
1773
- return file;
1774
- }
1775
-
1776
- return [file, ...args].join(' ');
1777
- };
1778
-
1779
- // Allow spaces to be escaped by a backslash if not meant as a delimiter
1780
- const handleEscaping = (tokens, token, index) => {
1781
- if (index === 0) {
1782
- return [token];
1783
- }
1784
-
1785
- const previousToken = tokens[tokens.length - 1];
1786
-
1787
- if (previousToken.endsWith('\\')) {
1788
- return [...tokens.slice(0, -1), `${previousToken.slice(0, -1)} ${token}`];
1789
- }
1790
-
1791
- return [...tokens, token];
1792
- };
1793
-
1794
- // Handle `execa.command()`
1795
- const parseCommand$1 = command => {
1796
- return command
1797
- .trim()
1798
- .split(SPACES_REGEXP)
1799
- .reduce(handleEscaping, []);
1800
- };
1801
-
1802
- var command = {
1803
- joinCommand: joinCommand$1,
1804
- parseCommand: parseCommand$1
1805
- };
1806
-
1807
- const path$1 = require$$1;
1808
- const childProcess$1 = require$$0$1;
1809
- const crossSpawn = crossSpawnExports;
1810
- const stripFinalNewline = stripFinalNewline$1;
1811
- const npmRunPath = npmRunPathExports;
1812
- const onetime = onetimeExports;
1813
- const makeError = error;
1814
- const normalizeStdio = stdioExports;
1815
- const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = kill;
1816
- const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = stream;
1817
- const {mergePromise, getSpawnedPromise} = promise;
1818
- const {joinCommand, parseCommand} = command;
1819
-
1820
- const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
1821
-
1822
- const getEnv = ({env: envOption, extendEnv, preferLocal, localDir}) => {
1823
- const env = extendEnv ? {...process.env, ...envOption} : envOption;
1824
-
1825
- if (preferLocal) {
1826
- return npmRunPath.env({env, cwd: localDir});
1827
- }
1828
-
1829
- return env;
1830
- };
1831
-
1832
- const handleArgs = (file, args, options = {}) => {
1833
- const parsed = crossSpawn._parse(file, args, options);
1834
- file = parsed.command;
1835
- args = parsed.args;
1836
- options = parsed.options;
1837
-
1838
- options = {
1839
- maxBuffer: DEFAULT_MAX_BUFFER,
1840
- buffer: true,
1841
- stripFinalNewline: true,
1842
- extendEnv: true,
1843
- preferLocal: false,
1844
- localDir: options.cwd || process.cwd(),
1845
- encoding: 'utf8',
1846
- reject: true,
1847
- cleanup: true,
1848
- ...options,
1849
- windowsHide: true
1850
- };
1851
-
1852
- options.env = getEnv(options);
1853
-
1854
- options.stdio = normalizeStdio(options);
1855
-
1856
- if (process.platform === 'win32' && path$1.basename(file, '.exe') === 'cmd') {
1857
- // #116
1858
- args.unshift('/q');
1859
- }
1860
-
1861
- return {file, args, options, parsed};
1862
- };
1863
-
1864
- const handleOutput = (options, value, error) => {
1865
- if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
1866
- // When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
1867
- return error === undefined ? undefined : '';
1868
- }
1869
-
1870
- if (options.stripFinalNewline) {
1871
- return stripFinalNewline(value);
1872
- }
1873
-
1874
- return value;
1875
- };
1876
-
1877
- const execa$1 = (file, args, options) => {
1878
- const parsed = handleArgs(file, args, options);
1879
- const command = joinCommand(file, args);
1880
-
1881
- let spawned;
1882
- try {
1883
- spawned = childProcess$1.spawn(parsed.file, parsed.args, parsed.options);
1884
- } catch (error) {
1885
- // Ensure the returned error is always both a promise and a child process
1886
- const dummySpawned = new childProcess$1.ChildProcess();
1887
- const errorPromise = Promise.reject(makeError({
1888
- error,
1889
- stdout: '',
1890
- stderr: '',
1891
- all: '',
1892
- command,
1893
- parsed,
1894
- timedOut: false,
1895
- isCanceled: false,
1896
- killed: false
1897
- }));
1898
- return mergePromise(dummySpawned, errorPromise);
1899
- }
1900
-
1901
- const spawnedPromise = getSpawnedPromise(spawned);
1902
- const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1903
- const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1904
-
1905
- const context = {isCanceled: false};
1906
-
1907
- spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1908
- spawned.cancel = spawnedCancel.bind(null, spawned, context);
1909
-
1910
- const handlePromise = async () => {
1911
- const [{error, code, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1912
- const stdout = handleOutput(parsed.options, stdoutResult);
1913
- const stderr = handleOutput(parsed.options, stderrResult);
1914
- const all = handleOutput(parsed.options, allResult);
1915
-
1916
- if (error || code !== 0 || signal !== null) {
1917
- const returnedError = makeError({
1918
- error,
1919
- code,
1920
- signal,
1921
- stdout,
1922
- stderr,
1923
- all,
1924
- command,
1925
- parsed,
1926
- timedOut,
1927
- isCanceled: context.isCanceled,
1928
- killed: spawned.killed
1929
- });
1930
-
1931
- if (!parsed.options.reject) {
1932
- return returnedError;
1933
- }
1934
-
1935
- throw returnedError;
1936
- }
1937
-
1938
- return {
1939
- command,
1940
- exitCode: 0,
1941
- exitCodeName: 'SUCCESS',
1942
- stdout,
1943
- stderr,
1944
- all,
1945
- failed: false,
1946
- timedOut: false,
1947
- isCanceled: false,
1948
- killed: false
1949
- };
1950
- };
1951
-
1952
- const handlePromiseOnce = onetime(handlePromise);
1953
-
1954
- crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
1955
-
1956
- handleInput(spawned, parsed.options.input);
1957
-
1958
- spawned.all = makeAllStream(spawned);
1959
-
1960
- return mergePromise(spawned, handlePromiseOnce);
1961
- };
1962
-
1963
- execa$2.exports = execa$1;
1964
-
1965
- execa$2.exports.sync = (file, args, options) => {
1966
- const parsed = handleArgs(file, args, options);
1967
- const command = joinCommand(file, args);
1968
-
1969
- validateInputSync(parsed.options);
1970
-
1971
- let result;
1972
- try {
1973
- result = childProcess$1.spawnSync(parsed.file, parsed.args, parsed.options);
1974
- } catch (error) {
1975
- throw makeError({
1976
- error,
1977
- stdout: '',
1978
- stderr: '',
1979
- all: '',
1980
- command,
1981
- parsed,
1982
- timedOut: false,
1983
- isCanceled: false,
1984
- killed: false
1985
- });
1986
- }
1987
-
1988
- result.stdout = handleOutput(parsed.options, result.stdout, result.error);
1989
- result.stderr = handleOutput(parsed.options, result.stderr, result.error);
1990
-
1991
- if (result.error || result.status !== 0 || result.signal !== null) {
1992
- const error = makeError({
1993
- ...result,
1994
- code: result.status,
1995
- command,
1996
- parsed,
1997
- timedOut: result.error && result.error.code === 'ETIMEDOUT',
1998
- isCanceled: false,
1999
- killed: result.signal !== null
2000
- });
2001
-
2002
- if (!parsed.options.reject) {
2003
- return error;
2004
- }
2005
-
2006
- throw error;
2007
- }
2008
-
2009
- return {
2010
- command,
2011
- exitCode: 0,
2012
- exitCodeName: 'SUCCESS',
2013
- stdout: result.stdout,
2014
- stderr: result.stderr,
2015
- failed: false,
2016
- timedOut: false,
2017
- isCanceled: false,
2018
- killed: false
2019
- };
2020
- };
2021
-
2022
- execa$2.exports.command = (command, options) => {
2023
- const [file, ...args] = parseCommand(command);
2024
- return execa$1(file, args, options);
2025
- };
2026
-
2027
- execa$2.exports.commandSync = (command, options) => {
2028
- const [file, ...args] = parseCommand(command);
2029
- return execa$1.sync(file, args, options);
2030
- };
2031
-
2032
- execa$2.exports.node = (scriptPath, args, options = {}) => {
2033
- if (args && !Array.isArray(args) && typeof args === 'object') {
2034
- options = args;
2035
- args = [];
2036
- }
2037
-
2038
- const stdio = normalizeStdio.node(options);
2039
-
2040
- const {nodePath = process.execPath, nodeOptions = process.execArgv} = options;
2041
-
2042
- return execa$1(
2043
- nodePath,
2044
- [
2045
- ...nodeOptions,
2046
- scriptPath,
2047
- ...(Array.isArray(args) ? args : [])
2048
- ],
2049
- {
2050
- ...options,
2051
- stdin: undefined,
2052
- stdout: undefined,
2053
- stderr: undefined,
2054
- stdio,
2055
- shell: false
2056
- }
2057
- );
2058
- };
2059
-
2060
- var execaExports = execa$2.exports;
2061
-
2062
- const execa = execaExports;
2063
-
2064
- const getColumnBoundaries = async header => {
2065
- // Regex captures each individual column
2066
- // ^\S+\s+ -> First column
2067
- // \s*\S+\s*\S+$ -> Last column (combined)
2068
- // \s*\S+ -> Regular columns
2069
- const regex = /^\S+\s+|\s*\S+\s*\S+$|\s*\S+/g;
2070
- const boundaries = [];
2071
- let match;
2072
-
2073
- while ((match = regex.exec(header))) {
2074
- boundaries.push(match[0].length);
2075
- }
2076
-
2077
- // Extend last column boundary
2078
- boundaries[boundaries.length - 1] = -1;
2079
-
2080
- return boundaries;
2081
- };
2082
-
2083
- const parseOutput = async output => {
2084
- const lines = output.trim().split('\n');
2085
- const boundaries = await getColumnBoundaries(lines[0]);
2086
-
2087
- return lines.slice(1).map(line => {
2088
- const cl = boundaries.map(boundary => {
2089
- // Handle extra-long last column
2090
- const column = boundary > 0 ? line.slice(0, boundary) : line;
2091
- line = line.slice(boundary);
2092
- return column.trim();
2093
- });
2094
-
2095
- return {
2096
- filesystem: cl[0],
2097
- size: parseInt(cl[1], 10) * 1024,
2098
- used: parseInt(cl[2], 10) * 1024,
2099
- available: parseInt(cl[3], 10) * 1024,
2100
- capacity: parseInt(cl[4], 10) / 100,
2101
- mountpoint: cl[5]
2102
- };
2103
- });
2104
- };
2105
-
2106
- const run$1 = async args => {
2107
- const {stdout} = await execa('df', args);
2108
- return parseOutput(stdout);
2109
- };
2110
-
2111
- const df$4 = async () => run$1(['-kP']);
2112
-
2113
- df$4.fs = async name => {
2114
- if (typeof name !== 'string') {
2115
- throw new TypeError('The `name` parameter required');
2116
- }
2117
-
2118
- const data = await run$1(['-kP']);
2119
-
2120
- for (const item of data) {
2121
- if (item.filesystem === name) {
2122
- return item;
2123
- }
2124
- }
2125
-
2126
- throw new Error(`The specified filesystem \`${name}\` doesn't exist`);
2127
- };
2128
-
2129
- df$4.file = async file => {
2130
- if (typeof file !== 'string') {
2131
- throw new TypeError('The `file` parameter is required');
2132
- }
2133
-
2134
- let data;
2135
- try {
2136
- data = await run$1(['-kP', file]);
2137
- } catch (error) {
2138
- if (/No such file or directory/.test(error.stderr)) {
2139
- throw new Error(`The specified file \`${file}\` doesn't exist`);
2140
- }
2141
-
2142
- throw error;
2143
- }
2144
-
2145
- return data[0];
2146
- };
2147
-
2148
- df$5.exports = df$4;
2149
- // TODO: remove this in the next major version
2150
- df$5.exports.default = df$4;
2151
-
2152
- if (process.env.NODE_ENV === 'test') {
2153
- df$5.exports._parseOutput = parseOutput;
2154
- }
2155
-
2156
- var dfExports$1 = df$5.exports;
2157
-
2158
- var df$3 = {exports: {}};
2159
-
2160
- var childProcess = require$$0$1;
2161
-
2162
- function run(args, cb) {
2163
- childProcess.execFile('df', args, function (err, stdout) {
2164
- if (err) {
2165
- cb(err);
2166
- return;
2167
- }
2168
-
2169
- cb(null, stdout.trim().split('\n').slice(1).map(function (el) {
2170
- var cl = el.split(/\s+(?=[\d\/])/);
2171
-
2172
- return {
2173
- filesystem: cl[0],
2174
- size: parseInt(cl[1], 10) * 1024,
2175
- used: parseInt(cl[2], 10) * 1024,
2176
- available: parseInt(cl[3], 10) * 1024,
2177
- capacity: parseInt(cl[4], 10) / 100,
2178
- mountpoint: cl[5]
2179
- };
2180
- }));
2181
- });
2182
- }
2183
- var df$2 = df$3.exports = function (cb) {
2184
- run(['-kP'], cb);
2185
- };
2186
-
2187
- df$2.fs = function (name, cb) {
2188
- if (typeof name !== 'string') {
2189
- throw new Error('name required');
2190
- }
2191
-
2192
- run(['-kP'], function (err, data) {
2193
- if (err) {
2194
- cb(err);
2195
- return;
2196
- }
2197
-
2198
- var ret;
2199
-
2200
- data.forEach(function (el) {
2201
- if (el.filesystem === name) {
2202
- ret = el;
2203
- }
2204
- });
2205
-
2206
- cb(null, ret);
2207
- });
2208
- };
2209
-
2210
- df$2.file = function (file, cb) {
2211
- if (typeof file !== 'string') {
2212
- throw new Error('file required');
2213
- }
2214
-
2215
- run(['-kP', file], function (err, data) {
2216
- if (err) {
2217
- cb(err);
2218
- return;
2219
- }
2220
-
2221
- cb(null, data[0]);
2222
- });
2223
- };
2224
-
2225
- var dfExports = df$3.exports;
2226
-
2227
- var pify$2 = {exports: {}};
2228
-
2229
- var processFn = function (fn, P, opts) {
2230
- return function () {
2231
- var that = this;
2232
- var args = new Array(arguments.length);
2233
-
2234
- for (var i = 0; i < arguments.length; i++) {
2235
- args[i] = arguments[i];
2236
- }
2237
-
2238
- return new P(function (resolve, reject) {
2239
- args.push(function (err, result) {
2240
- if (err) {
2241
- reject(err);
2242
- } else if (opts.multiArgs) {
2243
- var results = new Array(arguments.length - 1);
2244
-
2245
- for (var i = 1; i < arguments.length; i++) {
2246
- results[i - 1] = arguments[i];
2247
- }
2248
-
2249
- resolve(results);
2250
- } else {
2251
- resolve(result);
2252
- }
2253
- });
2254
-
2255
- fn.apply(that, args);
2256
- });
2257
- };
2258
- };
2259
-
2260
- var pify$1 = pify$2.exports = function (obj, P, opts) {
2261
- if (typeof P !== 'function') {
2262
- opts = P;
2263
- P = Promise;
2264
- }
2265
-
2266
- opts = opts || {};
2267
- opts.exclude = opts.exclude || [/.+Sync$/];
2268
-
2269
- var filter = function (key) {
2270
- var match = function (pattern) {
2271
- return typeof pattern === 'string' ? key === pattern : pattern.test(key);
2272
- };
2273
-
2274
- return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
2275
- };
2276
-
2277
- var ret = typeof obj === 'function' ? function () {
2278
- if (opts.excludeMain) {
2279
- return obj.apply(this, arguments);
2280
- }
2281
-
2282
- return processFn(obj, P, opts).apply(this, arguments);
2283
- } : {};
2284
-
2285
- return Object.keys(obj).reduce(function (ret, key) {
2286
- var x = obj[key];
2287
-
2288
- ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
2289
-
2290
- return ret;
2291
- }, ret);
2292
- };
2293
-
2294
- pify$1.all = pify$1;
2295
-
2296
- var pifyExports = pify$2.exports;
2297
-
2298
- var pinkie;
2299
- var hasRequiredPinkie;
2300
-
2301
- function requirePinkie () {
2302
- if (hasRequiredPinkie) return pinkie;
2303
- hasRequiredPinkie = 1;
2304
-
2305
- var PENDING = 'pending';
2306
- var SETTLED = 'settled';
2307
- var FULFILLED = 'fulfilled';
2308
- var REJECTED = 'rejected';
2309
- var NOOP = function () {};
2310
- var isNode = typeof index.commonjsGlobal !== 'undefined' && typeof index.commonjsGlobal.process !== 'undefined' && typeof index.commonjsGlobal.process.emit === 'function';
2311
-
2312
- var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
2313
- var asyncQueue = [];
2314
- var asyncTimer;
2315
-
2316
- function asyncFlush() {
2317
- // run promise callbacks
2318
- for (var i = 0; i < asyncQueue.length; i++) {
2319
- asyncQueue[i][0](asyncQueue[i][1]);
2320
- }
2321
-
2322
- // reset async asyncQueue
2323
- asyncQueue = [];
2324
- asyncTimer = false;
2325
- }
2326
-
2327
- function asyncCall(callback, arg) {
2328
- asyncQueue.push([callback, arg]);
2329
-
2330
- if (!asyncTimer) {
2331
- asyncTimer = true;
2332
- asyncSetTimer(asyncFlush, 0);
2333
- }
2334
- }
2335
-
2336
- function invokeResolver(resolver, promise) {
2337
- function resolvePromise(value) {
2338
- resolve(promise, value);
2339
- }
2340
-
2341
- function rejectPromise(reason) {
2342
- reject(promise, reason);
2343
- }
2344
-
2345
- try {
2346
- resolver(resolvePromise, rejectPromise);
2347
- } catch (e) {
2348
- rejectPromise(e);
2349
- }
2350
- }
2351
-
2352
- function invokeCallback(subscriber) {
2353
- var owner = subscriber.owner;
2354
- var settled = owner._state;
2355
- var value = owner._data;
2356
- var callback = subscriber[settled];
2357
- var promise = subscriber.then;
2358
-
2359
- if (typeof callback === 'function') {
2360
- settled = FULFILLED;
2361
- try {
2362
- value = callback(value);
2363
- } catch (e) {
2364
- reject(promise, e);
2365
- }
2366
- }
2367
-
2368
- if (!handleThenable(promise, value)) {
2369
- if (settled === FULFILLED) {
2370
- resolve(promise, value);
2371
- }
2372
-
2373
- if (settled === REJECTED) {
2374
- reject(promise, value);
2375
- }
2376
- }
2377
- }
2378
-
2379
- function handleThenable(promise, value) {
2380
- var resolved;
2381
-
2382
- try {
2383
- if (promise === value) {
2384
- throw new TypeError('A promises callback cannot return that same promise.');
2385
- }
2386
-
2387
- if (value && (typeof value === 'function' || typeof value === 'object')) {
2388
- // then should be retrieved only once
2389
- var then = value.then;
2390
-
2391
- if (typeof then === 'function') {
2392
- then.call(value, function (val) {
2393
- if (!resolved) {
2394
- resolved = true;
2395
-
2396
- if (value === val) {
2397
- fulfill(promise, val);
2398
- } else {
2399
- resolve(promise, val);
2400
- }
2401
- }
2402
- }, function (reason) {
2403
- if (!resolved) {
2404
- resolved = true;
2405
-
2406
- reject(promise, reason);
2407
- }
2408
- });
2409
-
2410
- return true;
2411
- }
2412
- }
2413
- } catch (e) {
2414
- if (!resolved) {
2415
- reject(promise, e);
2416
- }
2417
-
2418
- return true;
2419
- }
2420
-
2421
- return false;
2422
- }
2423
-
2424
- function resolve(promise, value) {
2425
- if (promise === value || !handleThenable(promise, value)) {
2426
- fulfill(promise, value);
2427
- }
2428
- }
2429
-
2430
- function fulfill(promise, value) {
2431
- if (promise._state === PENDING) {
2432
- promise._state = SETTLED;
2433
- promise._data = value;
2434
-
2435
- asyncCall(publishFulfillment, promise);
2436
- }
2437
- }
2438
-
2439
- function reject(promise, reason) {
2440
- if (promise._state === PENDING) {
2441
- promise._state = SETTLED;
2442
- promise._data = reason;
2443
-
2444
- asyncCall(publishRejection, promise);
2445
- }
2446
- }
2447
-
2448
- function publish(promise) {
2449
- promise._then = promise._then.forEach(invokeCallback);
2450
- }
2451
-
2452
- function publishFulfillment(promise) {
2453
- promise._state = FULFILLED;
2454
- publish(promise);
2455
- }
2456
-
2457
- function publishRejection(promise) {
2458
- promise._state = REJECTED;
2459
- publish(promise);
2460
- if (!promise._handled && isNode) {
2461
- index.commonjsGlobal.process.emit('unhandledRejection', promise._data, promise);
2462
- }
2463
- }
2464
-
2465
- function notifyRejectionHandled(promise) {
2466
- index.commonjsGlobal.process.emit('rejectionHandled', promise);
2467
- }
2468
-
2469
- /**
2470
- * @class
2471
- */
2472
- function Promise(resolver) {
2473
- if (typeof resolver !== 'function') {
2474
- throw new TypeError('Promise resolver ' + resolver + ' is not a function');
2475
- }
2476
-
2477
- if (this instanceof Promise === false) {
2478
- throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
2479
- }
2480
-
2481
- this._then = [];
2482
-
2483
- invokeResolver(resolver, this);
2484
- }
2485
-
2486
- Promise.prototype = {
2487
- constructor: Promise,
2488
-
2489
- _state: PENDING,
2490
- _then: null,
2491
- _data: undefined,
2492
- _handled: false,
2493
-
2494
- then: function (onFulfillment, onRejection) {
2495
- var subscriber = {
2496
- owner: this,
2497
- then: new this.constructor(NOOP),
2498
- fulfilled: onFulfillment,
2499
- rejected: onRejection
2500
- };
2501
-
2502
- if ((onRejection || onFulfillment) && !this._handled) {
2503
- this._handled = true;
2504
- if (this._state === REJECTED && isNode) {
2505
- asyncCall(notifyRejectionHandled, this);
2506
- }
2507
- }
2508
-
2509
- if (this._state === FULFILLED || this._state === REJECTED) {
2510
- // already resolved, call callback async
2511
- asyncCall(invokeCallback, subscriber);
2512
- } else {
2513
- // subscribe
2514
- this._then.push(subscriber);
2515
- }
2516
-
2517
- return subscriber.then;
2518
- },
2519
-
2520
- catch: function (onRejection) {
2521
- return this.then(null, onRejection);
2522
- }
2523
- };
2524
-
2525
- Promise.all = function (promises) {
2526
- if (!Array.isArray(promises)) {
2527
- throw new TypeError('You must pass an array to Promise.all().');
2528
- }
2529
-
2530
- return new Promise(function (resolve, reject) {
2531
- var results = [];
2532
- var remaining = 0;
2533
-
2534
- function resolver(index) {
2535
- remaining++;
2536
- return function (value) {
2537
- results[index] = value;
2538
- if (!--remaining) {
2539
- resolve(results);
2540
- }
2541
- };
2542
- }
2543
-
2544
- for (var i = 0, promise; i < promises.length; i++) {
2545
- promise = promises[i];
2546
-
2547
- if (promise && typeof promise.then === 'function') {
2548
- promise.then(resolver(i), reject);
2549
- } else {
2550
- results[i] = promise;
2551
- }
2552
- }
2553
-
2554
- if (!remaining) {
2555
- resolve(results);
2556
- }
2557
- });
2558
- };
2559
-
2560
- Promise.race = function (promises) {
2561
- if (!Array.isArray(promises)) {
2562
- throw new TypeError('You must pass an array to Promise.race().');
2563
- }
2564
-
2565
- return new Promise(function (resolve, reject) {
2566
- for (var i = 0, promise; i < promises.length; i++) {
2567
- promise = promises[i];
2568
-
2569
- if (promise && typeof promise.then === 'function') {
2570
- promise.then(resolve, reject);
2571
- } else {
2572
- resolve(promise);
2573
- }
2574
- }
2575
- });
2576
- };
2577
-
2578
- Promise.resolve = function (value) {
2579
- if (value && typeof value === 'object' && value.constructor === Promise) {
2580
- return value;
2581
- }
2582
-
2583
- return new Promise(function (resolve) {
2584
- resolve(value);
2585
- });
2586
- };
2587
-
2588
- Promise.reject = function (reason) {
2589
- return new Promise(function (resolve, reject) {
2590
- reject(reason);
2591
- });
2592
- };
2593
-
2594
- pinkie = Promise;
2595
- return pinkie;
2596
- }
2597
-
2598
- var pinkiePromise = typeof Promise === 'function' ? Promise : requirePinkie();
2599
-
2600
- var df$1 = dfExports;
2601
- var pify = pifyExports;
2602
- var Promise$1 = pinkiePromise;
2603
-
2604
- var mountPoint$1 = function (file) {
2605
- return pify(df$1.file, Promise$1)(file).then(function (data) {
2606
- return data.mountpoint;
2607
- });
2608
- };
2609
-
2610
- var os = require$$0$2;
2611
-
2612
- function homedir() {
2613
- var env = process.env;
2614
- var home = env.HOME;
2615
- var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
2616
-
2617
- if (process.platform === 'win32') {
2618
- return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
2619
- }
2620
-
2621
- if (process.platform === 'darwin') {
2622
- return home || (user ? '/Users/' + user : null);
2623
- }
2624
-
2625
- if (process.platform === 'linux') {
2626
- return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null));
2627
- }
2628
-
2629
- return home || null;
2630
- }
2631
-
2632
- var osHomedir = typeof os.homedir === 'function' ? os.homedir : homedir;
2633
-
2634
- var userHome$1 = osHomedir();
2635
-
2636
- var xdgBasedir$1 = {};
2637
-
2638
- (function (exports) {
2639
- const os = require$$0$2;
2640
- const path = require$$1;
2641
-
2642
- const homeDirectory = os.homedir();
2643
- const {env} = process;
2644
-
2645
- exports.data = env.XDG_DATA_HOME ||
2646
- (homeDirectory ? path.join(homeDirectory, '.local', 'share') : undefined);
2647
-
2648
- exports.config = env.XDG_CONFIG_HOME ||
2649
- (homeDirectory ? path.join(homeDirectory, '.config') : undefined);
2650
-
2651
- exports.cache = env.XDG_CACHE_HOME || (homeDirectory ? path.join(homeDirectory, '.cache') : undefined);
2652
-
2653
- exports.runtime = env.XDG_RUNTIME_DIR || undefined;
2654
-
2655
- exports.dataDirs = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':');
2656
-
2657
- if (exports.data) {
2658
- exports.dataDirs.unshift(exports.data);
2659
- }
2660
-
2661
- exports.configDirs = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':');
2662
-
2663
- if (exports.config) {
2664
- exports.configDirs.unshift(exports.config);
2665
- }
2666
- } (xdgBasedir$1));
2667
-
2668
- const fs = require$$0.promises;
2669
- const path = require$$1;
2670
- const df = dfExports$1;
2671
- const mountPoint = mountPoint$1;
2672
- const userHome = userHome$1;
2673
- const xdgBasedir = xdgBasedir$1;
2674
-
2675
- const check = async filePath => {
2676
- const topuid = `${filePath}-${process.getuid()}`;
2677
- const stickyBitMode = 17407;
2678
-
2679
- try {
2680
- const stats = await fs.lstat(filePath);
2681
-
2682
- if (stats.isSymbolicLink() || stats.mode !== stickyBitMode) {
2683
- return topuid;
2684
- }
2685
-
2686
- return path.join(filePath, String(process.getuid()));
2687
- } catch (error) {
2688
- if (error.code === 'ENOENT') {
2689
- return topuid;
2690
- }
2691
-
2692
- return path.join(xdgBasedir.data, 'Trash');
2693
- }
2694
- };
2695
-
2696
- xdgTrashdir$1.exports = async filePath => {
2697
- if (process.platform !== 'linux') {
2698
- return Promise.reject(new Error('Only Linux systems are supported'));
2699
- }
2700
-
2701
- if (!filePath) {
2702
- return Promise.resolve(path.join(xdgBasedir.data, 'Trash'));
2703
- }
2704
-
2705
- const [homeMountPoint, fileMountPoint] = await Promise.all([
2706
- mountPoint(userHome),
2707
- // Ignore errors in case `file` is a dangling symlink
2708
- mountPoint(filePath).catch(() => {})
2709
- ]);
2710
-
2711
- if (!fileMountPoint || fileMountPoint === homeMountPoint) {
2712
- return path.join(xdgBasedir.data, 'Trash');
2713
- }
2714
-
2715
- return check(path.join(fileMountPoint, '.Trash'));
2716
- };
2717
-
2718
- xdgTrashdir$1.exports.all = async () => {
2719
- if (process.platform !== 'linux') {
2720
- return Promise.reject(new Error('Only Linux systems are supported'));
2721
- }
2722
-
2723
- return Promise.all((await df()).map(fileSystem => {
2724
- if (fileSystem.mountpoint === '/') {
2725
- return path.join(xdgBasedir.data, 'Trash');
2726
- }
2727
-
2728
- return check(path.join(fileSystem.mountpoint, '.Trash'));
2729
- }));
2730
- };
2731
-
2732
- var xdgTrashdirExports = xdgTrashdir$1.exports;
2733
- var xdgTrashdir = /*@__PURE__*/index.getDefaultExportFromCjs(xdgTrashdirExports);
2734
-
2735
- function indentString(string, count = 1, options = {}) {
2736
- const {
2737
- indent = ' ',
2738
- includeEmptyLines = false
2739
- } = options;
2740
-
2741
- if (typeof string !== 'string') {
2742
- throw new TypeError(
2743
- `Expected \`input\` to be a \`string\`, got \`${typeof string}\``
2744
- );
2745
- }
2746
-
2747
- if (typeof count !== 'number') {
2748
- throw new TypeError(
2749
- `Expected \`count\` to be a \`number\`, got \`${typeof count}\``
2750
- );
2751
- }
2752
-
2753
- if (count < 0) {
2754
- throw new RangeError(
2755
- `Expected \`count\` to be at least 0, got \`${count}\``
2756
- );
2757
- }
2758
-
2759
- if (typeof indent !== 'string') {
2760
- throw new TypeError(
2761
- `Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
2762
- );
2763
- }
2764
-
2765
- if (count === 0) {
2766
- return string;
2767
- }
2768
-
2769
- const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
2770
-
2771
- return string.replace(regex, indent.repeat(count));
2772
- }
2773
-
2774
- function escapeStringRegexp(string) {
2775
- if (typeof string !== 'string') {
2776
- throw new TypeError('Expected a string');
2777
- }
2778
-
2779
- // Escape characters with special meaning either inside or outside character sets.
2780
- // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
2781
- return string
2782
- .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
2783
- .replace(/-/g, '\\x2d');
2784
- }
2785
-
2786
- const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
2787
- const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
2788
- const homeDir = typeof require$$0$2.homedir === 'undefined' ? '' : require$$0$2.homedir().replace(/\\/g, '/');
2789
-
2790
- function cleanStack(stack, {pretty = false, basePath} = {}) {
2791
- const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, '/'))}`, 'g');
2792
-
2793
- if (typeof stack !== 'string') {
2794
- return undefined;
2795
- }
2796
-
2797
- return stack.replace(/\\/g, '/')
2798
- .split('\n')
2799
- .filter(line => {
2800
- const pathMatches = line.match(extractPathRegex);
2801
- if (pathMatches === null || !pathMatches[1]) {
2802
- return true;
2803
- }
2804
-
2805
- const match = pathMatches[1];
2806
-
2807
- // Electron
2808
- if (
2809
- match.includes('.app/Contents/Resources/electron.asar') ||
2810
- match.includes('.app/Contents/Resources/default_app.asar') ||
2811
- match.includes('node_modules/electron/dist/resources/electron.asar') ||
2812
- match.includes('node_modules/electron/dist/resources/default_app.asar')
2813
- ) {
2814
- return false;
2815
- }
2816
-
2817
- return !pathRegex.test(match);
2818
- })
2819
- .filter(line => line.trim() !== '')
2820
- .map(line => {
2821
- if (basePathRegex) {
2822
- line = line.replace(basePathRegex, '$1');
2823
- }
2824
-
2825
- if (pretty) {
2826
- line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
2827
- }
2828
-
2829
- return line;
2830
- })
2831
- .join('\n');
2832
- }
2833
-
2834
- const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, '');
2835
-
2836
- class AggregateError extends Error {
2837
- #errors;
2838
-
2839
- name = 'AggregateError';
2840
-
2841
- constructor(errors) {
2842
- if (!Array.isArray(errors)) {
2843
- throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
2844
- }
2845
-
2846
- errors = errors.map(error => {
2847
- if (error instanceof Error) {
2848
- return error;
2849
- }
2850
-
2851
- if (error !== null && typeof error === 'object') {
2852
- // Handle plain error objects with message property and/or possibly other metadata
2853
- return Object.assign(new Error(error.message), error);
2854
- }
2855
-
2856
- return new Error(error);
2857
- });
2858
-
2859
- let message = errors
2860
- .map(error => {
2861
- // The `stack` property is not standardized, so we can't assume it exists
2862
- return typeof error.stack === 'string' && error.stack.length > 0 ? cleanInternalStack(cleanStack(error.stack)) : String(error);
2863
- })
2864
- .join('\n');
2865
- message = '\n' + indentString(message, 4);
2866
- super(message);
2867
-
2868
- this.#errors = errors;
2869
- }
2870
-
2871
- get errors() {
2872
- return this.#errors.slice();
2873
- }
2874
- }
2875
-
2876
- /**
2877
- An error to be thrown when the request is aborted by AbortController.
2878
- DOMException is thrown instead of this Error when DOMException is available.
2879
- */
2880
- class AbortError extends Error {
2881
- constructor(message) {
2882
- super();
2883
- this.name = 'AbortError';
2884
- this.message = message;
2885
- }
2886
- }
2887
-
2888
- /**
2889
- TODO: Remove AbortError and just throw DOMException when targeting Node 18.
2890
- */
2891
- const getDOMException = errorMessage => globalThis.DOMException === undefined
2892
- ? new AbortError(errorMessage)
2893
- : new DOMException(errorMessage);
2894
-
2895
- /**
2896
- TODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.
2897
- */
2898
- const getAbortedReason = signal => {
2899
- const reason = signal.reason === undefined
2900
- ? getDOMException('This operation was aborted.')
2901
- : signal.reason;
2902
-
2903
- return reason instanceof Error ? reason : getDOMException(reason);
2904
- };
2905
-
2906
- async function pMap(
2907
- iterable,
2908
- mapper,
2909
- {
2910
- concurrency = Number.POSITIVE_INFINITY,
2911
- stopOnError = true,
2912
- signal,
2913
- } = {},
2914
- ) {
2915
- return new Promise((resolve, reject_) => {
2916
- if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
2917
- throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
2918
- }
2919
-
2920
- if (typeof mapper !== 'function') {
2921
- throw new TypeError('Mapper function is required');
2922
- }
2923
-
2924
- if (!((Number.isSafeInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency >= 1)) {
2925
- throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
2926
- }
2927
-
2928
- const result = [];
2929
- const errors = [];
2930
- const skippedIndexesMap = new Map();
2931
- let isRejected = false;
2932
- let isResolved = false;
2933
- let isIterableDone = false;
2934
- let resolvingCount = 0;
2935
- let currentIndex = 0;
2936
- const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
2937
-
2938
- const reject = reason => {
2939
- isRejected = true;
2940
- isResolved = true;
2941
- reject_(reason);
2942
- };
2943
-
2944
- if (signal) {
2945
- if (signal.aborted) {
2946
- reject(getAbortedReason(signal));
2947
- }
2948
-
2949
- signal.addEventListener('abort', () => {
2950
- reject(getAbortedReason(signal));
2951
- });
2952
- }
2953
-
2954
- const next = async () => {
2955
- if (isResolved) {
2956
- return;
2957
- }
2958
-
2959
- const nextItem = await iterator.next();
2960
-
2961
- const index = currentIndex;
2962
- currentIndex++;
2963
-
2964
- // Note: `iterator.next()` can be called many times in parallel.
2965
- // This can cause multiple calls to this `next()` function to
2966
- // receive a `nextItem` with `done === true`.
2967
- // The shutdown logic that rejects/resolves must be protected
2968
- // so it runs only one time as the `skippedIndex` logic is
2969
- // non-idempotent.
2970
- if (nextItem.done) {
2971
- isIterableDone = true;
2972
-
2973
- if (resolvingCount === 0 && !isResolved) {
2974
- if (!stopOnError && errors.length > 0) {
2975
- reject(new AggregateError(errors));
2976
- return;
2977
- }
2978
-
2979
- isResolved = true;
2980
-
2981
- if (skippedIndexesMap.size === 0) {
2982
- resolve(result);
2983
- return;
2984
- }
2985
-
2986
- const pureResult = [];
2987
-
2988
- // Support multiple `pMapSkip`'s.
2989
- for (const [index, value] of result.entries()) {
2990
- if (skippedIndexesMap.get(index) === pMapSkip) {
2991
- continue;
2992
- }
2993
-
2994
- pureResult.push(value);
2995
- }
2996
-
2997
- resolve(pureResult);
2998
- }
2999
-
3000
- return;
3001
- }
3002
-
3003
- resolvingCount++;
3004
-
3005
- // Intentionally detached
3006
- (async () => {
3007
- try {
3008
- const element = await nextItem.value;
3009
-
3010
- if (isResolved) {
3011
- return;
3012
- }
3013
-
3014
- const value = await mapper(element, index);
3015
-
3016
- // Use Map to stage the index of the element.
3017
- if (value === pMapSkip) {
3018
- skippedIndexesMap.set(index, value);
3019
- }
3020
-
3021
- result[index] = value;
3022
-
3023
- resolvingCount--;
3024
- await next();
3025
- } catch (error) {
3026
- if (stopOnError) {
3027
- reject(error);
3028
- } else {
3029
- errors.push(error);
3030
- resolvingCount--;
3031
-
3032
- // In that case we can't really continue regardless of `stopOnError` state
3033
- // since an iterable is likely to continue throwing after it throws once.
3034
- // If we continue calling `next()` indefinitely we will likely end up
3035
- // in an infinite loop of failed iteration.
3036
- try {
3037
- await next();
3038
- } catch (error) {
3039
- reject(error);
3040
- }
3041
- }
3042
- }
3043
- })();
3044
- };
3045
-
3046
- // Create the concurrent runners in a detached (non-awaited)
3047
- // promise. We need this so we can await the `next()` calls
3048
- // to stop creating runners before hitting the concurrency limit
3049
- // if the iterable has already been marked as done.
3050
- // NOTE: We *must* do this for async iterators otherwise we'll spin up
3051
- // infinite `next()` calls by default and never start the event loop.
3052
- (async () => {
3053
- for (let index = 0; index < concurrency; index++) {
3054
- try {
3055
- // eslint-disable-next-line no-await-in-loop
3056
- await next();
3057
- } catch (error) {
3058
- reject(error);
3059
- break;
3060
- }
3061
-
3062
- if (isIterableDone || isRejected) {
3063
- break;
3064
- }
3065
- }
3066
- })();
3067
- });
3068
- }
3069
-
3070
- const pMapSkip = Symbol('skip');
3071
-
3072
- async function pathExists(path) {
3073
- try {
3074
- await fs$3.promises.access(path);
3075
- return true;
3076
- } catch {
3077
- return false;
3078
- }
3079
- }
3080
-
3081
- const resolvePath = (cwd, sourcePath, destinationPath) => {
3082
- sourcePath = path$5.resolve(cwd, sourcePath);
3083
- destinationPath = path$5.resolve(cwd, destinationPath);
3084
-
3085
- return {
3086
- sourcePath,
3087
- destinationPath,
3088
- };
3089
- };
3090
-
3091
- const validatePathsExist = (sourcePath, destinationPath, suffix = 'Path') => {
3092
- if (!sourcePath || !destinationPath) {
3093
- throw new TypeError(`\`source${suffix}\` and \`destination${suffix}\` required`);
3094
- }
3095
- };
3096
-
3097
- const validateSameDirectory = (source, destination) => {
3098
- if (path$5.dirname(source) !== path$5.dirname(destination)) {
3099
- throw new Error('`source` and `destination` must be in the same directory');
3100
- }
3101
- };
3102
-
3103
- const _moveFile = async (sourcePath, destinationPath, {overwrite = true, cwd = process$2.cwd(), directoryMode, validateDirectory = false} = {}) => {
3104
- if (cwd) {
3105
- ({sourcePath, destinationPath} = resolvePath(cwd, sourcePath, destinationPath));
3106
- }
3107
-
3108
- if (validateDirectory) {
3109
- validateSameDirectory(sourcePath, destinationPath);
3110
- }
3111
-
3112
- if (!overwrite && await pathExists(destinationPath)) {
3113
- throw new Error(`The destination file exists: ${destinationPath}`);
3114
- }
3115
-
3116
- await fs$3.promises.mkdir(path$5.dirname(destinationPath), {
3117
- recursive: true,
3118
- mode: directoryMode,
3119
- });
3120
-
3121
- try {
3122
- await fs$3.promises.rename(sourcePath, destinationPath);
3123
- } catch (error) {
3124
- if (error.code === 'EXDEV') {
3125
- await fs$3.promises.copyFile(sourcePath, destinationPath);
3126
- await fs$3.promises.unlink(sourcePath);
3127
- } else {
3128
- throw error;
3129
- }
3130
- }
3131
- };
3132
-
3133
- async function moveFile(sourcePath, destinationPath, options) {
3134
- validatePathsExist(sourcePath, destinationPath);
3135
- return _moveFile(sourcePath, destinationPath, options);
3136
- }
3137
-
3138
- let ProcfsError$1 = class ProcfsError extends Error {
3139
- constructor(code, message, sourceError) {
3140
- super(message);
3141
- this.name = 'ProcfsError';
3142
- this.code = code;
3143
- if (sourceError !== undefined) {
3144
- this.sourceError = sourceError;
3145
- }
3146
- }
3147
- };
3148
-
3149
- ProcfsError$1.ERR_PARSING_FAILED = 'EPARSE';
3150
- ProcfsError$1.ERR_UNKNOWN = 'EUNKNOWN';
3151
- ProcfsError$1.ERR_NOT_FOUND = 'ENOENT';
3152
-
3153
- ProcfsError$1.parsingError = (src, msg) => {
3154
- let e = new ProcfsError$1(ProcfsError$1.ERR_PARSING_FAILED, `Parsing failed: ${msg}`);
3155
- e.sourceText = src;
3156
- return e;
3157
- };
3158
-
3159
- ProcfsError$1.generic = err => {
3160
- /* istanbul ignore next should not ever happen */
3161
- if (err instanceof ProcfsError$1) {
3162
- return err;
3163
- }
3164
-
3165
- switch (err.code) {
3166
- case 'ENOENT':
3167
- return new ProcfsError$1(ProcfsError$1.ERR_NOT_FOUND, 'File not found', err);
3168
- /* istanbul ignore next should not ever happen*/
3169
- default:
3170
- return new ProcfsError$1(ProcfsError$1.ERR_UNKNOWN, `Unknown error: ${err.message}`, err);
3171
- }
3172
- };
3173
-
3174
- var procfsError = ProcfsError$1;
3175
-
3176
- const trim = str => str.trim();
3177
-
3178
- class Parsers {}
3179
-
3180
- const parsers$1 = new Parsers();
3181
-
3182
- for (let name of [
3183
- 'cgroups',
3184
- 'config',
3185
- 'cpuinfo',
3186
- 'devices',
3187
- 'diskstats',
3188
- 'filesystems',
3189
- 'loadavg',
3190
- 'meminfo',
3191
- 'partitions',
3192
- 'processAutogroup',
3193
- 'processCgroups',
3194
- 'processCmdline',
3195
- 'processEnviron',
3196
- 'processes',
3197
- 'processExe',
3198
- 'processFd',
3199
- 'processFdinfo',
3200
- 'processFds',
3201
- 'processGidMap',
3202
- 'processIo',
3203
- 'processLimits',
3204
- 'processMountinfo',
3205
- 'processNetDev',
3206
- 'processNetTcp4',
3207
- 'processNetTcp6',
3208
- 'processNetUdp4',
3209
- 'processNetUdp6',
3210
- 'processNetUnix',
3211
- 'processNetWireless',
3212
- 'processStat',
3213
- 'processStatm',
3214
- 'processStatus',
3215
- 'processThreads',
3216
- 'processUidMap',
3217
- 'stat',
3218
- 'swaps',
3219
- 'uptime',
3220
- ]) {
3221
- Object.defineProperty(Parsers.prototype, name, {
3222
- get: function () { // eslint-disable-line object-shorthand
3223
- let value = index.commonjsRequire(`./parsers/${name}`);
3224
- Object.defineProperty(this, name, {value});
3225
- return value;
3226
- },
3227
- });
3228
- }
3229
-
3230
- parsers$1.cmdline = trim;
3231
- parsers$1.processComm = trim;
3232
- parsers$1.processCpuset = trim;
3233
- parsers$1.processOomScore = src => parseInt(src);
3234
- parsers$1.processTimerslackNs = src => parseInt(src);
3235
- parsers$1.version = trim;
3236
- parsers$1.processCwd = src => src;
3237
- parsers$1.processPersonality = src => parseInt(src, 16);
3238
-
3239
- var parsers_1 = parsers$1;
3240
-
3241
- const {
3242
- readlinkSync,
3243
- readdirSync,
3244
- openSync,
3245
- readSync,
3246
- closeSync,
3247
- readFileSync,
3248
- existsSync,
3249
- } = require$$0;
3250
-
3251
- const tmpBufMinLen = 4096 * 2;
3252
- const tmpBufMaxLen = 4096 * 8;
3253
-
3254
- let tmpBuf = Buffer.allocUnsafeSlow(tmpBufMinLen);
3255
-
3256
- const read$1 = path => {
3257
- const fd = openSync(path, 'r', 0o666);
3258
- let pos = 0;
3259
- let bytesRead;
3260
- let buf = tmpBuf;
3261
- let length = buf.length;
3262
- do {
3263
- bytesRead = readSync(fd, buf, pos, buf.length - pos, null);
3264
- pos += bytesRead;
3265
- if (pos === tmpBuf.length) {
3266
- length = length << 1;
3267
- let newBuf = Buffer.allocUnsafeSlow(length);
3268
-
3269
- if (length <= tmpBufMaxLen) {
3270
- tmpBuf = newBuf;
3271
- }
3272
-
3273
- buf.copy(newBuf);
3274
- buf = newBuf;
3275
- }
3276
- } while (bytesRead !== 0);
3277
- closeSync(fd);
3278
- return buf.toString('utf8', 0, pos);
3279
- };
3280
-
3281
- const readIdList = path => {
3282
- let ls = readdirSync(path);
3283
- for (let i = 0; i < ls.length; i++) {
3284
- ls[i] = parseInt(ls[i]);
3285
- }
3286
- return ls;
3287
- };
3288
-
3289
- const readBuffer$1 = readFileSync;
3290
- const exists = existsSync;
3291
- const readdir$1 = readdirSync;
3292
-
3293
- const devIdGetMinor$1 = devId => (((devId >> 20) << 8) | (devId & 0xFF));
3294
- const devIdGetMajor$1 = devId => ((devId >> 8) & 0xFF);
3295
- const devIdFromMajorMinor$1 = (major, minor) => (((minor >> 8) << 20) | ((major & 0xFF) << 8) | (minor & 0xFF));
3296
-
3297
- var utils = {
3298
- read: read$1,
3299
- readLink: readlinkSync,
3300
- readIdList,
3301
- readBuffer: readBuffer$1,
3302
- exists,
3303
- readdir: readdir$1,
3304
-
3305
- devIdGetMinor: devIdGetMinor$1,
3306
- devIdGetMajor: devIdGetMajor$1,
3307
- devIdFromMajorMinor: devIdFromMajorMinor$1,
3308
- };
3309
-
3310
- const ProcfsError = procfsError;
3311
- const parsers = parsers_1;
3312
- const {
3313
- read,
3314
- readLink,
3315
- readBuffer,
3316
- readdir,
3317
- devIdGetMinor,
3318
- devIdGetMajor,
3319
- devIdFromMajorMinor,
3320
- } = utils;
3321
-
3322
- class Procfs {
3323
- constructor(root) {
3324
- if (root === undefined) {
3325
- root = '/proc';
3326
- }
3327
- this.root = root;
3328
- this.rootSlash = `${root}/`;
3329
- }
3330
-
3331
- processes() {
3332
- try {
3333
- return parsers.processes(readdir(this.root));
3334
- } catch (error) {
3335
- /* istanbul ignore next should not ever happen when procfs exists */
3336
- throw ProcfsError.generic(error);
3337
- }
3338
- }
3339
-
3340
- processFds(pid) {
3341
- if (pid !== undefined && (!Number.isInteger(pid) || pid <= 0)) {
3342
- throw new TypeError('pid');
3343
- }
3344
- try {
3345
- return parsers.processFds(readdir(`${this.rootSlash}${pid === undefined ? 'self' : pid}/fd`));
3346
- } catch (error) {
3347
- throw ProcfsError.generic(error);
3348
- }
3349
- }
3350
-
3351
- processThreads(pid) {
3352
- if (pid !== undefined && (!Number.isInteger(pid) || pid <= 0)) {
3353
- throw new TypeError('pid');
3354
- }
3355
- try {
3356
- return parsers.processThreads(readdir(`${this.rootSlash}${pid === undefined ? 'self' : pid}/task`));
3357
- } catch (error) {
3358
- throw ProcfsError.generic(error);
3359
- }
3360
- }
3361
-
3362
- processFdinfo(fd, pid) {
3363
- if (pid !== undefined && !(Number.isInteger(pid) && pid >= 0)) {
3364
- throw new TypeError('pid');
3365
- }
3366
- if (!Number.isInteger(fd) || fd <= 0) {
3367
- throw new TypeError('fd');
3368
- }
3369
- try {
3370
- return parsers.processFdinfo(read(`${this.rootSlash}${pid === undefined ? 'self' : pid}/fdinfo/${fd}`));
3371
- } catch (error) {
3372
- throw ProcfsError.generic(error);
3373
- }
3374
- }
3375
-
3376
- processFd(fd, pid) {
3377
- if (pid !== undefined && !(Number.isInteger(pid) && pid >= 0)) {
3378
- throw new TypeError('pid');
3379
- }
3380
- if (!Number.isInteger(fd) || fd <= 0) {
3381
- throw new TypeError('fd');
3382
- }
3383
- try {
3384
- return parsers.processFd(readLink(`${this.rootSlash}${pid === undefined ? 'self' : pid}/fd/${fd}`));
3385
- } catch (error) {
3386
- throw ProcfsError.generic(error);
3387
- }
3388
- }
3389
-
3390
- config() {
3391
- try {
3392
- return parsers.config(readBuffer(`${this.rootSlash}config.gz`));
3393
- } catch (error) {
3394
- /* istanbul ignore next should not ever happen when procfs exists and kernel properly configured */
3395
- throw ProcfsError.generic(error);
3396
- }
3397
- }
3398
- }
3399
-
3400
- Procfs.prototype.devIdGetMinor = devIdGetMinor;
3401
- Procfs.prototype.devIdGetMajor = devIdGetMajor;
3402
- Procfs.prototype.devIdFromMajorMinor = devIdFromMajorMinor;
3403
-
3404
- for (let [name, path] of [
3405
- ['processExe', '/exe'],
3406
- ['processCwd', '/cwd'],
3407
- ]) {
3408
- Procfs.prototype[name] = function (pid) {
3409
- if (pid !== undefined && !(Number.isInteger(pid) && pid >= 0)) {
3410
- throw new TypeError('pid');
3411
- }
3412
- try {
3413
- return parsers[name](readLink(`${this.rootSlash}${pid === undefined ? 'self' : pid}${path}`));
3414
- } catch (error) {
3415
- throw ProcfsError.generic(error);
3416
- }
3417
- };
3418
- }
3419
-
3420
- for (let [name, path] of [
3421
- ['processMountinfo', '/mountinfo'],
3422
- ['processIo', '/io'],
3423
- ['processUidMap', '/uid_map'],
3424
- ['processGidMap', '/gid_map'],
3425
- ['processEnviron', '/environ'],
3426
- ['processOomScore', '/oom_score'],
3427
- ['processTimerslackNs', '/timerslack_ns'],
3428
- ['processCmdline', '/cmdline'],
3429
- ['processAutogroup', '/autogroup'],
3430
- ['processStatm', '/statm'],
3431
- ['processComm', '/comm'],
3432
- ['processPersonality', '/personality'],
3433
- ['processCgroups', '/cgroup'],
3434
- ['processCpuset', '/cpuset'],
3435
- ['processLimits', '/limits'],
3436
- ['processStat', '/stat'],
3437
- ['processStatus', '/status'],
3438
- ['processNetDev', '/net/dev'],
3439
- ['processNetWireless', '/net/wireless'],
3440
- ['processNetUnix', '/net/unix'],
3441
- ['processNetTcp4', '/net/tcp'],
3442
- ['processNetTcp6', '/net/tcp6'],
3443
- ['processNetUdp4', '/net/udp'],
3444
- ['processNetUdp6', '/net/udp6'],
3445
- ]) {
3446
- Procfs.prototype[name] = function (pid) {
3447
- if (pid !== undefined && !(Number.isInteger(pid) && pid >= 0)) {
3448
- throw new TypeError('pid');
3449
- }
3450
- try {
3451
- return parsers[name](read(`${this.rootSlash}${pid === undefined ? 'self' : pid}${path}`));
3452
- } catch (error) {
3453
- throw ProcfsError.generic(error);
3454
- }
3455
- };
3456
- }
3457
-
3458
- for (let name of [
3459
- 'cpuinfo',
3460
- 'loadavg',
3461
- 'uptime',
3462
- 'version',
3463
- 'cmdline',
3464
- 'swaps',
3465
- 'stat',
3466
- 'devices',
3467
- 'filesystems',
3468
- 'diskstats',
3469
- 'partitions',
3470
- 'meminfo',
3471
- 'cgroups',
3472
- ]) {
3473
- Procfs.prototype[name] = function () {
3474
- try {
3475
- return parsers[name](read(this.rootSlash + name));
3476
- } catch (error) {
3477
- /* istanbul ignore next should not ever happen when procfs exists */
3478
- throw ProcfsError.generic(error);
3479
- }
3480
- };
3481
- }
3482
-
3483
- for (let [name, parser, path] of [
3484
- ['netDev', 'processNetDev', 'net/dev'],
3485
- ['netWireless', 'processNetWireless', 'net/wireless'],
3486
- ['netUnix', 'processNetUnix', 'net/unix'],
3487
- ['netTcp4', 'processNetTcp4', 'net/tcp'],
3488
- ['netTcp6', 'processNetTcp6', 'net/tcp6'],
3489
- ['netUdp4', 'processNetUdp4', 'net/udp'],
3490
- ['netUdp6', 'processNetUdp6', 'net/udp6'],
3491
- ]) {
3492
- Procfs.prototype[name] = function () {
3493
- try {
3494
- return parsers[parser](read(this.rootSlash + path));
3495
- } catch (error) {
3496
- /* istanbul ignore next should not ever happen when procfs exists */
3497
- throw ProcfsError.generic(error);
3498
- }
3499
- };
3500
- }
3501
-
3502
- const procfs = new Procfs();
3503
- var procfs_1 = {
3504
- procfs,
3505
- Procfs,
3506
- ProcfsError,
3507
- };
3508
-
3509
- // Educated guess, values of 16 to 64 seem to be optimal for modern SSD, 8-16 and 64-128 can be a bit slower.
3510
- // We should be ok as long as ssdCount <= cpuCount <= ssdCount*16.
3511
- // For slower media this is not as important and we rely on OS handling it for us.
3512
- const concurrency = os$3.cpus().length * 8;
3513
-
3514
- const pad = number => number < 10 ? '0' + number : number;
3515
-
3516
- const getDeletionDate = date => date.getFullYear()
3517
- + '-' + pad(date.getMonth() + 1)
3518
- + '-' + pad(date.getDate())
3519
- + 'T' + pad(date.getHours())
3520
- + ':' + pad(date.getMinutes())
3521
- + ':' + pad(date.getSeconds());
3522
-
3523
- const trash = async (filePath, trashPaths) => {
3524
- const name = v4();
3525
- const destination = path$5.join(trashPaths.filesPath, name);
3526
- const trashInfoPath = path$5.join(trashPaths.infoPath, `${name}.trashinfo`);
3527
-
3528
- const trashInfoData = `[Trash Info]\nPath=${filePath.replace(/\s/g, '%20')}\nDeletionDate=${getDeletionDate(new Date())}`;
3529
-
3530
- await fs$3.promises.writeFile(trashInfoPath, trashInfoData);
3531
- await moveFile(filePath, destination);
3532
-
3533
- return {
3534
- path: destination,
3535
- info: trashInfoPath,
3536
- };
3537
- };
3538
-
3539
- async function linux(paths) {
3540
- const mountPointMap = new Map();
3541
-
3542
- for (const mountInfo of Object.values(procfs_1.procfs.processMountinfo())) {
3543
- // Filter out irrelevant drives (that start with `/snap`, `/run`, etc).
3544
- if (/^\/(snap|var\/snap|run|sys|proc|dev)($|\/)/.test(mountInfo.mountPoint)) {
3545
- continue;
3546
- }
3547
-
3548
- // Keep the first one if there are multiple `devId`.
3549
- if (!mountPointMap.has(mountInfo.devId)) {
3550
- mountPointMap.set(mountInfo.devId, mountInfo.mountPoint);
3551
- }
3552
- }
3553
-
3554
- const trashPathsCache = new Map();
3555
-
3556
- const getDeviceTrashPaths = async devId => {
3557
- let trashPathsPromise = trashPathsCache.get(devId);
3558
- if (trashPathsPromise === undefined) {
3559
- trashPathsPromise = (async () => {
3560
- const trashPath = await xdgTrashdir(mountPointMap.get(devId));
3561
- const paths = {
3562
- filesPath: path$5.join(trashPath, 'files'),
3563
- infoPath: path$5.join(trashPath, 'info'),
3564
- };
3565
- await fs$3.promises.mkdir(paths.filesPath, {mode: 0o700, recursive: true});
3566
- await fs$3.promises.mkdir(paths.infoPath, {mode: 0o700, recursive: true});
3567
- return paths;
3568
- })();
3569
- trashPathsCache.set(devId, trashPathsPromise);
3570
- }
3571
-
3572
- return trashPathsPromise;
3573
- };
3574
-
3575
- return pMap(paths, async filePath => {
3576
- const stats = await fs$3.promises.lstat(filePath);
3577
- const trashPaths = await getDeviceTrashPaths(stats.dev);
3578
- return trash(filePath, trashPaths);
3579
- }, {concurrency});
3580
- }
3581
-
3582
- exports.default = linux;