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