@react-grab/claude-code 0.0.80 → 0.0.82

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/server.cjs CHANGED
@@ -1,18 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var child_process = require('child_process');
3
+ var childProcess2 = require('child_process');
4
4
  var url = require('url');
5
5
  var http = require('http');
6
6
  var http2 = require('http2');
7
7
  var stream = require('stream');
8
8
  var crypto = require('crypto');
9
+ var process2 = require('process');
10
+ var buffer = require('buffer');
9
11
  var path = require('path');
12
+ var os = require('os');
13
+ var fs = require('fs');
14
+ var promises$1 = require('timers/promises');
15
+ var util$1 = require('util');
10
16
  var events = require('events');
11
17
  var readline = require('readline');
12
- var fs = require('fs');
13
18
  var promises = require('fs/promises');
14
- var os = require('os');
15
- var process$1 = require('process');
16
19
 
17
20
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
18
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -35,7 +38,11 @@ function _interopNamespace(e) {
35
38
  return Object.freeze(n);
36
39
  }
37
40
 
41
+ var childProcess2__default = /*#__PURE__*/_interopDefault(childProcess2);
38
42
  var crypto__default = /*#__PURE__*/_interopDefault(crypto);
43
+ var process2__default = /*#__PURE__*/_interopDefault(process2);
44
+ var path__default = /*#__PURE__*/_interopDefault(path);
45
+ var os__default = /*#__PURE__*/_interopDefault(os);
39
46
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
40
47
 
41
48
  var __create = Object.create;
@@ -44,7 +51,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
44
51
  var __getOwnPropNames = Object.getOwnPropertyNames;
45
52
  var __getProtoOf = Object.getPrototypeOf;
46
53
  var __hasOwnProp = Object.prototype.hasOwnProperty;
47
- var __commonJS = (cb, mod) => function __require() {
54
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
55
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
56
+ }) : x)(function(x) {
57
+ if (typeof require !== "undefined") return require.apply(this, arguments);
58
+ throw Error('Dynamic require of "' + x + '" is not supported');
59
+ });
60
+ var __commonJS = (cb, mod) => function __require2() {
48
61
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
49
62
  };
50
63
  var __copyProps = (to, from, except, desc) => {
@@ -64,6 +77,827 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
64
77
  mod
65
78
  ));
66
79
 
80
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
81
+ var require_windows = __commonJS({
82
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
83
+ module.exports = isexe;
84
+ isexe.sync = sync;
85
+ var fs2 = __require("fs");
86
+ function checkPathExt(path5, options) {
87
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
88
+ if (!pathext) {
89
+ return true;
90
+ }
91
+ pathext = pathext.split(";");
92
+ if (pathext.indexOf("") !== -1) {
93
+ return true;
94
+ }
95
+ for (var i = 0; i < pathext.length; i++) {
96
+ var p = pathext[i].toLowerCase();
97
+ if (p && path5.substr(-p.length).toLowerCase() === p) {
98
+ return true;
99
+ }
100
+ }
101
+ return false;
102
+ }
103
+ function checkStat(stat, path5, options) {
104
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
105
+ return false;
106
+ }
107
+ return checkPathExt(path5, options);
108
+ }
109
+ function isexe(path5, options, cb) {
110
+ fs2.stat(path5, function(er, stat) {
111
+ cb(er, er ? false : checkStat(stat, path5, options));
112
+ });
113
+ }
114
+ function sync(path5, options) {
115
+ return checkStat(fs2.statSync(path5), path5, options);
116
+ }
117
+ }
118
+ });
119
+
120
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
121
+ var require_mode = __commonJS({
122
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
123
+ module.exports = isexe;
124
+ isexe.sync = sync;
125
+ var fs2 = __require("fs");
126
+ function isexe(path5, options, cb) {
127
+ fs2.stat(path5, function(er, stat) {
128
+ cb(er, er ? false : checkStat(stat, options));
129
+ });
130
+ }
131
+ function sync(path5, options) {
132
+ return checkStat(fs2.statSync(path5), options);
133
+ }
134
+ function checkStat(stat, options) {
135
+ return stat.isFile() && checkMode(stat, options);
136
+ }
137
+ function checkMode(stat, options) {
138
+ var mod = stat.mode;
139
+ var uid = stat.uid;
140
+ var gid = stat.gid;
141
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
142
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
143
+ var u = parseInt("100", 8);
144
+ var g = parseInt("010", 8);
145
+ var o = parseInt("001", 8);
146
+ var ug = u | g;
147
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
148
+ return ret;
149
+ }
150
+ }
151
+ });
152
+
153
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
154
+ var require_isexe = __commonJS({
155
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
156
+ __require("fs");
157
+ var core;
158
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
159
+ core = require_windows();
160
+ } else {
161
+ core = require_mode();
162
+ }
163
+ module.exports = isexe;
164
+ isexe.sync = sync;
165
+ function isexe(path5, options, cb) {
166
+ if (typeof options === "function") {
167
+ cb = options;
168
+ options = {};
169
+ }
170
+ if (!cb) {
171
+ if (typeof Promise !== "function") {
172
+ throw new TypeError("callback not provided");
173
+ }
174
+ return new Promise(function(resolve, reject) {
175
+ isexe(path5, options || {}, function(er, is) {
176
+ if (er) {
177
+ reject(er);
178
+ } else {
179
+ resolve(is);
180
+ }
181
+ });
182
+ });
183
+ }
184
+ core(path5, options || {}, function(er, is) {
185
+ if (er) {
186
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
187
+ er = null;
188
+ is = false;
189
+ }
190
+ }
191
+ cb(er, is);
192
+ });
193
+ }
194
+ function sync(path5, options) {
195
+ try {
196
+ return core.sync(path5, options || {});
197
+ } catch (er) {
198
+ if (options && options.ignoreErrors || er.code === "EACCES") {
199
+ return false;
200
+ } else {
201
+ throw er;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ });
207
+
208
+ // ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
209
+ var require_which = __commonJS({
210
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
211
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
212
+ var path5 = __require("path");
213
+ var COLON = isWindows ? ";" : ":";
214
+ var isexe = require_isexe();
215
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
216
+ var getPathInfo = (cmd, opt) => {
217
+ const colon = opt.colon || COLON;
218
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
219
+ // windows always checks the cwd first
220
+ ...isWindows ? [process.cwd()] : [],
221
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
222
+ "").split(colon)
223
+ ];
224
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
225
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
226
+ if (isWindows) {
227
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
228
+ pathExt.unshift("");
229
+ }
230
+ return {
231
+ pathEnv,
232
+ pathExt,
233
+ pathExtExe
234
+ };
235
+ };
236
+ var which = (cmd, opt, cb) => {
237
+ if (typeof opt === "function") {
238
+ cb = opt;
239
+ opt = {};
240
+ }
241
+ if (!opt)
242
+ opt = {};
243
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
244
+ const found = [];
245
+ const step = (i) => new Promise((resolve, reject) => {
246
+ if (i === pathEnv.length)
247
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
248
+ const ppRaw = pathEnv[i];
249
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
250
+ const pCmd = path5.join(pathPart, cmd);
251
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
252
+ resolve(subStep(p, i, 0));
253
+ });
254
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
255
+ if (ii === pathExt.length)
256
+ return resolve(step(i + 1));
257
+ const ext = pathExt[ii];
258
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
259
+ if (!er && is) {
260
+ if (opt.all)
261
+ found.push(p + ext);
262
+ else
263
+ return resolve(p + ext);
264
+ }
265
+ return resolve(subStep(p, i, ii + 1));
266
+ });
267
+ });
268
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
269
+ };
270
+ var whichSync = (cmd, opt) => {
271
+ opt = opt || {};
272
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
273
+ const found = [];
274
+ for (let i = 0; i < pathEnv.length; i++) {
275
+ const ppRaw = pathEnv[i];
276
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
277
+ const pCmd = path5.join(pathPart, cmd);
278
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
279
+ for (let j = 0; j < pathExt.length; j++) {
280
+ const cur = p + pathExt[j];
281
+ try {
282
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
283
+ if (is) {
284
+ if (opt.all)
285
+ found.push(cur);
286
+ else
287
+ return cur;
288
+ }
289
+ } catch (ex) {
290
+ }
291
+ }
292
+ }
293
+ if (opt.all && found.length)
294
+ return found;
295
+ if (opt.nothrow)
296
+ return null;
297
+ throw getNotFoundError(cmd);
298
+ };
299
+ module.exports = which;
300
+ which.sync = whichSync;
301
+ }
302
+ });
303
+
304
+ // ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
305
+ var require_path_key = __commonJS({
306
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
307
+ var pathKey2 = (options = {}) => {
308
+ const environment = options.env || process.env;
309
+ const platform = options.platform || process.platform;
310
+ if (platform !== "win32") {
311
+ return "PATH";
312
+ }
313
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
314
+ };
315
+ module.exports = pathKey2;
316
+ module.exports.default = pathKey2;
317
+ }
318
+ });
319
+
320
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
321
+ var require_resolveCommand = __commonJS({
322
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
323
+ var path5 = __require("path");
324
+ var which = require_which();
325
+ var getPathKey = require_path_key();
326
+ function resolveCommandAttempt(parsed, withoutPathExt) {
327
+ const env = parsed.options.env || process.env;
328
+ const cwd2 = process.cwd();
329
+ const hasCustomCwd = parsed.options.cwd != null;
330
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
331
+ if (shouldSwitchCwd) {
332
+ try {
333
+ process.chdir(parsed.options.cwd);
334
+ } catch (err) {
335
+ }
336
+ }
337
+ let resolved;
338
+ try {
339
+ resolved = which.sync(parsed.command, {
340
+ path: env[getPathKey({ env })],
341
+ pathExt: withoutPathExt ? path5.delimiter : void 0
342
+ });
343
+ } catch (e) {
344
+ } finally {
345
+ if (shouldSwitchCwd) {
346
+ process.chdir(cwd2);
347
+ }
348
+ }
349
+ if (resolved) {
350
+ resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
351
+ }
352
+ return resolved;
353
+ }
354
+ function resolveCommand(parsed) {
355
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
356
+ }
357
+ module.exports = resolveCommand;
358
+ }
359
+ });
360
+
361
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
362
+ var require_escape = __commonJS({
363
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
364
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
365
+ function escapeCommand(arg) {
366
+ arg = arg.replace(metaCharsRegExp, "^$1");
367
+ return arg;
368
+ }
369
+ function escapeArgument(arg, doubleEscapeMetaChars) {
370
+ arg = `${arg}`;
371
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
372
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
373
+ arg = `"${arg}"`;
374
+ arg = arg.replace(metaCharsRegExp, "^$1");
375
+ if (doubleEscapeMetaChars) {
376
+ arg = arg.replace(metaCharsRegExp, "^$1");
377
+ }
378
+ return arg;
379
+ }
380
+ module.exports.command = escapeCommand;
381
+ module.exports.argument = escapeArgument;
382
+ }
383
+ });
384
+
385
+ // ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
386
+ var require_shebang_regex = __commonJS({
387
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
388
+ module.exports = /^#!(.*)/;
389
+ }
390
+ });
391
+
392
+ // ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
393
+ var require_shebang_command = __commonJS({
394
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
395
+ var shebangRegex = require_shebang_regex();
396
+ module.exports = (string = "") => {
397
+ const match2 = string.match(shebangRegex);
398
+ if (!match2) {
399
+ return null;
400
+ }
401
+ const [path5, argument] = match2[0].replace(/#! ?/, "").split(" ");
402
+ const binary = path5.split("/").pop();
403
+ if (binary === "env") {
404
+ return argument;
405
+ }
406
+ return argument ? `${binary} ${argument}` : binary;
407
+ };
408
+ }
409
+ });
410
+
411
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
412
+ var require_readShebang = __commonJS({
413
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
414
+ var fs2 = __require("fs");
415
+ var shebangCommand = require_shebang_command();
416
+ function readShebang(command) {
417
+ const size = 150;
418
+ const buffer = Buffer.alloc(size);
419
+ let fd;
420
+ try {
421
+ fd = fs2.openSync(command, "r");
422
+ fs2.readSync(fd, buffer, 0, size, 0);
423
+ fs2.closeSync(fd);
424
+ } catch (e) {
425
+ }
426
+ return shebangCommand(buffer.toString());
427
+ }
428
+ module.exports = readShebang;
429
+ }
430
+ });
431
+
432
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
433
+ var require_parse = __commonJS({
434
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
435
+ var path5 = __require("path");
436
+ var resolveCommand = require_resolveCommand();
437
+ var escape = require_escape();
438
+ var readShebang = require_readShebang();
439
+ var isWin = process.platform === "win32";
440
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
441
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
442
+ function detectShebang(parsed) {
443
+ parsed.file = resolveCommand(parsed);
444
+ const shebang = parsed.file && readShebang(parsed.file);
445
+ if (shebang) {
446
+ parsed.args.unshift(parsed.file);
447
+ parsed.command = shebang;
448
+ return resolveCommand(parsed);
449
+ }
450
+ return parsed.file;
451
+ }
452
+ function parseNonShell(parsed) {
453
+ if (!isWin) {
454
+ return parsed;
455
+ }
456
+ const commandFile = detectShebang(parsed);
457
+ const needsShell = !isExecutableRegExp.test(commandFile);
458
+ if (parsed.options.forceShell || needsShell) {
459
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
460
+ parsed.command = path5.normalize(parsed.command);
461
+ parsed.command = escape.command(parsed.command);
462
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
463
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
464
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
465
+ parsed.command = process.env.comspec || "cmd.exe";
466
+ parsed.options.windowsVerbatimArguments = true;
467
+ }
468
+ return parsed;
469
+ }
470
+ function parse(command, args, options) {
471
+ if (args && !Array.isArray(args)) {
472
+ options = args;
473
+ args = null;
474
+ }
475
+ args = args ? args.slice(0) : [];
476
+ options = Object.assign({}, options);
477
+ const parsed = {
478
+ command,
479
+ args,
480
+ options,
481
+ file: void 0,
482
+ original: {
483
+ command,
484
+ args
485
+ }
486
+ };
487
+ return options.shell ? parsed : parseNonShell(parsed);
488
+ }
489
+ module.exports = parse;
490
+ }
491
+ });
492
+
493
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
494
+ var require_enoent = __commonJS({
495
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
496
+ var isWin = process.platform === "win32";
497
+ function notFoundError(original, syscall) {
498
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
499
+ code: "ENOENT",
500
+ errno: "ENOENT",
501
+ syscall: `${syscall} ${original.command}`,
502
+ path: original.command,
503
+ spawnargs: original.args
504
+ });
505
+ }
506
+ function hookChildProcess(cp, parsed) {
507
+ if (!isWin) {
508
+ return;
509
+ }
510
+ const originalEmit = cp.emit;
511
+ cp.emit = function(name, arg1) {
512
+ if (name === "exit") {
513
+ const err = verifyENOENT(arg1, parsed);
514
+ if (err) {
515
+ return originalEmit.call(cp, "error", err);
516
+ }
517
+ }
518
+ return originalEmit.apply(cp, arguments);
519
+ };
520
+ }
521
+ function verifyENOENT(status, parsed) {
522
+ if (isWin && status === 1 && !parsed.file) {
523
+ return notFoundError(parsed.original, "spawn");
524
+ }
525
+ return null;
526
+ }
527
+ function verifyENOENTSync(status, parsed) {
528
+ if (isWin && status === 1 && !parsed.file) {
529
+ return notFoundError(parsed.original, "spawnSync");
530
+ }
531
+ return null;
532
+ }
533
+ module.exports = {
534
+ hookChildProcess,
535
+ verifyENOENT,
536
+ verifyENOENTSync,
537
+ notFoundError
538
+ };
539
+ }
540
+ });
541
+
542
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
543
+ var require_cross_spawn = __commonJS({
544
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
545
+ var cp = __require("child_process");
546
+ var parse = require_parse();
547
+ var enoent = require_enoent();
548
+ function spawn2(command, args, options) {
549
+ const parsed = parse(command, args, options);
550
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
551
+ enoent.hookChildProcess(spawned, parsed);
552
+ return spawned;
553
+ }
554
+ function spawnSync(command, args, options) {
555
+ const parsed = parse(command, args, options);
556
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
557
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
558
+ return result;
559
+ }
560
+ module.exports = spawn2;
561
+ module.exports.spawn = spawn2;
562
+ module.exports.sync = spawnSync;
563
+ module.exports._parse = parse;
564
+ module.exports._enoent = enoent;
565
+ }
566
+ });
567
+
568
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
569
+ var require_signals = __commonJS({
570
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
571
+ module.exports = [
572
+ "SIGABRT",
573
+ "SIGALRM",
574
+ "SIGHUP",
575
+ "SIGINT",
576
+ "SIGTERM"
577
+ ];
578
+ if (process.platform !== "win32") {
579
+ module.exports.push(
580
+ "SIGVTALRM",
581
+ "SIGXCPU",
582
+ "SIGXFSZ",
583
+ "SIGUSR2",
584
+ "SIGTRAP",
585
+ "SIGSYS",
586
+ "SIGQUIT",
587
+ "SIGIOT"
588
+ // should detect profiler and enable/disable accordingly.
589
+ // see #21
590
+ // 'SIGPROF'
591
+ );
592
+ }
593
+ if (process.platform === "linux") {
594
+ module.exports.push(
595
+ "SIGIO",
596
+ "SIGPOLL",
597
+ "SIGPWR",
598
+ "SIGSTKFLT",
599
+ "SIGUNUSED"
600
+ );
601
+ }
602
+ }
603
+ });
604
+
605
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
606
+ var require_signal_exit = __commonJS({
607
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
608
+ var process13 = global.process;
609
+ var processOk2 = function(process14) {
610
+ return process14 && typeof process14 === "object" && typeof process14.removeListener === "function" && typeof process14.emit === "function" && typeof process14.reallyExit === "function" && typeof process14.listeners === "function" && typeof process14.kill === "function" && typeof process14.pid === "number" && typeof process14.on === "function";
611
+ };
612
+ if (!processOk2(process13)) {
613
+ module.exports = function() {
614
+ return function() {
615
+ };
616
+ };
617
+ } else {
618
+ assert = __require("assert");
619
+ signals2 = require_signals();
620
+ isWin = /^win/i.test(process13.platform);
621
+ EE = __require("events");
622
+ if (typeof EE !== "function") {
623
+ EE = EE.EventEmitter;
624
+ }
625
+ if (process13.__signal_exit_emitter__) {
626
+ emitter = process13.__signal_exit_emitter__;
627
+ } else {
628
+ emitter = process13.__signal_exit_emitter__ = new EE();
629
+ emitter.count = 0;
630
+ emitter.emitted = {};
631
+ }
632
+ if (!emitter.infinite) {
633
+ emitter.setMaxListeners(Infinity);
634
+ emitter.infinite = true;
635
+ }
636
+ module.exports = function(cb, opts) {
637
+ if (!processOk2(global.process)) {
638
+ return function() {
639
+ };
640
+ }
641
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
642
+ if (loaded === false) {
643
+ load2();
644
+ }
645
+ var ev = "exit";
646
+ if (opts && opts.alwaysLast) {
647
+ ev = "afterexit";
648
+ }
649
+ var remove = function() {
650
+ emitter.removeListener(ev, cb);
651
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
652
+ unload2();
653
+ }
654
+ };
655
+ emitter.on(ev, cb);
656
+ return remove;
657
+ };
658
+ unload2 = function unload3() {
659
+ if (!loaded || !processOk2(global.process)) {
660
+ return;
661
+ }
662
+ loaded = false;
663
+ signals2.forEach(function(sig) {
664
+ try {
665
+ process13.removeListener(sig, sigListeners[sig]);
666
+ } catch (er) {
667
+ }
668
+ });
669
+ process13.emit = originalProcessEmit;
670
+ process13.reallyExit = originalProcessReallyExit;
671
+ emitter.count -= 1;
672
+ };
673
+ module.exports.unload = unload2;
674
+ emit = function emit2(event, code, signal) {
675
+ if (emitter.emitted[event]) {
676
+ return;
677
+ }
678
+ emitter.emitted[event] = true;
679
+ emitter.emit(event, code, signal);
680
+ };
681
+ sigListeners = {};
682
+ signals2.forEach(function(sig) {
683
+ sigListeners[sig] = function listener() {
684
+ if (!processOk2(global.process)) {
685
+ return;
686
+ }
687
+ var listeners = process13.listeners(sig);
688
+ if (listeners.length === emitter.count) {
689
+ unload2();
690
+ emit("exit", null, sig);
691
+ emit("afterexit", null, sig);
692
+ if (isWin && sig === "SIGHUP") {
693
+ sig = "SIGINT";
694
+ }
695
+ process13.kill(process13.pid, sig);
696
+ }
697
+ };
698
+ });
699
+ module.exports.signals = function() {
700
+ return signals2;
701
+ };
702
+ loaded = false;
703
+ load2 = function load3() {
704
+ if (loaded || !processOk2(global.process)) {
705
+ return;
706
+ }
707
+ loaded = true;
708
+ emitter.count += 1;
709
+ signals2 = signals2.filter(function(sig) {
710
+ try {
711
+ process13.on(sig, sigListeners[sig]);
712
+ return true;
713
+ } catch (er) {
714
+ return false;
715
+ }
716
+ });
717
+ process13.emit = processEmit;
718
+ process13.reallyExit = processReallyExit;
719
+ };
720
+ module.exports.load = load2;
721
+ originalProcessReallyExit = process13.reallyExit;
722
+ processReallyExit = function processReallyExit2(code) {
723
+ if (!processOk2(global.process)) {
724
+ return;
725
+ }
726
+ process13.exitCode = code || /* istanbul ignore next */
727
+ 0;
728
+ emit("exit", process13.exitCode, null);
729
+ emit("afterexit", process13.exitCode, null);
730
+ originalProcessReallyExit.call(process13, process13.exitCode);
731
+ };
732
+ originalProcessEmit = process13.emit;
733
+ processEmit = function processEmit2(ev, arg) {
734
+ if (ev === "exit" && processOk2(global.process)) {
735
+ if (arg !== void 0) {
736
+ process13.exitCode = arg;
737
+ }
738
+ var ret = originalProcessEmit.apply(this, arguments);
739
+ emit("exit", process13.exitCode, null);
740
+ emit("afterexit", process13.exitCode, null);
741
+ return ret;
742
+ } else {
743
+ return originalProcessEmit.apply(this, arguments);
744
+ }
745
+ };
746
+ }
747
+ var assert;
748
+ var signals2;
749
+ var isWin;
750
+ var EE;
751
+ var emitter;
752
+ var unload2;
753
+ var emit;
754
+ var sigListeners;
755
+ var loaded;
756
+ var load2;
757
+ var originalProcessReallyExit;
758
+ var processReallyExit;
759
+ var originalProcessEmit;
760
+ var processEmit;
761
+ }
762
+ });
763
+
764
+ // ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js
765
+ var require_buffer_stream = __commonJS({
766
+ "../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js"(exports, module) {
767
+ var { PassThrough: PassThroughStream } = __require("stream");
768
+ module.exports = (options) => {
769
+ options = { ...options };
770
+ const { array } = options;
771
+ let { encoding } = options;
772
+ const isBuffer = encoding === "buffer";
773
+ let objectMode = false;
774
+ if (array) {
775
+ objectMode = !(encoding || isBuffer);
776
+ } else {
777
+ encoding = encoding || "utf8";
778
+ }
779
+ if (isBuffer) {
780
+ encoding = null;
781
+ }
782
+ const stream2 = new PassThroughStream({ objectMode });
783
+ if (encoding) {
784
+ stream2.setEncoding(encoding);
785
+ }
786
+ let length = 0;
787
+ const chunks = [];
788
+ stream2.on("data", (chunk) => {
789
+ chunks.push(chunk);
790
+ if (objectMode) {
791
+ length = chunks.length;
792
+ } else {
793
+ length += chunk.length;
794
+ }
795
+ });
796
+ stream2.getBufferedValue = () => {
797
+ if (array) {
798
+ return chunks;
799
+ }
800
+ return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
801
+ };
802
+ stream2.getBufferedLength = () => length;
803
+ return stream2;
804
+ };
805
+ }
806
+ });
807
+
808
+ // ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js
809
+ var require_get_stream = __commonJS({
810
+ "../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js"(exports, module) {
811
+ var { constants: BufferConstants } = __require("buffer");
812
+ var stream2 = __require("stream");
813
+ var { promisify: promisify2 } = __require("util");
814
+ var bufferStream = require_buffer_stream();
815
+ var streamPipelinePromisified = promisify2(stream2.pipeline);
816
+ var MaxBufferError2 = class extends Error {
817
+ constructor() {
818
+ super("maxBuffer exceeded");
819
+ this.name = "MaxBufferError";
820
+ }
821
+ };
822
+ async function getStream2(inputStream, options) {
823
+ if (!inputStream) {
824
+ throw new Error("Expected a stream");
825
+ }
826
+ options = {
827
+ maxBuffer: Infinity,
828
+ ...options
829
+ };
830
+ const { maxBuffer } = options;
831
+ const stream3 = bufferStream(options);
832
+ await new Promise((resolve, reject) => {
833
+ const rejectPromise = (error) => {
834
+ if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
835
+ error.bufferedData = stream3.getBufferedValue();
836
+ }
837
+ reject(error);
838
+ };
839
+ (async () => {
840
+ try {
841
+ await streamPipelinePromisified(inputStream, stream3);
842
+ resolve();
843
+ } catch (error) {
844
+ rejectPromise(error);
845
+ }
846
+ })();
847
+ stream3.on("data", () => {
848
+ if (stream3.getBufferedLength() > maxBuffer) {
849
+ rejectPromise(new MaxBufferError2());
850
+ }
851
+ });
852
+ });
853
+ return stream3.getBufferedValue();
854
+ }
855
+ module.exports = getStream2;
856
+ module.exports.buffer = (stream3, options) => getStream2(stream3, { ...options, encoding: "buffer" });
857
+ module.exports.array = (stream3, options) => getStream2(stream3, { ...options, array: true });
858
+ module.exports.MaxBufferError = MaxBufferError2;
859
+ }
860
+ });
861
+
862
+ // ../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
863
+ var require_merge_stream = __commonJS({
864
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module) {
865
+ var { PassThrough } = __require("stream");
866
+ module.exports = function() {
867
+ var sources = [];
868
+ var output = new PassThrough({ objectMode: true });
869
+ output.setMaxListeners(0);
870
+ output.add = add;
871
+ output.isEmpty = isEmpty;
872
+ output.on("unpipe", remove);
873
+ Array.prototype.slice.call(arguments).forEach(add);
874
+ return output;
875
+ function add(source) {
876
+ if (Array.isArray(source)) {
877
+ source.forEach(add);
878
+ return this;
879
+ }
880
+ sources.push(source);
881
+ source.once("end", remove.bind(null, source));
882
+ source.once("error", output.emit.bind(output, "error"));
883
+ source.pipe(output, { end: false });
884
+ return this;
885
+ }
886
+ function isEmpty() {
887
+ return sources.length == 0;
888
+ }
889
+ function remove(source) {
890
+ sources = sources.filter(function(it) {
891
+ return it !== source;
892
+ });
893
+ if (!sources.length && output.readable) {
894
+ output.end();
895
+ }
896
+ }
897
+ };
898
+ }
899
+ });
900
+
67
901
  // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
68
902
  var require_picocolors = __commonJS({
69
903
  "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
@@ -252,26 +1086,26 @@ var handleParsingNestedValues = (form, key, value) => {
252
1086
  };
253
1087
 
254
1088
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/utils/url.js
255
- var splitPath = (path) => {
256
- const paths = path.split("/");
1089
+ var splitPath = (path5) => {
1090
+ const paths = path5.split("/");
257
1091
  if (paths[0] === "") {
258
1092
  paths.shift();
259
1093
  }
260
1094
  return paths;
261
1095
  };
262
1096
  var splitRoutingPath = (routePath) => {
263
- const { groups, path } = extractGroupsFromPath(routePath);
264
- const paths = splitPath(path);
1097
+ const { groups, path: path5 } = extractGroupsFromPath(routePath);
1098
+ const paths = splitPath(path5);
265
1099
  return replaceGroupMarks(paths, groups);
266
1100
  };
267
- var extractGroupsFromPath = (path) => {
1101
+ var extractGroupsFromPath = (path5) => {
268
1102
  const groups = [];
269
- path = path.replace(/\{[^}]+\}/g, (match2, index) => {
1103
+ path5 = path5.replace(/\{[^}]+\}/g, (match2, index) => {
270
1104
  const mark = `@${index}`;
271
1105
  groups.push([mark, match2]);
272
1106
  return mark;
273
1107
  });
274
- return { groups, path };
1108
+ return { groups, path: path5 };
275
1109
  };
276
1110
  var replaceGroupMarks = (paths, groups) => {
277
1111
  for (let i = groups.length - 1; i >= 0; i--) {
@@ -326,8 +1160,8 @@ var getPath = (request) => {
326
1160
  const charCode = url.charCodeAt(i);
327
1161
  if (charCode === 37) {
328
1162
  const queryIndex = url.indexOf("?", i);
329
- const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
330
- return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
1163
+ const path5 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
1164
+ return tryDecodeURI(path5.includes("%25") ? path5.replace(/%25/g, "%2525") : path5);
331
1165
  } else if (charCode === 63) {
332
1166
  break;
333
1167
  }
@@ -344,11 +1178,11 @@ var mergePath = (base, sub, ...rest) => {
344
1178
  }
345
1179
  return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
346
1180
  };
347
- var checkOptionalParameter = (path) => {
348
- if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(":")) {
1181
+ var checkOptionalParameter = (path5) => {
1182
+ if (path5.charCodeAt(path5.length - 1) !== 63 || !path5.includes(":")) {
349
1183
  return null;
350
1184
  }
351
- const segments = path.split("/");
1185
+ const segments = path5.split("/");
352
1186
  const results = [];
353
1187
  let basePath = "";
354
1188
  segments.forEach((segment) => {
@@ -461,9 +1295,9 @@ var HonoRequest = class {
461
1295
  routeIndex = 0;
462
1296
  path;
463
1297
  bodyCache = {};
464
- constructor(request, path = "/", matchResult = [[]]) {
1298
+ constructor(request, path5 = "/", matchResult = [[]]) {
465
1299
  this.raw = request;
466
- this.path = path;
1300
+ this.path = path5;
467
1301
  this.#matchResult = matchResult;
468
1302
  this.#validatedData = {};
469
1303
  }
@@ -824,8 +1658,8 @@ var Hono = class {
824
1658
  return this;
825
1659
  };
826
1660
  });
827
- this.on = (method, path, ...handlers) => {
828
- for (const p of [path].flat()) {
1661
+ this.on = (method, path5, ...handlers) => {
1662
+ for (const p of [path5].flat()) {
829
1663
  this.#path = p;
830
1664
  for (const m of [method].flat()) {
831
1665
  handlers.map((handler) => {
@@ -863,8 +1697,8 @@ var Hono = class {
863
1697
  }
864
1698
  #notFoundHandler = notFoundHandler;
865
1699
  errorHandler = errorHandler;
866
- route(path, app) {
867
- const subApp = this.basePath(path);
1700
+ route(path5, app) {
1701
+ const subApp = this.basePath(path5);
868
1702
  app.routes.map((r) => {
869
1703
  let handler;
870
1704
  if (app.errorHandler === errorHandler) {
@@ -877,9 +1711,9 @@ var Hono = class {
877
1711
  });
878
1712
  return this;
879
1713
  }
880
- basePath(path) {
1714
+ basePath(path5) {
881
1715
  const subApp = this.#clone();
882
- subApp._basePath = mergePath(this._basePath, path);
1716
+ subApp._basePath = mergePath(this._basePath, path5);
883
1717
  return subApp;
884
1718
  }
885
1719
  onError = (handler) => {
@@ -890,7 +1724,7 @@ var Hono = class {
890
1724
  this.#notFoundHandler = handler;
891
1725
  return this;
892
1726
  };
893
- mount(path, applicationHandler, options) {
1727
+ mount(path5, applicationHandler, options) {
894
1728
  let replaceRequest;
895
1729
  let optionHandler;
896
1730
  if (options) {
@@ -917,7 +1751,7 @@ var Hono = class {
917
1751
  return [c.env, executionContext];
918
1752
  };
919
1753
  replaceRequest ||= (() => {
920
- const mergedPath = mergePath(this._basePath, path);
1754
+ const mergedPath = mergePath(this._basePath, path5);
921
1755
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
922
1756
  return (request) => {
923
1757
  const url = new URL(request.url);
@@ -932,14 +1766,14 @@ var Hono = class {
932
1766
  }
933
1767
  await next();
934
1768
  };
935
- this.#addRoute(METHOD_NAME_ALL, mergePath(path, "*"), handler);
1769
+ this.#addRoute(METHOD_NAME_ALL, mergePath(path5, "*"), handler);
936
1770
  return this;
937
1771
  }
938
- #addRoute(method, path, handler) {
1772
+ #addRoute(method, path5, handler) {
939
1773
  method = method.toUpperCase();
940
- path = mergePath(this._basePath, path);
941
- const r = { basePath: this._basePath, path, method, handler };
942
- this.router.add(method, path, [handler, r]);
1774
+ path5 = mergePath(this._basePath, path5);
1775
+ const r = { basePath: this._basePath, path: path5, method, handler };
1776
+ this.router.add(method, path5, [handler, r]);
943
1777
  this.routes.push(r);
944
1778
  }
945
1779
  #handleError(err, c) {
@@ -952,10 +1786,10 @@ var Hono = class {
952
1786
  if (method === "HEAD") {
953
1787
  return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
954
1788
  }
955
- const path = this.getPath(request, { env });
956
- const matchResult = this.router.match(method, path);
1789
+ const path5 = this.getPath(request, { env });
1790
+ const matchResult = this.router.match(method, path5);
957
1791
  const c = new Context(request, {
958
- path,
1792
+ path: path5,
959
1793
  matchResult,
960
1794
  env,
961
1795
  executionCtx,
@@ -1015,15 +1849,15 @@ var Hono = class {
1015
1849
 
1016
1850
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
1017
1851
  var emptyParam = [];
1018
- function match(method, path) {
1852
+ function match(method, path5) {
1019
1853
  const matchers = this.buildAllMatchers();
1020
- const match2 = (method2, path2) => {
1854
+ const match2 = (method2, path22) => {
1021
1855
  const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
1022
- const staticMatch = matcher[2][path2];
1856
+ const staticMatch = matcher[2][path22];
1023
1857
  if (staticMatch) {
1024
1858
  return staticMatch;
1025
1859
  }
1026
- const match3 = path2.match(matcher[0]);
1860
+ const match3 = path22.match(matcher[0]);
1027
1861
  if (!match3) {
1028
1862
  return [[], emptyParam];
1029
1863
  }
@@ -1031,7 +1865,7 @@ function match(method, path) {
1031
1865
  return [matcher[1][index], match3];
1032
1866
  };
1033
1867
  this.match = match2;
1034
- return match2(method, path);
1868
+ return match2(method, path5);
1035
1869
  }
1036
1870
 
1037
1871
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/node.js
@@ -1146,12 +1980,12 @@ var Node = class {
1146
1980
  var Trie = class {
1147
1981
  #context = { varIndex: 0 };
1148
1982
  #root = new Node();
1149
- insert(path, index, pathErrorCheckOnly) {
1983
+ insert(path5, index, pathErrorCheckOnly) {
1150
1984
  const paramAssoc = [];
1151
1985
  const groups = [];
1152
1986
  for (let i = 0; ; ) {
1153
1987
  let replaced = false;
1154
- path = path.replace(/\{[^}]+\}/g, (m) => {
1988
+ path5 = path5.replace(/\{[^}]+\}/g, (m) => {
1155
1989
  const mark = `@\\${i}`;
1156
1990
  groups[i] = [mark, m];
1157
1991
  i++;
@@ -1162,7 +1996,7 @@ var Trie = class {
1162
1996
  break;
1163
1997
  }
1164
1998
  }
1165
- const tokens = path.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1999
+ const tokens = path5.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
1166
2000
  for (let i = groups.length - 1; i >= 0; i--) {
1167
2001
  const [mark] = groups[i];
1168
2002
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -1201,9 +2035,9 @@ var Trie = class {
1201
2035
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/router.js
1202
2036
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
1203
2037
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
1204
- function buildWildcardRegExp(path) {
1205
- return wildcardRegExpCache[path] ??= new RegExp(
1206
- path === "*" ? "" : `^${path.replace(
2038
+ function buildWildcardRegExp(path5) {
2039
+ return wildcardRegExpCache[path5] ??= new RegExp(
2040
+ path5 === "*" ? "" : `^${path5.replace(
1207
2041
  /\/\*$|([.\\+*[^\]$()])/g,
1208
2042
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
1209
2043
  )}$`
@@ -1225,17 +2059,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
1225
2059
  );
1226
2060
  const staticMap = /* @__PURE__ */ Object.create(null);
1227
2061
  for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
1228
- const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
2062
+ const [pathErrorCheckOnly, path5, handlers] = routesWithStaticPathFlag[i];
1229
2063
  if (pathErrorCheckOnly) {
1230
- staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
2064
+ staticMap[path5] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
1231
2065
  } else {
1232
2066
  j++;
1233
2067
  }
1234
2068
  let paramAssoc;
1235
2069
  try {
1236
- paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
2070
+ paramAssoc = trie.insert(path5, j, pathErrorCheckOnly);
1237
2071
  } catch (e) {
1238
- throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
2072
+ throw e === PATH_ERROR ? new UnsupportedPathError(path5) : e;
1239
2073
  }
1240
2074
  if (pathErrorCheckOnly) {
1241
2075
  continue;
@@ -1269,12 +2103,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
1269
2103
  }
1270
2104
  return [regexp, handlerMap, staticMap];
1271
2105
  }
1272
- function findMiddleware(middleware, path) {
2106
+ function findMiddleware(middleware, path5) {
1273
2107
  if (!middleware) {
1274
2108
  return void 0;
1275
2109
  }
1276
2110
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
1277
- if (buildWildcardRegExp(k).test(path)) {
2111
+ if (buildWildcardRegExp(k).test(path5)) {
1278
2112
  return [...middleware[k]];
1279
2113
  }
1280
2114
  }
@@ -1288,7 +2122,7 @@ var RegExpRouter = class {
1288
2122
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1289
2123
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
1290
2124
  }
1291
- add(method, path, handler) {
2125
+ add(method, path5, handler) {
1292
2126
  const middleware = this.#middleware;
1293
2127
  const routes = this.#routes;
1294
2128
  if (!middleware || !routes) {
@@ -1302,18 +2136,18 @@ var RegExpRouter = class {
1302
2136
  });
1303
2137
  });
1304
2138
  }
1305
- if (path === "/*") {
1306
- path = "*";
2139
+ if (path5 === "/*") {
2140
+ path5 = "*";
1307
2141
  }
1308
- const paramCount = (path.match(/\/:/g) || []).length;
1309
- if (/\*$/.test(path)) {
1310
- const re = buildWildcardRegExp(path);
2142
+ const paramCount = (path5.match(/\/:/g) || []).length;
2143
+ if (/\*$/.test(path5)) {
2144
+ const re = buildWildcardRegExp(path5);
1311
2145
  if (method === METHOD_NAME_ALL) {
1312
2146
  Object.keys(middleware).forEach((m) => {
1313
- middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
2147
+ middleware[m][path5] ||= findMiddleware(middleware[m], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
1314
2148
  });
1315
2149
  } else {
1316
- middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
2150
+ middleware[method][path5] ||= findMiddleware(middleware[method], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
1317
2151
  }
1318
2152
  Object.keys(middleware).forEach((m) => {
1319
2153
  if (method === METHOD_NAME_ALL || method === m) {
@@ -1331,15 +2165,15 @@ var RegExpRouter = class {
1331
2165
  });
1332
2166
  return;
1333
2167
  }
1334
- const paths = checkOptionalParameter(path) || [path];
2168
+ const paths = checkOptionalParameter(path5) || [path5];
1335
2169
  for (let i = 0, len = paths.length; i < len; i++) {
1336
- const path2 = paths[i];
2170
+ const path22 = paths[i];
1337
2171
  Object.keys(routes).forEach((m) => {
1338
2172
  if (method === METHOD_NAME_ALL || method === m) {
1339
- routes[m][path2] ||= [
1340
- ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
2173
+ routes[m][path22] ||= [
2174
+ ...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
1341
2175
  ];
1342
- routes[m][path2].push([handler, paramCount - len + i + 1]);
2176
+ routes[m][path22].push([handler, paramCount - len + i + 1]);
1343
2177
  }
1344
2178
  });
1345
2179
  }
@@ -1358,13 +2192,13 @@ var RegExpRouter = class {
1358
2192
  const routes = [];
1359
2193
  let hasOwnRoute = method === METHOD_NAME_ALL;
1360
2194
  [this.#middleware, this.#routes].forEach((r) => {
1361
- const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : [];
2195
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path5) => [path5, r[method][path5]]) : [];
1362
2196
  if (ownRoute.length !== 0) {
1363
2197
  hasOwnRoute ||= true;
1364
2198
  routes.push(...ownRoute);
1365
2199
  } else if (method !== METHOD_NAME_ALL) {
1366
2200
  routes.push(
1367
- ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]])
2201
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path5) => [path5, r[METHOD_NAME_ALL][path5]])
1368
2202
  );
1369
2203
  }
1370
2204
  });
@@ -1384,13 +2218,13 @@ var SmartRouter = class {
1384
2218
  constructor(init) {
1385
2219
  this.#routers = init.routers;
1386
2220
  }
1387
- add(method, path, handler) {
2221
+ add(method, path5, handler) {
1388
2222
  if (!this.#routes) {
1389
2223
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
1390
2224
  }
1391
- this.#routes.push([method, path, handler]);
2225
+ this.#routes.push([method, path5, handler]);
1392
2226
  }
1393
- match(method, path) {
2227
+ match(method, path5) {
1394
2228
  if (!this.#routes) {
1395
2229
  throw new Error("Fatal error");
1396
2230
  }
@@ -1405,7 +2239,7 @@ var SmartRouter = class {
1405
2239
  for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
1406
2240
  router.add(...routes[i2]);
1407
2241
  }
1408
- res = router.match(method, path);
2242
+ res = router.match(method, path5);
1409
2243
  } catch (e) {
1410
2244
  if (e instanceof UnsupportedPathError) {
1411
2245
  continue;
@@ -1449,10 +2283,10 @@ var Node2 = class {
1449
2283
  }
1450
2284
  this.#patterns = [];
1451
2285
  }
1452
- insert(method, path, handler) {
2286
+ insert(method, path5, handler) {
1453
2287
  this.#order = ++this.#order;
1454
2288
  let curNode = this;
1455
- const parts = splitRoutingPath(path);
2289
+ const parts = splitRoutingPath(path5);
1456
2290
  const possibleKeys = [];
1457
2291
  for (let i = 0, len = parts.length; i < len; i++) {
1458
2292
  const p = parts[i];
@@ -1503,12 +2337,12 @@ var Node2 = class {
1503
2337
  }
1504
2338
  return handlerSets;
1505
2339
  }
1506
- search(method, path) {
2340
+ search(method, path5) {
1507
2341
  const handlerSets = [];
1508
2342
  this.#params = emptyParams;
1509
2343
  const curNode = this;
1510
2344
  let curNodes = [curNode];
1511
- const parts = splitPath(path);
2345
+ const parts = splitPath(path5);
1512
2346
  const curNodesQueue = [];
1513
2347
  for (let i = 0, len = parts.length; i < len; i++) {
1514
2348
  const part = parts[i];
@@ -1596,18 +2430,18 @@ var TrieRouter = class {
1596
2430
  constructor() {
1597
2431
  this.#node = new Node2();
1598
2432
  }
1599
- add(method, path, handler) {
1600
- const results = checkOptionalParameter(path);
2433
+ add(method, path5, handler) {
2434
+ const results = checkOptionalParameter(path5);
1601
2435
  if (results) {
1602
2436
  for (let i = 0, len = results.length; i < len; i++) {
1603
2437
  this.#node.insert(method, results[i], handler);
1604
2438
  }
1605
2439
  return;
1606
2440
  }
1607
- this.#node.insert(method, path, handler);
2441
+ this.#node.insert(method, path5, handler);
1608
2442
  }
1609
- match(method, path) {
1610
- return this.#node.search(method, path);
2443
+ match(method, path5) {
2444
+ return this.#node.search(method, path5);
1611
2445
  }
1612
2446
  };
1613
2447
 
@@ -2141,247 +2975,2873 @@ var buildOutgoingHttpHeaders = (headers) => {
2141
2975
  if (cookies.length > 0) {
2142
2976
  res["set-cookie"] = cookies;
2143
2977
  }
2144
- res["content-type"] ??= "text/plain; charset=UTF-8";
2145
- return res;
2978
+ res["content-type"] ??= "text/plain; charset=UTF-8";
2979
+ return res;
2980
+ };
2981
+ var X_ALREADY_SENT = "x-hono-already-sent";
2982
+ var webFetch = global.fetch;
2983
+ if (typeof global.crypto === "undefined") {
2984
+ global.crypto = crypto__default.default;
2985
+ }
2986
+ global.fetch = (info, init) => {
2987
+ init = {
2988
+ // Disable compression handling so people can return the result of a fetch
2989
+ // directly in the loader without messing with the Content-Encoding header.
2990
+ compress: false,
2991
+ ...init
2992
+ };
2993
+ return webFetch(info, init);
2994
+ };
2995
+ var outgoingEnded = Symbol("outgoingEnded");
2996
+ var handleRequestError = () => new Response(null, {
2997
+ status: 400
2998
+ });
2999
+ var handleFetchError = (e) => new Response(null, {
3000
+ status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
3001
+ });
3002
+ var handleResponseError = (e, outgoing) => {
3003
+ const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
3004
+ if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
3005
+ console.info("The user aborted a request.");
3006
+ } else {
3007
+ console.error(e);
3008
+ if (!outgoing.headersSent) {
3009
+ outgoing.writeHead(500, { "Content-Type": "text/plain" });
3010
+ }
3011
+ outgoing.end(`Error: ${err.message}`);
3012
+ outgoing.destroy(err);
3013
+ }
3014
+ };
3015
+ var flushHeaders = (outgoing) => {
3016
+ if ("flushHeaders" in outgoing && outgoing.writable) {
3017
+ outgoing.flushHeaders();
3018
+ }
3019
+ };
3020
+ var responseViaCache = async (res, outgoing) => {
3021
+ let [status, body, header] = res[cacheKey];
3022
+ if (header instanceof Headers) {
3023
+ header = buildOutgoingHttpHeaders(header);
3024
+ }
3025
+ if (typeof body === "string") {
3026
+ header["Content-Length"] = Buffer.byteLength(body);
3027
+ } else if (body instanceof Uint8Array) {
3028
+ header["Content-Length"] = body.byteLength;
3029
+ } else if (body instanceof Blob) {
3030
+ header["Content-Length"] = body.size;
3031
+ }
3032
+ outgoing.writeHead(status, header);
3033
+ if (typeof body === "string" || body instanceof Uint8Array) {
3034
+ outgoing.end(body);
3035
+ } else if (body instanceof Blob) {
3036
+ outgoing.end(new Uint8Array(await body.arrayBuffer()));
3037
+ } else {
3038
+ flushHeaders(outgoing);
3039
+ await writeFromReadableStream(body, outgoing)?.catch(
3040
+ (e) => handleResponseError(e, outgoing)
3041
+ );
3042
+ }
3043
+ outgoing[outgoingEnded]?.();
3044
+ };
3045
+ var isPromise = (res) => typeof res.then === "function";
3046
+ var responseViaResponseObject = async (res, outgoing, options = {}) => {
3047
+ if (isPromise(res)) {
3048
+ if (options.errorHandler) {
3049
+ try {
3050
+ res = await res;
3051
+ } catch (err) {
3052
+ const errRes = await options.errorHandler(err);
3053
+ if (!errRes) {
3054
+ return;
3055
+ }
3056
+ res = errRes;
3057
+ }
3058
+ } else {
3059
+ res = await res.catch(handleFetchError);
3060
+ }
3061
+ }
3062
+ if (cacheKey in res) {
3063
+ return responseViaCache(res, outgoing);
3064
+ }
3065
+ const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
3066
+ if (res.body) {
3067
+ const reader = res.body.getReader();
3068
+ const values = [];
3069
+ let done = false;
3070
+ let currentReadPromise = void 0;
3071
+ if (resHeaderRecord["transfer-encoding"] !== "chunked") {
3072
+ let maxReadCount = 2;
3073
+ for (let i = 0; i < maxReadCount; i++) {
3074
+ currentReadPromise ||= reader.read();
3075
+ const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
3076
+ console.error(e);
3077
+ done = true;
3078
+ });
3079
+ if (!chunk) {
3080
+ if (i === 1) {
3081
+ await new Promise((resolve) => setTimeout(resolve));
3082
+ maxReadCount = 3;
3083
+ continue;
3084
+ }
3085
+ break;
3086
+ }
3087
+ currentReadPromise = void 0;
3088
+ if (chunk.value) {
3089
+ values.push(chunk.value);
3090
+ }
3091
+ if (chunk.done) {
3092
+ done = true;
3093
+ break;
3094
+ }
3095
+ }
3096
+ if (done && !("content-length" in resHeaderRecord)) {
3097
+ resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
3098
+ }
3099
+ }
3100
+ outgoing.writeHead(res.status, resHeaderRecord);
3101
+ values.forEach((value) => {
3102
+ outgoing.write(value);
3103
+ });
3104
+ if (done) {
3105
+ outgoing.end();
3106
+ } else {
3107
+ if (values.length === 0) {
3108
+ flushHeaders(outgoing);
3109
+ }
3110
+ await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
3111
+ }
3112
+ } else if (resHeaderRecord[X_ALREADY_SENT]) ; else {
3113
+ outgoing.writeHead(res.status, resHeaderRecord);
3114
+ outgoing.end();
3115
+ }
3116
+ outgoing[outgoingEnded]?.();
3117
+ };
3118
+ var getRequestListener = (fetchCallback, options = {}) => {
3119
+ const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
3120
+ if (options.overrideGlobalObjects !== false && global.Request !== Request2) {
3121
+ Object.defineProperty(global, "Request", {
3122
+ value: Request2
3123
+ });
3124
+ Object.defineProperty(global, "Response", {
3125
+ value: Response2
3126
+ });
3127
+ }
3128
+ return async (incoming, outgoing) => {
3129
+ let res, req;
3130
+ try {
3131
+ req = newRequest(incoming, options.hostname);
3132
+ let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
3133
+ if (!incomingEnded) {
3134
+ ;
3135
+ incoming[wrapBodyStream] = true;
3136
+ incoming.on("end", () => {
3137
+ incomingEnded = true;
3138
+ });
3139
+ if (incoming instanceof http2.Http2ServerRequest) {
3140
+ ;
3141
+ outgoing[outgoingEnded] = () => {
3142
+ if (!incomingEnded) {
3143
+ setTimeout(() => {
3144
+ if (!incomingEnded) {
3145
+ setTimeout(() => {
3146
+ incoming.destroy();
3147
+ outgoing.destroy();
3148
+ });
3149
+ }
3150
+ });
3151
+ }
3152
+ };
3153
+ }
3154
+ }
3155
+ outgoing.on("close", () => {
3156
+ const abortController = req[abortControllerKey];
3157
+ if (abortController) {
3158
+ if (incoming.errored) {
3159
+ req[abortControllerKey].abort(incoming.errored.toString());
3160
+ } else if (!outgoing.writableFinished) {
3161
+ req[abortControllerKey].abort("Client connection prematurely closed.");
3162
+ }
3163
+ }
3164
+ if (!incomingEnded) {
3165
+ setTimeout(() => {
3166
+ if (!incomingEnded) {
3167
+ setTimeout(() => {
3168
+ incoming.destroy();
3169
+ });
3170
+ }
3171
+ });
3172
+ }
3173
+ });
3174
+ res = fetchCallback(req, { incoming, outgoing });
3175
+ if (cacheKey in res) {
3176
+ return responseViaCache(res, outgoing);
3177
+ }
3178
+ } catch (e) {
3179
+ if (!res) {
3180
+ if (options.errorHandler) {
3181
+ res = await options.errorHandler(req ? e : toRequestError(e));
3182
+ if (!res) {
3183
+ return;
3184
+ }
3185
+ } else if (!req) {
3186
+ res = handleRequestError();
3187
+ } else {
3188
+ res = handleFetchError(e);
3189
+ }
3190
+ } else {
3191
+ return handleResponseError(e, outgoing);
3192
+ }
3193
+ }
3194
+ try {
3195
+ return await responseViaResponseObject(res, outgoing, options);
3196
+ } catch (e) {
3197
+ return handleResponseError(e, outgoing);
3198
+ }
3199
+ };
3200
+ };
3201
+ var createAdaptorServer = (options) => {
3202
+ const fetchCallback = options.fetch;
3203
+ const requestListener = getRequestListener(fetchCallback, {
3204
+ hostname: options.hostname,
3205
+ overrideGlobalObjects: options.overrideGlobalObjects,
3206
+ autoCleanupIncoming: options.autoCleanupIncoming
3207
+ });
3208
+ const createServer2 = options.createServer || http.createServer;
3209
+ const server = createServer2(options.serverOptions || {}, requestListener);
3210
+ return server;
3211
+ };
3212
+ var serve = (options, listeningListener) => {
3213
+ const server = createAdaptorServer(options);
3214
+ server.listen(options?.port ?? 3e3, options.hostname, () => {
3215
+ server.address();
3216
+ });
3217
+ return server;
3218
+ };
3219
+
3220
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
3221
+ var import_cross_spawn = __toESM(require_cross_spawn());
3222
+
3223
+ // ../../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
3224
+ function stripFinalNewline(input) {
3225
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
3226
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
3227
+ if (input[input.length - 1] === LF) {
3228
+ input = input.slice(0, -1);
3229
+ }
3230
+ if (input[input.length - 1] === CR) {
3231
+ input = input.slice(0, -1);
3232
+ }
3233
+ return input;
3234
+ }
3235
+
3236
+ // ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
3237
+ function pathKey(options = {}) {
3238
+ const {
3239
+ env = process.env,
3240
+ platform = process.platform
3241
+ } = options;
3242
+ if (platform !== "win32") {
3243
+ return "PATH";
3244
+ }
3245
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
3246
+ }
3247
+
3248
+ // ../../node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
3249
+ var npmRunPath = ({
3250
+ cwd: cwd2 = process2__default.default.cwd(),
3251
+ path: pathOption = process2__default.default.env[pathKey()],
3252
+ preferLocal = true,
3253
+ execPath = process2__default.default.execPath,
3254
+ addExecPath = true
3255
+ } = {}) => {
3256
+ const cwdString = cwd2 instanceof URL ? url.fileURLToPath(cwd2) : cwd2;
3257
+ const cwdPath = path__default.default.resolve(cwdString);
3258
+ const result = [];
3259
+ if (preferLocal) {
3260
+ applyPreferLocal(result, cwdPath);
3261
+ }
3262
+ if (addExecPath) {
3263
+ applyExecPath(result, execPath, cwdPath);
3264
+ }
3265
+ return [...result, pathOption].join(path__default.default.delimiter);
3266
+ };
3267
+ var applyPreferLocal = (result, cwdPath) => {
3268
+ let previous;
3269
+ while (previous !== cwdPath) {
3270
+ result.push(path__default.default.join(cwdPath, "node_modules/.bin"));
3271
+ previous = cwdPath;
3272
+ cwdPath = path__default.default.resolve(cwdPath, "..");
3273
+ }
3274
+ };
3275
+ var applyExecPath = (result, execPath, cwdPath) => {
3276
+ const execPathString = execPath instanceof URL ? url.fileURLToPath(execPath) : execPath;
3277
+ result.push(path__default.default.resolve(cwdPath, execPathString, ".."));
3278
+ };
3279
+ var npmRunPathEnv = ({ env = process2__default.default.env, ...options } = {}) => {
3280
+ env = { ...env };
3281
+ const pathName = pathKey({ env });
3282
+ options.path = env[pathName];
3283
+ env[pathName] = npmRunPath(options);
3284
+ return env;
3285
+ };
3286
+
3287
+ // ../../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
3288
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
3289
+ if (property === "length" || property === "prototype") {
3290
+ return;
3291
+ }
3292
+ if (property === "arguments" || property === "caller") {
3293
+ return;
3294
+ }
3295
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
3296
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
3297
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
3298
+ return;
3299
+ }
3300
+ Object.defineProperty(to, property, fromDescriptor);
3301
+ };
3302
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
3303
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
3304
+ };
3305
+ var changePrototype = (to, from) => {
3306
+ const fromPrototype = Object.getPrototypeOf(from);
3307
+ if (fromPrototype === Object.getPrototypeOf(to)) {
3308
+ return;
3309
+ }
3310
+ Object.setPrototypeOf(to, fromPrototype);
3311
+ };
3312
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
3313
+ ${fromBody}`;
3314
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
3315
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
3316
+ var changeToString = (to, from, name) => {
3317
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
3318
+ const newToString = wrappedToString.bind(null, withName, from.toString());
3319
+ Object.defineProperty(newToString, "name", toStringName);
3320
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
3321
+ };
3322
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
3323
+ const { name } = to;
3324
+ for (const property of Reflect.ownKeys(from)) {
3325
+ copyProperty(to, from, property, ignoreNonConfigurable);
3326
+ }
3327
+ changePrototype(to, from);
3328
+ changeToString(to, from, name);
3329
+ return to;
3330
+ }
3331
+
3332
+ // ../../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
3333
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
3334
+ var onetime = (function_, options = {}) => {
3335
+ if (typeof function_ !== "function") {
3336
+ throw new TypeError("Expected a function");
3337
+ }
3338
+ let returnValue;
3339
+ let callCount = 0;
3340
+ const functionName = function_.displayName || function_.name || "<anonymous>";
3341
+ const onetime2 = function(...arguments_) {
3342
+ calledFunctions.set(onetime2, ++callCount);
3343
+ if (callCount === 1) {
3344
+ returnValue = function_.apply(this, arguments_);
3345
+ function_ = null;
3346
+ } else if (options.throw === true) {
3347
+ throw new Error(`Function \`${functionName}\` can only be called once`);
3348
+ }
3349
+ return returnValue;
3350
+ };
3351
+ mimicFunction(onetime2, function_);
3352
+ calledFunctions.set(onetime2, callCount);
3353
+ return onetime2;
3354
+ };
3355
+ onetime.callCount = (function_) => {
3356
+ if (!calledFunctions.has(function_)) {
3357
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
3358
+ }
3359
+ return calledFunctions.get(function_);
3360
+ };
3361
+ var onetime_default = onetime;
3362
+
3363
+ // ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/realtime.js
3364
+ var getRealtimeSignals = function() {
3365
+ const length = SIGRTMAX - SIGRTMIN + 1;
3366
+ return Array.from({ length }, getRealtimeSignal);
3367
+ };
3368
+ var getRealtimeSignal = function(value, index) {
3369
+ return {
3370
+ name: `SIGRT${index + 1}`,
3371
+ number: SIGRTMIN + index,
3372
+ action: "terminate",
3373
+ description: "Application-specific signal (realtime)",
3374
+ standard: "posix"
3375
+ };
3376
+ };
3377
+ var SIGRTMIN = 34;
3378
+ var SIGRTMAX = 64;
3379
+
3380
+ // ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/core.js
3381
+ var SIGNALS = [
3382
+ {
3383
+ name: "SIGHUP",
3384
+ number: 1,
3385
+ action: "terminate",
3386
+ description: "Terminal closed",
3387
+ standard: "posix"
3388
+ },
3389
+ {
3390
+ name: "SIGINT",
3391
+ number: 2,
3392
+ action: "terminate",
3393
+ description: "User interruption with CTRL-C",
3394
+ standard: "ansi"
3395
+ },
3396
+ {
3397
+ name: "SIGQUIT",
3398
+ number: 3,
3399
+ action: "core",
3400
+ description: "User interruption with CTRL-\\",
3401
+ standard: "posix"
3402
+ },
3403
+ {
3404
+ name: "SIGILL",
3405
+ number: 4,
3406
+ action: "core",
3407
+ description: "Invalid machine instruction",
3408
+ standard: "ansi"
3409
+ },
3410
+ {
3411
+ name: "SIGTRAP",
3412
+ number: 5,
3413
+ action: "core",
3414
+ description: "Debugger breakpoint",
3415
+ standard: "posix"
3416
+ },
3417
+ {
3418
+ name: "SIGABRT",
3419
+ number: 6,
3420
+ action: "core",
3421
+ description: "Aborted",
3422
+ standard: "ansi"
3423
+ },
3424
+ {
3425
+ name: "SIGIOT",
3426
+ number: 6,
3427
+ action: "core",
3428
+ description: "Aborted",
3429
+ standard: "bsd"
3430
+ },
3431
+ {
3432
+ name: "SIGBUS",
3433
+ number: 7,
3434
+ action: "core",
3435
+ description: "Bus error due to misaligned, non-existing address or paging error",
3436
+ standard: "bsd"
3437
+ },
3438
+ {
3439
+ name: "SIGEMT",
3440
+ number: 7,
3441
+ action: "terminate",
3442
+ description: "Command should be emulated but is not implemented",
3443
+ standard: "other"
3444
+ },
3445
+ {
3446
+ name: "SIGFPE",
3447
+ number: 8,
3448
+ action: "core",
3449
+ description: "Floating point arithmetic error",
3450
+ standard: "ansi"
3451
+ },
3452
+ {
3453
+ name: "SIGKILL",
3454
+ number: 9,
3455
+ action: "terminate",
3456
+ description: "Forced termination",
3457
+ standard: "posix",
3458
+ forced: true
3459
+ },
3460
+ {
3461
+ name: "SIGUSR1",
3462
+ number: 10,
3463
+ action: "terminate",
3464
+ description: "Application-specific signal",
3465
+ standard: "posix"
3466
+ },
3467
+ {
3468
+ name: "SIGSEGV",
3469
+ number: 11,
3470
+ action: "core",
3471
+ description: "Segmentation fault",
3472
+ standard: "ansi"
3473
+ },
3474
+ {
3475
+ name: "SIGUSR2",
3476
+ number: 12,
3477
+ action: "terminate",
3478
+ description: "Application-specific signal",
3479
+ standard: "posix"
3480
+ },
3481
+ {
3482
+ name: "SIGPIPE",
3483
+ number: 13,
3484
+ action: "terminate",
3485
+ description: "Broken pipe or socket",
3486
+ standard: "posix"
3487
+ },
3488
+ {
3489
+ name: "SIGALRM",
3490
+ number: 14,
3491
+ action: "terminate",
3492
+ description: "Timeout or timer",
3493
+ standard: "posix"
3494
+ },
3495
+ {
3496
+ name: "SIGTERM",
3497
+ number: 15,
3498
+ action: "terminate",
3499
+ description: "Termination",
3500
+ standard: "ansi"
3501
+ },
3502
+ {
3503
+ name: "SIGSTKFLT",
3504
+ number: 16,
3505
+ action: "terminate",
3506
+ description: "Stack is empty or overflowed",
3507
+ standard: "other"
3508
+ },
3509
+ {
3510
+ name: "SIGCHLD",
3511
+ number: 17,
3512
+ action: "ignore",
3513
+ description: "Child process terminated, paused or unpaused",
3514
+ standard: "posix"
3515
+ },
3516
+ {
3517
+ name: "SIGCLD",
3518
+ number: 17,
3519
+ action: "ignore",
3520
+ description: "Child process terminated, paused or unpaused",
3521
+ standard: "other"
3522
+ },
3523
+ {
3524
+ name: "SIGCONT",
3525
+ number: 18,
3526
+ action: "unpause",
3527
+ description: "Unpaused",
3528
+ standard: "posix",
3529
+ forced: true
3530
+ },
3531
+ {
3532
+ name: "SIGSTOP",
3533
+ number: 19,
3534
+ action: "pause",
3535
+ description: "Paused",
3536
+ standard: "posix",
3537
+ forced: true
3538
+ },
3539
+ {
3540
+ name: "SIGTSTP",
3541
+ number: 20,
3542
+ action: "pause",
3543
+ description: 'Paused using CTRL-Z or "suspend"',
3544
+ standard: "posix"
3545
+ },
3546
+ {
3547
+ name: "SIGTTIN",
3548
+ number: 21,
3549
+ action: "pause",
3550
+ description: "Background process cannot read terminal input",
3551
+ standard: "posix"
3552
+ },
3553
+ {
3554
+ name: "SIGBREAK",
3555
+ number: 21,
3556
+ action: "terminate",
3557
+ description: "User interruption with CTRL-BREAK",
3558
+ standard: "other"
3559
+ },
3560
+ {
3561
+ name: "SIGTTOU",
3562
+ number: 22,
3563
+ action: "pause",
3564
+ description: "Background process cannot write to terminal output",
3565
+ standard: "posix"
3566
+ },
3567
+ {
3568
+ name: "SIGURG",
3569
+ number: 23,
3570
+ action: "ignore",
3571
+ description: "Socket received out-of-band data",
3572
+ standard: "bsd"
3573
+ },
3574
+ {
3575
+ name: "SIGXCPU",
3576
+ number: 24,
3577
+ action: "core",
3578
+ description: "Process timed out",
3579
+ standard: "bsd"
3580
+ },
3581
+ {
3582
+ name: "SIGXFSZ",
3583
+ number: 25,
3584
+ action: "core",
3585
+ description: "File too big",
3586
+ standard: "bsd"
3587
+ },
3588
+ {
3589
+ name: "SIGVTALRM",
3590
+ number: 26,
3591
+ action: "terminate",
3592
+ description: "Timeout or timer",
3593
+ standard: "bsd"
3594
+ },
3595
+ {
3596
+ name: "SIGPROF",
3597
+ number: 27,
3598
+ action: "terminate",
3599
+ description: "Timeout or timer",
3600
+ standard: "bsd"
3601
+ },
3602
+ {
3603
+ name: "SIGWINCH",
3604
+ number: 28,
3605
+ action: "ignore",
3606
+ description: "Terminal window size changed",
3607
+ standard: "bsd"
3608
+ },
3609
+ {
3610
+ name: "SIGIO",
3611
+ number: 29,
3612
+ action: "terminate",
3613
+ description: "I/O is available",
3614
+ standard: "other"
3615
+ },
3616
+ {
3617
+ name: "SIGPOLL",
3618
+ number: 29,
3619
+ action: "terminate",
3620
+ description: "Watched event",
3621
+ standard: "other"
3622
+ },
3623
+ {
3624
+ name: "SIGINFO",
3625
+ number: 29,
3626
+ action: "ignore",
3627
+ description: "Request for process information",
3628
+ standard: "other"
3629
+ },
3630
+ {
3631
+ name: "SIGPWR",
3632
+ number: 30,
3633
+ action: "terminate",
3634
+ description: "Device running out of power",
3635
+ standard: "systemv"
3636
+ },
3637
+ {
3638
+ name: "SIGSYS",
3639
+ number: 31,
3640
+ action: "core",
3641
+ description: "Invalid system call",
3642
+ standard: "other"
3643
+ },
3644
+ {
3645
+ name: "SIGUNUSED",
3646
+ number: 31,
3647
+ action: "terminate",
3648
+ description: "Invalid system call",
3649
+ standard: "other"
3650
+ }
3651
+ ];
3652
+
3653
+ // ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/signals.js
3654
+ var getSignals = function() {
3655
+ const realtimeSignals = getRealtimeSignals();
3656
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
3657
+ return signals2;
3658
+ };
3659
+ var normalizeSignal = function({
3660
+ name,
3661
+ number: defaultNumber,
3662
+ description,
3663
+ action,
3664
+ forced = false,
3665
+ standard
3666
+ }) {
3667
+ const {
3668
+ signals: { [name]: constantSignal }
3669
+ } = os.constants;
3670
+ const supported = constantSignal !== void 0;
3671
+ const number = supported ? constantSignal : defaultNumber;
3672
+ return { name, number, description, supported, action, forced, standard };
3673
+ };
3674
+
3675
+ // ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/main.js
3676
+ var getSignalsByName = function() {
3677
+ const signals2 = getSignals();
3678
+ return signals2.reduce(getSignalByName, {});
3679
+ };
3680
+ var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
3681
+ return {
3682
+ ...signalByNameMemo,
3683
+ [name]: { name, number, description, supported, action, forced, standard }
3684
+ };
3685
+ };
3686
+ var signalsByName = getSignalsByName();
3687
+ var getSignalsByNumber = function() {
3688
+ const signals2 = getSignals();
3689
+ const length = SIGRTMAX + 1;
3690
+ const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals2));
3691
+ return Object.assign({}, ...signalsA);
3692
+ };
3693
+ var getSignalByNumber = function(number, signals2) {
3694
+ const signal = findSignalByNumber(number, signals2);
3695
+ if (signal === void 0) {
3696
+ return {};
3697
+ }
3698
+ const { name, description, supported, action, forced, standard } = signal;
3699
+ return {
3700
+ [number]: {
3701
+ name,
3702
+ number,
3703
+ description,
3704
+ supported,
3705
+ action,
3706
+ forced,
3707
+ standard
3708
+ }
3709
+ };
3710
+ };
3711
+ var findSignalByNumber = function(number, signals2) {
3712
+ const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
3713
+ if (signal !== void 0) {
3714
+ return signal;
3715
+ }
3716
+ return signals2.find((signalA) => signalA.number === number);
3717
+ };
3718
+ getSignalsByNumber();
3719
+
3720
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/error.js
3721
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
3722
+ if (timedOut) {
3723
+ return `timed out after ${timeout} milliseconds`;
3724
+ }
3725
+ if (isCanceled) {
3726
+ return "was canceled";
3727
+ }
3728
+ if (errorCode !== void 0) {
3729
+ return `failed with ${errorCode}`;
3730
+ }
3731
+ if (signal !== void 0) {
3732
+ return `was killed with ${signal} (${signalDescription})`;
3733
+ }
3734
+ if (exitCode !== void 0) {
3735
+ return `failed with exit code ${exitCode}`;
3736
+ }
3737
+ return "failed";
3738
+ };
3739
+ var makeError = ({
3740
+ stdout,
3741
+ stderr,
3742
+ all,
3743
+ error,
3744
+ signal,
3745
+ exitCode,
3746
+ command,
3747
+ escapedCommand,
3748
+ timedOut,
3749
+ isCanceled,
3750
+ killed,
3751
+ parsed: { options: { timeout } }
3752
+ }) => {
3753
+ exitCode = exitCode === null ? void 0 : exitCode;
3754
+ signal = signal === null ? void 0 : signal;
3755
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
3756
+ const errorCode = error && error.code;
3757
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
3758
+ const execaMessage = `Command ${prefix}: ${command}`;
3759
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
3760
+ const shortMessage = isError ? `${execaMessage}
3761
+ ${error.message}` : execaMessage;
3762
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
3763
+ if (isError) {
3764
+ error.originalMessage = error.message;
3765
+ error.message = message;
3766
+ } else {
3767
+ error = new Error(message);
3768
+ }
3769
+ error.shortMessage = shortMessage;
3770
+ error.command = command;
3771
+ error.escapedCommand = escapedCommand;
3772
+ error.exitCode = exitCode;
3773
+ error.signal = signal;
3774
+ error.signalDescription = signalDescription;
3775
+ error.stdout = stdout;
3776
+ error.stderr = stderr;
3777
+ if (all !== void 0) {
3778
+ error.all = all;
3779
+ }
3780
+ if ("bufferedData" in error) {
3781
+ delete error.bufferedData;
3782
+ }
3783
+ error.failed = true;
3784
+ error.timedOut = Boolean(timedOut);
3785
+ error.isCanceled = isCanceled;
3786
+ error.killed = killed && !timedOut;
3787
+ return error;
3788
+ };
3789
+
3790
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stdio.js
3791
+ var aliases = ["stdin", "stdout", "stderr"];
3792
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
3793
+ var normalizeStdio = (options) => {
3794
+ if (!options) {
3795
+ return;
3796
+ }
3797
+ const { stdio } = options;
3798
+ if (stdio === void 0) {
3799
+ return aliases.map((alias) => options[alias]);
3800
+ }
3801
+ if (hasAlias(options)) {
3802
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
3803
+ }
3804
+ if (typeof stdio === "string") {
3805
+ return stdio;
3806
+ }
3807
+ if (!Array.isArray(stdio)) {
3808
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
3809
+ }
3810
+ const length = Math.max(stdio.length, aliases.length);
3811
+ return Array.from({ length }, (value, index) => stdio[index]);
3812
+ };
3813
+
3814
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
3815
+ var import_signal_exit = __toESM(require_signal_exit());
3816
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
3817
+ var spawnedKill = (kill2, signal = "SIGTERM", options = {}) => {
3818
+ const killResult = kill2(signal);
3819
+ setKillTimeout(kill2, signal, options, killResult);
3820
+ return killResult;
3821
+ };
3822
+ var setKillTimeout = (kill2, signal, options, killResult) => {
3823
+ if (!shouldForceKill(signal, options, killResult)) {
3824
+ return;
3825
+ }
3826
+ const timeout = getForceKillAfterTimeout(options);
3827
+ const t = setTimeout(() => {
3828
+ kill2("SIGKILL");
3829
+ }, timeout);
3830
+ if (t.unref) {
3831
+ t.unref();
3832
+ }
3833
+ };
3834
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
3835
+ var isSigterm = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
3836
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
3837
+ if (forceKillAfterTimeout === true) {
3838
+ return DEFAULT_FORCE_KILL_TIMEOUT;
3839
+ }
3840
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
3841
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
3842
+ }
3843
+ return forceKillAfterTimeout;
3844
+ };
3845
+ var spawnedCancel = (spawned, context) => {
3846
+ const killResult = spawned.kill();
3847
+ if (killResult) {
3848
+ context.isCanceled = true;
3849
+ }
3850
+ };
3851
+ var timeoutKill = (spawned, signal, reject) => {
3852
+ spawned.kill(signal);
3853
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
3854
+ };
3855
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
3856
+ if (timeout === 0 || timeout === void 0) {
3857
+ return spawnedPromise;
3858
+ }
3859
+ let timeoutId;
3860
+ const timeoutPromise = new Promise((resolve, reject) => {
3861
+ timeoutId = setTimeout(() => {
3862
+ timeoutKill(spawned, killSignal, reject);
3863
+ }, timeout);
3864
+ });
3865
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
3866
+ clearTimeout(timeoutId);
3867
+ });
3868
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
3869
+ };
3870
+ var validateTimeout = ({ timeout }) => {
3871
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
3872
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
3873
+ }
3874
+ };
3875
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
3876
+ if (!cleanup || detached) {
3877
+ return timedPromise;
3878
+ }
3879
+ const removeExitHandler = (0, import_signal_exit.default)(() => {
3880
+ spawned.kill();
3881
+ });
3882
+ return timedPromise.finally(() => {
3883
+ removeExitHandler();
3884
+ });
3885
+ };
3886
+
3887
+ // ../../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
3888
+ function isStream(stream2) {
3889
+ return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
3890
+ }
3891
+ function isWritableStream(stream2) {
3892
+ return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
3893
+ }
3894
+
3895
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stream.js
3896
+ var import_get_stream = __toESM(require_get_stream());
3897
+ var import_merge_stream = __toESM(require_merge_stream());
3898
+ var handleInput = (spawned, input) => {
3899
+ if (input === void 0 || spawned.stdin === void 0) {
3900
+ return;
3901
+ }
3902
+ if (isStream(input)) {
3903
+ input.pipe(spawned.stdin);
3904
+ } else {
3905
+ spawned.stdin.end(input);
3906
+ }
3907
+ };
3908
+ var makeAllStream = (spawned, { all }) => {
3909
+ if (!all || !spawned.stdout && !spawned.stderr) {
3910
+ return;
3911
+ }
3912
+ const mixed = (0, import_merge_stream.default)();
3913
+ if (spawned.stdout) {
3914
+ mixed.add(spawned.stdout);
3915
+ }
3916
+ if (spawned.stderr) {
3917
+ mixed.add(spawned.stderr);
3918
+ }
3919
+ return mixed;
3920
+ };
3921
+ var getBufferedData = async (stream2, streamPromise) => {
3922
+ if (!stream2) {
3923
+ return;
3924
+ }
3925
+ stream2.destroy();
3926
+ try {
3927
+ return await streamPromise;
3928
+ } catch (error) {
3929
+ return error.bufferedData;
3930
+ }
3931
+ };
3932
+ var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
3933
+ if (!stream2 || !buffer) {
3934
+ return;
3935
+ }
3936
+ if (encoding) {
3937
+ return (0, import_get_stream.default)(stream2, { encoding, maxBuffer });
3938
+ }
3939
+ return import_get_stream.default.buffer(stream2, { maxBuffer });
3940
+ };
3941
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
3942
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
3943
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
3944
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
3945
+ try {
3946
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
3947
+ } catch (error) {
3948
+ return Promise.all([
3949
+ { error, signal: error.signal, timedOut: error.timedOut },
3950
+ getBufferedData(stdout, stdoutPromise),
3951
+ getBufferedData(stderr, stderrPromise),
3952
+ getBufferedData(all, allPromise)
3953
+ ]);
3954
+ }
3955
+ };
3956
+
3957
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/promise.js
3958
+ var nativePromisePrototype = (async () => {
3959
+ })().constructor.prototype;
3960
+ var descriptors = ["then", "catch", "finally"].map((property) => [
3961
+ property,
3962
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
3963
+ ]);
3964
+ var mergePromise = (spawned, promise) => {
3965
+ for (const [property, descriptor] of descriptors) {
3966
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
3967
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
3968
+ }
3969
+ return spawned;
3970
+ };
3971
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
3972
+ spawned.on("exit", (exitCode, signal) => {
3973
+ resolve({ exitCode, signal });
3974
+ });
3975
+ spawned.on("error", (error) => {
3976
+ reject(error);
3977
+ });
3978
+ if (spawned.stdin) {
3979
+ spawned.stdin.on("error", (error) => {
3980
+ reject(error);
3981
+ });
3982
+ }
3983
+ });
3984
+
3985
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/command.js
3986
+ var normalizeArgs = (file, args = []) => {
3987
+ if (!Array.isArray(args)) {
3988
+ return [file];
3989
+ }
3990
+ return [file, ...args];
3991
+ };
3992
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
3993
+ var DOUBLE_QUOTES_REGEXP = /"/g;
3994
+ var escapeArg = (arg) => {
3995
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
3996
+ return arg;
3997
+ }
3998
+ return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
3999
+ };
4000
+ var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
4001
+ var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
4002
+
4003
+ // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
4004
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
4005
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
4006
+ const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
4007
+ if (preferLocal) {
4008
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
4009
+ }
4010
+ return env;
4011
+ };
4012
+ var handleArguments = (file, args, options = {}) => {
4013
+ const parsed = import_cross_spawn.default._parse(file, args, options);
4014
+ file = parsed.command;
4015
+ args = parsed.args;
4016
+ options = parsed.options;
4017
+ options = {
4018
+ maxBuffer: DEFAULT_MAX_BUFFER,
4019
+ buffer: true,
4020
+ stripFinalNewline: true,
4021
+ extendEnv: true,
4022
+ preferLocal: false,
4023
+ localDir: options.cwd || process2__default.default.cwd(),
4024
+ execPath: process2__default.default.execPath,
4025
+ encoding: "utf8",
4026
+ reject: true,
4027
+ cleanup: true,
4028
+ all: false,
4029
+ windowsHide: true,
4030
+ ...options
4031
+ };
4032
+ options.env = getEnv(options);
4033
+ options.stdio = normalizeStdio(options);
4034
+ if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
4035
+ args.unshift("/q");
4036
+ }
4037
+ return { file, args, options, parsed };
4038
+ };
4039
+ var handleOutput = (options, value, error) => {
4040
+ if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
4041
+ return error === void 0 ? void 0 : "";
4042
+ }
4043
+ if (options.stripFinalNewline) {
4044
+ return stripFinalNewline(value);
4045
+ }
4046
+ return value;
4047
+ };
4048
+ function execa(file, args, options) {
4049
+ const parsed = handleArguments(file, args, options);
4050
+ const command = joinCommand(file, args);
4051
+ const escapedCommand = getEscapedCommand(file, args);
4052
+ validateTimeout(parsed.options);
4053
+ let spawned;
4054
+ try {
4055
+ spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
4056
+ } catch (error) {
4057
+ const dummySpawned = new childProcess2__default.default.ChildProcess();
4058
+ const errorPromise = Promise.reject(makeError({
4059
+ error,
4060
+ stdout: "",
4061
+ stderr: "",
4062
+ all: "",
4063
+ command,
4064
+ escapedCommand,
4065
+ parsed,
4066
+ timedOut: false,
4067
+ isCanceled: false,
4068
+ killed: false
4069
+ }));
4070
+ return mergePromise(dummySpawned, errorPromise);
4071
+ }
4072
+ const spawnedPromise = getSpawnedPromise(spawned);
4073
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
4074
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
4075
+ const context = { isCanceled: false };
4076
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
4077
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
4078
+ const handlePromise = async () => {
4079
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
4080
+ const stdout = handleOutput(parsed.options, stdoutResult);
4081
+ const stderr = handleOutput(parsed.options, stderrResult);
4082
+ const all = handleOutput(parsed.options, allResult);
4083
+ if (error || exitCode !== 0 || signal !== null) {
4084
+ const returnedError = makeError({
4085
+ error,
4086
+ exitCode,
4087
+ signal,
4088
+ stdout,
4089
+ stderr,
4090
+ all,
4091
+ command,
4092
+ escapedCommand,
4093
+ parsed,
4094
+ timedOut,
4095
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
4096
+ killed: spawned.killed
4097
+ });
4098
+ if (!parsed.options.reject) {
4099
+ return returnedError;
4100
+ }
4101
+ throw returnedError;
4102
+ }
4103
+ return {
4104
+ command,
4105
+ escapedCommand,
4106
+ exitCode: 0,
4107
+ stdout,
4108
+ stderr,
4109
+ all,
4110
+ failed: false,
4111
+ timedOut: false,
4112
+ isCanceled: false,
4113
+ killed: false
4114
+ };
4115
+ };
4116
+ const handlePromiseOnce = onetime_default(handlePromise);
4117
+ handleInput(spawned, parsed.options.input);
4118
+ spawned.all = makeAllStream(spawned, parsed.options);
4119
+ return mergePromise(spawned, handlePromiseOnce);
4120
+ }
4121
+
4122
+ // ../../node_modules/.pnpm/taskkill@5.0.0/node_modules/taskkill/index.js
4123
+ function parseArgs(input, options) {
4124
+ if (process2__default.default.platform !== "win32") {
4125
+ throw new Error("Windows only");
4126
+ }
4127
+ input = [input].flat();
4128
+ if (input.length === 0) {
4129
+ throw new Error("PID or image name required");
4130
+ }
4131
+ const arguments_ = [];
4132
+ if (options.system && options.username && options.password) {
4133
+ arguments_.push("/s", options.system, "/u", options.username, "/p", options.password);
4134
+ }
4135
+ if (options.filter) {
4136
+ arguments_.push("/fi", options.filter);
4137
+ }
4138
+ if (options.force) {
4139
+ arguments_.push("/f");
4140
+ }
4141
+ if (options.tree) {
4142
+ arguments_.push("/t");
4143
+ }
4144
+ for (const element of input) {
4145
+ arguments_.push(typeof element === "number" ? "/pid" : "/im", element);
4146
+ }
4147
+ return arguments_;
4148
+ }
4149
+ async function taskkill(input, options = {}) {
4150
+ await execa("taskkill", parseArgs(input, options));
4151
+ }
4152
+
4153
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
4154
+ var import_cross_spawn2 = __toESM(require_cross_spawn());
4155
+
4156
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
4157
+ var getRealtimeSignals2 = () => {
4158
+ const length = SIGRTMAX2 - SIGRTMIN2 + 1;
4159
+ return Array.from({ length }, getRealtimeSignal2);
4160
+ };
4161
+ var getRealtimeSignal2 = (value, index) => ({
4162
+ name: `SIGRT${index + 1}`,
4163
+ number: SIGRTMIN2 + index,
4164
+ action: "terminate",
4165
+ description: "Application-specific signal (realtime)",
4166
+ standard: "posix"
4167
+ });
4168
+ var SIGRTMIN2 = 34;
4169
+ var SIGRTMAX2 = 64;
4170
+
4171
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
4172
+ var SIGNALS2 = [
4173
+ {
4174
+ name: "SIGHUP",
4175
+ number: 1,
4176
+ action: "terminate",
4177
+ description: "Terminal closed",
4178
+ standard: "posix"
4179
+ },
4180
+ {
4181
+ name: "SIGINT",
4182
+ number: 2,
4183
+ action: "terminate",
4184
+ description: "User interruption with CTRL-C",
4185
+ standard: "ansi"
4186
+ },
4187
+ {
4188
+ name: "SIGQUIT",
4189
+ number: 3,
4190
+ action: "core",
4191
+ description: "User interruption with CTRL-\\",
4192
+ standard: "posix"
4193
+ },
4194
+ {
4195
+ name: "SIGILL",
4196
+ number: 4,
4197
+ action: "core",
4198
+ description: "Invalid machine instruction",
4199
+ standard: "ansi"
4200
+ },
4201
+ {
4202
+ name: "SIGTRAP",
4203
+ number: 5,
4204
+ action: "core",
4205
+ description: "Debugger breakpoint",
4206
+ standard: "posix"
4207
+ },
4208
+ {
4209
+ name: "SIGABRT",
4210
+ number: 6,
4211
+ action: "core",
4212
+ description: "Aborted",
4213
+ standard: "ansi"
4214
+ },
4215
+ {
4216
+ name: "SIGIOT",
4217
+ number: 6,
4218
+ action: "core",
4219
+ description: "Aborted",
4220
+ standard: "bsd"
4221
+ },
4222
+ {
4223
+ name: "SIGBUS",
4224
+ number: 7,
4225
+ action: "core",
4226
+ description: "Bus error due to misaligned, non-existing address or paging error",
4227
+ standard: "bsd"
4228
+ },
4229
+ {
4230
+ name: "SIGEMT",
4231
+ number: 7,
4232
+ action: "terminate",
4233
+ description: "Command should be emulated but is not implemented",
4234
+ standard: "other"
4235
+ },
4236
+ {
4237
+ name: "SIGFPE",
4238
+ number: 8,
4239
+ action: "core",
4240
+ description: "Floating point arithmetic error",
4241
+ standard: "ansi"
4242
+ },
4243
+ {
4244
+ name: "SIGKILL",
4245
+ number: 9,
4246
+ action: "terminate",
4247
+ description: "Forced termination",
4248
+ standard: "posix",
4249
+ forced: true
4250
+ },
4251
+ {
4252
+ name: "SIGUSR1",
4253
+ number: 10,
4254
+ action: "terminate",
4255
+ description: "Application-specific signal",
4256
+ standard: "posix"
4257
+ },
4258
+ {
4259
+ name: "SIGSEGV",
4260
+ number: 11,
4261
+ action: "core",
4262
+ description: "Segmentation fault",
4263
+ standard: "ansi"
4264
+ },
4265
+ {
4266
+ name: "SIGUSR2",
4267
+ number: 12,
4268
+ action: "terminate",
4269
+ description: "Application-specific signal",
4270
+ standard: "posix"
4271
+ },
4272
+ {
4273
+ name: "SIGPIPE",
4274
+ number: 13,
4275
+ action: "terminate",
4276
+ description: "Broken pipe or socket",
4277
+ standard: "posix"
4278
+ },
4279
+ {
4280
+ name: "SIGALRM",
4281
+ number: 14,
4282
+ action: "terminate",
4283
+ description: "Timeout or timer",
4284
+ standard: "posix"
4285
+ },
4286
+ {
4287
+ name: "SIGTERM",
4288
+ number: 15,
4289
+ action: "terminate",
4290
+ description: "Termination",
4291
+ standard: "ansi"
4292
+ },
4293
+ {
4294
+ name: "SIGSTKFLT",
4295
+ number: 16,
4296
+ action: "terminate",
4297
+ description: "Stack is empty or overflowed",
4298
+ standard: "other"
4299
+ },
4300
+ {
4301
+ name: "SIGCHLD",
4302
+ number: 17,
4303
+ action: "ignore",
4304
+ description: "Child process terminated, paused or unpaused",
4305
+ standard: "posix"
4306
+ },
4307
+ {
4308
+ name: "SIGCLD",
4309
+ number: 17,
4310
+ action: "ignore",
4311
+ description: "Child process terminated, paused or unpaused",
4312
+ standard: "other"
4313
+ },
4314
+ {
4315
+ name: "SIGCONT",
4316
+ number: 18,
4317
+ action: "unpause",
4318
+ description: "Unpaused",
4319
+ standard: "posix",
4320
+ forced: true
4321
+ },
4322
+ {
4323
+ name: "SIGSTOP",
4324
+ number: 19,
4325
+ action: "pause",
4326
+ description: "Paused",
4327
+ standard: "posix",
4328
+ forced: true
4329
+ },
4330
+ {
4331
+ name: "SIGTSTP",
4332
+ number: 20,
4333
+ action: "pause",
4334
+ description: 'Paused using CTRL-Z or "suspend"',
4335
+ standard: "posix"
4336
+ },
4337
+ {
4338
+ name: "SIGTTIN",
4339
+ number: 21,
4340
+ action: "pause",
4341
+ description: "Background process cannot read terminal input",
4342
+ standard: "posix"
4343
+ },
4344
+ {
4345
+ name: "SIGBREAK",
4346
+ number: 21,
4347
+ action: "terminate",
4348
+ description: "User interruption with CTRL-BREAK",
4349
+ standard: "other"
4350
+ },
4351
+ {
4352
+ name: "SIGTTOU",
4353
+ number: 22,
4354
+ action: "pause",
4355
+ description: "Background process cannot write to terminal output",
4356
+ standard: "posix"
4357
+ },
4358
+ {
4359
+ name: "SIGURG",
4360
+ number: 23,
4361
+ action: "ignore",
4362
+ description: "Socket received out-of-band data",
4363
+ standard: "bsd"
4364
+ },
4365
+ {
4366
+ name: "SIGXCPU",
4367
+ number: 24,
4368
+ action: "core",
4369
+ description: "Process timed out",
4370
+ standard: "bsd"
4371
+ },
4372
+ {
4373
+ name: "SIGXFSZ",
4374
+ number: 25,
4375
+ action: "core",
4376
+ description: "File too big",
4377
+ standard: "bsd"
4378
+ },
4379
+ {
4380
+ name: "SIGVTALRM",
4381
+ number: 26,
4382
+ action: "terminate",
4383
+ description: "Timeout or timer",
4384
+ standard: "bsd"
4385
+ },
4386
+ {
4387
+ name: "SIGPROF",
4388
+ number: 27,
4389
+ action: "terminate",
4390
+ description: "Timeout or timer",
4391
+ standard: "bsd"
4392
+ },
4393
+ {
4394
+ name: "SIGWINCH",
4395
+ number: 28,
4396
+ action: "ignore",
4397
+ description: "Terminal window size changed",
4398
+ standard: "bsd"
4399
+ },
4400
+ {
4401
+ name: "SIGIO",
4402
+ number: 29,
4403
+ action: "terminate",
4404
+ description: "I/O is available",
4405
+ standard: "other"
4406
+ },
4407
+ {
4408
+ name: "SIGPOLL",
4409
+ number: 29,
4410
+ action: "terminate",
4411
+ description: "Watched event",
4412
+ standard: "other"
4413
+ },
4414
+ {
4415
+ name: "SIGINFO",
4416
+ number: 29,
4417
+ action: "ignore",
4418
+ description: "Request for process information",
4419
+ standard: "other"
4420
+ },
4421
+ {
4422
+ name: "SIGPWR",
4423
+ number: 30,
4424
+ action: "terminate",
4425
+ description: "Device running out of power",
4426
+ standard: "systemv"
4427
+ },
4428
+ {
4429
+ name: "SIGSYS",
4430
+ number: 31,
4431
+ action: "core",
4432
+ description: "Invalid system call",
4433
+ standard: "other"
4434
+ },
4435
+ {
4436
+ name: "SIGUNUSED",
4437
+ number: 31,
4438
+ action: "terminate",
4439
+ description: "Invalid system call",
4440
+ standard: "other"
4441
+ }
4442
+ ];
4443
+
4444
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
4445
+ var getSignals2 = () => {
4446
+ const realtimeSignals = getRealtimeSignals2();
4447
+ const signals2 = [...SIGNALS2, ...realtimeSignals].map(normalizeSignal2);
4448
+ return signals2;
4449
+ };
4450
+ var normalizeSignal2 = ({
4451
+ name,
4452
+ number: defaultNumber,
4453
+ description,
4454
+ action,
4455
+ forced = false,
4456
+ standard
4457
+ }) => {
4458
+ const {
4459
+ signals: { [name]: constantSignal }
4460
+ } = os.constants;
4461
+ const supported = constantSignal !== void 0;
4462
+ const number = supported ? constantSignal : defaultNumber;
4463
+ return { name, number, description, supported, action, forced, standard };
4464
+ };
4465
+
4466
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
4467
+ var getSignalsByName2 = () => {
4468
+ const signals2 = getSignals2();
4469
+ return Object.fromEntries(signals2.map(getSignalByName2));
4470
+ };
4471
+ var getSignalByName2 = ({
4472
+ name,
4473
+ number,
4474
+ description,
4475
+ supported,
4476
+ action,
4477
+ forced,
4478
+ standard
4479
+ }) => [name, { name, number, description, supported, action, forced, standard }];
4480
+ var signalsByName2 = getSignalsByName2();
4481
+ var getSignalsByNumber2 = () => {
4482
+ const signals2 = getSignals2();
4483
+ const length = SIGRTMAX2 + 1;
4484
+ const signalsA = Array.from(
4485
+ { length },
4486
+ (value, number) => getSignalByNumber2(number, signals2)
4487
+ );
4488
+ return Object.assign({}, ...signalsA);
4489
+ };
4490
+ var getSignalByNumber2 = (number, signals2) => {
4491
+ const signal = findSignalByNumber2(number, signals2);
4492
+ if (signal === void 0) {
4493
+ return {};
4494
+ }
4495
+ const { name, description, supported, action, forced, standard } = signal;
4496
+ return {
4497
+ [number]: {
4498
+ name,
4499
+ number,
4500
+ description,
4501
+ supported,
4502
+ action,
4503
+ forced,
4504
+ standard
4505
+ }
4506
+ };
4507
+ };
4508
+ var findSignalByNumber2 = (number, signals2) => {
4509
+ const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
4510
+ if (signal !== void 0) {
4511
+ return signal;
4512
+ }
4513
+ return signals2.find((signalA) => signalA.number === number);
4514
+ };
4515
+ getSignalsByNumber2();
4516
+
4517
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
4518
+ var getErrorPrefix2 = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
4519
+ if (timedOut) {
4520
+ return `timed out after ${timeout} milliseconds`;
4521
+ }
4522
+ if (isCanceled) {
4523
+ return "was canceled";
4524
+ }
4525
+ if (errorCode !== void 0) {
4526
+ return `failed with ${errorCode}`;
4527
+ }
4528
+ if (signal !== void 0) {
4529
+ return `was killed with ${signal} (${signalDescription})`;
4530
+ }
4531
+ if (exitCode !== void 0) {
4532
+ return `failed with exit code ${exitCode}`;
4533
+ }
4534
+ return "failed";
4535
+ };
4536
+ var makeError2 = ({
4537
+ stdout,
4538
+ stderr,
4539
+ all,
4540
+ error,
4541
+ signal,
4542
+ exitCode,
4543
+ command,
4544
+ escapedCommand,
4545
+ timedOut,
4546
+ isCanceled,
4547
+ killed,
4548
+ parsed: { options: { timeout, cwd: cwd2 = process2__default.default.cwd() } }
4549
+ }) => {
4550
+ exitCode = exitCode === null ? void 0 : exitCode;
4551
+ signal = signal === null ? void 0 : signal;
4552
+ const signalDescription = signal === void 0 ? void 0 : signalsByName2[signal].description;
4553
+ const errorCode = error && error.code;
4554
+ const prefix = getErrorPrefix2({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
4555
+ const execaMessage = `Command ${prefix}: ${command}`;
4556
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
4557
+ const shortMessage = isError ? `${execaMessage}
4558
+ ${error.message}` : execaMessage;
4559
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
4560
+ if (isError) {
4561
+ error.originalMessage = error.message;
4562
+ error.message = message;
4563
+ } else {
4564
+ error = new Error(message);
4565
+ }
4566
+ error.shortMessage = shortMessage;
4567
+ error.command = command;
4568
+ error.escapedCommand = escapedCommand;
4569
+ error.exitCode = exitCode;
4570
+ error.signal = signal;
4571
+ error.signalDescription = signalDescription;
4572
+ error.stdout = stdout;
4573
+ error.stderr = stderr;
4574
+ error.cwd = cwd2;
4575
+ if (all !== void 0) {
4576
+ error.all = all;
4577
+ }
4578
+ if ("bufferedData" in error) {
4579
+ delete error.bufferedData;
4580
+ }
4581
+ error.failed = true;
4582
+ error.timedOut = Boolean(timedOut);
4583
+ error.isCanceled = isCanceled;
4584
+ error.killed = killed && !timedOut;
4585
+ return error;
4586
+ };
4587
+
4588
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
4589
+ var aliases2 = ["stdin", "stdout", "stderr"];
4590
+ var hasAlias2 = (options) => aliases2.some((alias) => options[alias] !== void 0);
4591
+ var normalizeStdio2 = (options) => {
4592
+ if (!options) {
4593
+ return;
4594
+ }
4595
+ const { stdio } = options;
4596
+ if (stdio === void 0) {
4597
+ return aliases2.map((alias) => options[alias]);
4598
+ }
4599
+ if (hasAlias2(options)) {
4600
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases2.map((alias) => `\`${alias}\``).join(", ")}`);
4601
+ }
4602
+ if (typeof stdio === "string") {
4603
+ return stdio;
4604
+ }
4605
+ if (!Array.isArray(stdio)) {
4606
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
4607
+ }
4608
+ const length = Math.max(stdio.length, aliases2.length);
4609
+ return Array.from({ length }, (value, index) => stdio[index]);
4610
+ };
4611
+
4612
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
4613
+ var signals = [];
4614
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
4615
+ if (process.platform !== "win32") {
4616
+ signals.push(
4617
+ "SIGALRM",
4618
+ "SIGABRT",
4619
+ "SIGVTALRM",
4620
+ "SIGXCPU",
4621
+ "SIGXFSZ",
4622
+ "SIGUSR2",
4623
+ "SIGTRAP",
4624
+ "SIGSYS",
4625
+ "SIGQUIT",
4626
+ "SIGIOT"
4627
+ // should detect profiler and enable/disable accordingly.
4628
+ // see #21
4629
+ // 'SIGPROF'
4630
+ );
4631
+ }
4632
+ if (process.platform === "linux") {
4633
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
4634
+ }
4635
+
4636
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
4637
+ var processOk = (process13) => !!process13 && typeof process13 === "object" && typeof process13.removeListener === "function" && typeof process13.emit === "function" && typeof process13.reallyExit === "function" && typeof process13.listeners === "function" && typeof process13.kill === "function" && typeof process13.pid === "number" && typeof process13.on === "function";
4638
+ var kExitEmitter = Symbol.for("signal-exit emitter");
4639
+ var global2 = globalThis;
4640
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
4641
+ var Emitter = class {
4642
+ emitted = {
4643
+ afterExit: false,
4644
+ exit: false
4645
+ };
4646
+ listeners = {
4647
+ afterExit: [],
4648
+ exit: []
4649
+ };
4650
+ count = 0;
4651
+ id = Math.random();
4652
+ constructor() {
4653
+ if (global2[kExitEmitter]) {
4654
+ return global2[kExitEmitter];
4655
+ }
4656
+ ObjectDefineProperty(global2, kExitEmitter, {
4657
+ value: this,
4658
+ writable: false,
4659
+ enumerable: false,
4660
+ configurable: false
4661
+ });
4662
+ }
4663
+ on(ev, fn) {
4664
+ this.listeners[ev].push(fn);
4665
+ }
4666
+ removeListener(ev, fn) {
4667
+ const list = this.listeners[ev];
4668
+ const i = list.indexOf(fn);
4669
+ if (i === -1) {
4670
+ return;
4671
+ }
4672
+ if (i === 0 && list.length === 1) {
4673
+ list.length = 0;
4674
+ } else {
4675
+ list.splice(i, 1);
4676
+ }
4677
+ }
4678
+ emit(ev, code, signal) {
4679
+ if (this.emitted[ev]) {
4680
+ return false;
4681
+ }
4682
+ this.emitted[ev] = true;
4683
+ let ret = false;
4684
+ for (const fn of this.listeners[ev]) {
4685
+ ret = fn(code, signal) === true || ret;
4686
+ }
4687
+ if (ev === "exit") {
4688
+ ret = this.emit("afterExit", code, signal) || ret;
4689
+ }
4690
+ return ret;
4691
+ }
4692
+ };
4693
+ var SignalExitBase = class {
4694
+ };
4695
+ var signalExitWrap = (handler) => {
4696
+ return {
4697
+ onExit(cb, opts) {
4698
+ return handler.onExit(cb, opts);
4699
+ },
4700
+ load() {
4701
+ return handler.load();
4702
+ },
4703
+ unload() {
4704
+ return handler.unload();
4705
+ }
4706
+ };
4707
+ };
4708
+ var SignalExitFallback = class extends SignalExitBase {
4709
+ onExit() {
4710
+ return () => {
4711
+ };
4712
+ }
4713
+ load() {
4714
+ }
4715
+ unload() {
4716
+ }
4717
+ };
4718
+ var SignalExit = class extends SignalExitBase {
4719
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
4720
+ // so use a supported signal instead
4721
+ /* c8 ignore start */
4722
+ #hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
4723
+ /* c8 ignore stop */
4724
+ #emitter = new Emitter();
4725
+ #process;
4726
+ #originalProcessEmit;
4727
+ #originalProcessReallyExit;
4728
+ #sigListeners = {};
4729
+ #loaded = false;
4730
+ constructor(process13) {
4731
+ super();
4732
+ this.#process = process13;
4733
+ this.#sigListeners = {};
4734
+ for (const sig of signals) {
4735
+ this.#sigListeners[sig] = () => {
4736
+ const listeners = this.#process.listeners(sig);
4737
+ let { count } = this.#emitter;
4738
+ const p = process13;
4739
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
4740
+ count += p.__signal_exit_emitter__.count;
4741
+ }
4742
+ if (listeners.length === count) {
4743
+ this.unload();
4744
+ const ret = this.#emitter.emit("exit", null, sig);
4745
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
4746
+ if (!ret)
4747
+ process13.kill(process13.pid, s);
4748
+ }
4749
+ };
4750
+ }
4751
+ this.#originalProcessReallyExit = process13.reallyExit;
4752
+ this.#originalProcessEmit = process13.emit;
4753
+ }
4754
+ onExit(cb, opts) {
4755
+ if (!processOk(this.#process)) {
4756
+ return () => {
4757
+ };
4758
+ }
4759
+ if (this.#loaded === false) {
4760
+ this.load();
4761
+ }
4762
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
4763
+ this.#emitter.on(ev, cb);
4764
+ return () => {
4765
+ this.#emitter.removeListener(ev, cb);
4766
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
4767
+ this.unload();
4768
+ }
4769
+ };
4770
+ }
4771
+ load() {
4772
+ if (this.#loaded) {
4773
+ return;
4774
+ }
4775
+ this.#loaded = true;
4776
+ this.#emitter.count += 1;
4777
+ for (const sig of signals) {
4778
+ try {
4779
+ const fn = this.#sigListeners[sig];
4780
+ if (fn)
4781
+ this.#process.on(sig, fn);
4782
+ } catch (_) {
4783
+ }
4784
+ }
4785
+ this.#process.emit = (ev, ...a) => {
4786
+ return this.#processEmit(ev, ...a);
4787
+ };
4788
+ this.#process.reallyExit = (code) => {
4789
+ return this.#processReallyExit(code);
4790
+ };
4791
+ }
4792
+ unload() {
4793
+ if (!this.#loaded) {
4794
+ return;
4795
+ }
4796
+ this.#loaded = false;
4797
+ signals.forEach((sig) => {
4798
+ const listener = this.#sigListeners[sig];
4799
+ if (!listener) {
4800
+ throw new Error("Listener not defined for signal: " + sig);
4801
+ }
4802
+ try {
4803
+ this.#process.removeListener(sig, listener);
4804
+ } catch (_) {
4805
+ }
4806
+ });
4807
+ this.#process.emit = this.#originalProcessEmit;
4808
+ this.#process.reallyExit = this.#originalProcessReallyExit;
4809
+ this.#emitter.count -= 1;
4810
+ }
4811
+ #processReallyExit(code) {
4812
+ if (!processOk(this.#process)) {
4813
+ return 0;
4814
+ }
4815
+ this.#process.exitCode = code || 0;
4816
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4817
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
4818
+ }
4819
+ #processEmit(ev, ...args) {
4820
+ const og = this.#originalProcessEmit;
4821
+ if (ev === "exit" && processOk(this.#process)) {
4822
+ if (typeof args[0] === "number") {
4823
+ this.#process.exitCode = args[0];
4824
+ }
4825
+ const ret = og.call(this.#process, ev, ...args);
4826
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4827
+ return ret;
4828
+ } else {
4829
+ return og.call(this.#process, ev, ...args);
4830
+ }
4831
+ }
4832
+ };
4833
+ var process6 = globalThis.process;
4834
+ var {
4835
+ /**
4836
+ * Called when the process is exiting, whether via signal, explicit
4837
+ * exit, or running out of stuff to do.
4838
+ *
4839
+ * If the global process object is not suitable for instrumentation,
4840
+ * then this will be a no-op.
4841
+ *
4842
+ * Returns a function that may be used to unload signal-exit.
4843
+ */
4844
+ onExit: onExit2} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback());
4845
+
4846
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
4847
+ var DEFAULT_FORCE_KILL_TIMEOUT2 = 1e3 * 5;
4848
+ var spawnedKill2 = (kill2, signal = "SIGTERM", options = {}) => {
4849
+ const killResult = kill2(signal);
4850
+ setKillTimeout2(kill2, signal, options, killResult);
4851
+ return killResult;
4852
+ };
4853
+ var setKillTimeout2 = (kill2, signal, options, killResult) => {
4854
+ if (!shouldForceKill2(signal, options, killResult)) {
4855
+ return;
4856
+ }
4857
+ const timeout = getForceKillAfterTimeout2(options);
4858
+ const t = setTimeout(() => {
4859
+ kill2("SIGKILL");
4860
+ }, timeout);
4861
+ if (t.unref) {
4862
+ t.unref();
4863
+ }
4864
+ };
4865
+ var shouldForceKill2 = (signal, { forceKillAfterTimeout }, killResult) => isSigterm2(signal) && forceKillAfterTimeout !== false && killResult;
4866
+ var isSigterm2 = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
4867
+ var getForceKillAfterTimeout2 = ({ forceKillAfterTimeout = true }) => {
4868
+ if (forceKillAfterTimeout === true) {
4869
+ return DEFAULT_FORCE_KILL_TIMEOUT2;
4870
+ }
4871
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
4872
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
4873
+ }
4874
+ return forceKillAfterTimeout;
4875
+ };
4876
+ var spawnedCancel2 = (spawned, context) => {
4877
+ const killResult = spawned.kill();
4878
+ if (killResult) {
4879
+ context.isCanceled = true;
4880
+ }
4881
+ };
4882
+ var timeoutKill2 = (spawned, signal, reject) => {
4883
+ spawned.kill(signal);
4884
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
4885
+ };
4886
+ var setupTimeout2 = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
4887
+ if (timeout === 0 || timeout === void 0) {
4888
+ return spawnedPromise;
4889
+ }
4890
+ let timeoutId;
4891
+ const timeoutPromise = new Promise((resolve, reject) => {
4892
+ timeoutId = setTimeout(() => {
4893
+ timeoutKill2(spawned, killSignal, reject);
4894
+ }, timeout);
4895
+ });
4896
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
4897
+ clearTimeout(timeoutId);
4898
+ });
4899
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
4900
+ };
4901
+ var validateTimeout2 = ({ timeout }) => {
4902
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
4903
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
4904
+ }
4905
+ };
4906
+ var setExitHandler2 = async (spawned, { cleanup, detached }, timedPromise) => {
4907
+ if (!cleanup || detached) {
4908
+ return timedPromise;
4909
+ }
4910
+ const removeExitHandler = onExit2(() => {
4911
+ spawned.kill();
4912
+ });
4913
+ return timedPromise.finally(() => {
4914
+ removeExitHandler();
4915
+ });
4916
+ };
4917
+ var isExecaChildProcess = (target) => target instanceof childProcess2.ChildProcess && typeof target.then === "function";
4918
+ var pipeToTarget = (spawned, streamName, target) => {
4919
+ if (typeof target === "string") {
4920
+ spawned[streamName].pipe(fs.createWriteStream(target));
4921
+ return spawned;
4922
+ }
4923
+ if (isWritableStream(target)) {
4924
+ spawned[streamName].pipe(target);
4925
+ return spawned;
4926
+ }
4927
+ if (!isExecaChildProcess(target)) {
4928
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
4929
+ }
4930
+ if (!isWritableStream(target.stdin)) {
4931
+ throw new TypeError("The target child process's stdin must be available.");
4932
+ }
4933
+ spawned[streamName].pipe(target.stdin);
4934
+ return target;
4935
+ };
4936
+ var addPipeMethods = (spawned) => {
4937
+ if (spawned.stdout !== null) {
4938
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
4939
+ }
4940
+ if (spawned.stderr !== null) {
4941
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
4942
+ }
4943
+ if (spawned.all !== void 0) {
4944
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
4945
+ }
4946
+ };
4947
+
4948
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
4949
+ var getStreamContents = async (stream2, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
4950
+ if (!isAsyncIterable(stream2)) {
4951
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
4952
+ }
4953
+ const state = init();
4954
+ state.length = 0;
4955
+ try {
4956
+ for await (const chunk of stream2) {
4957
+ const chunkType = getChunkType(chunk);
4958
+ const convertedChunk = convertChunk[chunkType](chunk, state);
4959
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4960
+ }
4961
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
4962
+ return finalize(state);
4963
+ } catch (error) {
4964
+ error.bufferedData = finalize(state);
4965
+ throw error;
4966
+ }
4967
+ };
4968
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
4969
+ const convertedChunk = getFinalChunk(state);
4970
+ if (convertedChunk !== void 0) {
4971
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4972
+ }
4973
+ };
4974
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
4975
+ const chunkSize = getSize(convertedChunk);
4976
+ const newLength = state.length + chunkSize;
4977
+ if (newLength <= maxBuffer) {
4978
+ addNewChunk(convertedChunk, state, addChunk, newLength);
4979
+ return;
4980
+ }
4981
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
4982
+ if (truncatedChunk !== void 0) {
4983
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
4984
+ }
4985
+ throw new MaxBufferError();
4986
+ };
4987
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
4988
+ state.contents = addChunk(convertedChunk, state, newLength);
4989
+ state.length = newLength;
4990
+ };
4991
+ var isAsyncIterable = (stream2) => typeof stream2 === "object" && stream2 !== null && typeof stream2[Symbol.asyncIterator] === "function";
4992
+ var getChunkType = (chunk) => {
4993
+ const typeOfChunk = typeof chunk;
4994
+ if (typeOfChunk === "string") {
4995
+ return "string";
4996
+ }
4997
+ if (typeOfChunk !== "object" || chunk === null) {
4998
+ return "others";
4999
+ }
5000
+ if (globalThis.Buffer?.isBuffer(chunk)) {
5001
+ return "buffer";
5002
+ }
5003
+ const prototypeName = objectToString.call(chunk);
5004
+ if (prototypeName === "[object ArrayBuffer]") {
5005
+ return "arrayBuffer";
5006
+ }
5007
+ if (prototypeName === "[object DataView]") {
5008
+ return "dataView";
5009
+ }
5010
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
5011
+ return "typedArray";
5012
+ }
5013
+ return "others";
5014
+ };
5015
+ var { toString: objectToString } = Object.prototype;
5016
+ var MaxBufferError = class extends Error {
5017
+ name = "MaxBufferError";
5018
+ constructor() {
5019
+ super("maxBuffer exceeded");
5020
+ }
5021
+ };
5022
+
5023
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
5024
+ var identity = (value) => value;
5025
+ var noop = () => void 0;
5026
+ var getContentsProp = ({ contents }) => contents;
5027
+ var throwObjectStream = (chunk) => {
5028
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
5029
+ };
5030
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
5031
+
5032
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
5033
+ async function getStreamAsArrayBuffer(stream2, options) {
5034
+ return getStreamContents(stream2, arrayBufferMethods, options);
5035
+ }
5036
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
5037
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
5038
+ var textEncoder = new TextEncoder();
5039
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
5040
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
5041
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
5042
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
5043
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
5044
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
5045
+ return newContents;
5046
+ };
5047
+ var resizeArrayBufferSlow = (contents, length) => {
5048
+ if (length <= contents.byteLength) {
5049
+ return contents;
5050
+ }
5051
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
5052
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
5053
+ return arrayBuffer;
5054
+ };
5055
+ var resizeArrayBuffer = (contents, length) => {
5056
+ if (length <= contents.maxByteLength) {
5057
+ contents.resize(length);
5058
+ return contents;
5059
+ }
5060
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
5061
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
5062
+ return arrayBuffer;
5063
+ };
5064
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
5065
+ var SCALE_FACTOR = 2;
5066
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
5067
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
5068
+ var arrayBufferMethods = {
5069
+ init: initArrayBuffer,
5070
+ convertChunk: {
5071
+ string: useTextEncoder,
5072
+ buffer: useUint8Array,
5073
+ arrayBuffer: useUint8Array,
5074
+ dataView: useUint8ArrayWithOffset,
5075
+ typedArray: useUint8ArrayWithOffset,
5076
+ others: throwObjectStream
5077
+ },
5078
+ getSize: getLengthProp,
5079
+ truncateChunk: truncateArrayBufferChunk,
5080
+ addChunk: addArrayBufferChunk,
5081
+ getFinalChunk: noop,
5082
+ finalize: finalizeArrayBuffer
5083
+ };
5084
+
5085
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
5086
+ async function getStreamAsBuffer(stream2, options) {
5087
+ if (!("Buffer" in globalThis)) {
5088
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
5089
+ }
5090
+ try {
5091
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream2, options));
5092
+ } catch (error) {
5093
+ if (error.bufferedData !== void 0) {
5094
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
5095
+ }
5096
+ throw error;
5097
+ }
5098
+ }
5099
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
5100
+
5101
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
5102
+ async function getStreamAsString(stream2, options) {
5103
+ return getStreamContents(stream2, stringMethods, options);
5104
+ }
5105
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
5106
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
5107
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
5108
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
5109
+ var getFinalStringChunk = ({ textDecoder }) => {
5110
+ const finalChunk = textDecoder.decode();
5111
+ return finalChunk === "" ? void 0 : finalChunk;
5112
+ };
5113
+ var stringMethods = {
5114
+ init: initString,
5115
+ convertChunk: {
5116
+ string: identity,
5117
+ buffer: useTextDecoder,
5118
+ arrayBuffer: useTextDecoder,
5119
+ dataView: useTextDecoder,
5120
+ typedArray: useTextDecoder,
5121
+ others: throwObjectStream
5122
+ },
5123
+ getSize: getLengthProp,
5124
+ truncateChunk: truncateStringChunk,
5125
+ addChunk: addStringChunk,
5126
+ getFinalChunk: getFinalStringChunk,
5127
+ finalize: getContentsProp
5128
+ };
5129
+
5130
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
5131
+ var import_merge_stream2 = __toESM(require_merge_stream());
5132
+ var validateInputOptions = (input) => {
5133
+ if (input !== void 0) {
5134
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
5135
+ }
5136
+ };
5137
+ var getInput = ({ input, inputFile }) => {
5138
+ if (typeof inputFile !== "string") {
5139
+ return input;
5140
+ }
5141
+ validateInputOptions(input);
5142
+ return fs.createReadStream(inputFile);
5143
+ };
5144
+ var handleInput2 = (spawned, options) => {
5145
+ const input = getInput(options);
5146
+ if (input === void 0) {
5147
+ return;
5148
+ }
5149
+ if (isStream(input)) {
5150
+ input.pipe(spawned.stdin);
5151
+ } else {
5152
+ spawned.stdin.end(input);
5153
+ }
5154
+ };
5155
+ var makeAllStream2 = (spawned, { all }) => {
5156
+ if (!all || !spawned.stdout && !spawned.stderr) {
5157
+ return;
5158
+ }
5159
+ const mixed = (0, import_merge_stream2.default)();
5160
+ if (spawned.stdout) {
5161
+ mixed.add(spawned.stdout);
5162
+ }
5163
+ if (spawned.stderr) {
5164
+ mixed.add(spawned.stderr);
5165
+ }
5166
+ return mixed;
5167
+ };
5168
+ var getBufferedData2 = async (stream2, streamPromise) => {
5169
+ if (!stream2 || streamPromise === void 0) {
5170
+ return;
5171
+ }
5172
+ await promises$1.setTimeout(0);
5173
+ stream2.destroy();
5174
+ try {
5175
+ return await streamPromise;
5176
+ } catch (error) {
5177
+ return error.bufferedData;
5178
+ }
5179
+ };
5180
+ var getStreamPromise2 = (stream2, { encoding, buffer, maxBuffer }) => {
5181
+ if (!stream2 || !buffer) {
5182
+ return;
5183
+ }
5184
+ if (encoding === "utf8" || encoding === "utf-8") {
5185
+ return getStreamAsString(stream2, { maxBuffer });
5186
+ }
5187
+ if (encoding === null || encoding === "buffer") {
5188
+ return getStreamAsBuffer(stream2, { maxBuffer });
5189
+ }
5190
+ return applyEncoding(stream2, maxBuffer, encoding);
5191
+ };
5192
+ var applyEncoding = async (stream2, maxBuffer, encoding) => {
5193
+ const buffer = await getStreamAsBuffer(stream2, { maxBuffer });
5194
+ return buffer.toString(encoding);
5195
+ };
5196
+ var getSpawnedResult2 = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
5197
+ const stdoutPromise = getStreamPromise2(stdout, { encoding, buffer, maxBuffer });
5198
+ const stderrPromise = getStreamPromise2(stderr, { encoding, buffer, maxBuffer });
5199
+ const allPromise = getStreamPromise2(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
5200
+ try {
5201
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
5202
+ } catch (error) {
5203
+ return Promise.all([
5204
+ { error, signal: error.signal, timedOut: error.timedOut },
5205
+ getBufferedData2(stdout, stdoutPromise),
5206
+ getBufferedData2(stderr, stderrPromise),
5207
+ getBufferedData2(all, allPromise)
5208
+ ]);
5209
+ }
5210
+ };
5211
+
5212
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
5213
+ var nativePromisePrototype2 = (async () => {
5214
+ })().constructor.prototype;
5215
+ var descriptors2 = ["then", "catch", "finally"].map((property) => [
5216
+ property,
5217
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype2, property)
5218
+ ]);
5219
+ var mergePromise2 = (spawned, promise) => {
5220
+ for (const [property, descriptor] of descriptors2) {
5221
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
5222
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
5223
+ }
5224
+ };
5225
+ var getSpawnedPromise2 = (spawned) => new Promise((resolve, reject) => {
5226
+ spawned.on("exit", (exitCode, signal) => {
5227
+ resolve({ exitCode, signal });
5228
+ });
5229
+ spawned.on("error", (error) => {
5230
+ reject(error);
5231
+ });
5232
+ if (spawned.stdin) {
5233
+ spawned.stdin.on("error", (error) => {
5234
+ reject(error);
5235
+ });
5236
+ }
5237
+ });
5238
+ var normalizeArgs2 = (file, args = []) => {
5239
+ if (!Array.isArray(args)) {
5240
+ return [file];
5241
+ }
5242
+ return [file, ...args];
5243
+ };
5244
+ var NO_ESCAPE_REGEXP2 = /^[\w.-]+$/;
5245
+ var escapeArg2 = (arg) => {
5246
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP2.test(arg)) {
5247
+ return arg;
5248
+ }
5249
+ return `"${arg.replaceAll('"', '\\"')}"`;
5250
+ };
5251
+ var joinCommand2 = (file, args) => normalizeArgs2(file, args).join(" ");
5252
+ var getEscapedCommand2 = (file, args) => normalizeArgs2(file, args).map((arg) => escapeArg2(arg)).join(" ");
5253
+ var verboseDefault = util$1.debuglog("execa").enabled;
5254
+ var padField = (field, padding) => String(field).padStart(padding, "0");
5255
+ var getTimestamp = () => {
5256
+ const date = /* @__PURE__ */ new Date();
5257
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
5258
+ };
5259
+ var logCommand = (escapedCommand, { verbose }) => {
5260
+ if (!verbose) {
5261
+ return;
5262
+ }
5263
+ process2__default.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
5264
+ `);
5265
+ };
5266
+
5267
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
5268
+ var DEFAULT_MAX_BUFFER2 = 1e3 * 1e3 * 100;
5269
+ var getEnv2 = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
5270
+ const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
5271
+ if (preferLocal) {
5272
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
5273
+ }
5274
+ return env;
5275
+ };
5276
+ var handleArguments2 = (file, args, options = {}) => {
5277
+ const parsed = import_cross_spawn2.default._parse(file, args, options);
5278
+ file = parsed.command;
5279
+ args = parsed.args;
5280
+ options = parsed.options;
5281
+ options = {
5282
+ maxBuffer: DEFAULT_MAX_BUFFER2,
5283
+ buffer: true,
5284
+ stripFinalNewline: true,
5285
+ extendEnv: true,
5286
+ preferLocal: false,
5287
+ localDir: options.cwd || process2__default.default.cwd(),
5288
+ execPath: process2__default.default.execPath,
5289
+ encoding: "utf8",
5290
+ reject: true,
5291
+ cleanup: true,
5292
+ all: false,
5293
+ windowsHide: true,
5294
+ verbose: verboseDefault,
5295
+ ...options
5296
+ };
5297
+ options.env = getEnv2(options);
5298
+ options.stdio = normalizeStdio2(options);
5299
+ if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
5300
+ args.unshift("/q");
5301
+ }
5302
+ return { file, args, options, parsed };
5303
+ };
5304
+ var handleOutput2 = (options, value, error) => {
5305
+ if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
5306
+ return error === void 0 ? void 0 : "";
5307
+ }
5308
+ if (options.stripFinalNewline) {
5309
+ return stripFinalNewline(value);
5310
+ }
5311
+ return value;
5312
+ };
5313
+ function execa2(file, args, options) {
5314
+ const parsed = handleArguments2(file, args, options);
5315
+ const command = joinCommand2(file, args);
5316
+ const escapedCommand = getEscapedCommand2(file, args);
5317
+ logCommand(escapedCommand, parsed.options);
5318
+ validateTimeout2(parsed.options);
5319
+ let spawned;
5320
+ try {
5321
+ spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
5322
+ } catch (error) {
5323
+ const dummySpawned = new childProcess2__default.default.ChildProcess();
5324
+ const errorPromise = Promise.reject(makeError2({
5325
+ error,
5326
+ stdout: "",
5327
+ stderr: "",
5328
+ all: "",
5329
+ command,
5330
+ escapedCommand,
5331
+ parsed,
5332
+ timedOut: false,
5333
+ isCanceled: false,
5334
+ killed: false
5335
+ }));
5336
+ mergePromise2(dummySpawned, errorPromise);
5337
+ return dummySpawned;
5338
+ }
5339
+ const spawnedPromise = getSpawnedPromise2(spawned);
5340
+ const timedPromise = setupTimeout2(spawned, parsed.options, spawnedPromise);
5341
+ const processDone = setExitHandler2(spawned, parsed.options, timedPromise);
5342
+ const context = { isCanceled: false };
5343
+ spawned.kill = spawnedKill2.bind(null, spawned.kill.bind(spawned));
5344
+ spawned.cancel = spawnedCancel2.bind(null, spawned, context);
5345
+ const handlePromise = async () => {
5346
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult2(spawned, parsed.options, processDone);
5347
+ const stdout = handleOutput2(parsed.options, stdoutResult);
5348
+ const stderr = handleOutput2(parsed.options, stderrResult);
5349
+ const all = handleOutput2(parsed.options, allResult);
5350
+ if (error || exitCode !== 0 || signal !== null) {
5351
+ const returnedError = makeError2({
5352
+ error,
5353
+ exitCode,
5354
+ signal,
5355
+ stdout,
5356
+ stderr,
5357
+ all,
5358
+ command,
5359
+ escapedCommand,
5360
+ parsed,
5361
+ timedOut,
5362
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
5363
+ killed: spawned.killed
5364
+ });
5365
+ if (!parsed.options.reject) {
5366
+ return returnedError;
5367
+ }
5368
+ throw returnedError;
5369
+ }
5370
+ return {
5371
+ command,
5372
+ escapedCommand,
5373
+ exitCode: 0,
5374
+ stdout,
5375
+ stderr,
5376
+ all,
5377
+ failed: false,
5378
+ timedOut: false,
5379
+ isCanceled: false,
5380
+ killed: false
5381
+ };
5382
+ };
5383
+ const handlePromiseOnce = onetime_default(handlePromise);
5384
+ handleInput2(spawned, parsed.options);
5385
+ spawned.all = makeAllStream2(spawned, parsed.options);
5386
+ addPipeMethods(spawned);
5387
+ mergePromise2(spawned, handlePromiseOnce);
5388
+ return spawned;
5389
+ }
5390
+
5391
+ // ../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js
5392
+ function indentString(string, count = 1, options = {}) {
5393
+ const {
5394
+ indent = " ",
5395
+ includeEmptyLines = false
5396
+ } = options;
5397
+ if (typeof string !== "string") {
5398
+ throw new TypeError(
5399
+ `Expected \`input\` to be a \`string\`, got \`${typeof string}\``
5400
+ );
5401
+ }
5402
+ if (typeof count !== "number") {
5403
+ throw new TypeError(
5404
+ `Expected \`count\` to be a \`number\`, got \`${typeof count}\``
5405
+ );
5406
+ }
5407
+ if (count < 0) {
5408
+ throw new RangeError(
5409
+ `Expected \`count\` to be at least 0, got \`${count}\``
5410
+ );
5411
+ }
5412
+ if (typeof indent !== "string") {
5413
+ throw new TypeError(
5414
+ `Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
5415
+ );
5416
+ }
5417
+ if (count === 0) {
5418
+ return string;
5419
+ }
5420
+ const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
5421
+ return string.replace(regex, indent.repeat(count));
5422
+ }
5423
+
5424
+ // ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
5425
+ function escapeStringRegexp(string) {
5426
+ if (typeof string !== "string") {
5427
+ throw new TypeError("Expected a string");
5428
+ }
5429
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
5430
+ }
5431
+ var getHomeDirectory = () => os__default.default.homedir().replace(/\\/g, "/");
5432
+ var home_directory_default = getHomeDirectory;
5433
+
5434
+ // ../../node_modules/.pnpm/clean-stack@5.3.0/node_modules/clean-stack/index.js
5435
+ var extractPathRegex = /\s+at.*[(\s](.*)\)?/;
5436
+ var pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
5437
+ function cleanStack(stack, { pretty = false, basePath, pathFilter } = {}) {
5438
+ const basePathRegex = basePath && new RegExp(`(file://)?${escapeStringRegexp(basePath.replace(/\\/g, "/"))}/?`, "g");
5439
+ const homeDirectory = pretty ? home_directory_default() : "";
5440
+ if (typeof stack !== "string") {
5441
+ return void 0;
5442
+ }
5443
+ return stack.replace(/\\/g, "/").split("\n").filter((line) => {
5444
+ const pathMatches = line.match(extractPathRegex);
5445
+ if (pathMatches === null || !pathMatches[1]) {
5446
+ return true;
5447
+ }
5448
+ const match2 = pathMatches[1];
5449
+ if (match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") || match2.includes("node_modules/electron/dist/resources/electron.asar") || match2.includes("node_modules/electron/dist/resources/default_app.asar")) {
5450
+ return false;
5451
+ }
5452
+ return pathFilter ? !pathRegex.test(match2) && pathFilter(match2) : !pathRegex.test(match2);
5453
+ }).filter((line) => line.trim() !== "").map((line) => {
5454
+ if (basePathRegex) {
5455
+ line = line.replace(basePathRegex, "");
5456
+ }
5457
+ if (pretty) {
5458
+ line = line.replace(extractPathRegex, (m, p1) => {
5459
+ let filePath = p1;
5460
+ if (filePath.startsWith("file://")) {
5461
+ filePath = url.fileURLToPath(filePath);
5462
+ }
5463
+ filePath = filePath.replace(homeDirectory, "~");
5464
+ return m.replace(p1, filePath);
5465
+ });
5466
+ }
5467
+ return line;
5468
+ }).join("\n");
5469
+ }
5470
+
5471
+ // ../../node_modules/.pnpm/aggregate-error@5.0.0/node_modules/aggregate-error/index.js
5472
+ var cleanInternalStack = (stack) => stack.replaceAll(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
5473
+ var AggregateError = class extends Error {
5474
+ #errors;
5475
+ name = "AggregateError";
5476
+ constructor(errors) {
5477
+ if (!Array.isArray(errors)) {
5478
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
5479
+ }
5480
+ errors = errors.map((error) => {
5481
+ if (error instanceof Error) {
5482
+ return error;
5483
+ }
5484
+ if (error !== null && typeof error === "object") {
5485
+ return Object.assign(new Error(error.message), error);
5486
+ }
5487
+ return new Error(error);
5488
+ });
5489
+ let message = errors.map(
5490
+ (error) => (
5491
+ // The `stack` property is not standardized, so we can't assume it exists
5492
+ typeof error.stack === "string" && error.stack.length > 0 ? cleanInternalStack(cleanStack(error.stack)) : String(error)
5493
+ )
5494
+ ).join("\n");
5495
+ message = "\n" + indentString(message, 4);
5496
+ super(message);
5497
+ this.#errors = errors;
5498
+ }
5499
+ get errors() {
5500
+ return [...this.#errors];
5501
+ }
5502
+ };
5503
+ var netstat = async (type) => {
5504
+ const { stdout } = await execa2("netstat", ["-anv", "-p", type]);
5505
+ return stdout;
5506
+ };
5507
+ var macos = async () => {
5508
+ const result = await Promise.all([
5509
+ netstat("tcp"),
5510
+ netstat("udp")
5511
+ ]);
5512
+ const tcp = result[0];
5513
+ const headerStart = tcp.indexOf("\n") + 1;
5514
+ const header = tcp.slice(headerStart, tcp.indexOf("\n", headerStart));
5515
+ return {
5516
+ stdout: result.join("\n"),
5517
+ addressColumn: 3,
5518
+ // Some versions of macOS print two extra columns for rxbytes and
5519
+ // txbytes before pid. Unfortunately headers can't be parsed because
5520
+ // they're space separated but some contain spaces, so we use this
5521
+ // heuristic to distinguish the two netstat versions.
5522
+ pidColumn: header.includes("rxbytes") ? 10 : 8
5523
+ };
5524
+ };
5525
+ var linux = async () => {
5526
+ const { stdout } = await execa2("ss", ["-tunlp"]);
5527
+ return {
5528
+ stdout,
5529
+ addressColumn: 4,
5530
+ pidColumn: 6
5531
+ };
5532
+ };
5533
+ var windows = async () => {
5534
+ const { stdout } = await execa2("netstat", ["-ano"]);
5535
+ return {
5536
+ stdout,
5537
+ addressColumn: 1,
5538
+ pidColumn: 4
5539
+ };
5540
+ };
5541
+ var isProtocol = (value) => /^\s*(tcp|udp)/i.test(value);
5542
+ var parsePid = (pid) => {
5543
+ if (typeof pid !== "string") {
5544
+ return;
5545
+ }
5546
+ const { groups } = /(?:^|",|",pid=)(?<pid>\d+)/.exec(pid) || {};
5547
+ if (groups) {
5548
+ return Number.parseInt(groups.pid, 10);
5549
+ }
5550
+ };
5551
+ var getPort = (port, { lines, addressColumn, pidColumn }) => {
5552
+ const regex = new RegExp(`[.:]${port}$`);
5553
+ const foundPort = lines.find((line) => regex.test(line[addressColumn]));
5554
+ if (!foundPort) {
5555
+ throw new Error(`Could not find a process that uses port \`${port}\``);
5556
+ }
5557
+ return parsePid(foundPort[pidColumn]);
5558
+ };
5559
+ var implementation = process2__default.default.platform === "darwin" ? macos : process2__default.default.platform === "linux" ? linux : windows;
5560
+ var getList = async () => {
5561
+ const { stdout, addressColumn, pidColumn } = await implementation();
5562
+ const lines = stdout.split("\n").filter((line) => isProtocol(line)).map((line) => line.match(/\S+/g) || []);
5563
+ return { lines, addressColumn, pidColumn };
5564
+ };
5565
+ async function portToPid(port) {
5566
+ if (Array.isArray(port)) {
5567
+ const list = await getList();
5568
+ const tuples = await Promise.all(port.map((port_) => [port_, getPort(port_, list)]));
5569
+ return new Map(tuples);
5570
+ }
5571
+ if (!Number.isInteger(port)) {
5572
+ throw new TypeError(`Expected an integer, got ${typeof port}`);
5573
+ }
5574
+ return getPort(port, await getList());
5575
+ }
5576
+ var __dirname$1 = path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('server.cjs', document.baseURI).href))));
5577
+ var TEN_MEGABYTES = 1e3 * 1e3 * 10;
5578
+ var execFile = util$1.promisify(childProcess2__default.default.execFile);
5579
+ var windows2 = async () => {
5580
+ let binary;
5581
+ switch (process2__default.default.arch) {
5582
+ case "x64":
5583
+ binary = "fastlist-0.3.0-x64.exe";
5584
+ break;
5585
+ case "ia32":
5586
+ binary = "fastlist-0.3.0-x86.exe";
5587
+ break;
5588
+ default:
5589
+ throw new Error(`Unsupported architecture: ${process2__default.default.arch}`);
5590
+ }
5591
+ const binaryPath = path__default.default.join(__dirname$1, "vendor", binary);
5592
+ const { stdout } = await execFile(binaryPath, {
5593
+ maxBuffer: TEN_MEGABYTES,
5594
+ windowsHide: true
5595
+ });
5596
+ return stdout.trim().split("\r\n").map((line) => line.split(" ")).map(([pid, ppid, name]) => ({
5597
+ pid: Number.parseInt(pid, 10),
5598
+ ppid: Number.parseInt(ppid, 10),
5599
+ name
5600
+ }));
5601
+ };
5602
+ var nonWindowsMultipleCalls = async (options = {}) => {
5603
+ const flags = (options.all === false ? "" : "a") + "wwxo";
5604
+ const returnValue = {};
5605
+ await Promise.all(["comm", "args", "ppid", "uid", "%cpu", "%mem"].map(async (cmd) => {
5606
+ const { stdout } = await execFile("ps", [flags, `pid,${cmd}`], { maxBuffer: TEN_MEGABYTES });
5607
+ for (let line of stdout.trim().split("\n").slice(1)) {
5608
+ line = line.trim();
5609
+ const [pid] = line.split(" ", 1);
5610
+ const value = line.slice(pid.length + 1).trim();
5611
+ if (returnValue[pid] === void 0) {
5612
+ returnValue[pid] = {};
5613
+ }
5614
+ returnValue[pid][cmd] = value;
5615
+ }
5616
+ }));
5617
+ return Object.entries(returnValue).filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value["%cpu"] && value["%mem"]).map(([key, value]) => ({
5618
+ pid: Number.parseInt(key, 10),
5619
+ name: path__default.default.basename(value.comm),
5620
+ cmd: value.args,
5621
+ ppid: Number.parseInt(value.ppid, 10),
5622
+ uid: Number.parseInt(value.uid, 10),
5623
+ cpu: Number.parseFloat(value["%cpu"]),
5624
+ memory: Number.parseFloat(value["%mem"])
5625
+ }));
5626
+ };
5627
+ var ERROR_MESSAGE_PARSING_FAILED = "ps output parsing failed";
5628
+ var psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>[-\d]+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+(?<comm>.*)?/;
5629
+ var nonWindowsCall = async (options = {}) => {
5630
+ const flags = options.all === false ? "wwxo" : "awwxo";
5631
+ const psPromises = [
5632
+ execFile("ps", [flags, "pid,ppid,uid,%cpu,%mem,comm"], { maxBuffer: TEN_MEGABYTES }),
5633
+ execFile("ps", [flags, "pid,args"], { maxBuffer: TEN_MEGABYTES })
5634
+ ];
5635
+ const [psLines, psArgsLines] = (await Promise.all(psPromises)).map(({ stdout }) => stdout.trim().split("\n"));
5636
+ const psPids = new Set(psPromises.map((promise) => promise.child.pid));
5637
+ psLines.shift();
5638
+ psArgsLines.shift();
5639
+ const processCmds = {};
5640
+ for (const line of psArgsLines) {
5641
+ const [pid, cmds] = line.trim().split(" ");
5642
+ processCmds[pid] = cmds.join(" ");
5643
+ }
5644
+ const processes = psLines.map((line) => {
5645
+ const match2 = psOutputRegex.exec(line);
5646
+ if (match2 === null) {
5647
+ throw new Error(ERROR_MESSAGE_PARSING_FAILED);
5648
+ }
5649
+ const { pid, ppid, uid, cpu, memory, comm } = match2.groups;
5650
+ const processInfo = {
5651
+ pid: Number.parseInt(pid, 10),
5652
+ ppid: Number.parseInt(ppid, 10),
5653
+ uid: Number.parseInt(uid, 10),
5654
+ cpu: Number.parseFloat(cpu),
5655
+ memory: Number.parseFloat(memory),
5656
+ name: path__default.default.basename(comm),
5657
+ cmd: processCmds[pid]
5658
+ };
5659
+ return processInfo;
5660
+ }).filter((processInfo) => !psPids.has(processInfo.pid));
5661
+ return processes;
5662
+ };
5663
+ var nonWindows = async (options = {}) => {
5664
+ try {
5665
+ return await nonWindowsCall(options);
5666
+ } catch {
5667
+ return nonWindowsMultipleCalls(options);
5668
+ }
5669
+ };
5670
+ var psList = process2__default.default.platform === "win32" ? windows2 : nonWindows;
5671
+ var ps_list_default = psList;
5672
+
5673
+ // ../../node_modules/.pnpm/process-exists@5.0.0/node_modules/process-exists/index.js
5674
+ var linuxProcessMatchesName = (wantedProcessName, process13) => {
5675
+ if (typeof wantedProcessName === "string") {
5676
+ return process13.name === wantedProcessName || process13.cmd.split(" ")[0] === wantedProcessName;
5677
+ }
5678
+ return process13.pid === wantedProcessName;
5679
+ };
5680
+ var nonLinuxProcessMatchesName = (wantedProcessName, process13) => {
5681
+ if (typeof wantedProcessName === "string") {
5682
+ return process13.name === wantedProcessName;
5683
+ }
5684
+ return process13.pid === wantedProcessName;
2146
5685
  };
2147
- var X_ALREADY_SENT = "x-hono-already-sent";
2148
- var webFetch = global.fetch;
2149
- if (typeof global.crypto === "undefined") {
2150
- global.crypto = crypto__default.default;
5686
+ var processMatchesName = process2__default.default.platform === "linux" ? linuxProcessMatchesName : nonLinuxProcessMatchesName;
5687
+ async function processExistsMultiple(processNames) {
5688
+ const processes = await ps_list_default();
5689
+ return new Map(processNames.map((processName) => [processName, processes.some((y) => processMatchesName(processName, y))]));
2151
5690
  }
2152
- global.fetch = (info, init) => {
2153
- init = {
2154
- // Disable compression handling so people can return the result of a fetch
2155
- // directly in the loader without messing with the Content-Encoding header.
2156
- compress: false,
2157
- ...init
2158
- };
2159
- return webFetch(info, init);
2160
- };
2161
- var outgoingEnded = Symbol("outgoingEnded");
2162
- var handleRequestError = () => new Response(null, {
2163
- status: 400
2164
- });
2165
- var handleFetchError = (e) => new Response(null, {
2166
- status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
5691
+ async function filterExistingProcesses(processNames) {
5692
+ const processes = await ps_list_default();
5693
+ return processNames.filter((processName) => processes.some((process_) => processMatchesName(processName, process_)));
5694
+ }
5695
+
5696
+ // ../../node_modules/.pnpm/fkill@9.0.0/node_modules/fkill/index.js
5697
+ var ALIVE_CHECK_MIN_INTERVAL = 5;
5698
+ var ALIVE_CHECK_MAX_INTERVAL = 1280;
5699
+ var TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM = 255;
5700
+ var delay = (ms) => new Promise((resolve) => {
5701
+ setTimeout(resolve, ms);
2167
5702
  });
2168
- var handleResponseError = (e, outgoing) => {
2169
- const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
2170
- if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
2171
- console.info("The user aborted a request.");
2172
- } else {
2173
- console.error(e);
2174
- if (!outgoing.headersSent) {
2175
- outgoing.writeHead(500, { "Content-Type": "text/plain" });
5703
+ var missingBinaryError = async (command, arguments_) => {
5704
+ try {
5705
+ return await execa2(command, arguments_);
5706
+ } catch (error) {
5707
+ if (error.code === "ENOENT") {
5708
+ const newError = new Error(`\`${command}\` doesn't seem to be installed and is required by fkill`);
5709
+ newError.sourceError = error;
5710
+ throw newError;
2176
5711
  }
2177
- outgoing.end(`Error: ${err.message}`);
2178
- outgoing.destroy(err);
5712
+ throw error;
2179
5713
  }
2180
5714
  };
2181
- var flushHeaders = (outgoing) => {
2182
- if ("flushHeaders" in outgoing && outgoing.writable) {
2183
- outgoing.flushHeaders();
5715
+ var windowsKill = async (input, options) => {
5716
+ try {
5717
+ return await taskkill(input, {
5718
+ force: options.force,
5719
+ tree: options.tree === void 0 ? true : options.tree
5720
+ });
5721
+ } catch (error) {
5722
+ if (error.exitCode === TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM && !options.force) {
5723
+ return;
5724
+ }
5725
+ throw error;
2184
5726
  }
2185
5727
  };
2186
- var responseViaCache = async (res, outgoing) => {
2187
- let [status, body, header] = res[cacheKey];
2188
- if (header instanceof Headers) {
2189
- header = buildOutgoingHttpHeaders(header);
5728
+ var macosKill = (input, options) => {
5729
+ const killByName = typeof input === "string";
5730
+ const command = killByName ? "pkill" : "kill";
5731
+ const arguments_ = [input];
5732
+ if (killByName && options.ignoreCase) {
5733
+ arguments_.unshift("-i");
5734
+ }
5735
+ if (killByName) {
5736
+ arguments_.unshift("-x");
5737
+ }
5738
+ if (options.force) {
5739
+ if (killByName) {
5740
+ arguments_.unshift("-KILL");
5741
+ } else {
5742
+ arguments_.unshift("-9");
5743
+ }
2190
5744
  }
2191
- if (typeof body === "string") {
2192
- header["Content-Length"] = Buffer.byteLength(body);
2193
- } else if (body instanceof Uint8Array) {
2194
- header["Content-Length"] = body.byteLength;
2195
- } else if (body instanceof Blob) {
2196
- header["Content-Length"] = body.size;
5745
+ return missingBinaryError(command, arguments_);
5746
+ };
5747
+ var defaultKill = (input, options) => {
5748
+ const killByName = typeof input === "string";
5749
+ const command = killByName ? "killall" : "kill";
5750
+ const arguments_ = [input];
5751
+ if (options.force) {
5752
+ arguments_.unshift("-9");
2197
5753
  }
2198
- outgoing.writeHead(status, header);
2199
- if (typeof body === "string" || body instanceof Uint8Array) {
2200
- outgoing.end(body);
2201
- } else if (body instanceof Blob) {
2202
- outgoing.end(new Uint8Array(await body.arrayBuffer()));
2203
- } else {
2204
- flushHeaders(outgoing);
2205
- await writeFromReadableStream(body, outgoing)?.catch(
2206
- (e) => handleResponseError(e, outgoing)
2207
- );
5754
+ if (killByName && options.ignoreCase) {
5755
+ arguments_.unshift("-I");
2208
5756
  }
2209
- outgoing[outgoingEnded]?.();
5757
+ return missingBinaryError(command, arguments_);
2210
5758
  };
2211
- var isPromise = (res) => typeof res.then === "function";
2212
- var responseViaResponseObject = async (res, outgoing, options = {}) => {
2213
- if (isPromise(res)) {
2214
- if (options.errorHandler) {
2215
- try {
2216
- res = await res;
2217
- } catch (err) {
2218
- const errRes = await options.errorHandler(err);
2219
- if (!errRes) {
2220
- return;
2221
- }
2222
- res = errRes;
2223
- }
2224
- } else {
2225
- res = await res.catch(handleFetchError);
2226
- }
5759
+ var kill = (() => {
5760
+ if (process2__default.default.platform === "darwin") {
5761
+ return macosKill;
2227
5762
  }
2228
- if (cacheKey in res) {
2229
- return responseViaCache(res, outgoing);
5763
+ if (process2__default.default.platform === "win32") {
5764
+ return windowsKill;
2230
5765
  }
2231
- const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
2232
- if (res.body) {
2233
- const reader = res.body.getReader();
2234
- const values = [];
2235
- let done = false;
2236
- let currentReadPromise = void 0;
2237
- if (resHeaderRecord["transfer-encoding"] !== "chunked") {
2238
- let maxReadCount = 2;
2239
- for (let i = 0; i < maxReadCount; i++) {
2240
- currentReadPromise ||= reader.read();
2241
- const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
2242
- console.error(e);
2243
- done = true;
2244
- });
2245
- if (!chunk) {
2246
- if (i === 1) {
2247
- await new Promise((resolve) => setTimeout(resolve));
2248
- maxReadCount = 3;
2249
- continue;
2250
- }
2251
- break;
2252
- }
2253
- currentReadPromise = void 0;
2254
- if (chunk.value) {
2255
- values.push(chunk.value);
2256
- }
2257
- if (chunk.done) {
2258
- done = true;
2259
- break;
2260
- }
2261
- }
2262
- if (done && !("content-length" in resHeaderRecord)) {
2263
- resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
2264
- }
2265
- }
2266
- outgoing.writeHead(res.status, resHeaderRecord);
2267
- values.forEach((value) => {
2268
- outgoing.write(value);
2269
- });
2270
- if (done) {
2271
- outgoing.end();
2272
- } else {
2273
- if (values.length === 0) {
2274
- flushHeaders(outgoing);
2275
- }
2276
- await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
2277
- }
2278
- } else if (resHeaderRecord[X_ALREADY_SENT]) ; else {
2279
- outgoing.writeHead(res.status, resHeaderRecord);
2280
- outgoing.end();
5766
+ return defaultKill;
5767
+ })();
5768
+ var parseInput = async (input) => {
5769
+ if (typeof input === "string" && input[0] === ":") {
5770
+ return portToPid(Number.parseInt(input.slice(1), 10));
2281
5771
  }
2282
- outgoing[outgoingEnded]?.();
5772
+ return input;
2283
5773
  };
2284
- var getRequestListener = (fetchCallback, options = {}) => {
2285
- const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
2286
- if (options.overrideGlobalObjects !== false && global.Request !== Request2) {
2287
- Object.defineProperty(global, "Request", {
2288
- value: Request2
2289
- });
2290
- Object.defineProperty(global, "Response", {
2291
- value: Response2
2292
- });
5774
+ var getCurrentProcessParentsPID = (processes) => {
5775
+ const processMap = new Map(processes.map((ps) => [ps.pid, ps.ppid]));
5776
+ const pids = [];
5777
+ let currentId = process2__default.default.pid;
5778
+ while (currentId) {
5779
+ pids.push(currentId);
5780
+ currentId = processMap.get(currentId);
5781
+ }
5782
+ return pids;
5783
+ };
5784
+ var killWithLimits = async (input, options) => {
5785
+ input = await parseInput(input);
5786
+ if (input === process2__default.default.pid) {
5787
+ return;
2293
5788
  }
2294
- return async (incoming, outgoing) => {
2295
- let res, req;
2296
- try {
2297
- req = newRequest(incoming, options.hostname);
2298
- let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
2299
- if (!incomingEnded) {
2300
- ;
2301
- incoming[wrapBodyStream] = true;
2302
- incoming.on("end", () => {
2303
- incomingEnded = true;
2304
- });
2305
- if (incoming instanceof http2.Http2ServerRequest) {
2306
- ;
2307
- outgoing[outgoingEnded] = () => {
2308
- if (!incomingEnded) {
2309
- setTimeout(() => {
2310
- if (!incomingEnded) {
2311
- setTimeout(() => {
2312
- incoming.destroy();
2313
- outgoing.destroy();
2314
- });
2315
- }
2316
- });
2317
- }
2318
- };
2319
- }
2320
- }
2321
- outgoing.on("close", () => {
2322
- const abortController = req[abortControllerKey];
2323
- if (abortController) {
2324
- if (incoming.errored) {
2325
- req[abortControllerKey].abort(incoming.errored.toString());
2326
- } else if (!outgoing.writableFinished) {
2327
- req[abortControllerKey].abort("Client connection prematurely closed.");
2328
- }
2329
- }
2330
- if (!incomingEnded) {
2331
- setTimeout(() => {
2332
- if (!incomingEnded) {
2333
- setTimeout(() => {
2334
- incoming.destroy();
2335
- });
2336
- }
2337
- });
2338
- }
2339
- });
2340
- res = fetchCallback(req, { incoming, outgoing });
2341
- if (cacheKey in res) {
2342
- return responseViaCache(res, outgoing);
2343
- }
2344
- } catch (e) {
2345
- if (!res) {
2346
- if (options.errorHandler) {
2347
- res = await options.errorHandler(req ? e : toRequestError(e));
2348
- if (!res) {
2349
- return;
2350
- }
2351
- } else if (!req) {
2352
- res = handleRequestError();
2353
- } else {
2354
- res = handleFetchError(e);
2355
- }
2356
- } else {
2357
- return handleResponseError(e, outgoing);
5789
+ if (input === "node" || input === "node.exe") {
5790
+ const processes = await ps_list_default();
5791
+ const pids = getCurrentProcessParentsPID(processes);
5792
+ await Promise.all(processes.map(async (ps) => {
5793
+ if ((ps.name === "node" || ps.name === "node.exe") && !pids.includes(ps.pid)) {
5794
+ await kill(ps.pid, options);
2358
5795
  }
2359
- }
5796
+ }));
5797
+ return;
5798
+ }
5799
+ await kill(input, options);
5800
+ };
5801
+ async function fkill(inputs, options = {}) {
5802
+ inputs = [inputs].flat();
5803
+ const exists = await processExistsMultiple(inputs);
5804
+ const errors = [];
5805
+ const handleKill = async (input) => {
2360
5806
  try {
2361
- return await responseViaResponseObject(res, outgoing, options);
2362
- } catch (e) {
2363
- return handleResponseError(e, outgoing);
5807
+ await killWithLimits(input, options);
5808
+ } catch (error) {
5809
+ if (!exists.get(input)) {
5810
+ errors.push(`Killing process ${input} failed: Process doesn't exist`);
5811
+ return;
5812
+ }
5813
+ errors.push(`Killing process ${input} failed: ${error.message.replace(/.*\n/, "").replace(/kill: \d+: /, "").trim()}`);
2364
5814
  }
2365
5815
  };
2366
- };
2367
- var createAdaptorServer = (options) => {
2368
- const fetchCallback = options.fetch;
2369
- const requestListener = getRequestListener(fetchCallback, {
2370
- hostname: options.hostname,
2371
- overrideGlobalObjects: options.overrideGlobalObjects,
2372
- autoCleanupIncoming: options.autoCleanupIncoming
2373
- });
2374
- const createServer2 = options.createServer || http.createServer;
2375
- const server = createServer2(options.serverOptions || {}, requestListener);
2376
- return server;
2377
- };
2378
- var serve = (options, listeningListener) => {
2379
- const server = createAdaptorServer(options);
2380
- server.listen(options?.port ?? 3e3, options.hostname, () => {
2381
- server.address();
2382
- });
2383
- return server;
2384
- };
5816
+ await Promise.all(inputs.map((input) => handleKill(input)));
5817
+ if (errors.length > 0 && !options.silent) {
5818
+ throw new AggregateError(errors);
5819
+ }
5820
+ if (options.forceAfterTimeout !== void 0 && !options.force) {
5821
+ const endTime = Date.now() + options.forceAfterTimeout;
5822
+ let interval = ALIVE_CHECK_MIN_INTERVAL;
5823
+ if (interval > options.forceAfterTimeout) {
5824
+ interval = options.forceAfterTimeout;
5825
+ }
5826
+ let alive = inputs;
5827
+ do {
5828
+ await delay(interval);
5829
+ alive = await filterExistingProcesses(alive);
5830
+ interval *= 2;
5831
+ if (interval > ALIVE_CHECK_MAX_INTERVAL) {
5832
+ interval = ALIVE_CHECK_MAX_INTERVAL;
5833
+ }
5834
+ } while (Date.now() < endTime && alive.length > 0);
5835
+ if (alive.length > 0) {
5836
+ await Promise.all(alive.map(async (input) => {
5837
+ try {
5838
+ await killWithLimits(input, { ...options, force: true });
5839
+ } catch {
5840
+ }
5841
+ }));
5842
+ }
5843
+ }
5844
+ }
2385
5845
 
2386
5846
  // src/server.ts
2387
5847
  var import_picocolors = __toESM(require_picocolors());
@@ -2412,8 +5872,8 @@ var __export = (target, all) => {
2412
5872
  });
2413
5873
  };
2414
5874
  var require_uri_all = __commonJS2((exports, module) => {
2415
- (function(global2, factory) {
2416
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global2.URI = global2.URI || {});
5875
+ (function(global22, factory) {
5876
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global22.URI = global22.URI || {});
2417
5877
  })(exports, function(exports2) {
2418
5878
  function merge() {
2419
5879
  for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
@@ -3217,8 +6677,8 @@ var require_uri_all = __commonJS2((exports, module) => {
3217
6677
  wsComponents.secure = void 0;
3218
6678
  }
3219
6679
  if (wsComponents.resourceName) {
3220
- var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path = _wsComponents$resourc2[0], query2 = _wsComponents$resourc2[1];
3221
- wsComponents.path = path && path !== "/" ? path : void 0;
6680
+ var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path5 = _wsComponents$resourc2[0], query2 = _wsComponents$resourc2[1];
6681
+ wsComponents.path = path5 && path5 !== "/" ? path5 : void 0;
3222
6682
  wsComponents.query = query2;
3223
6683
  wsComponents.resourceName = void 0;
3224
6684
  }
@@ -3604,12 +7064,12 @@ var require_util = __commonJS2((exports, module) => {
3604
7064
  return "'" + escapeQuotes(str) + "'";
3605
7065
  }
3606
7066
  function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
3607
- var path = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
3608
- return joinPaths(currentPath, path);
7067
+ var path5 = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
7068
+ return joinPaths(currentPath, path5);
3609
7069
  }
3610
7070
  function getPath2(currentPath, prop, jsonPointers) {
3611
- var path = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
3612
- return joinPaths(currentPath, path);
7071
+ var path5 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
7072
+ return joinPaths(currentPath, path5);
3613
7073
  }
3614
7074
  var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
3615
7075
  var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
@@ -8467,7 +11927,7 @@ var require_ajv = __commonJS2((exports, module) => {
8467
11927
  function setLogger(self2) {
8468
11928
  var logger = self2._opts.logger;
8469
11929
  if (logger === false) {
8470
- self2.logger = { log: noop, warn: noop, error: noop };
11930
+ self2.logger = { log: noop2, warn: noop2, error: noop2 };
8471
11931
  } else {
8472
11932
  if (logger === void 0)
8473
11933
  logger = console;
@@ -8476,7 +11936,7 @@ var require_ajv = __commonJS2((exports, module) => {
8476
11936
  self2.logger = logger;
8477
11937
  }
8478
11938
  }
8479
- function noop() {
11939
+ function noop2() {
8480
11940
  }
8481
11941
  });
8482
11942
  var DEFAULT_MAX_LISTENERS = 50;
@@ -8542,39 +12002,39 @@ var NodeFsOperations = {
8542
12002
  }
8543
12003
  }
8544
12004
  },
8545
- appendFileSync(path, data, options) {
8546
- if (!fs__namespace.existsSync(path)) {
12005
+ appendFileSync(path5, data, options) {
12006
+ if (!fs__namespace.existsSync(path5)) {
8547
12007
  const mode = options?.mode ?? 384;
8548
- const fd = fs__namespace.openSync(path, "a", mode);
12008
+ const fd = fs__namespace.openSync(path5, "a", mode);
8549
12009
  try {
8550
12010
  fs__namespace.appendFileSync(fd, data);
8551
12011
  } finally {
8552
12012
  fs__namespace.closeSync(fd);
8553
12013
  }
8554
12014
  } else {
8555
- fs__namespace.appendFileSync(path, data);
12015
+ fs__namespace.appendFileSync(path5, data);
8556
12016
  }
8557
12017
  },
8558
12018
  copyFileSync(src, dest) {
8559
12019
  fs__namespace.copyFileSync(src, dest);
8560
12020
  },
8561
- unlinkSync(path) {
8562
- fs__namespace.unlinkSync(path);
12021
+ unlinkSync(path5) {
12022
+ fs__namespace.unlinkSync(path5);
8563
12023
  },
8564
12024
  renameSync(oldPath, newPath) {
8565
12025
  fs__namespace.renameSync(oldPath, newPath);
8566
12026
  },
8567
- linkSync(target, path) {
8568
- fs__namespace.linkSync(target, path);
12027
+ linkSync(target, path5) {
12028
+ fs__namespace.linkSync(target, path5);
8569
12029
  },
8570
- symlinkSync(target, path) {
8571
- fs__namespace.symlinkSync(target, path);
12030
+ symlinkSync(target, path5) {
12031
+ fs__namespace.symlinkSync(target, path5);
8572
12032
  },
8573
- readlinkSync(path) {
8574
- return fs__namespace.readlinkSync(path);
12033
+ readlinkSync(path5) {
12034
+ return fs__namespace.readlinkSync(path5);
8575
12035
  },
8576
- realpathSync(path) {
8577
- return fs__namespace.realpathSync(path);
12036
+ realpathSync(path5) {
12037
+ return fs__namespace.realpathSync(path5);
8578
12038
  },
8579
12039
  mkdirSync(dirPath) {
8580
12040
  if (!fs__namespace.existsSync(dirPath)) {
@@ -8594,11 +12054,11 @@ var NodeFsOperations = {
8594
12054
  rmdirSync(dirPath) {
8595
12055
  fs__namespace.rmdirSync(dirPath);
8596
12056
  },
8597
- rmSync(path, options) {
8598
- fs__namespace.rmSync(path, options);
12057
+ rmSync(path5, options) {
12058
+ fs__namespace.rmSync(path5, options);
8599
12059
  },
8600
- createWriteStream(path) {
8601
- return fs__namespace.createWriteStream(path);
12060
+ createWriteStream(path5) {
12061
+ return fs__namespace.createWriteStream(path5);
8602
12062
  }
8603
12063
  };
8604
12064
  var activeFs = NodeFsOperations;
@@ -8769,7 +12229,7 @@ var ProcessTransport = class {
8769
12229
  const spawnArgs = isNative ? [...executableArgs, ...args] : [...executableArgs, pathToClaudeCodeExecutable, ...args];
8770
12230
  this.logForDebugging(isNative ? `Spawning Claude Code native binary: ${spawnCommand} ${spawnArgs.join(" ")}` : `Spawning Claude Code process: ${spawnCommand} ${spawnArgs.join(" ")}`);
8771
12231
  const stderrMode = env.DEBUG || stderr ? "pipe" : "ignore";
8772
- this.child = child_process.spawn(spawnCommand, spawnArgs, {
12232
+ this.child = childProcess2.spawn(spawnCommand, spawnArgs, {
8773
12233
  cwd: cwd2,
8774
12234
  stdio: ["pipe", "pipe", stderrMode],
8775
12235
  signal: this.abortController.signal,
@@ -9109,10 +12569,10 @@ function getRawTag(value) {
9109
12569
  var _getRawTag_default = getRawTag;
9110
12570
  var objectProto2 = Object.prototype;
9111
12571
  var nativeObjectToString2 = objectProto2.toString;
9112
- function objectToString(value) {
12572
+ function objectToString2(value) {
9113
12573
  return nativeObjectToString2.call(value);
9114
12574
  }
9115
- var _objectToString_default = objectToString;
12575
+ var _objectToString_default = objectToString2;
9116
12576
  var nullTag = "[object Null]";
9117
12577
  var undefinedTag = "[object Undefined]";
9118
12578
  var symToStringTag2 = _Symbol_default ? _Symbol_default.toStringTag : void 0;
@@ -9534,7 +12994,7 @@ var maxOutputTokensValidator = {
9534
12994
  function getInitialState() {
9535
12995
  let resolvedCwd = "";
9536
12996
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
9537
- resolvedCwd = fs.realpathSync(process$1.cwd());
12997
+ resolvedCwd = fs.realpathSync(process2.cwd());
9538
12998
  }
9539
12999
  return {
9540
13000
  originalCwd: resolvedCwd,
@@ -10522,8 +13982,8 @@ function getErrorMap() {
10522
13982
  return overrideErrorMap;
10523
13983
  }
10524
13984
  var makeIssue = (params) => {
10525
- const { data, path, errorMaps, issueData } = params;
10526
- const fullPath = [...path, ...issueData.path || []];
13985
+ const { data, path: path5, errorMaps, issueData } = params;
13986
+ const fullPath = [...path5, ...issueData.path || []];
10527
13987
  const fullIssue = {
10528
13988
  ...issueData,
10529
13989
  path: fullPath
@@ -10631,11 +14091,11 @@ var errorUtil;
10631
14091
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
10632
14092
  })(errorUtil || (errorUtil = {}));
10633
14093
  var ParseInputLazyPath = class {
10634
- constructor(parent, value, path, key) {
14094
+ constructor(parent, value, path5, key) {
10635
14095
  this._cachedPath = [];
10636
14096
  this.parent = parent;
10637
14097
  this.data = value;
10638
- this._path = path;
14098
+ this._path = path5;
10639
14099
  this._key = key;
10640
14100
  }
10641
14101
  get path() {
@@ -14698,11 +18158,11 @@ function query({
14698
18158
  var DEFAULT_PORT = 4567;
14699
18159
 
14700
18160
  // src/server.ts
14701
- var VERSION = "0.0.80";
18161
+ var VERSION = "0.0.82";
14702
18162
  var resolveClaudePath = () => {
14703
18163
  const command = process.platform === "win32" ? "where claude" : "which claude";
14704
18164
  try {
14705
- const result = child_process.execSync(command, { encoding: "utf8" }).trim();
18165
+ const result = childProcess2.execSync(command, { encoding: "utf8" }).trim();
14706
18166
  return result.split("\n")[0];
14707
18167
  } catch {
14708
18168
  return "claude";
@@ -14710,7 +18170,6 @@ var resolveClaudePath = () => {
14710
18170
  };
14711
18171
  var claudeSessionMap = /* @__PURE__ */ new Map();
14712
18172
  var abortedSessions = /* @__PURE__ */ new Set();
14713
- var lastClaudeSessionId;
14714
18173
  var isTextBlock = (block) => block.type === "text";
14715
18174
  var createServer = () => {
14716
18175
  const app = new Hono2();
@@ -14761,7 +18220,6 @@ ${content}`;
14761
18220
  }
14762
18221
  }
14763
18222
  if (!isAborted2() && capturedClaudeSessionId) {
14764
- lastClaudeSessionId = capturedClaudeSessionId;
14765
18223
  if (sessionId) {
14766
18224
  claudeSessionMap.set(sessionId, capturedClaudeSessionId);
14767
18225
  }
@@ -14794,38 +18252,16 @@ ${stderr.trim()}` : errorMessage;
14794
18252
  abortedSessions.add(sessionId);
14795
18253
  return context.json({ status: "ok" });
14796
18254
  });
14797
- app.post("/undo", async (context) => {
14798
- if (!lastClaudeSessionId) {
14799
- return context.json({ status: "error", message: "No session to undo" });
14800
- }
14801
- try {
14802
- const env = { ...process.env };
14803
- delete env.NODE_OPTIONS;
14804
- delete env.VSCODE_INSPECTOR_OPTIONS;
14805
- const queryResult = query({
14806
- prompt: "/rewind",
14807
- options: {
14808
- pathToClaudeCodeExecutable: resolveClaudePath(),
14809
- cwd: process.cwd(),
14810
- env,
14811
- resume: lastClaudeSessionId
14812
- }
14813
- });
14814
- for await (const message of queryResult) {
14815
- if (message.type === "result") break;
14816
- }
14817
- return context.json({ status: "ok" });
14818
- } catch (error) {
14819
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
14820
- return context.json({ status: "error", message: errorMessage });
14821
- }
14822
- });
14823
18255
  app.get("/health", (context) => {
14824
18256
  return context.json({ status: "ok", provider: "claude" });
14825
18257
  });
14826
18258
  return app;
14827
18259
  };
18260
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
14828
18261
  var startServer = async (port = DEFAULT_PORT) => {
18262
+ await fkill(`:${port}`, { force: true, silent: true }).catch(() => {
18263
+ });
18264
+ await sleep(100);
14829
18265
  const app = createServer();
14830
18266
  serve({ fetch: app.fetch, port });
14831
18267
  console.log(