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