@rspress/core 2.0.0-beta.20 → 2.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/94.js ADDED
@@ -0,0 +1,1787 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export const __webpack_ids__ = [
4
+ "94"
5
+ ];
6
+ export const __webpack_modules__ = {
7
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
8
+ const cp = __webpack_require__("child_process");
9
+ const parse = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js");
10
+ const enoent = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");
11
+ function spawn(command, args, options) {
12
+ const parsed = parse(command, args, options);
13
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
14
+ enoent.hookChildProcess(spawned, parsed);
15
+ return spawned;
16
+ }
17
+ function spawnSync(command, args, options) {
18
+ const parsed = parse(command, args, options);
19
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
20
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
21
+ return result;
22
+ }
23
+ module.exports = spawn;
24
+ module.exports.spawn = spawn;
25
+ module.exports.sync = spawnSync;
26
+ module.exports._parse = parse;
27
+ module.exports._enoent = enoent;
28
+ },
29
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js": function(module) {
30
+ const isWin = 'win32' === process.platform;
31
+ function notFoundError(original, syscall) {
32
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
33
+ code: 'ENOENT',
34
+ errno: 'ENOENT',
35
+ syscall: `${syscall} ${original.command}`,
36
+ path: original.command,
37
+ spawnargs: original.args
38
+ });
39
+ }
40
+ function hookChildProcess(cp, parsed) {
41
+ if (!isWin) return;
42
+ const originalEmit = cp.emit;
43
+ cp.emit = function(name, arg1) {
44
+ if ('exit' === name) {
45
+ const err = verifyENOENT(arg1, parsed);
46
+ if (err) return originalEmit.call(cp, 'error', err);
47
+ }
48
+ return originalEmit.apply(cp, arguments);
49
+ };
50
+ }
51
+ function verifyENOENT(status, parsed) {
52
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
53
+ return null;
54
+ }
55
+ function verifyENOENTSync(status, parsed) {
56
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
57
+ return null;
58
+ }
59
+ module.exports = {
60
+ hookChildProcess,
61
+ verifyENOENT,
62
+ verifyENOENTSync,
63
+ notFoundError
64
+ };
65
+ },
66
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js": function(module, __unused_webpack_exports, __webpack_require__) {
67
+ const path = __webpack_require__("path");
68
+ const resolveCommand = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js");
69
+ const escape = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js");
70
+ const readShebang = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js");
71
+ const isWin = 'win32' === process.platform;
72
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
73
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
74
+ function detectShebang(parsed) {
75
+ parsed.file = resolveCommand(parsed);
76
+ const shebang = parsed.file && readShebang(parsed.file);
77
+ if (shebang) {
78
+ parsed.args.unshift(parsed.file);
79
+ parsed.command = shebang;
80
+ return resolveCommand(parsed);
81
+ }
82
+ return parsed.file;
83
+ }
84
+ function parseNonShell(parsed) {
85
+ if (!isWin) return parsed;
86
+ const commandFile = detectShebang(parsed);
87
+ const needsShell = !isExecutableRegExp.test(commandFile);
88
+ if (parsed.options.forceShell || needsShell) {
89
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
90
+ parsed.command = path.normalize(parsed.command);
91
+ parsed.command = escape.command(parsed.command);
92
+ parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
93
+ const shellCommand = [
94
+ parsed.command
95
+ ].concat(parsed.args).join(' ');
96
+ parsed.args = [
97
+ '/d',
98
+ '/s',
99
+ '/c',
100
+ `"${shellCommand}"`
101
+ ];
102
+ parsed.command = process.env.comspec || 'cmd.exe';
103
+ parsed.options.windowsVerbatimArguments = true;
104
+ }
105
+ return parsed;
106
+ }
107
+ function parse(command, args, options) {
108
+ if (args && !Array.isArray(args)) {
109
+ options = args;
110
+ args = null;
111
+ }
112
+ args = args ? args.slice(0) : [];
113
+ options = Object.assign({}, options);
114
+ const parsed = {
115
+ command,
116
+ args,
117
+ options,
118
+ file: void 0,
119
+ original: {
120
+ command,
121
+ args
122
+ }
123
+ };
124
+ return options.shell ? parsed : parseNonShell(parsed);
125
+ }
126
+ module.exports = parse;
127
+ },
128
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js": function(module) {
129
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
130
+ function escapeCommand(arg) {
131
+ arg = arg.replace(metaCharsRegExp, '^$1');
132
+ return arg;
133
+ }
134
+ function escapeArgument(arg, doubleEscapeMetaChars) {
135
+ arg = `${arg}`;
136
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
137
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
138
+ arg = `"${arg}"`;
139
+ arg = arg.replace(metaCharsRegExp, '^$1');
140
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
141
+ return arg;
142
+ }
143
+ module.exports.command = escapeCommand;
144
+ module.exports.argument = escapeArgument;
145
+ },
146
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js": function(module, __unused_webpack_exports, __webpack_require__) {
147
+ const fs = __webpack_require__("fs");
148
+ const shebangCommand = __webpack_require__("../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");
149
+ function readShebang(command) {
150
+ const size = 150;
151
+ const buffer = Buffer.alloc(size);
152
+ let fd;
153
+ try {
154
+ fd = fs.openSync(command, 'r');
155
+ fs.readSync(fd, buffer, 0, size, 0);
156
+ fs.closeSync(fd);
157
+ } catch (e) {}
158
+ return shebangCommand(buffer.toString());
159
+ }
160
+ module.exports = readShebang;
161
+ },
162
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js": function(module, __unused_webpack_exports, __webpack_require__) {
163
+ const path = __webpack_require__("path");
164
+ const which = __webpack_require__("../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js");
165
+ const getPathKey = __webpack_require__("../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");
166
+ function resolveCommandAttempt(parsed, withoutPathExt) {
167
+ const env = parsed.options.env || process.env;
168
+ const cwd = process.cwd();
169
+ const hasCustomCwd = null != parsed.options.cwd;
170
+ const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
171
+ if (shouldSwitchCwd) try {
172
+ process.chdir(parsed.options.cwd);
173
+ } catch (err) {}
174
+ let resolved;
175
+ try {
176
+ resolved = which.sync(parsed.command, {
177
+ path: env[getPathKey({
178
+ env
179
+ })],
180
+ pathExt: withoutPathExt ? path.delimiter : void 0
181
+ });
182
+ } catch (e) {} finally{
183
+ if (shouldSwitchCwd) process.chdir(cwd);
184
+ }
185
+ if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
186
+ return resolved;
187
+ }
188
+ function resolveCommand(parsed) {
189
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
190
+ }
191
+ module.exports = resolveCommand;
192
+ },
193
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
194
+ __webpack_require__("fs");
195
+ var core;
196
+ core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js") : __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js");
197
+ module.exports = isexe;
198
+ isexe.sync = sync;
199
+ function isexe(path, options, cb) {
200
+ if ('function' == typeof options) {
201
+ cb = options;
202
+ options = {};
203
+ }
204
+ if (!cb) {
205
+ if ('function' != typeof Promise) throw new TypeError('callback not provided');
206
+ return new Promise(function(resolve, reject) {
207
+ isexe(path, options || {}, function(er, is) {
208
+ if (er) reject(er);
209
+ else resolve(is);
210
+ });
211
+ });
212
+ }
213
+ core(path, options || {}, function(er, is) {
214
+ if (er) {
215
+ if ('EACCES' === er.code || options && options.ignoreErrors) {
216
+ er = null;
217
+ is = false;
218
+ }
219
+ }
220
+ cb(er, is);
221
+ });
222
+ }
223
+ function sync(path, options) {
224
+ try {
225
+ return core.sync(path, options || {});
226
+ } catch (er) {
227
+ if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
228
+ throw er;
229
+ }
230
+ }
231
+ },
232
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js": function(module, __unused_webpack_exports, __webpack_require__) {
233
+ module.exports = isexe;
234
+ isexe.sync = sync;
235
+ var fs = __webpack_require__("fs");
236
+ function isexe(path, options, cb) {
237
+ fs.stat(path, function(er, stat) {
238
+ cb(er, er ? false : checkStat(stat, options));
239
+ });
240
+ }
241
+ function sync(path, options) {
242
+ return checkStat(fs.statSync(path), options);
243
+ }
244
+ function checkStat(stat, options) {
245
+ return stat.isFile() && checkMode(stat, options);
246
+ }
247
+ function checkMode(stat, options) {
248
+ var mod = stat.mode;
249
+ var uid = stat.uid;
250
+ var gid = stat.gid;
251
+ var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
252
+ var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
253
+ var u = parseInt('100', 8);
254
+ var g = parseInt('010', 8);
255
+ var o = parseInt('001', 8);
256
+ var ug = u | g;
257
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
258
+ return ret;
259
+ }
260
+ },
261
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js": function(module, __unused_webpack_exports, __webpack_require__) {
262
+ module.exports = isexe;
263
+ isexe.sync = sync;
264
+ var fs = __webpack_require__("fs");
265
+ function checkPathExt(path, options) {
266
+ var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
267
+ if (!pathext) return true;
268
+ pathext = pathext.split(';');
269
+ if (-1 !== pathext.indexOf('')) return true;
270
+ for(var i = 0; i < pathext.length; i++){
271
+ var p = pathext[i].toLowerCase();
272
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
273
+ }
274
+ return false;
275
+ }
276
+ function checkStat(stat, path, options) {
277
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
278
+ return checkPathExt(path, options);
279
+ }
280
+ function isexe(path, options, cb) {
281
+ fs.stat(path, function(er, stat) {
282
+ cb(er, er ? false : checkStat(stat, path, options));
283
+ });
284
+ }
285
+ function sync(path, options) {
286
+ return checkStat(fs.statSync(path), path, options);
287
+ }
288
+ },
289
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
290
+ const { PassThrough } = __webpack_require__("stream");
291
+ module.exports = function() {
292
+ var sources = [];
293
+ var output = new PassThrough({
294
+ objectMode: true
295
+ });
296
+ output.setMaxListeners(0);
297
+ output.add = add;
298
+ output.isEmpty = isEmpty;
299
+ output.on('unpipe', remove);
300
+ Array.prototype.slice.call(arguments).forEach(add);
301
+ return output;
302
+ function add(source) {
303
+ if (Array.isArray(source)) {
304
+ source.forEach(add);
305
+ return this;
306
+ }
307
+ sources.push(source);
308
+ source.once('end', remove.bind(null, source));
309
+ source.once('error', output.emit.bind(output, 'error'));
310
+ source.pipe(output, {
311
+ end: false
312
+ });
313
+ return this;
314
+ }
315
+ function isEmpty() {
316
+ return 0 == sources.length;
317
+ }
318
+ function remove(source) {
319
+ sources = sources.filter(function(it) {
320
+ return it !== source;
321
+ });
322
+ if (!sources.length && output.readable) output.end();
323
+ }
324
+ };
325
+ },
326
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js": function(module) {
327
+ const pathKey = (options = {})=>{
328
+ const environment = options.env || process.env;
329
+ const platform = options.platform || process.platform;
330
+ if ('win32' !== platform) return 'PATH';
331
+ return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
332
+ };
333
+ module.exports = pathKey;
334
+ module.exports["default"] = pathKey;
335
+ },
336
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
337
+ const shebangRegex = __webpack_require__("../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
338
+ module.exports = (string = '')=>{
339
+ const match = string.match(shebangRegex);
340
+ if (!match) return null;
341
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
342
+ const binary = path.split('/').pop();
343
+ if ('env' === binary) return argument;
344
+ return argument ? `${binary} ${argument}` : binary;
345
+ };
346
+ },
347
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js": function(module) {
348
+ module.exports = /^#!(.*)/;
349
+ },
350
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js": function(module, __unused_webpack_exports, __webpack_require__) {
351
+ const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
352
+ const path = __webpack_require__("path");
353
+ const COLON = isWindows ? ';' : ':';
354
+ const isexe = __webpack_require__("../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js");
355
+ const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
356
+ code: 'ENOENT'
357
+ });
358
+ const getPathInfo = (cmd, opt)=>{
359
+ const colon = opt.colon || COLON;
360
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
361
+ ''
362
+ ] : [
363
+ ...isWindows ? [
364
+ process.cwd()
365
+ ] : [],
366
+ ...(opt.path || process.env.PATH || '').split(colon)
367
+ ];
368
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
369
+ const pathExt = isWindows ? pathExtExe.split(colon) : [
370
+ ''
371
+ ];
372
+ if (isWindows) {
373
+ if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
374
+ }
375
+ return {
376
+ pathEnv,
377
+ pathExt,
378
+ pathExtExe
379
+ };
380
+ };
381
+ const which = (cmd, opt, cb)=>{
382
+ if ('function' == typeof opt) {
383
+ cb = opt;
384
+ opt = {};
385
+ }
386
+ if (!opt) opt = {};
387
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
388
+ const found = [];
389
+ const step = (i)=>new Promise((resolve, reject)=>{
390
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
391
+ const ppRaw = pathEnv[i];
392
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
393
+ const pCmd = path.join(pathPart, cmd);
394
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
395
+ resolve(subStep(p, i, 0));
396
+ });
397
+ const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
398
+ if (ii === pathExt.length) return resolve(step(i + 1));
399
+ const ext = pathExt[ii];
400
+ isexe(p + ext, {
401
+ pathExt: pathExtExe
402
+ }, (er, is)=>{
403
+ if (!er && is) if (!opt.all) return resolve(p + ext);
404
+ else found.push(p + ext);
405
+ return resolve(subStep(p, i, ii + 1));
406
+ });
407
+ });
408
+ return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
409
+ };
410
+ const whichSync = (cmd, opt)=>{
411
+ opt = opt || {};
412
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
413
+ const found = [];
414
+ for(let i = 0; i < pathEnv.length; i++){
415
+ const ppRaw = pathEnv[i];
416
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
417
+ const pCmd = path.join(pathPart, cmd);
418
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
419
+ for(let j = 0; j < pathExt.length; j++){
420
+ const cur = p + pathExt[j];
421
+ try {
422
+ const is = isexe.sync(cur, {
423
+ pathExt: pathExtExe
424
+ });
425
+ if (is) if (!opt.all) return cur;
426
+ else found.push(cur);
427
+ } catch (ex) {}
428
+ }
429
+ }
430
+ if (opt.all && found.length) return found;
431
+ if (opt.nothrow) return null;
432
+ throw getNotFoundError(cmd);
433
+ };
434
+ module.exports = which;
435
+ which.sync = whichSync;
436
+ },
437
+ "../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
438
+ __webpack_require__.d(__webpack_exports__, {
439
+ r: ()=>execa
440
+ });
441
+ var external_node_buffer_ = __webpack_require__("node:buffer");
442
+ var external_node_path_ = __webpack_require__("node:path");
443
+ var external_node_child_process_ = __webpack_require__("node:child_process");
444
+ var external_node_process_ = __webpack_require__("node:process");
445
+ var cross_spawn = __webpack_require__("../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
446
+ function stripFinalNewline(input) {
447
+ const LF = 'string' == typeof input ? '\n' : '\n'.charCodeAt();
448
+ const CR = 'string' == typeof input ? '\r' : '\r'.charCodeAt();
449
+ if (input[input.length - 1] === LF) input = input.slice(0, -1);
450
+ if (input[input.length - 1] === CR) input = input.slice(0, -1);
451
+ return input;
452
+ }
453
+ var external_node_url_ = __webpack_require__("node:url");
454
+ function pathKey(options = {}) {
455
+ const { env = process.env, platform = process.platform } = options;
456
+ if ('win32' !== platform) return 'PATH';
457
+ return Object.keys(env).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
458
+ }
459
+ function npmRunPath(options = {}) {
460
+ const { cwd = external_node_process_["default"].cwd(), path: path_ = external_node_process_["default"].env[pathKey()], execPath = external_node_process_["default"].execPath } = options;
461
+ let previous;
462
+ const cwdString = cwd instanceof URL ? external_node_url_["default"].fileURLToPath(cwd) : cwd;
463
+ let cwdPath = external_node_path_["default"].resolve(cwdString);
464
+ const result = [];
465
+ while(previous !== cwdPath){
466
+ result.push(external_node_path_["default"].join(cwdPath, 'node_modules/.bin'));
467
+ previous = cwdPath;
468
+ cwdPath = external_node_path_["default"].resolve(cwdPath, '..');
469
+ }
470
+ result.push(external_node_path_["default"].resolve(cwdString, execPath, '..'));
471
+ return [
472
+ ...result,
473
+ path_
474
+ ].join(external_node_path_["default"].delimiter);
475
+ }
476
+ function npmRunPathEnv({ env = external_node_process_["default"].env, ...options } = {}) {
477
+ env = {
478
+ ...env
479
+ };
480
+ const path = pathKey({
481
+ env
482
+ });
483
+ options.path = env[path];
484
+ env[path] = npmRunPath(options);
485
+ return env;
486
+ }
487
+ const copyProperty = (to, from, property, ignoreNonConfigurable)=>{
488
+ if ('length' === property || 'prototype' === property) return;
489
+ if ('arguments' === property || 'caller' === property) return;
490
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
491
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
492
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
493
+ Object.defineProperty(to, property, fromDescriptor);
494
+ };
495
+ const canCopyProperty = function(toDescriptor, fromDescriptor) {
496
+ return void 0 === toDescriptor || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
497
+ };
498
+ const changePrototype = (to, from)=>{
499
+ const fromPrototype = Object.getPrototypeOf(from);
500
+ if (fromPrototype === Object.getPrototypeOf(to)) return;
501
+ Object.setPrototypeOf(to, fromPrototype);
502
+ };
503
+ const wrappedToString = (withName, fromBody)=>`/* Wrapped ${withName}*/\n${fromBody}`;
504
+ const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
505
+ const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
506
+ const changeToString = (to, from, name)=>{
507
+ const withName = '' === name ? '' : `with ${name.trim()}() `;
508
+ const newToString = wrappedToString.bind(null, withName, from.toString());
509
+ Object.defineProperty(newToString, 'name', toStringName);
510
+ Object.defineProperty(to, 'toString', {
511
+ ...toStringDescriptor,
512
+ value: newToString
513
+ });
514
+ };
515
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
516
+ const { name } = to;
517
+ for (const property of Reflect.ownKeys(from))copyProperty(to, from, property, ignoreNonConfigurable);
518
+ changePrototype(to, from);
519
+ changeToString(to, from, name);
520
+ return to;
521
+ }
522
+ const calledFunctions = new WeakMap();
523
+ const onetime_onetime = (function_, options = {})=>{
524
+ if ('function' != typeof function_) throw new TypeError('Expected a function');
525
+ let returnValue;
526
+ let callCount = 0;
527
+ const functionName = function_.displayName || function_.name || '<anonymous>';
528
+ const onetime = function(...arguments_) {
529
+ calledFunctions.set(onetime, ++callCount);
530
+ if (1 === callCount) {
531
+ returnValue = function_.apply(this, arguments_);
532
+ function_ = null;
533
+ } else if (true === options.throw) throw new Error(`Function \`${functionName}\` can only be called once`);
534
+ return returnValue;
535
+ };
536
+ mimicFunction(onetime, function_);
537
+ calledFunctions.set(onetime, callCount);
538
+ return onetime;
539
+ };
540
+ onetime_onetime.callCount = (function_)=>{
541
+ if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
542
+ return calledFunctions.get(function_);
543
+ };
544
+ const node_modules_onetime = onetime_onetime;
545
+ var external_node_os_ = __webpack_require__("node:os");
546
+ const getRealtimeSignals = ()=>{
547
+ const length = SIGRTMAX - SIGRTMIN + 1;
548
+ return Array.from({
549
+ length
550
+ }, getRealtimeSignal);
551
+ };
552
+ const getRealtimeSignal = (value, index)=>({
553
+ name: `SIGRT${index + 1}`,
554
+ number: SIGRTMIN + index,
555
+ action: "terminate",
556
+ description: "Application-specific signal (realtime)",
557
+ standard: "posix"
558
+ });
559
+ const SIGRTMIN = 34;
560
+ const SIGRTMAX = 64;
561
+ const SIGNALS = [
562
+ {
563
+ name: "SIGHUP",
564
+ number: 1,
565
+ action: "terminate",
566
+ description: "Terminal closed",
567
+ standard: "posix"
568
+ },
569
+ {
570
+ name: "SIGINT",
571
+ number: 2,
572
+ action: "terminate",
573
+ description: "User interruption with CTRL-C",
574
+ standard: "ansi"
575
+ },
576
+ {
577
+ name: "SIGQUIT",
578
+ number: 3,
579
+ action: "core",
580
+ description: "User interruption with CTRL-\\",
581
+ standard: "posix"
582
+ },
583
+ {
584
+ name: "SIGILL",
585
+ number: 4,
586
+ action: "core",
587
+ description: "Invalid machine instruction",
588
+ standard: "ansi"
589
+ },
590
+ {
591
+ name: "SIGTRAP",
592
+ number: 5,
593
+ action: "core",
594
+ description: "Debugger breakpoint",
595
+ standard: "posix"
596
+ },
597
+ {
598
+ name: "SIGABRT",
599
+ number: 6,
600
+ action: "core",
601
+ description: "Aborted",
602
+ standard: "ansi"
603
+ },
604
+ {
605
+ name: "SIGIOT",
606
+ number: 6,
607
+ action: "core",
608
+ description: "Aborted",
609
+ standard: "bsd"
610
+ },
611
+ {
612
+ name: "SIGBUS",
613
+ number: 7,
614
+ action: "core",
615
+ description: "Bus error due to misaligned, non-existing address or paging error",
616
+ standard: "bsd"
617
+ },
618
+ {
619
+ name: "SIGEMT",
620
+ number: 7,
621
+ action: "terminate",
622
+ description: "Command should be emulated but is not implemented",
623
+ standard: "other"
624
+ },
625
+ {
626
+ name: "SIGFPE",
627
+ number: 8,
628
+ action: "core",
629
+ description: "Floating point arithmetic error",
630
+ standard: "ansi"
631
+ },
632
+ {
633
+ name: "SIGKILL",
634
+ number: 9,
635
+ action: "terminate",
636
+ description: "Forced termination",
637
+ standard: "posix",
638
+ forced: true
639
+ },
640
+ {
641
+ name: "SIGUSR1",
642
+ number: 10,
643
+ action: "terminate",
644
+ description: "Application-specific signal",
645
+ standard: "posix"
646
+ },
647
+ {
648
+ name: "SIGSEGV",
649
+ number: 11,
650
+ action: "core",
651
+ description: "Segmentation fault",
652
+ standard: "ansi"
653
+ },
654
+ {
655
+ name: "SIGUSR2",
656
+ number: 12,
657
+ action: "terminate",
658
+ description: "Application-specific signal",
659
+ standard: "posix"
660
+ },
661
+ {
662
+ name: "SIGPIPE",
663
+ number: 13,
664
+ action: "terminate",
665
+ description: "Broken pipe or socket",
666
+ standard: "posix"
667
+ },
668
+ {
669
+ name: "SIGALRM",
670
+ number: 14,
671
+ action: "terminate",
672
+ description: "Timeout or timer",
673
+ standard: "posix"
674
+ },
675
+ {
676
+ name: "SIGTERM",
677
+ number: 15,
678
+ action: "terminate",
679
+ description: "Termination",
680
+ standard: "ansi"
681
+ },
682
+ {
683
+ name: "SIGSTKFLT",
684
+ number: 16,
685
+ action: "terminate",
686
+ description: "Stack is empty or overflowed",
687
+ standard: "other"
688
+ },
689
+ {
690
+ name: "SIGCHLD",
691
+ number: 17,
692
+ action: "ignore",
693
+ description: "Child process terminated, paused or unpaused",
694
+ standard: "posix"
695
+ },
696
+ {
697
+ name: "SIGCLD",
698
+ number: 17,
699
+ action: "ignore",
700
+ description: "Child process terminated, paused or unpaused",
701
+ standard: "other"
702
+ },
703
+ {
704
+ name: "SIGCONT",
705
+ number: 18,
706
+ action: "unpause",
707
+ description: "Unpaused",
708
+ standard: "posix",
709
+ forced: true
710
+ },
711
+ {
712
+ name: "SIGSTOP",
713
+ number: 19,
714
+ action: "pause",
715
+ description: "Paused",
716
+ standard: "posix",
717
+ forced: true
718
+ },
719
+ {
720
+ name: "SIGTSTP",
721
+ number: 20,
722
+ action: "pause",
723
+ description: "Paused using CTRL-Z or \"suspend\"",
724
+ standard: "posix"
725
+ },
726
+ {
727
+ name: "SIGTTIN",
728
+ number: 21,
729
+ action: "pause",
730
+ description: "Background process cannot read terminal input",
731
+ standard: "posix"
732
+ },
733
+ {
734
+ name: "SIGBREAK",
735
+ number: 21,
736
+ action: "terminate",
737
+ description: "User interruption with CTRL-BREAK",
738
+ standard: "other"
739
+ },
740
+ {
741
+ name: "SIGTTOU",
742
+ number: 22,
743
+ action: "pause",
744
+ description: "Background process cannot write to terminal output",
745
+ standard: "posix"
746
+ },
747
+ {
748
+ name: "SIGURG",
749
+ number: 23,
750
+ action: "ignore",
751
+ description: "Socket received out-of-band data",
752
+ standard: "bsd"
753
+ },
754
+ {
755
+ name: "SIGXCPU",
756
+ number: 24,
757
+ action: "core",
758
+ description: "Process timed out",
759
+ standard: "bsd"
760
+ },
761
+ {
762
+ name: "SIGXFSZ",
763
+ number: 25,
764
+ action: "core",
765
+ description: "File too big",
766
+ standard: "bsd"
767
+ },
768
+ {
769
+ name: "SIGVTALRM",
770
+ number: 26,
771
+ action: "terminate",
772
+ description: "Timeout or timer",
773
+ standard: "bsd"
774
+ },
775
+ {
776
+ name: "SIGPROF",
777
+ number: 27,
778
+ action: "terminate",
779
+ description: "Timeout or timer",
780
+ standard: "bsd"
781
+ },
782
+ {
783
+ name: "SIGWINCH",
784
+ number: 28,
785
+ action: "ignore",
786
+ description: "Terminal window size changed",
787
+ standard: "bsd"
788
+ },
789
+ {
790
+ name: "SIGIO",
791
+ number: 29,
792
+ action: "terminate",
793
+ description: "I/O is available",
794
+ standard: "other"
795
+ },
796
+ {
797
+ name: "SIGPOLL",
798
+ number: 29,
799
+ action: "terminate",
800
+ description: "Watched event",
801
+ standard: "other"
802
+ },
803
+ {
804
+ name: "SIGINFO",
805
+ number: 29,
806
+ action: "ignore",
807
+ description: "Request for process information",
808
+ standard: "other"
809
+ },
810
+ {
811
+ name: "SIGPWR",
812
+ number: 30,
813
+ action: "terminate",
814
+ description: "Device running out of power",
815
+ standard: "systemv"
816
+ },
817
+ {
818
+ name: "SIGSYS",
819
+ number: 31,
820
+ action: "core",
821
+ description: "Invalid system call",
822
+ standard: "other"
823
+ },
824
+ {
825
+ name: "SIGUNUSED",
826
+ number: 31,
827
+ action: "terminate",
828
+ description: "Invalid system call",
829
+ standard: "other"
830
+ }
831
+ ];
832
+ const getSignals = ()=>{
833
+ const realtimeSignals = getRealtimeSignals();
834
+ const signals = [
835
+ ...SIGNALS,
836
+ ...realtimeSignals
837
+ ].map(normalizeSignal);
838
+ return signals;
839
+ };
840
+ const normalizeSignal = ({ name, number: defaultNumber, description, action, forced = false, standard })=>{
841
+ const { signals: { [name]: constantSignal } } = external_node_os_.constants;
842
+ const supported = void 0 !== constantSignal;
843
+ const number = supported ? constantSignal : defaultNumber;
844
+ return {
845
+ name,
846
+ number,
847
+ description,
848
+ supported,
849
+ action,
850
+ forced,
851
+ standard
852
+ };
853
+ };
854
+ const getSignalsByName = ()=>{
855
+ const signals = getSignals();
856
+ return Object.fromEntries(signals.map(getSignalByName));
857
+ };
858
+ const getSignalByName = ({ name, number, description, supported, action, forced, standard })=>[
859
+ name,
860
+ {
861
+ name,
862
+ number,
863
+ description,
864
+ supported,
865
+ action,
866
+ forced,
867
+ standard
868
+ }
869
+ ];
870
+ const signalsByName = getSignalsByName();
871
+ const getSignalsByNumber = ()=>{
872
+ const signals = getSignals();
873
+ const length = SIGRTMAX + 1;
874
+ const signalsA = Array.from({
875
+ length
876
+ }, (value, number)=>getSignalByNumber(number, signals));
877
+ return Object.assign({}, ...signalsA);
878
+ };
879
+ const getSignalByNumber = (number, signals)=>{
880
+ const signal = findSignalByNumber(number, signals);
881
+ if (void 0 === signal) return {};
882
+ const { name, description, supported, action, forced, standard } = signal;
883
+ return {
884
+ [number]: {
885
+ name,
886
+ number,
887
+ description,
888
+ supported,
889
+ action,
890
+ forced,
891
+ standard
892
+ }
893
+ };
894
+ };
895
+ const findSignalByNumber = (number, signals)=>{
896
+ const signal = signals.find(({ name })=>external_node_os_.constants.signals[name] === number);
897
+ if (void 0 !== signal) return signal;
898
+ return signals.find((signalA)=>signalA.number === number);
899
+ };
900
+ getSignalsByNumber();
901
+ const getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled })=>{
902
+ if (timedOut) return `timed out after ${timeout} milliseconds`;
903
+ if (isCanceled) return 'was canceled';
904
+ if (void 0 !== errorCode) return `failed with ${errorCode}`;
905
+ if (void 0 !== signal) return `was killed with ${signal} (${signalDescription})`;
906
+ if (void 0 !== exitCode) return `failed with exit code ${exitCode}`;
907
+ return 'failed';
908
+ };
909
+ const makeError = ({ stdout, stderr, all, error, signal, exitCode, command, escapedCommand, timedOut, isCanceled, killed, parsed: { options: { timeout, cwd = external_node_process_["default"].cwd() } } })=>{
910
+ exitCode = null === exitCode ? void 0 : exitCode;
911
+ signal = null === signal ? void 0 : signal;
912
+ const signalDescription = void 0 === signal ? void 0 : signalsByName[signal].description;
913
+ const errorCode = error && error.code;
914
+ const prefix = getErrorPrefix({
915
+ timedOut,
916
+ timeout,
917
+ errorCode,
918
+ signal,
919
+ signalDescription,
920
+ exitCode,
921
+ isCanceled
922
+ });
923
+ const execaMessage = `Command ${prefix}: ${command}`;
924
+ const isError = '[object Error]' === Object.prototype.toString.call(error);
925
+ const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage;
926
+ const message = [
927
+ shortMessage,
928
+ stderr,
929
+ stdout
930
+ ].filter(Boolean).join('\n');
931
+ if (isError) {
932
+ error.originalMessage = error.message;
933
+ error.message = message;
934
+ } else error = new Error(message);
935
+ error.shortMessage = shortMessage;
936
+ error.command = command;
937
+ error.escapedCommand = escapedCommand;
938
+ error.exitCode = exitCode;
939
+ error.signal = signal;
940
+ error.signalDescription = signalDescription;
941
+ error.stdout = stdout;
942
+ error.stderr = stderr;
943
+ error.cwd = cwd;
944
+ if (void 0 !== all) error.all = all;
945
+ if ('bufferedData' in error) delete error.bufferedData;
946
+ error.failed = true;
947
+ error.timedOut = Boolean(timedOut);
948
+ error.isCanceled = isCanceled;
949
+ error.killed = killed && !timedOut;
950
+ return error;
951
+ };
952
+ const aliases = [
953
+ 'stdin',
954
+ 'stdout',
955
+ 'stderr'
956
+ ];
957
+ const hasAlias = (options)=>aliases.some((alias)=>void 0 !== options[alias]);
958
+ const normalizeStdio = (options)=>{
959
+ if (!options) return;
960
+ const { stdio } = options;
961
+ if (void 0 === stdio) return aliases.map((alias)=>options[alias]);
962
+ if (hasAlias(options)) throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias)=>`\`${alias}\``).join(', ')}`);
963
+ if ('string' == typeof stdio) return stdio;
964
+ if (!Array.isArray(stdio)) throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
965
+ const length = Math.max(stdio.length, aliases.length);
966
+ return Array.from({
967
+ length
968
+ }, (value, index)=>stdio[index]);
969
+ };
970
+ const signals_signals = [];
971
+ signals_signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
972
+ if ('win32' !== process.platform) signals_signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT');
973
+ if ('linux' === process.platform) signals_signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
974
+ const processOk = (process1)=>!!process1 && 'object' == typeof process1 && 'function' == typeof process1.removeListener && 'function' == typeof process1.emit && 'function' == typeof process1.reallyExit && 'function' == typeof process1.listeners && 'function' == typeof process1.kill && 'number' == typeof process1.pid && 'function' == typeof process1.on;
975
+ const kExitEmitter = Symbol.for('signal-exit emitter');
976
+ const global1 = globalThis;
977
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
978
+ class Emitter {
979
+ emitted = {
980
+ afterExit: false,
981
+ exit: false
982
+ };
983
+ listeners = {
984
+ afterExit: [],
985
+ exit: []
986
+ };
987
+ count = 0;
988
+ id = Math.random();
989
+ constructor(){
990
+ if (global1[kExitEmitter]) return global1[kExitEmitter];
991
+ ObjectDefineProperty(global1, kExitEmitter, {
992
+ value: this,
993
+ writable: false,
994
+ enumerable: false,
995
+ configurable: false
996
+ });
997
+ }
998
+ on(ev, fn) {
999
+ this.listeners[ev].push(fn);
1000
+ }
1001
+ removeListener(ev, fn) {
1002
+ const list = this.listeners[ev];
1003
+ const i = list.indexOf(fn);
1004
+ if (-1 === i) return;
1005
+ if (0 === i && 1 === list.length) list.length = 0;
1006
+ else list.splice(i, 1);
1007
+ }
1008
+ emit(ev, code, signal) {
1009
+ if (this.emitted[ev]) return false;
1010
+ this.emitted[ev] = true;
1011
+ let ret = false;
1012
+ for (const fn of this.listeners[ev])ret = true === fn(code, signal) || ret;
1013
+ if ('exit' === ev) ret = this.emit('afterExit', code, signal) || ret;
1014
+ return ret;
1015
+ }
1016
+ }
1017
+ class SignalExitBase {
1018
+ }
1019
+ const signalExitWrap = (handler)=>({
1020
+ onExit (cb, opts) {
1021
+ return handler.onExit(cb, opts);
1022
+ },
1023
+ load () {
1024
+ return handler.load();
1025
+ },
1026
+ unload () {
1027
+ return handler.unload();
1028
+ }
1029
+ });
1030
+ class SignalExitFallback extends SignalExitBase {
1031
+ onExit() {
1032
+ return ()=>{};
1033
+ }
1034
+ load() {}
1035
+ unload() {}
1036
+ }
1037
+ class SignalExit extends SignalExitBase {
1038
+ #hupSig = 'win32' === mjs_process.platform ? 'SIGINT' : 'SIGHUP';
1039
+ #emitter = new Emitter();
1040
+ #process;
1041
+ #originalProcessEmit;
1042
+ #originalProcessReallyExit;
1043
+ #sigListeners = {};
1044
+ #loaded = false;
1045
+ constructor(process1){
1046
+ super();
1047
+ this.#process = process1;
1048
+ this.#sigListeners = {};
1049
+ for (const sig of signals_signals)this.#sigListeners[sig] = ()=>{
1050
+ const listeners = this.#process.listeners(sig);
1051
+ let { count } = this.#emitter;
1052
+ const p = process1;
1053
+ if ('object' == typeof p.__signal_exit_emitter__ && 'number' == typeof p.__signal_exit_emitter__.count) count += p.__signal_exit_emitter__.count;
1054
+ if (listeners.length === count) {
1055
+ this.unload();
1056
+ const ret = this.#emitter.emit('exit', null, sig);
1057
+ const s = 'SIGHUP' === sig ? this.#hupSig : sig;
1058
+ if (!ret) process1.kill(process1.pid, s);
1059
+ }
1060
+ };
1061
+ this.#originalProcessReallyExit = process1.reallyExit;
1062
+ this.#originalProcessEmit = process1.emit;
1063
+ }
1064
+ onExit(cb, opts) {
1065
+ if (!processOk(this.#process)) return ()=>{};
1066
+ if (false === this.#loaded) this.load();
1067
+ const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
1068
+ this.#emitter.on(ev, cb);
1069
+ return ()=>{
1070
+ this.#emitter.removeListener(ev, cb);
1071
+ if (0 === this.#emitter.listeners['exit'].length && 0 === this.#emitter.listeners['afterExit'].length) this.unload();
1072
+ };
1073
+ }
1074
+ load() {
1075
+ if (this.#loaded) return;
1076
+ this.#loaded = true;
1077
+ this.#emitter.count += 1;
1078
+ for (const sig of signals_signals)try {
1079
+ const fn = this.#sigListeners[sig];
1080
+ if (fn) this.#process.on(sig, fn);
1081
+ } catch (_) {}
1082
+ this.#process.emit = (ev, ...a)=>this.#processEmit(ev, ...a);
1083
+ this.#process.reallyExit = (code)=>this.#processReallyExit(code);
1084
+ }
1085
+ unload() {
1086
+ if (!this.#loaded) return;
1087
+ this.#loaded = false;
1088
+ signals_signals.forEach((sig)=>{
1089
+ const listener = this.#sigListeners[sig];
1090
+ if (!listener) throw new Error('Listener not defined for signal: ' + sig);
1091
+ try {
1092
+ this.#process.removeListener(sig, listener);
1093
+ } catch (_) {}
1094
+ });
1095
+ this.#process.emit = this.#originalProcessEmit;
1096
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1097
+ this.#emitter.count -= 1;
1098
+ }
1099
+ #processReallyExit(code) {
1100
+ if (!processOk(this.#process)) return 0;
1101
+ this.#process.exitCode = code || 0;
1102
+ this.#emitter.emit('exit', this.#process.exitCode, null);
1103
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1104
+ }
1105
+ #processEmit(ev, ...args) {
1106
+ const og = this.#originalProcessEmit;
1107
+ if (!('exit' === ev && processOk(this.#process))) return og.call(this.#process, ev, ...args);
1108
+ {
1109
+ if ('number' == typeof args[0]) this.#process.exitCode = args[0];
1110
+ const ret = og.call(this.#process, ev, ...args);
1111
+ this.#emitter.emit('exit', this.#process.exitCode, null);
1112
+ return ret;
1113
+ }
1114
+ }
1115
+ }
1116
+ const mjs_process = globalThis.process;
1117
+ const { onExit, load, unload } = signalExitWrap(processOk(mjs_process) ? new SignalExit(mjs_process) : new SignalExitFallback());
1118
+ const DEFAULT_FORCE_KILL_TIMEOUT = 5000;
1119
+ const spawnedKill = (kill, signal = 'SIGTERM', options = {})=>{
1120
+ const killResult = kill(signal);
1121
+ setKillTimeout(kill, signal, options, killResult);
1122
+ return killResult;
1123
+ };
1124
+ const setKillTimeout = (kill, signal, options, killResult)=>{
1125
+ if (!shouldForceKill(signal, options, killResult)) return;
1126
+ const timeout = getForceKillAfterTimeout(options);
1127
+ const t = setTimeout(()=>{
1128
+ kill('SIGKILL');
1129
+ }, timeout);
1130
+ if (t.unref) t.unref();
1131
+ };
1132
+ const shouldForceKill = (signal, { forceKillAfterTimeout }, killResult)=>isSigterm(signal) && false !== forceKillAfterTimeout && killResult;
1133
+ const isSigterm = (signal)=>signal === external_node_os_["default"].constants.signals.SIGTERM || 'string' == typeof signal && 'SIGTERM' === signal.toUpperCase();
1134
+ const getForceKillAfterTimeout = ({ forceKillAfterTimeout = true })=>{
1135
+ if (true === forceKillAfterTimeout) return DEFAULT_FORCE_KILL_TIMEOUT;
1136
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1137
+ return forceKillAfterTimeout;
1138
+ };
1139
+ const spawnedCancel = (spawned, context)=>{
1140
+ const killResult = spawned.kill();
1141
+ if (killResult) context.isCanceled = true;
1142
+ };
1143
+ const timeoutKill = (spawned, signal, reject)=>{
1144
+ spawned.kill(signal);
1145
+ reject(Object.assign(new Error('Timed out'), {
1146
+ timedOut: true,
1147
+ signal
1148
+ }));
1149
+ };
1150
+ const setupTimeout = (spawned, { timeout, killSignal = 'SIGTERM' }, spawnedPromise)=>{
1151
+ if (0 === timeout || void 0 === timeout) return spawnedPromise;
1152
+ let timeoutId;
1153
+ const timeoutPromise = new Promise((resolve, reject)=>{
1154
+ timeoutId = setTimeout(()=>{
1155
+ timeoutKill(spawned, killSignal, reject);
1156
+ }, timeout);
1157
+ });
1158
+ const safeSpawnedPromise = spawnedPromise.finally(()=>{
1159
+ clearTimeout(timeoutId);
1160
+ });
1161
+ return Promise.race([
1162
+ timeoutPromise,
1163
+ safeSpawnedPromise
1164
+ ]);
1165
+ };
1166
+ const validateTimeout = ({ timeout })=>{
1167
+ if (void 0 !== timeout && (!Number.isFinite(timeout) || timeout < 0)) throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1168
+ };
1169
+ const setExitHandler = async (spawned, { cleanup, detached }, timedPromise)=>{
1170
+ if (!cleanup || detached) return timedPromise;
1171
+ const removeExitHandler = onExit(()=>{
1172
+ spawned.kill();
1173
+ });
1174
+ return timedPromise.finally(()=>{
1175
+ removeExitHandler();
1176
+ });
1177
+ };
1178
+ var external_node_fs_ = __webpack_require__("node:fs");
1179
+ function isStream(stream) {
1180
+ return null !== stream && 'object' == typeof stream && 'function' == typeof stream.pipe;
1181
+ }
1182
+ function isWritableStream(stream) {
1183
+ return isStream(stream) && false !== stream.writable && 'function' == typeof stream._write && 'object' == typeof stream._writableState;
1184
+ }
1185
+ const isExecaChildProcess = (target)=>target instanceof external_node_child_process_.ChildProcess && 'function' == typeof target.then;
1186
+ const pipeToTarget = (spawned, streamName, target)=>{
1187
+ if ('string' == typeof target) {
1188
+ spawned[streamName].pipe((0, external_node_fs_.createWriteStream)(target));
1189
+ return spawned;
1190
+ }
1191
+ if (isWritableStream(target)) {
1192
+ spawned[streamName].pipe(target);
1193
+ return spawned;
1194
+ }
1195
+ if (!isExecaChildProcess(target)) throw new TypeError('The second argument must be a string, a stream or an Execa child process.');
1196
+ if (!isWritableStream(target.stdin)) throw new TypeError('The target child process\'s stdin must be available.');
1197
+ spawned[streamName].pipe(target.stdin);
1198
+ return target;
1199
+ };
1200
+ const addPipeMethods = (spawned)=>{
1201
+ if (null !== spawned.stdout) spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, 'stdout');
1202
+ if (null !== spawned.stderr) spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, 'stderr');
1203
+ if (void 0 !== spawned.all) spawned.pipeAll = pipeToTarget.bind(void 0, spawned, 'all');
1204
+ };
1205
+ var promises_ = __webpack_require__("node:timers/promises");
1206
+ const contents_getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = 1 / 0 } = {})=>{
1207
+ if (!isAsyncIterable(stream)) throw new Error('The first argument must be a Readable, a ReadableStream, or an async iterable.');
1208
+ const state = init();
1209
+ state.length = 0;
1210
+ try {
1211
+ for await (const chunk of stream){
1212
+ const chunkType = getChunkType(chunk);
1213
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1214
+ appendChunk({
1215
+ convertedChunk,
1216
+ state,
1217
+ getSize,
1218
+ truncateChunk,
1219
+ addChunk,
1220
+ maxBuffer
1221
+ });
1222
+ }
1223
+ appendFinalChunk({
1224
+ state,
1225
+ convertChunk,
1226
+ getSize,
1227
+ truncateChunk,
1228
+ addChunk,
1229
+ getFinalChunk,
1230
+ maxBuffer
1231
+ });
1232
+ return finalize(state);
1233
+ } catch (error) {
1234
+ error.bufferedData = finalize(state);
1235
+ throw error;
1236
+ }
1237
+ };
1238
+ const appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer })=>{
1239
+ const convertedChunk = getFinalChunk(state);
1240
+ if (void 0 !== convertedChunk) appendChunk({
1241
+ convertedChunk,
1242
+ state,
1243
+ getSize,
1244
+ truncateChunk,
1245
+ addChunk,
1246
+ maxBuffer
1247
+ });
1248
+ };
1249
+ const appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer })=>{
1250
+ const chunkSize = getSize(convertedChunk);
1251
+ const newLength = state.length + chunkSize;
1252
+ if (newLength <= maxBuffer) return void addNewChunk(convertedChunk, state, addChunk, newLength);
1253
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1254
+ if (void 0 !== truncatedChunk) addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1255
+ throw new MaxBufferError();
1256
+ };
1257
+ const addNewChunk = (convertedChunk, state, addChunk, newLength)=>{
1258
+ state.contents = addChunk(convertedChunk, state, newLength);
1259
+ state.length = newLength;
1260
+ };
1261
+ const isAsyncIterable = (stream)=>'object' == typeof stream && null !== stream && 'function' == typeof stream[Symbol.asyncIterator];
1262
+ const getChunkType = (chunk)=>{
1263
+ const typeOfChunk = typeof chunk;
1264
+ if ('string' === typeOfChunk) return 'string';
1265
+ if ('object' !== typeOfChunk || null === chunk) return 'others';
1266
+ if (globalThis.Buffer?.isBuffer(chunk)) return 'buffer';
1267
+ const prototypeName = objectToString.call(chunk);
1268
+ if ('[object ArrayBuffer]' === prototypeName) return 'arrayBuffer';
1269
+ if ('[object DataView]' === prototypeName) return 'dataView';
1270
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && '[object ArrayBuffer]' === objectToString.call(chunk.buffer)) return 'typedArray';
1271
+ return 'others';
1272
+ };
1273
+ const { toString: objectToString } = Object.prototype;
1274
+ class MaxBufferError extends Error {
1275
+ name = 'MaxBufferError';
1276
+ constructor(){
1277
+ super('maxBuffer exceeded');
1278
+ }
1279
+ }
1280
+ const utils_identity = (value)=>value;
1281
+ const utils_noop = ()=>void 0;
1282
+ const utils_getContentsProp = ({ contents })=>contents;
1283
+ const throwObjectStream = (chunk)=>{
1284
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1285
+ };
1286
+ const getLengthProp = (convertedChunk)=>convertedChunk.length;
1287
+ async function getStreamAsArrayBuffer(stream, options) {
1288
+ return contents_getStreamContents(stream, arrayBufferMethods, options);
1289
+ }
1290
+ const initArrayBuffer = ()=>({
1291
+ contents: new ArrayBuffer(0)
1292
+ });
1293
+ const useTextEncoder = (chunk)=>textEncoder.encode(chunk);
1294
+ const textEncoder = new TextEncoder();
1295
+ const useUint8Array = (chunk)=>new Uint8Array(chunk);
1296
+ const useUint8ArrayWithOffset = (chunk)=>new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1297
+ const truncateArrayBufferChunk = (convertedChunk, chunkSize)=>convertedChunk.slice(0, chunkSize);
1298
+ const addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length)=>{
1299
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1300
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1301
+ return newContents;
1302
+ };
1303
+ const resizeArrayBufferSlow = (contents, length)=>{
1304
+ if (length <= contents.byteLength) return contents;
1305
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1306
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1307
+ return arrayBuffer;
1308
+ };
1309
+ const resizeArrayBuffer = (contents, length)=>{
1310
+ if (length <= contents.maxByteLength) {
1311
+ contents.resize(length);
1312
+ return contents;
1313
+ }
1314
+ const arrayBuffer = new ArrayBuffer(length, {
1315
+ maxByteLength: getNewContentsLength(length)
1316
+ });
1317
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1318
+ return arrayBuffer;
1319
+ };
1320
+ const getNewContentsLength = (length)=>SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1321
+ const SCALE_FACTOR = 2;
1322
+ const finalizeArrayBuffer = ({ contents, length })=>hasArrayBufferResize() ? contents : contents.slice(0, length);
1323
+ const hasArrayBufferResize = ()=>'resize' in ArrayBuffer.prototype;
1324
+ const arrayBufferMethods = {
1325
+ init: initArrayBuffer,
1326
+ convertChunk: {
1327
+ string: useTextEncoder,
1328
+ buffer: useUint8Array,
1329
+ arrayBuffer: useUint8Array,
1330
+ dataView: useUint8ArrayWithOffset,
1331
+ typedArray: useUint8ArrayWithOffset,
1332
+ others: throwObjectStream
1333
+ },
1334
+ getSize: getLengthProp,
1335
+ truncateChunk: truncateArrayBufferChunk,
1336
+ addChunk: addArrayBufferChunk,
1337
+ getFinalChunk: utils_noop,
1338
+ finalize: finalizeArrayBuffer
1339
+ };
1340
+ async function getStreamAsBuffer(stream, options) {
1341
+ if (!('Buffer' in globalThis)) throw new Error('getStreamAsBuffer() is only supported in Node.js');
1342
+ try {
1343
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1344
+ } catch (error) {
1345
+ if (void 0 !== error.bufferedData) error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1346
+ throw error;
1347
+ }
1348
+ }
1349
+ const arrayBufferToNodeBuffer = (arrayBuffer)=>globalThis.Buffer.from(arrayBuffer);
1350
+ async function getStreamAsString(stream, options) {
1351
+ return contents_getStreamContents(stream, stringMethods, options);
1352
+ }
1353
+ const initString = ()=>({
1354
+ contents: '',
1355
+ textDecoder: new TextDecoder()
1356
+ });
1357
+ const useTextDecoder = (chunk, { textDecoder })=>textDecoder.decode(chunk, {
1358
+ stream: true
1359
+ });
1360
+ const addStringChunk = (convertedChunk, { contents })=>contents + convertedChunk;
1361
+ const truncateStringChunk = (convertedChunk, chunkSize)=>convertedChunk.slice(0, chunkSize);
1362
+ const getFinalStringChunk = ({ textDecoder })=>{
1363
+ const finalChunk = textDecoder.decode();
1364
+ return '' === finalChunk ? void 0 : finalChunk;
1365
+ };
1366
+ const stringMethods = {
1367
+ init: initString,
1368
+ convertChunk: {
1369
+ string: utils_identity,
1370
+ buffer: useTextDecoder,
1371
+ arrayBuffer: useTextDecoder,
1372
+ dataView: useTextDecoder,
1373
+ typedArray: useTextDecoder,
1374
+ others: throwObjectStream
1375
+ },
1376
+ getSize: getLengthProp,
1377
+ truncateChunk: truncateStringChunk,
1378
+ addChunk: addStringChunk,
1379
+ getFinalChunk: getFinalStringChunk,
1380
+ finalize: utils_getContentsProp
1381
+ };
1382
+ var merge_stream = __webpack_require__("../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js");
1383
+ const validateInputOptions = (input)=>{
1384
+ if (void 0 !== input) throw new TypeError('The `input` and `inputFile` options cannot be both set.');
1385
+ };
1386
+ const getInputSync = ({ input, inputFile })=>{
1387
+ if ('string' != typeof inputFile) return input;
1388
+ validateInputOptions(input);
1389
+ return (0, external_node_fs_.readFileSync)(inputFile);
1390
+ };
1391
+ const handleInputSync = (options)=>{
1392
+ const input = getInputSync(options);
1393
+ if (isStream(input)) throw new TypeError('The `input` option cannot be a stream in sync mode');
1394
+ return input;
1395
+ };
1396
+ const getInput = ({ input, inputFile })=>{
1397
+ if ('string' != typeof inputFile) return input;
1398
+ validateInputOptions(input);
1399
+ return (0, external_node_fs_.createReadStream)(inputFile);
1400
+ };
1401
+ const handleInput = (spawned, options)=>{
1402
+ const input = getInput(options);
1403
+ if (void 0 === input) return;
1404
+ if (isStream(input)) input.pipe(spawned.stdin);
1405
+ else spawned.stdin.end(input);
1406
+ };
1407
+ const makeAllStream = (spawned, { all })=>{
1408
+ if (!all || !spawned.stdout && !spawned.stderr) return;
1409
+ const mixed = merge_stream();
1410
+ if (spawned.stdout) mixed.add(spawned.stdout);
1411
+ if (spawned.stderr) mixed.add(spawned.stderr);
1412
+ return mixed;
1413
+ };
1414
+ const getBufferedData = async (stream, streamPromise)=>{
1415
+ if (!stream || void 0 === streamPromise) return;
1416
+ await (0, promises_.setTimeout)(0);
1417
+ stream.destroy();
1418
+ try {
1419
+ return await streamPromise;
1420
+ } catch (error) {
1421
+ return error.bufferedData;
1422
+ }
1423
+ };
1424
+ const getStreamPromise = (stream, { encoding, buffer, maxBuffer })=>{
1425
+ if (!stream || !buffer) return;
1426
+ if ('utf8' === encoding || 'utf-8' === encoding) return getStreamAsString(stream, {
1427
+ maxBuffer
1428
+ });
1429
+ if (null === encoding || 'buffer' === encoding) return getStreamAsBuffer(stream, {
1430
+ maxBuffer
1431
+ });
1432
+ return applyEncoding(stream, maxBuffer, encoding);
1433
+ };
1434
+ const applyEncoding = async (stream, maxBuffer, encoding)=>{
1435
+ const buffer = await getStreamAsBuffer(stream, {
1436
+ maxBuffer
1437
+ });
1438
+ return buffer.toString(encoding);
1439
+ };
1440
+ const getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone)=>{
1441
+ const stdoutPromise = getStreamPromise(stdout, {
1442
+ encoding,
1443
+ buffer,
1444
+ maxBuffer
1445
+ });
1446
+ const stderrPromise = getStreamPromise(stderr, {
1447
+ encoding,
1448
+ buffer,
1449
+ maxBuffer
1450
+ });
1451
+ const allPromise = getStreamPromise(all, {
1452
+ encoding,
1453
+ buffer,
1454
+ maxBuffer: 2 * maxBuffer
1455
+ });
1456
+ try {
1457
+ return await Promise.all([
1458
+ processDone,
1459
+ stdoutPromise,
1460
+ stderrPromise,
1461
+ allPromise
1462
+ ]);
1463
+ } catch (error) {
1464
+ return Promise.all([
1465
+ {
1466
+ error,
1467
+ signal: error.signal,
1468
+ timedOut: error.timedOut
1469
+ },
1470
+ getBufferedData(stdout, stdoutPromise),
1471
+ getBufferedData(stderr, stderrPromise),
1472
+ getBufferedData(all, allPromise)
1473
+ ]);
1474
+ }
1475
+ };
1476
+ const nativePromisePrototype = (async ()=>{})().constructor.prototype;
1477
+ const descriptors = [
1478
+ 'then',
1479
+ 'catch',
1480
+ 'finally'
1481
+ ].map((property)=>[
1482
+ property,
1483
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1484
+ ]);
1485
+ const mergePromise = (spawned, promise)=>{
1486
+ for (const [property, descriptor] of descriptors){
1487
+ const value = 'function' == typeof promise ? (...args)=>Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1488
+ Reflect.defineProperty(spawned, property, {
1489
+ ...descriptor,
1490
+ value
1491
+ });
1492
+ }
1493
+ };
1494
+ const getSpawnedPromise = (spawned)=>new Promise((resolve, reject)=>{
1495
+ spawned.on('exit', (exitCode, signal)=>{
1496
+ resolve({
1497
+ exitCode,
1498
+ signal
1499
+ });
1500
+ });
1501
+ spawned.on('error', (error)=>{
1502
+ reject(error);
1503
+ });
1504
+ if (spawned.stdin) spawned.stdin.on('error', (error)=>{
1505
+ reject(error);
1506
+ });
1507
+ });
1508
+ const normalizeArgs = (file, args = [])=>{
1509
+ if (!Array.isArray(args)) return [
1510
+ file
1511
+ ];
1512
+ return [
1513
+ file,
1514
+ ...args
1515
+ ];
1516
+ };
1517
+ const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1518
+ const escapeArg = (arg)=>{
1519
+ if ('string' != typeof arg || NO_ESCAPE_REGEXP.test(arg)) return arg;
1520
+ return `"${arg.replaceAll('"', '\\"')}"`;
1521
+ };
1522
+ const joinCommand = (file, args)=>normalizeArgs(file, args).join(' ');
1523
+ const getEscapedCommand = (file, args)=>normalizeArgs(file, args).map((arg)=>escapeArg(arg)).join(' ');
1524
+ const SPACES_REGEXP = / +/g;
1525
+ const parseExpression = (expression)=>{
1526
+ const typeOfExpression = typeof expression;
1527
+ if ('string' === typeOfExpression) return expression;
1528
+ if ('number' === typeOfExpression) return String(expression);
1529
+ if ('object' === typeOfExpression && null !== expression && !(expression instanceof external_node_child_process_.ChildProcess) && 'stdout' in expression) {
1530
+ const typeOfStdout = typeof expression.stdout;
1531
+ if ('string' === typeOfStdout) return expression.stdout;
1532
+ if (external_node_buffer_.Buffer.isBuffer(expression.stdout)) return expression.stdout.toString();
1533
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1534
+ }
1535
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1536
+ };
1537
+ const concatTokens = (tokens, nextTokens, isNew)=>isNew || 0 === tokens.length || 0 === nextTokens.length ? [
1538
+ ...tokens,
1539
+ ...nextTokens
1540
+ ] : [
1541
+ ...tokens.slice(0, -1),
1542
+ `${tokens.at(-1)}${nextTokens[0]}`,
1543
+ ...nextTokens.slice(1)
1544
+ ];
1545
+ const parseTemplate = ({ templates, expressions, tokens, index, template })=>{
1546
+ const templateString = template ?? templates.raw[index];
1547
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1548
+ const newTokens = concatTokens(tokens, templateTokens, templateString.startsWith(' '));
1549
+ if (index === expressions.length) return newTokens;
1550
+ const expression = expressions[index];
1551
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression)=>parseExpression(expression)) : [
1552
+ parseExpression(expression)
1553
+ ];
1554
+ return concatTokens(newTokens, expressionTokens, templateString.endsWith(' '));
1555
+ };
1556
+ const parseTemplates = (templates, expressions)=>{
1557
+ let tokens = [];
1558
+ for (const [index, template] of templates.entries())tokens = parseTemplate({
1559
+ templates,
1560
+ expressions,
1561
+ tokens,
1562
+ index,
1563
+ template
1564
+ });
1565
+ return tokens;
1566
+ };
1567
+ var external_node_util_ = __webpack_require__("node:util");
1568
+ const verboseDefault = (0, external_node_util_.debuglog)('execa').enabled;
1569
+ const padField = (field, padding)=>String(field).padStart(padding, '0');
1570
+ const getTimestamp = ()=>{
1571
+ const date = new Date();
1572
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1573
+ };
1574
+ const logCommand = (escapedCommand, { verbose })=>{
1575
+ if (!verbose) return;
1576
+ external_node_process_["default"].stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
1577
+ };
1578
+ const DEFAULT_MAX_BUFFER = 100000000;
1579
+ const getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath })=>{
1580
+ const env = extendEnv ? {
1581
+ ...external_node_process_["default"].env,
1582
+ ...envOption
1583
+ } : envOption;
1584
+ if (preferLocal) return npmRunPathEnv({
1585
+ env,
1586
+ cwd: localDir,
1587
+ execPath
1588
+ });
1589
+ return env;
1590
+ };
1591
+ const handleArguments = (file, args, options = {})=>{
1592
+ const parsed = cross_spawn._parse(file, args, options);
1593
+ file = parsed.command;
1594
+ args = parsed.args;
1595
+ options = parsed.options;
1596
+ options = {
1597
+ maxBuffer: DEFAULT_MAX_BUFFER,
1598
+ buffer: true,
1599
+ stripFinalNewline: true,
1600
+ extendEnv: true,
1601
+ preferLocal: false,
1602
+ localDir: options.cwd || external_node_process_["default"].cwd(),
1603
+ execPath: external_node_process_["default"].execPath,
1604
+ encoding: 'utf8',
1605
+ reject: true,
1606
+ cleanup: true,
1607
+ all: false,
1608
+ windowsHide: true,
1609
+ verbose: verboseDefault,
1610
+ ...options
1611
+ };
1612
+ options.env = getEnv(options);
1613
+ options.stdio = normalizeStdio(options);
1614
+ if ('win32' === external_node_process_["default"].platform && 'cmd' === external_node_path_["default"].basename(file, '.exe')) args.unshift('/q');
1615
+ return {
1616
+ file,
1617
+ args,
1618
+ options,
1619
+ parsed
1620
+ };
1621
+ };
1622
+ const handleOutput = (options, value, error)=>{
1623
+ if ('string' != typeof value && !external_node_buffer_.Buffer.isBuffer(value)) return void 0 === error ? void 0 : '';
1624
+ if (options.stripFinalNewline) return stripFinalNewline(value);
1625
+ return value;
1626
+ };
1627
+ function execa(file, args, options) {
1628
+ const parsed = handleArguments(file, args, options);
1629
+ const command = joinCommand(file, args);
1630
+ const escapedCommand = getEscapedCommand(file, args);
1631
+ logCommand(escapedCommand, parsed.options);
1632
+ validateTimeout(parsed.options);
1633
+ let spawned;
1634
+ try {
1635
+ spawned = external_node_child_process_["default"].spawn(parsed.file, parsed.args, parsed.options);
1636
+ } catch (error) {
1637
+ const dummySpawned = new external_node_child_process_["default"].ChildProcess();
1638
+ const errorPromise = Promise.reject(makeError({
1639
+ error,
1640
+ stdout: '',
1641
+ stderr: '',
1642
+ all: '',
1643
+ command,
1644
+ escapedCommand,
1645
+ parsed,
1646
+ timedOut: false,
1647
+ isCanceled: false,
1648
+ killed: false
1649
+ }));
1650
+ mergePromise(dummySpawned, errorPromise);
1651
+ return dummySpawned;
1652
+ }
1653
+ const spawnedPromise = getSpawnedPromise(spawned);
1654
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1655
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1656
+ const context = {
1657
+ isCanceled: false
1658
+ };
1659
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1660
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
1661
+ const handlePromise = async ()=>{
1662
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1663
+ const stdout = handleOutput(parsed.options, stdoutResult);
1664
+ const stderr = handleOutput(parsed.options, stderrResult);
1665
+ const all = handleOutput(parsed.options, allResult);
1666
+ if (error || 0 !== exitCode || null !== signal) {
1667
+ const returnedError = makeError({
1668
+ error,
1669
+ exitCode,
1670
+ signal,
1671
+ stdout,
1672
+ stderr,
1673
+ all,
1674
+ command,
1675
+ escapedCommand,
1676
+ parsed,
1677
+ timedOut,
1678
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
1679
+ killed: spawned.killed
1680
+ });
1681
+ if (!parsed.options.reject) return returnedError;
1682
+ throw returnedError;
1683
+ }
1684
+ return {
1685
+ command,
1686
+ escapedCommand,
1687
+ exitCode: 0,
1688
+ stdout,
1689
+ stderr,
1690
+ all,
1691
+ failed: false,
1692
+ timedOut: false,
1693
+ isCanceled: false,
1694
+ killed: false
1695
+ };
1696
+ };
1697
+ const handlePromiseOnce = node_modules_onetime(handlePromise);
1698
+ handleInput(spawned, parsed.options);
1699
+ spawned.all = makeAllStream(spawned, parsed.options);
1700
+ addPipeMethods(spawned);
1701
+ mergePromise(spawned, handlePromiseOnce);
1702
+ return spawned;
1703
+ }
1704
+ function execaSync(file, args, options) {
1705
+ const parsed = handleArguments(file, args, options);
1706
+ const command = joinCommand(file, args);
1707
+ const escapedCommand = getEscapedCommand(file, args);
1708
+ logCommand(escapedCommand, parsed.options);
1709
+ const input = handleInputSync(parsed.options);
1710
+ let result;
1711
+ try {
1712
+ result = external_node_child_process_["default"].spawnSync(parsed.file, parsed.args, {
1713
+ ...parsed.options,
1714
+ input
1715
+ });
1716
+ } catch (error) {
1717
+ throw makeError({
1718
+ error,
1719
+ stdout: '',
1720
+ stderr: '',
1721
+ all: '',
1722
+ command,
1723
+ escapedCommand,
1724
+ parsed,
1725
+ timedOut: false,
1726
+ isCanceled: false,
1727
+ killed: false
1728
+ });
1729
+ }
1730
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
1731
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
1732
+ if (result.error || 0 !== result.status || null !== result.signal) {
1733
+ const error = makeError({
1734
+ stdout,
1735
+ stderr,
1736
+ error: result.error,
1737
+ signal: result.signal,
1738
+ exitCode: result.status,
1739
+ command,
1740
+ escapedCommand,
1741
+ parsed,
1742
+ timedOut: result.error && 'ETIMEDOUT' === result.error.code,
1743
+ isCanceled: false,
1744
+ killed: null !== result.signal
1745
+ });
1746
+ if (!parsed.options.reject) return error;
1747
+ throw error;
1748
+ }
1749
+ return {
1750
+ command,
1751
+ escapedCommand,
1752
+ exitCode: 0,
1753
+ stdout,
1754
+ stderr,
1755
+ failed: false,
1756
+ timedOut: false,
1757
+ isCanceled: false,
1758
+ killed: false
1759
+ };
1760
+ }
1761
+ const normalizeScriptStdin = ({ input, inputFile, stdio })=>void 0 === input && void 0 === inputFile && void 0 === stdio ? {
1762
+ stdin: 'inherit'
1763
+ } : {};
1764
+ const normalizeScriptOptions = (options = {})=>({
1765
+ preferLocal: true,
1766
+ ...normalizeScriptStdin(options),
1767
+ ...options
1768
+ });
1769
+ function create$(options) {
1770
+ function $(templatesOrOptions, ...expressions) {
1771
+ if (!Array.isArray(templatesOrOptions)) return create$({
1772
+ ...options,
1773
+ ...templatesOrOptions
1774
+ });
1775
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
1776
+ return execa(file, args, normalizeScriptOptions(options));
1777
+ }
1778
+ $.sync = (templates, ...expressions)=>{
1779
+ if (!Array.isArray(templates)) throw new TypeError('Please use $(options).sync`command` instead of $.sync(options)`command`.');
1780
+ const [file, ...args] = parseTemplates(templates, expressions);
1781
+ return execaSync(file, args, normalizeScriptOptions(options));
1782
+ };
1783
+ return $;
1784
+ }
1785
+ create$();
1786
+ }
1787
+ };