@react-grab/opencode 0.0.80 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +2 -6
- package/dist/cli.js +3 -6
- package/dist/server.cjs +3669 -286
- package/dist/server.js +3664 -285
- package/package.json +4 -5
package/dist/server.cjs
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var childProcess2 = require('child_process');
|
|
4
|
+
var process2 = require('process');
|
|
5
|
+
var buffer = require('buffer');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var url = require('url');
|
|
8
|
+
var os = require('os');
|
|
9
|
+
var fs = require('fs');
|
|
10
|
+
var promises = require('timers/promises');
|
|
11
|
+
var util = require('util');
|
|
4
12
|
var http = require('http');
|
|
5
13
|
var http2 = require('http2');
|
|
6
14
|
var stream = require('stream');
|
|
7
15
|
var crypto = require('crypto');
|
|
8
|
-
var url = require('url');
|
|
9
16
|
|
|
10
17
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
19
|
|
|
20
|
+
var childProcess2__default = /*#__PURE__*/_interopDefault(childProcess2);
|
|
21
|
+
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
22
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
23
|
+
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
13
24
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
14
25
|
|
|
15
26
|
var __create = Object.create;
|
|
@@ -44,80 +55,823 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
44
55
|
mod
|
|
45
56
|
));
|
|
46
57
|
|
|
47
|
-
// ../../node_modules/.pnpm/
|
|
48
|
-
var
|
|
49
|
-
"../../node_modules/.pnpm/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
59
|
+
var require_windows = __commonJS({
|
|
60
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
61
|
+
module.exports = isexe;
|
|
62
|
+
isexe.sync = sync;
|
|
63
|
+
var fs = __require("fs");
|
|
64
|
+
function checkPathExt(path5, options) {
|
|
65
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
66
|
+
if (!pathext) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
pathext = pathext.split(";");
|
|
70
|
+
if (pathext.indexOf("") !== -1) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
74
|
+
var p = pathext[i].toLowerCase();
|
|
75
|
+
if (p && path5.substr(-p.length).toLowerCase() === p) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
function checkStat(stat, path5, options) {
|
|
82
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return checkPathExt(path5, options);
|
|
86
|
+
}
|
|
87
|
+
function isexe(path5, options, cb) {
|
|
88
|
+
fs.stat(path5, function(er, stat) {
|
|
89
|
+
cb(er, er ? false : checkStat(stat, path5, options));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function sync(path5, options) {
|
|
93
|
+
return checkStat(fs.statSync(path5), path5, options);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
99
|
+
var require_mode = __commonJS({
|
|
100
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
101
|
+
module.exports = isexe;
|
|
102
|
+
isexe.sync = sync;
|
|
103
|
+
var fs = __require("fs");
|
|
104
|
+
function isexe(path5, options, cb) {
|
|
105
|
+
fs.stat(path5, function(er, stat) {
|
|
106
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function sync(path5, options) {
|
|
110
|
+
return checkStat(fs.statSync(path5), options);
|
|
111
|
+
}
|
|
112
|
+
function checkStat(stat, options) {
|
|
113
|
+
return stat.isFile() && checkMode(stat, options);
|
|
114
|
+
}
|
|
115
|
+
function checkMode(stat, options) {
|
|
116
|
+
var mod = stat.mode;
|
|
117
|
+
var uid = stat.uid;
|
|
118
|
+
var gid = stat.gid;
|
|
119
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
120
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
121
|
+
var u = parseInt("100", 8);
|
|
122
|
+
var g = parseInt("010", 8);
|
|
123
|
+
var o = parseInt("001", 8);
|
|
124
|
+
var ug = u | g;
|
|
125
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
126
|
+
return ret;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
132
|
+
var require_isexe = __commonJS({
|
|
133
|
+
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
134
|
+
__require("fs");
|
|
135
|
+
var core;
|
|
136
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
137
|
+
core = require_windows();
|
|
138
|
+
} else {
|
|
139
|
+
core = require_mode();
|
|
140
|
+
}
|
|
141
|
+
module.exports = isexe;
|
|
142
|
+
isexe.sync = sync;
|
|
143
|
+
function isexe(path5, options, cb) {
|
|
144
|
+
if (typeof options === "function") {
|
|
145
|
+
cb = options;
|
|
146
|
+
options = {};
|
|
147
|
+
}
|
|
148
|
+
if (!cb) {
|
|
149
|
+
if (typeof Promise !== "function") {
|
|
150
|
+
throw new TypeError("callback not provided");
|
|
70
151
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
152
|
+
return new Promise(function(resolve, reject) {
|
|
153
|
+
isexe(path5, options || {}, function(er, is) {
|
|
154
|
+
if (er) {
|
|
155
|
+
reject(er);
|
|
156
|
+
} else {
|
|
157
|
+
resolve(is);
|
|
158
|
+
}
|
|
74
159
|
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
core(path5, options || {}, function(er, is) {
|
|
163
|
+
if (er) {
|
|
164
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
165
|
+
er = null;
|
|
166
|
+
is = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
cb(er, is);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function sync(path5, options) {
|
|
173
|
+
try {
|
|
174
|
+
return core.sync(path5, options || {});
|
|
175
|
+
} catch (er) {
|
|
176
|
+
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
177
|
+
return false;
|
|
178
|
+
} else {
|
|
179
|
+
throw er;
|
|
75
180
|
}
|
|
76
|
-
|
|
77
|
-
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
187
|
+
var require_which = __commonJS({
|
|
188
|
+
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
189
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
190
|
+
var path5 = __require("path");
|
|
191
|
+
var COLON = isWindows ? ";" : ":";
|
|
192
|
+
var isexe = require_isexe();
|
|
193
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
194
|
+
var getPathInfo = (cmd, opt) => {
|
|
195
|
+
const colon = opt.colon || COLON;
|
|
196
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
197
|
+
// windows always checks the cwd first
|
|
198
|
+
...isWindows ? [process.cwd()] : [],
|
|
199
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
200
|
+
"").split(colon)
|
|
201
|
+
];
|
|
202
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
203
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
204
|
+
if (isWindows) {
|
|
205
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
206
|
+
pathExt.unshift("");
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
pathEnv,
|
|
210
|
+
pathExt,
|
|
211
|
+
pathExtExe
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
var which = (cmd, opt, cb) => {
|
|
215
|
+
if (typeof opt === "function") {
|
|
216
|
+
cb = opt;
|
|
217
|
+
opt = {};
|
|
218
|
+
}
|
|
219
|
+
if (!opt)
|
|
220
|
+
opt = {};
|
|
221
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
222
|
+
const found = [];
|
|
223
|
+
const step = (i) => new Promise((resolve, reject) => {
|
|
224
|
+
if (i === pathEnv.length)
|
|
225
|
+
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
226
|
+
const ppRaw = pathEnv[i];
|
|
227
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
228
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
229
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
230
|
+
resolve(subStep(p, i, 0));
|
|
231
|
+
});
|
|
232
|
+
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
233
|
+
if (ii === pathExt.length)
|
|
234
|
+
return resolve(step(i + 1));
|
|
235
|
+
const ext = pathExt[ii];
|
|
236
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
237
|
+
if (!er && is) {
|
|
238
|
+
if (opt.all)
|
|
239
|
+
found.push(p + ext);
|
|
240
|
+
else
|
|
241
|
+
return resolve(p + ext);
|
|
242
|
+
}
|
|
243
|
+
return resolve(subStep(p, i, ii + 1));
|
|
78
244
|
});
|
|
79
|
-
|
|
80
|
-
|
|
245
|
+
});
|
|
246
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
247
|
+
};
|
|
248
|
+
var whichSync = (cmd, opt) => {
|
|
249
|
+
opt = opt || {};
|
|
250
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
251
|
+
const found = [];
|
|
252
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
253
|
+
const ppRaw = pathEnv[i];
|
|
254
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
255
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
256
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
257
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
258
|
+
const cur = p + pathExt[j];
|
|
259
|
+
try {
|
|
260
|
+
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
261
|
+
if (is) {
|
|
262
|
+
if (opt.all)
|
|
263
|
+
found.push(cur);
|
|
264
|
+
else
|
|
265
|
+
return cur;
|
|
266
|
+
}
|
|
267
|
+
} catch (ex) {
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (opt.all && found.length)
|
|
272
|
+
return found;
|
|
273
|
+
if (opt.nothrow)
|
|
274
|
+
return null;
|
|
275
|
+
throw getNotFoundError(cmd);
|
|
276
|
+
};
|
|
277
|
+
module.exports = which;
|
|
278
|
+
which.sync = whichSync;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
283
|
+
var require_path_key = __commonJS({
|
|
284
|
+
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
|
|
285
|
+
var pathKey2 = (options = {}) => {
|
|
286
|
+
const environment = options.env || process.env;
|
|
287
|
+
const platform = options.platform || process.platform;
|
|
288
|
+
if (platform !== "win32") {
|
|
289
|
+
return "PATH";
|
|
290
|
+
}
|
|
291
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
292
|
+
};
|
|
293
|
+
module.exports = pathKey2;
|
|
294
|
+
module.exports.default = pathKey2;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
299
|
+
var require_resolveCommand = __commonJS({
|
|
300
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
301
|
+
var path5 = __require("path");
|
|
302
|
+
var which = require_which();
|
|
303
|
+
var getPathKey = require_path_key();
|
|
304
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
305
|
+
const env = parsed.options.env || process.env;
|
|
306
|
+
const cwd = process.cwd();
|
|
307
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
308
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
309
|
+
if (shouldSwitchCwd) {
|
|
310
|
+
try {
|
|
311
|
+
process.chdir(parsed.options.cwd);
|
|
312
|
+
} catch (err) {
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
let resolved;
|
|
316
|
+
try {
|
|
317
|
+
resolved = which.sync(parsed.command, {
|
|
318
|
+
path: env[getPathKey({ env })],
|
|
319
|
+
pathExt: withoutPathExt ? path5.delimiter : void 0
|
|
81
320
|
});
|
|
321
|
+
} catch (e) {
|
|
322
|
+
} finally {
|
|
323
|
+
if (shouldSwitchCwd) {
|
|
324
|
+
process.chdir(cwd);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (resolved) {
|
|
328
|
+
resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
329
|
+
}
|
|
330
|
+
return resolved;
|
|
331
|
+
}
|
|
332
|
+
function resolveCommand(parsed) {
|
|
333
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
334
|
+
}
|
|
335
|
+
module.exports = resolveCommand;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
340
|
+
var require_escape = __commonJS({
|
|
341
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
|
|
342
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
343
|
+
function escapeCommand(arg) {
|
|
344
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
345
|
+
return arg;
|
|
346
|
+
}
|
|
347
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
348
|
+
arg = `${arg}`;
|
|
349
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
350
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
351
|
+
arg = `"${arg}"`;
|
|
352
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
353
|
+
if (doubleEscapeMetaChars) {
|
|
354
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
355
|
+
}
|
|
356
|
+
return arg;
|
|
357
|
+
}
|
|
358
|
+
module.exports.command = escapeCommand;
|
|
359
|
+
module.exports.argument = escapeArgument;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
// ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
364
|
+
var require_shebang_regex = __commonJS({
|
|
365
|
+
"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
|
|
366
|
+
module.exports = /^#!(.*)/;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
371
|
+
var require_shebang_command = __commonJS({
|
|
372
|
+
"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
|
|
373
|
+
var shebangRegex = require_shebang_regex();
|
|
374
|
+
module.exports = (string = "") => {
|
|
375
|
+
const match2 = string.match(shebangRegex);
|
|
376
|
+
if (!match2) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
const [path5, argument] = match2[0].replace(/#! ?/, "").split(" ");
|
|
380
|
+
const binary = path5.split("/").pop();
|
|
381
|
+
if (binary === "env") {
|
|
382
|
+
return argument;
|
|
383
|
+
}
|
|
384
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
390
|
+
var require_readShebang = __commonJS({
|
|
391
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
392
|
+
var fs = __require("fs");
|
|
393
|
+
var shebangCommand = require_shebang_command();
|
|
394
|
+
function readShebang(command) {
|
|
395
|
+
const size = 150;
|
|
396
|
+
const buffer = Buffer.alloc(size);
|
|
397
|
+
let fd;
|
|
398
|
+
try {
|
|
399
|
+
fd = fs.openSync(command, "r");
|
|
400
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
401
|
+
fs.closeSync(fd);
|
|
402
|
+
} catch (e) {
|
|
403
|
+
}
|
|
404
|
+
return shebangCommand(buffer.toString());
|
|
405
|
+
}
|
|
406
|
+
module.exports = readShebang;
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
411
|
+
var require_parse = __commonJS({
|
|
412
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
413
|
+
var path5 = __require("path");
|
|
414
|
+
var resolveCommand = require_resolveCommand();
|
|
415
|
+
var escape = require_escape();
|
|
416
|
+
var readShebang = require_readShebang();
|
|
417
|
+
var isWin = process.platform === "win32";
|
|
418
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
419
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
420
|
+
function detectShebang(parsed) {
|
|
421
|
+
parsed.file = resolveCommand(parsed);
|
|
422
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
423
|
+
if (shebang) {
|
|
424
|
+
parsed.args.unshift(parsed.file);
|
|
425
|
+
parsed.command = shebang;
|
|
426
|
+
return resolveCommand(parsed);
|
|
427
|
+
}
|
|
428
|
+
return parsed.file;
|
|
429
|
+
}
|
|
430
|
+
function parseNonShell(parsed) {
|
|
431
|
+
if (!isWin) {
|
|
432
|
+
return parsed;
|
|
433
|
+
}
|
|
434
|
+
const commandFile = detectShebang(parsed);
|
|
435
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
436
|
+
if (parsed.options.forceShell || needsShell) {
|
|
437
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
438
|
+
parsed.command = path5.normalize(parsed.command);
|
|
439
|
+
parsed.command = escape.command(parsed.command);
|
|
440
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
441
|
+
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
442
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
443
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
444
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
445
|
+
}
|
|
446
|
+
return parsed;
|
|
447
|
+
}
|
|
448
|
+
function parse(command, args, options) {
|
|
449
|
+
if (args && !Array.isArray(args)) {
|
|
450
|
+
options = args;
|
|
451
|
+
args = null;
|
|
452
|
+
}
|
|
453
|
+
args = args ? args.slice(0) : [];
|
|
454
|
+
options = Object.assign({}, options);
|
|
455
|
+
const parsed = {
|
|
456
|
+
command,
|
|
457
|
+
args,
|
|
458
|
+
options,
|
|
459
|
+
file: void 0,
|
|
460
|
+
original: {
|
|
461
|
+
command,
|
|
462
|
+
args
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
466
|
+
}
|
|
467
|
+
module.exports = parse;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
472
|
+
var require_enoent = __commonJS({
|
|
473
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
|
|
474
|
+
var isWin = process.platform === "win32";
|
|
475
|
+
function notFoundError(original, syscall) {
|
|
476
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
477
|
+
code: "ENOENT",
|
|
478
|
+
errno: "ENOENT",
|
|
479
|
+
syscall: `${syscall} ${original.command}`,
|
|
480
|
+
path: original.command,
|
|
481
|
+
spawnargs: original.args
|
|
82
482
|
});
|
|
83
483
|
}
|
|
84
|
-
|
|
484
|
+
function hookChildProcess(cp, parsed) {
|
|
485
|
+
if (!isWin) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const originalEmit = cp.emit;
|
|
489
|
+
cp.emit = function(name, arg1) {
|
|
490
|
+
if (name === "exit") {
|
|
491
|
+
const err = verifyENOENT(arg1, parsed);
|
|
492
|
+
if (err) {
|
|
493
|
+
return originalEmit.call(cp, "error", err);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return originalEmit.apply(cp, arguments);
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function verifyENOENT(status, parsed) {
|
|
500
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
501
|
+
return notFoundError(parsed.original, "spawn");
|
|
502
|
+
}
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
function verifyENOENTSync(status, parsed) {
|
|
506
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
507
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
508
|
+
}
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
module.exports = {
|
|
512
|
+
hookChildProcess,
|
|
513
|
+
verifyENOENT,
|
|
514
|
+
verifyENOENTSync,
|
|
515
|
+
notFoundError
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
521
|
+
var require_cross_spawn = __commonJS({
|
|
522
|
+
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
|
|
523
|
+
var cp = __require("child_process");
|
|
524
|
+
var parse = require_parse();
|
|
525
|
+
var enoent = require_enoent();
|
|
526
|
+
function spawn2(command, args, options) {
|
|
527
|
+
const parsed = parse(command, args, options);
|
|
528
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
529
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
530
|
+
return spawned;
|
|
531
|
+
}
|
|
532
|
+
function spawnSync(command, args, options) {
|
|
533
|
+
const parsed = parse(command, args, options);
|
|
534
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
535
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
536
|
+
return result;
|
|
537
|
+
}
|
|
538
|
+
module.exports = spawn2;
|
|
539
|
+
module.exports.spawn = spawn2;
|
|
540
|
+
module.exports.sync = spawnSync;
|
|
541
|
+
module.exports._parse = parse;
|
|
542
|
+
module.exports._enoent = enoent;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
547
|
+
var require_signals = __commonJS({
|
|
548
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
|
|
549
|
+
module.exports = [
|
|
550
|
+
"SIGABRT",
|
|
551
|
+
"SIGALRM",
|
|
552
|
+
"SIGHUP",
|
|
553
|
+
"SIGINT",
|
|
554
|
+
"SIGTERM"
|
|
555
|
+
];
|
|
556
|
+
if (process.platform !== "win32") {
|
|
557
|
+
module.exports.push(
|
|
558
|
+
"SIGVTALRM",
|
|
559
|
+
"SIGXCPU",
|
|
560
|
+
"SIGXFSZ",
|
|
561
|
+
"SIGUSR2",
|
|
562
|
+
"SIGTRAP",
|
|
563
|
+
"SIGSYS",
|
|
564
|
+
"SIGQUIT",
|
|
565
|
+
"SIGIOT"
|
|
566
|
+
// should detect profiler and enable/disable accordingly.
|
|
567
|
+
// see #21
|
|
568
|
+
// 'SIGPROF'
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
if (process.platform === "linux") {
|
|
572
|
+
module.exports.push(
|
|
573
|
+
"SIGIO",
|
|
574
|
+
"SIGPOLL",
|
|
575
|
+
"SIGPWR",
|
|
576
|
+
"SIGSTKFLT",
|
|
577
|
+
"SIGUNUSED"
|
|
578
|
+
);
|
|
579
|
+
}
|
|
85
580
|
}
|
|
86
581
|
});
|
|
87
582
|
|
|
88
|
-
// ../../node_modules/.pnpm/
|
|
89
|
-
var
|
|
90
|
-
"../../node_modules/.pnpm/
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
583
|
+
// ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
584
|
+
var require_signal_exit = __commonJS({
|
|
585
|
+
"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
|
|
586
|
+
var process13 = global.process;
|
|
587
|
+
var processOk2 = function(process14) {
|
|
588
|
+
return process14 && typeof process14 === "object" && typeof process14.removeListener === "function" && typeof process14.emit === "function" && typeof process14.reallyExit === "function" && typeof process14.listeners === "function" && typeof process14.kill === "function" && typeof process14.pid === "number" && typeof process14.on === "function";
|
|
589
|
+
};
|
|
590
|
+
if (!processOk2(process13)) {
|
|
591
|
+
module.exports = function() {
|
|
592
|
+
return function() {
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
} else {
|
|
596
|
+
assert = __require("assert");
|
|
597
|
+
signals2 = require_signals();
|
|
598
|
+
isWin = /^win/i.test(process13.platform);
|
|
599
|
+
EE = __require("events");
|
|
600
|
+
if (typeof EE !== "function") {
|
|
601
|
+
EE = EE.EventEmitter;
|
|
602
|
+
}
|
|
603
|
+
if (process13.__signal_exit_emitter__) {
|
|
604
|
+
emitter = process13.__signal_exit_emitter__;
|
|
605
|
+
} else {
|
|
606
|
+
emitter = process13.__signal_exit_emitter__ = new EE();
|
|
607
|
+
emitter.count = 0;
|
|
608
|
+
emitter.emitted = {};
|
|
609
|
+
}
|
|
610
|
+
if (!emitter.infinite) {
|
|
611
|
+
emitter.setMaxListeners(Infinity);
|
|
612
|
+
emitter.infinite = true;
|
|
613
|
+
}
|
|
614
|
+
module.exports = function(cb, opts) {
|
|
615
|
+
if (!processOk2(global.process)) {
|
|
616
|
+
return function() {
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
620
|
+
if (loaded === false) {
|
|
621
|
+
load2();
|
|
622
|
+
}
|
|
623
|
+
var ev = "exit";
|
|
624
|
+
if (opts && opts.alwaysLast) {
|
|
625
|
+
ev = "afterexit";
|
|
626
|
+
}
|
|
627
|
+
var remove = function() {
|
|
628
|
+
emitter.removeListener(ev, cb);
|
|
629
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
630
|
+
unload2();
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
emitter.on(ev, cb);
|
|
634
|
+
return remove;
|
|
635
|
+
};
|
|
636
|
+
unload2 = function unload3() {
|
|
637
|
+
if (!loaded || !processOk2(global.process)) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
loaded = false;
|
|
641
|
+
signals2.forEach(function(sig) {
|
|
642
|
+
try {
|
|
643
|
+
process13.removeListener(sig, sigListeners[sig]);
|
|
644
|
+
} catch (er) {
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
process13.emit = originalProcessEmit;
|
|
648
|
+
process13.reallyExit = originalProcessReallyExit;
|
|
649
|
+
emitter.count -= 1;
|
|
650
|
+
};
|
|
651
|
+
module.exports.unload = unload2;
|
|
652
|
+
emit = function emit2(event, code, signal) {
|
|
653
|
+
if (emitter.emitted[event]) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
emitter.emitted[event] = true;
|
|
657
|
+
emitter.emit(event, code, signal);
|
|
658
|
+
};
|
|
659
|
+
sigListeners = {};
|
|
660
|
+
signals2.forEach(function(sig) {
|
|
661
|
+
sigListeners[sig] = function listener() {
|
|
662
|
+
if (!processOk2(global.process)) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
var listeners = process13.listeners(sig);
|
|
666
|
+
if (listeners.length === emitter.count) {
|
|
667
|
+
unload2();
|
|
668
|
+
emit("exit", null, sig);
|
|
669
|
+
emit("afterexit", null, sig);
|
|
670
|
+
if (isWin && sig === "SIGHUP") {
|
|
671
|
+
sig = "SIGINT";
|
|
672
|
+
}
|
|
673
|
+
process13.kill(process13.pid, sig);
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
});
|
|
677
|
+
module.exports.signals = function() {
|
|
678
|
+
return signals2;
|
|
679
|
+
};
|
|
680
|
+
loaded = false;
|
|
681
|
+
load2 = function load3() {
|
|
682
|
+
if (loaded || !processOk2(global.process)) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
loaded = true;
|
|
686
|
+
emitter.count += 1;
|
|
687
|
+
signals2 = signals2.filter(function(sig) {
|
|
688
|
+
try {
|
|
689
|
+
process13.on(sig, sigListeners[sig]);
|
|
690
|
+
return true;
|
|
691
|
+
} catch (er) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
109
694
|
});
|
|
695
|
+
process13.emit = processEmit;
|
|
696
|
+
process13.reallyExit = processReallyExit;
|
|
697
|
+
};
|
|
698
|
+
module.exports.load = load2;
|
|
699
|
+
originalProcessReallyExit = process13.reallyExit;
|
|
700
|
+
processReallyExit = function processReallyExit2(code) {
|
|
701
|
+
if (!processOk2(global.process)) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
process13.exitCode = code || /* istanbul ignore next */
|
|
705
|
+
0;
|
|
706
|
+
emit("exit", process13.exitCode, null);
|
|
707
|
+
emit("afterexit", process13.exitCode, null);
|
|
708
|
+
originalProcessReallyExit.call(process13, process13.exitCode);
|
|
709
|
+
};
|
|
710
|
+
originalProcessEmit = process13.emit;
|
|
711
|
+
processEmit = function processEmit2(ev, arg) {
|
|
712
|
+
if (ev === "exit" && processOk2(global.process)) {
|
|
713
|
+
if (arg !== void 0) {
|
|
714
|
+
process13.exitCode = arg;
|
|
715
|
+
}
|
|
716
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
717
|
+
emit("exit", process13.exitCode, null);
|
|
718
|
+
emit("afterexit", process13.exitCode, null);
|
|
719
|
+
return ret;
|
|
720
|
+
} else {
|
|
721
|
+
return originalProcessEmit.apply(this, arguments);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
var assert;
|
|
726
|
+
var signals2;
|
|
727
|
+
var isWin;
|
|
728
|
+
var EE;
|
|
729
|
+
var emitter;
|
|
730
|
+
var unload2;
|
|
731
|
+
var emit;
|
|
732
|
+
var sigListeners;
|
|
733
|
+
var loaded;
|
|
734
|
+
var load2;
|
|
735
|
+
var originalProcessReallyExit;
|
|
736
|
+
var processReallyExit;
|
|
737
|
+
var originalProcessEmit;
|
|
738
|
+
var processEmit;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js
|
|
743
|
+
var require_buffer_stream = __commonJS({
|
|
744
|
+
"../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js"(exports, module) {
|
|
745
|
+
var { PassThrough: PassThroughStream } = __require("stream");
|
|
746
|
+
module.exports = (options) => {
|
|
747
|
+
options = { ...options };
|
|
748
|
+
const { array } = options;
|
|
749
|
+
let { encoding } = options;
|
|
750
|
+
const isBuffer = encoding === "buffer";
|
|
751
|
+
let objectMode = false;
|
|
752
|
+
if (array) {
|
|
753
|
+
objectMode = !(encoding || isBuffer);
|
|
754
|
+
} else {
|
|
755
|
+
encoding = encoding || "utf8";
|
|
110
756
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
757
|
+
if (isBuffer) {
|
|
758
|
+
encoding = null;
|
|
759
|
+
}
|
|
760
|
+
const stream2 = new PassThroughStream({ objectMode });
|
|
761
|
+
if (encoding) {
|
|
762
|
+
stream2.setEncoding(encoding);
|
|
763
|
+
}
|
|
764
|
+
let length = 0;
|
|
765
|
+
const chunks = [];
|
|
766
|
+
stream2.on("data", (chunk) => {
|
|
767
|
+
chunks.push(chunk);
|
|
768
|
+
if (objectMode) {
|
|
769
|
+
length = chunks.length;
|
|
770
|
+
} else {
|
|
771
|
+
length += chunk.length;
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
stream2.getBufferedValue = () => {
|
|
775
|
+
if (array) {
|
|
776
|
+
return chunks;
|
|
777
|
+
}
|
|
778
|
+
return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
|
|
779
|
+
};
|
|
780
|
+
stream2.getBufferedLength = () => length;
|
|
781
|
+
return stream2;
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
// ../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js
|
|
787
|
+
var require_get_stream = __commonJS({
|
|
788
|
+
"../../node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js"(exports, module) {
|
|
789
|
+
var { constants: BufferConstants } = __require("buffer");
|
|
790
|
+
var stream2 = __require("stream");
|
|
791
|
+
var { promisify: promisify2 } = __require("util");
|
|
792
|
+
var bufferStream = require_buffer_stream();
|
|
793
|
+
var streamPipelinePromisified = promisify2(stream2.pipeline);
|
|
794
|
+
var MaxBufferError2 = class extends Error {
|
|
795
|
+
constructor() {
|
|
796
|
+
super("maxBuffer exceeded");
|
|
797
|
+
this.name = "MaxBufferError";
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
async function getStream2(inputStream, options) {
|
|
801
|
+
if (!inputStream) {
|
|
802
|
+
throw new Error("Expected a stream");
|
|
803
|
+
}
|
|
804
|
+
options = {
|
|
805
|
+
maxBuffer: Infinity,
|
|
806
|
+
...options
|
|
807
|
+
};
|
|
808
|
+
const { maxBuffer } = options;
|
|
809
|
+
const stream3 = bufferStream(options);
|
|
810
|
+
await new Promise((resolve, reject) => {
|
|
811
|
+
const rejectPromise = (error) => {
|
|
812
|
+
if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
813
|
+
error.bufferedData = stream3.getBufferedValue();
|
|
814
|
+
}
|
|
815
|
+
reject(error);
|
|
816
|
+
};
|
|
817
|
+
(async () => {
|
|
818
|
+
try {
|
|
819
|
+
await streamPipelinePromisified(inputStream, stream3);
|
|
820
|
+
resolve();
|
|
821
|
+
} catch (error) {
|
|
822
|
+
rejectPromise(error);
|
|
823
|
+
}
|
|
824
|
+
})();
|
|
825
|
+
stream3.on("data", () => {
|
|
826
|
+
if (stream3.getBufferedLength() > maxBuffer) {
|
|
827
|
+
rejectPromise(new MaxBufferError2());
|
|
828
|
+
}
|
|
829
|
+
});
|
|
120
830
|
});
|
|
831
|
+
return stream3.getBufferedValue();
|
|
832
|
+
}
|
|
833
|
+
module.exports = getStream2;
|
|
834
|
+
module.exports.buffer = (stream3, options) => getStream2(stream3, { ...options, encoding: "buffer" });
|
|
835
|
+
module.exports.array = (stream3, options) => getStream2(stream3, { ...options, array: true });
|
|
836
|
+
module.exports.MaxBufferError = MaxBufferError2;
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
// ../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
|
|
841
|
+
var require_merge_stream = __commonJS({
|
|
842
|
+
"../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module) {
|
|
843
|
+
var { PassThrough } = __require("stream");
|
|
844
|
+
module.exports = function() {
|
|
845
|
+
var sources = [];
|
|
846
|
+
var output = new PassThrough({ objectMode: true });
|
|
847
|
+
output.setMaxListeners(0);
|
|
848
|
+
output.add = add;
|
|
849
|
+
output.isEmpty = isEmpty;
|
|
850
|
+
output.on("unpipe", remove);
|
|
851
|
+
Array.prototype.slice.call(arguments).forEach(add);
|
|
852
|
+
return output;
|
|
853
|
+
function add(source) {
|
|
854
|
+
if (Array.isArray(source)) {
|
|
855
|
+
source.forEach(add);
|
|
856
|
+
return this;
|
|
857
|
+
}
|
|
858
|
+
sources.push(source);
|
|
859
|
+
source.once("end", remove.bind(null, source));
|
|
860
|
+
source.once("error", output.emit.bind(output, "error"));
|
|
861
|
+
source.pipe(output, { end: false });
|
|
862
|
+
return this;
|
|
863
|
+
}
|
|
864
|
+
function isEmpty() {
|
|
865
|
+
return sources.length == 0;
|
|
866
|
+
}
|
|
867
|
+
function remove(source) {
|
|
868
|
+
sources = sources.filter(function(it) {
|
|
869
|
+
return it !== source;
|
|
870
|
+
});
|
|
871
|
+
if (!sources.length && output.readable) {
|
|
872
|
+
output.end();
|
|
873
|
+
}
|
|
874
|
+
}
|
|
121
875
|
};
|
|
122
876
|
}
|
|
123
877
|
});
|
|
@@ -197,7 +951,7 @@ var require_picocolors = __commonJS({
|
|
|
197
951
|
// ../../node_modules/.pnpm/@opencode-ai+sdk@1.0.132/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
|
|
198
952
|
var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
199
953
|
let lastEventId;
|
|
200
|
-
const
|
|
954
|
+
const sleep2 = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
201
955
|
const createStream = async function* () {
|
|
202
956
|
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
203
957
|
let attempt = 0;
|
|
@@ -292,7 +1046,7 @@ var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseVa
|
|
|
292
1046
|
break;
|
|
293
1047
|
}
|
|
294
1048
|
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
295
|
-
await
|
|
1049
|
+
await sleep2(backoff);
|
|
296
1050
|
}
|
|
297
1051
|
}
|
|
298
1052
|
};
|
|
@@ -425,7 +1179,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
425
1179
|
|
|
426
1180
|
// ../../node_modules/.pnpm/@opencode-ai+sdk@1.0.132/node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
|
|
427
1181
|
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
428
|
-
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
1182
|
+
var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
429
1183
|
let url = _url;
|
|
430
1184
|
const matches = _url.match(PATH_PARAM_RE);
|
|
431
1185
|
if (matches) {
|
|
@@ -444,7 +1198,7 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
444
1198
|
name = name.substring(1);
|
|
445
1199
|
style = "matrix";
|
|
446
1200
|
}
|
|
447
|
-
const value =
|
|
1201
|
+
const value = path5[name];
|
|
448
1202
|
if (value === void 0 || value === null) {
|
|
449
1203
|
continue;
|
|
450
1204
|
}
|
|
@@ -475,11 +1229,11 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
475
1229
|
}
|
|
476
1230
|
return url;
|
|
477
1231
|
};
|
|
478
|
-
var getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
1232
|
+
var getUrl = ({ baseUrl, path: path5, query, querySerializer, url: _url }) => {
|
|
479
1233
|
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
480
1234
|
let url = (baseUrl ?? "") + pathUrl;
|
|
481
|
-
if (
|
|
482
|
-
url = defaultPathSerializer({ path, url });
|
|
1235
|
+
if (path5) {
|
|
1236
|
+
url = defaultPathSerializer({ path: path5, url });
|
|
483
1237
|
}
|
|
484
1238
|
let search = query ? querySerializer(query) : "";
|
|
485
1239
|
if (search.startsWith("?")) {
|
|
@@ -1546,169 +2300,2792 @@ var Tui = class extends _HeyApiClient {
|
|
|
1546
2300
|
}
|
|
1547
2301
|
});
|
|
1548
2302
|
}
|
|
1549
|
-
control = new Control({ client: this._client });
|
|
2303
|
+
control = new Control({ client: this._client });
|
|
2304
|
+
};
|
|
2305
|
+
var Auth = class extends _HeyApiClient {
|
|
2306
|
+
/**
|
|
2307
|
+
* Set authentication credentials
|
|
2308
|
+
*/
|
|
2309
|
+
set(options) {
|
|
2310
|
+
return (options.client ?? this._client).put({
|
|
2311
|
+
url: "/auth/{id}",
|
|
2312
|
+
...options,
|
|
2313
|
+
headers: {
|
|
2314
|
+
"Content-Type": "application/json",
|
|
2315
|
+
...options.headers
|
|
2316
|
+
}
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
var Event = class extends _HeyApiClient {
|
|
2321
|
+
/**
|
|
2322
|
+
* Get events
|
|
2323
|
+
*/
|
|
2324
|
+
subscribe(options) {
|
|
2325
|
+
return (options?.client ?? this._client).get.sse({
|
|
2326
|
+
url: "/event",
|
|
2327
|
+
...options
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2331
|
+
var OpencodeClient = class extends _HeyApiClient {
|
|
2332
|
+
/**
|
|
2333
|
+
* Respond to a permission request
|
|
2334
|
+
*/
|
|
2335
|
+
postSessionIdPermissionsPermissionId(options) {
|
|
2336
|
+
return (options.client ?? this._client).post({
|
|
2337
|
+
url: "/session/{id}/permissions/{permissionID}",
|
|
2338
|
+
...options,
|
|
2339
|
+
headers: {
|
|
2340
|
+
"Content-Type": "application/json",
|
|
2341
|
+
...options.headers
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
global = new Global({ client: this._client });
|
|
2346
|
+
project = new Project({ client: this._client });
|
|
2347
|
+
config = new Config({ client: this._client });
|
|
2348
|
+
tool = new Tool({ client: this._client });
|
|
2349
|
+
instance = new Instance({ client: this._client });
|
|
2350
|
+
path = new Path({ client: this._client });
|
|
2351
|
+
vcs = new Vcs({ client: this._client });
|
|
2352
|
+
session = new Session({ client: this._client });
|
|
2353
|
+
command = new Command({ client: this._client });
|
|
2354
|
+
provider = new Provider({ client: this._client });
|
|
2355
|
+
find = new Find({ client: this._client });
|
|
2356
|
+
file = new File2({ client: this._client });
|
|
2357
|
+
app = new App({ client: this._client });
|
|
2358
|
+
mcp = new Mcp({ client: this._client });
|
|
2359
|
+
lsp = new Lsp({ client: this._client });
|
|
2360
|
+
formatter = new Formatter({ client: this._client });
|
|
2361
|
+
tui = new Tui({ client: this._client });
|
|
2362
|
+
auth = new Auth({ client: this._client });
|
|
2363
|
+
event = new Event({ client: this._client });
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
// ../../node_modules/.pnpm/@opencode-ai+sdk@1.0.132/node_modules/@opencode-ai/sdk/dist/client.js
|
|
2367
|
+
function createOpencodeClient(config) {
|
|
2368
|
+
if (!config?.fetch) {
|
|
2369
|
+
config = {
|
|
2370
|
+
...config,
|
|
2371
|
+
fetch: (req) => {
|
|
2372
|
+
req.timeout = false;
|
|
2373
|
+
return fetch(req);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
if (config?.directory) {
|
|
2378
|
+
config.headers = {
|
|
2379
|
+
...config.headers,
|
|
2380
|
+
"x-opencode-directory": config.directory
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2383
|
+
const client2 = createClient(config);
|
|
2384
|
+
return new OpencodeClient({ client: client2 });
|
|
2385
|
+
}
|
|
2386
|
+
async function createOpencodeServer(options) {
|
|
2387
|
+
options = Object.assign({
|
|
2388
|
+
hostname: "127.0.0.1",
|
|
2389
|
+
port: 4096,
|
|
2390
|
+
timeout: 5e3
|
|
2391
|
+
}, options ?? {});
|
|
2392
|
+
const proc = childProcess2.spawn(`opencode`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
|
|
2393
|
+
signal: options.signal,
|
|
2394
|
+
env: {
|
|
2395
|
+
...process.env,
|
|
2396
|
+
OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {})
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
const url = await new Promise((resolve, reject) => {
|
|
2400
|
+
const id = setTimeout(() => {
|
|
2401
|
+
reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
|
|
2402
|
+
}, options.timeout);
|
|
2403
|
+
let output = "";
|
|
2404
|
+
proc.stdout?.on("data", (chunk) => {
|
|
2405
|
+
output += chunk.toString();
|
|
2406
|
+
const lines = output.split("\n");
|
|
2407
|
+
for (const line of lines) {
|
|
2408
|
+
if (line.startsWith("opencode server listening")) {
|
|
2409
|
+
const match2 = line.match(/on\s+(https?:\/\/[^\s]+)/);
|
|
2410
|
+
if (!match2) {
|
|
2411
|
+
throw new Error(`Failed to parse server url from output: ${line}`);
|
|
2412
|
+
}
|
|
2413
|
+
clearTimeout(id);
|
|
2414
|
+
resolve(match2[1]);
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
proc.stderr?.on("data", (chunk) => {
|
|
2420
|
+
output += chunk.toString();
|
|
2421
|
+
});
|
|
2422
|
+
proc.on("exit", (code) => {
|
|
2423
|
+
clearTimeout(id);
|
|
2424
|
+
let msg = `Server exited with code ${code}`;
|
|
2425
|
+
if (output.trim()) {
|
|
2426
|
+
msg += `
|
|
2427
|
+
Server output: ${output}`;
|
|
2428
|
+
}
|
|
2429
|
+
reject(new Error(msg));
|
|
2430
|
+
});
|
|
2431
|
+
proc.on("error", (error) => {
|
|
2432
|
+
clearTimeout(id);
|
|
2433
|
+
reject(error);
|
|
2434
|
+
});
|
|
2435
|
+
if (options.signal) {
|
|
2436
|
+
options.signal.addEventListener("abort", () => {
|
|
2437
|
+
clearTimeout(id);
|
|
2438
|
+
reject(new Error("Aborted"));
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
});
|
|
2442
|
+
return {
|
|
2443
|
+
url,
|
|
2444
|
+
close() {
|
|
2445
|
+
proc.kill();
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
// ../../node_modules/.pnpm/@opencode-ai+sdk@1.0.132/node_modules/@opencode-ai/sdk/dist/index.js
|
|
2451
|
+
async function createOpencode(options) {
|
|
2452
|
+
const server = await createOpencodeServer({
|
|
2453
|
+
...options
|
|
2454
|
+
});
|
|
2455
|
+
const client2 = createOpencodeClient({
|
|
2456
|
+
baseUrl: server.url
|
|
2457
|
+
});
|
|
2458
|
+
return {
|
|
2459
|
+
client: client2,
|
|
2460
|
+
server
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
|
|
2465
|
+
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
2466
|
+
|
|
2467
|
+
// ../../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
|
|
2468
|
+
function stripFinalNewline(input) {
|
|
2469
|
+
const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
|
|
2470
|
+
const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
|
|
2471
|
+
if (input[input.length - 1] === LF) {
|
|
2472
|
+
input = input.slice(0, -1);
|
|
2473
|
+
}
|
|
2474
|
+
if (input[input.length - 1] === CR) {
|
|
2475
|
+
input = input.slice(0, -1);
|
|
2476
|
+
}
|
|
2477
|
+
return input;
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
2481
|
+
function pathKey(options = {}) {
|
|
2482
|
+
const {
|
|
2483
|
+
env = process.env,
|
|
2484
|
+
platform = process.platform
|
|
2485
|
+
} = options;
|
|
2486
|
+
if (platform !== "win32") {
|
|
2487
|
+
return "PATH";
|
|
2488
|
+
}
|
|
2489
|
+
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
// ../../node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
|
|
2493
|
+
var npmRunPath = ({
|
|
2494
|
+
cwd = process2__default.default.cwd(),
|
|
2495
|
+
path: pathOption = process2__default.default.env[pathKey()],
|
|
2496
|
+
preferLocal = true,
|
|
2497
|
+
execPath = process2__default.default.execPath,
|
|
2498
|
+
addExecPath = true
|
|
2499
|
+
} = {}) => {
|
|
2500
|
+
const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
|
|
2501
|
+
const cwdPath = path__default.default.resolve(cwdString);
|
|
2502
|
+
const result = [];
|
|
2503
|
+
if (preferLocal) {
|
|
2504
|
+
applyPreferLocal(result, cwdPath);
|
|
2505
|
+
}
|
|
2506
|
+
if (addExecPath) {
|
|
2507
|
+
applyExecPath(result, execPath, cwdPath);
|
|
2508
|
+
}
|
|
2509
|
+
return [...result, pathOption].join(path__default.default.delimiter);
|
|
2510
|
+
};
|
|
2511
|
+
var applyPreferLocal = (result, cwdPath) => {
|
|
2512
|
+
let previous;
|
|
2513
|
+
while (previous !== cwdPath) {
|
|
2514
|
+
result.push(path__default.default.join(cwdPath, "node_modules/.bin"));
|
|
2515
|
+
previous = cwdPath;
|
|
2516
|
+
cwdPath = path__default.default.resolve(cwdPath, "..");
|
|
2517
|
+
}
|
|
2518
|
+
};
|
|
2519
|
+
var applyExecPath = (result, execPath, cwdPath) => {
|
|
2520
|
+
const execPathString = execPath instanceof URL ? url.fileURLToPath(execPath) : execPath;
|
|
2521
|
+
result.push(path__default.default.resolve(cwdPath, execPathString, ".."));
|
|
2522
|
+
};
|
|
2523
|
+
var npmRunPathEnv = ({ env = process2__default.default.env, ...options } = {}) => {
|
|
2524
|
+
env = { ...env };
|
|
2525
|
+
const pathName = pathKey({ env });
|
|
2526
|
+
options.path = env[pathName];
|
|
2527
|
+
env[pathName] = npmRunPath(options);
|
|
2528
|
+
return env;
|
|
2529
|
+
};
|
|
2530
|
+
|
|
2531
|
+
// ../../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
2532
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
2533
|
+
if (property === "length" || property === "prototype") {
|
|
2534
|
+
return;
|
|
2535
|
+
}
|
|
2536
|
+
if (property === "arguments" || property === "caller") {
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
2539
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
2540
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
2541
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
2542
|
+
return;
|
|
2543
|
+
}
|
|
2544
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
2545
|
+
};
|
|
2546
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
2547
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
2548
|
+
};
|
|
2549
|
+
var changePrototype = (to, from) => {
|
|
2550
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
2551
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
2555
|
+
};
|
|
2556
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
2557
|
+
${fromBody}`;
|
|
2558
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
2559
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
2560
|
+
var changeToString = (to, from, name) => {
|
|
2561
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
2562
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
2563
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
2564
|
+
Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
2565
|
+
};
|
|
2566
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
2567
|
+
const { name } = to;
|
|
2568
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
2569
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
2570
|
+
}
|
|
2571
|
+
changePrototype(to, from);
|
|
2572
|
+
changeToString(to, from, name);
|
|
2573
|
+
return to;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
// ../../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
|
|
2577
|
+
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
2578
|
+
var onetime = (function_, options = {}) => {
|
|
2579
|
+
if (typeof function_ !== "function") {
|
|
2580
|
+
throw new TypeError("Expected a function");
|
|
2581
|
+
}
|
|
2582
|
+
let returnValue;
|
|
2583
|
+
let callCount = 0;
|
|
2584
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
2585
|
+
const onetime2 = function(...arguments_) {
|
|
2586
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
2587
|
+
if (callCount === 1) {
|
|
2588
|
+
returnValue = function_.apply(this, arguments_);
|
|
2589
|
+
function_ = null;
|
|
2590
|
+
} else if (options.throw === true) {
|
|
2591
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
2592
|
+
}
|
|
2593
|
+
return returnValue;
|
|
2594
|
+
};
|
|
2595
|
+
mimicFunction(onetime2, function_);
|
|
2596
|
+
calledFunctions.set(onetime2, callCount);
|
|
2597
|
+
return onetime2;
|
|
2598
|
+
};
|
|
2599
|
+
onetime.callCount = (function_) => {
|
|
2600
|
+
if (!calledFunctions.has(function_)) {
|
|
2601
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
2602
|
+
}
|
|
2603
|
+
return calledFunctions.get(function_);
|
|
2604
|
+
};
|
|
2605
|
+
var onetime_default = onetime;
|
|
2606
|
+
|
|
2607
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/realtime.js
|
|
2608
|
+
var getRealtimeSignals = function() {
|
|
2609
|
+
const length = SIGRTMAX - SIGRTMIN + 1;
|
|
2610
|
+
return Array.from({ length }, getRealtimeSignal);
|
|
2611
|
+
};
|
|
2612
|
+
var getRealtimeSignal = function(value, index) {
|
|
2613
|
+
return {
|
|
2614
|
+
name: `SIGRT${index + 1}`,
|
|
2615
|
+
number: SIGRTMIN + index,
|
|
2616
|
+
action: "terminate",
|
|
2617
|
+
description: "Application-specific signal (realtime)",
|
|
2618
|
+
standard: "posix"
|
|
2619
|
+
};
|
|
2620
|
+
};
|
|
2621
|
+
var SIGRTMIN = 34;
|
|
2622
|
+
var SIGRTMAX = 64;
|
|
2623
|
+
|
|
2624
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/core.js
|
|
2625
|
+
var SIGNALS = [
|
|
2626
|
+
{
|
|
2627
|
+
name: "SIGHUP",
|
|
2628
|
+
number: 1,
|
|
2629
|
+
action: "terminate",
|
|
2630
|
+
description: "Terminal closed",
|
|
2631
|
+
standard: "posix"
|
|
2632
|
+
},
|
|
2633
|
+
{
|
|
2634
|
+
name: "SIGINT",
|
|
2635
|
+
number: 2,
|
|
2636
|
+
action: "terminate",
|
|
2637
|
+
description: "User interruption with CTRL-C",
|
|
2638
|
+
standard: "ansi"
|
|
2639
|
+
},
|
|
2640
|
+
{
|
|
2641
|
+
name: "SIGQUIT",
|
|
2642
|
+
number: 3,
|
|
2643
|
+
action: "core",
|
|
2644
|
+
description: "User interruption with CTRL-\\",
|
|
2645
|
+
standard: "posix"
|
|
2646
|
+
},
|
|
2647
|
+
{
|
|
2648
|
+
name: "SIGILL",
|
|
2649
|
+
number: 4,
|
|
2650
|
+
action: "core",
|
|
2651
|
+
description: "Invalid machine instruction",
|
|
2652
|
+
standard: "ansi"
|
|
2653
|
+
},
|
|
2654
|
+
{
|
|
2655
|
+
name: "SIGTRAP",
|
|
2656
|
+
number: 5,
|
|
2657
|
+
action: "core",
|
|
2658
|
+
description: "Debugger breakpoint",
|
|
2659
|
+
standard: "posix"
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
name: "SIGABRT",
|
|
2663
|
+
number: 6,
|
|
2664
|
+
action: "core",
|
|
2665
|
+
description: "Aborted",
|
|
2666
|
+
standard: "ansi"
|
|
2667
|
+
},
|
|
2668
|
+
{
|
|
2669
|
+
name: "SIGIOT",
|
|
2670
|
+
number: 6,
|
|
2671
|
+
action: "core",
|
|
2672
|
+
description: "Aborted",
|
|
2673
|
+
standard: "bsd"
|
|
2674
|
+
},
|
|
2675
|
+
{
|
|
2676
|
+
name: "SIGBUS",
|
|
2677
|
+
number: 7,
|
|
2678
|
+
action: "core",
|
|
2679
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
2680
|
+
standard: "bsd"
|
|
2681
|
+
},
|
|
2682
|
+
{
|
|
2683
|
+
name: "SIGEMT",
|
|
2684
|
+
number: 7,
|
|
2685
|
+
action: "terminate",
|
|
2686
|
+
description: "Command should be emulated but is not implemented",
|
|
2687
|
+
standard: "other"
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
name: "SIGFPE",
|
|
2691
|
+
number: 8,
|
|
2692
|
+
action: "core",
|
|
2693
|
+
description: "Floating point arithmetic error",
|
|
2694
|
+
standard: "ansi"
|
|
2695
|
+
},
|
|
2696
|
+
{
|
|
2697
|
+
name: "SIGKILL",
|
|
2698
|
+
number: 9,
|
|
2699
|
+
action: "terminate",
|
|
2700
|
+
description: "Forced termination",
|
|
2701
|
+
standard: "posix",
|
|
2702
|
+
forced: true
|
|
2703
|
+
},
|
|
2704
|
+
{
|
|
2705
|
+
name: "SIGUSR1",
|
|
2706
|
+
number: 10,
|
|
2707
|
+
action: "terminate",
|
|
2708
|
+
description: "Application-specific signal",
|
|
2709
|
+
standard: "posix"
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
name: "SIGSEGV",
|
|
2713
|
+
number: 11,
|
|
2714
|
+
action: "core",
|
|
2715
|
+
description: "Segmentation fault",
|
|
2716
|
+
standard: "ansi"
|
|
2717
|
+
},
|
|
2718
|
+
{
|
|
2719
|
+
name: "SIGUSR2",
|
|
2720
|
+
number: 12,
|
|
2721
|
+
action: "terminate",
|
|
2722
|
+
description: "Application-specific signal",
|
|
2723
|
+
standard: "posix"
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
name: "SIGPIPE",
|
|
2727
|
+
number: 13,
|
|
2728
|
+
action: "terminate",
|
|
2729
|
+
description: "Broken pipe or socket",
|
|
2730
|
+
standard: "posix"
|
|
2731
|
+
},
|
|
2732
|
+
{
|
|
2733
|
+
name: "SIGALRM",
|
|
2734
|
+
number: 14,
|
|
2735
|
+
action: "terminate",
|
|
2736
|
+
description: "Timeout or timer",
|
|
2737
|
+
standard: "posix"
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
name: "SIGTERM",
|
|
2741
|
+
number: 15,
|
|
2742
|
+
action: "terminate",
|
|
2743
|
+
description: "Termination",
|
|
2744
|
+
standard: "ansi"
|
|
2745
|
+
},
|
|
2746
|
+
{
|
|
2747
|
+
name: "SIGSTKFLT",
|
|
2748
|
+
number: 16,
|
|
2749
|
+
action: "terminate",
|
|
2750
|
+
description: "Stack is empty or overflowed",
|
|
2751
|
+
standard: "other"
|
|
2752
|
+
},
|
|
2753
|
+
{
|
|
2754
|
+
name: "SIGCHLD",
|
|
2755
|
+
number: 17,
|
|
2756
|
+
action: "ignore",
|
|
2757
|
+
description: "Child process terminated, paused or unpaused",
|
|
2758
|
+
standard: "posix"
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
name: "SIGCLD",
|
|
2762
|
+
number: 17,
|
|
2763
|
+
action: "ignore",
|
|
2764
|
+
description: "Child process terminated, paused or unpaused",
|
|
2765
|
+
standard: "other"
|
|
2766
|
+
},
|
|
2767
|
+
{
|
|
2768
|
+
name: "SIGCONT",
|
|
2769
|
+
number: 18,
|
|
2770
|
+
action: "unpause",
|
|
2771
|
+
description: "Unpaused",
|
|
2772
|
+
standard: "posix",
|
|
2773
|
+
forced: true
|
|
2774
|
+
},
|
|
2775
|
+
{
|
|
2776
|
+
name: "SIGSTOP",
|
|
2777
|
+
number: 19,
|
|
2778
|
+
action: "pause",
|
|
2779
|
+
description: "Paused",
|
|
2780
|
+
standard: "posix",
|
|
2781
|
+
forced: true
|
|
2782
|
+
},
|
|
2783
|
+
{
|
|
2784
|
+
name: "SIGTSTP",
|
|
2785
|
+
number: 20,
|
|
2786
|
+
action: "pause",
|
|
2787
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
2788
|
+
standard: "posix"
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
name: "SIGTTIN",
|
|
2792
|
+
number: 21,
|
|
2793
|
+
action: "pause",
|
|
2794
|
+
description: "Background process cannot read terminal input",
|
|
2795
|
+
standard: "posix"
|
|
2796
|
+
},
|
|
2797
|
+
{
|
|
2798
|
+
name: "SIGBREAK",
|
|
2799
|
+
number: 21,
|
|
2800
|
+
action: "terminate",
|
|
2801
|
+
description: "User interruption with CTRL-BREAK",
|
|
2802
|
+
standard: "other"
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
name: "SIGTTOU",
|
|
2806
|
+
number: 22,
|
|
2807
|
+
action: "pause",
|
|
2808
|
+
description: "Background process cannot write to terminal output",
|
|
2809
|
+
standard: "posix"
|
|
2810
|
+
},
|
|
2811
|
+
{
|
|
2812
|
+
name: "SIGURG",
|
|
2813
|
+
number: 23,
|
|
2814
|
+
action: "ignore",
|
|
2815
|
+
description: "Socket received out-of-band data",
|
|
2816
|
+
standard: "bsd"
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
name: "SIGXCPU",
|
|
2820
|
+
number: 24,
|
|
2821
|
+
action: "core",
|
|
2822
|
+
description: "Process timed out",
|
|
2823
|
+
standard: "bsd"
|
|
2824
|
+
},
|
|
2825
|
+
{
|
|
2826
|
+
name: "SIGXFSZ",
|
|
2827
|
+
number: 25,
|
|
2828
|
+
action: "core",
|
|
2829
|
+
description: "File too big",
|
|
2830
|
+
standard: "bsd"
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
name: "SIGVTALRM",
|
|
2834
|
+
number: 26,
|
|
2835
|
+
action: "terminate",
|
|
2836
|
+
description: "Timeout or timer",
|
|
2837
|
+
standard: "bsd"
|
|
2838
|
+
},
|
|
2839
|
+
{
|
|
2840
|
+
name: "SIGPROF",
|
|
2841
|
+
number: 27,
|
|
2842
|
+
action: "terminate",
|
|
2843
|
+
description: "Timeout or timer",
|
|
2844
|
+
standard: "bsd"
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
name: "SIGWINCH",
|
|
2848
|
+
number: 28,
|
|
2849
|
+
action: "ignore",
|
|
2850
|
+
description: "Terminal window size changed",
|
|
2851
|
+
standard: "bsd"
|
|
2852
|
+
},
|
|
2853
|
+
{
|
|
2854
|
+
name: "SIGIO",
|
|
2855
|
+
number: 29,
|
|
2856
|
+
action: "terminate",
|
|
2857
|
+
description: "I/O is available",
|
|
2858
|
+
standard: "other"
|
|
2859
|
+
},
|
|
2860
|
+
{
|
|
2861
|
+
name: "SIGPOLL",
|
|
2862
|
+
number: 29,
|
|
2863
|
+
action: "terminate",
|
|
2864
|
+
description: "Watched event",
|
|
2865
|
+
standard: "other"
|
|
2866
|
+
},
|
|
2867
|
+
{
|
|
2868
|
+
name: "SIGINFO",
|
|
2869
|
+
number: 29,
|
|
2870
|
+
action: "ignore",
|
|
2871
|
+
description: "Request for process information",
|
|
2872
|
+
standard: "other"
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
name: "SIGPWR",
|
|
2876
|
+
number: 30,
|
|
2877
|
+
action: "terminate",
|
|
2878
|
+
description: "Device running out of power",
|
|
2879
|
+
standard: "systemv"
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
name: "SIGSYS",
|
|
2883
|
+
number: 31,
|
|
2884
|
+
action: "core",
|
|
2885
|
+
description: "Invalid system call",
|
|
2886
|
+
standard: "other"
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
name: "SIGUNUSED",
|
|
2890
|
+
number: 31,
|
|
2891
|
+
action: "terminate",
|
|
2892
|
+
description: "Invalid system call",
|
|
2893
|
+
standard: "other"
|
|
2894
|
+
}
|
|
2895
|
+
];
|
|
2896
|
+
|
|
2897
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/signals.js
|
|
2898
|
+
var getSignals = function() {
|
|
2899
|
+
const realtimeSignals = getRealtimeSignals();
|
|
2900
|
+
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
2901
|
+
return signals2;
|
|
2902
|
+
};
|
|
2903
|
+
var normalizeSignal = function({
|
|
2904
|
+
name,
|
|
2905
|
+
number: defaultNumber,
|
|
2906
|
+
description,
|
|
2907
|
+
action,
|
|
2908
|
+
forced = false,
|
|
2909
|
+
standard
|
|
2910
|
+
}) {
|
|
2911
|
+
const {
|
|
2912
|
+
signals: { [name]: constantSignal }
|
|
2913
|
+
} = os.constants;
|
|
2914
|
+
const supported = constantSignal !== void 0;
|
|
2915
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
2916
|
+
return { name, number, description, supported, action, forced, standard };
|
|
2917
|
+
};
|
|
2918
|
+
|
|
2919
|
+
// ../../node_modules/.pnpm/human-signals@3.0.1/node_modules/human-signals/build/src/main.js
|
|
2920
|
+
var getSignalsByName = function() {
|
|
2921
|
+
const signals2 = getSignals();
|
|
2922
|
+
return signals2.reduce(getSignalByName, {});
|
|
2923
|
+
};
|
|
2924
|
+
var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
|
|
2925
|
+
return {
|
|
2926
|
+
...signalByNameMemo,
|
|
2927
|
+
[name]: { name, number, description, supported, action, forced, standard }
|
|
2928
|
+
};
|
|
2929
|
+
};
|
|
2930
|
+
var signalsByName = getSignalsByName();
|
|
2931
|
+
var getSignalsByNumber = function() {
|
|
2932
|
+
const signals2 = getSignals();
|
|
2933
|
+
const length = SIGRTMAX + 1;
|
|
2934
|
+
const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals2));
|
|
2935
|
+
return Object.assign({}, ...signalsA);
|
|
2936
|
+
};
|
|
2937
|
+
var getSignalByNumber = function(number, signals2) {
|
|
2938
|
+
const signal = findSignalByNumber(number, signals2);
|
|
2939
|
+
if (signal === void 0) {
|
|
2940
|
+
return {};
|
|
2941
|
+
}
|
|
2942
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
2943
|
+
return {
|
|
2944
|
+
[number]: {
|
|
2945
|
+
name,
|
|
2946
|
+
number,
|
|
2947
|
+
description,
|
|
2948
|
+
supported,
|
|
2949
|
+
action,
|
|
2950
|
+
forced,
|
|
2951
|
+
standard
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
};
|
|
2955
|
+
var findSignalByNumber = function(number, signals2) {
|
|
2956
|
+
const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
|
|
2957
|
+
if (signal !== void 0) {
|
|
2958
|
+
return signal;
|
|
2959
|
+
}
|
|
2960
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
2961
|
+
};
|
|
2962
|
+
getSignalsByNumber();
|
|
2963
|
+
|
|
2964
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/error.js
|
|
2965
|
+
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
2966
|
+
if (timedOut) {
|
|
2967
|
+
return `timed out after ${timeout} milliseconds`;
|
|
2968
|
+
}
|
|
2969
|
+
if (isCanceled) {
|
|
2970
|
+
return "was canceled";
|
|
2971
|
+
}
|
|
2972
|
+
if (errorCode !== void 0) {
|
|
2973
|
+
return `failed with ${errorCode}`;
|
|
2974
|
+
}
|
|
2975
|
+
if (signal !== void 0) {
|
|
2976
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
2977
|
+
}
|
|
2978
|
+
if (exitCode !== void 0) {
|
|
2979
|
+
return `failed with exit code ${exitCode}`;
|
|
2980
|
+
}
|
|
2981
|
+
return "failed";
|
|
2982
|
+
};
|
|
2983
|
+
var makeError = ({
|
|
2984
|
+
stdout,
|
|
2985
|
+
stderr,
|
|
2986
|
+
all,
|
|
2987
|
+
error,
|
|
2988
|
+
signal,
|
|
2989
|
+
exitCode,
|
|
2990
|
+
command,
|
|
2991
|
+
escapedCommand,
|
|
2992
|
+
timedOut,
|
|
2993
|
+
isCanceled,
|
|
2994
|
+
killed,
|
|
2995
|
+
parsed: { options: { timeout } }
|
|
2996
|
+
}) => {
|
|
2997
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
2998
|
+
signal = signal === null ? void 0 : signal;
|
|
2999
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
|
|
3000
|
+
const errorCode = error && error.code;
|
|
3001
|
+
const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
3002
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
3003
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
3004
|
+
const shortMessage = isError ? `${execaMessage}
|
|
3005
|
+
${error.message}` : execaMessage;
|
|
3006
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
3007
|
+
if (isError) {
|
|
3008
|
+
error.originalMessage = error.message;
|
|
3009
|
+
error.message = message;
|
|
3010
|
+
} else {
|
|
3011
|
+
error = new Error(message);
|
|
3012
|
+
}
|
|
3013
|
+
error.shortMessage = shortMessage;
|
|
3014
|
+
error.command = command;
|
|
3015
|
+
error.escapedCommand = escapedCommand;
|
|
3016
|
+
error.exitCode = exitCode;
|
|
3017
|
+
error.signal = signal;
|
|
3018
|
+
error.signalDescription = signalDescription;
|
|
3019
|
+
error.stdout = stdout;
|
|
3020
|
+
error.stderr = stderr;
|
|
3021
|
+
if (all !== void 0) {
|
|
3022
|
+
error.all = all;
|
|
3023
|
+
}
|
|
3024
|
+
if ("bufferedData" in error) {
|
|
3025
|
+
delete error.bufferedData;
|
|
3026
|
+
}
|
|
3027
|
+
error.failed = true;
|
|
3028
|
+
error.timedOut = Boolean(timedOut);
|
|
3029
|
+
error.isCanceled = isCanceled;
|
|
3030
|
+
error.killed = killed && !timedOut;
|
|
3031
|
+
return error;
|
|
3032
|
+
};
|
|
3033
|
+
|
|
3034
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stdio.js
|
|
3035
|
+
var aliases = ["stdin", "stdout", "stderr"];
|
|
3036
|
+
var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
|
|
3037
|
+
var normalizeStdio = (options) => {
|
|
3038
|
+
if (!options) {
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3041
|
+
const { stdio } = options;
|
|
3042
|
+
if (stdio === void 0) {
|
|
3043
|
+
return aliases.map((alias) => options[alias]);
|
|
3044
|
+
}
|
|
3045
|
+
if (hasAlias(options)) {
|
|
3046
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
3047
|
+
}
|
|
3048
|
+
if (typeof stdio === "string") {
|
|
3049
|
+
return stdio;
|
|
3050
|
+
}
|
|
3051
|
+
if (!Array.isArray(stdio)) {
|
|
3052
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
3053
|
+
}
|
|
3054
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
3055
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
3056
|
+
};
|
|
3057
|
+
|
|
3058
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
|
3059
|
+
var import_signal_exit = __toESM(require_signal_exit());
|
|
3060
|
+
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
3061
|
+
var spawnedKill = (kill2, signal = "SIGTERM", options = {}) => {
|
|
3062
|
+
const killResult = kill2(signal);
|
|
3063
|
+
setKillTimeout(kill2, signal, options, killResult);
|
|
3064
|
+
return killResult;
|
|
3065
|
+
};
|
|
3066
|
+
var setKillTimeout = (kill2, signal, options, killResult) => {
|
|
3067
|
+
if (!shouldForceKill(signal, options, killResult)) {
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
const timeout = getForceKillAfterTimeout(options);
|
|
3071
|
+
const t = setTimeout(() => {
|
|
3072
|
+
kill2("SIGKILL");
|
|
3073
|
+
}, timeout);
|
|
3074
|
+
if (t.unref) {
|
|
3075
|
+
t.unref();
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
3079
|
+
var isSigterm = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
3080
|
+
var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
3081
|
+
if (forceKillAfterTimeout === true) {
|
|
3082
|
+
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
3083
|
+
}
|
|
3084
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
3085
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
3086
|
+
}
|
|
3087
|
+
return forceKillAfterTimeout;
|
|
3088
|
+
};
|
|
3089
|
+
var spawnedCancel = (spawned, context) => {
|
|
3090
|
+
const killResult = spawned.kill();
|
|
3091
|
+
if (killResult) {
|
|
3092
|
+
context.isCanceled = true;
|
|
3093
|
+
}
|
|
3094
|
+
};
|
|
3095
|
+
var timeoutKill = (spawned, signal, reject) => {
|
|
3096
|
+
spawned.kill(signal);
|
|
3097
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
3098
|
+
};
|
|
3099
|
+
var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
3100
|
+
if (timeout === 0 || timeout === void 0) {
|
|
3101
|
+
return spawnedPromise;
|
|
3102
|
+
}
|
|
3103
|
+
let timeoutId;
|
|
3104
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
3105
|
+
timeoutId = setTimeout(() => {
|
|
3106
|
+
timeoutKill(spawned, killSignal, reject);
|
|
3107
|
+
}, timeout);
|
|
3108
|
+
});
|
|
3109
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
3110
|
+
clearTimeout(timeoutId);
|
|
3111
|
+
});
|
|
3112
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
3113
|
+
};
|
|
3114
|
+
var validateTimeout = ({ timeout }) => {
|
|
3115
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
3116
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
3117
|
+
}
|
|
3118
|
+
};
|
|
3119
|
+
var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
3120
|
+
if (!cleanup || detached) {
|
|
3121
|
+
return timedPromise;
|
|
3122
|
+
}
|
|
3123
|
+
const removeExitHandler = (0, import_signal_exit.default)(() => {
|
|
3124
|
+
spawned.kill();
|
|
3125
|
+
});
|
|
3126
|
+
return timedPromise.finally(() => {
|
|
3127
|
+
removeExitHandler();
|
|
3128
|
+
});
|
|
3129
|
+
};
|
|
3130
|
+
|
|
3131
|
+
// ../../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
|
|
3132
|
+
function isStream(stream2) {
|
|
3133
|
+
return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
|
|
3134
|
+
}
|
|
3135
|
+
function isWritableStream(stream2) {
|
|
3136
|
+
return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stream.js
|
|
3140
|
+
var import_get_stream = __toESM(require_get_stream());
|
|
3141
|
+
var import_merge_stream = __toESM(require_merge_stream());
|
|
3142
|
+
var handleInput = (spawned, input) => {
|
|
3143
|
+
if (input === void 0 || spawned.stdin === void 0) {
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
3146
|
+
if (isStream(input)) {
|
|
3147
|
+
input.pipe(spawned.stdin);
|
|
3148
|
+
} else {
|
|
3149
|
+
spawned.stdin.end(input);
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
var makeAllStream = (spawned, { all }) => {
|
|
3153
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
const mixed = (0, import_merge_stream.default)();
|
|
3157
|
+
if (spawned.stdout) {
|
|
3158
|
+
mixed.add(spawned.stdout);
|
|
3159
|
+
}
|
|
3160
|
+
if (spawned.stderr) {
|
|
3161
|
+
mixed.add(spawned.stderr);
|
|
3162
|
+
}
|
|
3163
|
+
return mixed;
|
|
3164
|
+
};
|
|
3165
|
+
var getBufferedData = async (stream2, streamPromise) => {
|
|
3166
|
+
if (!stream2) {
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
stream2.destroy();
|
|
3170
|
+
try {
|
|
3171
|
+
return await streamPromise;
|
|
3172
|
+
} catch (error) {
|
|
3173
|
+
return error.bufferedData;
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
|
|
3177
|
+
if (!stream2 || !buffer) {
|
|
3178
|
+
return;
|
|
3179
|
+
}
|
|
3180
|
+
if (encoding) {
|
|
3181
|
+
return (0, import_get_stream.default)(stream2, { encoding, maxBuffer });
|
|
3182
|
+
}
|
|
3183
|
+
return import_get_stream.default.buffer(stream2, { maxBuffer });
|
|
3184
|
+
};
|
|
3185
|
+
var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
3186
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
3187
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
|
|
3188
|
+
const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
3189
|
+
try {
|
|
3190
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
3191
|
+
} catch (error) {
|
|
3192
|
+
return Promise.all([
|
|
3193
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
3194
|
+
getBufferedData(stdout, stdoutPromise),
|
|
3195
|
+
getBufferedData(stderr, stderrPromise),
|
|
3196
|
+
getBufferedData(all, allPromise)
|
|
3197
|
+
]);
|
|
3198
|
+
}
|
|
3199
|
+
};
|
|
3200
|
+
|
|
3201
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/promise.js
|
|
3202
|
+
var nativePromisePrototype = (async () => {
|
|
3203
|
+
})().constructor.prototype;
|
|
3204
|
+
var descriptors = ["then", "catch", "finally"].map((property) => [
|
|
3205
|
+
property,
|
|
3206
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
3207
|
+
]);
|
|
3208
|
+
var mergePromise = (spawned, promise) => {
|
|
3209
|
+
for (const [property, descriptor] of descriptors) {
|
|
3210
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
3211
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
3212
|
+
}
|
|
3213
|
+
return spawned;
|
|
3214
|
+
};
|
|
3215
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
|
|
3216
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
3217
|
+
resolve({ exitCode, signal });
|
|
3218
|
+
});
|
|
3219
|
+
spawned.on("error", (error) => {
|
|
3220
|
+
reject(error);
|
|
3221
|
+
});
|
|
3222
|
+
if (spawned.stdin) {
|
|
3223
|
+
spawned.stdin.on("error", (error) => {
|
|
3224
|
+
reject(error);
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
|
|
3229
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/command.js
|
|
3230
|
+
var normalizeArgs = (file, args = []) => {
|
|
3231
|
+
if (!Array.isArray(args)) {
|
|
3232
|
+
return [file];
|
|
3233
|
+
}
|
|
3234
|
+
return [file, ...args];
|
|
3235
|
+
};
|
|
3236
|
+
var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
3237
|
+
var DOUBLE_QUOTES_REGEXP = /"/g;
|
|
3238
|
+
var escapeArg = (arg) => {
|
|
3239
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
3240
|
+
return arg;
|
|
3241
|
+
}
|
|
3242
|
+
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
|
3243
|
+
};
|
|
3244
|
+
var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
3245
|
+
var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
3246
|
+
|
|
3247
|
+
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
|
|
3248
|
+
var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
3249
|
+
var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
3250
|
+
const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
|
|
3251
|
+
if (preferLocal) {
|
|
3252
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
3253
|
+
}
|
|
3254
|
+
return env;
|
|
3255
|
+
};
|
|
3256
|
+
var handleArguments = (file, args, options = {}) => {
|
|
3257
|
+
const parsed = import_cross_spawn.default._parse(file, args, options);
|
|
3258
|
+
file = parsed.command;
|
|
3259
|
+
args = parsed.args;
|
|
3260
|
+
options = parsed.options;
|
|
3261
|
+
options = {
|
|
3262
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
3263
|
+
buffer: true,
|
|
3264
|
+
stripFinalNewline: true,
|
|
3265
|
+
extendEnv: true,
|
|
3266
|
+
preferLocal: false,
|
|
3267
|
+
localDir: options.cwd || process2__default.default.cwd(),
|
|
3268
|
+
execPath: process2__default.default.execPath,
|
|
3269
|
+
encoding: "utf8",
|
|
3270
|
+
reject: true,
|
|
3271
|
+
cleanup: true,
|
|
3272
|
+
all: false,
|
|
3273
|
+
windowsHide: true,
|
|
3274
|
+
...options
|
|
3275
|
+
};
|
|
3276
|
+
options.env = getEnv(options);
|
|
3277
|
+
options.stdio = normalizeStdio(options);
|
|
3278
|
+
if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
|
|
3279
|
+
args.unshift("/q");
|
|
3280
|
+
}
|
|
3281
|
+
return { file, args, options, parsed };
|
|
3282
|
+
};
|
|
3283
|
+
var handleOutput = (options, value, error) => {
|
|
3284
|
+
if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
|
|
3285
|
+
return error === void 0 ? void 0 : "";
|
|
3286
|
+
}
|
|
3287
|
+
if (options.stripFinalNewline) {
|
|
3288
|
+
return stripFinalNewline(value);
|
|
3289
|
+
}
|
|
3290
|
+
return value;
|
|
3291
|
+
};
|
|
3292
|
+
function execa(file, args, options) {
|
|
3293
|
+
const parsed = handleArguments(file, args, options);
|
|
3294
|
+
const command = joinCommand(file, args);
|
|
3295
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
3296
|
+
validateTimeout(parsed.options);
|
|
3297
|
+
let spawned;
|
|
3298
|
+
try {
|
|
3299
|
+
spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
3300
|
+
} catch (error) {
|
|
3301
|
+
const dummySpawned = new childProcess2__default.default.ChildProcess();
|
|
3302
|
+
const errorPromise = Promise.reject(makeError({
|
|
3303
|
+
error,
|
|
3304
|
+
stdout: "",
|
|
3305
|
+
stderr: "",
|
|
3306
|
+
all: "",
|
|
3307
|
+
command,
|
|
3308
|
+
escapedCommand,
|
|
3309
|
+
parsed,
|
|
3310
|
+
timedOut: false,
|
|
3311
|
+
isCanceled: false,
|
|
3312
|
+
killed: false
|
|
3313
|
+
}));
|
|
3314
|
+
return mergePromise(dummySpawned, errorPromise);
|
|
3315
|
+
}
|
|
3316
|
+
const spawnedPromise = getSpawnedPromise(spawned);
|
|
3317
|
+
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
3318
|
+
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
3319
|
+
const context = { isCanceled: false };
|
|
3320
|
+
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
3321
|
+
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
3322
|
+
const handlePromise = async () => {
|
|
3323
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
3324
|
+
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
3325
|
+
const stderr = handleOutput(parsed.options, stderrResult);
|
|
3326
|
+
const all = handleOutput(parsed.options, allResult);
|
|
3327
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
3328
|
+
const returnedError = makeError({
|
|
3329
|
+
error,
|
|
3330
|
+
exitCode,
|
|
3331
|
+
signal,
|
|
3332
|
+
stdout,
|
|
3333
|
+
stderr,
|
|
3334
|
+
all,
|
|
3335
|
+
command,
|
|
3336
|
+
escapedCommand,
|
|
3337
|
+
parsed,
|
|
3338
|
+
timedOut,
|
|
3339
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
3340
|
+
killed: spawned.killed
|
|
3341
|
+
});
|
|
3342
|
+
if (!parsed.options.reject) {
|
|
3343
|
+
return returnedError;
|
|
3344
|
+
}
|
|
3345
|
+
throw returnedError;
|
|
3346
|
+
}
|
|
3347
|
+
return {
|
|
3348
|
+
command,
|
|
3349
|
+
escapedCommand,
|
|
3350
|
+
exitCode: 0,
|
|
3351
|
+
stdout,
|
|
3352
|
+
stderr,
|
|
3353
|
+
all,
|
|
3354
|
+
failed: false,
|
|
3355
|
+
timedOut: false,
|
|
3356
|
+
isCanceled: false,
|
|
3357
|
+
killed: false
|
|
3358
|
+
};
|
|
3359
|
+
};
|
|
3360
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
3361
|
+
handleInput(spawned, parsed.options.input);
|
|
3362
|
+
spawned.all = makeAllStream(spawned, parsed.options);
|
|
3363
|
+
return mergePromise(spawned, handlePromiseOnce);
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
// ../../node_modules/.pnpm/taskkill@5.0.0/node_modules/taskkill/index.js
|
|
3367
|
+
function parseArgs(input, options) {
|
|
3368
|
+
if (process2__default.default.platform !== "win32") {
|
|
3369
|
+
throw new Error("Windows only");
|
|
3370
|
+
}
|
|
3371
|
+
input = [input].flat();
|
|
3372
|
+
if (input.length === 0) {
|
|
3373
|
+
throw new Error("PID or image name required");
|
|
3374
|
+
}
|
|
3375
|
+
const arguments_ = [];
|
|
3376
|
+
if (options.system && options.username && options.password) {
|
|
3377
|
+
arguments_.push("/s", options.system, "/u", options.username, "/p", options.password);
|
|
3378
|
+
}
|
|
3379
|
+
if (options.filter) {
|
|
3380
|
+
arguments_.push("/fi", options.filter);
|
|
3381
|
+
}
|
|
3382
|
+
if (options.force) {
|
|
3383
|
+
arguments_.push("/f");
|
|
3384
|
+
}
|
|
3385
|
+
if (options.tree) {
|
|
3386
|
+
arguments_.push("/t");
|
|
3387
|
+
}
|
|
3388
|
+
for (const element of input) {
|
|
3389
|
+
arguments_.push(typeof element === "number" ? "/pid" : "/im", element);
|
|
3390
|
+
}
|
|
3391
|
+
return arguments_;
|
|
3392
|
+
}
|
|
3393
|
+
async function taskkill(input, options = {}) {
|
|
3394
|
+
await execa("taskkill", parseArgs(input, options));
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
3398
|
+
var import_cross_spawn2 = __toESM(require_cross_spawn());
|
|
3399
|
+
|
|
3400
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
|
|
3401
|
+
var getRealtimeSignals2 = () => {
|
|
3402
|
+
const length = SIGRTMAX2 - SIGRTMIN2 + 1;
|
|
3403
|
+
return Array.from({ length }, getRealtimeSignal2);
|
|
3404
|
+
};
|
|
3405
|
+
var getRealtimeSignal2 = (value, index) => ({
|
|
3406
|
+
name: `SIGRT${index + 1}`,
|
|
3407
|
+
number: SIGRTMIN2 + index,
|
|
3408
|
+
action: "terminate",
|
|
3409
|
+
description: "Application-specific signal (realtime)",
|
|
3410
|
+
standard: "posix"
|
|
3411
|
+
});
|
|
3412
|
+
var SIGRTMIN2 = 34;
|
|
3413
|
+
var SIGRTMAX2 = 64;
|
|
3414
|
+
|
|
3415
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
|
|
3416
|
+
var SIGNALS2 = [
|
|
3417
|
+
{
|
|
3418
|
+
name: "SIGHUP",
|
|
3419
|
+
number: 1,
|
|
3420
|
+
action: "terminate",
|
|
3421
|
+
description: "Terminal closed",
|
|
3422
|
+
standard: "posix"
|
|
3423
|
+
},
|
|
3424
|
+
{
|
|
3425
|
+
name: "SIGINT",
|
|
3426
|
+
number: 2,
|
|
3427
|
+
action: "terminate",
|
|
3428
|
+
description: "User interruption with CTRL-C",
|
|
3429
|
+
standard: "ansi"
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
name: "SIGQUIT",
|
|
3433
|
+
number: 3,
|
|
3434
|
+
action: "core",
|
|
3435
|
+
description: "User interruption with CTRL-\\",
|
|
3436
|
+
standard: "posix"
|
|
3437
|
+
},
|
|
3438
|
+
{
|
|
3439
|
+
name: "SIGILL",
|
|
3440
|
+
number: 4,
|
|
3441
|
+
action: "core",
|
|
3442
|
+
description: "Invalid machine instruction",
|
|
3443
|
+
standard: "ansi"
|
|
3444
|
+
},
|
|
3445
|
+
{
|
|
3446
|
+
name: "SIGTRAP",
|
|
3447
|
+
number: 5,
|
|
3448
|
+
action: "core",
|
|
3449
|
+
description: "Debugger breakpoint",
|
|
3450
|
+
standard: "posix"
|
|
3451
|
+
},
|
|
3452
|
+
{
|
|
3453
|
+
name: "SIGABRT",
|
|
3454
|
+
number: 6,
|
|
3455
|
+
action: "core",
|
|
3456
|
+
description: "Aborted",
|
|
3457
|
+
standard: "ansi"
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
name: "SIGIOT",
|
|
3461
|
+
number: 6,
|
|
3462
|
+
action: "core",
|
|
3463
|
+
description: "Aborted",
|
|
3464
|
+
standard: "bsd"
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
name: "SIGBUS",
|
|
3468
|
+
number: 7,
|
|
3469
|
+
action: "core",
|
|
3470
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
3471
|
+
standard: "bsd"
|
|
3472
|
+
},
|
|
3473
|
+
{
|
|
3474
|
+
name: "SIGEMT",
|
|
3475
|
+
number: 7,
|
|
3476
|
+
action: "terminate",
|
|
3477
|
+
description: "Command should be emulated but is not implemented",
|
|
3478
|
+
standard: "other"
|
|
3479
|
+
},
|
|
3480
|
+
{
|
|
3481
|
+
name: "SIGFPE",
|
|
3482
|
+
number: 8,
|
|
3483
|
+
action: "core",
|
|
3484
|
+
description: "Floating point arithmetic error",
|
|
3485
|
+
standard: "ansi"
|
|
3486
|
+
},
|
|
3487
|
+
{
|
|
3488
|
+
name: "SIGKILL",
|
|
3489
|
+
number: 9,
|
|
3490
|
+
action: "terminate",
|
|
3491
|
+
description: "Forced termination",
|
|
3492
|
+
standard: "posix",
|
|
3493
|
+
forced: true
|
|
3494
|
+
},
|
|
3495
|
+
{
|
|
3496
|
+
name: "SIGUSR1",
|
|
3497
|
+
number: 10,
|
|
3498
|
+
action: "terminate",
|
|
3499
|
+
description: "Application-specific signal",
|
|
3500
|
+
standard: "posix"
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
name: "SIGSEGV",
|
|
3504
|
+
number: 11,
|
|
3505
|
+
action: "core",
|
|
3506
|
+
description: "Segmentation fault",
|
|
3507
|
+
standard: "ansi"
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
name: "SIGUSR2",
|
|
3511
|
+
number: 12,
|
|
3512
|
+
action: "terminate",
|
|
3513
|
+
description: "Application-specific signal",
|
|
3514
|
+
standard: "posix"
|
|
3515
|
+
},
|
|
3516
|
+
{
|
|
3517
|
+
name: "SIGPIPE",
|
|
3518
|
+
number: 13,
|
|
3519
|
+
action: "terminate",
|
|
3520
|
+
description: "Broken pipe or socket",
|
|
3521
|
+
standard: "posix"
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
name: "SIGALRM",
|
|
3525
|
+
number: 14,
|
|
3526
|
+
action: "terminate",
|
|
3527
|
+
description: "Timeout or timer",
|
|
3528
|
+
standard: "posix"
|
|
3529
|
+
},
|
|
3530
|
+
{
|
|
3531
|
+
name: "SIGTERM",
|
|
3532
|
+
number: 15,
|
|
3533
|
+
action: "terminate",
|
|
3534
|
+
description: "Termination",
|
|
3535
|
+
standard: "ansi"
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
name: "SIGSTKFLT",
|
|
3539
|
+
number: 16,
|
|
3540
|
+
action: "terminate",
|
|
3541
|
+
description: "Stack is empty or overflowed",
|
|
3542
|
+
standard: "other"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
name: "SIGCHLD",
|
|
3546
|
+
number: 17,
|
|
3547
|
+
action: "ignore",
|
|
3548
|
+
description: "Child process terminated, paused or unpaused",
|
|
3549
|
+
standard: "posix"
|
|
3550
|
+
},
|
|
3551
|
+
{
|
|
3552
|
+
name: "SIGCLD",
|
|
3553
|
+
number: 17,
|
|
3554
|
+
action: "ignore",
|
|
3555
|
+
description: "Child process terminated, paused or unpaused",
|
|
3556
|
+
standard: "other"
|
|
3557
|
+
},
|
|
3558
|
+
{
|
|
3559
|
+
name: "SIGCONT",
|
|
3560
|
+
number: 18,
|
|
3561
|
+
action: "unpause",
|
|
3562
|
+
description: "Unpaused",
|
|
3563
|
+
standard: "posix",
|
|
3564
|
+
forced: true
|
|
3565
|
+
},
|
|
3566
|
+
{
|
|
3567
|
+
name: "SIGSTOP",
|
|
3568
|
+
number: 19,
|
|
3569
|
+
action: "pause",
|
|
3570
|
+
description: "Paused",
|
|
3571
|
+
standard: "posix",
|
|
3572
|
+
forced: true
|
|
3573
|
+
},
|
|
3574
|
+
{
|
|
3575
|
+
name: "SIGTSTP",
|
|
3576
|
+
number: 20,
|
|
3577
|
+
action: "pause",
|
|
3578
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
3579
|
+
standard: "posix"
|
|
3580
|
+
},
|
|
3581
|
+
{
|
|
3582
|
+
name: "SIGTTIN",
|
|
3583
|
+
number: 21,
|
|
3584
|
+
action: "pause",
|
|
3585
|
+
description: "Background process cannot read terminal input",
|
|
3586
|
+
standard: "posix"
|
|
3587
|
+
},
|
|
3588
|
+
{
|
|
3589
|
+
name: "SIGBREAK",
|
|
3590
|
+
number: 21,
|
|
3591
|
+
action: "terminate",
|
|
3592
|
+
description: "User interruption with CTRL-BREAK",
|
|
3593
|
+
standard: "other"
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
name: "SIGTTOU",
|
|
3597
|
+
number: 22,
|
|
3598
|
+
action: "pause",
|
|
3599
|
+
description: "Background process cannot write to terminal output",
|
|
3600
|
+
standard: "posix"
|
|
3601
|
+
},
|
|
3602
|
+
{
|
|
3603
|
+
name: "SIGURG",
|
|
3604
|
+
number: 23,
|
|
3605
|
+
action: "ignore",
|
|
3606
|
+
description: "Socket received out-of-band data",
|
|
3607
|
+
standard: "bsd"
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
name: "SIGXCPU",
|
|
3611
|
+
number: 24,
|
|
3612
|
+
action: "core",
|
|
3613
|
+
description: "Process timed out",
|
|
3614
|
+
standard: "bsd"
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
name: "SIGXFSZ",
|
|
3618
|
+
number: 25,
|
|
3619
|
+
action: "core",
|
|
3620
|
+
description: "File too big",
|
|
3621
|
+
standard: "bsd"
|
|
3622
|
+
},
|
|
3623
|
+
{
|
|
3624
|
+
name: "SIGVTALRM",
|
|
3625
|
+
number: 26,
|
|
3626
|
+
action: "terminate",
|
|
3627
|
+
description: "Timeout or timer",
|
|
3628
|
+
standard: "bsd"
|
|
3629
|
+
},
|
|
3630
|
+
{
|
|
3631
|
+
name: "SIGPROF",
|
|
3632
|
+
number: 27,
|
|
3633
|
+
action: "terminate",
|
|
3634
|
+
description: "Timeout or timer",
|
|
3635
|
+
standard: "bsd"
|
|
3636
|
+
},
|
|
3637
|
+
{
|
|
3638
|
+
name: "SIGWINCH",
|
|
3639
|
+
number: 28,
|
|
3640
|
+
action: "ignore",
|
|
3641
|
+
description: "Terminal window size changed",
|
|
3642
|
+
standard: "bsd"
|
|
3643
|
+
},
|
|
3644
|
+
{
|
|
3645
|
+
name: "SIGIO",
|
|
3646
|
+
number: 29,
|
|
3647
|
+
action: "terminate",
|
|
3648
|
+
description: "I/O is available",
|
|
3649
|
+
standard: "other"
|
|
3650
|
+
},
|
|
3651
|
+
{
|
|
3652
|
+
name: "SIGPOLL",
|
|
3653
|
+
number: 29,
|
|
3654
|
+
action: "terminate",
|
|
3655
|
+
description: "Watched event",
|
|
3656
|
+
standard: "other"
|
|
3657
|
+
},
|
|
3658
|
+
{
|
|
3659
|
+
name: "SIGINFO",
|
|
3660
|
+
number: 29,
|
|
3661
|
+
action: "ignore",
|
|
3662
|
+
description: "Request for process information",
|
|
3663
|
+
standard: "other"
|
|
3664
|
+
},
|
|
3665
|
+
{
|
|
3666
|
+
name: "SIGPWR",
|
|
3667
|
+
number: 30,
|
|
3668
|
+
action: "terminate",
|
|
3669
|
+
description: "Device running out of power",
|
|
3670
|
+
standard: "systemv"
|
|
3671
|
+
},
|
|
3672
|
+
{
|
|
3673
|
+
name: "SIGSYS",
|
|
3674
|
+
number: 31,
|
|
3675
|
+
action: "core",
|
|
3676
|
+
description: "Invalid system call",
|
|
3677
|
+
standard: "other"
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
name: "SIGUNUSED",
|
|
3681
|
+
number: 31,
|
|
3682
|
+
action: "terminate",
|
|
3683
|
+
description: "Invalid system call",
|
|
3684
|
+
standard: "other"
|
|
3685
|
+
}
|
|
3686
|
+
];
|
|
3687
|
+
|
|
3688
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
|
|
3689
|
+
var getSignals2 = () => {
|
|
3690
|
+
const realtimeSignals = getRealtimeSignals2();
|
|
3691
|
+
const signals2 = [...SIGNALS2, ...realtimeSignals].map(normalizeSignal2);
|
|
3692
|
+
return signals2;
|
|
3693
|
+
};
|
|
3694
|
+
var normalizeSignal2 = ({
|
|
3695
|
+
name,
|
|
3696
|
+
number: defaultNumber,
|
|
3697
|
+
description,
|
|
3698
|
+
action,
|
|
3699
|
+
forced = false,
|
|
3700
|
+
standard
|
|
3701
|
+
}) => {
|
|
3702
|
+
const {
|
|
3703
|
+
signals: { [name]: constantSignal }
|
|
3704
|
+
} = os.constants;
|
|
3705
|
+
const supported = constantSignal !== void 0;
|
|
3706
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
3707
|
+
return { name, number, description, supported, action, forced, standard };
|
|
3708
|
+
};
|
|
3709
|
+
|
|
3710
|
+
// ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
|
|
3711
|
+
var getSignalsByName2 = () => {
|
|
3712
|
+
const signals2 = getSignals2();
|
|
3713
|
+
return Object.fromEntries(signals2.map(getSignalByName2));
|
|
3714
|
+
};
|
|
3715
|
+
var getSignalByName2 = ({
|
|
3716
|
+
name,
|
|
3717
|
+
number,
|
|
3718
|
+
description,
|
|
3719
|
+
supported,
|
|
3720
|
+
action,
|
|
3721
|
+
forced,
|
|
3722
|
+
standard
|
|
3723
|
+
}) => [name, { name, number, description, supported, action, forced, standard }];
|
|
3724
|
+
var signalsByName2 = getSignalsByName2();
|
|
3725
|
+
var getSignalsByNumber2 = () => {
|
|
3726
|
+
const signals2 = getSignals2();
|
|
3727
|
+
const length = SIGRTMAX2 + 1;
|
|
3728
|
+
const signalsA = Array.from(
|
|
3729
|
+
{ length },
|
|
3730
|
+
(value, number) => getSignalByNumber2(number, signals2)
|
|
3731
|
+
);
|
|
3732
|
+
return Object.assign({}, ...signalsA);
|
|
3733
|
+
};
|
|
3734
|
+
var getSignalByNumber2 = (number, signals2) => {
|
|
3735
|
+
const signal = findSignalByNumber2(number, signals2);
|
|
3736
|
+
if (signal === void 0) {
|
|
3737
|
+
return {};
|
|
3738
|
+
}
|
|
3739
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
3740
|
+
return {
|
|
3741
|
+
[number]: {
|
|
3742
|
+
name,
|
|
3743
|
+
number,
|
|
3744
|
+
description,
|
|
3745
|
+
supported,
|
|
3746
|
+
action,
|
|
3747
|
+
forced,
|
|
3748
|
+
standard
|
|
3749
|
+
}
|
|
3750
|
+
};
|
|
3751
|
+
};
|
|
3752
|
+
var findSignalByNumber2 = (number, signals2) => {
|
|
3753
|
+
const signal = signals2.find(({ name }) => os.constants.signals[name] === number);
|
|
3754
|
+
if (signal !== void 0) {
|
|
3755
|
+
return signal;
|
|
3756
|
+
}
|
|
3757
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
3758
|
+
};
|
|
3759
|
+
getSignalsByNumber2();
|
|
3760
|
+
|
|
3761
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
|
|
3762
|
+
var getErrorPrefix2 = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
3763
|
+
if (timedOut) {
|
|
3764
|
+
return `timed out after ${timeout} milliseconds`;
|
|
3765
|
+
}
|
|
3766
|
+
if (isCanceled) {
|
|
3767
|
+
return "was canceled";
|
|
3768
|
+
}
|
|
3769
|
+
if (errorCode !== void 0) {
|
|
3770
|
+
return `failed with ${errorCode}`;
|
|
3771
|
+
}
|
|
3772
|
+
if (signal !== void 0) {
|
|
3773
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
3774
|
+
}
|
|
3775
|
+
if (exitCode !== void 0) {
|
|
3776
|
+
return `failed with exit code ${exitCode}`;
|
|
3777
|
+
}
|
|
3778
|
+
return "failed";
|
|
3779
|
+
};
|
|
3780
|
+
var makeError2 = ({
|
|
3781
|
+
stdout,
|
|
3782
|
+
stderr,
|
|
3783
|
+
all,
|
|
3784
|
+
error,
|
|
3785
|
+
signal,
|
|
3786
|
+
exitCode,
|
|
3787
|
+
command,
|
|
3788
|
+
escapedCommand,
|
|
3789
|
+
timedOut,
|
|
3790
|
+
isCanceled,
|
|
3791
|
+
killed,
|
|
3792
|
+
parsed: { options: { timeout, cwd = process2__default.default.cwd() } }
|
|
3793
|
+
}) => {
|
|
3794
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
3795
|
+
signal = signal === null ? void 0 : signal;
|
|
3796
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName2[signal].description;
|
|
3797
|
+
const errorCode = error && error.code;
|
|
3798
|
+
const prefix = getErrorPrefix2({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
3799
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
3800
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
3801
|
+
const shortMessage = isError ? `${execaMessage}
|
|
3802
|
+
${error.message}` : execaMessage;
|
|
3803
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
3804
|
+
if (isError) {
|
|
3805
|
+
error.originalMessage = error.message;
|
|
3806
|
+
error.message = message;
|
|
3807
|
+
} else {
|
|
3808
|
+
error = new Error(message);
|
|
3809
|
+
}
|
|
3810
|
+
error.shortMessage = shortMessage;
|
|
3811
|
+
error.command = command;
|
|
3812
|
+
error.escapedCommand = escapedCommand;
|
|
3813
|
+
error.exitCode = exitCode;
|
|
3814
|
+
error.signal = signal;
|
|
3815
|
+
error.signalDescription = signalDescription;
|
|
3816
|
+
error.stdout = stdout;
|
|
3817
|
+
error.stderr = stderr;
|
|
3818
|
+
error.cwd = cwd;
|
|
3819
|
+
if (all !== void 0) {
|
|
3820
|
+
error.all = all;
|
|
3821
|
+
}
|
|
3822
|
+
if ("bufferedData" in error) {
|
|
3823
|
+
delete error.bufferedData;
|
|
3824
|
+
}
|
|
3825
|
+
error.failed = true;
|
|
3826
|
+
error.timedOut = Boolean(timedOut);
|
|
3827
|
+
error.isCanceled = isCanceled;
|
|
3828
|
+
error.killed = killed && !timedOut;
|
|
3829
|
+
return error;
|
|
3830
|
+
};
|
|
3831
|
+
|
|
3832
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
|
|
3833
|
+
var aliases2 = ["stdin", "stdout", "stderr"];
|
|
3834
|
+
var hasAlias2 = (options) => aliases2.some((alias) => options[alias] !== void 0);
|
|
3835
|
+
var normalizeStdio2 = (options) => {
|
|
3836
|
+
if (!options) {
|
|
3837
|
+
return;
|
|
3838
|
+
}
|
|
3839
|
+
const { stdio } = options;
|
|
3840
|
+
if (stdio === void 0) {
|
|
3841
|
+
return aliases2.map((alias) => options[alias]);
|
|
3842
|
+
}
|
|
3843
|
+
if (hasAlias2(options)) {
|
|
3844
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases2.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
3845
|
+
}
|
|
3846
|
+
if (typeof stdio === "string") {
|
|
3847
|
+
return stdio;
|
|
3848
|
+
}
|
|
3849
|
+
if (!Array.isArray(stdio)) {
|
|
3850
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
3851
|
+
}
|
|
3852
|
+
const length = Math.max(stdio.length, aliases2.length);
|
|
3853
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
3854
|
+
};
|
|
3855
|
+
|
|
3856
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
3857
|
+
var signals = [];
|
|
3858
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
3859
|
+
if (process.platform !== "win32") {
|
|
3860
|
+
signals.push(
|
|
3861
|
+
"SIGALRM",
|
|
3862
|
+
"SIGABRT",
|
|
3863
|
+
"SIGVTALRM",
|
|
3864
|
+
"SIGXCPU",
|
|
3865
|
+
"SIGXFSZ",
|
|
3866
|
+
"SIGUSR2",
|
|
3867
|
+
"SIGTRAP",
|
|
3868
|
+
"SIGSYS",
|
|
3869
|
+
"SIGQUIT",
|
|
3870
|
+
"SIGIOT"
|
|
3871
|
+
// should detect profiler and enable/disable accordingly.
|
|
3872
|
+
// see #21
|
|
3873
|
+
// 'SIGPROF'
|
|
3874
|
+
);
|
|
3875
|
+
}
|
|
3876
|
+
if (process.platform === "linux") {
|
|
3877
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
// ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
3881
|
+
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";
|
|
3882
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
3883
|
+
var global2 = globalThis;
|
|
3884
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
3885
|
+
var Emitter = class {
|
|
3886
|
+
emitted = {
|
|
3887
|
+
afterExit: false,
|
|
3888
|
+
exit: false
|
|
3889
|
+
};
|
|
3890
|
+
listeners = {
|
|
3891
|
+
afterExit: [],
|
|
3892
|
+
exit: []
|
|
3893
|
+
};
|
|
3894
|
+
count = 0;
|
|
3895
|
+
id = Math.random();
|
|
3896
|
+
constructor() {
|
|
3897
|
+
if (global2[kExitEmitter]) {
|
|
3898
|
+
return global2[kExitEmitter];
|
|
3899
|
+
}
|
|
3900
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
3901
|
+
value: this,
|
|
3902
|
+
writable: false,
|
|
3903
|
+
enumerable: false,
|
|
3904
|
+
configurable: false
|
|
3905
|
+
});
|
|
3906
|
+
}
|
|
3907
|
+
on(ev, fn) {
|
|
3908
|
+
this.listeners[ev].push(fn);
|
|
3909
|
+
}
|
|
3910
|
+
removeListener(ev, fn) {
|
|
3911
|
+
const list = this.listeners[ev];
|
|
3912
|
+
const i = list.indexOf(fn);
|
|
3913
|
+
if (i === -1) {
|
|
3914
|
+
return;
|
|
3915
|
+
}
|
|
3916
|
+
if (i === 0 && list.length === 1) {
|
|
3917
|
+
list.length = 0;
|
|
3918
|
+
} else {
|
|
3919
|
+
list.splice(i, 1);
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
emit(ev, code, signal) {
|
|
3923
|
+
if (this.emitted[ev]) {
|
|
3924
|
+
return false;
|
|
3925
|
+
}
|
|
3926
|
+
this.emitted[ev] = true;
|
|
3927
|
+
let ret = false;
|
|
3928
|
+
for (const fn of this.listeners[ev]) {
|
|
3929
|
+
ret = fn(code, signal) === true || ret;
|
|
3930
|
+
}
|
|
3931
|
+
if (ev === "exit") {
|
|
3932
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
3933
|
+
}
|
|
3934
|
+
return ret;
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
var SignalExitBase = class {
|
|
3938
|
+
};
|
|
3939
|
+
var signalExitWrap = (handler) => {
|
|
3940
|
+
return {
|
|
3941
|
+
onExit(cb, opts) {
|
|
3942
|
+
return handler.onExit(cb, opts);
|
|
3943
|
+
},
|
|
3944
|
+
load() {
|
|
3945
|
+
return handler.load();
|
|
3946
|
+
},
|
|
3947
|
+
unload() {
|
|
3948
|
+
return handler.unload();
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3951
|
+
};
|
|
3952
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
3953
|
+
onExit() {
|
|
3954
|
+
return () => {
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
load() {
|
|
3958
|
+
}
|
|
3959
|
+
unload() {
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
var SignalExit = class extends SignalExitBase {
|
|
3963
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
3964
|
+
// so use a supported signal instead
|
|
3965
|
+
/* c8 ignore start */
|
|
3966
|
+
#hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
3967
|
+
/* c8 ignore stop */
|
|
3968
|
+
#emitter = new Emitter();
|
|
3969
|
+
#process;
|
|
3970
|
+
#originalProcessEmit;
|
|
3971
|
+
#originalProcessReallyExit;
|
|
3972
|
+
#sigListeners = {};
|
|
3973
|
+
#loaded = false;
|
|
3974
|
+
constructor(process13) {
|
|
3975
|
+
super();
|
|
3976
|
+
this.#process = process13;
|
|
3977
|
+
this.#sigListeners = {};
|
|
3978
|
+
for (const sig of signals) {
|
|
3979
|
+
this.#sigListeners[sig] = () => {
|
|
3980
|
+
const listeners = this.#process.listeners(sig);
|
|
3981
|
+
let { count } = this.#emitter;
|
|
3982
|
+
const p = process13;
|
|
3983
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
3984
|
+
count += p.__signal_exit_emitter__.count;
|
|
3985
|
+
}
|
|
3986
|
+
if (listeners.length === count) {
|
|
3987
|
+
this.unload();
|
|
3988
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
3989
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
3990
|
+
if (!ret)
|
|
3991
|
+
process13.kill(process13.pid, s);
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3994
|
+
}
|
|
3995
|
+
this.#originalProcessReallyExit = process13.reallyExit;
|
|
3996
|
+
this.#originalProcessEmit = process13.emit;
|
|
3997
|
+
}
|
|
3998
|
+
onExit(cb, opts) {
|
|
3999
|
+
if (!processOk(this.#process)) {
|
|
4000
|
+
return () => {
|
|
4001
|
+
};
|
|
4002
|
+
}
|
|
4003
|
+
if (this.#loaded === false) {
|
|
4004
|
+
this.load();
|
|
4005
|
+
}
|
|
4006
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
4007
|
+
this.#emitter.on(ev, cb);
|
|
4008
|
+
return () => {
|
|
4009
|
+
this.#emitter.removeListener(ev, cb);
|
|
4010
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
4011
|
+
this.unload();
|
|
4012
|
+
}
|
|
4013
|
+
};
|
|
4014
|
+
}
|
|
4015
|
+
load() {
|
|
4016
|
+
if (this.#loaded) {
|
|
4017
|
+
return;
|
|
4018
|
+
}
|
|
4019
|
+
this.#loaded = true;
|
|
4020
|
+
this.#emitter.count += 1;
|
|
4021
|
+
for (const sig of signals) {
|
|
4022
|
+
try {
|
|
4023
|
+
const fn = this.#sigListeners[sig];
|
|
4024
|
+
if (fn)
|
|
4025
|
+
this.#process.on(sig, fn);
|
|
4026
|
+
} catch (_) {
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
this.#process.emit = (ev, ...a) => {
|
|
4030
|
+
return this.#processEmit(ev, ...a);
|
|
4031
|
+
};
|
|
4032
|
+
this.#process.reallyExit = (code) => {
|
|
4033
|
+
return this.#processReallyExit(code);
|
|
4034
|
+
};
|
|
4035
|
+
}
|
|
4036
|
+
unload() {
|
|
4037
|
+
if (!this.#loaded) {
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
4040
|
+
this.#loaded = false;
|
|
4041
|
+
signals.forEach((sig) => {
|
|
4042
|
+
const listener = this.#sigListeners[sig];
|
|
4043
|
+
if (!listener) {
|
|
4044
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
4045
|
+
}
|
|
4046
|
+
try {
|
|
4047
|
+
this.#process.removeListener(sig, listener);
|
|
4048
|
+
} catch (_) {
|
|
4049
|
+
}
|
|
4050
|
+
});
|
|
4051
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
4052
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
4053
|
+
this.#emitter.count -= 1;
|
|
4054
|
+
}
|
|
4055
|
+
#processReallyExit(code) {
|
|
4056
|
+
if (!processOk(this.#process)) {
|
|
4057
|
+
return 0;
|
|
4058
|
+
}
|
|
4059
|
+
this.#process.exitCode = code || 0;
|
|
4060
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4061
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
4062
|
+
}
|
|
4063
|
+
#processEmit(ev, ...args) {
|
|
4064
|
+
const og = this.#originalProcessEmit;
|
|
4065
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
4066
|
+
if (typeof args[0] === "number") {
|
|
4067
|
+
this.#process.exitCode = args[0];
|
|
4068
|
+
}
|
|
4069
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
4070
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
4071
|
+
return ret;
|
|
4072
|
+
} else {
|
|
4073
|
+
return og.call(this.#process, ev, ...args);
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
};
|
|
4077
|
+
var process6 = globalThis.process;
|
|
4078
|
+
var {
|
|
4079
|
+
/**
|
|
4080
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
4081
|
+
* exit, or running out of stuff to do.
|
|
4082
|
+
*
|
|
4083
|
+
* If the global process object is not suitable for instrumentation,
|
|
4084
|
+
* then this will be a no-op.
|
|
4085
|
+
*
|
|
4086
|
+
* Returns a function that may be used to unload signal-exit.
|
|
4087
|
+
*/
|
|
4088
|
+
onExit: onExit2} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback());
|
|
4089
|
+
|
|
4090
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
|
|
4091
|
+
var DEFAULT_FORCE_KILL_TIMEOUT2 = 1e3 * 5;
|
|
4092
|
+
var spawnedKill2 = (kill2, signal = "SIGTERM", options = {}) => {
|
|
4093
|
+
const killResult = kill2(signal);
|
|
4094
|
+
setKillTimeout2(kill2, signal, options, killResult);
|
|
4095
|
+
return killResult;
|
|
4096
|
+
};
|
|
4097
|
+
var setKillTimeout2 = (kill2, signal, options, killResult) => {
|
|
4098
|
+
if (!shouldForceKill2(signal, options, killResult)) {
|
|
4099
|
+
return;
|
|
4100
|
+
}
|
|
4101
|
+
const timeout = getForceKillAfterTimeout2(options);
|
|
4102
|
+
const t = setTimeout(() => {
|
|
4103
|
+
kill2("SIGKILL");
|
|
4104
|
+
}, timeout);
|
|
4105
|
+
if (t.unref) {
|
|
4106
|
+
t.unref();
|
|
4107
|
+
}
|
|
4108
|
+
};
|
|
4109
|
+
var shouldForceKill2 = (signal, { forceKillAfterTimeout }, killResult) => isSigterm2(signal) && forceKillAfterTimeout !== false && killResult;
|
|
4110
|
+
var isSigterm2 = (signal) => signal === os__default.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
4111
|
+
var getForceKillAfterTimeout2 = ({ forceKillAfterTimeout = true }) => {
|
|
4112
|
+
if (forceKillAfterTimeout === true) {
|
|
4113
|
+
return DEFAULT_FORCE_KILL_TIMEOUT2;
|
|
4114
|
+
}
|
|
4115
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
4116
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
4117
|
+
}
|
|
4118
|
+
return forceKillAfterTimeout;
|
|
4119
|
+
};
|
|
4120
|
+
var spawnedCancel2 = (spawned, context) => {
|
|
4121
|
+
const killResult = spawned.kill();
|
|
4122
|
+
if (killResult) {
|
|
4123
|
+
context.isCanceled = true;
|
|
4124
|
+
}
|
|
4125
|
+
};
|
|
4126
|
+
var timeoutKill2 = (spawned, signal, reject) => {
|
|
4127
|
+
spawned.kill(signal);
|
|
4128
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
4129
|
+
};
|
|
4130
|
+
var setupTimeout2 = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
4131
|
+
if (timeout === 0 || timeout === void 0) {
|
|
4132
|
+
return spawnedPromise;
|
|
4133
|
+
}
|
|
4134
|
+
let timeoutId;
|
|
4135
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
4136
|
+
timeoutId = setTimeout(() => {
|
|
4137
|
+
timeoutKill2(spawned, killSignal, reject);
|
|
4138
|
+
}, timeout);
|
|
4139
|
+
});
|
|
4140
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
4141
|
+
clearTimeout(timeoutId);
|
|
4142
|
+
});
|
|
4143
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
4144
|
+
};
|
|
4145
|
+
var validateTimeout2 = ({ timeout }) => {
|
|
4146
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
4147
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
4148
|
+
}
|
|
4149
|
+
};
|
|
4150
|
+
var setExitHandler2 = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
4151
|
+
if (!cleanup || detached) {
|
|
4152
|
+
return timedPromise;
|
|
4153
|
+
}
|
|
4154
|
+
const removeExitHandler = onExit2(() => {
|
|
4155
|
+
spawned.kill();
|
|
4156
|
+
});
|
|
4157
|
+
return timedPromise.finally(() => {
|
|
4158
|
+
removeExitHandler();
|
|
4159
|
+
});
|
|
4160
|
+
};
|
|
4161
|
+
var isExecaChildProcess = (target) => target instanceof childProcess2.ChildProcess && typeof target.then === "function";
|
|
4162
|
+
var pipeToTarget = (spawned, streamName, target) => {
|
|
4163
|
+
if (typeof target === "string") {
|
|
4164
|
+
spawned[streamName].pipe(fs.createWriteStream(target));
|
|
4165
|
+
return spawned;
|
|
4166
|
+
}
|
|
4167
|
+
if (isWritableStream(target)) {
|
|
4168
|
+
spawned[streamName].pipe(target);
|
|
4169
|
+
return spawned;
|
|
4170
|
+
}
|
|
4171
|
+
if (!isExecaChildProcess(target)) {
|
|
4172
|
+
throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
|
|
4173
|
+
}
|
|
4174
|
+
if (!isWritableStream(target.stdin)) {
|
|
4175
|
+
throw new TypeError("The target child process's stdin must be available.");
|
|
4176
|
+
}
|
|
4177
|
+
spawned[streamName].pipe(target.stdin);
|
|
4178
|
+
return target;
|
|
4179
|
+
};
|
|
4180
|
+
var addPipeMethods = (spawned) => {
|
|
4181
|
+
if (spawned.stdout !== null) {
|
|
4182
|
+
spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
|
|
4183
|
+
}
|
|
4184
|
+
if (spawned.stderr !== null) {
|
|
4185
|
+
spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
|
|
4186
|
+
}
|
|
4187
|
+
if (spawned.all !== void 0) {
|
|
4188
|
+
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
4189
|
+
}
|
|
4190
|
+
};
|
|
4191
|
+
|
|
4192
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
|
|
4193
|
+
var getStreamContents = async (stream2, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
4194
|
+
if (!isAsyncIterable(stream2)) {
|
|
4195
|
+
throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
4196
|
+
}
|
|
4197
|
+
const state = init();
|
|
4198
|
+
state.length = 0;
|
|
4199
|
+
try {
|
|
4200
|
+
for await (const chunk of stream2) {
|
|
4201
|
+
const chunkType = getChunkType(chunk);
|
|
4202
|
+
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
4203
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4204
|
+
}
|
|
4205
|
+
appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
|
|
4206
|
+
return finalize(state);
|
|
4207
|
+
} catch (error) {
|
|
4208
|
+
error.bufferedData = finalize(state);
|
|
4209
|
+
throw error;
|
|
4210
|
+
}
|
|
4211
|
+
};
|
|
4212
|
+
var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
4213
|
+
const convertedChunk = getFinalChunk(state);
|
|
4214
|
+
if (convertedChunk !== void 0) {
|
|
4215
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
4216
|
+
}
|
|
4217
|
+
};
|
|
4218
|
+
var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
4219
|
+
const chunkSize = getSize(convertedChunk);
|
|
4220
|
+
const newLength = state.length + chunkSize;
|
|
4221
|
+
if (newLength <= maxBuffer) {
|
|
4222
|
+
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
4223
|
+
return;
|
|
4224
|
+
}
|
|
4225
|
+
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
4226
|
+
if (truncatedChunk !== void 0) {
|
|
4227
|
+
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
4228
|
+
}
|
|
4229
|
+
throw new MaxBufferError();
|
|
4230
|
+
};
|
|
4231
|
+
var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
4232
|
+
state.contents = addChunk(convertedChunk, state, newLength);
|
|
4233
|
+
state.length = newLength;
|
|
4234
|
+
};
|
|
4235
|
+
var isAsyncIterable = (stream2) => typeof stream2 === "object" && stream2 !== null && typeof stream2[Symbol.asyncIterator] === "function";
|
|
4236
|
+
var getChunkType = (chunk) => {
|
|
4237
|
+
const typeOfChunk = typeof chunk;
|
|
4238
|
+
if (typeOfChunk === "string") {
|
|
4239
|
+
return "string";
|
|
4240
|
+
}
|
|
4241
|
+
if (typeOfChunk !== "object" || chunk === null) {
|
|
4242
|
+
return "others";
|
|
4243
|
+
}
|
|
4244
|
+
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
4245
|
+
return "buffer";
|
|
4246
|
+
}
|
|
4247
|
+
const prototypeName = objectToString.call(chunk);
|
|
4248
|
+
if (prototypeName === "[object ArrayBuffer]") {
|
|
4249
|
+
return "arrayBuffer";
|
|
4250
|
+
}
|
|
4251
|
+
if (prototypeName === "[object DataView]") {
|
|
4252
|
+
return "dataView";
|
|
4253
|
+
}
|
|
4254
|
+
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
4255
|
+
return "typedArray";
|
|
4256
|
+
}
|
|
4257
|
+
return "others";
|
|
4258
|
+
};
|
|
4259
|
+
var { toString: objectToString } = Object.prototype;
|
|
4260
|
+
var MaxBufferError = class extends Error {
|
|
4261
|
+
name = "MaxBufferError";
|
|
4262
|
+
constructor() {
|
|
4263
|
+
super("maxBuffer exceeded");
|
|
4264
|
+
}
|
|
4265
|
+
};
|
|
4266
|
+
|
|
4267
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
|
|
4268
|
+
var identity = (value) => value;
|
|
4269
|
+
var noop = () => void 0;
|
|
4270
|
+
var getContentsProp = ({ contents }) => contents;
|
|
4271
|
+
var throwObjectStream = (chunk) => {
|
|
4272
|
+
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
4273
|
+
};
|
|
4274
|
+
var getLengthProp = (convertedChunk) => convertedChunk.length;
|
|
4275
|
+
|
|
4276
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
|
|
4277
|
+
async function getStreamAsArrayBuffer(stream2, options) {
|
|
4278
|
+
return getStreamContents(stream2, arrayBufferMethods, options);
|
|
4279
|
+
}
|
|
4280
|
+
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
|
|
4281
|
+
var useTextEncoder = (chunk) => textEncoder.encode(chunk);
|
|
4282
|
+
var textEncoder = new TextEncoder();
|
|
4283
|
+
var useUint8Array = (chunk) => new Uint8Array(chunk);
|
|
4284
|
+
var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
4285
|
+
var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
4286
|
+
var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
4287
|
+
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
4288
|
+
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
4289
|
+
return newContents;
|
|
4290
|
+
};
|
|
4291
|
+
var resizeArrayBufferSlow = (contents, length) => {
|
|
4292
|
+
if (length <= contents.byteLength) {
|
|
4293
|
+
return contents;
|
|
4294
|
+
}
|
|
4295
|
+
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
4296
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
4297
|
+
return arrayBuffer;
|
|
4298
|
+
};
|
|
4299
|
+
var resizeArrayBuffer = (contents, length) => {
|
|
4300
|
+
if (length <= contents.maxByteLength) {
|
|
4301
|
+
contents.resize(length);
|
|
4302
|
+
return contents;
|
|
4303
|
+
}
|
|
4304
|
+
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
4305
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
4306
|
+
return arrayBuffer;
|
|
4307
|
+
};
|
|
4308
|
+
var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
4309
|
+
var SCALE_FACTOR = 2;
|
|
4310
|
+
var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
4311
|
+
var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
|
|
4312
|
+
var arrayBufferMethods = {
|
|
4313
|
+
init: initArrayBuffer,
|
|
4314
|
+
convertChunk: {
|
|
4315
|
+
string: useTextEncoder,
|
|
4316
|
+
buffer: useUint8Array,
|
|
4317
|
+
arrayBuffer: useUint8Array,
|
|
4318
|
+
dataView: useUint8ArrayWithOffset,
|
|
4319
|
+
typedArray: useUint8ArrayWithOffset,
|
|
4320
|
+
others: throwObjectStream
|
|
4321
|
+
},
|
|
4322
|
+
getSize: getLengthProp,
|
|
4323
|
+
truncateChunk: truncateArrayBufferChunk,
|
|
4324
|
+
addChunk: addArrayBufferChunk,
|
|
4325
|
+
getFinalChunk: noop,
|
|
4326
|
+
finalize: finalizeArrayBuffer
|
|
4327
|
+
};
|
|
4328
|
+
|
|
4329
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
|
|
4330
|
+
async function getStreamAsBuffer(stream2, options) {
|
|
4331
|
+
if (!("Buffer" in globalThis)) {
|
|
4332
|
+
throw new Error("getStreamAsBuffer() is only supported in Node.js");
|
|
4333
|
+
}
|
|
4334
|
+
try {
|
|
4335
|
+
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream2, options));
|
|
4336
|
+
} catch (error) {
|
|
4337
|
+
if (error.bufferedData !== void 0) {
|
|
4338
|
+
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
4339
|
+
}
|
|
4340
|
+
throw error;
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
|
|
4344
|
+
|
|
4345
|
+
// ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
|
|
4346
|
+
async function getStreamAsString(stream2, options) {
|
|
4347
|
+
return getStreamContents(stream2, stringMethods, options);
|
|
4348
|
+
}
|
|
4349
|
+
var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
|
|
4350
|
+
var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
|
|
4351
|
+
var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
|
|
4352
|
+
var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
4353
|
+
var getFinalStringChunk = ({ textDecoder }) => {
|
|
4354
|
+
const finalChunk = textDecoder.decode();
|
|
4355
|
+
return finalChunk === "" ? void 0 : finalChunk;
|
|
4356
|
+
};
|
|
4357
|
+
var stringMethods = {
|
|
4358
|
+
init: initString,
|
|
4359
|
+
convertChunk: {
|
|
4360
|
+
string: identity,
|
|
4361
|
+
buffer: useTextDecoder,
|
|
4362
|
+
arrayBuffer: useTextDecoder,
|
|
4363
|
+
dataView: useTextDecoder,
|
|
4364
|
+
typedArray: useTextDecoder,
|
|
4365
|
+
others: throwObjectStream
|
|
4366
|
+
},
|
|
4367
|
+
getSize: getLengthProp,
|
|
4368
|
+
truncateChunk: truncateStringChunk,
|
|
4369
|
+
addChunk: addStringChunk,
|
|
4370
|
+
getFinalChunk: getFinalStringChunk,
|
|
4371
|
+
finalize: getContentsProp
|
|
4372
|
+
};
|
|
4373
|
+
|
|
4374
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
4375
|
+
var import_merge_stream2 = __toESM(require_merge_stream());
|
|
4376
|
+
var validateInputOptions = (input) => {
|
|
4377
|
+
if (input !== void 0) {
|
|
4378
|
+
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
|
4379
|
+
}
|
|
4380
|
+
};
|
|
4381
|
+
var getInput = ({ input, inputFile }) => {
|
|
4382
|
+
if (typeof inputFile !== "string") {
|
|
4383
|
+
return input;
|
|
4384
|
+
}
|
|
4385
|
+
validateInputOptions(input);
|
|
4386
|
+
return fs.createReadStream(inputFile);
|
|
4387
|
+
};
|
|
4388
|
+
var handleInput2 = (spawned, options) => {
|
|
4389
|
+
const input = getInput(options);
|
|
4390
|
+
if (input === void 0) {
|
|
4391
|
+
return;
|
|
4392
|
+
}
|
|
4393
|
+
if (isStream(input)) {
|
|
4394
|
+
input.pipe(spawned.stdin);
|
|
4395
|
+
} else {
|
|
4396
|
+
spawned.stdin.end(input);
|
|
4397
|
+
}
|
|
4398
|
+
};
|
|
4399
|
+
var makeAllStream2 = (spawned, { all }) => {
|
|
4400
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
4401
|
+
return;
|
|
4402
|
+
}
|
|
4403
|
+
const mixed = (0, import_merge_stream2.default)();
|
|
4404
|
+
if (spawned.stdout) {
|
|
4405
|
+
mixed.add(spawned.stdout);
|
|
4406
|
+
}
|
|
4407
|
+
if (spawned.stderr) {
|
|
4408
|
+
mixed.add(spawned.stderr);
|
|
4409
|
+
}
|
|
4410
|
+
return mixed;
|
|
4411
|
+
};
|
|
4412
|
+
var getBufferedData2 = async (stream2, streamPromise) => {
|
|
4413
|
+
if (!stream2 || streamPromise === void 0) {
|
|
4414
|
+
return;
|
|
4415
|
+
}
|
|
4416
|
+
await promises.setTimeout(0);
|
|
4417
|
+
stream2.destroy();
|
|
4418
|
+
try {
|
|
4419
|
+
return await streamPromise;
|
|
4420
|
+
} catch (error) {
|
|
4421
|
+
return error.bufferedData;
|
|
4422
|
+
}
|
|
4423
|
+
};
|
|
4424
|
+
var getStreamPromise2 = (stream2, { encoding, buffer, maxBuffer }) => {
|
|
4425
|
+
if (!stream2 || !buffer) {
|
|
4426
|
+
return;
|
|
4427
|
+
}
|
|
4428
|
+
if (encoding === "utf8" || encoding === "utf-8") {
|
|
4429
|
+
return getStreamAsString(stream2, { maxBuffer });
|
|
4430
|
+
}
|
|
4431
|
+
if (encoding === null || encoding === "buffer") {
|
|
4432
|
+
return getStreamAsBuffer(stream2, { maxBuffer });
|
|
4433
|
+
}
|
|
4434
|
+
return applyEncoding(stream2, maxBuffer, encoding);
|
|
4435
|
+
};
|
|
4436
|
+
var applyEncoding = async (stream2, maxBuffer, encoding) => {
|
|
4437
|
+
const buffer = await getStreamAsBuffer(stream2, { maxBuffer });
|
|
4438
|
+
return buffer.toString(encoding);
|
|
4439
|
+
};
|
|
4440
|
+
var getSpawnedResult2 = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
4441
|
+
const stdoutPromise = getStreamPromise2(stdout, { encoding, buffer, maxBuffer });
|
|
4442
|
+
const stderrPromise = getStreamPromise2(stderr, { encoding, buffer, maxBuffer });
|
|
4443
|
+
const allPromise = getStreamPromise2(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
4444
|
+
try {
|
|
4445
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
4446
|
+
} catch (error) {
|
|
4447
|
+
return Promise.all([
|
|
4448
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
4449
|
+
getBufferedData2(stdout, stdoutPromise),
|
|
4450
|
+
getBufferedData2(stderr, stderrPromise),
|
|
4451
|
+
getBufferedData2(all, allPromise)
|
|
4452
|
+
]);
|
|
4453
|
+
}
|
|
4454
|
+
};
|
|
4455
|
+
|
|
4456
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
|
|
4457
|
+
var nativePromisePrototype2 = (async () => {
|
|
4458
|
+
})().constructor.prototype;
|
|
4459
|
+
var descriptors2 = ["then", "catch", "finally"].map((property) => [
|
|
4460
|
+
property,
|
|
4461
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype2, property)
|
|
4462
|
+
]);
|
|
4463
|
+
var mergePromise2 = (spawned, promise) => {
|
|
4464
|
+
for (const [property, descriptor] of descriptors2) {
|
|
4465
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
4466
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
4467
|
+
}
|
|
1550
4468
|
};
|
|
1551
|
-
var
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
...options.headers
|
|
1562
|
-
}
|
|
4469
|
+
var getSpawnedPromise2 = (spawned) => new Promise((resolve, reject) => {
|
|
4470
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
4471
|
+
resolve({ exitCode, signal });
|
|
4472
|
+
});
|
|
4473
|
+
spawned.on("error", (error) => {
|
|
4474
|
+
reject(error);
|
|
4475
|
+
});
|
|
4476
|
+
if (spawned.stdin) {
|
|
4477
|
+
spawned.stdin.on("error", (error) => {
|
|
4478
|
+
reject(error);
|
|
1563
4479
|
});
|
|
1564
4480
|
}
|
|
4481
|
+
});
|
|
4482
|
+
var normalizeArgs2 = (file, args = []) => {
|
|
4483
|
+
if (!Array.isArray(args)) {
|
|
4484
|
+
return [file];
|
|
4485
|
+
}
|
|
4486
|
+
return [file, ...args];
|
|
1565
4487
|
};
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
subscribe(options) {
|
|
1571
|
-
return (options?.client ?? this._client).get.sse({
|
|
1572
|
-
url: "/event",
|
|
1573
|
-
...options
|
|
1574
|
-
});
|
|
4488
|
+
var NO_ESCAPE_REGEXP2 = /^[\w.-]+$/;
|
|
4489
|
+
var escapeArg2 = (arg) => {
|
|
4490
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP2.test(arg)) {
|
|
4491
|
+
return arg;
|
|
1575
4492
|
}
|
|
4493
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
1576
4494
|
};
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
4495
|
+
var joinCommand2 = (file, args) => normalizeArgs2(file, args).join(" ");
|
|
4496
|
+
var getEscapedCommand2 = (file, args) => normalizeArgs2(file, args).map((arg) => escapeArg2(arg)).join(" ");
|
|
4497
|
+
var verboseDefault = util.debuglog("execa").enabled;
|
|
4498
|
+
var padField = (field, padding) => String(field).padStart(padding, "0");
|
|
4499
|
+
var getTimestamp = () => {
|
|
4500
|
+
const date = /* @__PURE__ */ new Date();
|
|
4501
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
4502
|
+
};
|
|
4503
|
+
var logCommand = (escapedCommand, { verbose }) => {
|
|
4504
|
+
if (!verbose) {
|
|
4505
|
+
return;
|
|
1590
4506
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
config = new Config({ client: this._client });
|
|
1594
|
-
tool = new Tool({ client: this._client });
|
|
1595
|
-
instance = new Instance({ client: this._client });
|
|
1596
|
-
path = new Path({ client: this._client });
|
|
1597
|
-
vcs = new Vcs({ client: this._client });
|
|
1598
|
-
session = new Session({ client: this._client });
|
|
1599
|
-
command = new Command({ client: this._client });
|
|
1600
|
-
provider = new Provider({ client: this._client });
|
|
1601
|
-
find = new Find({ client: this._client });
|
|
1602
|
-
file = new File2({ client: this._client });
|
|
1603
|
-
app = new App({ client: this._client });
|
|
1604
|
-
mcp = new Mcp({ client: this._client });
|
|
1605
|
-
lsp = new Lsp({ client: this._client });
|
|
1606
|
-
formatter = new Formatter({ client: this._client });
|
|
1607
|
-
tui = new Tui({ client: this._client });
|
|
1608
|
-
auth = new Auth({ client: this._client });
|
|
1609
|
-
event = new Event({ client: this._client });
|
|
4507
|
+
process2__default.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
|
|
4508
|
+
`);
|
|
1610
4509
|
};
|
|
1611
4510
|
|
|
1612
|
-
// ../../node_modules/.pnpm
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
4511
|
+
// ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
4512
|
+
var DEFAULT_MAX_BUFFER2 = 1e3 * 1e3 * 100;
|
|
4513
|
+
var getEnv2 = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
4514
|
+
const env = extendEnv ? { ...process2__default.default.env, ...envOption } : envOption;
|
|
4515
|
+
if (preferLocal) {
|
|
4516
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
4517
|
+
}
|
|
4518
|
+
return env;
|
|
4519
|
+
};
|
|
4520
|
+
var handleArguments2 = (file, args, options = {}) => {
|
|
4521
|
+
const parsed = import_cross_spawn2.default._parse(file, args, options);
|
|
4522
|
+
file = parsed.command;
|
|
4523
|
+
args = parsed.args;
|
|
4524
|
+
options = parsed.options;
|
|
4525
|
+
options = {
|
|
4526
|
+
maxBuffer: DEFAULT_MAX_BUFFER2,
|
|
4527
|
+
buffer: true,
|
|
4528
|
+
stripFinalNewline: true,
|
|
4529
|
+
extendEnv: true,
|
|
4530
|
+
preferLocal: false,
|
|
4531
|
+
localDir: options.cwd || process2__default.default.cwd(),
|
|
4532
|
+
execPath: process2__default.default.execPath,
|
|
4533
|
+
encoding: "utf8",
|
|
4534
|
+
reject: true,
|
|
4535
|
+
cleanup: true,
|
|
4536
|
+
all: false,
|
|
4537
|
+
windowsHide: true,
|
|
4538
|
+
verbose: verboseDefault,
|
|
4539
|
+
...options
|
|
4540
|
+
};
|
|
4541
|
+
options.env = getEnv2(options);
|
|
4542
|
+
options.stdio = normalizeStdio2(options);
|
|
4543
|
+
if (process2__default.default.platform === "win32" && path__default.default.basename(file, ".exe") === "cmd") {
|
|
4544
|
+
args.unshift("/q");
|
|
4545
|
+
}
|
|
4546
|
+
return { file, args, options, parsed };
|
|
4547
|
+
};
|
|
4548
|
+
var handleOutput2 = (options, value, error) => {
|
|
4549
|
+
if (typeof value !== "string" && !buffer.Buffer.isBuffer(value)) {
|
|
4550
|
+
return error === void 0 ? void 0 : "";
|
|
4551
|
+
}
|
|
4552
|
+
if (options.stripFinalNewline) {
|
|
4553
|
+
return stripFinalNewline(value);
|
|
4554
|
+
}
|
|
4555
|
+
return value;
|
|
4556
|
+
};
|
|
4557
|
+
function execa2(file, args, options) {
|
|
4558
|
+
const parsed = handleArguments2(file, args, options);
|
|
4559
|
+
const command = joinCommand2(file, args);
|
|
4560
|
+
const escapedCommand = getEscapedCommand2(file, args);
|
|
4561
|
+
logCommand(escapedCommand, parsed.options);
|
|
4562
|
+
validateTimeout2(parsed.options);
|
|
4563
|
+
let spawned;
|
|
4564
|
+
try {
|
|
4565
|
+
spawned = childProcess2__default.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
4566
|
+
} catch (error) {
|
|
4567
|
+
const dummySpawned = new childProcess2__default.default.ChildProcess();
|
|
4568
|
+
const errorPromise = Promise.reject(makeError2({
|
|
4569
|
+
error,
|
|
4570
|
+
stdout: "",
|
|
4571
|
+
stderr: "",
|
|
4572
|
+
all: "",
|
|
4573
|
+
command,
|
|
4574
|
+
escapedCommand,
|
|
4575
|
+
parsed,
|
|
4576
|
+
timedOut: false,
|
|
4577
|
+
isCanceled: false,
|
|
4578
|
+
killed: false
|
|
4579
|
+
}));
|
|
4580
|
+
mergePromise2(dummySpawned, errorPromise);
|
|
4581
|
+
return dummySpawned;
|
|
4582
|
+
}
|
|
4583
|
+
const spawnedPromise = getSpawnedPromise2(spawned);
|
|
4584
|
+
const timedPromise = setupTimeout2(spawned, parsed.options, spawnedPromise);
|
|
4585
|
+
const processDone = setExitHandler2(spawned, parsed.options, timedPromise);
|
|
4586
|
+
const context = { isCanceled: false };
|
|
4587
|
+
spawned.kill = spawnedKill2.bind(null, spawned.kill.bind(spawned));
|
|
4588
|
+
spawned.cancel = spawnedCancel2.bind(null, spawned, context);
|
|
4589
|
+
const handlePromise = async () => {
|
|
4590
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult2(spawned, parsed.options, processDone);
|
|
4591
|
+
const stdout = handleOutput2(parsed.options, stdoutResult);
|
|
4592
|
+
const stderr = handleOutput2(parsed.options, stderrResult);
|
|
4593
|
+
const all = handleOutput2(parsed.options, allResult);
|
|
4594
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
4595
|
+
const returnedError = makeError2({
|
|
4596
|
+
error,
|
|
4597
|
+
exitCode,
|
|
4598
|
+
signal,
|
|
4599
|
+
stdout,
|
|
4600
|
+
stderr,
|
|
4601
|
+
all,
|
|
4602
|
+
command,
|
|
4603
|
+
escapedCommand,
|
|
4604
|
+
parsed,
|
|
4605
|
+
timedOut,
|
|
4606
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
4607
|
+
killed: spawned.killed
|
|
4608
|
+
});
|
|
4609
|
+
if (!parsed.options.reject) {
|
|
4610
|
+
return returnedError;
|
|
1620
4611
|
}
|
|
4612
|
+
throw returnedError;
|
|
4613
|
+
}
|
|
4614
|
+
return {
|
|
4615
|
+
command,
|
|
4616
|
+
escapedCommand,
|
|
4617
|
+
exitCode: 0,
|
|
4618
|
+
stdout,
|
|
4619
|
+
stderr,
|
|
4620
|
+
all,
|
|
4621
|
+
failed: false,
|
|
4622
|
+
timedOut: false,
|
|
4623
|
+
isCanceled: false,
|
|
4624
|
+
killed: false
|
|
1621
4625
|
};
|
|
4626
|
+
};
|
|
4627
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
4628
|
+
handleInput2(spawned, parsed.options);
|
|
4629
|
+
spawned.all = makeAllStream2(spawned, parsed.options);
|
|
4630
|
+
addPipeMethods(spawned);
|
|
4631
|
+
mergePromise2(spawned, handlePromiseOnce);
|
|
4632
|
+
return spawned;
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
// ../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js
|
|
4636
|
+
function indentString(string, count = 1, options = {}) {
|
|
4637
|
+
const {
|
|
4638
|
+
indent = " ",
|
|
4639
|
+
includeEmptyLines = false
|
|
4640
|
+
} = options;
|
|
4641
|
+
if (typeof string !== "string") {
|
|
4642
|
+
throw new TypeError(
|
|
4643
|
+
`Expected \`input\` to be a \`string\`, got \`${typeof string}\``
|
|
4644
|
+
);
|
|
1622
4645
|
}
|
|
1623
|
-
if (
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
};
|
|
4646
|
+
if (typeof count !== "number") {
|
|
4647
|
+
throw new TypeError(
|
|
4648
|
+
`Expected \`count\` to be a \`number\`, got \`${typeof count}\``
|
|
4649
|
+
);
|
|
1628
4650
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
4651
|
+
if (count < 0) {
|
|
4652
|
+
throw new RangeError(
|
|
4653
|
+
`Expected \`count\` to be at least 0, got \`${count}\``
|
|
4654
|
+
);
|
|
4655
|
+
}
|
|
4656
|
+
if (typeof indent !== "string") {
|
|
4657
|
+
throw new TypeError(
|
|
4658
|
+
`Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
|
|
4659
|
+
);
|
|
4660
|
+
}
|
|
4661
|
+
if (count === 0) {
|
|
4662
|
+
return string;
|
|
4663
|
+
}
|
|
4664
|
+
const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
|
4665
|
+
return string.replace(regex, indent.repeat(count));
|
|
1631
4666
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
4667
|
+
|
|
4668
|
+
// ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
|
|
4669
|
+
function escapeStringRegexp(string) {
|
|
4670
|
+
if (typeof string !== "string") {
|
|
4671
|
+
throw new TypeError("Expected a string");
|
|
4672
|
+
}
|
|
4673
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
4674
|
+
}
|
|
4675
|
+
var getHomeDirectory = () => os__default.default.homedir().replace(/\\/g, "/");
|
|
4676
|
+
var home_directory_default = getHomeDirectory;
|
|
4677
|
+
|
|
4678
|
+
// ../../node_modules/.pnpm/clean-stack@5.3.0/node_modules/clean-stack/index.js
|
|
4679
|
+
var extractPathRegex = /\s+at.*[(\s](.*)\)?/;
|
|
4680
|
+
var pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
|
|
4681
|
+
function cleanStack(stack, { pretty = false, basePath, pathFilter } = {}) {
|
|
4682
|
+
const basePathRegex = basePath && new RegExp(`(file://)?${escapeStringRegexp(basePath.replace(/\\/g, "/"))}/?`, "g");
|
|
4683
|
+
const homeDirectory = pretty ? home_directory_default() : "";
|
|
4684
|
+
if (typeof stack !== "string") {
|
|
4685
|
+
return void 0;
|
|
4686
|
+
}
|
|
4687
|
+
return stack.replace(/\\/g, "/").split("\n").filter((line) => {
|
|
4688
|
+
const pathMatches = line.match(extractPathRegex);
|
|
4689
|
+
if (pathMatches === null || !pathMatches[1]) {
|
|
4690
|
+
return true;
|
|
1643
4691
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
}
|
|
1659
|
-
clearTimeout(id);
|
|
1660
|
-
resolve(match2[1]);
|
|
1661
|
-
return;
|
|
4692
|
+
const match2 = pathMatches[1];
|
|
4693
|
+
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")) {
|
|
4694
|
+
return false;
|
|
4695
|
+
}
|
|
4696
|
+
return pathFilter ? !pathRegex.test(match2) && pathFilter(match2) : !pathRegex.test(match2);
|
|
4697
|
+
}).filter((line) => line.trim() !== "").map((line) => {
|
|
4698
|
+
if (basePathRegex) {
|
|
4699
|
+
line = line.replace(basePathRegex, "");
|
|
4700
|
+
}
|
|
4701
|
+
if (pretty) {
|
|
4702
|
+
line = line.replace(extractPathRegex, (m, p1) => {
|
|
4703
|
+
let filePath = p1;
|
|
4704
|
+
if (filePath.startsWith("file://")) {
|
|
4705
|
+
filePath = url.fileURLToPath(filePath);
|
|
1662
4706
|
}
|
|
4707
|
+
filePath = filePath.replace(homeDirectory, "~");
|
|
4708
|
+
return m.replace(p1, filePath);
|
|
4709
|
+
});
|
|
4710
|
+
}
|
|
4711
|
+
return line;
|
|
4712
|
+
}).join("\n");
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
// ../../node_modules/.pnpm/aggregate-error@5.0.0/node_modules/aggregate-error/index.js
|
|
4716
|
+
var cleanInternalStack = (stack) => stack.replaceAll(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
|
|
4717
|
+
var AggregateError = class extends Error {
|
|
4718
|
+
#errors;
|
|
4719
|
+
name = "AggregateError";
|
|
4720
|
+
constructor(errors) {
|
|
4721
|
+
if (!Array.isArray(errors)) {
|
|
4722
|
+
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
|
4723
|
+
}
|
|
4724
|
+
errors = errors.map((error) => {
|
|
4725
|
+
if (error instanceof Error) {
|
|
4726
|
+
return error;
|
|
1663
4727
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
output += chunk.toString();
|
|
1667
|
-
});
|
|
1668
|
-
proc.on("exit", (code) => {
|
|
1669
|
-
clearTimeout(id);
|
|
1670
|
-
let msg = `Server exited with code ${code}`;
|
|
1671
|
-
if (output.trim()) {
|
|
1672
|
-
msg += `
|
|
1673
|
-
Server output: ${output}`;
|
|
4728
|
+
if (error !== null && typeof error === "object") {
|
|
4729
|
+
return Object.assign(new Error(error.message), error);
|
|
1674
4730
|
}
|
|
1675
|
-
|
|
1676
|
-
});
|
|
1677
|
-
proc.on("error", (error) => {
|
|
1678
|
-
clearTimeout(id);
|
|
1679
|
-
reject(error);
|
|
4731
|
+
return new Error(error);
|
|
1680
4732
|
});
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
4733
|
+
let message = errors.map(
|
|
4734
|
+
(error) => (
|
|
4735
|
+
// The `stack` property is not standardized, so we can't assume it exists
|
|
4736
|
+
typeof error.stack === "string" && error.stack.length > 0 ? cleanInternalStack(cleanStack(error.stack)) : String(error)
|
|
4737
|
+
)
|
|
4738
|
+
).join("\n");
|
|
4739
|
+
message = "\n" + indentString(message, 4);
|
|
4740
|
+
super(message);
|
|
4741
|
+
this.#errors = errors;
|
|
4742
|
+
}
|
|
4743
|
+
get errors() {
|
|
4744
|
+
return [...this.#errors];
|
|
4745
|
+
}
|
|
4746
|
+
};
|
|
4747
|
+
var netstat = async (type) => {
|
|
4748
|
+
const { stdout } = await execa2("netstat", ["-anv", "-p", type]);
|
|
4749
|
+
return stdout;
|
|
4750
|
+
};
|
|
4751
|
+
var macos = async () => {
|
|
4752
|
+
const result = await Promise.all([
|
|
4753
|
+
netstat("tcp"),
|
|
4754
|
+
netstat("udp")
|
|
4755
|
+
]);
|
|
4756
|
+
const tcp = result[0];
|
|
4757
|
+
const headerStart = tcp.indexOf("\n") + 1;
|
|
4758
|
+
const header = tcp.slice(headerStart, tcp.indexOf("\n", headerStart));
|
|
1688
4759
|
return {
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
4760
|
+
stdout: result.join("\n"),
|
|
4761
|
+
addressColumn: 3,
|
|
4762
|
+
// Some versions of macOS print two extra columns for rxbytes and
|
|
4763
|
+
// txbytes before pid. Unfortunately headers can't be parsed because
|
|
4764
|
+
// they're space separated but some contain spaces, so we use this
|
|
4765
|
+
// heuristic to distinguish the two netstat versions.
|
|
4766
|
+
pidColumn: header.includes("rxbytes") ? 10 : 8
|
|
1693
4767
|
};
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
async function createOpencode(options) {
|
|
1698
|
-
const server = await createOpencodeServer({
|
|
1699
|
-
...options
|
|
1700
|
-
});
|
|
1701
|
-
const client2 = createOpencodeClient({
|
|
1702
|
-
baseUrl: server.url
|
|
1703
|
-
});
|
|
4768
|
+
};
|
|
4769
|
+
var linux = async () => {
|
|
4770
|
+
const { stdout } = await execa2("ss", ["-tunlp"]);
|
|
1704
4771
|
return {
|
|
1705
|
-
|
|
1706
|
-
|
|
4772
|
+
stdout,
|
|
4773
|
+
addressColumn: 4,
|
|
4774
|
+
pidColumn: 6
|
|
4775
|
+
};
|
|
4776
|
+
};
|
|
4777
|
+
var windows = async () => {
|
|
4778
|
+
const { stdout } = await execa2("netstat", ["-ano"]);
|
|
4779
|
+
return {
|
|
4780
|
+
stdout,
|
|
4781
|
+
addressColumn: 1,
|
|
4782
|
+
pidColumn: 4
|
|
1707
4783
|
};
|
|
4784
|
+
};
|
|
4785
|
+
var isProtocol = (value) => /^\s*(tcp|udp)/i.test(value);
|
|
4786
|
+
var parsePid = (pid) => {
|
|
4787
|
+
if (typeof pid !== "string") {
|
|
4788
|
+
return;
|
|
4789
|
+
}
|
|
4790
|
+
const { groups } = /(?:^|",|",pid=)(?<pid>\d+)/.exec(pid) || {};
|
|
4791
|
+
if (groups) {
|
|
4792
|
+
return Number.parseInt(groups.pid, 10);
|
|
4793
|
+
}
|
|
4794
|
+
};
|
|
4795
|
+
var getPort = (port, { lines, addressColumn, pidColumn }) => {
|
|
4796
|
+
const regex = new RegExp(`[.:]${port}$`);
|
|
4797
|
+
const foundPort = lines.find((line) => regex.test(line[addressColumn]));
|
|
4798
|
+
if (!foundPort) {
|
|
4799
|
+
throw new Error(`Could not find a process that uses port \`${port}\``);
|
|
4800
|
+
}
|
|
4801
|
+
return parsePid(foundPort[pidColumn]);
|
|
4802
|
+
};
|
|
4803
|
+
var implementation = process2__default.default.platform === "darwin" ? macos : process2__default.default.platform === "linux" ? linux : windows;
|
|
4804
|
+
var getList = async () => {
|
|
4805
|
+
const { stdout, addressColumn, pidColumn } = await implementation();
|
|
4806
|
+
const lines = stdout.split("\n").filter((line) => isProtocol(line)).map((line) => line.match(/\S+/g) || []);
|
|
4807
|
+
return { lines, addressColumn, pidColumn };
|
|
4808
|
+
};
|
|
4809
|
+
async function portToPid(port) {
|
|
4810
|
+
if (Array.isArray(port)) {
|
|
4811
|
+
const list = await getList();
|
|
4812
|
+
const tuples = await Promise.all(port.map((port_) => [port_, getPort(port_, list)]));
|
|
4813
|
+
return new Map(tuples);
|
|
4814
|
+
}
|
|
4815
|
+
if (!Number.isInteger(port)) {
|
|
4816
|
+
throw new TypeError(`Expected an integer, got ${typeof port}`);
|
|
4817
|
+
}
|
|
4818
|
+
return getPort(port, await getList());
|
|
1708
4819
|
}
|
|
4820
|
+
var __dirname$1 = path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('server.cjs', document.baseURI).href))));
|
|
4821
|
+
var TEN_MEGABYTES = 1e3 * 1e3 * 10;
|
|
4822
|
+
var execFile = util.promisify(childProcess2__default.default.execFile);
|
|
4823
|
+
var windows2 = async () => {
|
|
4824
|
+
let binary;
|
|
4825
|
+
switch (process2__default.default.arch) {
|
|
4826
|
+
case "x64":
|
|
4827
|
+
binary = "fastlist-0.3.0-x64.exe";
|
|
4828
|
+
break;
|
|
4829
|
+
case "ia32":
|
|
4830
|
+
binary = "fastlist-0.3.0-x86.exe";
|
|
4831
|
+
break;
|
|
4832
|
+
default:
|
|
4833
|
+
throw new Error(`Unsupported architecture: ${process2__default.default.arch}`);
|
|
4834
|
+
}
|
|
4835
|
+
const binaryPath = path__default.default.join(__dirname$1, "vendor", binary);
|
|
4836
|
+
const { stdout } = await execFile(binaryPath, {
|
|
4837
|
+
maxBuffer: TEN_MEGABYTES,
|
|
4838
|
+
windowsHide: true
|
|
4839
|
+
});
|
|
4840
|
+
return stdout.trim().split("\r\n").map((line) => line.split(" ")).map(([pid, ppid, name]) => ({
|
|
4841
|
+
pid: Number.parseInt(pid, 10),
|
|
4842
|
+
ppid: Number.parseInt(ppid, 10),
|
|
4843
|
+
name
|
|
4844
|
+
}));
|
|
4845
|
+
};
|
|
4846
|
+
var nonWindowsMultipleCalls = async (options = {}) => {
|
|
4847
|
+
const flags = (options.all === false ? "" : "a") + "wwxo";
|
|
4848
|
+
const returnValue = {};
|
|
4849
|
+
await Promise.all(["comm", "args", "ppid", "uid", "%cpu", "%mem"].map(async (cmd) => {
|
|
4850
|
+
const { stdout } = await execFile("ps", [flags, `pid,${cmd}`], { maxBuffer: TEN_MEGABYTES });
|
|
4851
|
+
for (let line of stdout.trim().split("\n").slice(1)) {
|
|
4852
|
+
line = line.trim();
|
|
4853
|
+
const [pid] = line.split(" ", 1);
|
|
4854
|
+
const value = line.slice(pid.length + 1).trim();
|
|
4855
|
+
if (returnValue[pid] === void 0) {
|
|
4856
|
+
returnValue[pid] = {};
|
|
4857
|
+
}
|
|
4858
|
+
returnValue[pid][cmd] = value;
|
|
4859
|
+
}
|
|
4860
|
+
}));
|
|
4861
|
+
return Object.entries(returnValue).filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value["%cpu"] && value["%mem"]).map(([key, value]) => ({
|
|
4862
|
+
pid: Number.parseInt(key, 10),
|
|
4863
|
+
name: path__default.default.basename(value.comm),
|
|
4864
|
+
cmd: value.args,
|
|
4865
|
+
ppid: Number.parseInt(value.ppid, 10),
|
|
4866
|
+
uid: Number.parseInt(value.uid, 10),
|
|
4867
|
+
cpu: Number.parseFloat(value["%cpu"]),
|
|
4868
|
+
memory: Number.parseFloat(value["%mem"])
|
|
4869
|
+
}));
|
|
4870
|
+
};
|
|
4871
|
+
var ERROR_MESSAGE_PARSING_FAILED = "ps output parsing failed";
|
|
4872
|
+
var psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>[-\d]+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+(?<comm>.*)?/;
|
|
4873
|
+
var nonWindowsCall = async (options = {}) => {
|
|
4874
|
+
const flags = options.all === false ? "wwxo" : "awwxo";
|
|
4875
|
+
const psPromises = [
|
|
4876
|
+
execFile("ps", [flags, "pid,ppid,uid,%cpu,%mem,comm"], { maxBuffer: TEN_MEGABYTES }),
|
|
4877
|
+
execFile("ps", [flags, "pid,args"], { maxBuffer: TEN_MEGABYTES })
|
|
4878
|
+
];
|
|
4879
|
+
const [psLines, psArgsLines] = (await Promise.all(psPromises)).map(({ stdout }) => stdout.trim().split("\n"));
|
|
4880
|
+
const psPids = new Set(psPromises.map((promise) => promise.child.pid));
|
|
4881
|
+
psLines.shift();
|
|
4882
|
+
psArgsLines.shift();
|
|
4883
|
+
const processCmds = {};
|
|
4884
|
+
for (const line of psArgsLines) {
|
|
4885
|
+
const [pid, cmds] = line.trim().split(" ");
|
|
4886
|
+
processCmds[pid] = cmds.join(" ");
|
|
4887
|
+
}
|
|
4888
|
+
const processes = psLines.map((line) => {
|
|
4889
|
+
const match2 = psOutputRegex.exec(line);
|
|
4890
|
+
if (match2 === null) {
|
|
4891
|
+
throw new Error(ERROR_MESSAGE_PARSING_FAILED);
|
|
4892
|
+
}
|
|
4893
|
+
const { pid, ppid, uid, cpu, memory, comm } = match2.groups;
|
|
4894
|
+
const processInfo = {
|
|
4895
|
+
pid: Number.parseInt(pid, 10),
|
|
4896
|
+
ppid: Number.parseInt(ppid, 10),
|
|
4897
|
+
uid: Number.parseInt(uid, 10),
|
|
4898
|
+
cpu: Number.parseFloat(cpu),
|
|
4899
|
+
memory: Number.parseFloat(memory),
|
|
4900
|
+
name: path__default.default.basename(comm),
|
|
4901
|
+
cmd: processCmds[pid]
|
|
4902
|
+
};
|
|
4903
|
+
return processInfo;
|
|
4904
|
+
}).filter((processInfo) => !psPids.has(processInfo.pid));
|
|
4905
|
+
return processes;
|
|
4906
|
+
};
|
|
4907
|
+
var nonWindows = async (options = {}) => {
|
|
4908
|
+
try {
|
|
4909
|
+
return await nonWindowsCall(options);
|
|
4910
|
+
} catch {
|
|
4911
|
+
return nonWindowsMultipleCalls(options);
|
|
4912
|
+
}
|
|
4913
|
+
};
|
|
4914
|
+
var psList = process2__default.default.platform === "win32" ? windows2 : nonWindows;
|
|
4915
|
+
var ps_list_default = psList;
|
|
1709
4916
|
|
|
1710
|
-
//
|
|
1711
|
-
var
|
|
4917
|
+
// ../../node_modules/.pnpm/process-exists@5.0.0/node_modules/process-exists/index.js
|
|
4918
|
+
var linuxProcessMatchesName = (wantedProcessName, process13) => {
|
|
4919
|
+
if (typeof wantedProcessName === "string") {
|
|
4920
|
+
return process13.name === wantedProcessName || process13.cmd.split(" ")[0] === wantedProcessName;
|
|
4921
|
+
}
|
|
4922
|
+
return process13.pid === wantedProcessName;
|
|
4923
|
+
};
|
|
4924
|
+
var nonLinuxProcessMatchesName = (wantedProcessName, process13) => {
|
|
4925
|
+
if (typeof wantedProcessName === "string") {
|
|
4926
|
+
return process13.name === wantedProcessName;
|
|
4927
|
+
}
|
|
4928
|
+
return process13.pid === wantedProcessName;
|
|
4929
|
+
};
|
|
4930
|
+
var processMatchesName = process2__default.default.platform === "linux" ? linuxProcessMatchesName : nonLinuxProcessMatchesName;
|
|
4931
|
+
async function processExistsMultiple(processNames) {
|
|
4932
|
+
const processes = await ps_list_default();
|
|
4933
|
+
return new Map(processNames.map((processName) => [processName, processes.some((y) => processMatchesName(processName, y))]));
|
|
4934
|
+
}
|
|
4935
|
+
async function filterExistingProcesses(processNames) {
|
|
4936
|
+
const processes = await ps_list_default();
|
|
4937
|
+
return processNames.filter((processName) => processes.some((process_) => processMatchesName(processName, process_)));
|
|
4938
|
+
}
|
|
4939
|
+
|
|
4940
|
+
// ../../node_modules/.pnpm/fkill@9.0.0/node_modules/fkill/index.js
|
|
4941
|
+
var ALIVE_CHECK_MIN_INTERVAL = 5;
|
|
4942
|
+
var ALIVE_CHECK_MAX_INTERVAL = 1280;
|
|
4943
|
+
var TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM = 255;
|
|
4944
|
+
var delay = (ms) => new Promise((resolve) => {
|
|
4945
|
+
setTimeout(resolve, ms);
|
|
4946
|
+
});
|
|
4947
|
+
var missingBinaryError = async (command, arguments_) => {
|
|
4948
|
+
try {
|
|
4949
|
+
return await execa2(command, arguments_);
|
|
4950
|
+
} catch (error) {
|
|
4951
|
+
if (error.code === "ENOENT") {
|
|
4952
|
+
const newError = new Error(`\`${command}\` doesn't seem to be installed and is required by fkill`);
|
|
4953
|
+
newError.sourceError = error;
|
|
4954
|
+
throw newError;
|
|
4955
|
+
}
|
|
4956
|
+
throw error;
|
|
4957
|
+
}
|
|
4958
|
+
};
|
|
4959
|
+
var windowsKill = async (input, options) => {
|
|
4960
|
+
try {
|
|
4961
|
+
return await taskkill(input, {
|
|
4962
|
+
force: options.force,
|
|
4963
|
+
tree: options.tree === void 0 ? true : options.tree
|
|
4964
|
+
});
|
|
4965
|
+
} catch (error) {
|
|
4966
|
+
if (error.exitCode === TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM && !options.force) {
|
|
4967
|
+
return;
|
|
4968
|
+
}
|
|
4969
|
+
throw error;
|
|
4970
|
+
}
|
|
4971
|
+
};
|
|
4972
|
+
var macosKill = (input, options) => {
|
|
4973
|
+
const killByName = typeof input === "string";
|
|
4974
|
+
const command = killByName ? "pkill" : "kill";
|
|
4975
|
+
const arguments_ = [input];
|
|
4976
|
+
if (killByName && options.ignoreCase) {
|
|
4977
|
+
arguments_.unshift("-i");
|
|
4978
|
+
}
|
|
4979
|
+
if (killByName) {
|
|
4980
|
+
arguments_.unshift("-x");
|
|
4981
|
+
}
|
|
4982
|
+
if (options.force) {
|
|
4983
|
+
if (killByName) {
|
|
4984
|
+
arguments_.unshift("-KILL");
|
|
4985
|
+
} else {
|
|
4986
|
+
arguments_.unshift("-9");
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
return missingBinaryError(command, arguments_);
|
|
4990
|
+
};
|
|
4991
|
+
var defaultKill = (input, options) => {
|
|
4992
|
+
const killByName = typeof input === "string";
|
|
4993
|
+
const command = killByName ? "killall" : "kill";
|
|
4994
|
+
const arguments_ = [input];
|
|
4995
|
+
if (options.force) {
|
|
4996
|
+
arguments_.unshift("-9");
|
|
4997
|
+
}
|
|
4998
|
+
if (killByName && options.ignoreCase) {
|
|
4999
|
+
arguments_.unshift("-I");
|
|
5000
|
+
}
|
|
5001
|
+
return missingBinaryError(command, arguments_);
|
|
5002
|
+
};
|
|
5003
|
+
var kill = (() => {
|
|
5004
|
+
if (process2__default.default.platform === "darwin") {
|
|
5005
|
+
return macosKill;
|
|
5006
|
+
}
|
|
5007
|
+
if (process2__default.default.platform === "win32") {
|
|
5008
|
+
return windowsKill;
|
|
5009
|
+
}
|
|
5010
|
+
return defaultKill;
|
|
5011
|
+
})();
|
|
5012
|
+
var parseInput = async (input) => {
|
|
5013
|
+
if (typeof input === "string" && input[0] === ":") {
|
|
5014
|
+
return portToPid(Number.parseInt(input.slice(1), 10));
|
|
5015
|
+
}
|
|
5016
|
+
return input;
|
|
5017
|
+
};
|
|
5018
|
+
var getCurrentProcessParentsPID = (processes) => {
|
|
5019
|
+
const processMap = new Map(processes.map((ps) => [ps.pid, ps.ppid]));
|
|
5020
|
+
const pids = [];
|
|
5021
|
+
let currentId = process2__default.default.pid;
|
|
5022
|
+
while (currentId) {
|
|
5023
|
+
pids.push(currentId);
|
|
5024
|
+
currentId = processMap.get(currentId);
|
|
5025
|
+
}
|
|
5026
|
+
return pids;
|
|
5027
|
+
};
|
|
5028
|
+
var killWithLimits = async (input, options) => {
|
|
5029
|
+
input = await parseInput(input);
|
|
5030
|
+
if (input === process2__default.default.pid) {
|
|
5031
|
+
return;
|
|
5032
|
+
}
|
|
5033
|
+
if (input === "node" || input === "node.exe") {
|
|
5034
|
+
const processes = await ps_list_default();
|
|
5035
|
+
const pids = getCurrentProcessParentsPID(processes);
|
|
5036
|
+
await Promise.all(processes.map(async (ps) => {
|
|
5037
|
+
if ((ps.name === "node" || ps.name === "node.exe") && !pids.includes(ps.pid)) {
|
|
5038
|
+
await kill(ps.pid, options);
|
|
5039
|
+
}
|
|
5040
|
+
}));
|
|
5041
|
+
return;
|
|
5042
|
+
}
|
|
5043
|
+
await kill(input, options);
|
|
5044
|
+
};
|
|
5045
|
+
async function fkill(inputs, options = {}) {
|
|
5046
|
+
inputs = [inputs].flat();
|
|
5047
|
+
const exists = await processExistsMultiple(inputs);
|
|
5048
|
+
const errors = [];
|
|
5049
|
+
const handleKill = async (input) => {
|
|
5050
|
+
try {
|
|
5051
|
+
await killWithLimits(input, options);
|
|
5052
|
+
} catch (error) {
|
|
5053
|
+
if (!exists.get(input)) {
|
|
5054
|
+
errors.push(`Killing process ${input} failed: Process doesn't exist`);
|
|
5055
|
+
return;
|
|
5056
|
+
}
|
|
5057
|
+
errors.push(`Killing process ${input} failed: ${error.message.replace(/.*\n/, "").replace(/kill: \d+: /, "").trim()}`);
|
|
5058
|
+
}
|
|
5059
|
+
};
|
|
5060
|
+
await Promise.all(inputs.map((input) => handleKill(input)));
|
|
5061
|
+
if (errors.length > 0 && !options.silent) {
|
|
5062
|
+
throw new AggregateError(errors);
|
|
5063
|
+
}
|
|
5064
|
+
if (options.forceAfterTimeout !== void 0 && !options.force) {
|
|
5065
|
+
const endTime = Date.now() + options.forceAfterTimeout;
|
|
5066
|
+
let interval = ALIVE_CHECK_MIN_INTERVAL;
|
|
5067
|
+
if (interval > options.forceAfterTimeout) {
|
|
5068
|
+
interval = options.forceAfterTimeout;
|
|
5069
|
+
}
|
|
5070
|
+
let alive = inputs;
|
|
5071
|
+
do {
|
|
5072
|
+
await delay(interval);
|
|
5073
|
+
alive = await filterExistingProcesses(alive);
|
|
5074
|
+
interval *= 2;
|
|
5075
|
+
if (interval > ALIVE_CHECK_MAX_INTERVAL) {
|
|
5076
|
+
interval = ALIVE_CHECK_MAX_INTERVAL;
|
|
5077
|
+
}
|
|
5078
|
+
} while (Date.now() < endTime && alive.length > 0);
|
|
5079
|
+
if (alive.length > 0) {
|
|
5080
|
+
await Promise.all(alive.map(async (input) => {
|
|
5081
|
+
try {
|
|
5082
|
+
await killWithLimits(input, { ...options, force: true });
|
|
5083
|
+
} catch {
|
|
5084
|
+
}
|
|
5085
|
+
}));
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
}
|
|
1712
5089
|
|
|
1713
5090
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
|
|
1714
5091
|
var compose = (middleware, onError, onNotFound) => {
|
|
@@ -1826,26 +5203,26 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
1826
5203
|
};
|
|
1827
5204
|
|
|
1828
5205
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/utils/url.js
|
|
1829
|
-
var splitPath = (
|
|
1830
|
-
const paths =
|
|
5206
|
+
var splitPath = (path5) => {
|
|
5207
|
+
const paths = path5.split("/");
|
|
1831
5208
|
if (paths[0] === "") {
|
|
1832
5209
|
paths.shift();
|
|
1833
5210
|
}
|
|
1834
5211
|
return paths;
|
|
1835
5212
|
};
|
|
1836
5213
|
var splitRoutingPath = (routePath) => {
|
|
1837
|
-
const { groups, path } = extractGroupsFromPath(routePath);
|
|
1838
|
-
const paths = splitPath(
|
|
5214
|
+
const { groups, path: path5 } = extractGroupsFromPath(routePath);
|
|
5215
|
+
const paths = splitPath(path5);
|
|
1839
5216
|
return replaceGroupMarks(paths, groups);
|
|
1840
5217
|
};
|
|
1841
|
-
var extractGroupsFromPath = (
|
|
5218
|
+
var extractGroupsFromPath = (path5) => {
|
|
1842
5219
|
const groups = [];
|
|
1843
|
-
|
|
5220
|
+
path5 = path5.replace(/\{[^}]+\}/g, (match2, index) => {
|
|
1844
5221
|
const mark = `@${index}`;
|
|
1845
5222
|
groups.push([mark, match2]);
|
|
1846
5223
|
return mark;
|
|
1847
5224
|
});
|
|
1848
|
-
return { groups, path };
|
|
5225
|
+
return { groups, path: path5 };
|
|
1849
5226
|
};
|
|
1850
5227
|
var replaceGroupMarks = (paths, groups) => {
|
|
1851
5228
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
@@ -1900,8 +5277,8 @@ var getPath = (request) => {
|
|
|
1900
5277
|
const charCode = url.charCodeAt(i);
|
|
1901
5278
|
if (charCode === 37) {
|
|
1902
5279
|
const queryIndex = url.indexOf("?", i);
|
|
1903
|
-
const
|
|
1904
|
-
return tryDecodeURI(
|
|
5280
|
+
const path5 = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
|
|
5281
|
+
return tryDecodeURI(path5.includes("%25") ? path5.replace(/%25/g, "%2525") : path5);
|
|
1905
5282
|
} else if (charCode === 63) {
|
|
1906
5283
|
break;
|
|
1907
5284
|
}
|
|
@@ -1918,11 +5295,11 @@ var mergePath = (base, sub, ...rest) => {
|
|
|
1918
5295
|
}
|
|
1919
5296
|
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
|
|
1920
5297
|
};
|
|
1921
|
-
var checkOptionalParameter = (
|
|
1922
|
-
if (
|
|
5298
|
+
var checkOptionalParameter = (path5) => {
|
|
5299
|
+
if (path5.charCodeAt(path5.length - 1) !== 63 || !path5.includes(":")) {
|
|
1923
5300
|
return null;
|
|
1924
5301
|
}
|
|
1925
|
-
const segments =
|
|
5302
|
+
const segments = path5.split("/");
|
|
1926
5303
|
const results = [];
|
|
1927
5304
|
let basePath = "";
|
|
1928
5305
|
segments.forEach((segment) => {
|
|
@@ -2035,9 +5412,9 @@ var HonoRequest = class {
|
|
|
2035
5412
|
routeIndex = 0;
|
|
2036
5413
|
path;
|
|
2037
5414
|
bodyCache = {};
|
|
2038
|
-
constructor(request,
|
|
5415
|
+
constructor(request, path5 = "/", matchResult = [[]]) {
|
|
2039
5416
|
this.raw = request;
|
|
2040
|
-
this.path =
|
|
5417
|
+
this.path = path5;
|
|
2041
5418
|
this.#matchResult = matchResult;
|
|
2042
5419
|
this.#validatedData = {};
|
|
2043
5420
|
}
|
|
@@ -2398,8 +5775,8 @@ var Hono = class {
|
|
|
2398
5775
|
return this;
|
|
2399
5776
|
};
|
|
2400
5777
|
});
|
|
2401
|
-
this.on = (method,
|
|
2402
|
-
for (const p of [
|
|
5778
|
+
this.on = (method, path5, ...handlers) => {
|
|
5779
|
+
for (const p of [path5].flat()) {
|
|
2403
5780
|
this.#path = p;
|
|
2404
5781
|
for (const m of [method].flat()) {
|
|
2405
5782
|
handlers.map((handler) => {
|
|
@@ -2437,8 +5814,8 @@ var Hono = class {
|
|
|
2437
5814
|
}
|
|
2438
5815
|
#notFoundHandler = notFoundHandler;
|
|
2439
5816
|
errorHandler = errorHandler;
|
|
2440
|
-
route(
|
|
2441
|
-
const subApp = this.basePath(
|
|
5817
|
+
route(path5, app) {
|
|
5818
|
+
const subApp = this.basePath(path5);
|
|
2442
5819
|
app.routes.map((r) => {
|
|
2443
5820
|
let handler;
|
|
2444
5821
|
if (app.errorHandler === errorHandler) {
|
|
@@ -2451,9 +5828,9 @@ var Hono = class {
|
|
|
2451
5828
|
});
|
|
2452
5829
|
return this;
|
|
2453
5830
|
}
|
|
2454
|
-
basePath(
|
|
5831
|
+
basePath(path5) {
|
|
2455
5832
|
const subApp = this.#clone();
|
|
2456
|
-
subApp._basePath = mergePath(this._basePath,
|
|
5833
|
+
subApp._basePath = mergePath(this._basePath, path5);
|
|
2457
5834
|
return subApp;
|
|
2458
5835
|
}
|
|
2459
5836
|
onError = (handler) => {
|
|
@@ -2464,7 +5841,7 @@ var Hono = class {
|
|
|
2464
5841
|
this.#notFoundHandler = handler;
|
|
2465
5842
|
return this;
|
|
2466
5843
|
};
|
|
2467
|
-
mount(
|
|
5844
|
+
mount(path5, applicationHandler, options) {
|
|
2468
5845
|
let replaceRequest;
|
|
2469
5846
|
let optionHandler;
|
|
2470
5847
|
if (options) {
|
|
@@ -2491,7 +5868,7 @@ var Hono = class {
|
|
|
2491
5868
|
return [c.env, executionContext];
|
|
2492
5869
|
};
|
|
2493
5870
|
replaceRequest ||= (() => {
|
|
2494
|
-
const mergedPath = mergePath(this._basePath,
|
|
5871
|
+
const mergedPath = mergePath(this._basePath, path5);
|
|
2495
5872
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
2496
5873
|
return (request) => {
|
|
2497
5874
|
const url = new URL(request.url);
|
|
@@ -2506,14 +5883,14 @@ var Hono = class {
|
|
|
2506
5883
|
}
|
|
2507
5884
|
await next();
|
|
2508
5885
|
};
|
|
2509
|
-
this.#addRoute(METHOD_NAME_ALL, mergePath(
|
|
5886
|
+
this.#addRoute(METHOD_NAME_ALL, mergePath(path5, "*"), handler);
|
|
2510
5887
|
return this;
|
|
2511
5888
|
}
|
|
2512
|
-
#addRoute(method,
|
|
5889
|
+
#addRoute(method, path5, handler) {
|
|
2513
5890
|
method = method.toUpperCase();
|
|
2514
|
-
|
|
2515
|
-
const r = { basePath: this._basePath, path, method, handler };
|
|
2516
|
-
this.router.add(method,
|
|
5891
|
+
path5 = mergePath(this._basePath, path5);
|
|
5892
|
+
const r = { basePath: this._basePath, path: path5, method, handler };
|
|
5893
|
+
this.router.add(method, path5, [handler, r]);
|
|
2517
5894
|
this.routes.push(r);
|
|
2518
5895
|
}
|
|
2519
5896
|
#handleError(err, c) {
|
|
@@ -2526,10 +5903,10 @@ var Hono = class {
|
|
|
2526
5903
|
if (method === "HEAD") {
|
|
2527
5904
|
return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
|
|
2528
5905
|
}
|
|
2529
|
-
const
|
|
2530
|
-
const matchResult = this.router.match(method,
|
|
5906
|
+
const path5 = this.getPath(request, { env });
|
|
5907
|
+
const matchResult = this.router.match(method, path5);
|
|
2531
5908
|
const c = new Context(request, {
|
|
2532
|
-
path,
|
|
5909
|
+
path: path5,
|
|
2533
5910
|
matchResult,
|
|
2534
5911
|
env,
|
|
2535
5912
|
executionCtx,
|
|
@@ -2589,15 +5966,15 @@ var Hono = class {
|
|
|
2589
5966
|
|
|
2590
5967
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
2591
5968
|
var emptyParam = [];
|
|
2592
|
-
function match(method,
|
|
5969
|
+
function match(method, path5) {
|
|
2593
5970
|
const matchers = this.buildAllMatchers();
|
|
2594
|
-
const match2 = (method2,
|
|
5971
|
+
const match2 = (method2, path22) => {
|
|
2595
5972
|
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
|
2596
|
-
const staticMatch = matcher[2][
|
|
5973
|
+
const staticMatch = matcher[2][path22];
|
|
2597
5974
|
if (staticMatch) {
|
|
2598
5975
|
return staticMatch;
|
|
2599
5976
|
}
|
|
2600
|
-
const match3 =
|
|
5977
|
+
const match3 = path22.match(matcher[0]);
|
|
2601
5978
|
if (!match3) {
|
|
2602
5979
|
return [[], emptyParam];
|
|
2603
5980
|
}
|
|
@@ -2605,7 +5982,7 @@ function match(method, path) {
|
|
|
2605
5982
|
return [matcher[1][index], match3];
|
|
2606
5983
|
};
|
|
2607
5984
|
this.match = match2;
|
|
2608
|
-
return match2(method,
|
|
5985
|
+
return match2(method, path5);
|
|
2609
5986
|
}
|
|
2610
5987
|
|
|
2611
5988
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
@@ -2720,12 +6097,12 @@ var Node = class {
|
|
|
2720
6097
|
var Trie = class {
|
|
2721
6098
|
#context = { varIndex: 0 };
|
|
2722
6099
|
#root = new Node();
|
|
2723
|
-
insert(
|
|
6100
|
+
insert(path5, index, pathErrorCheckOnly) {
|
|
2724
6101
|
const paramAssoc = [];
|
|
2725
6102
|
const groups = [];
|
|
2726
6103
|
for (let i = 0; ; ) {
|
|
2727
6104
|
let replaced = false;
|
|
2728
|
-
|
|
6105
|
+
path5 = path5.replace(/\{[^}]+\}/g, (m) => {
|
|
2729
6106
|
const mark = `@\\${i}`;
|
|
2730
6107
|
groups[i] = [mark, m];
|
|
2731
6108
|
i++;
|
|
@@ -2736,7 +6113,7 @@ var Trie = class {
|
|
|
2736
6113
|
break;
|
|
2737
6114
|
}
|
|
2738
6115
|
}
|
|
2739
|
-
const tokens =
|
|
6116
|
+
const tokens = path5.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
2740
6117
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
2741
6118
|
const [mark] = groups[i];
|
|
2742
6119
|
for (let j = tokens.length - 1; j >= 0; j--) {
|
|
@@ -2775,9 +6152,9 @@ var Trie = class {
|
|
|
2775
6152
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
2776
6153
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
2777
6154
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
2778
|
-
function buildWildcardRegExp(
|
|
2779
|
-
return wildcardRegExpCache[
|
|
2780
|
-
|
|
6155
|
+
function buildWildcardRegExp(path5) {
|
|
6156
|
+
return wildcardRegExpCache[path5] ??= new RegExp(
|
|
6157
|
+
path5 === "*" ? "" : `^${path5.replace(
|
|
2781
6158
|
/\/\*$|([.\\+*[^\]$()])/g,
|
|
2782
6159
|
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
|
|
2783
6160
|
)}$`
|
|
@@ -2799,17 +6176,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
2799
6176
|
);
|
|
2800
6177
|
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
2801
6178
|
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
2802
|
-
const [pathErrorCheckOnly,
|
|
6179
|
+
const [pathErrorCheckOnly, path5, handlers] = routesWithStaticPathFlag[i];
|
|
2803
6180
|
if (pathErrorCheckOnly) {
|
|
2804
|
-
staticMap[
|
|
6181
|
+
staticMap[path5] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
2805
6182
|
} else {
|
|
2806
6183
|
j++;
|
|
2807
6184
|
}
|
|
2808
6185
|
let paramAssoc;
|
|
2809
6186
|
try {
|
|
2810
|
-
paramAssoc = trie.insert(
|
|
6187
|
+
paramAssoc = trie.insert(path5, j, pathErrorCheckOnly);
|
|
2811
6188
|
} catch (e) {
|
|
2812
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(
|
|
6189
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path5) : e;
|
|
2813
6190
|
}
|
|
2814
6191
|
if (pathErrorCheckOnly) {
|
|
2815
6192
|
continue;
|
|
@@ -2843,12 +6220,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
2843
6220
|
}
|
|
2844
6221
|
return [regexp, handlerMap, staticMap];
|
|
2845
6222
|
}
|
|
2846
|
-
function findMiddleware(middleware,
|
|
6223
|
+
function findMiddleware(middleware, path5) {
|
|
2847
6224
|
if (!middleware) {
|
|
2848
6225
|
return void 0;
|
|
2849
6226
|
}
|
|
2850
6227
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
2851
|
-
if (buildWildcardRegExp(k).test(
|
|
6228
|
+
if (buildWildcardRegExp(k).test(path5)) {
|
|
2852
6229
|
return [...middleware[k]];
|
|
2853
6230
|
}
|
|
2854
6231
|
}
|
|
@@ -2862,7 +6239,7 @@ var RegExpRouter = class {
|
|
|
2862
6239
|
this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
2863
6240
|
this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
2864
6241
|
}
|
|
2865
|
-
add(method,
|
|
6242
|
+
add(method, path5, handler) {
|
|
2866
6243
|
const middleware = this.#middleware;
|
|
2867
6244
|
const routes = this.#routes;
|
|
2868
6245
|
if (!middleware || !routes) {
|
|
@@ -2876,18 +6253,18 @@ var RegExpRouter = class {
|
|
|
2876
6253
|
});
|
|
2877
6254
|
});
|
|
2878
6255
|
}
|
|
2879
|
-
if (
|
|
2880
|
-
|
|
6256
|
+
if (path5 === "/*") {
|
|
6257
|
+
path5 = "*";
|
|
2881
6258
|
}
|
|
2882
|
-
const paramCount = (
|
|
2883
|
-
if (/\*$/.test(
|
|
2884
|
-
const re = buildWildcardRegExp(
|
|
6259
|
+
const paramCount = (path5.match(/\/:/g) || []).length;
|
|
6260
|
+
if (/\*$/.test(path5)) {
|
|
6261
|
+
const re = buildWildcardRegExp(path5);
|
|
2885
6262
|
if (method === METHOD_NAME_ALL) {
|
|
2886
6263
|
Object.keys(middleware).forEach((m) => {
|
|
2887
|
-
middleware[m][
|
|
6264
|
+
middleware[m][path5] ||= findMiddleware(middleware[m], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
|
|
2888
6265
|
});
|
|
2889
6266
|
} else {
|
|
2890
|
-
middleware[method][
|
|
6267
|
+
middleware[method][path5] ||= findMiddleware(middleware[method], path5) || findMiddleware(middleware[METHOD_NAME_ALL], path5) || [];
|
|
2891
6268
|
}
|
|
2892
6269
|
Object.keys(middleware).forEach((m) => {
|
|
2893
6270
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
@@ -2905,15 +6282,15 @@ var RegExpRouter = class {
|
|
|
2905
6282
|
});
|
|
2906
6283
|
return;
|
|
2907
6284
|
}
|
|
2908
|
-
const paths = checkOptionalParameter(
|
|
6285
|
+
const paths = checkOptionalParameter(path5) || [path5];
|
|
2909
6286
|
for (let i = 0, len = paths.length; i < len; i++) {
|
|
2910
|
-
const
|
|
6287
|
+
const path22 = paths[i];
|
|
2911
6288
|
Object.keys(routes).forEach((m) => {
|
|
2912
6289
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
2913
|
-
routes[m][
|
|
2914
|
-
...findMiddleware(middleware[m],
|
|
6290
|
+
routes[m][path22] ||= [
|
|
6291
|
+
...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
|
|
2915
6292
|
];
|
|
2916
|
-
routes[m][
|
|
6293
|
+
routes[m][path22].push([handler, paramCount - len + i + 1]);
|
|
2917
6294
|
}
|
|
2918
6295
|
});
|
|
2919
6296
|
}
|
|
@@ -2932,13 +6309,13 @@ var RegExpRouter = class {
|
|
|
2932
6309
|
const routes = [];
|
|
2933
6310
|
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
2934
6311
|
[this.#middleware, this.#routes].forEach((r) => {
|
|
2935
|
-
const ownRoute = r[method] ? Object.keys(r[method]).map((
|
|
6312
|
+
const ownRoute = r[method] ? Object.keys(r[method]).map((path5) => [path5, r[method][path5]]) : [];
|
|
2936
6313
|
if (ownRoute.length !== 0) {
|
|
2937
6314
|
hasOwnRoute ||= true;
|
|
2938
6315
|
routes.push(...ownRoute);
|
|
2939
6316
|
} else if (method !== METHOD_NAME_ALL) {
|
|
2940
6317
|
routes.push(
|
|
2941
|
-
...Object.keys(r[METHOD_NAME_ALL]).map((
|
|
6318
|
+
...Object.keys(r[METHOD_NAME_ALL]).map((path5) => [path5, r[METHOD_NAME_ALL][path5]])
|
|
2942
6319
|
);
|
|
2943
6320
|
}
|
|
2944
6321
|
});
|
|
@@ -2958,13 +6335,13 @@ var SmartRouter = class {
|
|
|
2958
6335
|
constructor(init) {
|
|
2959
6336
|
this.#routers = init.routers;
|
|
2960
6337
|
}
|
|
2961
|
-
add(method,
|
|
6338
|
+
add(method, path5, handler) {
|
|
2962
6339
|
if (!this.#routes) {
|
|
2963
6340
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
2964
6341
|
}
|
|
2965
|
-
this.#routes.push([method,
|
|
6342
|
+
this.#routes.push([method, path5, handler]);
|
|
2966
6343
|
}
|
|
2967
|
-
match(method,
|
|
6344
|
+
match(method, path5) {
|
|
2968
6345
|
if (!this.#routes) {
|
|
2969
6346
|
throw new Error("Fatal error");
|
|
2970
6347
|
}
|
|
@@ -2979,7 +6356,7 @@ var SmartRouter = class {
|
|
|
2979
6356
|
for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
|
|
2980
6357
|
router.add(...routes[i2]);
|
|
2981
6358
|
}
|
|
2982
|
-
res = router.match(method,
|
|
6359
|
+
res = router.match(method, path5);
|
|
2983
6360
|
} catch (e) {
|
|
2984
6361
|
if (e instanceof UnsupportedPathError) {
|
|
2985
6362
|
continue;
|
|
@@ -3023,10 +6400,10 @@ var Node2 = class {
|
|
|
3023
6400
|
}
|
|
3024
6401
|
this.#patterns = [];
|
|
3025
6402
|
}
|
|
3026
|
-
insert(method,
|
|
6403
|
+
insert(method, path5, handler) {
|
|
3027
6404
|
this.#order = ++this.#order;
|
|
3028
6405
|
let curNode = this;
|
|
3029
|
-
const parts = splitRoutingPath(
|
|
6406
|
+
const parts = splitRoutingPath(path5);
|
|
3030
6407
|
const possibleKeys = [];
|
|
3031
6408
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
3032
6409
|
const p = parts[i];
|
|
@@ -3077,12 +6454,12 @@ var Node2 = class {
|
|
|
3077
6454
|
}
|
|
3078
6455
|
return handlerSets;
|
|
3079
6456
|
}
|
|
3080
|
-
search(method,
|
|
6457
|
+
search(method, path5) {
|
|
3081
6458
|
const handlerSets = [];
|
|
3082
6459
|
this.#params = emptyParams;
|
|
3083
6460
|
const curNode = this;
|
|
3084
6461
|
let curNodes = [curNode];
|
|
3085
|
-
const parts = splitPath(
|
|
6462
|
+
const parts = splitPath(path5);
|
|
3086
6463
|
const curNodesQueue = [];
|
|
3087
6464
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
3088
6465
|
const part = parts[i];
|
|
@@ -3170,18 +6547,18 @@ var TrieRouter = class {
|
|
|
3170
6547
|
constructor() {
|
|
3171
6548
|
this.#node = new Node2();
|
|
3172
6549
|
}
|
|
3173
|
-
add(method,
|
|
3174
|
-
const results = checkOptionalParameter(
|
|
6550
|
+
add(method, path5, handler) {
|
|
6551
|
+
const results = checkOptionalParameter(path5);
|
|
3175
6552
|
if (results) {
|
|
3176
6553
|
for (let i = 0, len = results.length; i < len; i++) {
|
|
3177
6554
|
this.#node.insert(method, results[i], handler);
|
|
3178
6555
|
}
|
|
3179
6556
|
return;
|
|
3180
6557
|
}
|
|
3181
|
-
this.#node.insert(method,
|
|
6558
|
+
this.#node.insert(method, path5, handler);
|
|
3182
6559
|
}
|
|
3183
|
-
match(method,
|
|
3184
|
-
return this.#node.search(method,
|
|
6560
|
+
match(method, path5) {
|
|
6561
|
+
return this.#node.search(method, path5);
|
|
3185
6562
|
}
|
|
3186
6563
|
};
|
|
3187
6564
|
|
|
@@ -3962,16 +7339,21 @@ var import_picocolors = __toESM(require_picocolors());
|
|
|
3962
7339
|
|
|
3963
7340
|
// src/constants.ts
|
|
3964
7341
|
var DEFAULT_PORT = 6567;
|
|
3965
|
-
var VERSION = "0.0.
|
|
7342
|
+
var VERSION = "0.0.82";
|
|
7343
|
+
var OPENCODE_SDK_PORT = 4096;
|
|
7344
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3966
7345
|
var opencodeInstance = null;
|
|
3967
7346
|
var sessionMap = /* @__PURE__ */ new Map();
|
|
3968
7347
|
var abortedSessions = /* @__PURE__ */ new Set();
|
|
3969
7348
|
var lastOpencodeSessionId;
|
|
3970
7349
|
var getOpencodeClient = async () => {
|
|
3971
7350
|
if (!opencodeInstance) {
|
|
7351
|
+
await fkill(`:${OPENCODE_SDK_PORT}`, { force: true, silent: true }).catch(() => {
|
|
7352
|
+
});
|
|
7353
|
+
await sleep(100);
|
|
3972
7354
|
const instance = await createOpencode({
|
|
3973
7355
|
hostname: "127.0.0.1",
|
|
3974
|
-
port:
|
|
7356
|
+
port: OPENCODE_SDK_PORT
|
|
3975
7357
|
});
|
|
3976
7358
|
opencodeInstance = instance;
|
|
3977
7359
|
}
|
|
@@ -4102,8 +7484,9 @@ ${stderr.trim()}` : errorMessage;
|
|
|
4102
7484
|
return honoApplication;
|
|
4103
7485
|
};
|
|
4104
7486
|
var startServer = async (port = DEFAULT_PORT) => {
|
|
4105
|
-
await (
|
|
7487
|
+
await fkill(`:${port}`, { force: true, silent: true }).catch(() => {
|
|
4106
7488
|
});
|
|
7489
|
+
await sleep(100);
|
|
4107
7490
|
const honoApplication = createServer();
|
|
4108
7491
|
serve({ fetch: honoApplication.fetch, port });
|
|
4109
7492
|
console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Opencode)")}`);
|