@mcpjam/inspector 0.9.19 → 0.9.20

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,5 +1,2103 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // ../node_modules/isexe/windows.js
34
+ var require_windows = __commonJS({
35
+ "../node_modules/isexe/windows.js"(exports, module) {
36
+ "use strict";
37
+ module.exports = isexe;
38
+ isexe.sync = sync;
39
+ var fs = __require("fs");
40
+ function checkPathExt(path, options) {
41
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
42
+ if (!pathext) {
43
+ return true;
44
+ }
45
+ pathext = pathext.split(";");
46
+ if (pathext.indexOf("") !== -1) {
47
+ return true;
48
+ }
49
+ for (var i = 0; i < pathext.length; i++) {
50
+ var p = pathext[i].toLowerCase();
51
+ if (p && path.substr(-p.length).toLowerCase() === p) {
52
+ return true;
53
+ }
54
+ }
55
+ return false;
56
+ }
57
+ function checkStat(stat, path, options) {
58
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
59
+ return false;
60
+ }
61
+ return checkPathExt(path, options);
62
+ }
63
+ function isexe(path, options, cb) {
64
+ fs.stat(path, function(er, stat) {
65
+ cb(er, er ? false : checkStat(stat, path, options));
66
+ });
67
+ }
68
+ function sync(path, options) {
69
+ return checkStat(fs.statSync(path), path, options);
70
+ }
71
+ }
72
+ });
73
+
74
+ // ../node_modules/isexe/mode.js
75
+ var require_mode = __commonJS({
76
+ "../node_modules/isexe/mode.js"(exports, module) {
77
+ "use strict";
78
+ module.exports = isexe;
79
+ isexe.sync = sync;
80
+ var fs = __require("fs");
81
+ function isexe(path, options, cb) {
82
+ fs.stat(path, function(er, stat) {
83
+ cb(er, er ? false : checkStat(stat, options));
84
+ });
85
+ }
86
+ function sync(path, options) {
87
+ return checkStat(fs.statSync(path), options);
88
+ }
89
+ function checkStat(stat, options) {
90
+ return stat.isFile() && checkMode(stat, options);
91
+ }
92
+ function checkMode(stat, options) {
93
+ var mod = stat.mode;
94
+ var uid = stat.uid;
95
+ var gid = stat.gid;
96
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
97
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
98
+ var u = parseInt("100", 8);
99
+ var g = parseInt("010", 8);
100
+ var o = parseInt("001", 8);
101
+ var ug = u | g;
102
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
103
+ return ret;
104
+ }
105
+ }
106
+ });
107
+
108
+ // ../node_modules/isexe/index.js
109
+ var require_isexe = __commonJS({
110
+ "../node_modules/isexe/index.js"(exports, module) {
111
+ "use strict";
112
+ var fs = __require("fs");
113
+ var core;
114
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
115
+ core = require_windows();
116
+ } else {
117
+ core = require_mode();
118
+ }
119
+ module.exports = isexe;
120
+ isexe.sync = sync;
121
+ function isexe(path, options, cb) {
122
+ if (typeof options === "function") {
123
+ cb = options;
124
+ options = {};
125
+ }
126
+ if (!cb) {
127
+ if (typeof Promise !== "function") {
128
+ throw new TypeError("callback not provided");
129
+ }
130
+ return new Promise(function(resolve, reject) {
131
+ isexe(path, options || {}, function(er, is) {
132
+ if (er) {
133
+ reject(er);
134
+ } else {
135
+ resolve(is);
136
+ }
137
+ });
138
+ });
139
+ }
140
+ core(path, options || {}, function(er, is) {
141
+ if (er) {
142
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
143
+ er = null;
144
+ is = false;
145
+ }
146
+ }
147
+ cb(er, is);
148
+ });
149
+ }
150
+ function sync(path, options) {
151
+ try {
152
+ return core.sync(path, options || {});
153
+ } catch (er) {
154
+ if (options && options.ignoreErrors || er.code === "EACCES") {
155
+ return false;
156
+ } else {
157
+ throw er;
158
+ }
159
+ }
160
+ }
161
+ }
162
+ });
163
+
164
+ // ../node_modules/which/which.js
165
+ var require_which = __commonJS({
166
+ "../node_modules/which/which.js"(exports, module) {
167
+ "use strict";
168
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
169
+ var path = __require("path");
170
+ var COLON = isWindows ? ";" : ":";
171
+ var isexe = require_isexe();
172
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
173
+ var getPathInfo = (cmd, opt) => {
174
+ const colon = opt.colon || COLON;
175
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
176
+ // windows always checks the cwd first
177
+ ...isWindows ? [process.cwd()] : [],
178
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
179
+ "").split(colon)
180
+ ];
181
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
182
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
183
+ if (isWindows) {
184
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
185
+ pathExt.unshift("");
186
+ }
187
+ return {
188
+ pathEnv,
189
+ pathExt,
190
+ pathExtExe
191
+ };
192
+ };
193
+ var which = (cmd, opt, cb) => {
194
+ if (typeof opt === "function") {
195
+ cb = opt;
196
+ opt = {};
197
+ }
198
+ if (!opt)
199
+ opt = {};
200
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
201
+ const found = [];
202
+ const step = (i) => new Promise((resolve, reject) => {
203
+ if (i === pathEnv.length)
204
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
205
+ const ppRaw = pathEnv[i];
206
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
207
+ const pCmd = path.join(pathPart, cmd);
208
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
209
+ resolve(subStep(p, i, 0));
210
+ });
211
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
212
+ if (ii === pathExt.length)
213
+ return resolve(step(i + 1));
214
+ const ext = pathExt[ii];
215
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
216
+ if (!er && is) {
217
+ if (opt.all)
218
+ found.push(p + ext);
219
+ else
220
+ return resolve(p + ext);
221
+ }
222
+ return resolve(subStep(p, i, ii + 1));
223
+ });
224
+ });
225
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
226
+ };
227
+ var whichSync = (cmd, opt) => {
228
+ opt = opt || {};
229
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
230
+ const found = [];
231
+ for (let i = 0; i < pathEnv.length; i++) {
232
+ const ppRaw = pathEnv[i];
233
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
234
+ const pCmd = path.join(pathPart, cmd);
235
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
236
+ for (let j = 0; j < pathExt.length; j++) {
237
+ const cur = p + pathExt[j];
238
+ try {
239
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
240
+ if (is) {
241
+ if (opt.all)
242
+ found.push(cur);
243
+ else
244
+ return cur;
245
+ }
246
+ } catch (ex) {
247
+ }
248
+ }
249
+ }
250
+ if (opt.all && found.length)
251
+ return found;
252
+ if (opt.nothrow)
253
+ return null;
254
+ throw getNotFoundError(cmd);
255
+ };
256
+ module.exports = which;
257
+ which.sync = whichSync;
258
+ }
259
+ });
260
+
261
+ // ../node_modules/path-key/index.js
262
+ var require_path_key = __commonJS({
263
+ "../node_modules/path-key/index.js"(exports, module) {
264
+ "use strict";
265
+ var pathKey = (options = {}) => {
266
+ const environment = options.env || process.env;
267
+ const platform = options.platform || process.platform;
268
+ if (platform !== "win32") {
269
+ return "PATH";
270
+ }
271
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
272
+ };
273
+ module.exports = pathKey;
274
+ module.exports.default = pathKey;
275
+ }
276
+ });
277
+
278
+ // ../node_modules/cross-spawn/lib/util/resolveCommand.js
279
+ var require_resolveCommand = __commonJS({
280
+ "../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
281
+ "use strict";
282
+ var path = __require("path");
283
+ var which = require_which();
284
+ var getPathKey = require_path_key();
285
+ function resolveCommandAttempt(parsed, withoutPathExt) {
286
+ const env2 = parsed.options.env || process.env;
287
+ const cwd = process.cwd();
288
+ const hasCustomCwd = parsed.options.cwd != null;
289
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
290
+ if (shouldSwitchCwd) {
291
+ try {
292
+ process.chdir(parsed.options.cwd);
293
+ } catch (err) {
294
+ }
295
+ }
296
+ let resolved;
297
+ try {
298
+ resolved = which.sync(parsed.command, {
299
+ path: env2[getPathKey({ env: env2 })],
300
+ pathExt: withoutPathExt ? path.delimiter : void 0
301
+ });
302
+ } catch (e) {
303
+ } finally {
304
+ if (shouldSwitchCwd) {
305
+ process.chdir(cwd);
306
+ }
307
+ }
308
+ if (resolved) {
309
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
310
+ }
311
+ return resolved;
312
+ }
313
+ function resolveCommand(parsed) {
314
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
315
+ }
316
+ module.exports = resolveCommand;
317
+ }
318
+ });
319
+
320
+ // ../node_modules/cross-spawn/lib/util/escape.js
321
+ var require_escape = __commonJS({
322
+ "../node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
323
+ "use strict";
324
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
325
+ function escapeCommand(arg) {
326
+ arg = arg.replace(metaCharsRegExp, "^$1");
327
+ return arg;
328
+ }
329
+ function escapeArgument(arg, doubleEscapeMetaChars) {
330
+ arg = `${arg}`;
331
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
332
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
333
+ arg = `"${arg}"`;
334
+ arg = arg.replace(metaCharsRegExp, "^$1");
335
+ if (doubleEscapeMetaChars) {
336
+ arg = arg.replace(metaCharsRegExp, "^$1");
337
+ }
338
+ return arg;
339
+ }
340
+ module.exports.command = escapeCommand;
341
+ module.exports.argument = escapeArgument;
342
+ }
343
+ });
344
+
345
+ // ../node_modules/shebang-regex/index.js
346
+ var require_shebang_regex = __commonJS({
347
+ "../node_modules/shebang-regex/index.js"(exports, module) {
348
+ "use strict";
349
+ module.exports = /^#!(.*)/;
350
+ }
351
+ });
352
+
353
+ // ../node_modules/shebang-command/index.js
354
+ var require_shebang_command = __commonJS({
355
+ "../node_modules/shebang-command/index.js"(exports, module) {
356
+ "use strict";
357
+ var shebangRegex = require_shebang_regex();
358
+ module.exports = (string = "") => {
359
+ const match = string.match(shebangRegex);
360
+ if (!match) {
361
+ return null;
362
+ }
363
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
364
+ const binary = path.split("/").pop();
365
+ if (binary === "env") {
366
+ return argument;
367
+ }
368
+ return argument ? `${binary} ${argument}` : binary;
369
+ };
370
+ }
371
+ });
372
+
373
+ // ../node_modules/cross-spawn/lib/util/readShebang.js
374
+ var require_readShebang = __commonJS({
375
+ "../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
376
+ "use strict";
377
+ var fs = __require("fs");
378
+ var shebangCommand = require_shebang_command();
379
+ function readShebang(command) {
380
+ const size = 150;
381
+ const buffer = Buffer.alloc(size);
382
+ let fd;
383
+ try {
384
+ fd = fs.openSync(command, "r");
385
+ fs.readSync(fd, buffer, 0, size, 0);
386
+ fs.closeSync(fd);
387
+ } catch (e) {
388
+ }
389
+ return shebangCommand(buffer.toString());
390
+ }
391
+ module.exports = readShebang;
392
+ }
393
+ });
394
+
395
+ // ../node_modules/cross-spawn/lib/parse.js
396
+ var require_parse = __commonJS({
397
+ "../node_modules/cross-spawn/lib/parse.js"(exports, module) {
398
+ "use strict";
399
+ var path = __require("path");
400
+ var resolveCommand = require_resolveCommand();
401
+ var escape = require_escape();
402
+ var readShebang = require_readShebang();
403
+ var isWin = process.platform === "win32";
404
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
405
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
406
+ function detectShebang(parsed) {
407
+ parsed.file = resolveCommand(parsed);
408
+ const shebang = parsed.file && readShebang(parsed.file);
409
+ if (shebang) {
410
+ parsed.args.unshift(parsed.file);
411
+ parsed.command = shebang;
412
+ return resolveCommand(parsed);
413
+ }
414
+ return parsed.file;
415
+ }
416
+ function parseNonShell(parsed) {
417
+ if (!isWin) {
418
+ return parsed;
419
+ }
420
+ const commandFile = detectShebang(parsed);
421
+ const needsShell = !isExecutableRegExp.test(commandFile);
422
+ if (parsed.options.forceShell || needsShell) {
423
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
424
+ parsed.command = path.normalize(parsed.command);
425
+ parsed.command = escape.command(parsed.command);
426
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
427
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
428
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
429
+ parsed.command = process.env.comspec || "cmd.exe";
430
+ parsed.options.windowsVerbatimArguments = true;
431
+ }
432
+ return parsed;
433
+ }
434
+ function parse(command, args2, options) {
435
+ if (args2 && !Array.isArray(args2)) {
436
+ options = args2;
437
+ args2 = null;
438
+ }
439
+ args2 = args2 ? args2.slice(0) : [];
440
+ options = Object.assign({}, options);
441
+ const parsed = {
442
+ command,
443
+ args: args2,
444
+ options,
445
+ file: void 0,
446
+ original: {
447
+ command,
448
+ args: args2
449
+ }
450
+ };
451
+ return options.shell ? parsed : parseNonShell(parsed);
452
+ }
453
+ module.exports = parse;
454
+ }
455
+ });
456
+
457
+ // ../node_modules/cross-spawn/lib/enoent.js
458
+ var require_enoent = __commonJS({
459
+ "../node_modules/cross-spawn/lib/enoent.js"(exports, module) {
460
+ "use strict";
461
+ var isWin = process.platform === "win32";
462
+ function notFoundError(original, syscall) {
463
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
464
+ code: "ENOENT",
465
+ errno: "ENOENT",
466
+ syscall: `${syscall} ${original.command}`,
467
+ path: original.command,
468
+ spawnargs: original.args
469
+ });
470
+ }
471
+ function hookChildProcess(cp, parsed) {
472
+ if (!isWin) {
473
+ return;
474
+ }
475
+ const originalEmit = cp.emit;
476
+ cp.emit = function(name, arg1) {
477
+ if (name === "exit") {
478
+ const err = verifyENOENT(arg1, parsed);
479
+ if (err) {
480
+ return originalEmit.call(cp, "error", err);
481
+ }
482
+ }
483
+ return originalEmit.apply(cp, arguments);
484
+ };
485
+ }
486
+ function verifyENOENT(status, parsed) {
487
+ if (isWin && status === 1 && !parsed.file) {
488
+ return notFoundError(parsed.original, "spawn");
489
+ }
490
+ return null;
491
+ }
492
+ function verifyENOENTSync(status, parsed) {
493
+ if (isWin && status === 1 && !parsed.file) {
494
+ return notFoundError(parsed.original, "spawnSync");
495
+ }
496
+ return null;
497
+ }
498
+ module.exports = {
499
+ hookChildProcess,
500
+ verifyENOENT,
501
+ verifyENOENTSync,
502
+ notFoundError
503
+ };
504
+ }
505
+ });
506
+
507
+ // ../node_modules/cross-spawn/index.js
508
+ var require_cross_spawn = __commonJS({
509
+ "../node_modules/cross-spawn/index.js"(exports, module) {
510
+ "use strict";
511
+ var cp = __require("child_process");
512
+ var parse = require_parse();
513
+ var enoent = require_enoent();
514
+ function spawn(command, args2, options) {
515
+ const parsed = parse(command, args2, options);
516
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
517
+ enoent.hookChildProcess(spawned, parsed);
518
+ return spawned;
519
+ }
520
+ function spawnSync(command, args2, options) {
521
+ const parsed = parse(command, args2, options);
522
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
523
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
524
+ return result;
525
+ }
526
+ module.exports = spawn;
527
+ module.exports.spawn = spawn;
528
+ module.exports.sync = spawnSync;
529
+ module.exports._parse = parse;
530
+ module.exports._enoent = enoent;
531
+ }
532
+ });
533
+
534
+ // ../node_modules/strip-final-newline/index.js
535
+ var require_strip_final_newline = __commonJS({
536
+ "../node_modules/strip-final-newline/index.js"(exports, module) {
537
+ "use strict";
538
+ module.exports = (input) => {
539
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
540
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
541
+ if (input[input.length - 1] === LF) {
542
+ input = input.slice(0, input.length - 1);
543
+ }
544
+ if (input[input.length - 1] === CR) {
545
+ input = input.slice(0, input.length - 1);
546
+ }
547
+ return input;
548
+ };
549
+ }
550
+ });
551
+
552
+ // ../node_modules/shell-env/node_modules/npm-run-path/index.js
553
+ var require_npm_run_path = __commonJS({
554
+ "../node_modules/shell-env/node_modules/npm-run-path/index.js"(exports, module) {
555
+ "use strict";
556
+ var path = __require("path");
557
+ var pathKey = require_path_key();
558
+ var npmRunPath = (options) => {
559
+ options = {
560
+ cwd: process.cwd(),
561
+ path: process.env[pathKey()],
562
+ execPath: process.execPath,
563
+ ...options
564
+ };
565
+ let previous;
566
+ let cwdPath = path.resolve(options.cwd);
567
+ const result = [];
568
+ while (previous !== cwdPath) {
569
+ result.push(path.join(cwdPath, "node_modules/.bin"));
570
+ previous = cwdPath;
571
+ cwdPath = path.resolve(cwdPath, "..");
572
+ }
573
+ const execPathDir = path.resolve(options.cwd, options.execPath, "..");
574
+ result.push(execPathDir);
575
+ return result.concat(options.path).join(path.delimiter);
576
+ };
577
+ module.exports = npmRunPath;
578
+ module.exports.default = npmRunPath;
579
+ module.exports.env = (options) => {
580
+ options = {
581
+ env: process.env,
582
+ ...options
583
+ };
584
+ const env2 = { ...options.env };
585
+ const path2 = pathKey({ env: env2 });
586
+ options.path = env2[path2];
587
+ env2[path2] = module.exports(options);
588
+ return env2;
589
+ };
590
+ }
591
+ });
592
+
593
+ // ../node_modules/mimic-fn/index.js
594
+ var require_mimic_fn = __commonJS({
595
+ "../node_modules/mimic-fn/index.js"(exports, module) {
596
+ "use strict";
597
+ var mimicFn = (to, from) => {
598
+ for (const prop of Reflect.ownKeys(from)) {
599
+ Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
600
+ }
601
+ return to;
602
+ };
603
+ module.exports = mimicFn;
604
+ module.exports.default = mimicFn;
605
+ }
606
+ });
607
+
608
+ // ../node_modules/onetime/index.js
609
+ var require_onetime = __commonJS({
610
+ "../node_modules/onetime/index.js"(exports, module) {
611
+ "use strict";
612
+ var mimicFn = require_mimic_fn();
613
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
614
+ var onetime = (function_, options = {}) => {
615
+ if (typeof function_ !== "function") {
616
+ throw new TypeError("Expected a function");
617
+ }
618
+ let returnValue;
619
+ let callCount = 0;
620
+ const functionName = function_.displayName || function_.name || "<anonymous>";
621
+ const onetime2 = function(...arguments_) {
622
+ calledFunctions.set(onetime2, ++callCount);
623
+ if (callCount === 1) {
624
+ returnValue = function_.apply(this, arguments_);
625
+ function_ = null;
626
+ } else if (options.throw === true) {
627
+ throw new Error(`Function \`${functionName}\` can only be called once`);
628
+ }
629
+ return returnValue;
630
+ };
631
+ mimicFn(onetime2, function_);
632
+ calledFunctions.set(onetime2, callCount);
633
+ return onetime2;
634
+ };
635
+ module.exports = onetime;
636
+ module.exports.default = onetime;
637
+ module.exports.callCount = (function_) => {
638
+ if (!calledFunctions.has(function_)) {
639
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
640
+ }
641
+ return calledFunctions.get(function_);
642
+ };
643
+ }
644
+ });
645
+
646
+ // ../node_modules/human-signals/build/src/core.js
647
+ var require_core = __commonJS({
648
+ "../node_modules/human-signals/build/src/core.js"(exports) {
649
+ "use strict";
650
+ Object.defineProperty(exports, "__esModule", { value: true });
651
+ exports.SIGNALS = void 0;
652
+ var SIGNALS = [
653
+ {
654
+ name: "SIGHUP",
655
+ number: 1,
656
+ action: "terminate",
657
+ description: "Terminal closed",
658
+ standard: "posix"
659
+ },
660
+ {
661
+ name: "SIGINT",
662
+ number: 2,
663
+ action: "terminate",
664
+ description: "User interruption with CTRL-C",
665
+ standard: "ansi"
666
+ },
667
+ {
668
+ name: "SIGQUIT",
669
+ number: 3,
670
+ action: "core",
671
+ description: "User interruption with CTRL-\\",
672
+ standard: "posix"
673
+ },
674
+ {
675
+ name: "SIGILL",
676
+ number: 4,
677
+ action: "core",
678
+ description: "Invalid machine instruction",
679
+ standard: "ansi"
680
+ },
681
+ {
682
+ name: "SIGTRAP",
683
+ number: 5,
684
+ action: "core",
685
+ description: "Debugger breakpoint",
686
+ standard: "posix"
687
+ },
688
+ {
689
+ name: "SIGABRT",
690
+ number: 6,
691
+ action: "core",
692
+ description: "Aborted",
693
+ standard: "ansi"
694
+ },
695
+ {
696
+ name: "SIGIOT",
697
+ number: 6,
698
+ action: "core",
699
+ description: "Aborted",
700
+ standard: "bsd"
701
+ },
702
+ {
703
+ name: "SIGBUS",
704
+ number: 7,
705
+ action: "core",
706
+ description: "Bus error due to misaligned, non-existing address or paging error",
707
+ standard: "bsd"
708
+ },
709
+ {
710
+ name: "SIGEMT",
711
+ number: 7,
712
+ action: "terminate",
713
+ description: "Command should be emulated but is not implemented",
714
+ standard: "other"
715
+ },
716
+ {
717
+ name: "SIGFPE",
718
+ number: 8,
719
+ action: "core",
720
+ description: "Floating point arithmetic error",
721
+ standard: "ansi"
722
+ },
723
+ {
724
+ name: "SIGKILL",
725
+ number: 9,
726
+ action: "terminate",
727
+ description: "Forced termination",
728
+ standard: "posix",
729
+ forced: true
730
+ },
731
+ {
732
+ name: "SIGUSR1",
733
+ number: 10,
734
+ action: "terminate",
735
+ description: "Application-specific signal",
736
+ standard: "posix"
737
+ },
738
+ {
739
+ name: "SIGSEGV",
740
+ number: 11,
741
+ action: "core",
742
+ description: "Segmentation fault",
743
+ standard: "ansi"
744
+ },
745
+ {
746
+ name: "SIGUSR2",
747
+ number: 12,
748
+ action: "terminate",
749
+ description: "Application-specific signal",
750
+ standard: "posix"
751
+ },
752
+ {
753
+ name: "SIGPIPE",
754
+ number: 13,
755
+ action: "terminate",
756
+ description: "Broken pipe or socket",
757
+ standard: "posix"
758
+ },
759
+ {
760
+ name: "SIGALRM",
761
+ number: 14,
762
+ action: "terminate",
763
+ description: "Timeout or timer",
764
+ standard: "posix"
765
+ },
766
+ {
767
+ name: "SIGTERM",
768
+ number: 15,
769
+ action: "terminate",
770
+ description: "Termination",
771
+ standard: "ansi"
772
+ },
773
+ {
774
+ name: "SIGSTKFLT",
775
+ number: 16,
776
+ action: "terminate",
777
+ description: "Stack is empty or overflowed",
778
+ standard: "other"
779
+ },
780
+ {
781
+ name: "SIGCHLD",
782
+ number: 17,
783
+ action: "ignore",
784
+ description: "Child process terminated, paused or unpaused",
785
+ standard: "posix"
786
+ },
787
+ {
788
+ name: "SIGCLD",
789
+ number: 17,
790
+ action: "ignore",
791
+ description: "Child process terminated, paused or unpaused",
792
+ standard: "other"
793
+ },
794
+ {
795
+ name: "SIGCONT",
796
+ number: 18,
797
+ action: "unpause",
798
+ description: "Unpaused",
799
+ standard: "posix",
800
+ forced: true
801
+ },
802
+ {
803
+ name: "SIGSTOP",
804
+ number: 19,
805
+ action: "pause",
806
+ description: "Paused",
807
+ standard: "posix",
808
+ forced: true
809
+ },
810
+ {
811
+ name: "SIGTSTP",
812
+ number: 20,
813
+ action: "pause",
814
+ description: 'Paused using CTRL-Z or "suspend"',
815
+ standard: "posix"
816
+ },
817
+ {
818
+ name: "SIGTTIN",
819
+ number: 21,
820
+ action: "pause",
821
+ description: "Background process cannot read terminal input",
822
+ standard: "posix"
823
+ },
824
+ {
825
+ name: "SIGBREAK",
826
+ number: 21,
827
+ action: "terminate",
828
+ description: "User interruption with CTRL-BREAK",
829
+ standard: "other"
830
+ },
831
+ {
832
+ name: "SIGTTOU",
833
+ number: 22,
834
+ action: "pause",
835
+ description: "Background process cannot write to terminal output",
836
+ standard: "posix"
837
+ },
838
+ {
839
+ name: "SIGURG",
840
+ number: 23,
841
+ action: "ignore",
842
+ description: "Socket received out-of-band data",
843
+ standard: "bsd"
844
+ },
845
+ {
846
+ name: "SIGXCPU",
847
+ number: 24,
848
+ action: "core",
849
+ description: "Process timed out",
850
+ standard: "bsd"
851
+ },
852
+ {
853
+ name: "SIGXFSZ",
854
+ number: 25,
855
+ action: "core",
856
+ description: "File too big",
857
+ standard: "bsd"
858
+ },
859
+ {
860
+ name: "SIGVTALRM",
861
+ number: 26,
862
+ action: "terminate",
863
+ description: "Timeout or timer",
864
+ standard: "bsd"
865
+ },
866
+ {
867
+ name: "SIGPROF",
868
+ number: 27,
869
+ action: "terminate",
870
+ description: "Timeout or timer",
871
+ standard: "bsd"
872
+ },
873
+ {
874
+ name: "SIGWINCH",
875
+ number: 28,
876
+ action: "ignore",
877
+ description: "Terminal window size changed",
878
+ standard: "bsd"
879
+ },
880
+ {
881
+ name: "SIGIO",
882
+ number: 29,
883
+ action: "terminate",
884
+ description: "I/O is available",
885
+ standard: "other"
886
+ },
887
+ {
888
+ name: "SIGPOLL",
889
+ number: 29,
890
+ action: "terminate",
891
+ description: "Watched event",
892
+ standard: "other"
893
+ },
894
+ {
895
+ name: "SIGINFO",
896
+ number: 29,
897
+ action: "ignore",
898
+ description: "Request for process information",
899
+ standard: "other"
900
+ },
901
+ {
902
+ name: "SIGPWR",
903
+ number: 30,
904
+ action: "terminate",
905
+ description: "Device running out of power",
906
+ standard: "systemv"
907
+ },
908
+ {
909
+ name: "SIGSYS",
910
+ number: 31,
911
+ action: "core",
912
+ description: "Invalid system call",
913
+ standard: "other"
914
+ },
915
+ {
916
+ name: "SIGUNUSED",
917
+ number: 31,
918
+ action: "terminate",
919
+ description: "Invalid system call",
920
+ standard: "other"
921
+ }
922
+ ];
923
+ exports.SIGNALS = SIGNALS;
924
+ }
925
+ });
926
+
927
+ // ../node_modules/human-signals/build/src/realtime.js
928
+ var require_realtime = __commonJS({
929
+ "../node_modules/human-signals/build/src/realtime.js"(exports) {
930
+ "use strict";
931
+ Object.defineProperty(exports, "__esModule", { value: true });
932
+ exports.SIGRTMAX = exports.getRealtimeSignals = void 0;
933
+ var getRealtimeSignals = function() {
934
+ const length = SIGRTMAX - SIGRTMIN + 1;
935
+ return Array.from({ length }, getRealtimeSignal);
936
+ };
937
+ exports.getRealtimeSignals = getRealtimeSignals;
938
+ var getRealtimeSignal = function(value, index) {
939
+ return {
940
+ name: `SIGRT${index + 1}`,
941
+ number: SIGRTMIN + index,
942
+ action: "terminate",
943
+ description: "Application-specific signal (realtime)",
944
+ standard: "posix"
945
+ };
946
+ };
947
+ var SIGRTMIN = 34;
948
+ var SIGRTMAX = 64;
949
+ exports.SIGRTMAX = SIGRTMAX;
950
+ }
951
+ });
952
+
953
+ // ../node_modules/human-signals/build/src/signals.js
954
+ var require_signals = __commonJS({
955
+ "../node_modules/human-signals/build/src/signals.js"(exports) {
956
+ "use strict";
957
+ Object.defineProperty(exports, "__esModule", { value: true });
958
+ exports.getSignals = void 0;
959
+ var _os = __require("os");
960
+ var _core = require_core();
961
+ var _realtime = require_realtime();
962
+ var getSignals = function() {
963
+ const realtimeSignals = (0, _realtime.getRealtimeSignals)();
964
+ const signals = [..._core.SIGNALS, ...realtimeSignals].map(normalizeSignal);
965
+ return signals;
966
+ };
967
+ exports.getSignals = getSignals;
968
+ var normalizeSignal = function({
969
+ name,
970
+ number: defaultNumber,
971
+ description,
972
+ action,
973
+ forced = false,
974
+ standard
975
+ }) {
976
+ const {
977
+ signals: { [name]: constantSignal }
978
+ } = _os.constants;
979
+ const supported = constantSignal !== void 0;
980
+ const number = supported ? constantSignal : defaultNumber;
981
+ return { name, number, description, supported, action, forced, standard };
982
+ };
983
+ }
984
+ });
985
+
986
+ // ../node_modules/human-signals/build/src/main.js
987
+ var require_main = __commonJS({
988
+ "../node_modules/human-signals/build/src/main.js"(exports) {
989
+ "use strict";
990
+ Object.defineProperty(exports, "__esModule", { value: true });
991
+ exports.signalsByNumber = exports.signalsByName = void 0;
992
+ var _os = __require("os");
993
+ var _signals = require_signals();
994
+ var _realtime = require_realtime();
995
+ var getSignalsByName = function() {
996
+ const signals = (0, _signals.getSignals)();
997
+ return signals.reduce(getSignalByName, {});
998
+ };
999
+ var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
1000
+ return {
1001
+ ...signalByNameMemo,
1002
+ [name]: { name, number, description, supported, action, forced, standard }
1003
+ };
1004
+ };
1005
+ var signalsByName = getSignalsByName();
1006
+ exports.signalsByName = signalsByName;
1007
+ var getSignalsByNumber = function() {
1008
+ const signals = (0, _signals.getSignals)();
1009
+ const length = _realtime.SIGRTMAX + 1;
1010
+ const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals));
1011
+ return Object.assign({}, ...signalsA);
1012
+ };
1013
+ var getSignalByNumber = function(number, signals) {
1014
+ const signal = findSignalByNumber(number, signals);
1015
+ if (signal === void 0) {
1016
+ return {};
1017
+ }
1018
+ const { name, description, supported, action, forced, standard } = signal;
1019
+ return {
1020
+ [number]: {
1021
+ name,
1022
+ number,
1023
+ description,
1024
+ supported,
1025
+ action,
1026
+ forced,
1027
+ standard
1028
+ }
1029
+ };
1030
+ };
1031
+ var findSignalByNumber = function(number, signals) {
1032
+ const signal = signals.find(({ name }) => _os.constants.signals[name] === number);
1033
+ if (signal !== void 0) {
1034
+ return signal;
1035
+ }
1036
+ return signals.find((signalA) => signalA.number === number);
1037
+ };
1038
+ var signalsByNumber = getSignalsByNumber();
1039
+ exports.signalsByNumber = signalsByNumber;
1040
+ }
1041
+ });
1042
+
1043
+ // ../node_modules/shell-env/node_modules/execa/lib/error.js
1044
+ var require_error = __commonJS({
1045
+ "../node_modules/shell-env/node_modules/execa/lib/error.js"(exports, module) {
1046
+ "use strict";
1047
+ var { signalsByName } = require_main();
1048
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1049
+ if (timedOut) {
1050
+ return `timed out after ${timeout} milliseconds`;
1051
+ }
1052
+ if (isCanceled) {
1053
+ return "was canceled";
1054
+ }
1055
+ if (errorCode !== void 0) {
1056
+ return `failed with ${errorCode}`;
1057
+ }
1058
+ if (signal !== void 0) {
1059
+ return `was killed with ${signal} (${signalDescription})`;
1060
+ }
1061
+ if (exitCode !== void 0) {
1062
+ return `failed with exit code ${exitCode}`;
1063
+ }
1064
+ return "failed";
1065
+ };
1066
+ var makeError = ({
1067
+ stdout,
1068
+ stderr,
1069
+ all,
1070
+ error,
1071
+ signal,
1072
+ exitCode,
1073
+ command,
1074
+ escapedCommand,
1075
+ timedOut,
1076
+ isCanceled,
1077
+ killed,
1078
+ parsed: { options: { timeout } }
1079
+ }) => {
1080
+ exitCode = exitCode === null ? void 0 : exitCode;
1081
+ signal = signal === null ? void 0 : signal;
1082
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1083
+ const errorCode = error && error.code;
1084
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1085
+ const execaMessage = `Command ${prefix}: ${command}`;
1086
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1087
+ const shortMessage = isError ? `${execaMessage}
1088
+ ${error.message}` : execaMessage;
1089
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1090
+ if (isError) {
1091
+ error.originalMessage = error.message;
1092
+ error.message = message;
1093
+ } else {
1094
+ error = new Error(message);
1095
+ }
1096
+ error.shortMessage = shortMessage;
1097
+ error.command = command;
1098
+ error.escapedCommand = escapedCommand;
1099
+ error.exitCode = exitCode;
1100
+ error.signal = signal;
1101
+ error.signalDescription = signalDescription;
1102
+ error.stdout = stdout;
1103
+ error.stderr = stderr;
1104
+ if (all !== void 0) {
1105
+ error.all = all;
1106
+ }
1107
+ if ("bufferedData" in error) {
1108
+ delete error.bufferedData;
1109
+ }
1110
+ error.failed = true;
1111
+ error.timedOut = Boolean(timedOut);
1112
+ error.isCanceled = isCanceled;
1113
+ error.killed = killed && !timedOut;
1114
+ return error;
1115
+ };
1116
+ module.exports = makeError;
1117
+ }
1118
+ });
1119
+
1120
+ // ../node_modules/shell-env/node_modules/execa/lib/stdio.js
1121
+ var require_stdio = __commonJS({
1122
+ "../node_modules/shell-env/node_modules/execa/lib/stdio.js"(exports, module) {
1123
+ "use strict";
1124
+ var aliases = ["stdin", "stdout", "stderr"];
1125
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1126
+ var normalizeStdio = (options) => {
1127
+ if (!options) {
1128
+ return;
1129
+ }
1130
+ const { stdio } = options;
1131
+ if (stdio === void 0) {
1132
+ return aliases.map((alias) => options[alias]);
1133
+ }
1134
+ if (hasAlias(options)) {
1135
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1136
+ }
1137
+ if (typeof stdio === "string") {
1138
+ return stdio;
1139
+ }
1140
+ if (!Array.isArray(stdio)) {
1141
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1142
+ }
1143
+ const length = Math.max(stdio.length, aliases.length);
1144
+ return Array.from({ length }, (value, index) => stdio[index]);
1145
+ };
1146
+ module.exports = normalizeStdio;
1147
+ module.exports.node = (options) => {
1148
+ const stdio = normalizeStdio(options);
1149
+ if (stdio === "ipc") {
1150
+ return "ipc";
1151
+ }
1152
+ if (stdio === void 0 || typeof stdio === "string") {
1153
+ return [stdio, stdio, stdio, "ipc"];
1154
+ }
1155
+ if (stdio.includes("ipc")) {
1156
+ return stdio;
1157
+ }
1158
+ return [...stdio, "ipc"];
1159
+ };
1160
+ }
1161
+ });
1162
+
1163
+ // ../node_modules/shell-env/node_modules/signal-exit/signals.js
1164
+ var require_signals2 = __commonJS({
1165
+ "../node_modules/shell-env/node_modules/signal-exit/signals.js"(exports, module) {
1166
+ "use strict";
1167
+ module.exports = [
1168
+ "SIGABRT",
1169
+ "SIGALRM",
1170
+ "SIGHUP",
1171
+ "SIGINT",
1172
+ "SIGTERM"
1173
+ ];
1174
+ if (process.platform !== "win32") {
1175
+ module.exports.push(
1176
+ "SIGVTALRM",
1177
+ "SIGXCPU",
1178
+ "SIGXFSZ",
1179
+ "SIGUSR2",
1180
+ "SIGTRAP",
1181
+ "SIGSYS",
1182
+ "SIGQUIT",
1183
+ "SIGIOT"
1184
+ // should detect profiler and enable/disable accordingly.
1185
+ // see #21
1186
+ // 'SIGPROF'
1187
+ );
1188
+ }
1189
+ if (process.platform === "linux") {
1190
+ module.exports.push(
1191
+ "SIGIO",
1192
+ "SIGPOLL",
1193
+ "SIGPWR",
1194
+ "SIGSTKFLT",
1195
+ "SIGUNUSED"
1196
+ );
1197
+ }
1198
+ }
1199
+ });
1200
+
1201
+ // ../node_modules/shell-env/node_modules/signal-exit/index.js
1202
+ var require_signal_exit = __commonJS({
1203
+ "../node_modules/shell-env/node_modules/signal-exit/index.js"(exports, module) {
1204
+ "use strict";
1205
+ var process5 = global.process;
1206
+ var processOk = function(process6) {
1207
+ return process6 && typeof process6 === "object" && typeof process6.removeListener === "function" && typeof process6.emit === "function" && typeof process6.reallyExit === "function" && typeof process6.listeners === "function" && typeof process6.kill === "function" && typeof process6.pid === "number" && typeof process6.on === "function";
1208
+ };
1209
+ if (!processOk(process5)) {
1210
+ module.exports = function() {
1211
+ return function() {
1212
+ };
1213
+ };
1214
+ } else {
1215
+ assert = __require("assert");
1216
+ signals = require_signals2();
1217
+ isWin = /^win/i.test(process5.platform);
1218
+ EE = __require("events");
1219
+ if (typeof EE !== "function") {
1220
+ EE = EE.EventEmitter;
1221
+ }
1222
+ if (process5.__signal_exit_emitter__) {
1223
+ emitter = process5.__signal_exit_emitter__;
1224
+ } else {
1225
+ emitter = process5.__signal_exit_emitter__ = new EE();
1226
+ emitter.count = 0;
1227
+ emitter.emitted = {};
1228
+ }
1229
+ if (!emitter.infinite) {
1230
+ emitter.setMaxListeners(Infinity);
1231
+ emitter.infinite = true;
1232
+ }
1233
+ module.exports = function(cb, opts) {
1234
+ if (!processOk(global.process)) {
1235
+ return function() {
1236
+ };
1237
+ }
1238
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1239
+ if (loaded === false) {
1240
+ load();
1241
+ }
1242
+ var ev = "exit";
1243
+ if (opts && opts.alwaysLast) {
1244
+ ev = "afterexit";
1245
+ }
1246
+ var remove = function() {
1247
+ emitter.removeListener(ev, cb);
1248
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1249
+ unload();
1250
+ }
1251
+ };
1252
+ emitter.on(ev, cb);
1253
+ return remove;
1254
+ };
1255
+ unload = function unload2() {
1256
+ if (!loaded || !processOk(global.process)) {
1257
+ return;
1258
+ }
1259
+ loaded = false;
1260
+ signals.forEach(function(sig) {
1261
+ try {
1262
+ process5.removeListener(sig, sigListeners[sig]);
1263
+ } catch (er) {
1264
+ }
1265
+ });
1266
+ process5.emit = originalProcessEmit;
1267
+ process5.reallyExit = originalProcessReallyExit;
1268
+ emitter.count -= 1;
1269
+ };
1270
+ module.exports.unload = unload;
1271
+ emit = function emit2(event, code, signal) {
1272
+ if (emitter.emitted[event]) {
1273
+ return;
1274
+ }
1275
+ emitter.emitted[event] = true;
1276
+ emitter.emit(event, code, signal);
1277
+ };
1278
+ sigListeners = {};
1279
+ signals.forEach(function(sig) {
1280
+ sigListeners[sig] = function listener() {
1281
+ if (!processOk(global.process)) {
1282
+ return;
1283
+ }
1284
+ var listeners = process5.listeners(sig);
1285
+ if (listeners.length === emitter.count) {
1286
+ unload();
1287
+ emit("exit", null, sig);
1288
+ emit("afterexit", null, sig);
1289
+ if (isWin && sig === "SIGHUP") {
1290
+ sig = "SIGINT";
1291
+ }
1292
+ process5.kill(process5.pid, sig);
1293
+ }
1294
+ };
1295
+ });
1296
+ module.exports.signals = function() {
1297
+ return signals;
1298
+ };
1299
+ loaded = false;
1300
+ load = function load2() {
1301
+ if (loaded || !processOk(global.process)) {
1302
+ return;
1303
+ }
1304
+ loaded = true;
1305
+ emitter.count += 1;
1306
+ signals = signals.filter(function(sig) {
1307
+ try {
1308
+ process5.on(sig, sigListeners[sig]);
1309
+ return true;
1310
+ } catch (er) {
1311
+ return false;
1312
+ }
1313
+ });
1314
+ process5.emit = processEmit;
1315
+ process5.reallyExit = processReallyExit;
1316
+ };
1317
+ module.exports.load = load;
1318
+ originalProcessReallyExit = process5.reallyExit;
1319
+ processReallyExit = function processReallyExit2(code) {
1320
+ if (!processOk(global.process)) {
1321
+ return;
1322
+ }
1323
+ process5.exitCode = code || /* istanbul ignore next */
1324
+ 0;
1325
+ emit("exit", process5.exitCode, null);
1326
+ emit("afterexit", process5.exitCode, null);
1327
+ originalProcessReallyExit.call(process5, process5.exitCode);
1328
+ };
1329
+ originalProcessEmit = process5.emit;
1330
+ processEmit = function processEmit2(ev, arg) {
1331
+ if (ev === "exit" && processOk(global.process)) {
1332
+ if (arg !== void 0) {
1333
+ process5.exitCode = arg;
1334
+ }
1335
+ var ret = originalProcessEmit.apply(this, arguments);
1336
+ emit("exit", process5.exitCode, null);
1337
+ emit("afterexit", process5.exitCode, null);
1338
+ return ret;
1339
+ } else {
1340
+ return originalProcessEmit.apply(this, arguments);
1341
+ }
1342
+ };
1343
+ }
1344
+ var assert;
1345
+ var signals;
1346
+ var isWin;
1347
+ var EE;
1348
+ var emitter;
1349
+ var unload;
1350
+ var emit;
1351
+ var sigListeners;
1352
+ var loaded;
1353
+ var load;
1354
+ var originalProcessReallyExit;
1355
+ var processReallyExit;
1356
+ var originalProcessEmit;
1357
+ var processEmit;
1358
+ }
1359
+ });
1360
+
1361
+ // ../node_modules/shell-env/node_modules/execa/lib/kill.js
1362
+ var require_kill = __commonJS({
1363
+ "../node_modules/shell-env/node_modules/execa/lib/kill.js"(exports, module) {
1364
+ "use strict";
1365
+ var os = __require("os");
1366
+ var onExit = require_signal_exit();
1367
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1368
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1369
+ const killResult = kill(signal);
1370
+ setKillTimeout(kill, signal, options, killResult);
1371
+ return killResult;
1372
+ };
1373
+ var setKillTimeout = (kill, signal, options, killResult) => {
1374
+ if (!shouldForceKill(signal, options, killResult)) {
1375
+ return;
1376
+ }
1377
+ const timeout = getForceKillAfterTimeout(options);
1378
+ const t = setTimeout(() => {
1379
+ kill("SIGKILL");
1380
+ }, timeout);
1381
+ if (t.unref) {
1382
+ t.unref();
1383
+ }
1384
+ };
1385
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => {
1386
+ return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1387
+ };
1388
+ var isSigterm = (signal) => {
1389
+ return signal === os.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1390
+ };
1391
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1392
+ if (forceKillAfterTimeout === true) {
1393
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1394
+ }
1395
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1396
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1397
+ }
1398
+ return forceKillAfterTimeout;
1399
+ };
1400
+ var spawnedCancel = (spawned, context) => {
1401
+ const killResult = spawned.kill();
1402
+ if (killResult) {
1403
+ context.isCanceled = true;
1404
+ }
1405
+ };
1406
+ var timeoutKill = (spawned, signal, reject) => {
1407
+ spawned.kill(signal);
1408
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1409
+ };
1410
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1411
+ if (timeout === 0 || timeout === void 0) {
1412
+ return spawnedPromise;
1413
+ }
1414
+ let timeoutId;
1415
+ const timeoutPromise = new Promise((resolve, reject) => {
1416
+ timeoutId = setTimeout(() => {
1417
+ timeoutKill(spawned, killSignal, reject);
1418
+ }, timeout);
1419
+ });
1420
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1421
+ clearTimeout(timeoutId);
1422
+ });
1423
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1424
+ };
1425
+ var validateTimeout = ({ timeout }) => {
1426
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
1427
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1428
+ }
1429
+ };
1430
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1431
+ if (!cleanup || detached) {
1432
+ return timedPromise;
1433
+ }
1434
+ const removeExitHandler = onExit(() => {
1435
+ spawned.kill();
1436
+ });
1437
+ return timedPromise.finally(() => {
1438
+ removeExitHandler();
1439
+ });
1440
+ };
1441
+ module.exports = {
1442
+ spawnedKill,
1443
+ spawnedCancel,
1444
+ setupTimeout,
1445
+ validateTimeout,
1446
+ setExitHandler
1447
+ };
1448
+ }
1449
+ });
1450
+
1451
+ // ../node_modules/is-stream/index.js
1452
+ var require_is_stream = __commonJS({
1453
+ "../node_modules/is-stream/index.js"(exports, module) {
1454
+ "use strict";
1455
+ var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1456
+ isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1457
+ isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
1458
+ isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream);
1459
+ isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function";
1460
+ module.exports = isStream;
1461
+ }
1462
+ });
1463
+
1464
+ // ../node_modules/shell-env/node_modules/get-stream/buffer-stream.js
1465
+ var require_buffer_stream = __commonJS({
1466
+ "../node_modules/shell-env/node_modules/get-stream/buffer-stream.js"(exports, module) {
1467
+ "use strict";
1468
+ var { PassThrough: PassThroughStream } = __require("stream");
1469
+ module.exports = (options) => {
1470
+ options = { ...options };
1471
+ const { array } = options;
1472
+ let { encoding } = options;
1473
+ const isBuffer = encoding === "buffer";
1474
+ let objectMode = false;
1475
+ if (array) {
1476
+ objectMode = !(encoding || isBuffer);
1477
+ } else {
1478
+ encoding = encoding || "utf8";
1479
+ }
1480
+ if (isBuffer) {
1481
+ encoding = null;
1482
+ }
1483
+ const stream = new PassThroughStream({ objectMode });
1484
+ if (encoding) {
1485
+ stream.setEncoding(encoding);
1486
+ }
1487
+ let length = 0;
1488
+ const chunks = [];
1489
+ stream.on("data", (chunk) => {
1490
+ chunks.push(chunk);
1491
+ if (objectMode) {
1492
+ length = chunks.length;
1493
+ } else {
1494
+ length += chunk.length;
1495
+ }
1496
+ });
1497
+ stream.getBufferedValue = () => {
1498
+ if (array) {
1499
+ return chunks;
1500
+ }
1501
+ return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
1502
+ };
1503
+ stream.getBufferedLength = () => length;
1504
+ return stream;
1505
+ };
1506
+ }
1507
+ });
1508
+
1509
+ // ../node_modules/shell-env/node_modules/get-stream/index.js
1510
+ var require_get_stream = __commonJS({
1511
+ "../node_modules/shell-env/node_modules/get-stream/index.js"(exports, module) {
1512
+ "use strict";
1513
+ var { constants: BufferConstants } = __require("buffer");
1514
+ var stream = __require("stream");
1515
+ var { promisify } = __require("util");
1516
+ var bufferStream = require_buffer_stream();
1517
+ var streamPipelinePromisified = promisify(stream.pipeline);
1518
+ var MaxBufferError = class extends Error {
1519
+ constructor() {
1520
+ super("maxBuffer exceeded");
1521
+ this.name = "MaxBufferError";
1522
+ }
1523
+ };
1524
+ async function getStream(inputStream, options) {
1525
+ if (!inputStream) {
1526
+ throw new Error("Expected a stream");
1527
+ }
1528
+ options = {
1529
+ maxBuffer: Infinity,
1530
+ ...options
1531
+ };
1532
+ const { maxBuffer } = options;
1533
+ const stream2 = bufferStream(options);
1534
+ await new Promise((resolve, reject) => {
1535
+ const rejectPromise = (error) => {
1536
+ if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
1537
+ error.bufferedData = stream2.getBufferedValue();
1538
+ }
1539
+ reject(error);
1540
+ };
1541
+ (async () => {
1542
+ try {
1543
+ await streamPipelinePromisified(inputStream, stream2);
1544
+ resolve();
1545
+ } catch (error) {
1546
+ rejectPromise(error);
1547
+ }
1548
+ })();
1549
+ stream2.on("data", () => {
1550
+ if (stream2.getBufferedLength() > maxBuffer) {
1551
+ rejectPromise(new MaxBufferError());
1552
+ }
1553
+ });
1554
+ });
1555
+ return stream2.getBufferedValue();
1556
+ }
1557
+ module.exports = getStream;
1558
+ module.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
1559
+ module.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
1560
+ module.exports.MaxBufferError = MaxBufferError;
1561
+ }
1562
+ });
1563
+
1564
+ // ../node_modules/merge-stream/index.js
1565
+ var require_merge_stream = __commonJS({
1566
+ "../node_modules/merge-stream/index.js"(exports, module) {
1567
+ "use strict";
1568
+ var { PassThrough } = __require("stream");
1569
+ module.exports = function() {
1570
+ var sources = [];
1571
+ var output = new PassThrough({ objectMode: true });
1572
+ output.setMaxListeners(0);
1573
+ output.add = add;
1574
+ output.isEmpty = isEmpty;
1575
+ output.on("unpipe", remove);
1576
+ Array.prototype.slice.call(arguments).forEach(add);
1577
+ return output;
1578
+ function add(source) {
1579
+ if (Array.isArray(source)) {
1580
+ source.forEach(add);
1581
+ return this;
1582
+ }
1583
+ sources.push(source);
1584
+ source.once("end", remove.bind(null, source));
1585
+ source.once("error", output.emit.bind(output, "error"));
1586
+ source.pipe(output, { end: false });
1587
+ return this;
1588
+ }
1589
+ function isEmpty() {
1590
+ return sources.length == 0;
1591
+ }
1592
+ function remove(source) {
1593
+ sources = sources.filter(function(it) {
1594
+ return it !== source;
1595
+ });
1596
+ if (!sources.length && output.readable) {
1597
+ output.end();
1598
+ }
1599
+ }
1600
+ };
1601
+ }
1602
+ });
1603
+
1604
+ // ../node_modules/shell-env/node_modules/execa/lib/stream.js
1605
+ var require_stream = __commonJS({
1606
+ "../node_modules/shell-env/node_modules/execa/lib/stream.js"(exports, module) {
1607
+ "use strict";
1608
+ var isStream = require_is_stream();
1609
+ var getStream = require_get_stream();
1610
+ var mergeStream = require_merge_stream();
1611
+ var handleInput = (spawned, input) => {
1612
+ if (input === void 0 || spawned.stdin === void 0) {
1613
+ return;
1614
+ }
1615
+ if (isStream(input)) {
1616
+ input.pipe(spawned.stdin);
1617
+ } else {
1618
+ spawned.stdin.end(input);
1619
+ }
1620
+ };
1621
+ var makeAllStream = (spawned, { all }) => {
1622
+ if (!all || !spawned.stdout && !spawned.stderr) {
1623
+ return;
1624
+ }
1625
+ const mixed = mergeStream();
1626
+ if (spawned.stdout) {
1627
+ mixed.add(spawned.stdout);
1628
+ }
1629
+ if (spawned.stderr) {
1630
+ mixed.add(spawned.stderr);
1631
+ }
1632
+ return mixed;
1633
+ };
1634
+ var getBufferedData = async (stream, streamPromise) => {
1635
+ if (!stream) {
1636
+ return;
1637
+ }
1638
+ stream.destroy();
1639
+ try {
1640
+ return await streamPromise;
1641
+ } catch (error) {
1642
+ return error.bufferedData;
1643
+ }
1644
+ };
1645
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1646
+ if (!stream || !buffer) {
1647
+ return;
1648
+ }
1649
+ if (encoding) {
1650
+ return getStream(stream, { encoding, maxBuffer });
1651
+ }
1652
+ return getStream.buffer(stream, { maxBuffer });
1653
+ };
1654
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1655
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1656
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1657
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1658
+ try {
1659
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1660
+ } catch (error) {
1661
+ return Promise.all([
1662
+ { error, signal: error.signal, timedOut: error.timedOut },
1663
+ getBufferedData(stdout, stdoutPromise),
1664
+ getBufferedData(stderr, stderrPromise),
1665
+ getBufferedData(all, allPromise)
1666
+ ]);
1667
+ }
1668
+ };
1669
+ var validateInputSync = ({ input }) => {
1670
+ if (isStream(input)) {
1671
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1672
+ }
1673
+ };
1674
+ module.exports = {
1675
+ handleInput,
1676
+ makeAllStream,
1677
+ getSpawnedResult,
1678
+ validateInputSync
1679
+ };
1680
+ }
1681
+ });
1682
+
1683
+ // ../node_modules/shell-env/node_modules/execa/lib/promise.js
1684
+ var require_promise = __commonJS({
1685
+ "../node_modules/shell-env/node_modules/execa/lib/promise.js"(exports, module) {
1686
+ "use strict";
1687
+ var nativePromisePrototype = (async () => {
1688
+ })().constructor.prototype;
1689
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1690
+ property,
1691
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1692
+ ]);
1693
+ var mergePromise = (spawned, promise) => {
1694
+ for (const [property, descriptor] of descriptors) {
1695
+ const value = typeof promise === "function" ? (...args2) => Reflect.apply(descriptor.value, promise(), args2) : descriptor.value.bind(promise);
1696
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1697
+ }
1698
+ return spawned;
1699
+ };
1700
+ var getSpawnedPromise = (spawned) => {
1701
+ return new Promise((resolve, reject) => {
1702
+ spawned.on("exit", (exitCode, signal) => {
1703
+ resolve({ exitCode, signal });
1704
+ });
1705
+ spawned.on("error", (error) => {
1706
+ reject(error);
1707
+ });
1708
+ if (spawned.stdin) {
1709
+ spawned.stdin.on("error", (error) => {
1710
+ reject(error);
1711
+ });
1712
+ }
1713
+ });
1714
+ };
1715
+ module.exports = {
1716
+ mergePromise,
1717
+ getSpawnedPromise
1718
+ };
1719
+ }
1720
+ });
1721
+
1722
+ // ../node_modules/shell-env/node_modules/execa/lib/command.js
1723
+ var require_command = __commonJS({
1724
+ "../node_modules/shell-env/node_modules/execa/lib/command.js"(exports, module) {
1725
+ "use strict";
1726
+ var normalizeArgs = (file, args2 = []) => {
1727
+ if (!Array.isArray(args2)) {
1728
+ return [file];
1729
+ }
1730
+ return [file, ...args2];
1731
+ };
1732
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1733
+ var DOUBLE_QUOTES_REGEXP = /"/g;
1734
+ var escapeArg = (arg) => {
1735
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1736
+ return arg;
1737
+ }
1738
+ return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
1739
+ };
1740
+ var joinCommand = (file, args2) => {
1741
+ return normalizeArgs(file, args2).join(" ");
1742
+ };
1743
+ var getEscapedCommand = (file, args2) => {
1744
+ return normalizeArgs(file, args2).map((arg) => escapeArg(arg)).join(" ");
1745
+ };
1746
+ var SPACES_REGEXP = / +/g;
1747
+ var parseCommand = (command) => {
1748
+ const tokens = [];
1749
+ for (const token of command.trim().split(SPACES_REGEXP)) {
1750
+ const previousToken = tokens[tokens.length - 1];
1751
+ if (previousToken && previousToken.endsWith("\\")) {
1752
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
1753
+ } else {
1754
+ tokens.push(token);
1755
+ }
1756
+ }
1757
+ return tokens;
1758
+ };
1759
+ module.exports = {
1760
+ joinCommand,
1761
+ getEscapedCommand,
1762
+ parseCommand
1763
+ };
1764
+ }
1765
+ });
1766
+
1767
+ // ../node_modules/shell-env/node_modules/execa/index.js
1768
+ var require_execa = __commonJS({
1769
+ "../node_modules/shell-env/node_modules/execa/index.js"(exports, module) {
1770
+ "use strict";
1771
+ var path = __require("path");
1772
+ var childProcess = __require("child_process");
1773
+ var crossSpawn = require_cross_spawn();
1774
+ var stripFinalNewline = require_strip_final_newline();
1775
+ var npmRunPath = require_npm_run_path();
1776
+ var onetime = require_onetime();
1777
+ var makeError = require_error();
1778
+ var normalizeStdio = require_stdio();
1779
+ var { spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler } = require_kill();
1780
+ var { handleInput, getSpawnedResult, makeAllStream, validateInputSync } = require_stream();
1781
+ var { mergePromise, getSpawnedPromise } = require_promise();
1782
+ var { joinCommand, parseCommand, getEscapedCommand } = require_command();
1783
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1784
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1785
+ const env2 = extendEnv ? { ...process.env, ...envOption } : envOption;
1786
+ if (preferLocal) {
1787
+ return npmRunPath.env({ env: env2, cwd: localDir, execPath });
1788
+ }
1789
+ return env2;
1790
+ };
1791
+ var handleArguments = (file, args2, options = {}) => {
1792
+ const parsed = crossSpawn._parse(file, args2, options);
1793
+ file = parsed.command;
1794
+ args2 = parsed.args;
1795
+ options = parsed.options;
1796
+ options = {
1797
+ maxBuffer: DEFAULT_MAX_BUFFER,
1798
+ buffer: true,
1799
+ stripFinalNewline: true,
1800
+ extendEnv: true,
1801
+ preferLocal: false,
1802
+ localDir: options.cwd || process.cwd(),
1803
+ execPath: process.execPath,
1804
+ encoding: "utf8",
1805
+ reject: true,
1806
+ cleanup: true,
1807
+ all: false,
1808
+ windowsHide: true,
1809
+ ...options
1810
+ };
1811
+ options.env = getEnv(options);
1812
+ options.stdio = normalizeStdio(options);
1813
+ if (process.platform === "win32" && path.basename(file, ".exe") === "cmd") {
1814
+ args2.unshift("/q");
1815
+ }
1816
+ return { file, args: args2, options, parsed };
1817
+ };
1818
+ var handleOutput = (options, value, error) => {
1819
+ if (typeof value !== "string" && !Buffer.isBuffer(value)) {
1820
+ return error === void 0 ? void 0 : "";
1821
+ }
1822
+ if (options.stripFinalNewline) {
1823
+ return stripFinalNewline(value);
1824
+ }
1825
+ return value;
1826
+ };
1827
+ var execa2 = (file, args2, options) => {
1828
+ const parsed = handleArguments(file, args2, options);
1829
+ const command = joinCommand(file, args2);
1830
+ const escapedCommand = getEscapedCommand(file, args2);
1831
+ validateTimeout(parsed.options);
1832
+ let spawned;
1833
+ try {
1834
+ spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
1835
+ } catch (error) {
1836
+ const dummySpawned = new childProcess.ChildProcess();
1837
+ const errorPromise = Promise.reject(makeError({
1838
+ error,
1839
+ stdout: "",
1840
+ stderr: "",
1841
+ all: "",
1842
+ command,
1843
+ escapedCommand,
1844
+ parsed,
1845
+ timedOut: false,
1846
+ isCanceled: false,
1847
+ killed: false
1848
+ }));
1849
+ return mergePromise(dummySpawned, errorPromise);
1850
+ }
1851
+ const spawnedPromise = getSpawnedPromise(spawned);
1852
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1853
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1854
+ const context = { isCanceled: false };
1855
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1856
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
1857
+ const handlePromise = async () => {
1858
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1859
+ const stdout = handleOutput(parsed.options, stdoutResult);
1860
+ const stderr = handleOutput(parsed.options, stderrResult);
1861
+ const all = handleOutput(parsed.options, allResult);
1862
+ if (error || exitCode !== 0 || signal !== null) {
1863
+ const returnedError = makeError({
1864
+ error,
1865
+ exitCode,
1866
+ signal,
1867
+ stdout,
1868
+ stderr,
1869
+ all,
1870
+ command,
1871
+ escapedCommand,
1872
+ parsed,
1873
+ timedOut,
1874
+ isCanceled: context.isCanceled,
1875
+ killed: spawned.killed
1876
+ });
1877
+ if (!parsed.options.reject) {
1878
+ return returnedError;
1879
+ }
1880
+ throw returnedError;
1881
+ }
1882
+ return {
1883
+ command,
1884
+ escapedCommand,
1885
+ exitCode: 0,
1886
+ stdout,
1887
+ stderr,
1888
+ all,
1889
+ failed: false,
1890
+ timedOut: false,
1891
+ isCanceled: false,
1892
+ killed: false
1893
+ };
1894
+ };
1895
+ const handlePromiseOnce = onetime(handlePromise);
1896
+ handleInput(spawned, parsed.options.input);
1897
+ spawned.all = makeAllStream(spawned, parsed.options);
1898
+ return mergePromise(spawned, handlePromiseOnce);
1899
+ };
1900
+ module.exports = execa2;
1901
+ module.exports.sync = (file, args2, options) => {
1902
+ const parsed = handleArguments(file, args2, options);
1903
+ const command = joinCommand(file, args2);
1904
+ const escapedCommand = getEscapedCommand(file, args2);
1905
+ validateInputSync(parsed.options);
1906
+ let result;
1907
+ try {
1908
+ result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
1909
+ } catch (error) {
1910
+ throw makeError({
1911
+ error,
1912
+ stdout: "",
1913
+ stderr: "",
1914
+ all: "",
1915
+ command,
1916
+ escapedCommand,
1917
+ parsed,
1918
+ timedOut: false,
1919
+ isCanceled: false,
1920
+ killed: false
1921
+ });
1922
+ }
1923
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
1924
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
1925
+ if (result.error || result.status !== 0 || result.signal !== null) {
1926
+ const error = makeError({
1927
+ stdout,
1928
+ stderr,
1929
+ error: result.error,
1930
+ signal: result.signal,
1931
+ exitCode: result.status,
1932
+ command,
1933
+ escapedCommand,
1934
+ parsed,
1935
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
1936
+ isCanceled: false,
1937
+ killed: result.signal !== null
1938
+ });
1939
+ if (!parsed.options.reject) {
1940
+ return error;
1941
+ }
1942
+ throw error;
1943
+ }
1944
+ return {
1945
+ command,
1946
+ escapedCommand,
1947
+ exitCode: 0,
1948
+ stdout,
1949
+ stderr,
1950
+ failed: false,
1951
+ timedOut: false,
1952
+ isCanceled: false,
1953
+ killed: false
1954
+ };
1955
+ };
1956
+ module.exports.command = (command, options) => {
1957
+ const [file, ...args2] = parseCommand(command);
1958
+ return execa2(file, args2, options);
1959
+ };
1960
+ module.exports.commandSync = (command, options) => {
1961
+ const [file, ...args2] = parseCommand(command);
1962
+ return execa2.sync(file, args2, options);
1963
+ };
1964
+ module.exports.node = (scriptPath, args2, options = {}) => {
1965
+ if (args2 && !Array.isArray(args2) && typeof args2 === "object") {
1966
+ options = args2;
1967
+ args2 = [];
1968
+ }
1969
+ const stdio = normalizeStdio.node(options);
1970
+ const defaultExecArgv = process.execArgv.filter((arg) => !arg.startsWith("--inspect"));
1971
+ const {
1972
+ nodePath = process.execPath,
1973
+ nodeOptions = defaultExecArgv
1974
+ } = options;
1975
+ return execa2(
1976
+ nodePath,
1977
+ [
1978
+ ...nodeOptions,
1979
+ scriptPath,
1980
+ ...Array.isArray(args2) ? args2 : []
1981
+ ],
1982
+ {
1983
+ ...options,
1984
+ stdin: void 0,
1985
+ stdout: void 0,
1986
+ stderr: void 0,
1987
+ stdio,
1988
+ shell: false
1989
+ }
1990
+ );
1991
+ };
1992
+ }
1993
+ });
1994
+
1
1995
  // index.ts
2
1996
  import { serve } from "@hono/node-server";
1997
+
1998
+ // ../node_modules/fix-path/index.js
1999
+ import process4 from "process";
2000
+
2001
+ // ../node_modules/shell-env/index.js
2002
+ var import_execa = __toESM(require_execa(), 1);
2003
+ import process3 from "process";
2004
+
2005
+ // ../node_modules/shell-env/node_modules/ansi-regex/index.js
2006
+ function ansiRegex({ onlyFirst = false } = {}) {
2007
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
2008
+ const pattern = [
2009
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
2010
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
2011
+ ].join("|");
2012
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
2013
+ }
2014
+
2015
+ // ../node_modules/shell-env/node_modules/strip-ansi/index.js
2016
+ var regex = ansiRegex();
2017
+ function stripAnsi(string) {
2018
+ if (typeof string !== "string") {
2019
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
2020
+ }
2021
+ return string.replace(regex, "");
2022
+ }
2023
+
2024
+ // ../node_modules/default-shell/index.js
2025
+ import process2 from "process";
2026
+ import { userInfo } from "os";
2027
+ var detectDefaultShell = () => {
2028
+ const { env: env2 } = process2;
2029
+ if (process2.platform === "win32") {
2030
+ return env2.COMSPEC || "cmd.exe";
2031
+ }
2032
+ try {
2033
+ const { shell } = userInfo();
2034
+ if (shell) {
2035
+ return shell;
2036
+ }
2037
+ } catch {
2038
+ }
2039
+ if (process2.platform === "darwin") {
2040
+ return env2.SHELL || "/bin/zsh";
2041
+ }
2042
+ return env2.SHELL || "/bin/sh";
2043
+ };
2044
+ var defaultShell = detectDefaultShell();
2045
+ var default_shell_default = defaultShell;
2046
+
2047
+ // ../node_modules/shell-env/index.js
2048
+ var args = [
2049
+ "-ilc",
2050
+ 'echo -n "_SHELL_ENV_DELIMITER_"; env; echo -n "_SHELL_ENV_DELIMITER_"; exit'
2051
+ ];
2052
+ var env = {
2053
+ // Disables Oh My Zsh auto-update thing that can block the process.
2054
+ DISABLE_AUTO_UPDATE: "true"
2055
+ };
2056
+ var parseEnv = (env2) => {
2057
+ env2 = env2.split("_SHELL_ENV_DELIMITER_")[1];
2058
+ const returnValue = {};
2059
+ for (const line of stripAnsi(env2).split("\n").filter((line2) => Boolean(line2))) {
2060
+ const [key, ...values] = line.split("=");
2061
+ returnValue[key] = values.join("=");
2062
+ }
2063
+ return returnValue;
2064
+ };
2065
+ function shellEnvSync(shell) {
2066
+ if (process3.platform === "win32") {
2067
+ return process3.env;
2068
+ }
2069
+ try {
2070
+ const { stdout } = import_execa.default.sync(shell || default_shell_default, args, { env });
2071
+ return parseEnv(stdout);
2072
+ } catch (error) {
2073
+ if (shell) {
2074
+ throw error;
2075
+ } else {
2076
+ return process3.env;
2077
+ }
2078
+ }
2079
+ }
2080
+
2081
+ // ../node_modules/shell-path/index.js
2082
+ function shellPathSync() {
2083
+ const { PATH } = shellEnvSync();
2084
+ return PATH;
2085
+ }
2086
+
2087
+ // ../node_modules/fix-path/index.js
2088
+ function fixPath() {
2089
+ if (process4.platform === "win32") {
2090
+ return;
2091
+ }
2092
+ process4.env.PATH = shellPathSync() || [
2093
+ "./node_modules/.bin",
2094
+ "/.nodebrew/current/bin",
2095
+ "/usr/local/bin",
2096
+ process4.env.PATH
2097
+ ].join(":");
2098
+ }
2099
+
2100
+ // index.ts
3
2101
  import { Hono as Hono10 } from "hono";
4
2102
  import { cors } from "hono/cors";
5
2103
  import { logger } from "hono/logger";
@@ -502,7 +2600,7 @@ prompts.post("/list", async (c) => {
502
2600
  });
503
2601
  prompts.post("/get", async (c) => {
504
2602
  try {
505
- const { serverId, name, args } = await c.req.json();
2603
+ const { serverId, name, args: args2 } = await c.req.json();
506
2604
  if (!serverId) {
507
2605
  return c.json({ success: false, error: "serverId is required" }, 400);
508
2606
  }
@@ -519,7 +2617,7 @@ prompts.post("/get", async (c) => {
519
2617
  const content = await mcpJamClientManager2.getPrompt(
520
2618
  name,
521
2619
  serverId,
522
- args || {}
2620
+ args2 || {}
523
2621
  );
524
2622
  return c.json({ content });
525
2623
  } catch (error) {
@@ -565,8 +2663,8 @@ function getDefaultTemperatureByProvider(provider) {
565
2663
  var DEBUG_ENABLED = process.env.MCP_DEBUG !== "false";
566
2664
  var ELICITATION_TIMEOUT = 3e5;
567
2665
  var MAX_AGENT_STEPS = 10;
568
- var dbg = (...args) => {
569
- if (DEBUG_ENABLED) console.log("[mcp/chat]", ...args);
2666
+ var dbg = (...args2) => {
2667
+ if (DEBUG_ENABLED) console.log("[mcp/chat]", ...args2);
570
2668
  };
571
2669
  try {
572
2670
  process.setMaxListeners?.(50);
@@ -1784,9 +3882,9 @@ var MCPJamClientManager = class {
1784
3882
  const direct = parameters || {};
1785
3883
  const attempts = requiresContext ? [contextWrapped, direct] : [direct, contextWrapped];
1786
3884
  let lastError = void 0;
1787
- for (const args of attempts) {
3885
+ for (const args2 of attempts) {
1788
3886
  try {
1789
- const result = await tool.execute(args);
3887
+ const result = await tool.execute(args2);
1790
3888
  if (result && result.isError) {
1791
3889
  const errorText = result.content && result.content[0] && result.content[0].text ? result.content[0].text : "Unknown error";
1792
3890
  throw new Error(errorText);
@@ -1810,7 +3908,7 @@ var MCPJamClientManager = class {
1810
3908
  const content = await client.resources.read(resolvedServerId, uri);
1811
3909
  return { contents: content?.contents || [] };
1812
3910
  }
1813
- async getPrompt(promptName, serverId, args) {
3911
+ async getPrompt(promptName, serverId, args2) {
1814
3912
  const mappedId = this.getServerUniqueId(serverId);
1815
3913
  const resolvedServerId = mappedId || (this.mcpClients.has(serverId) ? serverId : void 0);
1816
3914
  if (!resolvedServerId) {
@@ -1821,7 +3919,7 @@ var MCPJamClientManager = class {
1821
3919
  const content = await client.prompts.get({
1822
3920
  serverName: resolvedServerId,
1823
3921
  name: promptName,
1824
- args: args || {}
3922
+ args: args2 || {}
1825
3923
  });
1826
3924
  return { content };
1827
3925
  }
@@ -1906,14 +4004,18 @@ function getMCPConfigFromEnv() {
1906
4004
  return null;
1907
4005
  }
1908
4006
  const argsString = process.env.MCP_SERVER_ARGS;
1909
- const args = argsString ? JSON.parse(argsString) : [];
4007
+ const args2 = argsString ? JSON.parse(argsString) : [];
1910
4008
  return {
1911
4009
  command,
1912
- args,
4010
+ args: args2,
1913
4011
  name: "CLI Server"
1914
4012
  // Default name for CLI-provided servers
1915
4013
  };
1916
4014
  }
4015
+ try {
4016
+ fixPath();
4017
+ } catch {
4018
+ }
1917
4019
  var app = new Hono10();
1918
4020
  var mcpJamClientManager = new MCPJamClientManager();
1919
4021
  app.use("*", async (c, next) => {