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