@react-grab/cursor 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/cli.cjs +2 -6
- package/dist/cli.js +3 -6
- package/dist/server.cjs +3072 -178
- package/dist/server.js +3069 -179
- package/package.json +4 -5
package/dist/server.cjs
CHANGED
|
@@ -5,11 +5,23 @@ var http = require('http');
|
|
|
5
5
|
var http2 = require('http2');
|
|
6
6
|
var stream = require('stream');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
|
+
var process2 = require('process');
|
|
9
|
+
var buffer = require('buffer');
|
|
10
|
+
var path = require('path');
|
|
11
|
+
var childProcess2 = require('child_process');
|
|
12
|
+
var os = require('os');
|
|
13
|
+
var fs = require('fs');
|
|
14
|
+
var promises = require('timers/promises');
|
|
15
|
+
var util = require('util');
|
|
8
16
|
|
|
9
17
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
19
|
|
|
12
20
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
21
|
+
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
22
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
23
|
+
var childProcess2__default = /*#__PURE__*/_interopDefault(childProcess2);
|
|
24
|
+
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
13
25
|
|
|
14
26
|
var __create = Object.create;
|
|
15
27
|
var __defProp = Object.defineProperty;
|
|
@@ -49,7 +61,7 @@ var require_windows = __commonJS({
|
|
|
49
61
|
module.exports = isexe;
|
|
50
62
|
isexe.sync = sync;
|
|
51
63
|
var fs = __require("fs");
|
|
52
|
-
function checkPathExt(
|
|
64
|
+
function checkPathExt(path5, options) {
|
|
53
65
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
54
66
|
if (!pathext) {
|
|
55
67
|
return true;
|
|
@@ -60,25 +72,25 @@ var require_windows = __commonJS({
|
|
|
60
72
|
}
|
|
61
73
|
for (var i = 0; i < pathext.length; i++) {
|
|
62
74
|
var p = pathext[i].toLowerCase();
|
|
63
|
-
if (p &&
|
|
75
|
+
if (p && path5.substr(-p.length).toLowerCase() === p) {
|
|
64
76
|
return true;
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
return false;
|
|
68
80
|
}
|
|
69
|
-
function checkStat(stat,
|
|
81
|
+
function checkStat(stat, path5, options) {
|
|
70
82
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
71
83
|
return false;
|
|
72
84
|
}
|
|
73
|
-
return checkPathExt(
|
|
85
|
+
return checkPathExt(path5, options);
|
|
74
86
|
}
|
|
75
|
-
function isexe(
|
|
76
|
-
fs.stat(
|
|
77
|
-
cb(er, er ? false : checkStat(stat,
|
|
87
|
+
function isexe(path5, options, cb) {
|
|
88
|
+
fs.stat(path5, function(er, stat) {
|
|
89
|
+
cb(er, er ? false : checkStat(stat, path5, options));
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
|
-
function sync(
|
|
81
|
-
return checkStat(fs.statSync(
|
|
92
|
+
function sync(path5, options) {
|
|
93
|
+
return checkStat(fs.statSync(path5), path5, options);
|
|
82
94
|
}
|
|
83
95
|
}
|
|
84
96
|
});
|
|
@@ -89,13 +101,13 @@ var require_mode = __commonJS({
|
|
|
89
101
|
module.exports = isexe;
|
|
90
102
|
isexe.sync = sync;
|
|
91
103
|
var fs = __require("fs");
|
|
92
|
-
function isexe(
|
|
93
|
-
fs.stat(
|
|
104
|
+
function isexe(path5, options, cb) {
|
|
105
|
+
fs.stat(path5, function(er, stat) {
|
|
94
106
|
cb(er, er ? false : checkStat(stat, options));
|
|
95
107
|
});
|
|
96
108
|
}
|
|
97
|
-
function sync(
|
|
98
|
-
return checkStat(fs.statSync(
|
|
109
|
+
function sync(path5, options) {
|
|
110
|
+
return checkStat(fs.statSync(path5), options);
|
|
99
111
|
}
|
|
100
112
|
function checkStat(stat, options) {
|
|
101
113
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -128,7 +140,7 @@ var require_isexe = __commonJS({
|
|
|
128
140
|
}
|
|
129
141
|
module.exports = isexe;
|
|
130
142
|
isexe.sync = sync;
|
|
131
|
-
function isexe(
|
|
143
|
+
function isexe(path5, options, cb) {
|
|
132
144
|
if (typeof options === "function") {
|
|
133
145
|
cb = options;
|
|
134
146
|
options = {};
|
|
@@ -138,7 +150,7 @@ var require_isexe = __commonJS({
|
|
|
138
150
|
throw new TypeError("callback not provided");
|
|
139
151
|
}
|
|
140
152
|
return new Promise(function(resolve, reject) {
|
|
141
|
-
isexe(
|
|
153
|
+
isexe(path5, options || {}, function(er, is) {
|
|
142
154
|
if (er) {
|
|
143
155
|
reject(er);
|
|
144
156
|
} else {
|
|
@@ -147,7 +159,7 @@ var require_isexe = __commonJS({
|
|
|
147
159
|
});
|
|
148
160
|
});
|
|
149
161
|
}
|
|
150
|
-
core(
|
|
162
|
+
core(path5, options || {}, function(er, is) {
|
|
151
163
|
if (er) {
|
|
152
164
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
153
165
|
er = null;
|
|
@@ -157,9 +169,9 @@ var require_isexe = __commonJS({
|
|
|
157
169
|
cb(er, is);
|
|
158
170
|
});
|
|
159
171
|
}
|
|
160
|
-
function sync(
|
|
172
|
+
function sync(path5, options) {
|
|
161
173
|
try {
|
|
162
|
-
return core.sync(
|
|
174
|
+
return core.sync(path5, options || {});
|
|
163
175
|
} catch (er) {
|
|
164
176
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
165
177
|
return false;
|
|
@@ -175,7 +187,7 @@ var require_isexe = __commonJS({
|
|
|
175
187
|
var require_which = __commonJS({
|
|
176
188
|
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
177
189
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
178
|
-
var
|
|
190
|
+
var path5 = __require("path");
|
|
179
191
|
var COLON = isWindows ? ";" : ":";
|
|
180
192
|
var isexe = require_isexe();
|
|
181
193
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -213,7 +225,7 @@ var require_which = __commonJS({
|
|
|
213
225
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
214
226
|
const ppRaw = pathEnv[i];
|
|
215
227
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
216
|
-
const pCmd =
|
|
228
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
217
229
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
218
230
|
resolve(subStep(p, i, 0));
|
|
219
231
|
});
|
|
@@ -240,7 +252,7 @@ var require_which = __commonJS({
|
|
|
240
252
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
241
253
|
const ppRaw = pathEnv[i];
|
|
242
254
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
243
|
-
const pCmd =
|
|
255
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
244
256
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
245
257
|
for (let j = 0; j < pathExt.length; j++) {
|
|
246
258
|
const cur = p + pathExt[j];
|
|
@@ -270,7 +282,7 @@ var require_which = __commonJS({
|
|
|
270
282
|
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
271
283
|
var require_path_key = __commonJS({
|
|
272
284
|
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
|
|
273
|
-
var
|
|
285
|
+
var pathKey2 = (options = {}) => {
|
|
274
286
|
const environment = options.env || process.env;
|
|
275
287
|
const platform = options.platform || process.platform;
|
|
276
288
|
if (platform !== "win32") {
|
|
@@ -278,15 +290,15 @@ var require_path_key = __commonJS({
|
|
|
278
290
|
}
|
|
279
291
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
280
292
|
};
|
|
281
|
-
module.exports =
|
|
282
|
-
module.exports.default =
|
|
293
|
+
module.exports = pathKey2;
|
|
294
|
+
module.exports.default = pathKey2;
|
|
283
295
|
}
|
|
284
296
|
});
|
|
285
297
|
|
|
286
298
|
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
287
299
|
var require_resolveCommand = __commonJS({
|
|
288
300
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
289
|
-
var
|
|
301
|
+
var path5 = __require("path");
|
|
290
302
|
var which = require_which();
|
|
291
303
|
var getPathKey = require_path_key();
|
|
292
304
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -304,7 +316,7 @@ var require_resolveCommand = __commonJS({
|
|
|
304
316
|
try {
|
|
305
317
|
resolved = which.sync(parsed.command, {
|
|
306
318
|
path: env[getPathKey({ env })],
|
|
307
|
-
pathExt: withoutPathExt ?
|
|
319
|
+
pathExt: withoutPathExt ? path5.delimiter : void 0
|
|
308
320
|
});
|
|
309
321
|
} catch (e) {
|
|
310
322
|
} finally {
|
|
@@ -313,7 +325,7 @@ var require_resolveCommand = __commonJS({
|
|
|
313
325
|
}
|
|
314
326
|
}
|
|
315
327
|
if (resolved) {
|
|
316
|
-
resolved =
|
|
328
|
+
resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
317
329
|
}
|
|
318
330
|
return resolved;
|
|
319
331
|
}
|
|
@@ -364,8 +376,8 @@ var require_shebang_command = __commonJS({
|
|
|
364
376
|
if (!match2) {
|
|
365
377
|
return null;
|
|
366
378
|
}
|
|
367
|
-
const [
|
|
368
|
-
const binary =
|
|
379
|
+
const [path5, argument] = match2[0].replace(/#! ?/, "").split(" ");
|
|
380
|
+
const binary = path5.split("/").pop();
|
|
369
381
|
if (binary === "env") {
|
|
370
382
|
return argument;
|
|
371
383
|
}
|
|
@@ -398,7 +410,7 @@ var require_readShebang = __commonJS({
|
|
|
398
410
|
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
399
411
|
var require_parse = __commonJS({
|
|
400
412
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
401
|
-
var
|
|
413
|
+
var path5 = __require("path");
|
|
402
414
|
var resolveCommand = require_resolveCommand();
|
|
403
415
|
var escape = require_escape();
|
|
404
416
|
var readShebang = require_readShebang();
|
|
@@ -423,7 +435,7 @@ var require_parse = __commonJS({
|
|
|
423
435
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
424
436
|
if (parsed.options.forceShell || needsShell) {
|
|
425
437
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
426
|
-
parsed.command =
|
|
438
|
+
parsed.command = path5.normalize(parsed.command);
|
|
427
439
|
parsed.command = escape.command(parsed.command);
|
|
428
440
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
429
441
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -531,80 +543,335 @@ var require_cross_spawn = __commonJS({
|
|
|
531
543
|
}
|
|
532
544
|
});
|
|
533
545
|
|
|
534
|
-
// ../../node_modules/.pnpm/
|
|
535
|
-
var
|
|
536
|
-
"../../node_modules/.pnpm/
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
546
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
547
|
+
var require_signals = __commonJS({
|
|
548
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
|
|
549
|
+
module.exports = [
|
|
550
|
+
"SIGABRT",
|
|
551
|
+
"SIGALRM",
|
|
552
|
+
"SIGHUP",
|
|
553
|
+
"SIGINT",
|
|
554
|
+
"SIGTERM"
|
|
555
|
+
];
|
|
556
|
+
if (process.platform !== "win32") {
|
|
557
|
+
module.exports.push(
|
|
558
|
+
"SIGVTALRM",
|
|
559
|
+
"SIGXCPU",
|
|
560
|
+
"SIGXFSZ",
|
|
561
|
+
"SIGUSR2",
|
|
562
|
+
"SIGTRAP",
|
|
563
|
+
"SIGSYS",
|
|
564
|
+
"SIGQUIT",
|
|
565
|
+
"SIGIOT"
|
|
566
|
+
// should detect profiler and enable/disable accordingly.
|
|
567
|
+
// see #21
|
|
568
|
+
// 'SIGPROF'
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
if (process.platform === "linux") {
|
|
572
|
+
module.exports.push(
|
|
573
|
+
"SIGIO",
|
|
574
|
+
"SIGPOLL",
|
|
575
|
+
"SIGPWR",
|
|
576
|
+
"SIGSTKFLT",
|
|
577
|
+
"SIGUNUSED"
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
584
|
+
var require_signal_exit = __commonJS({
|
|
585
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
|
|
586
|
+
var process13 = global.process;
|
|
587
|
+
var processOk2 = function(process14) {
|
|
588
|
+
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";
|
|
589
|
+
};
|
|
590
|
+
if (!processOk2(process13)) {
|
|
591
|
+
module.exports = function() {
|
|
592
|
+
return function() {
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
} else {
|
|
596
|
+
assert = __require("assert");
|
|
597
|
+
signals2 = require_signals();
|
|
598
|
+
isWin = /^win/i.test(process13.platform);
|
|
599
|
+
EE = __require("events");
|
|
600
|
+
if (typeof EE !== "function") {
|
|
601
|
+
EE = EE.EventEmitter;
|
|
602
|
+
}
|
|
603
|
+
if (process13.__signal_exit_emitter__) {
|
|
604
|
+
emitter = process13.__signal_exit_emitter__;
|
|
605
|
+
} else {
|
|
606
|
+
emitter = process13.__signal_exit_emitter__ = new EE();
|
|
607
|
+
emitter.count = 0;
|
|
608
|
+
emitter.emitted = {};
|
|
609
|
+
}
|
|
610
|
+
if (!emitter.infinite) {
|
|
611
|
+
emitter.setMaxListeners(Infinity);
|
|
612
|
+
emitter.infinite = true;
|
|
613
|
+
}
|
|
614
|
+
module.exports = function(cb, opts) {
|
|
615
|
+
if (!processOk2(global.process)) {
|
|
616
|
+
return function() {
|
|
617
|
+
};
|
|
557
618
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
619
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
620
|
+
if (loaded === false) {
|
|
621
|
+
load2();
|
|
622
|
+
}
|
|
623
|
+
var ev = "exit";
|
|
624
|
+
if (opts && opts.alwaysLast) {
|
|
625
|
+
ev = "afterexit";
|
|
626
|
+
}
|
|
627
|
+
var remove = function() {
|
|
628
|
+
emitter.removeListener(ev, cb);
|
|
629
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
630
|
+
unload2();
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
emitter.on(ev, cb);
|
|
634
|
+
return remove;
|
|
635
|
+
};
|
|
636
|
+
unload2 = function unload3() {
|
|
637
|
+
if (!loaded || !processOk2(global.process)) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
loaded = false;
|
|
641
|
+
signals2.forEach(function(sig) {
|
|
642
|
+
try {
|
|
643
|
+
process13.removeListener(sig, sigListeners[sig]);
|
|
644
|
+
} catch (er) {
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
process13.emit = originalProcessEmit;
|
|
648
|
+
process13.reallyExit = originalProcessReallyExit;
|
|
649
|
+
emitter.count -= 1;
|
|
650
|
+
};
|
|
651
|
+
module.exports.unload = unload2;
|
|
652
|
+
emit = function emit2(event, code, signal) {
|
|
653
|
+
if (emitter.emitted[event]) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
emitter.emitted[event] = true;
|
|
657
|
+
emitter.emit(event, code, signal);
|
|
658
|
+
};
|
|
659
|
+
sigListeners = {};
|
|
660
|
+
signals2.forEach(function(sig) {
|
|
661
|
+
sigListeners[sig] = function listener() {
|
|
662
|
+
if (!processOk2(global.process)) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
var listeners = process13.listeners(sig);
|
|
666
|
+
if (listeners.length === emitter.count) {
|
|
667
|
+
unload2();
|
|
668
|
+
emit("exit", null, sig);
|
|
669
|
+
emit("afterexit", null, sig);
|
|
670
|
+
if (isWin && sig === "SIGHUP") {
|
|
671
|
+
sig = "SIGINT";
|
|
672
|
+
}
|
|
673
|
+
process13.kill(process13.pid, sig);
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
});
|
|
677
|
+
module.exports.signals = function() {
|
|
678
|
+
return signals2;
|
|
679
|
+
};
|
|
680
|
+
loaded = false;
|
|
681
|
+
load2 = function load3() {
|
|
682
|
+
if (loaded || !processOk2(global.process)) {
|
|
683
|
+
return;
|
|
562
684
|
}
|
|
563
|
-
|
|
564
|
-
|
|
685
|
+
loaded = true;
|
|
686
|
+
emitter.count += 1;
|
|
687
|
+
signals2 = signals2.filter(function(sig) {
|
|
688
|
+
try {
|
|
689
|
+
process13.on(sig, sigListeners[sig]);
|
|
690
|
+
return true;
|
|
691
|
+
} catch (er) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
565
694
|
});
|
|
566
|
-
|
|
567
|
-
|
|
695
|
+
process13.emit = processEmit;
|
|
696
|
+
process13.reallyExit = processReallyExit;
|
|
697
|
+
};
|
|
698
|
+
module.exports.load = load2;
|
|
699
|
+
originalProcessReallyExit = process13.reallyExit;
|
|
700
|
+
processReallyExit = function processReallyExit2(code) {
|
|
701
|
+
if (!processOk2(global.process)) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
process13.exitCode = code || /* istanbul ignore next */
|
|
705
|
+
0;
|
|
706
|
+
emit("exit", process13.exitCode, null);
|
|
707
|
+
emit("afterexit", process13.exitCode, null);
|
|
708
|
+
originalProcessReallyExit.call(process13, process13.exitCode);
|
|
709
|
+
};
|
|
710
|
+
originalProcessEmit = process13.emit;
|
|
711
|
+
processEmit = function processEmit2(ev, arg) {
|
|
712
|
+
if (ev === "exit" && processOk2(global.process)) {
|
|
713
|
+
if (arg !== void 0) {
|
|
714
|
+
process13.exitCode = arg;
|
|
715
|
+
}
|
|
716
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
717
|
+
emit("exit", process13.exitCode, null);
|
|
718
|
+
emit("afterexit", process13.exitCode, null);
|
|
719
|
+
return ret;
|
|
720
|
+
} else {
|
|
721
|
+
return originalProcessEmit.apply(this, arguments);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
var assert;
|
|
726
|
+
var signals2;
|
|
727
|
+
var isWin;
|
|
728
|
+
var EE;
|
|
729
|
+
var emitter;
|
|
730
|
+
var unload2;
|
|
731
|
+
var emit;
|
|
732
|
+
var sigListeners;
|
|
733
|
+
var loaded;
|
|
734
|
+
var load2;
|
|
735
|
+
var originalProcessReallyExit;
|
|
736
|
+
var processReallyExit;
|
|
737
|
+
var originalProcessEmit;
|
|
738
|
+
var processEmit;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js
|
|
743
|
+
var require_buffer_stream = __commonJS({
|
|
744
|
+
"../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js"(exports, module) {
|
|
745
|
+
var { PassThrough: PassThroughStream } = __require("stream");
|
|
746
|
+
module.exports = (options) => {
|
|
747
|
+
options = { ...options };
|
|
748
|
+
const { array } = options;
|
|
749
|
+
let { encoding } = options;
|
|
750
|
+
const isBuffer = encoding === "buffer";
|
|
751
|
+
let objectMode = false;
|
|
752
|
+
if (array) {
|
|
753
|
+
objectMode = !(encoding || isBuffer);
|
|
754
|
+
} else {
|
|
755
|
+
encoding = encoding || "utf8";
|
|
756
|
+
}
|
|
757
|
+
if (isBuffer) {
|
|
758
|
+
encoding = null;
|
|
759
|
+
}
|
|
760
|
+
const stream2 = new PassThroughStream({ objectMode });
|
|
761
|
+
if (encoding) {
|
|
762
|
+
stream2.setEncoding(encoding);
|
|
763
|
+
}
|
|
764
|
+
let length = 0;
|
|
765
|
+
const chunks = [];
|
|
766
|
+
stream2.on("data", (chunk) => {
|
|
767
|
+
chunks.push(chunk);
|
|
768
|
+
if (objectMode) {
|
|
769
|
+
length = chunks.length;
|
|
770
|
+
} else {
|
|
771
|
+
length += chunk.length;
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
stream2.getBufferedValue = () => {
|
|
775
|
+
if (array) {
|
|
776
|
+
return chunks;
|
|
777
|
+
}
|
|
778
|
+
return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
|
|
779
|
+
};
|
|
780
|
+
stream2.getBufferedLength = () => length;
|
|
781
|
+
return stream2;
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
// ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js
|
|
787
|
+
var require_get_stream = __commonJS({
|
|
788
|
+
"../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js"(exports, module) {
|
|
789
|
+
var { constants: BufferConstants } = __require("buffer");
|
|
790
|
+
var stream2 = __require("stream");
|
|
791
|
+
var { promisify: promisify2 } = __require("util");
|
|
792
|
+
var bufferStream = require_buffer_stream();
|
|
793
|
+
var streamPipelinePromisified = promisify2(stream2.pipeline);
|
|
794
|
+
var MaxBufferError2 = class extends Error {
|
|
795
|
+
constructor() {
|
|
796
|
+
super("maxBuffer exceeded");
|
|
797
|
+
this.name = "MaxBufferError";
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
async function getStream2(inputStream, options) {
|
|
801
|
+
if (!inputStream) {
|
|
802
|
+
throw new Error("Expected a stream");
|
|
803
|
+
}
|
|
804
|
+
options = {
|
|
805
|
+
maxBuffer: Infinity,
|
|
806
|
+
...options
|
|
807
|
+
};
|
|
808
|
+
const { maxBuffer } = options;
|
|
809
|
+
const stream3 = bufferStream(options);
|
|
810
|
+
await new Promise((resolve, reject) => {
|
|
811
|
+
const rejectPromise = (error) => {
|
|
812
|
+
if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
813
|
+
error.bufferedData = stream3.getBufferedValue();
|
|
814
|
+
}
|
|
815
|
+
reject(error);
|
|
816
|
+
};
|
|
817
|
+
(async () => {
|
|
818
|
+
try {
|
|
819
|
+
await streamPipelinePromisified(inputStream, stream3);
|
|
820
|
+
resolve();
|
|
821
|
+
} catch (error) {
|
|
822
|
+
rejectPromise(error);
|
|
823
|
+
}
|
|
824
|
+
})();
|
|
825
|
+
stream3.on("data", () => {
|
|
826
|
+
if (stream3.getBufferedLength() > maxBuffer) {
|
|
827
|
+
rejectPromise(new MaxBufferError2());
|
|
828
|
+
}
|
|
568
829
|
});
|
|
569
830
|
});
|
|
831
|
+
return stream3.getBufferedValue();
|
|
570
832
|
}
|
|
571
|
-
module.exports =
|
|
833
|
+
module.exports = getStream2;
|
|
834
|
+
module.exports.buffer = (stream3, options) => getStream2(stream3, { ...options, encoding: "buffer" });
|
|
835
|
+
module.exports.array = (stream3, options) => getStream2(stream3, { ...options, array: true });
|
|
836
|
+
module.exports.MaxBufferError = MaxBufferError2;
|
|
572
837
|
}
|
|
573
838
|
});
|
|
574
839
|
|
|
575
|
-
// ../../node_modules/.pnpm/
|
|
576
|
-
var
|
|
577
|
-
"../../node_modules/.pnpm/
|
|
578
|
-
var
|
|
579
|
-
module.exports = function(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
840
|
+
// ../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
|
|
841
|
+
var require_merge_stream = __commonJS({
|
|
842
|
+
"../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module) {
|
|
843
|
+
var { PassThrough } = __require("stream");
|
|
844
|
+
module.exports = function() {
|
|
845
|
+
var sources = [];
|
|
846
|
+
var output = new PassThrough({ objectMode: true });
|
|
847
|
+
output.setMaxListeners(0);
|
|
848
|
+
output.add = add;
|
|
849
|
+
output.isEmpty = isEmpty;
|
|
850
|
+
output.on("unpipe", remove);
|
|
851
|
+
Array.prototype.slice.call(arguments).forEach(add);
|
|
852
|
+
return output;
|
|
853
|
+
function add(source) {
|
|
854
|
+
if (Array.isArray(source)) {
|
|
855
|
+
source.forEach(add);
|
|
856
|
+
return this;
|
|
857
|
+
}
|
|
858
|
+
sources.push(source);
|
|
859
|
+
source.once("end", remove.bind(null, source));
|
|
860
|
+
source.once("error", output.emit.bind(output, "error"));
|
|
861
|
+
source.pipe(output, { end: false });
|
|
862
|
+
return this;
|
|
863
|
+
}
|
|
864
|
+
function isEmpty() {
|
|
865
|
+
return sources.length == 0;
|
|
866
|
+
}
|
|
867
|
+
function remove(source) {
|
|
868
|
+
sources = sources.filter(function(it) {
|
|
869
|
+
return it !== source;
|
|
596
870
|
});
|
|
871
|
+
if (!sources.length && output.readable) {
|
|
872
|
+
output.end();
|
|
873
|
+
}
|
|
597
874
|
}
|
|
598
|
-
return sh("lsof -i -P").then((res) => {
|
|
599
|
-
const { stdout } = res;
|
|
600
|
-
if (!stdout) return res;
|
|
601
|
-
const lines = stdout.split("\n");
|
|
602
|
-
const existProccess = lines.filter((line) => line.match(new RegExp(`:*${port}`))).length > 0;
|
|
603
|
-
if (!existProccess) return Promise.reject(new Error("No process running on port"));
|
|
604
|
-
return sh(
|
|
605
|
-
`lsof -i ${method === "udp" ? "udp" : "tcp"}:${port} | grep ${method === "udp" ? "UDP" : "LISTEN"} | awk '{print $2}' | xargs kill -9`
|
|
606
|
-
);
|
|
607
|
-
});
|
|
608
875
|
};
|
|
609
876
|
}
|
|
610
877
|
});
|
|
@@ -682,7 +949,7 @@ var require_picocolors = __commonJS({
|
|
|
682
949
|
});
|
|
683
950
|
|
|
684
951
|
// src/server.ts
|
|
685
|
-
var
|
|
952
|
+
var import_cross_spawn3 = __toESM(require_cross_spawn());
|
|
686
953
|
|
|
687
954
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
|
|
688
955
|
var compose = (middleware, onError, onNotFound) => {
|
|
@@ -800,26 +1067,26 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
800
1067
|
};
|
|
801
1068
|
|
|
802
1069
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/utils/url.js
|
|
803
|
-
var splitPath = (
|
|
804
|
-
const paths =
|
|
1070
|
+
var splitPath = (path5) => {
|
|
1071
|
+
const paths = path5.split("/");
|
|
805
1072
|
if (paths[0] === "") {
|
|
806
1073
|
paths.shift();
|
|
807
1074
|
}
|
|
808
1075
|
return paths;
|
|
809
1076
|
};
|
|
810
1077
|
var splitRoutingPath = (routePath) => {
|
|
811
|
-
const { groups, path } = extractGroupsFromPath(routePath);
|
|
812
|
-
const paths = splitPath(
|
|
1078
|
+
const { groups, path: path5 } = extractGroupsFromPath(routePath);
|
|
1079
|
+
const paths = splitPath(path5);
|
|
813
1080
|
return replaceGroupMarks(paths, groups);
|
|
814
1081
|
};
|
|
815
|
-
var extractGroupsFromPath = (
|
|
1082
|
+
var extractGroupsFromPath = (path5) => {
|
|
816
1083
|
const groups = [];
|
|
817
|
-
|
|
1084
|
+
path5 = path5.replace(/\{[^}]+\}/g, (match2, index) => {
|
|
818
1085
|
const mark = `@${index}`;
|
|
819
1086
|
groups.push([mark, match2]);
|
|
820
1087
|
return mark;
|
|
821
1088
|
});
|
|
822
|
-
return { groups, path };
|
|
1089
|
+
return { groups, path: path5 };
|
|
823
1090
|
};
|
|
824
1091
|
var replaceGroupMarks = (paths, groups) => {
|
|
825
1092
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
@@ -874,8 +1141,8 @@ var getPath = (request) => {
|
|
|
874
1141
|
const charCode = url.charCodeAt(i);
|
|
875
1142
|
if (charCode === 37) {
|
|
876
1143
|
const queryIndex = url.indexOf("?", i);
|
|
877
|
-
const
|
|
878
|
-
return tryDecodeURI(
|
|
1144
|
+
const path5 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
|
|
1145
|
+
return tryDecodeURI(path5.includes("%25") ? path5.replace(/%25/g, "%2525") : path5);
|
|
879
1146
|
} else if (charCode === 63) {
|
|
880
1147
|
break;
|
|
881
1148
|
}
|
|
@@ -892,11 +1159,11 @@ var mergePath = (base, sub, ...rest) => {
|
|
|
892
1159
|
}
|
|
893
1160
|
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
|
|
894
1161
|
};
|
|
895
|
-
var checkOptionalParameter = (
|
|
896
|
-
if (
|
|
1162
|
+
var checkOptionalParameter = (path5) => {
|
|
1163
|
+
if (path5.charCodeAt(path5.length - 1) !== 63 || !path5.includes(":")) {
|
|
897
1164
|
return null;
|
|
898
1165
|
}
|
|
899
|
-
const segments =
|
|
1166
|
+
const segments = path5.split("/");
|
|
900
1167
|
const results = [];
|
|
901
1168
|
let basePath = "";
|
|
902
1169
|
segments.forEach((segment) => {
|
|
@@ -1009,9 +1276,9 @@ var HonoRequest = class {
|
|
|
1009
1276
|
routeIndex = 0;
|
|
1010
1277
|
path;
|
|
1011
1278
|
bodyCache = {};
|
|
1012
|
-
constructor(request,
|
|
1279
|
+
constructor(request, path5 = "/", matchResult = [[]]) {
|
|
1013
1280
|
this.raw = request;
|
|
1014
|
-
this.path =
|
|
1281
|
+
this.path = path5;
|
|
1015
1282
|
this.#matchResult = matchResult;
|
|
1016
1283
|
this.#validatedData = {};
|
|
1017
1284
|
}
|
|
@@ -1372,8 +1639,8 @@ var Hono = class {
|
|
|
1372
1639
|
return this;
|
|
1373
1640
|
};
|
|
1374
1641
|
});
|
|
1375
|
-
this.on = (method,
|
|
1376
|
-
for (const p of [
|
|
1642
|
+
this.on = (method, path5, ...handlers) => {
|
|
1643
|
+
for (const p of [path5].flat()) {
|
|
1377
1644
|
this.#path = p;
|
|
1378
1645
|
for (const m of [method].flat()) {
|
|
1379
1646
|
handlers.map((handler) => {
|
|
@@ -1411,8 +1678,8 @@ var Hono = class {
|
|
|
1411
1678
|
}
|
|
1412
1679
|
#notFoundHandler = notFoundHandler;
|
|
1413
1680
|
errorHandler = errorHandler;
|
|
1414
|
-
route(
|
|
1415
|
-
const subApp = this.basePath(
|
|
1681
|
+
route(path5, app) {
|
|
1682
|
+
const subApp = this.basePath(path5);
|
|
1416
1683
|
app.routes.map((r) => {
|
|
1417
1684
|
let handler;
|
|
1418
1685
|
if (app.errorHandler === errorHandler) {
|
|
@@ -1425,9 +1692,9 @@ var Hono = class {
|
|
|
1425
1692
|
});
|
|
1426
1693
|
return this;
|
|
1427
1694
|
}
|
|
1428
|
-
basePath(
|
|
1695
|
+
basePath(path5) {
|
|
1429
1696
|
const subApp = this.#clone();
|
|
1430
|
-
subApp._basePath = mergePath(this._basePath,
|
|
1697
|
+
subApp._basePath = mergePath(this._basePath, path5);
|
|
1431
1698
|
return subApp;
|
|
1432
1699
|
}
|
|
1433
1700
|
onError = (handler) => {
|
|
@@ -1438,7 +1705,7 @@ var Hono = class {
|
|
|
1438
1705
|
this.#notFoundHandler = handler;
|
|
1439
1706
|
return this;
|
|
1440
1707
|
};
|
|
1441
|
-
mount(
|
|
1708
|
+
mount(path5, applicationHandler, options) {
|
|
1442
1709
|
let replaceRequest;
|
|
1443
1710
|
let optionHandler;
|
|
1444
1711
|
if (options) {
|
|
@@ -1465,7 +1732,7 @@ var Hono = class {
|
|
|
1465
1732
|
return [c.env, executionContext];
|
|
1466
1733
|
};
|
|
1467
1734
|
replaceRequest ||= (() => {
|
|
1468
|
-
const mergedPath = mergePath(this._basePath,
|
|
1735
|
+
const mergedPath = mergePath(this._basePath, path5);
|
|
1469
1736
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
1470
1737
|
return (request) => {
|
|
1471
1738
|
const url = new URL(request.url);
|
|
@@ -1480,14 +1747,14 @@ var Hono = class {
|
|
|
1480
1747
|
}
|
|
1481
1748
|
await next();
|
|
1482
1749
|
};
|
|
1483
|
-
this.#addRoute(METHOD_NAME_ALL, mergePath(
|
|
1750
|
+
this.#addRoute(METHOD_NAME_ALL, mergePath(path5, "*"), handler);
|
|
1484
1751
|
return this;
|
|
1485
1752
|
}
|
|
1486
|
-
#addRoute(method,
|
|
1753
|
+
#addRoute(method, path5, handler) {
|
|
1487
1754
|
method = method.toUpperCase();
|
|
1488
|
-
|
|
1489
|
-
const r = { basePath: this._basePath, path, method, handler };
|
|
1490
|
-
this.router.add(method,
|
|
1755
|
+
path5 = mergePath(this._basePath, path5);
|
|
1756
|
+
const r = { basePath: this._basePath, path: path5, method, handler };
|
|
1757
|
+
this.router.add(method, path5, [handler, r]);
|
|
1491
1758
|
this.routes.push(r);
|
|
1492
1759
|
}
|
|
1493
1760
|
#handleError(err, c) {
|
|
@@ -1500,10 +1767,10 @@ var Hono = class {
|
|
|
1500
1767
|
if (method === "HEAD") {
|
|
1501
1768
|
return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
|
|
1502
1769
|
}
|
|
1503
|
-
const
|
|
1504
|
-
const matchResult = this.router.match(method,
|
|
1770
|
+
const path5 = this.getPath(request, { env });
|
|
1771
|
+
const matchResult = this.router.match(method, path5);
|
|
1505
1772
|
const c = new Context(request, {
|
|
1506
|
-
path,
|
|
1773
|
+
path: path5,
|
|
1507
1774
|
matchResult,
|
|
1508
1775
|
env,
|
|
1509
1776
|
executionCtx,
|
|
@@ -1563,15 +1830,15 @@ var Hono = class {
|
|
|
1563
1830
|
|
|
1564
1831
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
1565
1832
|
var emptyParam = [];
|
|
1566
|
-
function match(method,
|
|
1833
|
+
function match(method, path5) {
|
|
1567
1834
|
const matchers = this.buildAllMatchers();
|
|
1568
|
-
const match2 = (method2,
|
|
1835
|
+
const match2 = (method2, path22) => {
|
|
1569
1836
|
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
|
1570
|
-
const staticMatch = matcher[2][
|
|
1837
|
+
const staticMatch = matcher[2][path22];
|
|
1571
1838
|
if (staticMatch) {
|
|
1572
1839
|
return staticMatch;
|
|
1573
1840
|
}
|
|
1574
|
-
const match3 =
|
|
1841
|
+
const match3 = path22.match(matcher[0]);
|
|
1575
1842
|
if (!match3) {
|
|
1576
1843
|
return [[], emptyParam];
|
|
1577
1844
|
}
|
|
@@ -1579,7 +1846,7 @@ function match(method, path) {
|
|
|
1579
1846
|
return [matcher[1][index], match3];
|
|
1580
1847
|
};
|
|
1581
1848
|
this.match = match2;
|
|
1582
|
-
return match2(method,
|
|
1849
|
+
return match2(method, path5);
|
|
1583
1850
|
}
|
|
1584
1851
|
|
|
1585
1852
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
@@ -1694,12 +1961,12 @@ var Node = class {
|
|
|
1694
1961
|
var Trie = class {
|
|
1695
1962
|
#context = { varIndex: 0 };
|
|
1696
1963
|
#root = new Node();
|
|
1697
|
-
insert(
|
|
1964
|
+
insert(path5, index, pathErrorCheckOnly) {
|
|
1698
1965
|
const paramAssoc = [];
|
|
1699
1966
|
const groups = [];
|
|
1700
1967
|
for (let i = 0; ; ) {
|
|
1701
1968
|
let replaced = false;
|
|
1702
|
-
|
|
1969
|
+
path5 = path5.replace(/\{[^}]+\}/g, (m) => {
|
|
1703
1970
|
const mark = `@\\${i}`;
|
|
1704
1971
|
groups[i] = [mark, m];
|
|
1705
1972
|
i++;
|
|
@@ -1710,7 +1977,7 @@ var Trie = class {
|
|
|
1710
1977
|
break;
|
|
1711
1978
|
}
|
|
1712
1979
|
}
|
|
1713
|
-
const tokens =
|
|
1980
|
+
const tokens = path5.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
1714
1981
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
1715
1982
|
const [mark] = groups[i];
|
|
1716
1983
|
for (let j = tokens.length - 1; j >= 0; j--) {
|
|
@@ -1749,9 +2016,9 @@ var Trie = class {
|
|
|
1749
2016
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
1750
2017
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
1751
2018
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
1752
|
-
function buildWildcardRegExp(
|
|
1753
|
-
return wildcardRegExpCache[
|
|
1754
|
-
|
|
2019
|
+
function buildWildcardRegExp(path5) {
|
|
2020
|
+
return wildcardRegExpCache[path5] ??= new RegExp(
|
|
2021
|
+
path5 === "*" ? "" : `^${path5.replace(
|
|
1755
2022
|
/\/\*$|([.\\+*[^\]$()])/g,
|
|
1756
2023
|
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
|
|
1757
2024
|
)}$`
|
|
@@ -1773,17 +2040,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
1773
2040
|
);
|
|
1774
2041
|
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
1775
2042
|
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
1776
|
-
const [pathErrorCheckOnly,
|
|
2043
|
+
const [pathErrorCheckOnly, path5, handlers] = routesWithStaticPathFlag[i];
|
|
1777
2044
|
if (pathErrorCheckOnly) {
|
|
1778
|
-
staticMap[
|
|
2045
|
+
staticMap[path5] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
1779
2046
|
} else {
|
|
1780
2047
|
j++;
|
|
1781
2048
|
}
|
|
1782
2049
|
let paramAssoc;
|
|
1783
2050
|
try {
|
|
1784
|
-
paramAssoc = trie.insert(
|
|
2051
|
+
paramAssoc = trie.insert(path5, j, pathErrorCheckOnly);
|
|
1785
2052
|
} catch (e) {
|
|
1786
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(
|
|
2053
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path5) : e;
|
|
1787
2054
|
}
|
|
1788
2055
|
if (pathErrorCheckOnly) {
|
|
1789
2056
|
continue;
|
|
@@ -1817,12 +2084,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
1817
2084
|
}
|
|
1818
2085
|
return [regexp, handlerMap, staticMap];
|
|
1819
2086
|
}
|
|
1820
|
-
function findMiddleware(middleware,
|
|
2087
|
+
function findMiddleware(middleware, path5) {
|
|
1821
2088
|
if (!middleware) {
|
|
1822
2089
|
return void 0;
|
|
1823
2090
|
}
|
|
1824
2091
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
1825
|
-
if (buildWildcardRegExp(k).test(
|
|
2092
|
+
if (buildWildcardRegExp(k).test(path5)) {
|
|
1826
2093
|
return [...middleware[k]];
|
|
1827
2094
|
}
|
|
1828
2095
|
}
|
|
@@ -1836,7 +2103,7 @@ var RegExpRouter = class {
|
|
|
1836
2103
|
this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
1837
2104
|
this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
1838
2105
|
}
|
|
1839
|
-
add(method,
|
|
2106
|
+
add(method, path5, handler) {
|
|
1840
2107
|
const middleware = this.#middleware;
|
|
1841
2108
|
const routes = this.#routes;
|
|
1842
2109
|
if (!middleware || !routes) {
|
|
@@ -1850,18 +2117,18 @@ var RegExpRouter = class {
|
|
|
1850
2117
|
});
|
|
1851
2118
|
});
|
|
1852
2119
|
}
|
|
1853
|
-
if (
|
|
1854
|
-
|
|
2120
|
+
if (path5 === "/*") {
|
|
2121
|
+
path5 = "*";
|
|
1855
2122
|
}
|
|
1856
|
-
const paramCount = (
|
|
1857
|
-
if (/\*$/.test(
|
|
1858
|
-
const re = buildWildcardRegExp(
|
|
2123
|
+
const paramCount = (path5.match(/\/:/g) || []).length;
|
|
2124
|
+
if (/\*$/.test(path5)) {
|
|
2125
|
+
const re = buildWildcardRegExp(path5);
|
|
1859
2126
|
if (method === METHOD_NAME_ALL) {
|
|
1860
2127
|
Object.keys(middleware).forEach((m) => {
|
|
1861
|
-
middleware[m][
|
|
2128
|
+
middleware[m][path5] ||= findMiddleware(middleware[m], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
|
|
1862
2129
|
});
|
|
1863
2130
|
} else {
|
|
1864
|
-
middleware[method][
|
|
2131
|
+
middleware[method][path5] ||= findMiddleware(middleware[method], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
|
|
1865
2132
|
}
|
|
1866
2133
|
Object.keys(middleware).forEach((m) => {
|
|
1867
2134
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
@@ -1879,15 +2146,15 @@ var RegExpRouter = class {
|
|
|
1879
2146
|
});
|
|
1880
2147
|
return;
|
|
1881
2148
|
}
|
|
1882
|
-
const paths = checkOptionalParameter(
|
|
2149
|
+
const paths = checkOptionalParameter(path5) || [path5];
|
|
1883
2150
|
for (let i = 0, len = paths.length; i < len; i++) {
|
|
1884
|
-
const
|
|
2151
|
+
const path22 = paths[i];
|
|
1885
2152
|
Object.keys(routes).forEach((m) => {
|
|
1886
2153
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
1887
|
-
routes[m][
|
|
1888
|
-
...findMiddleware(middleware[m],
|
|
2154
|
+
routes[m][path22] ||= [
|
|
2155
|
+
...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
|
|
1889
2156
|
];
|
|
1890
|
-
routes[m][
|
|
2157
|
+
routes[m][path22].push([handler, paramCount - len + i + 1]);
|
|
1891
2158
|
}
|
|
1892
2159
|
});
|
|
1893
2160
|
}
|
|
@@ -1906,13 +2173,13 @@ var RegExpRouter = class {
|
|
|
1906
2173
|
const routes = [];
|
|
1907
2174
|
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
1908
2175
|
[this.#middleware, this.#routes].forEach((r) => {
|
|
1909
|
-
const ownRoute = r[method] ? Object.keys(r[method]).map((
|
|
2176
|
+
const ownRoute = r[method] ? Object.keys(r[method]).map((path5) => [path5, r[method][path5]]) : [];
|
|
1910
2177
|
if (ownRoute.length !== 0) {
|
|
1911
2178
|
hasOwnRoute ||= true;
|
|
1912
2179
|
routes.push(...ownRoute);
|
|
1913
2180
|
} else if (method !== METHOD_NAME_ALL) {
|
|
1914
2181
|
routes.push(
|
|
1915
|
-
...Object.keys(r[METHOD_NAME_ALL]).map((
|
|
2182
|
+
...Object.keys(r[METHOD_NAME_ALL]).map((path5) => [path5, r[METHOD_NAME_ALL][path5]])
|
|
1916
2183
|
);
|
|
1917
2184
|
}
|
|
1918
2185
|
});
|
|
@@ -1932,13 +2199,13 @@ var SmartRouter = class {
|
|
|
1932
2199
|
constructor(init) {
|
|
1933
2200
|
this.#routers = init.routers;
|
|
1934
2201
|
}
|
|
1935
|
-
add(method,
|
|
2202
|
+
add(method, path5, handler) {
|
|
1936
2203
|
if (!this.#routes) {
|
|
1937
2204
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
1938
2205
|
}
|
|
1939
|
-
this.#routes.push([method,
|
|
2206
|
+
this.#routes.push([method, path5, handler]);
|
|
1940
2207
|
}
|
|
1941
|
-
match(method,
|
|
2208
|
+
match(method, path5) {
|
|
1942
2209
|
if (!this.#routes) {
|
|
1943
2210
|
throw new Error("Fatal error");
|
|
1944
2211
|
}
|
|
@@ -1953,7 +2220,7 @@ var SmartRouter = class {
|
|
|
1953
2220
|
for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
|
|
1954
2221
|
router.add(...routes[i2]);
|
|
1955
2222
|
}
|
|
1956
|
-
res = router.match(method,
|
|
2223
|
+
res = router.match(method, path5);
|
|
1957
2224
|
} catch (e) {
|
|
1958
2225
|
if (e instanceof UnsupportedPathError) {
|
|
1959
2226
|
continue;
|
|
@@ -1997,10 +2264,10 @@ var Node2 = class {
|
|
|
1997
2264
|
}
|
|
1998
2265
|
this.#patterns = [];
|
|
1999
2266
|
}
|
|
2000
|
-
insert(method,
|
|
2267
|
+
insert(method, path5, handler) {
|
|
2001
2268
|
this.#order = ++this.#order;
|
|
2002
2269
|
let curNode = this;
|
|
2003
|
-
const parts = splitRoutingPath(
|
|
2270
|
+
const parts = splitRoutingPath(path5);
|
|
2004
2271
|
const possibleKeys = [];
|
|
2005
2272
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
2006
2273
|
const p = parts[i];
|
|
@@ -2051,12 +2318,12 @@ var Node2 = class {
|
|
|
2051
2318
|
}
|
|
2052
2319
|
return handlerSets;
|
|
2053
2320
|
}
|
|
2054
|
-
search(method,
|
|
2321
|
+
search(method, path5) {
|
|
2055
2322
|
const handlerSets = [];
|
|
2056
2323
|
this.#params = emptyParams;
|
|
2057
2324
|
const curNode = this;
|
|
2058
2325
|
let curNodes = [curNode];
|
|
2059
|
-
const parts = splitPath(
|
|
2326
|
+
const parts = splitPath(path5);
|
|
2060
2327
|
const curNodesQueue = [];
|
|
2061
2328
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
2062
2329
|
const part = parts[i];
|
|
@@ -2144,18 +2411,18 @@ var TrieRouter = class {
|
|
|
2144
2411
|
constructor() {
|
|
2145
2412
|
this.#node = new Node2();
|
|
2146
2413
|
}
|
|
2147
|
-
add(method,
|
|
2148
|
-
const results = checkOptionalParameter(
|
|
2414
|
+
add(method, path5, handler) {
|
|
2415
|
+
const results = checkOptionalParameter(path5);
|
|
2149
2416
|
if (results) {
|
|
2150
2417
|
for (let i = 0, len = results.length; i < len; i++) {
|
|
2151
2418
|
this.#node.insert(method, results[i], handler);
|
|
2152
2419
|
}
|
|
2153
2420
|
return;
|
|
2154
2421
|
}
|
|
2155
|
-
this.#node.insert(method,
|
|
2422
|
+
this.#node.insert(method, path5, handler);
|
|
2156
2423
|
}
|
|
2157
|
-
match(method,
|
|
2158
|
-
return this.#node.search(method,
|
|
2424
|
+
match(method, path5) {
|
|
2425
|
+
return this.#node.search(method, path5);
|
|
2159
2426
|
}
|
|
2160
2427
|
};
|
|
2161
2428
|
|
|
@@ -2931,15 +3198,2641 @@ var serve = (options, listeningListener) => {
|
|
|
2931
3198
|
return server;
|
|
2932
3199
|
};
|
|
2933
3200
|
|
|
3201
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
|
|
3202
|
+
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
3203
|
+
|
|
3204
|
+
// ../../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
|
|
3205
|
+
function stripFinalNewline(input) {
|
|
3206
|
+
const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
|
|
3207
|
+
const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
|
|
3208
|
+
if (input[input.length - 1] === LF) {
|
|
3209
|
+
input = input.slice(0, -1);
|
|
3210
|
+
}
|
|
3211
|
+
if (input[input.length - 1] === CR) {
|
|
3212
|
+
input = input.slice(0, -1);
|
|
3213
|
+
}
|
|
3214
|
+
return input;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
3218
|
+
function pathKey(options = {}) {
|
|
3219
|
+
const {
|
|
3220
|
+
env = process.env,
|
|
3221
|
+
platform = process.platform
|
|
3222
|
+
} = options;
|
|
3223
|
+
if (platform !== "win32") {
|
|
3224
|
+
return "PATH";
|
|
3225
|
+
}
|
|
3226
|
+
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
// ../../node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
|
|
3230
|
+
var npmRunPath = ({
|
|
3231
|
+
cwd = process2__default.default.cwd(),
|
|
3232
|
+
path: pathOption = process2__default.default.env[pathKey()],
|
|
3233
|
+
preferLocal = true,
|
|
3234
|
+
execPath = process2__default.default.execPath,
|
|
3235
|
+
addExecPath = true
|
|
3236
|
+
} = {}) => {
|
|
3237
|
+
const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
|
|
3238
|
+
const cwdPath = path__default.default.resolve(cwdString);
|
|
3239
|
+
const result = [];
|
|
3240
|
+
if (preferLocal) {
|
|
3241
|
+
applyPreferLocal(result, cwdPath);
|
|
3242
|
+
}
|
|
3243
|
+
if (addExecPath) {
|
|
3244
|
+
applyExecPath(result, execPath, cwdPath);
|
|
3245
|
+
}
|
|
3246
|
+
return [...result, pathOption].join(path__default.default.delimiter);
|
|
3247
|
+
};
|
|
3248
|
+
var applyPreferLocal = (result, cwdPath) => {
|
|
3249
|
+
let previous;
|
|
3250
|
+
while (previous !== cwdPath) {
|
|
3251
|
+
result.push(path__default.default.join(cwdPath, "node_modules/.bin"));
|
|
3252
|
+
previous = cwdPath;
|
|
3253
|
+
cwdPath = path__default.default.resolve(cwdPath, "..");
|
|
3254
|
+
}
|
|
3255
|
+
};
|
|
3256
|
+
var applyExecPath = (result, execPath, cwdPath) => {
|
|
3257
|
+
const execPathString = execPath instanceof URL ? url.fileURLToPath(execPath) : execPath;
|
|
3258
|
+
result.push(path__default.default.resolve(cwdPath, execPathString, ".."));
|
|
3259
|
+
};
|
|
3260
|
+
var npmRunPathEnv = ({ env = process2__default.default.env, ...options } = {}) => {
|
|
3261
|
+
env = { ...env };
|
|
3262
|
+
const pathName = pathKey({ env });
|
|
3263
|
+
options.path = env[pathName];
|
|
3264
|
+
env[pathName] = npmRunPath(options);
|
|
3265
|
+
return env;
|
|
3266
|
+
};
|
|
3267
|
+
|
|
3268
|
+
// ../../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
3269
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
3270
|
+
if (property === "length" || property === "prototype") {
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3273
|
+
if (property === "arguments" || property === "caller") {
|
|
3274
|
+
return;
|
|
3275
|
+
}
|
|
3276
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
3277
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
3278
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
3279
|
+
return;
|
|
3280
|
+
}
|
|
3281
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
3282
|
+
};
|
|
3283
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
3284
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
3285
|
+
};
|
|
3286
|
+
var changePrototype = (to, from) => {
|
|
3287
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
3288
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
3289
|
+
return;
|
|
3290
|
+
}
|
|
3291
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
3292
|
+
};
|
|
3293
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
3294
|
+
${fromBody}`;
|
|
3295
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
3296
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
3297
|
+
var changeToString = (to, from, name) => {
|
|
3298
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
3299
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
3300
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
3301
|
+
Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
3302
|
+
};
|
|
3303
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
3304
|
+
const { name } = to;
|
|
3305
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
3306
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
3307
|
+
}
|
|
3308
|
+
changePrototype(to, from);
|
|
3309
|
+
changeToString(to, from, name);
|
|
3310
|
+
return to;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
// ../../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
|
|
3314
|
+
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
3315
|
+
var onetime = (function_, options = {}) => {
|
|
3316
|
+
if (typeof function_ !== "function") {
|
|
3317
|
+
throw new TypeError("Expected a function");
|
|
3318
|
+
}
|
|
3319
|
+
let returnValue;
|
|
3320
|
+
let callCount = 0;
|
|
3321
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
3322
|
+
const onetime2 = function(...arguments_) {
|
|
3323
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
3324
|
+
if (callCount === 1) {
|
|
3325
|
+
returnValue = function_.apply(this, arguments_);
|
|
3326
|
+
function_ = null;
|
|
3327
|
+
} else if (options.throw === true) {
|
|
3328
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
3329
|
+
}
|
|
3330
|
+
return returnValue;
|
|
3331
|
+
};
|
|
3332
|
+
mimicFunction(onetime2, function_);
|
|
3333
|
+
calledFunctions.set(onetime2, callCount);
|
|
3334
|
+
return onetime2;
|
|
3335
|
+
};
|
|
3336
|
+
onetime.callCount = (function_) => {
|
|
3337
|
+
if (!calledFunctions.has(function_)) {
|
|
3338
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
3339
|
+
}
|
|
3340
|
+
return calledFunctions.get(function_);
|
|
3341
|
+
};
|
|
3342
|
+
var onetime_default = onetime;
|
|
3343
|
+
|
|
3344
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/realtime.js
|
|
3345
|
+
var getRealtimeSignals = function() {
|
|
3346
|
+
const length = SIGRTMAX - SIGRTMIN + 1;
|
|
3347
|
+
return Array.from({ length }, getRealtimeSignal);
|
|
3348
|
+
};
|
|
3349
|
+
var getRealtimeSignal = function(value, index) {
|
|
3350
|
+
return {
|
|
3351
|
+
name: `SIGRT${index + 1}`,
|
|
3352
|
+
number: SIGRTMIN + index,
|
|
3353
|
+
action: "terminate",
|
|
3354
|
+
description: "Application-specific signal (realtime)",
|
|
3355
|
+
standard: "posix"
|
|
3356
|
+
};
|
|
3357
|
+
};
|
|
3358
|
+
var SIGRTMIN = 34;
|
|
3359
|
+
var SIGRTMAX = 64;
|
|
3360
|
+
|
|
3361
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/core.js
|
|
3362
|
+
var SIGNALS = [
|
|
3363
|
+
{
|
|
3364
|
+
name: "SIGHUP",
|
|
3365
|
+
number: 1,
|
|
3366
|
+
action: "terminate",
|
|
3367
|
+
description: "Terminal closed",
|
|
3368
|
+
standard: "posix"
|
|
3369
|
+
},
|
|
3370
|
+
{
|
|
3371
|
+
name: "SIGINT",
|
|
3372
|
+
number: 2,
|
|
3373
|
+
action: "terminate",
|
|
3374
|
+
description: "User interruption with CTRL-C",
|
|
3375
|
+
standard: "ansi"
|
|
3376
|
+
},
|
|
3377
|
+
{
|
|
3378
|
+
name: "SIGQUIT",
|
|
3379
|
+
number: 3,
|
|
3380
|
+
action: "core",
|
|
3381
|
+
description: "User interruption with CTRL-\\",
|
|
3382
|
+
standard: "posix"
|
|
3383
|
+
},
|
|
3384
|
+
{
|
|
3385
|
+
name: "SIGILL",
|
|
3386
|
+
number: 4,
|
|
3387
|
+
action: "core",
|
|
3388
|
+
description: "Invalid machine instruction",
|
|
3389
|
+
standard: "ansi"
|
|
3390
|
+
},
|
|
3391
|
+
{
|
|
3392
|
+
name: "SIGTRAP",
|
|
3393
|
+
number: 5,
|
|
3394
|
+
action: "core",
|
|
3395
|
+
description: "Debugger breakpoint",
|
|
3396
|
+
standard: "posix"
|
|
3397
|
+
},
|
|
3398
|
+
{
|
|
3399
|
+
name: "SIGABRT",
|
|
3400
|
+
number: 6,
|
|
3401
|
+
action: "core",
|
|
3402
|
+
description: "Aborted",
|
|
3403
|
+
standard: "ansi"
|
|
3404
|
+
},
|
|
3405
|
+
{
|
|
3406
|
+
name: "SIGIOT",
|
|
3407
|
+
number: 6,
|
|
3408
|
+
action: "core",
|
|
3409
|
+
description: "Aborted",
|
|
3410
|
+
standard: "bsd"
|
|
3411
|
+
},
|
|
3412
|
+
{
|
|
3413
|
+
name: "SIGBUS",
|
|
3414
|
+
number: 7,
|
|
3415
|
+
action: "core",
|
|
3416
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
3417
|
+
standard: "bsd"
|
|
3418
|
+
},
|
|
3419
|
+
{
|
|
3420
|
+
name: "SIGEMT",
|
|
3421
|
+
number: 7,
|
|
3422
|
+
action: "terminate",
|
|
3423
|
+
description: "Command should be emulated but is not implemented",
|
|
3424
|
+
standard: "other"
|
|
3425
|
+
},
|
|
3426
|
+
{
|
|
3427
|
+
name: "SIGFPE",
|
|
3428
|
+
number: 8,
|
|
3429
|
+
action: "core",
|
|
3430
|
+
description: "Floating point arithmetic error",
|
|
3431
|
+
standard: "ansi"
|
|
3432
|
+
},
|
|
3433
|
+
{
|
|
3434
|
+
name: "SIGKILL",
|
|
3435
|
+
number: 9,
|
|
3436
|
+
action: "terminate",
|
|
3437
|
+
description: "Forced termination",
|
|
3438
|
+
standard: "posix",
|
|
3439
|
+
forced: true
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
name: "SIGUSR1",
|
|
3443
|
+
number: 10,
|
|
3444
|
+
action: "terminate",
|
|
3445
|
+
description: "Application-specific signal",
|
|
3446
|
+
standard: "posix"
|
|
3447
|
+
},
|
|
3448
|
+
{
|
|
3449
|
+
name: "SIGSEGV",
|
|
3450
|
+
number: 11,
|
|
3451
|
+
action: "core",
|
|
3452
|
+
description: "Segmentation fault",
|
|
3453
|
+
standard: "ansi"
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
name: "SIGUSR2",
|
|
3457
|
+
number: 12,
|
|
3458
|
+
action: "terminate",
|
|
3459
|
+
description: "Application-specific signal",
|
|
3460
|
+
standard: "posix"
|
|
3461
|
+
},
|
|
3462
|
+
{
|
|
3463
|
+
name: "SIGPIPE",
|
|
3464
|
+
number: 13,
|
|
3465
|
+
action: "terminate",
|
|
3466
|
+
description: "Broken pipe or socket",
|
|
3467
|
+
standard: "posix"
|
|
3468
|
+
},
|
|
3469
|
+
{
|
|
3470
|
+
name: "SIGALRM",
|
|
3471
|
+
number: 14,
|
|
3472
|
+
action: "terminate",
|
|
3473
|
+
description: "Timeout or timer",
|
|
3474
|
+
standard: "posix"
|
|
3475
|
+
},
|
|
3476
|
+
{
|
|
3477
|
+
name: "SIGTERM",
|
|
3478
|
+
number: 15,
|
|
3479
|
+
action: "terminate",
|
|
3480
|
+
description: "Termination",
|
|
3481
|
+
standard: "ansi"
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
name: "SIGSTKFLT",
|
|
3485
|
+
number: 16,
|
|
3486
|
+
action: "terminate",
|
|
3487
|
+
description: "Stack is empty or overflowed",
|
|
3488
|
+
standard: "other"
|
|
3489
|
+
},
|
|
3490
|
+
{
|
|
3491
|
+
name: "SIGCHLD",
|
|
3492
|
+
number: 17,
|
|
3493
|
+
action: "ignore",
|
|
3494
|
+
description: "Child process terminated, paused or unpaused",
|
|
3495
|
+
standard: "posix"
|
|
3496
|
+
},
|
|
3497
|
+
{
|
|
3498
|
+
name: "SIGCLD",
|
|
3499
|
+
number: 17,
|
|
3500
|
+
action: "ignore",
|
|
3501
|
+
description: "Child process terminated, paused or unpaused",
|
|
3502
|
+
standard: "other"
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
name: "SIGCONT",
|
|
3506
|
+
number: 18,
|
|
3507
|
+
action: "unpause",
|
|
3508
|
+
description: "Unpaused",
|
|
3509
|
+
standard: "posix",
|
|
3510
|
+
forced: true
|
|
3511
|
+
},
|
|
3512
|
+
{
|
|
3513
|
+
name: "SIGSTOP",
|
|
3514
|
+
number: 19,
|
|
3515
|
+
action: "pause",
|
|
3516
|
+
description: "Paused",
|
|
3517
|
+
standard: "posix",
|
|
3518
|
+
forced: true
|
|
3519
|
+
},
|
|
3520
|
+
{
|
|
3521
|
+
name: "SIGTSTP",
|
|
3522
|
+
number: 20,
|
|
3523
|
+
action: "pause",
|
|
3524
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
3525
|
+
standard: "posix"
|
|
3526
|
+
},
|
|
3527
|
+
{
|
|
3528
|
+
name: "SIGTTIN",
|
|
3529
|
+
number: 21,
|
|
3530
|
+
action: "pause",
|
|
3531
|
+
description: "Background process cannot read terminal input",
|
|
3532
|
+
standard: "posix"
|
|
3533
|
+
},
|
|
3534
|
+
{
|
|
3535
|
+
name: "SIGBREAK",
|
|
3536
|
+
number: 21,
|
|
3537
|
+
action: "terminate",
|
|
3538
|
+
description: "User interruption with CTRL-BREAK",
|
|
3539
|
+
standard: "other"
|
|
3540
|
+
},
|
|
3541
|
+
{
|
|
3542
|
+
name: "SIGTTOU",
|
|
3543
|
+
number: 22,
|
|
3544
|
+
action: "pause",
|
|
3545
|
+
description: "Background process cannot write to terminal output",
|
|
3546
|
+
standard: "posix"
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
name: "SIGURG",
|
|
3550
|
+
number: 23,
|
|
3551
|
+
action: "ignore",
|
|
3552
|
+
description: "Socket received out-of-band data",
|
|
3553
|
+
standard: "bsd"
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
name: "SIGXCPU",
|
|
3557
|
+
number: 24,
|
|
3558
|
+
action: "core",
|
|
3559
|
+
description: "Process timed out",
|
|
3560
|
+
standard: "bsd"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
name: "SIGXFSZ",
|
|
3564
|
+
number: 25,
|
|
3565
|
+
action: "core",
|
|
3566
|
+
description: "File too big",
|
|
3567
|
+
standard: "bsd"
|
|
3568
|
+
},
|
|
3569
|
+
{
|
|
3570
|
+
name: "SIGVTALRM",
|
|
3571
|
+
number: 26,
|
|
3572
|
+
action: "terminate",
|
|
3573
|
+
description: "Timeout or timer",
|
|
3574
|
+
standard: "bsd"
|
|
3575
|
+
},
|
|
3576
|
+
{
|
|
3577
|
+
name: "SIGPROF",
|
|
3578
|
+
number: 27,
|
|
3579
|
+
action: "terminate",
|
|
3580
|
+
description: "Timeout or timer",
|
|
3581
|
+
standard: "bsd"
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
name: "SIGWINCH",
|
|
3585
|
+
number: 28,
|
|
3586
|
+
action: "ignore",
|
|
3587
|
+
description: "Terminal window size changed",
|
|
3588
|
+
standard: "bsd"
|
|
3589
|
+
},
|
|
3590
|
+
{
|
|
3591
|
+
name: "SIGIO",
|
|
3592
|
+
number: 29,
|
|
3593
|
+
action: "terminate",
|
|
3594
|
+
description: "I/O is available",
|
|
3595
|
+
standard: "other"
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
name: "SIGPOLL",
|
|
3599
|
+
number: 29,
|
|
3600
|
+
action: "terminate",
|
|
3601
|
+
description: "Watched event",
|
|
3602
|
+
standard: "other"
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
name: "SIGINFO",
|
|
3606
|
+
number: 29,
|
|
3607
|
+
action: "ignore",
|
|
3608
|
+
description: "Request for process information",
|
|
3609
|
+
standard: "other"
|
|
3610
|
+
},
|
|
3611
|
+
{
|
|
3612
|
+
name: "SIGPWR",
|
|
3613
|
+
number: 30,
|
|
3614
|
+
action: "terminate",
|
|
3615
|
+
description: "Device running out of power",
|
|
3616
|
+
standard: "systemv"
|
|
3617
|
+
},
|
|
3618
|
+
{
|
|
3619
|
+
name: "SIGSYS",
|
|
3620
|
+
number: 31,
|
|
3621
|
+
action: "core",
|
|
3622
|
+
description: "Invalid system call",
|
|
3623
|
+
standard: "other"
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
name: "SIGUNUSED",
|
|
3627
|
+
number: 31,
|
|
3628
|
+
action: "terminate",
|
|
3629
|
+
description: "Invalid system call",
|
|
3630
|
+
standard: "other"
|
|
3631
|
+
}
|
|
3632
|
+
];
|
|
3633
|
+
|
|
3634
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/signals.js
|
|
3635
|
+
var getSignals = function() {
|
|
3636
|
+
const realtimeSignals = getRealtimeSignals();
|
|
3637
|
+
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
3638
|
+
return signals2;
|
|
3639
|
+
};
|
|
3640
|
+
var normalizeSignal = function({
|
|
3641
|
+
name,
|
|
3642
|
+
number: defaultNumber,
|
|
3643
|
+
description,
|
|
3644
|
+
action,
|
|
3645
|
+
forced = false,
|
|
3646
|
+
standard
|
|
3647
|
+
}) {
|
|
3648
|
+
const {
|
|
3649
|
+
signals: { [name]: constantSignal }
|
|
3650
|
+
} = os.constants;
|
|
3651
|
+
const supported = constantSignal !== void 0;
|
|
3652
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
3653
|
+
return { name, number, description, supported, action, forced, standard };
|
|
3654
|
+
};
|
|
3655
|
+
|
|
3656
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/main.js
|
|
3657
|
+
var getSignalsByName = function() {
|
|
3658
|
+
const signals2 = getSignals();
|
|
3659
|
+
return signals2.reduce(getSignalByName, {});
|
|
3660
|
+
};
|
|
3661
|
+
var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
|
|
3662
|
+
return {
|
|
3663
|
+
...signalByNameMemo,
|
|
3664
|
+
[name]: { name, number, description, supported, action, forced, standard }
|
|
3665
|
+
};
|
|
3666
|
+
};
|
|
3667
|
+
var signalsByName = getSignalsByName();
|
|
3668
|
+
var getSignalsByNumber = function() {
|
|
3669
|
+
const signals2 = getSignals();
|
|
3670
|
+
const length = SIGRTMAX + 1;
|
|
3671
|
+
const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals2));
|
|
3672
|
+
return Object.assign({}, ...signalsA);
|
|
3673
|
+
};
|
|
3674
|
+
var getSignalByNumber = function(number, signals2) {
|
|
3675
|
+
const signal = findSignalByNumber(number, signals2);
|
|
3676
|
+
if (signal === void 0) {
|
|
3677
|
+
return {};
|
|
3678
|
+
}
|
|
3679
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
3680
|
+
return {
|
|
3681
|
+
[number]: {
|
|
3682
|
+
name,
|
|
3683
|
+
number,
|
|
3684
|
+
description,
|
|
3685
|
+
supported,
|
|
3686
|
+
action,
|
|
3687
|
+
forced,
|
|
3688
|
+
standard
|
|
3689
|
+
}
|
|
3690
|
+
};
|
|
3691
|
+
};
|
|
3692
|
+
var findSignalByNumber = function(number, signals2) {
|
|
3693
|
+
const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
|
|
3694
|
+
if (signal !== void 0) {
|
|
3695
|
+
return signal;
|
|
3696
|
+
}
|
|
3697
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
3698
|
+
};
|
|
3699
|
+
getSignalsByNumber();
|
|
3700
|
+
|
|
3701
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/error.js
|
|
3702
|
+
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
3703
|
+
if (timedOut) {
|
|
3704
|
+
return `timed out after ${timeout} milliseconds`;
|
|
3705
|
+
}
|
|
3706
|
+
if (isCanceled) {
|
|
3707
|
+
return "was canceled";
|
|
3708
|
+
}
|
|
3709
|
+
if (errorCode !== void 0) {
|
|
3710
|
+
return `failed with ${errorCode}`;
|
|
3711
|
+
}
|
|
3712
|
+
if (signal !== void 0) {
|
|
3713
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
3714
|
+
}
|
|
3715
|
+
if (exitCode !== void 0) {
|
|
3716
|
+
return `failed with exit code ${exitCode}`;
|
|
3717
|
+
}
|
|
3718
|
+
return "failed";
|
|
3719
|
+
};
|
|
3720
|
+
var makeError = ({
|
|
3721
|
+
stdout,
|
|
3722
|
+
stderr,
|
|
3723
|
+
all,
|
|
3724
|
+
error,
|
|
3725
|
+
signal,
|
|
3726
|
+
exitCode,
|
|
3727
|
+
command,
|
|
3728
|
+
escapedCommand,
|
|
3729
|
+
timedOut,
|
|
3730
|
+
isCanceled,
|
|
3731
|
+
killed,
|
|
3732
|
+
parsed: { options: { timeout } }
|
|
3733
|
+
}) => {
|
|
3734
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
3735
|
+
signal = signal === null ? void 0 : signal;
|
|
3736
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
|
|
3737
|
+
const errorCode = error && error.code;
|
|
3738
|
+
const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
3739
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
3740
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
3741
|
+
const shortMessage = isError ? `${execaMessage}
|
|
3742
|
+
${error.message}` : execaMessage;
|
|
3743
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
3744
|
+
if (isError) {
|
|
3745
|
+
error.originalMessage = error.message;
|
|
3746
|
+
error.message = message;
|
|
3747
|
+
} else {
|
|
3748
|
+
error = new Error(message);
|
|
3749
|
+
}
|
|
3750
|
+
error.shortMessage = shortMessage;
|
|
3751
|
+
error.command = command;
|
|
3752
|
+
error.escapedCommand = escapedCommand;
|
|
3753
|
+
error.exitCode = exitCode;
|
|
3754
|
+
error.signal = signal;
|
|
3755
|
+
error.signalDescription = signalDescription;
|
|
3756
|
+
error.stdout = stdout;
|
|
3757
|
+
error.stderr = stderr;
|
|
3758
|
+
if (all !== void 0) {
|
|
3759
|
+
error.all = all;
|
|
3760
|
+
}
|
|
3761
|
+
if ("bufferedData" in error) {
|
|
3762
|
+
delete error.bufferedData;
|
|
3763
|
+
}
|
|
3764
|
+
error.failed = true;
|
|
3765
|
+
error.timedOut = Boolean(timedOut);
|
|
3766
|
+
error.isCanceled = isCanceled;
|
|
3767
|
+
error.killed = killed && !timedOut;
|
|
3768
|
+
return error;
|
|
3769
|
+
};
|
|
3770
|
+
|
|
3771
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stdio.js
|
|
3772
|
+
var aliases = ["stdin", "stdout", "stderr"];
|
|
3773
|
+
var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
|
|
3774
|
+
var normalizeStdio = (options) => {
|
|
3775
|
+
if (!options) {
|
|
3776
|
+
return;
|
|
3777
|
+
}
|
|
3778
|
+
const { stdio } = options;
|
|
3779
|
+
if (stdio === void 0) {
|
|
3780
|
+
return aliases.map((alias) => options[alias]);
|
|
3781
|
+
}
|
|
3782
|
+
if (hasAlias(options)) {
|
|
3783
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
3784
|
+
}
|
|
3785
|
+
if (typeof stdio === "string") {
|
|
3786
|
+
return stdio;
|
|
3787
|
+
}
|
|
3788
|
+
if (!Array.isArray(stdio)) {
|
|
3789
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
3790
|
+
}
|
|
3791
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
3792
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
3793
|
+
};
|
|
3794
|
+
|
|
3795
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
|
3796
|
+
var import_signal_exit = __toESM(require_signal_exit());
|
|
3797
|
+
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
3798
|
+
var spawnedKill = (kill2, signal = "SIGTERM", options = {}) => {
|
|
3799
|
+
const killResult = kill2(signal);
|
|
3800
|
+
setKillTimeout(kill2, signal, options, killResult);
|
|
3801
|
+
return killResult;
|
|
3802
|
+
};
|
|
3803
|
+
var setKillTimeout = (kill2, signal, options, killResult) => {
|
|
3804
|
+
if (!shouldForceKill(signal, options, killResult)) {
|
|
3805
|
+
return;
|
|
3806
|
+
}
|
|
3807
|
+
const timeout = getForceKillAfterTimeout(options);
|
|
3808
|
+
const t = setTimeout(() => {
|
|
3809
|
+
kill2("SIGKILL");
|
|
3810
|
+
}, timeout);
|
|
3811
|
+
if (t.unref) {
|
|
3812
|
+
t.unref();
|
|
3813
|
+
}
|
|
3814
|
+
};
|
|
3815
|
+
var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
3816
|
+
var isSigterm = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
3817
|
+
var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
3818
|
+
if (forceKillAfterTimeout === true) {
|
|
3819
|
+
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
3820
|
+
}
|
|
3821
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
3822
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
3823
|
+
}
|
|
3824
|
+
return forceKillAfterTimeout;
|
|
3825
|
+
};
|
|
3826
|
+
var spawnedCancel = (spawned, context) => {
|
|
3827
|
+
const killResult = spawned.kill();
|
|
3828
|
+
if (killResult) {
|
|
3829
|
+
context.isCanceled = true;
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
var timeoutKill = (spawned, signal, reject) => {
|
|
3833
|
+
spawned.kill(signal);
|
|
3834
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
3835
|
+
};
|
|
3836
|
+
var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
3837
|
+
if (timeout === 0 || timeout === void 0) {
|
|
3838
|
+
return spawnedPromise;
|
|
3839
|
+
}
|
|
3840
|
+
let timeoutId;
|
|
3841
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
3842
|
+
timeoutId = setTimeout(() => {
|
|
3843
|
+
timeoutKill(spawned, killSignal, reject);
|
|
3844
|
+
}, timeout);
|
|
3845
|
+
});
|
|
3846
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
3847
|
+
clearTimeout(timeoutId);
|
|
3848
|
+
});
|
|
3849
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
3850
|
+
};
|
|
3851
|
+
var validateTimeout = ({ timeout }) => {
|
|
3852
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
3853
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3856
|
+
var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
3857
|
+
if (!cleanup || detached) {
|
|
3858
|
+
return timedPromise;
|
|
3859
|
+
}
|
|
3860
|
+
const removeExitHandler = (0, import_signal_exit.default)(() => {
|
|
3861
|
+
spawned.kill();
|
|
3862
|
+
});
|
|
3863
|
+
return timedPromise.finally(() => {
|
|
3864
|
+
removeExitHandler();
|
|
3865
|
+
});
|
|
3866
|
+
};
|
|
3867
|
+
|
|
3868
|
+
// ../../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
|
|
3869
|
+
function isStream(stream2) {
|
|
3870
|
+
return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
|
|
3871
|
+
}
|
|
3872
|
+
function isWritableStream(stream2) {
|
|
3873
|
+
return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stream.js
|
|
3877
|
+
var import_get_stream = __toESM(require_get_stream());
|
|
3878
|
+
var import_merge_stream = __toESM(require_merge_stream());
|
|
3879
|
+
var handleInput = (spawned, input) => {
|
|
3880
|
+
if (input === void 0 || spawned.stdin === void 0) {
|
|
3881
|
+
return;
|
|
3882
|
+
}
|
|
3883
|
+
if (isStream(input)) {
|
|
3884
|
+
input.pipe(spawned.stdin);
|
|
3885
|
+
} else {
|
|
3886
|
+
spawned.stdin.end(input);
|
|
3887
|
+
}
|
|
3888
|
+
};
|
|
3889
|
+
var makeAllStream = (spawned, { all }) => {
|
|
3890
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
const mixed = (0, import_merge_stream.default)();
|
|
3894
|
+
if (spawned.stdout) {
|
|
3895
|
+
mixed.add(spawned.stdout);
|
|
3896
|
+
}
|
|
3897
|
+
if (spawned.stderr) {
|
|
3898
|
+
mixed.add(spawned.stderr);
|
|
3899
|
+
}
|
|
3900
|
+
return mixed;
|
|
3901
|
+
};
|
|
3902
|
+
var getBufferedData = async (stream2, streamPromise) => {
|
|
3903
|
+
if (!stream2) {
|
|
3904
|
+
return;
|
|
3905
|
+
}
|
|
3906
|
+
stream2.destroy();
|
|
3907
|
+
try {
|
|
3908
|
+
return await streamPromise;
|
|
3909
|
+
} catch (error) {
|
|
3910
|
+
return error.bufferedData;
|
|
3911
|
+
}
|
|
3912
|
+
};
|
|
3913
|
+
var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
|
|
3914
|
+
if (!stream2 || !buffer) {
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
if (encoding) {
|
|
3918
|
+
return (0, import_get_stream.default)(stream2, { encoding, maxBuffer });
|
|
3919
|
+
}
|
|
3920
|
+
return import_get_stream.default.buffer(stream2, { maxBuffer });
|
|
3921
|
+
};
|
|
3922
|
+
var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
3923
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
3924
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
|
|
3925
|
+
const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
3926
|
+
try {
|
|
3927
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
3928
|
+
} catch (error) {
|
|
3929
|
+
return Promise.all([
|
|
3930
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
3931
|
+
getBufferedData(stdout, stdoutPromise),
|
|
3932
|
+
getBufferedData(stderr, stderrPromise),
|
|
3933
|
+
getBufferedData(all, allPromise)
|
|
3934
|
+
]);
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
|
|
3938
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/promise.js
|
|
3939
|
+
var nativePromisePrototype = (async () => {
|
|
3940
|
+
})().constructor.prototype;
|
|
3941
|
+
var descriptors = ["then", "catch", "finally"].map((property) => [
|
|
3942
|
+
property,
|
|
3943
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
3944
|
+
]);
|
|
3945
|
+
var mergePromise = (spawned, promise) => {
|
|
3946
|
+
for (const [property, descriptor] of descriptors) {
|
|
3947
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
3948
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
3949
|
+
}
|
|
3950
|
+
return spawned;
|
|
3951
|
+
};
|
|
3952
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
|
|
3953
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
3954
|
+
resolve({ exitCode, signal });
|
|
3955
|
+
});
|
|
3956
|
+
spawned.on("error", (error) => {
|
|
3957
|
+
reject(error);
|
|
3958
|
+
});
|
|
3959
|
+
if (spawned.stdin) {
|
|
3960
|
+
spawned.stdin.on("error", (error) => {
|
|
3961
|
+
reject(error);
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
});
|
|
3965
|
+
|
|
3966
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/command.js
|
|
3967
|
+
var normalizeArgs = (file, args = []) => {
|
|
3968
|
+
if (!Array.isArray(args)) {
|
|
3969
|
+
return [file];
|
|
3970
|
+
}
|
|
3971
|
+
return [file, ...args];
|
|
3972
|
+
};
|
|
3973
|
+
var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
3974
|
+
var DOUBLE_QUOTES_REGEXP = /"/g;
|
|
3975
|
+
var escapeArg = (arg) => {
|
|
3976
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
3977
|
+
return arg;
|
|
3978
|
+
}
|
|
3979
|
+
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
|
3980
|
+
};
|
|
3981
|
+
var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
3982
|
+
var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
3983
|
+
|
|
3984
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
|
|
3985
|
+
var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
3986
|
+
var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
3987
|
+
const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
|
|
3988
|
+
if (preferLocal) {
|
|
3989
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
3990
|
+
}
|
|
3991
|
+
return env;
|
|
3992
|
+
};
|
|
3993
|
+
var handleArguments = (file, args, options = {}) => {
|
|
3994
|
+
const parsed = import_cross_spawn.default._parse(file, args, options);
|
|
3995
|
+
file = parsed.command;
|
|
3996
|
+
args = parsed.args;
|
|
3997
|
+
options = parsed.options;
|
|
3998
|
+
options = {
|
|
3999
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
4000
|
+
buffer: true,
|
|
4001
|
+
stripFinalNewline: true,
|
|
4002
|
+
extendEnv: true,
|
|
4003
|
+
preferLocal: false,
|
|
4004
|
+
localDir: options.cwd || process2__default.default.cwd(),
|
|
4005
|
+
execPath: process2__default.default.execPath,
|
|
4006
|
+
encoding: "utf8",
|
|
4007
|
+
reject: true,
|
|
4008
|
+
cleanup: true,
|
|
4009
|
+
all: false,
|
|
4010
|
+
windowsHide: true,
|
|
4011
|
+
...options
|
|
4012
|
+
};
|
|
4013
|
+
options.env = getEnv(options);
|
|
4014
|
+
options.stdio = normalizeStdio(options);
|
|
4015
|
+
if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
|
|
4016
|
+
args.unshift("/q");
|
|
4017
|
+
}
|
|
4018
|
+
return { file, args, options, parsed };
|
|
4019
|
+
};
|
|
4020
|
+
var handleOutput = (options, value, error) => {
|
|
4021
|
+
if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
|
|
4022
|
+
return error === void 0 ? void 0 : "";
|
|
4023
|
+
}
|
|
4024
|
+
if (options.stripFinalNewline) {
|
|
4025
|
+
return stripFinalNewline(value);
|
|
4026
|
+
}
|
|
4027
|
+
return value;
|
|
4028
|
+
};
|
|
4029
|
+
function execa(file, args, options) {
|
|
4030
|
+
const parsed = handleArguments(file, args, options);
|
|
4031
|
+
const command = joinCommand(file, args);
|
|
4032
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
4033
|
+
validateTimeout(parsed.options);
|
|
4034
|
+
let spawned;
|
|
4035
|
+
try {
|
|
4036
|
+
spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
4037
|
+
} catch (error) {
|
|
4038
|
+
const dummySpawned = new childProcess2__default.default.ChildProcess();
|
|
4039
|
+
const errorPromise = Promise.reject(makeError({
|
|
4040
|
+
error,
|
|
4041
|
+
stdout: "",
|
|
4042
|
+
stderr: "",
|
|
4043
|
+
all: "",
|
|
4044
|
+
command,
|
|
4045
|
+
escapedCommand,
|
|
4046
|
+
parsed,
|
|
4047
|
+
timedOut: false,
|
|
4048
|
+
isCanceled: false,
|
|
4049
|
+
killed: false
|
|
4050
|
+
}));
|
|
4051
|
+
return mergePromise(dummySpawned, errorPromise);
|
|
4052
|
+
}
|
|
4053
|
+
const spawnedPromise = getSpawnedPromise(spawned);
|
|
4054
|
+
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
4055
|
+
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
4056
|
+
const context = { isCanceled: false };
|
|
4057
|
+
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
4058
|
+
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
4059
|
+
const handlePromise = async () => {
|
|
4060
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
4061
|
+
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
4062
|
+
const stderr = handleOutput(parsed.options, stderrResult);
|
|
4063
|
+
const all = handleOutput(parsed.options, allResult);
|
|
4064
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
4065
|
+
const returnedError = makeError({
|
|
4066
|
+
error,
|
|
4067
|
+
exitCode,
|
|
4068
|
+
signal,
|
|
4069
|
+
stdout,
|
|
4070
|
+
stderr,
|
|
4071
|
+
all,
|
|
4072
|
+
command,
|
|
4073
|
+
escapedCommand,
|
|
4074
|
+
parsed,
|
|
4075
|
+
timedOut,
|
|
4076
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
4077
|
+
killed: spawned.killed
|
|
4078
|
+
});
|
|
4079
|
+
if (!parsed.options.reject) {
|
|
4080
|
+
return returnedError;
|
|
4081
|
+
}
|
|
4082
|
+
throw returnedError;
|
|
4083
|
+
}
|
|
4084
|
+
return {
|
|
4085
|
+
command,
|
|
4086
|
+
escapedCommand,
|
|
4087
|
+
exitCode: 0,
|
|
4088
|
+
stdout,
|
|
4089
|
+
stderr,
|
|
4090
|
+
all,
|
|
4091
|
+
failed: false,
|
|
4092
|
+
timedOut: false,
|
|
4093
|
+
isCanceled: false,
|
|
4094
|
+
killed: false
|
|
4095
|
+
};
|
|
4096
|
+
};
|
|
4097
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
4098
|
+
handleInput(spawned, parsed.options.input);
|
|
4099
|
+
spawned.all = makeAllStream(spawned, parsed.options);
|
|
4100
|
+
return mergePromise(spawned, handlePromiseOnce);
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
// ../../node_modules/.pnpm/taskkill@5.0.0/node_modules/taskkill/index.js
|
|
4104
|
+
function parseArgs(input, options) {
|
|
4105
|
+
if (process2__default.default.platform !== "win32") {
|
|
4106
|
+
throw new Error("Windows only");
|
|
4107
|
+
}
|
|
4108
|
+
input = [input].flat();
|
|
4109
|
+
if (input.length === 0) {
|
|
4110
|
+
throw new Error("PID or image name required");
|
|
4111
|
+
}
|
|
4112
|
+
const arguments_ = [];
|
|
4113
|
+
if (options.system && options.username && options.password) {
|
|
4114
|
+
arguments_.push("/s", options.system, "/u", options.username, "/p", options.password);
|
|
4115
|
+
}
|
|
4116
|
+
if (options.filter) {
|
|
4117
|
+
arguments_.push("/fi", options.filter);
|
|
4118
|
+
}
|
|
4119
|
+
if (options.force) {
|
|
4120
|
+
arguments_.push("/f");
|
|
4121
|
+
}
|
|
4122
|
+
if (options.tree) {
|
|
4123
|
+
arguments_.push("/t");
|
|
4124
|
+
}
|
|
4125
|
+
for (const element of input) {
|
|
4126
|
+
arguments_.push(typeof element === "number" ? "/pid" : "/im", element);
|
|
4127
|
+
}
|
|
4128
|
+
return arguments_;
|
|
4129
|
+
}
|
|
4130
|
+
async function taskkill(input, options = {}) {
|
|
4131
|
+
await execa("taskkill", parseArgs(input, options));
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
4135
|
+
var import_cross_spawn2 = __toESM(require_cross_spawn());
|
|
4136
|
+
|
|
4137
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
|
|
4138
|
+
var getRealtimeSignals2 = () => {
|
|
4139
|
+
const length = SIGRTMAX2 - SIGRTMIN2 + 1;
|
|
4140
|
+
return Array.from({ length }, getRealtimeSignal2);
|
|
4141
|
+
};
|
|
4142
|
+
var getRealtimeSignal2 = (value, index) => ({
|
|
4143
|
+
name: `SIGRT${index + 1}`,
|
|
4144
|
+
number: SIGRTMIN2 + index,
|
|
4145
|
+
action: "terminate",
|
|
4146
|
+
description: "Application-specific signal (realtime)",
|
|
4147
|
+
standard: "posix"
|
|
4148
|
+
});
|
|
4149
|
+
var SIGRTMIN2 = 34;
|
|
4150
|
+
var SIGRTMAX2 = 64;
|
|
4151
|
+
|
|
4152
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
|
|
4153
|
+
var SIGNALS2 = [
|
|
4154
|
+
{
|
|
4155
|
+
name: "SIGHUP",
|
|
4156
|
+
number: 1,
|
|
4157
|
+
action: "terminate",
|
|
4158
|
+
description: "Terminal closed",
|
|
4159
|
+
standard: "posix"
|
|
4160
|
+
},
|
|
4161
|
+
{
|
|
4162
|
+
name: "SIGINT",
|
|
4163
|
+
number: 2,
|
|
4164
|
+
action: "terminate",
|
|
4165
|
+
description: "User interruption with CTRL-C",
|
|
4166
|
+
standard: "ansi"
|
|
4167
|
+
},
|
|
4168
|
+
{
|
|
4169
|
+
name: "SIGQUIT",
|
|
4170
|
+
number: 3,
|
|
4171
|
+
action: "core",
|
|
4172
|
+
description: "User interruption with CTRL-\\",
|
|
4173
|
+
standard: "posix"
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
name: "SIGILL",
|
|
4177
|
+
number: 4,
|
|
4178
|
+
action: "core",
|
|
4179
|
+
description: "Invalid machine instruction",
|
|
4180
|
+
standard: "ansi"
|
|
4181
|
+
},
|
|
4182
|
+
{
|
|
4183
|
+
name: "SIGTRAP",
|
|
4184
|
+
number: 5,
|
|
4185
|
+
action: "core",
|
|
4186
|
+
description: "Debugger breakpoint",
|
|
4187
|
+
standard: "posix"
|
|
4188
|
+
},
|
|
4189
|
+
{
|
|
4190
|
+
name: "SIGABRT",
|
|
4191
|
+
number: 6,
|
|
4192
|
+
action: "core",
|
|
4193
|
+
description: "Aborted",
|
|
4194
|
+
standard: "ansi"
|
|
4195
|
+
},
|
|
4196
|
+
{
|
|
4197
|
+
name: "SIGIOT",
|
|
4198
|
+
number: 6,
|
|
4199
|
+
action: "core",
|
|
4200
|
+
description: "Aborted",
|
|
4201
|
+
standard: "bsd"
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
name: "SIGBUS",
|
|
4205
|
+
number: 7,
|
|
4206
|
+
action: "core",
|
|
4207
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
4208
|
+
standard: "bsd"
|
|
4209
|
+
},
|
|
4210
|
+
{
|
|
4211
|
+
name: "SIGEMT",
|
|
4212
|
+
number: 7,
|
|
4213
|
+
action: "terminate",
|
|
4214
|
+
description: "Command should be emulated but is not implemented",
|
|
4215
|
+
standard: "other"
|
|
4216
|
+
},
|
|
4217
|
+
{
|
|
4218
|
+
name: "SIGFPE",
|
|
4219
|
+
number: 8,
|
|
4220
|
+
action: "core",
|
|
4221
|
+
description: "Floating point arithmetic error",
|
|
4222
|
+
standard: "ansi"
|
|
4223
|
+
},
|
|
4224
|
+
{
|
|
4225
|
+
name: "SIGKILL",
|
|
4226
|
+
number: 9,
|
|
4227
|
+
action: "terminate",
|
|
4228
|
+
description: "Forced termination",
|
|
4229
|
+
standard: "posix",
|
|
4230
|
+
forced: true
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
name: "SIGUSR1",
|
|
4234
|
+
number: 10,
|
|
4235
|
+
action: "terminate",
|
|
4236
|
+
description: "Application-specific signal",
|
|
4237
|
+
standard: "posix"
|
|
4238
|
+
},
|
|
4239
|
+
{
|
|
4240
|
+
name: "SIGSEGV",
|
|
4241
|
+
number: 11,
|
|
4242
|
+
action: "core",
|
|
4243
|
+
description: "Segmentation fault",
|
|
4244
|
+
standard: "ansi"
|
|
4245
|
+
},
|
|
4246
|
+
{
|
|
4247
|
+
name: "SIGUSR2",
|
|
4248
|
+
number: 12,
|
|
4249
|
+
action: "terminate",
|
|
4250
|
+
description: "Application-specific signal",
|
|
4251
|
+
standard: "posix"
|
|
4252
|
+
},
|
|
4253
|
+
{
|
|
4254
|
+
name: "SIGPIPE",
|
|
4255
|
+
number: 13,
|
|
4256
|
+
action: "terminate",
|
|
4257
|
+
description: "Broken pipe or socket",
|
|
4258
|
+
standard: "posix"
|
|
4259
|
+
},
|
|
4260
|
+
{
|
|
4261
|
+
name: "SIGALRM",
|
|
4262
|
+
number: 14,
|
|
4263
|
+
action: "terminate",
|
|
4264
|
+
description: "Timeout or timer",
|
|
4265
|
+
standard: "posix"
|
|
4266
|
+
},
|
|
4267
|
+
{
|
|
4268
|
+
name: "SIGTERM",
|
|
4269
|
+
number: 15,
|
|
4270
|
+
action: "terminate",
|
|
4271
|
+
description: "Termination",
|
|
4272
|
+
standard: "ansi"
|
|
4273
|
+
},
|
|
4274
|
+
{
|
|
4275
|
+
name: "SIGSTKFLT",
|
|
4276
|
+
number: 16,
|
|
4277
|
+
action: "terminate",
|
|
4278
|
+
description: "Stack is empty or overflowed",
|
|
4279
|
+
standard: "other"
|
|
4280
|
+
},
|
|
4281
|
+
{
|
|
4282
|
+
name: "SIGCHLD",
|
|
4283
|
+
number: 17,
|
|
4284
|
+
action: "ignore",
|
|
4285
|
+
description: "Child process terminated, paused or unpaused",
|
|
4286
|
+
standard: "posix"
|
|
4287
|
+
},
|
|
4288
|
+
{
|
|
4289
|
+
name: "SIGCLD",
|
|
4290
|
+
number: 17,
|
|
4291
|
+
action: "ignore",
|
|
4292
|
+
description: "Child process terminated, paused or unpaused",
|
|
4293
|
+
standard: "other"
|
|
4294
|
+
},
|
|
4295
|
+
{
|
|
4296
|
+
name: "SIGCONT",
|
|
4297
|
+
number: 18,
|
|
4298
|
+
action: "unpause",
|
|
4299
|
+
description: "Unpaused",
|
|
4300
|
+
standard: "posix",
|
|
4301
|
+
forced: true
|
|
4302
|
+
},
|
|
4303
|
+
{
|
|
4304
|
+
name: "SIGSTOP",
|
|
4305
|
+
number: 19,
|
|
4306
|
+
action: "pause",
|
|
4307
|
+
description: "Paused",
|
|
4308
|
+
standard: "posix",
|
|
4309
|
+
forced: true
|
|
4310
|
+
},
|
|
4311
|
+
{
|
|
4312
|
+
name: "SIGTSTP",
|
|
4313
|
+
number: 20,
|
|
4314
|
+
action: "pause",
|
|
4315
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
4316
|
+
standard: "posix"
|
|
4317
|
+
},
|
|
4318
|
+
{
|
|
4319
|
+
name: "SIGTTIN",
|
|
4320
|
+
number: 21,
|
|
4321
|
+
action: "pause",
|
|
4322
|
+
description: "Background process cannot read terminal input",
|
|
4323
|
+
standard: "posix"
|
|
4324
|
+
},
|
|
4325
|
+
{
|
|
4326
|
+
name: "SIGBREAK",
|
|
4327
|
+
number: 21,
|
|
4328
|
+
action: "terminate",
|
|
4329
|
+
description: "User interruption with CTRL-BREAK",
|
|
4330
|
+
standard: "other"
|
|
4331
|
+
},
|
|
4332
|
+
{
|
|
4333
|
+
name: "SIGTTOU",
|
|
4334
|
+
number: 22,
|
|
4335
|
+
action: "pause",
|
|
4336
|
+
description: "Background process cannot write to terminal output",
|
|
4337
|
+
standard: "posix"
|
|
4338
|
+
},
|
|
4339
|
+
{
|
|
4340
|
+
name: "SIGURG",
|
|
4341
|
+
number: 23,
|
|
4342
|
+
action: "ignore",
|
|
4343
|
+
description: "Socket received out-of-band data",
|
|
4344
|
+
standard: "bsd"
|
|
4345
|
+
},
|
|
4346
|
+
{
|
|
4347
|
+
name: "SIGXCPU",
|
|
4348
|
+
number: 24,
|
|
4349
|
+
action: "core",
|
|
4350
|
+
description: "Process timed out",
|
|
4351
|
+
standard: "bsd"
|
|
4352
|
+
},
|
|
4353
|
+
{
|
|
4354
|
+
name: "SIGXFSZ",
|
|
4355
|
+
number: 25,
|
|
4356
|
+
action: "core",
|
|
4357
|
+
description: "File too big",
|
|
4358
|
+
standard: "bsd"
|
|
4359
|
+
},
|
|
4360
|
+
{
|
|
4361
|
+
name: "SIGVTALRM",
|
|
4362
|
+
number: 26,
|
|
4363
|
+
action: "terminate",
|
|
4364
|
+
description: "Timeout or timer",
|
|
4365
|
+
standard: "bsd"
|
|
4366
|
+
},
|
|
4367
|
+
{
|
|
4368
|
+
name: "SIGPROF",
|
|
4369
|
+
number: 27,
|
|
4370
|
+
action: "terminate",
|
|
4371
|
+
description: "Timeout or timer",
|
|
4372
|
+
standard: "bsd"
|
|
4373
|
+
},
|
|
4374
|
+
{
|
|
4375
|
+
name: "SIGWINCH",
|
|
4376
|
+
number: 28,
|
|
4377
|
+
action: "ignore",
|
|
4378
|
+
description: "Terminal window size changed",
|
|
4379
|
+
standard: "bsd"
|
|
4380
|
+
},
|
|
4381
|
+
{
|
|
4382
|
+
name: "SIGIO",
|
|
4383
|
+
number: 29,
|
|
4384
|
+
action: "terminate",
|
|
4385
|
+
description: "I/O is available",
|
|
4386
|
+
standard: "other"
|
|
4387
|
+
},
|
|
4388
|
+
{
|
|
4389
|
+
name: "SIGPOLL",
|
|
4390
|
+
number: 29,
|
|
4391
|
+
action: "terminate",
|
|
4392
|
+
description: "Watched event",
|
|
4393
|
+
standard: "other"
|
|
4394
|
+
},
|
|
4395
|
+
{
|
|
4396
|
+
name: "SIGINFO",
|
|
4397
|
+
number: 29,
|
|
4398
|
+
action: "ignore",
|
|
4399
|
+
description: "Request for process information",
|
|
4400
|
+
standard: "other"
|
|
4401
|
+
},
|
|
4402
|
+
{
|
|
4403
|
+
name: "SIGPWR",
|
|
4404
|
+
number: 30,
|
|
4405
|
+
action: "terminate",
|
|
4406
|
+
description: "Device running out of power",
|
|
4407
|
+
standard: "systemv"
|
|
4408
|
+
},
|
|
4409
|
+
{
|
|
4410
|
+
name: "SIGSYS",
|
|
4411
|
+
number: 31,
|
|
4412
|
+
action: "core",
|
|
4413
|
+
description: "Invalid system call",
|
|
4414
|
+
standard: "other"
|
|
4415
|
+
},
|
|
4416
|
+
{
|
|
4417
|
+
name: "SIGUNUSED",
|
|
4418
|
+
number: 31,
|
|
4419
|
+
action: "terminate",
|
|
4420
|
+
description: "Invalid system call",
|
|
4421
|
+
standard: "other"
|
|
4422
|
+
}
|
|
4423
|
+
];
|
|
4424
|
+
|
|
4425
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
|
|
4426
|
+
var getSignals2 = () => {
|
|
4427
|
+
const realtimeSignals = getRealtimeSignals2();
|
|
4428
|
+
const signals2 = [...SIGNALS2, ...realtimeSignals].map(normalizeSignal2);
|
|
4429
|
+
return signals2;
|
|
4430
|
+
};
|
|
4431
|
+
var normalizeSignal2 = ({
|
|
4432
|
+
name,
|
|
4433
|
+
number: defaultNumber,
|
|
4434
|
+
description,
|
|
4435
|
+
action,
|
|
4436
|
+
forced = false,
|
|
4437
|
+
standard
|
|
4438
|
+
}) => {
|
|
4439
|
+
const {
|
|
4440
|
+
signals: { [name]: constantSignal }
|
|
4441
|
+
} = os.constants;
|
|
4442
|
+
const supported = constantSignal !== void 0;
|
|
4443
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
4444
|
+
return { name, number, description, supported, action, forced, standard };
|
|
4445
|
+
};
|
|
4446
|
+
|
|
4447
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
|
|
4448
|
+
var getSignalsByName2 = () => {
|
|
4449
|
+
const signals2 = getSignals2();
|
|
4450
|
+
return Object.fromEntries(signals2.map(getSignalByName2));
|
|
4451
|
+
};
|
|
4452
|
+
var getSignalByName2 = ({
|
|
4453
|
+
name,
|
|
4454
|
+
number,
|
|
4455
|
+
description,
|
|
4456
|
+
supported,
|
|
4457
|
+
action,
|
|
4458
|
+
forced,
|
|
4459
|
+
standard
|
|
4460
|
+
}) => [name, { name, number, description, supported, action, forced, standard }];
|
|
4461
|
+
var signalsByName2 = getSignalsByName2();
|
|
4462
|
+
var getSignalsByNumber2 = () => {
|
|
4463
|
+
const signals2 = getSignals2();
|
|
4464
|
+
const length = SIGRTMAX2 + 1;
|
|
4465
|
+
const signalsA = Array.from(
|
|
4466
|
+
{ length },
|
|
4467
|
+
(value, number) => getSignalByNumber2(number, signals2)
|
|
4468
|
+
);
|
|
4469
|
+
return Object.assign({}, ...signalsA);
|
|
4470
|
+
};
|
|
4471
|
+
var getSignalByNumber2 = (number, signals2) => {
|
|
4472
|
+
const signal = findSignalByNumber2(number, signals2);
|
|
4473
|
+
if (signal === void 0) {
|
|
4474
|
+
return {};
|
|
4475
|
+
}
|
|
4476
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
4477
|
+
return {
|
|
4478
|
+
[number]: {
|
|
4479
|
+
name,
|
|
4480
|
+
number,
|
|
4481
|
+
description,
|
|
4482
|
+
supported,
|
|
4483
|
+
action,
|
|
4484
|
+
forced,
|
|
4485
|
+
standard
|
|
4486
|
+
}
|
|
4487
|
+
};
|
|
4488
|
+
};
|
|
4489
|
+
var findSignalByNumber2 = (number, signals2) => {
|
|
4490
|
+
const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
|
|
4491
|
+
if (signal !== void 0) {
|
|
4492
|
+
return signal;
|
|
4493
|
+
}
|
|
4494
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
4495
|
+
};
|
|
4496
|
+
getSignalsByNumber2();
|
|
4497
|
+
|
|
4498
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
|
|
4499
|
+
var getErrorPrefix2 = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
4500
|
+
if (timedOut) {
|
|
4501
|
+
return `timed out after ${timeout} milliseconds`;
|
|
4502
|
+
}
|
|
4503
|
+
if (isCanceled) {
|
|
4504
|
+
return "was canceled";
|
|
4505
|
+
}
|
|
4506
|
+
if (errorCode !== void 0) {
|
|
4507
|
+
return `failed with ${errorCode}`;
|
|
4508
|
+
}
|
|
4509
|
+
if (signal !== void 0) {
|
|
4510
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
4511
|
+
}
|
|
4512
|
+
if (exitCode !== void 0) {
|
|
4513
|
+
return `failed with exit code ${exitCode}`;
|
|
4514
|
+
}
|
|
4515
|
+
return "failed";
|
|
4516
|
+
};
|
|
4517
|
+
var makeError2 = ({
|
|
4518
|
+
stdout,
|
|
4519
|
+
stderr,
|
|
4520
|
+
all,
|
|
4521
|
+
error,
|
|
4522
|
+
signal,
|
|
4523
|
+
exitCode,
|
|
4524
|
+
command,
|
|
4525
|
+
escapedCommand,
|
|
4526
|
+
timedOut,
|
|
4527
|
+
isCanceled,
|
|
4528
|
+
killed,
|
|
4529
|
+
parsed: { options: { timeout, cwd = process2__default.default.cwd() } }
|
|
4530
|
+
}) => {
|
|
4531
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
4532
|
+
signal = signal === null ? void 0 : signal;
|
|
4533
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName2[signal].description;
|
|
4534
|
+
const errorCode = error && error.code;
|
|
4535
|
+
const prefix = getErrorPrefix2({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
4536
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
4537
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
4538
|
+
const shortMessage = isError ? `${execaMessage}
|
|
4539
|
+
${error.message}` : execaMessage;
|
|
4540
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
4541
|
+
if (isError) {
|
|
4542
|
+
error.originalMessage = error.message;
|
|
4543
|
+
error.message = message;
|
|
4544
|
+
} else {
|
|
4545
|
+
error = new Error(message);
|
|
4546
|
+
}
|
|
4547
|
+
error.shortMessage = shortMessage;
|
|
4548
|
+
error.command = command;
|
|
4549
|
+
error.escapedCommand = escapedCommand;
|
|
4550
|
+
error.exitCode = exitCode;
|
|
4551
|
+
error.signal = signal;
|
|
4552
|
+
error.signalDescription = signalDescription;
|
|
4553
|
+
error.stdout = stdout;
|
|
4554
|
+
error.stderr = stderr;
|
|
4555
|
+
error.cwd = cwd;
|
|
4556
|
+
if (all !== void 0) {
|
|
4557
|
+
error.all = all;
|
|
4558
|
+
}
|
|
4559
|
+
if ("bufferedData" in error) {
|
|
4560
|
+
delete error.bufferedData;
|
|
4561
|
+
}
|
|
4562
|
+
error.failed = true;
|
|
4563
|
+
error.timedOut = Boolean(timedOut);
|
|
4564
|
+
error.isCanceled = isCanceled;
|
|
4565
|
+
error.killed = killed && !timedOut;
|
|
4566
|
+
return error;
|
|
4567
|
+
};
|
|
4568
|
+
|
|
4569
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
|
|
4570
|
+
var aliases2 = ["stdin", "stdout", "stderr"];
|
|
4571
|
+
var hasAlias2 = (options) => aliases2.some((alias) => options[alias] !== void 0);
|
|
4572
|
+
var normalizeStdio2 = (options) => {
|
|
4573
|
+
if (!options) {
|
|
4574
|
+
return;
|
|
4575
|
+
}
|
|
4576
|
+
const { stdio } = options;
|
|
4577
|
+
if (stdio === void 0) {
|
|
4578
|
+
return aliases2.map((alias) => options[alias]);
|
|
4579
|
+
}
|
|
4580
|
+
if (hasAlias2(options)) {
|
|
4581
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases2.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
4582
|
+
}
|
|
4583
|
+
if (typeof stdio === "string") {
|
|
4584
|
+
return stdio;
|
|
4585
|
+
}
|
|
4586
|
+
if (!Array.isArray(stdio)) {
|
|
4587
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
4588
|
+
}
|
|
4589
|
+
const length = Math.max(stdio.length, aliases2.length);
|
|
4590
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
4594
|
+
var signals = [];
|
|
4595
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
4596
|
+
if (process.platform !== "win32") {
|
|
4597
|
+
signals.push(
|
|
4598
|
+
"SIGALRM",
|
|
4599
|
+
"SIGABRT",
|
|
4600
|
+
"SIGVTALRM",
|
|
4601
|
+
"SIGXCPU",
|
|
4602
|
+
"SIGXFSZ",
|
|
4603
|
+
"SIGUSR2",
|
|
4604
|
+
"SIGTRAP",
|
|
4605
|
+
"SIGSYS",
|
|
4606
|
+
"SIGQUIT",
|
|
4607
|
+
"SIGIOT"
|
|
4608
|
+
// should detect profiler and enable/disable accordingly.
|
|
4609
|
+
// see #21
|
|
4610
|
+
// 'SIGPROF'
|
|
4611
|
+
);
|
|
4612
|
+
}
|
|
4613
|
+
if (process.platform === "linux") {
|
|
4614
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
4615
|
+
}
|
|
4616
|
+
|
|
4617
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
4618
|
+
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";
|
|
4619
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
4620
|
+
var global2 = globalThis;
|
|
4621
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
4622
|
+
var Emitter = class {
|
|
4623
|
+
emitted = {
|
|
4624
|
+
afterExit: false,
|
|
4625
|
+
exit: false
|
|
4626
|
+
};
|
|
4627
|
+
listeners = {
|
|
4628
|
+
afterExit: [],
|
|
4629
|
+
exit: []
|
|
4630
|
+
};
|
|
4631
|
+
count = 0;
|
|
4632
|
+
id = Math.random();
|
|
4633
|
+
constructor() {
|
|
4634
|
+
if (global2[kExitEmitter]) {
|
|
4635
|
+
return global2[kExitEmitter];
|
|
4636
|
+
}
|
|
4637
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
4638
|
+
value: this,
|
|
4639
|
+
writable: false,
|
|
4640
|
+
enumerable: false,
|
|
4641
|
+
configurable: false
|
|
4642
|
+
});
|
|
4643
|
+
}
|
|
4644
|
+
on(ev, fn) {
|
|
4645
|
+
this.listeners[ev].push(fn);
|
|
4646
|
+
}
|
|
4647
|
+
removeListener(ev, fn) {
|
|
4648
|
+
const list = this.listeners[ev];
|
|
4649
|
+
const i = list.indexOf(fn);
|
|
4650
|
+
if (i === -1) {
|
|
4651
|
+
return;
|
|
4652
|
+
}
|
|
4653
|
+
if (i === 0 && list.length === 1) {
|
|
4654
|
+
list.length = 0;
|
|
4655
|
+
} else {
|
|
4656
|
+
list.splice(i, 1);
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
emit(ev, code, signal) {
|
|
4660
|
+
if (this.emitted[ev]) {
|
|
4661
|
+
return false;
|
|
4662
|
+
}
|
|
4663
|
+
this.emitted[ev] = true;
|
|
4664
|
+
let ret = false;
|
|
4665
|
+
for (const fn of this.listeners[ev]) {
|
|
4666
|
+
ret = fn(code, signal) === true || ret;
|
|
4667
|
+
}
|
|
4668
|
+
if (ev === "exit") {
|
|
4669
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
4670
|
+
}
|
|
4671
|
+
return ret;
|
|
4672
|
+
}
|
|
4673
|
+
};
|
|
4674
|
+
var SignalExitBase = class {
|
|
4675
|
+
};
|
|
4676
|
+
var signalExitWrap = (handler) => {
|
|
4677
|
+
return {
|
|
4678
|
+
onExit(cb, opts) {
|
|
4679
|
+
return handler.onExit(cb, opts);
|
|
4680
|
+
},
|
|
4681
|
+
load() {
|
|
4682
|
+
return handler.load();
|
|
4683
|
+
},
|
|
4684
|
+
unload() {
|
|
4685
|
+
return handler.unload();
|
|
4686
|
+
}
|
|
4687
|
+
};
|
|
4688
|
+
};
|
|
4689
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
4690
|
+
onExit() {
|
|
4691
|
+
return () => {
|
|
4692
|
+
};
|
|
4693
|
+
}
|
|
4694
|
+
load() {
|
|
4695
|
+
}
|
|
4696
|
+
unload() {
|
|
4697
|
+
}
|
|
4698
|
+
};
|
|
4699
|
+
var SignalExit = class extends SignalExitBase {
|
|
4700
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
4701
|
+
// so use a supported signal instead
|
|
4702
|
+
/* c8 ignore start */
|
|
4703
|
+
#hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
4704
|
+
/* c8 ignore stop */
|
|
4705
|
+
#emitter = new Emitter();
|
|
4706
|
+
#process;
|
|
4707
|
+
#originalProcessEmit;
|
|
4708
|
+
#originalProcessReallyExit;
|
|
4709
|
+
#sigListeners = {};
|
|
4710
|
+
#loaded = false;
|
|
4711
|
+
constructor(process13) {
|
|
4712
|
+
super();
|
|
4713
|
+
this.#process = process13;
|
|
4714
|
+
this.#sigListeners = {};
|
|
4715
|
+
for (const sig of signals) {
|
|
4716
|
+
this.#sigListeners[sig] = () => {
|
|
4717
|
+
const listeners = this.#process.listeners(sig);
|
|
4718
|
+
let { count } = this.#emitter;
|
|
4719
|
+
const p = process13;
|
|
4720
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
4721
|
+
count += p.__signal_exit_emitter__.count;
|
|
4722
|
+
}
|
|
4723
|
+
if (listeners.length === count) {
|
|
4724
|
+
this.unload();
|
|
4725
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
4726
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
4727
|
+
if (!ret)
|
|
4728
|
+
process13.kill(process13.pid, s);
|
|
4729
|
+
}
|
|
4730
|
+
};
|
|
4731
|
+
}
|
|
4732
|
+
this.#originalProcessReallyExit = process13.reallyExit;
|
|
4733
|
+
this.#originalProcessEmit = process13.emit;
|
|
4734
|
+
}
|
|
4735
|
+
onExit(cb, opts) {
|
|
4736
|
+
if (!processOk(this.#process)) {
|
|
4737
|
+
return () => {
|
|
4738
|
+
};
|
|
4739
|
+
}
|
|
4740
|
+
if (this.#loaded === false) {
|
|
4741
|
+
this.load();
|
|
4742
|
+
}
|
|
4743
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
4744
|
+
this.#emitter.on(ev, cb);
|
|
4745
|
+
return () => {
|
|
4746
|
+
this.#emitter.removeListener(ev, cb);
|
|
4747
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
4748
|
+
this.unload();
|
|
4749
|
+
}
|
|
4750
|
+
};
|
|
4751
|
+
}
|
|
4752
|
+
load() {
|
|
4753
|
+
if (this.#loaded) {
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4756
|
+
this.#loaded = true;
|
|
4757
|
+
this.#emitter.count += 1;
|
|
4758
|
+
for (const sig of signals) {
|
|
4759
|
+
try {
|
|
4760
|
+
const fn = this.#sigListeners[sig];
|
|
4761
|
+
if (fn)
|
|
4762
|
+
this.#process.on(sig, fn);
|
|
4763
|
+
} catch (_) {
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
this.#process.emit = (ev, ...a) => {
|
|
4767
|
+
return this.#processEmit(ev, ...a);
|
|
4768
|
+
};
|
|
4769
|
+
this.#process.reallyExit = (code) => {
|
|
4770
|
+
return this.#processReallyExit(code);
|
|
4771
|
+
};
|
|
4772
|
+
}
|
|
4773
|
+
unload() {
|
|
4774
|
+
if (!this.#loaded) {
|
|
4775
|
+
return;
|
|
4776
|
+
}
|
|
4777
|
+
this.#loaded = false;
|
|
4778
|
+
signals.forEach((sig) => {
|
|
4779
|
+
const listener = this.#sigListeners[sig];
|
|
4780
|
+
if (!listener) {
|
|
4781
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
4782
|
+
}
|
|
4783
|
+
try {
|
|
4784
|
+
this.#process.removeListener(sig, listener);
|
|
4785
|
+
} catch (_) {
|
|
4786
|
+
}
|
|
4787
|
+
});
|
|
4788
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
4789
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
4790
|
+
this.#emitter.count -= 1;
|
|
4791
|
+
}
|
|
4792
|
+
#processReallyExit(code) {
|
|
4793
|
+
if (!processOk(this.#process)) {
|
|
4794
|
+
return 0;
|
|
4795
|
+
}
|
|
4796
|
+
this.#process.exitCode = code || 0;
|
|
4797
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4798
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
4799
|
+
}
|
|
4800
|
+
#processEmit(ev, ...args) {
|
|
4801
|
+
const og = this.#originalProcessEmit;
|
|
4802
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
4803
|
+
if (typeof args[0] === "number") {
|
|
4804
|
+
this.#process.exitCode = args[0];
|
|
4805
|
+
}
|
|
4806
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
4807
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4808
|
+
return ret;
|
|
4809
|
+
} else {
|
|
4810
|
+
return og.call(this.#process, ev, ...args);
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
};
|
|
4814
|
+
var process6 = globalThis.process;
|
|
4815
|
+
var {
|
|
4816
|
+
/**
|
|
4817
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
4818
|
+
* exit, or running out of stuff to do.
|
|
4819
|
+
*
|
|
4820
|
+
* If the global process object is not suitable for instrumentation,
|
|
4821
|
+
* then this will be a no-op.
|
|
4822
|
+
*
|
|
4823
|
+
* Returns a function that may be used to unload signal-exit.
|
|
4824
|
+
*/
|
|
4825
|
+
onExit: onExit2} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback());
|
|
4826
|
+
|
|
4827
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
|
|
4828
|
+
var DEFAULT_FORCE_KILL_TIMEOUT2 = 1e3 * 5;
|
|
4829
|
+
var spawnedKill2 = (kill2, signal = "SIGTERM", options = {}) => {
|
|
4830
|
+
const killResult = kill2(signal);
|
|
4831
|
+
setKillTimeout2(kill2, signal, options, killResult);
|
|
4832
|
+
return killResult;
|
|
4833
|
+
};
|
|
4834
|
+
var setKillTimeout2 = (kill2, signal, options, killResult) => {
|
|
4835
|
+
if (!shouldForceKill2(signal, options, killResult)) {
|
|
4836
|
+
return;
|
|
4837
|
+
}
|
|
4838
|
+
const timeout = getForceKillAfterTimeout2(options);
|
|
4839
|
+
const t = setTimeout(() => {
|
|
4840
|
+
kill2("SIGKILL");
|
|
4841
|
+
}, timeout);
|
|
4842
|
+
if (t.unref) {
|
|
4843
|
+
t.unref();
|
|
4844
|
+
}
|
|
4845
|
+
};
|
|
4846
|
+
var shouldForceKill2 = (signal, { forceKillAfterTimeout }, killResult) => isSigterm2(signal) && forceKillAfterTimeout !== false && killResult;
|
|
4847
|
+
var isSigterm2 = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
4848
|
+
var getForceKillAfterTimeout2 = ({ forceKillAfterTimeout = true }) => {
|
|
4849
|
+
if (forceKillAfterTimeout === true) {
|
|
4850
|
+
return DEFAULT_FORCE_KILL_TIMEOUT2;
|
|
4851
|
+
}
|
|
4852
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
4853
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
4854
|
+
}
|
|
4855
|
+
return forceKillAfterTimeout;
|
|
4856
|
+
};
|
|
4857
|
+
var spawnedCancel2 = (spawned, context) => {
|
|
4858
|
+
const killResult = spawned.kill();
|
|
4859
|
+
if (killResult) {
|
|
4860
|
+
context.isCanceled = true;
|
|
4861
|
+
}
|
|
4862
|
+
};
|
|
4863
|
+
var timeoutKill2 = (spawned, signal, reject) => {
|
|
4864
|
+
spawned.kill(signal);
|
|
4865
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
4866
|
+
};
|
|
4867
|
+
var setupTimeout2 = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
4868
|
+
if (timeout === 0 || timeout === void 0) {
|
|
4869
|
+
return spawnedPromise;
|
|
4870
|
+
}
|
|
4871
|
+
let timeoutId;
|
|
4872
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
4873
|
+
timeoutId = setTimeout(() => {
|
|
4874
|
+
timeoutKill2(spawned, killSignal, reject);
|
|
4875
|
+
}, timeout);
|
|
4876
|
+
});
|
|
4877
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
4878
|
+
clearTimeout(timeoutId);
|
|
4879
|
+
});
|
|
4880
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
4881
|
+
};
|
|
4882
|
+
var validateTimeout2 = ({ timeout }) => {
|
|
4883
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
4884
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
4885
|
+
}
|
|
4886
|
+
};
|
|
4887
|
+
var setExitHandler2 = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
4888
|
+
if (!cleanup || detached) {
|
|
4889
|
+
return timedPromise;
|
|
4890
|
+
}
|
|
4891
|
+
const removeExitHandler = onExit2(() => {
|
|
4892
|
+
spawned.kill();
|
|
4893
|
+
});
|
|
4894
|
+
return timedPromise.finally(() => {
|
|
4895
|
+
removeExitHandler();
|
|
4896
|
+
});
|
|
4897
|
+
};
|
|
4898
|
+
var isExecaChildProcess = (target) => target instanceof childProcess2.ChildProcess && typeof target.then === "function";
|
|
4899
|
+
var pipeToTarget = (spawned, streamName, target) => {
|
|
4900
|
+
if (typeof target === "string") {
|
|
4901
|
+
spawned[streamName].pipe(fs.createWriteStream(target));
|
|
4902
|
+
return spawned;
|
|
4903
|
+
}
|
|
4904
|
+
if (isWritableStream(target)) {
|
|
4905
|
+
spawned[streamName].pipe(target);
|
|
4906
|
+
return spawned;
|
|
4907
|
+
}
|
|
4908
|
+
if (!isExecaChildProcess(target)) {
|
|
4909
|
+
throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
|
|
4910
|
+
}
|
|
4911
|
+
if (!isWritableStream(target.stdin)) {
|
|
4912
|
+
throw new TypeError("The target child process's stdin must be available.");
|
|
4913
|
+
}
|
|
4914
|
+
spawned[streamName].pipe(target.stdin);
|
|
4915
|
+
return target;
|
|
4916
|
+
};
|
|
4917
|
+
var addPipeMethods = (spawned) => {
|
|
4918
|
+
if (spawned.stdout !== null) {
|
|
4919
|
+
spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
|
|
4920
|
+
}
|
|
4921
|
+
if (spawned.stderr !== null) {
|
|
4922
|
+
spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
|
|
4923
|
+
}
|
|
4924
|
+
if (spawned.all !== void 0) {
|
|
4925
|
+
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
4926
|
+
}
|
|
4927
|
+
};
|
|
4928
|
+
|
|
4929
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
|
|
4930
|
+
var getStreamContents = async (stream2, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
4931
|
+
if (!isAsyncIterable(stream2)) {
|
|
4932
|
+
throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
4933
|
+
}
|
|
4934
|
+
const state = init();
|
|
4935
|
+
state.length = 0;
|
|
4936
|
+
try {
|
|
4937
|
+
for await (const chunk of stream2) {
|
|
4938
|
+
const chunkType = getChunkType(chunk);
|
|
4939
|
+
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
4940
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4941
|
+
}
|
|
4942
|
+
appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
|
|
4943
|
+
return finalize(state);
|
|
4944
|
+
} catch (error) {
|
|
4945
|
+
error.bufferedData = finalize(state);
|
|
4946
|
+
throw error;
|
|
4947
|
+
}
|
|
4948
|
+
};
|
|
4949
|
+
var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
4950
|
+
const convertedChunk = getFinalChunk(state);
|
|
4951
|
+
if (convertedChunk !== void 0) {
|
|
4952
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4953
|
+
}
|
|
4954
|
+
};
|
|
4955
|
+
var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
4956
|
+
const chunkSize = getSize(convertedChunk);
|
|
4957
|
+
const newLength = state.length + chunkSize;
|
|
4958
|
+
if (newLength <= maxBuffer) {
|
|
4959
|
+
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
4960
|
+
return;
|
|
4961
|
+
}
|
|
4962
|
+
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
4963
|
+
if (truncatedChunk !== void 0) {
|
|
4964
|
+
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
4965
|
+
}
|
|
4966
|
+
throw new MaxBufferError();
|
|
4967
|
+
};
|
|
4968
|
+
var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
4969
|
+
state.contents = addChunk(convertedChunk, state, newLength);
|
|
4970
|
+
state.length = newLength;
|
|
4971
|
+
};
|
|
4972
|
+
var isAsyncIterable = (stream2) => typeof stream2 === "object" && stream2 !== null && typeof stream2[Symbol.asyncIterator] === "function";
|
|
4973
|
+
var getChunkType = (chunk) => {
|
|
4974
|
+
const typeOfChunk = typeof chunk;
|
|
4975
|
+
if (typeOfChunk === "string") {
|
|
4976
|
+
return "string";
|
|
4977
|
+
}
|
|
4978
|
+
if (typeOfChunk !== "object" || chunk === null) {
|
|
4979
|
+
return "others";
|
|
4980
|
+
}
|
|
4981
|
+
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
4982
|
+
return "buffer";
|
|
4983
|
+
}
|
|
4984
|
+
const prototypeName = objectToString.call(chunk);
|
|
4985
|
+
if (prototypeName === "[object ArrayBuffer]") {
|
|
4986
|
+
return "arrayBuffer";
|
|
4987
|
+
}
|
|
4988
|
+
if (prototypeName === "[object DataView]") {
|
|
4989
|
+
return "dataView";
|
|
4990
|
+
}
|
|
4991
|
+
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
4992
|
+
return "typedArray";
|
|
4993
|
+
}
|
|
4994
|
+
return "others";
|
|
4995
|
+
};
|
|
4996
|
+
var { toString: objectToString } = Object.prototype;
|
|
4997
|
+
var MaxBufferError = class extends Error {
|
|
4998
|
+
name = "MaxBufferError";
|
|
4999
|
+
constructor() {
|
|
5000
|
+
super("maxBuffer exceeded");
|
|
5001
|
+
}
|
|
5002
|
+
};
|
|
5003
|
+
|
|
5004
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
|
|
5005
|
+
var identity = (value) => value;
|
|
5006
|
+
var noop = () => void 0;
|
|
5007
|
+
var getContentsProp = ({ contents }) => contents;
|
|
5008
|
+
var throwObjectStream = (chunk) => {
|
|
5009
|
+
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
5010
|
+
};
|
|
5011
|
+
var getLengthProp = (convertedChunk) => convertedChunk.length;
|
|
5012
|
+
|
|
5013
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
|
|
5014
|
+
async function getStreamAsArrayBuffer(stream2, options) {
|
|
5015
|
+
return getStreamContents(stream2, arrayBufferMethods, options);
|
|
5016
|
+
}
|
|
5017
|
+
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
|
|
5018
|
+
var useTextEncoder = (chunk) => textEncoder.encode(chunk);
|
|
5019
|
+
var textEncoder = new TextEncoder();
|
|
5020
|
+
var useUint8Array = (chunk) => new Uint8Array(chunk);
|
|
5021
|
+
var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
5022
|
+
var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
5023
|
+
var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
5024
|
+
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
5025
|
+
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
5026
|
+
return newContents;
|
|
5027
|
+
};
|
|
5028
|
+
var resizeArrayBufferSlow = (contents, length) => {
|
|
5029
|
+
if (length <= contents.byteLength) {
|
|
5030
|
+
return contents;
|
|
5031
|
+
}
|
|
5032
|
+
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
5033
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
5034
|
+
return arrayBuffer;
|
|
5035
|
+
};
|
|
5036
|
+
var resizeArrayBuffer = (contents, length) => {
|
|
5037
|
+
if (length <= contents.maxByteLength) {
|
|
5038
|
+
contents.resize(length);
|
|
5039
|
+
return contents;
|
|
5040
|
+
}
|
|
5041
|
+
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
5042
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
5043
|
+
return arrayBuffer;
|
|
5044
|
+
};
|
|
5045
|
+
var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
5046
|
+
var SCALE_FACTOR = 2;
|
|
5047
|
+
var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
5048
|
+
var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
|
|
5049
|
+
var arrayBufferMethods = {
|
|
5050
|
+
init: initArrayBuffer,
|
|
5051
|
+
convertChunk: {
|
|
5052
|
+
string: useTextEncoder,
|
|
5053
|
+
buffer: useUint8Array,
|
|
5054
|
+
arrayBuffer: useUint8Array,
|
|
5055
|
+
dataView: useUint8ArrayWithOffset,
|
|
5056
|
+
typedArray: useUint8ArrayWithOffset,
|
|
5057
|
+
others: throwObjectStream
|
|
5058
|
+
},
|
|
5059
|
+
getSize: getLengthProp,
|
|
5060
|
+
truncateChunk: truncateArrayBufferChunk,
|
|
5061
|
+
addChunk: addArrayBufferChunk,
|
|
5062
|
+
getFinalChunk: noop,
|
|
5063
|
+
finalize: finalizeArrayBuffer
|
|
5064
|
+
};
|
|
5065
|
+
|
|
5066
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
|
|
5067
|
+
async function getStreamAsBuffer(stream2, options) {
|
|
5068
|
+
if (!("Buffer" in globalThis)) {
|
|
5069
|
+
throw new Error("getStreamAsBuffer() is only supported in Node.js");
|
|
5070
|
+
}
|
|
5071
|
+
try {
|
|
5072
|
+
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream2, options));
|
|
5073
|
+
} catch (error) {
|
|
5074
|
+
if (error.bufferedData !== void 0) {
|
|
5075
|
+
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
5076
|
+
}
|
|
5077
|
+
throw error;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
|
|
5081
|
+
|
|
5082
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
|
|
5083
|
+
async function getStreamAsString(stream2, options) {
|
|
5084
|
+
return getStreamContents(stream2, stringMethods, options);
|
|
5085
|
+
}
|
|
5086
|
+
var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
|
|
5087
|
+
var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
|
|
5088
|
+
var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
|
|
5089
|
+
var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
5090
|
+
var getFinalStringChunk = ({ textDecoder }) => {
|
|
5091
|
+
const finalChunk = textDecoder.decode();
|
|
5092
|
+
return finalChunk === "" ? void 0 : finalChunk;
|
|
5093
|
+
};
|
|
5094
|
+
var stringMethods = {
|
|
5095
|
+
init: initString,
|
|
5096
|
+
convertChunk: {
|
|
5097
|
+
string: identity,
|
|
5098
|
+
buffer: useTextDecoder,
|
|
5099
|
+
arrayBuffer: useTextDecoder,
|
|
5100
|
+
dataView: useTextDecoder,
|
|
5101
|
+
typedArray: useTextDecoder,
|
|
5102
|
+
others: throwObjectStream
|
|
5103
|
+
},
|
|
5104
|
+
getSize: getLengthProp,
|
|
5105
|
+
truncateChunk: truncateStringChunk,
|
|
5106
|
+
addChunk: addStringChunk,
|
|
5107
|
+
getFinalChunk: getFinalStringChunk,
|
|
5108
|
+
finalize: getContentsProp
|
|
5109
|
+
};
|
|
5110
|
+
|
|
5111
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
5112
|
+
var import_merge_stream2 = __toESM(require_merge_stream());
|
|
5113
|
+
var validateInputOptions = (input) => {
|
|
5114
|
+
if (input !== void 0) {
|
|
5115
|
+
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
|
5116
|
+
}
|
|
5117
|
+
};
|
|
5118
|
+
var getInput = ({ input, inputFile }) => {
|
|
5119
|
+
if (typeof inputFile !== "string") {
|
|
5120
|
+
return input;
|
|
5121
|
+
}
|
|
5122
|
+
validateInputOptions(input);
|
|
5123
|
+
return fs.createReadStream(inputFile);
|
|
5124
|
+
};
|
|
5125
|
+
var handleInput2 = (spawned, options) => {
|
|
5126
|
+
const input = getInput(options);
|
|
5127
|
+
if (input === void 0) {
|
|
5128
|
+
return;
|
|
5129
|
+
}
|
|
5130
|
+
if (isStream(input)) {
|
|
5131
|
+
input.pipe(spawned.stdin);
|
|
5132
|
+
} else {
|
|
5133
|
+
spawned.stdin.end(input);
|
|
5134
|
+
}
|
|
5135
|
+
};
|
|
5136
|
+
var makeAllStream2 = (spawned, { all }) => {
|
|
5137
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
5138
|
+
return;
|
|
5139
|
+
}
|
|
5140
|
+
const mixed = (0, import_merge_stream2.default)();
|
|
5141
|
+
if (spawned.stdout) {
|
|
5142
|
+
mixed.add(spawned.stdout);
|
|
5143
|
+
}
|
|
5144
|
+
if (spawned.stderr) {
|
|
5145
|
+
mixed.add(spawned.stderr);
|
|
5146
|
+
}
|
|
5147
|
+
return mixed;
|
|
5148
|
+
};
|
|
5149
|
+
var getBufferedData2 = async (stream2, streamPromise) => {
|
|
5150
|
+
if (!stream2 || streamPromise === void 0) {
|
|
5151
|
+
return;
|
|
5152
|
+
}
|
|
5153
|
+
await promises.setTimeout(0);
|
|
5154
|
+
stream2.destroy();
|
|
5155
|
+
try {
|
|
5156
|
+
return await streamPromise;
|
|
5157
|
+
} catch (error) {
|
|
5158
|
+
return error.bufferedData;
|
|
5159
|
+
}
|
|
5160
|
+
};
|
|
5161
|
+
var getStreamPromise2 = (stream2, { encoding, buffer, maxBuffer }) => {
|
|
5162
|
+
if (!stream2 || !buffer) {
|
|
5163
|
+
return;
|
|
5164
|
+
}
|
|
5165
|
+
if (encoding === "utf8" || encoding === "utf-8") {
|
|
5166
|
+
return getStreamAsString(stream2, { maxBuffer });
|
|
5167
|
+
}
|
|
5168
|
+
if (encoding === null || encoding === "buffer") {
|
|
5169
|
+
return getStreamAsBuffer(stream2, { maxBuffer });
|
|
5170
|
+
}
|
|
5171
|
+
return applyEncoding(stream2, maxBuffer, encoding);
|
|
5172
|
+
};
|
|
5173
|
+
var applyEncoding = async (stream2, maxBuffer, encoding) => {
|
|
5174
|
+
const buffer = await getStreamAsBuffer(stream2, { maxBuffer });
|
|
5175
|
+
return buffer.toString(encoding);
|
|
5176
|
+
};
|
|
5177
|
+
var getSpawnedResult2 = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
5178
|
+
const stdoutPromise = getStreamPromise2(stdout, { encoding, buffer, maxBuffer });
|
|
5179
|
+
const stderrPromise = getStreamPromise2(stderr, { encoding, buffer, maxBuffer });
|
|
5180
|
+
const allPromise = getStreamPromise2(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
5181
|
+
try {
|
|
5182
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
5183
|
+
} catch (error) {
|
|
5184
|
+
return Promise.all([
|
|
5185
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
5186
|
+
getBufferedData2(stdout, stdoutPromise),
|
|
5187
|
+
getBufferedData2(stderr, stderrPromise),
|
|
5188
|
+
getBufferedData2(all, allPromise)
|
|
5189
|
+
]);
|
|
5190
|
+
}
|
|
5191
|
+
};
|
|
5192
|
+
|
|
5193
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
|
|
5194
|
+
var nativePromisePrototype2 = (async () => {
|
|
5195
|
+
})().constructor.prototype;
|
|
5196
|
+
var descriptors2 = ["then", "catch", "finally"].map((property) => [
|
|
5197
|
+
property,
|
|
5198
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype2, property)
|
|
5199
|
+
]);
|
|
5200
|
+
var mergePromise2 = (spawned, promise) => {
|
|
5201
|
+
for (const [property, descriptor] of descriptors2) {
|
|
5202
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
5203
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
5204
|
+
}
|
|
5205
|
+
};
|
|
5206
|
+
var getSpawnedPromise2 = (spawned) => new Promise((resolve, reject) => {
|
|
5207
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
5208
|
+
resolve({ exitCode, signal });
|
|
5209
|
+
});
|
|
5210
|
+
spawned.on("error", (error) => {
|
|
5211
|
+
reject(error);
|
|
5212
|
+
});
|
|
5213
|
+
if (spawned.stdin) {
|
|
5214
|
+
spawned.stdin.on("error", (error) => {
|
|
5215
|
+
reject(error);
|
|
5216
|
+
});
|
|
5217
|
+
}
|
|
5218
|
+
});
|
|
5219
|
+
var normalizeArgs2 = (file, args = []) => {
|
|
5220
|
+
if (!Array.isArray(args)) {
|
|
5221
|
+
return [file];
|
|
5222
|
+
}
|
|
5223
|
+
return [file, ...args];
|
|
5224
|
+
};
|
|
5225
|
+
var NO_ESCAPE_REGEXP2 = /^[\w.-]+$/;
|
|
5226
|
+
var escapeArg2 = (arg) => {
|
|
5227
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP2.test(arg)) {
|
|
5228
|
+
return arg;
|
|
5229
|
+
}
|
|
5230
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
5231
|
+
};
|
|
5232
|
+
var joinCommand2 = (file, args) => normalizeArgs2(file, args).join(" ");
|
|
5233
|
+
var getEscapedCommand2 = (file, args) => normalizeArgs2(file, args).map((arg) => escapeArg2(arg)).join(" ");
|
|
5234
|
+
var verboseDefault = util.debuglog("execa").enabled;
|
|
5235
|
+
var padField = (field, padding) => String(field).padStart(padding, "0");
|
|
5236
|
+
var getTimestamp = () => {
|
|
5237
|
+
const date = /* @__PURE__ */ new Date();
|
|
5238
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
5239
|
+
};
|
|
5240
|
+
var logCommand = (escapedCommand, { verbose }) => {
|
|
5241
|
+
if (!verbose) {
|
|
5242
|
+
return;
|
|
5243
|
+
}
|
|
5244
|
+
process2__default.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
|
|
5245
|
+
`);
|
|
5246
|
+
};
|
|
5247
|
+
|
|
5248
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
5249
|
+
var DEFAULT_MAX_BUFFER2 = 1e3 * 1e3 * 100;
|
|
5250
|
+
var getEnv2 = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
5251
|
+
const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
|
|
5252
|
+
if (preferLocal) {
|
|
5253
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
5254
|
+
}
|
|
5255
|
+
return env;
|
|
5256
|
+
};
|
|
5257
|
+
var handleArguments2 = (file, args, options = {}) => {
|
|
5258
|
+
const parsed = import_cross_spawn2.default._parse(file, args, options);
|
|
5259
|
+
file = parsed.command;
|
|
5260
|
+
args = parsed.args;
|
|
5261
|
+
options = parsed.options;
|
|
5262
|
+
options = {
|
|
5263
|
+
maxBuffer: DEFAULT_MAX_BUFFER2,
|
|
5264
|
+
buffer: true,
|
|
5265
|
+
stripFinalNewline: true,
|
|
5266
|
+
extendEnv: true,
|
|
5267
|
+
preferLocal: false,
|
|
5268
|
+
localDir: options.cwd || process2__default.default.cwd(),
|
|
5269
|
+
execPath: process2__default.default.execPath,
|
|
5270
|
+
encoding: "utf8",
|
|
5271
|
+
reject: true,
|
|
5272
|
+
cleanup: true,
|
|
5273
|
+
all: false,
|
|
5274
|
+
windowsHide: true,
|
|
5275
|
+
verbose: verboseDefault,
|
|
5276
|
+
...options
|
|
5277
|
+
};
|
|
5278
|
+
options.env = getEnv2(options);
|
|
5279
|
+
options.stdio = normalizeStdio2(options);
|
|
5280
|
+
if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
|
|
5281
|
+
args.unshift("/q");
|
|
5282
|
+
}
|
|
5283
|
+
return { file, args, options, parsed };
|
|
5284
|
+
};
|
|
5285
|
+
var handleOutput2 = (options, value, error) => {
|
|
5286
|
+
if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
|
|
5287
|
+
return error === void 0 ? void 0 : "";
|
|
5288
|
+
}
|
|
5289
|
+
if (options.stripFinalNewline) {
|
|
5290
|
+
return stripFinalNewline(value);
|
|
5291
|
+
}
|
|
5292
|
+
return value;
|
|
5293
|
+
};
|
|
5294
|
+
function execa2(file, args, options) {
|
|
5295
|
+
const parsed = handleArguments2(file, args, options);
|
|
5296
|
+
const command = joinCommand2(file, args);
|
|
5297
|
+
const escapedCommand = getEscapedCommand2(file, args);
|
|
5298
|
+
logCommand(escapedCommand, parsed.options);
|
|
5299
|
+
validateTimeout2(parsed.options);
|
|
5300
|
+
let spawned;
|
|
5301
|
+
try {
|
|
5302
|
+
spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
5303
|
+
} catch (error) {
|
|
5304
|
+
const dummySpawned = new childProcess2__default.default.ChildProcess();
|
|
5305
|
+
const errorPromise = Promise.reject(makeError2({
|
|
5306
|
+
error,
|
|
5307
|
+
stdout: "",
|
|
5308
|
+
stderr: "",
|
|
5309
|
+
all: "",
|
|
5310
|
+
command,
|
|
5311
|
+
escapedCommand,
|
|
5312
|
+
parsed,
|
|
5313
|
+
timedOut: false,
|
|
5314
|
+
isCanceled: false,
|
|
5315
|
+
killed: false
|
|
5316
|
+
}));
|
|
5317
|
+
mergePromise2(dummySpawned, errorPromise);
|
|
5318
|
+
return dummySpawned;
|
|
5319
|
+
}
|
|
5320
|
+
const spawnedPromise = getSpawnedPromise2(spawned);
|
|
5321
|
+
const timedPromise = setupTimeout2(spawned, parsed.options, spawnedPromise);
|
|
5322
|
+
const processDone = setExitHandler2(spawned, parsed.options, timedPromise);
|
|
5323
|
+
const context = { isCanceled: false };
|
|
5324
|
+
spawned.kill = spawnedKill2.bind(null, spawned.kill.bind(spawned));
|
|
5325
|
+
spawned.cancel = spawnedCancel2.bind(null, spawned, context);
|
|
5326
|
+
const handlePromise = async () => {
|
|
5327
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult2(spawned, parsed.options, processDone);
|
|
5328
|
+
const stdout = handleOutput2(parsed.options, stdoutResult);
|
|
5329
|
+
const stderr = handleOutput2(parsed.options, stderrResult);
|
|
5330
|
+
const all = handleOutput2(parsed.options, allResult);
|
|
5331
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
5332
|
+
const returnedError = makeError2({
|
|
5333
|
+
error,
|
|
5334
|
+
exitCode,
|
|
5335
|
+
signal,
|
|
5336
|
+
stdout,
|
|
5337
|
+
stderr,
|
|
5338
|
+
all,
|
|
5339
|
+
command,
|
|
5340
|
+
escapedCommand,
|
|
5341
|
+
parsed,
|
|
5342
|
+
timedOut,
|
|
5343
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
5344
|
+
killed: spawned.killed
|
|
5345
|
+
});
|
|
5346
|
+
if (!parsed.options.reject) {
|
|
5347
|
+
return returnedError;
|
|
5348
|
+
}
|
|
5349
|
+
throw returnedError;
|
|
5350
|
+
}
|
|
5351
|
+
return {
|
|
5352
|
+
command,
|
|
5353
|
+
escapedCommand,
|
|
5354
|
+
exitCode: 0,
|
|
5355
|
+
stdout,
|
|
5356
|
+
stderr,
|
|
5357
|
+
all,
|
|
5358
|
+
failed: false,
|
|
5359
|
+
timedOut: false,
|
|
5360
|
+
isCanceled: false,
|
|
5361
|
+
killed: false
|
|
5362
|
+
};
|
|
5363
|
+
};
|
|
5364
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
5365
|
+
handleInput2(spawned, parsed.options);
|
|
5366
|
+
spawned.all = makeAllStream2(spawned, parsed.options);
|
|
5367
|
+
addPipeMethods(spawned);
|
|
5368
|
+
mergePromise2(spawned, handlePromiseOnce);
|
|
5369
|
+
return spawned;
|
|
5370
|
+
}
|
|
5371
|
+
|
|
5372
|
+
// ../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js
|
|
5373
|
+
function indentString(string, count = 1, options = {}) {
|
|
5374
|
+
const {
|
|
5375
|
+
indent = " ",
|
|
5376
|
+
includeEmptyLines = false
|
|
5377
|
+
} = options;
|
|
5378
|
+
if (typeof string !== "string") {
|
|
5379
|
+
throw new TypeError(
|
|
5380
|
+
`Expected \`input\` to be a \`string\`, got \`${typeof string}\``
|
|
5381
|
+
);
|
|
5382
|
+
}
|
|
5383
|
+
if (typeof count !== "number") {
|
|
5384
|
+
throw new TypeError(
|
|
5385
|
+
`Expected \`count\` to be a \`number\`, got \`${typeof count}\``
|
|
5386
|
+
);
|
|
5387
|
+
}
|
|
5388
|
+
if (count < 0) {
|
|
5389
|
+
throw new RangeError(
|
|
5390
|
+
`Expected \`count\` to be at least 0, got \`${count}\``
|
|
5391
|
+
);
|
|
5392
|
+
}
|
|
5393
|
+
if (typeof indent !== "string") {
|
|
5394
|
+
throw new TypeError(
|
|
5395
|
+
`Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
|
|
5396
|
+
);
|
|
5397
|
+
}
|
|
5398
|
+
if (count === 0) {
|
|
5399
|
+
return string;
|
|
5400
|
+
}
|
|
5401
|
+
const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
|
5402
|
+
return string.replace(regex, indent.repeat(count));
|
|
5403
|
+
}
|
|
5404
|
+
|
|
5405
|
+
// ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
|
|
5406
|
+
function escapeStringRegexp(string) {
|
|
5407
|
+
if (typeof string !== "string") {
|
|
5408
|
+
throw new TypeError("Expected a string");
|
|
5409
|
+
}
|
|
5410
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
5411
|
+
}
|
|
5412
|
+
var getHomeDirectory = () => os__default.default.homedir().replace(/\\/g, "/");
|
|
5413
|
+
var home_directory_default = getHomeDirectory;
|
|
5414
|
+
|
|
5415
|
+
// ../../node_modules/.pnpm/clean-stack@5.3.0/node_modules/clean-stack/index.js
|
|
5416
|
+
var extractPathRegex = /\s+at.*[(\s](.*)\)?/;
|
|
5417
|
+
var pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
|
|
5418
|
+
function cleanStack(stack, { pretty = false, basePath, pathFilter } = {}) {
|
|
5419
|
+
const basePathRegex = basePath && new RegExp(`(file://)?${escapeStringRegexp(basePath.replace(/\\/g, "/"))}/?`, "g");
|
|
5420
|
+
const homeDirectory = pretty ? home_directory_default() : "";
|
|
5421
|
+
if (typeof stack !== "string") {
|
|
5422
|
+
return void 0;
|
|
5423
|
+
}
|
|
5424
|
+
return stack.replace(/\\/g, "/").split("\n").filter((line) => {
|
|
5425
|
+
const pathMatches = line.match(extractPathRegex);
|
|
5426
|
+
if (pathMatches === null || !pathMatches[1]) {
|
|
5427
|
+
return true;
|
|
5428
|
+
}
|
|
5429
|
+
const match2 = pathMatches[1];
|
|
5430
|
+
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")) {
|
|
5431
|
+
return false;
|
|
5432
|
+
}
|
|
5433
|
+
return pathFilter ? !pathRegex.test(match2) && pathFilter(match2) : !pathRegex.test(match2);
|
|
5434
|
+
}).filter((line) => line.trim() !== "").map((line) => {
|
|
5435
|
+
if (basePathRegex) {
|
|
5436
|
+
line = line.replace(basePathRegex, "");
|
|
5437
|
+
}
|
|
5438
|
+
if (pretty) {
|
|
5439
|
+
line = line.replace(extractPathRegex, (m, p1) => {
|
|
5440
|
+
let filePath = p1;
|
|
5441
|
+
if (filePath.startsWith("file://")) {
|
|
5442
|
+
filePath = url.fileURLToPath(filePath);
|
|
5443
|
+
}
|
|
5444
|
+
filePath = filePath.replace(homeDirectory, "~");
|
|
5445
|
+
return m.replace(p1, filePath);
|
|
5446
|
+
});
|
|
5447
|
+
}
|
|
5448
|
+
return line;
|
|
5449
|
+
}).join("\n");
|
|
5450
|
+
}
|
|
5451
|
+
|
|
5452
|
+
// ../../node_modules/.pnpm/aggregate-error@5.0.0/node_modules/aggregate-error/index.js
|
|
5453
|
+
var cleanInternalStack = (stack) => stack.replaceAll(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
|
|
5454
|
+
var AggregateError = class extends Error {
|
|
5455
|
+
#errors;
|
|
5456
|
+
name = "AggregateError";
|
|
5457
|
+
constructor(errors) {
|
|
5458
|
+
if (!Array.isArray(errors)) {
|
|
5459
|
+
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
|
5460
|
+
}
|
|
5461
|
+
errors = errors.map((error) => {
|
|
5462
|
+
if (error instanceof Error) {
|
|
5463
|
+
return error;
|
|
5464
|
+
}
|
|
5465
|
+
if (error !== null && typeof error === "object") {
|
|
5466
|
+
return Object.assign(new Error(error.message), error);
|
|
5467
|
+
}
|
|
5468
|
+
return new Error(error);
|
|
5469
|
+
});
|
|
5470
|
+
let message = errors.map(
|
|
5471
|
+
(error) => (
|
|
5472
|
+
// The `stack` property is not standardized, so we can't assume it exists
|
|
5473
|
+
typeof error.stack === "string" && error.stack.length > 0 ? cleanInternalStack(cleanStack(error.stack)) : String(error)
|
|
5474
|
+
)
|
|
5475
|
+
).join("\n");
|
|
5476
|
+
message = "\n" + indentString(message, 4);
|
|
5477
|
+
super(message);
|
|
5478
|
+
this.#errors = errors;
|
|
5479
|
+
}
|
|
5480
|
+
get errors() {
|
|
5481
|
+
return [...this.#errors];
|
|
5482
|
+
}
|
|
5483
|
+
};
|
|
5484
|
+
var netstat = async (type) => {
|
|
5485
|
+
const { stdout } = await execa2("netstat", ["-anv", "-p", type]);
|
|
5486
|
+
return stdout;
|
|
5487
|
+
};
|
|
5488
|
+
var macos = async () => {
|
|
5489
|
+
const result = await Promise.all([
|
|
5490
|
+
netstat("tcp"),
|
|
5491
|
+
netstat("udp")
|
|
5492
|
+
]);
|
|
5493
|
+
const tcp = result[0];
|
|
5494
|
+
const headerStart = tcp.indexOf("\n") + 1;
|
|
5495
|
+
const header = tcp.slice(headerStart, tcp.indexOf("\n", headerStart));
|
|
5496
|
+
return {
|
|
5497
|
+
stdout: result.join("\n"),
|
|
5498
|
+
addressColumn: 3,
|
|
5499
|
+
// Some versions of macOS print two extra columns for rxbytes and
|
|
5500
|
+
// txbytes before pid. Unfortunately headers can't be parsed because
|
|
5501
|
+
// they're space separated but some contain spaces, so we use this
|
|
5502
|
+
// heuristic to distinguish the two netstat versions.
|
|
5503
|
+
pidColumn: header.includes("rxbytes") ? 10 : 8
|
|
5504
|
+
};
|
|
5505
|
+
};
|
|
5506
|
+
var linux = async () => {
|
|
5507
|
+
const { stdout } = await execa2("ss", ["-tunlp"]);
|
|
5508
|
+
return {
|
|
5509
|
+
stdout,
|
|
5510
|
+
addressColumn: 4,
|
|
5511
|
+
pidColumn: 6
|
|
5512
|
+
};
|
|
5513
|
+
};
|
|
5514
|
+
var windows = async () => {
|
|
5515
|
+
const { stdout } = await execa2("netstat", ["-ano"]);
|
|
5516
|
+
return {
|
|
5517
|
+
stdout,
|
|
5518
|
+
addressColumn: 1,
|
|
5519
|
+
pidColumn: 4
|
|
5520
|
+
};
|
|
5521
|
+
};
|
|
5522
|
+
var isProtocol = (value) => /^\s*(tcp|udp)/i.test(value);
|
|
5523
|
+
var parsePid = (pid) => {
|
|
5524
|
+
if (typeof pid !== "string") {
|
|
5525
|
+
return;
|
|
5526
|
+
}
|
|
5527
|
+
const { groups } = /(?:^|",|",pid=)(?<pid>\d+)/.exec(pid) || {};
|
|
5528
|
+
if (groups) {
|
|
5529
|
+
return Number.parseInt(groups.pid, 10);
|
|
5530
|
+
}
|
|
5531
|
+
};
|
|
5532
|
+
var getPort = (port, { lines, addressColumn, pidColumn }) => {
|
|
5533
|
+
const regex = new RegExp(`[.:]${port}$`);
|
|
5534
|
+
const foundPort = lines.find((line) => regex.test(line[addressColumn]));
|
|
5535
|
+
if (!foundPort) {
|
|
5536
|
+
throw new Error(`Could not find a process that uses port \`${port}\``);
|
|
5537
|
+
}
|
|
5538
|
+
return parsePid(foundPort[pidColumn]);
|
|
5539
|
+
};
|
|
5540
|
+
var implementation = process2__default.default.platform === "darwin" ? macos : process2__default.default.platform === "linux" ? linux : windows;
|
|
5541
|
+
var getList = async () => {
|
|
5542
|
+
const { stdout, addressColumn, pidColumn } = await implementation();
|
|
5543
|
+
const lines = stdout.split("\n").filter((line) => isProtocol(line)).map((line) => line.match(/\S+/g) || []);
|
|
5544
|
+
return { lines, addressColumn, pidColumn };
|
|
5545
|
+
};
|
|
5546
|
+
async function portToPid(port) {
|
|
5547
|
+
if (Array.isArray(port)) {
|
|
5548
|
+
const list = await getList();
|
|
5549
|
+
const tuples = await Promise.all(port.map((port_) => [port_, getPort(port_, list)]));
|
|
5550
|
+
return new Map(tuples);
|
|
5551
|
+
}
|
|
5552
|
+
if (!Number.isInteger(port)) {
|
|
5553
|
+
throw new TypeError(`Expected an integer, got ${typeof port}`);
|
|
5554
|
+
}
|
|
5555
|
+
return getPort(port, await getList());
|
|
5556
|
+
}
|
|
5557
|
+
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))));
|
|
5558
|
+
var TEN_MEGABYTES = 1e3 * 1e3 * 10;
|
|
5559
|
+
var execFile = util.promisify(childProcess2__default.default.execFile);
|
|
5560
|
+
var windows2 = async () => {
|
|
5561
|
+
let binary;
|
|
5562
|
+
switch (process2__default.default.arch) {
|
|
5563
|
+
case "x64":
|
|
5564
|
+
binary = "fastlist-0.3.0-x64.exe";
|
|
5565
|
+
break;
|
|
5566
|
+
case "ia32":
|
|
5567
|
+
binary = "fastlist-0.3.0-x86.exe";
|
|
5568
|
+
break;
|
|
5569
|
+
default:
|
|
5570
|
+
throw new Error(`Unsupported architecture: ${process2__default.default.arch}`);
|
|
5571
|
+
}
|
|
5572
|
+
const binaryPath = path__default.default.join(__dirname$1, "vendor", binary);
|
|
5573
|
+
const { stdout } = await execFile(binaryPath, {
|
|
5574
|
+
maxBuffer: TEN_MEGABYTES,
|
|
5575
|
+
windowsHide: true
|
|
5576
|
+
});
|
|
5577
|
+
return stdout.trim().split("\r\n").map((line) => line.split(" ")).map(([pid, ppid, name]) => ({
|
|
5578
|
+
pid: Number.parseInt(pid, 10),
|
|
5579
|
+
ppid: Number.parseInt(ppid, 10),
|
|
5580
|
+
name
|
|
5581
|
+
}));
|
|
5582
|
+
};
|
|
5583
|
+
var nonWindowsMultipleCalls = async (options = {}) => {
|
|
5584
|
+
const flags = (options.all === false ? "" : "a") + "wwxo";
|
|
5585
|
+
const returnValue = {};
|
|
5586
|
+
await Promise.all(["comm", "args", "ppid", "uid", "%cpu", "%mem"].map(async (cmd) => {
|
|
5587
|
+
const { stdout } = await execFile("ps", [flags, `pid,${cmd}`], { maxBuffer: TEN_MEGABYTES });
|
|
5588
|
+
for (let line of stdout.trim().split("\n").slice(1)) {
|
|
5589
|
+
line = line.trim();
|
|
5590
|
+
const [pid] = line.split(" ", 1);
|
|
5591
|
+
const value = line.slice(pid.length + 1).trim();
|
|
5592
|
+
if (returnValue[pid] === void 0) {
|
|
5593
|
+
returnValue[pid] = {};
|
|
5594
|
+
}
|
|
5595
|
+
returnValue[pid][cmd] = value;
|
|
5596
|
+
}
|
|
5597
|
+
}));
|
|
5598
|
+
return Object.entries(returnValue).filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value["%cpu"] && value["%mem"]).map(([key, value]) => ({
|
|
5599
|
+
pid: Number.parseInt(key, 10),
|
|
5600
|
+
name: path__default.default.basename(value.comm),
|
|
5601
|
+
cmd: value.args,
|
|
5602
|
+
ppid: Number.parseInt(value.ppid, 10),
|
|
5603
|
+
uid: Number.parseInt(value.uid, 10),
|
|
5604
|
+
cpu: Number.parseFloat(value["%cpu"]),
|
|
5605
|
+
memory: Number.parseFloat(value["%mem"])
|
|
5606
|
+
}));
|
|
5607
|
+
};
|
|
5608
|
+
var ERROR_MESSAGE_PARSING_FAILED = "ps output parsing failed";
|
|
5609
|
+
var psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>[-\d]+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+(?<comm>.*)?/;
|
|
5610
|
+
var nonWindowsCall = async (options = {}) => {
|
|
5611
|
+
const flags = options.all === false ? "wwxo" : "awwxo";
|
|
5612
|
+
const psPromises = [
|
|
5613
|
+
execFile("ps", [flags, "pid,ppid,uid,%cpu,%mem,comm"], { maxBuffer: TEN_MEGABYTES }),
|
|
5614
|
+
execFile("ps", [flags, "pid,args"], { maxBuffer: TEN_MEGABYTES })
|
|
5615
|
+
];
|
|
5616
|
+
const [psLines, psArgsLines] = (await Promise.all(psPromises)).map(({ stdout }) => stdout.trim().split("\n"));
|
|
5617
|
+
const psPids = new Set(psPromises.map((promise) => promise.child.pid));
|
|
5618
|
+
psLines.shift();
|
|
5619
|
+
psArgsLines.shift();
|
|
5620
|
+
const processCmds = {};
|
|
5621
|
+
for (const line of psArgsLines) {
|
|
5622
|
+
const [pid, cmds] = line.trim().split(" ");
|
|
5623
|
+
processCmds[pid] = cmds.join(" ");
|
|
5624
|
+
}
|
|
5625
|
+
const processes = psLines.map((line) => {
|
|
5626
|
+
const match2 = psOutputRegex.exec(line);
|
|
5627
|
+
if (match2 === null) {
|
|
5628
|
+
throw new Error(ERROR_MESSAGE_PARSING_FAILED);
|
|
5629
|
+
}
|
|
5630
|
+
const { pid, ppid, uid, cpu, memory, comm } = match2.groups;
|
|
5631
|
+
const processInfo = {
|
|
5632
|
+
pid: Number.parseInt(pid, 10),
|
|
5633
|
+
ppid: Number.parseInt(ppid, 10),
|
|
5634
|
+
uid: Number.parseInt(uid, 10),
|
|
5635
|
+
cpu: Number.parseFloat(cpu),
|
|
5636
|
+
memory: Number.parseFloat(memory),
|
|
5637
|
+
name: path__default.default.basename(comm),
|
|
5638
|
+
cmd: processCmds[pid]
|
|
5639
|
+
};
|
|
5640
|
+
return processInfo;
|
|
5641
|
+
}).filter((processInfo) => !psPids.has(processInfo.pid));
|
|
5642
|
+
return processes;
|
|
5643
|
+
};
|
|
5644
|
+
var nonWindows = async (options = {}) => {
|
|
5645
|
+
try {
|
|
5646
|
+
return await nonWindowsCall(options);
|
|
5647
|
+
} catch {
|
|
5648
|
+
return nonWindowsMultipleCalls(options);
|
|
5649
|
+
}
|
|
5650
|
+
};
|
|
5651
|
+
var psList = process2__default.default.platform === "win32" ? windows2 : nonWindows;
|
|
5652
|
+
var ps_list_default = psList;
|
|
5653
|
+
|
|
5654
|
+
// ../../node_modules/.pnpm/process-exists@5.0.0/node_modules/process-exists/index.js
|
|
5655
|
+
var linuxProcessMatchesName = (wantedProcessName, process13) => {
|
|
5656
|
+
if (typeof wantedProcessName === "string") {
|
|
5657
|
+
return process13.name === wantedProcessName || process13.cmd.split(" ")[0] === wantedProcessName;
|
|
5658
|
+
}
|
|
5659
|
+
return process13.pid === wantedProcessName;
|
|
5660
|
+
};
|
|
5661
|
+
var nonLinuxProcessMatchesName = (wantedProcessName, process13) => {
|
|
5662
|
+
if (typeof wantedProcessName === "string") {
|
|
5663
|
+
return process13.name === wantedProcessName;
|
|
5664
|
+
}
|
|
5665
|
+
return process13.pid === wantedProcessName;
|
|
5666
|
+
};
|
|
5667
|
+
var processMatchesName = process2__default.default.platform === "linux" ? linuxProcessMatchesName : nonLinuxProcessMatchesName;
|
|
5668
|
+
async function processExistsMultiple(processNames) {
|
|
5669
|
+
const processes = await ps_list_default();
|
|
5670
|
+
return new Map(processNames.map((processName) => [processName, processes.some((y) => processMatchesName(processName, y))]));
|
|
5671
|
+
}
|
|
5672
|
+
async function filterExistingProcesses(processNames) {
|
|
5673
|
+
const processes = await ps_list_default();
|
|
5674
|
+
return processNames.filter((processName) => processes.some((process_) => processMatchesName(processName, process_)));
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5677
|
+
// ../../node_modules/.pnpm/fkill@9.0.0/node_modules/fkill/index.js
|
|
5678
|
+
var ALIVE_CHECK_MIN_INTERVAL = 5;
|
|
5679
|
+
var ALIVE_CHECK_MAX_INTERVAL = 1280;
|
|
5680
|
+
var TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM = 255;
|
|
5681
|
+
var delay = (ms) => new Promise((resolve) => {
|
|
5682
|
+
setTimeout(resolve, ms);
|
|
5683
|
+
});
|
|
5684
|
+
var missingBinaryError = async (command, arguments_) => {
|
|
5685
|
+
try {
|
|
5686
|
+
return await execa2(command, arguments_);
|
|
5687
|
+
} catch (error) {
|
|
5688
|
+
if (error.code === "ENOENT") {
|
|
5689
|
+
const newError = new Error(`\`${command}\` doesn't seem to be installed and is required by fkill`);
|
|
5690
|
+
newError.sourceError = error;
|
|
5691
|
+
throw newError;
|
|
5692
|
+
}
|
|
5693
|
+
throw error;
|
|
5694
|
+
}
|
|
5695
|
+
};
|
|
5696
|
+
var windowsKill = async (input, options) => {
|
|
5697
|
+
try {
|
|
5698
|
+
return await taskkill(input, {
|
|
5699
|
+
force: options.force,
|
|
5700
|
+
tree: options.tree === void 0 ? true : options.tree
|
|
5701
|
+
});
|
|
5702
|
+
} catch (error) {
|
|
5703
|
+
if (error.exitCode === TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM && !options.force) {
|
|
5704
|
+
return;
|
|
5705
|
+
}
|
|
5706
|
+
throw error;
|
|
5707
|
+
}
|
|
5708
|
+
};
|
|
5709
|
+
var macosKill = (input, options) => {
|
|
5710
|
+
const killByName = typeof input === "string";
|
|
5711
|
+
const command = killByName ? "pkill" : "kill";
|
|
5712
|
+
const arguments_ = [input];
|
|
5713
|
+
if (killByName && options.ignoreCase) {
|
|
5714
|
+
arguments_.unshift("-i");
|
|
5715
|
+
}
|
|
5716
|
+
if (killByName) {
|
|
5717
|
+
arguments_.unshift("-x");
|
|
5718
|
+
}
|
|
5719
|
+
if (options.force) {
|
|
5720
|
+
if (killByName) {
|
|
5721
|
+
arguments_.unshift("-KILL");
|
|
5722
|
+
} else {
|
|
5723
|
+
arguments_.unshift("-9");
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5726
|
+
return missingBinaryError(command, arguments_);
|
|
5727
|
+
};
|
|
5728
|
+
var defaultKill = (input, options) => {
|
|
5729
|
+
const killByName = typeof input === "string";
|
|
5730
|
+
const command = killByName ? "killall" : "kill";
|
|
5731
|
+
const arguments_ = [input];
|
|
5732
|
+
if (options.force) {
|
|
5733
|
+
arguments_.unshift("-9");
|
|
5734
|
+
}
|
|
5735
|
+
if (killByName && options.ignoreCase) {
|
|
5736
|
+
arguments_.unshift("-I");
|
|
5737
|
+
}
|
|
5738
|
+
return missingBinaryError(command, arguments_);
|
|
5739
|
+
};
|
|
5740
|
+
var kill = (() => {
|
|
5741
|
+
if (process2__default.default.platform === "darwin") {
|
|
5742
|
+
return macosKill;
|
|
5743
|
+
}
|
|
5744
|
+
if (process2__default.default.platform === "win32") {
|
|
5745
|
+
return windowsKill;
|
|
5746
|
+
}
|
|
5747
|
+
return defaultKill;
|
|
5748
|
+
})();
|
|
5749
|
+
var parseInput = async (input) => {
|
|
5750
|
+
if (typeof input === "string" && input[0] === ":") {
|
|
5751
|
+
return portToPid(Number.parseInt(input.slice(1), 10));
|
|
5752
|
+
}
|
|
5753
|
+
return input;
|
|
5754
|
+
};
|
|
5755
|
+
var getCurrentProcessParentsPID = (processes) => {
|
|
5756
|
+
const processMap = new Map(processes.map((ps) => [ps.pid, ps.ppid]));
|
|
5757
|
+
const pids = [];
|
|
5758
|
+
let currentId = process2__default.default.pid;
|
|
5759
|
+
while (currentId) {
|
|
5760
|
+
pids.push(currentId);
|
|
5761
|
+
currentId = processMap.get(currentId);
|
|
5762
|
+
}
|
|
5763
|
+
return pids;
|
|
5764
|
+
};
|
|
5765
|
+
var killWithLimits = async (input, options) => {
|
|
5766
|
+
input = await parseInput(input);
|
|
5767
|
+
if (input === process2__default.default.pid) {
|
|
5768
|
+
return;
|
|
5769
|
+
}
|
|
5770
|
+
if (input === "node" || input === "node.exe") {
|
|
5771
|
+
const processes = await ps_list_default();
|
|
5772
|
+
const pids = getCurrentProcessParentsPID(processes);
|
|
5773
|
+
await Promise.all(processes.map(async (ps) => {
|
|
5774
|
+
if ((ps.name === "node" || ps.name === "node.exe") && !pids.includes(ps.pid)) {
|
|
5775
|
+
await kill(ps.pid, options);
|
|
5776
|
+
}
|
|
5777
|
+
}));
|
|
5778
|
+
return;
|
|
5779
|
+
}
|
|
5780
|
+
await kill(input, options);
|
|
5781
|
+
};
|
|
5782
|
+
async function fkill(inputs, options = {}) {
|
|
5783
|
+
inputs = [inputs].flat();
|
|
5784
|
+
const exists = await processExistsMultiple(inputs);
|
|
5785
|
+
const errors = [];
|
|
5786
|
+
const handleKill = async (input) => {
|
|
5787
|
+
try {
|
|
5788
|
+
await killWithLimits(input, options);
|
|
5789
|
+
} catch (error) {
|
|
5790
|
+
if (!exists.get(input)) {
|
|
5791
|
+
errors.push(`Killing process ${input} failed: Process doesn't exist`);
|
|
5792
|
+
return;
|
|
5793
|
+
}
|
|
5794
|
+
errors.push(`Killing process ${input} failed: ${error.message.replace(/.*\n/, "").replace(/kill: \d+: /, "").trim()}`);
|
|
5795
|
+
}
|
|
5796
|
+
};
|
|
5797
|
+
await Promise.all(inputs.map((input) => handleKill(input)));
|
|
5798
|
+
if (errors.length > 0 && !options.silent) {
|
|
5799
|
+
throw new AggregateError(errors);
|
|
5800
|
+
}
|
|
5801
|
+
if (options.forceAfterTimeout !== void 0 && !options.force) {
|
|
5802
|
+
const endTime = Date.now() + options.forceAfterTimeout;
|
|
5803
|
+
let interval = ALIVE_CHECK_MIN_INTERVAL;
|
|
5804
|
+
if (interval > options.forceAfterTimeout) {
|
|
5805
|
+
interval = options.forceAfterTimeout;
|
|
5806
|
+
}
|
|
5807
|
+
let alive = inputs;
|
|
5808
|
+
do {
|
|
5809
|
+
await delay(interval);
|
|
5810
|
+
alive = await filterExistingProcesses(alive);
|
|
5811
|
+
interval *= 2;
|
|
5812
|
+
if (interval > ALIVE_CHECK_MAX_INTERVAL) {
|
|
5813
|
+
interval = ALIVE_CHECK_MAX_INTERVAL;
|
|
5814
|
+
}
|
|
5815
|
+
} while (Date.now() < endTime && alive.length > 0);
|
|
5816
|
+
if (alive.length > 0) {
|
|
5817
|
+
await Promise.all(alive.map(async (input) => {
|
|
5818
|
+
try {
|
|
5819
|
+
await killWithLimits(input, { ...options, force: true });
|
|
5820
|
+
} catch {
|
|
5821
|
+
}
|
|
5822
|
+
}));
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
|
|
2934
5827
|
// src/server.ts
|
|
2935
|
-
var import_kill_port = __toESM(require_kill_port());
|
|
2936
5828
|
var import_picocolors = __toESM(require_picocolors());
|
|
2937
5829
|
|
|
2938
5830
|
// src/constants.ts
|
|
2939
5831
|
var DEFAULT_PORT = 5567;
|
|
2940
5832
|
|
|
2941
5833
|
// src/server.ts
|
|
2942
|
-
var VERSION = "0.0.
|
|
5834
|
+
var VERSION = "0.0.82";
|
|
5835
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2943
5836
|
var cursorSessionMap = /* @__PURE__ */ new Map();
|
|
2944
5837
|
var activeProcesses = /* @__PURE__ */ new Map();
|
|
2945
5838
|
var parseStreamLine = (line) => {
|
|
@@ -2988,7 +5881,7 @@ ${content}`;
|
|
|
2988
5881
|
let stderrBuffer = "";
|
|
2989
5882
|
try {
|
|
2990
5883
|
await stream2.writeSSE({ data: "Thinking...", event: "status" });
|
|
2991
|
-
cursorProcess = (0,
|
|
5884
|
+
cursorProcess = (0, import_cross_spawn3.default)("cursor-agent", cursorAgentArgs, {
|
|
2992
5885
|
stdio: ["pipe", "pipe", "pipe"],
|
|
2993
5886
|
env: { ...process.env }
|
|
2994
5887
|
});
|
|
@@ -3052,19 +5945,19 @@ ${content}`;
|
|
|
3052
5945
|
cursorProcess.stdin.end();
|
|
3053
5946
|
}
|
|
3054
5947
|
if (cursorProcess) {
|
|
3055
|
-
const
|
|
5948
|
+
const childProcess4 = cursorProcess;
|
|
3056
5949
|
await new Promise((resolve, reject) => {
|
|
3057
|
-
|
|
5950
|
+
childProcess4.on("close", (code) => {
|
|
3058
5951
|
if (sessionId) {
|
|
3059
5952
|
activeProcesses.delete(sessionId);
|
|
3060
5953
|
}
|
|
3061
|
-
if (code === 0 ||
|
|
5954
|
+
if (code === 0 || childProcess4.killed) {
|
|
3062
5955
|
resolve();
|
|
3063
5956
|
} else {
|
|
3064
5957
|
reject(new Error(`cursor-agent exited with code ${code}`));
|
|
3065
5958
|
}
|
|
3066
5959
|
});
|
|
3067
|
-
|
|
5960
|
+
childProcess4.on("error", (error) => {
|
|
3068
5961
|
if (sessionId) {
|
|
3069
5962
|
activeProcesses.delete(sessionId);
|
|
3070
5963
|
}
|
|
@@ -3108,8 +6001,9 @@ ${stderrContent}` : errorMessage;
|
|
|
3108
6001
|
return app;
|
|
3109
6002
|
};
|
|
3110
6003
|
var startServer = async (port = DEFAULT_PORT) => {
|
|
3111
|
-
await (
|
|
6004
|
+
await fkill(`:${port}`, { force: true, silent: true }).catch(() => {
|
|
3112
6005
|
});
|
|
6006
|
+
await sleep(100);
|
|
3113
6007
|
const app = createServer();
|
|
3114
6008
|
serve({ fetch: app.fetch, port });
|
|
3115
6009
|
console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Cursor)")}`);
|