@elizaos/cli 1.2.0 → 1.2.2

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.
Files changed (34) hide show
  1. package/dist/{chunk-7F7J7V7K.js → chunk-5RHJRZKW.js} +6 -6
  2. package/dist/chunk-GRPGGUED.js +2262 -0
  3. package/dist/{chunk-IMVD3V75.js → chunk-J5E77VTL.js} +2 -2
  4. package/dist/{chunk-GDP7OWFE.js → chunk-PMV25BM7.js} +2 -2
  5. package/dist/chunk-XB5JBFO6.js +41 -0
  6. package/dist/{chunk-RXPGZT6Z.js → chunk-YKFBLIQD.js} +154 -137
  7. package/dist/commands/agent/actions/index.js +3 -3
  8. package/dist/commands/agent/index.js +3 -3
  9. package/dist/commands/create/actions/index.js +5 -5
  10. package/dist/commands/create/index.js +6 -6
  11. package/dist/commands/shared/index.js +1 -1
  12. package/dist/index.js +35 -32
  13. package/dist/{plugin-creator-35CAJF4O.js → plugin-creator-KFTUVFYX.js} +10 -7
  14. package/dist/{registry-3LKJUU3X.js → registry-WOGFPQNY.js} +3 -3
  15. package/dist/{setup-JDB67JV2.js → setup-KAJWYH6P.js} +4 -4
  16. package/dist/templates/plugin-starter/dist/index.js +12 -2
  17. package/dist/templates/plugin-starter/dist/index.js.map +1 -1
  18. package/dist/templates/plugin-starter/package.json +1 -1
  19. package/dist/templates/plugin-starter/src/plugin.ts +16 -4
  20. package/dist/templates/project-starter/package.json +4 -4
  21. package/dist/templates/project-starter/src/plugin.ts +29 -3
  22. package/dist/templates/project-tee-starter/package.json +3 -3
  23. package/dist/{utils-SV7PQSFH.js → utils-Q5OUIPQH.js} +3 -3
  24. package/package.json +5 -6
  25. package/templates/plugin-starter/dist/.vite/manifest.json +1 -1
  26. package/templates/plugin-starter/dist/index.js +12 -2
  27. package/templates/plugin-starter/dist/index.js.map +1 -1
  28. package/templates/plugin-starter/package.json +1 -1
  29. package/templates/plugin-starter/src/plugin.ts +16 -4
  30. package/templates/project-starter/package.json +4 -4
  31. package/templates/project-starter/src/plugin.ts +29 -3
  32. package/templates/project-tee-starter/package.json +3 -3
  33. package/dist/chunk-7PPBVSWE.js +0 -166
  34. package/dist/chunk-AQ6OMR2A.js +0 -14
@@ -0,0 +1,2262 @@
1
+
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ import {
6
+ __commonJS,
7
+ __require
8
+ } from "./chunk-XB5JBFO6.js";
9
+
10
+ // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js
11
+ var require_windows = __commonJS({
12
+ "../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js"(exports, module) {
13
+ "use strict";
14
+ module.exports = isexe;
15
+ isexe.sync = sync;
16
+ var fs = __require("fs");
17
+ function checkPathExt(path, options) {
18
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
19
+ if (!pathext) {
20
+ return true;
21
+ }
22
+ pathext = pathext.split(";");
23
+ if (pathext.indexOf("") !== -1) {
24
+ return true;
25
+ }
26
+ for (var i = 0; i < pathext.length; i++) {
27
+ var p = pathext[i].toLowerCase();
28
+ if (p && path.substr(-p.length).toLowerCase() === p) {
29
+ return true;
30
+ }
31
+ }
32
+ return false;
33
+ }
34
+ function checkStat(stat, path, options) {
35
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
36
+ return false;
37
+ }
38
+ return checkPathExt(path, options);
39
+ }
40
+ function isexe(path, options, cb) {
41
+ fs.stat(path, function(er, stat) {
42
+ cb(er, er ? false : checkStat(stat, path, options));
43
+ });
44
+ }
45
+ function sync(path, options) {
46
+ return checkStat(fs.statSync(path), path, options);
47
+ }
48
+ }
49
+ });
50
+
51
+ // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js
52
+ var require_mode = __commonJS({
53
+ "../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js"(exports, module) {
54
+ "use strict";
55
+ module.exports = isexe;
56
+ isexe.sync = sync;
57
+ var fs = __require("fs");
58
+ function isexe(path, options, cb) {
59
+ fs.stat(path, function(er, stat) {
60
+ cb(er, er ? false : checkStat(stat, options));
61
+ });
62
+ }
63
+ function sync(path, options) {
64
+ return checkStat(fs.statSync(path), options);
65
+ }
66
+ function checkStat(stat, options) {
67
+ return stat.isFile() && checkMode(stat, options);
68
+ }
69
+ function checkMode(stat, options) {
70
+ var mod = stat.mode;
71
+ var uid = stat.uid;
72
+ var gid = stat.gid;
73
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
74
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
75
+ var u = parseInt("100", 8);
76
+ var g = parseInt("010", 8);
77
+ var o = parseInt("001", 8);
78
+ var ug = u | g;
79
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
80
+ return ret;
81
+ }
82
+ }
83
+ });
84
+
85
+ // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js
86
+ var require_isexe = __commonJS({
87
+ "../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js"(exports, module) {
88
+ "use strict";
89
+ var fs = __require("fs");
90
+ var core;
91
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
92
+ core = require_windows();
93
+ } else {
94
+ core = require_mode();
95
+ }
96
+ module.exports = isexe;
97
+ isexe.sync = sync;
98
+ function isexe(path, options, cb) {
99
+ if (typeof options === "function") {
100
+ cb = options;
101
+ options = {};
102
+ }
103
+ if (!cb) {
104
+ if (typeof Promise !== "function") {
105
+ throw new TypeError("callback not provided");
106
+ }
107
+ return new Promise(function(resolve, reject) {
108
+ isexe(path, options || {}, function(er, is) {
109
+ if (er) {
110
+ reject(er);
111
+ } else {
112
+ resolve(is);
113
+ }
114
+ });
115
+ });
116
+ }
117
+ core(path, options || {}, function(er, is) {
118
+ if (er) {
119
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
120
+ er = null;
121
+ is = false;
122
+ }
123
+ }
124
+ cb(er, is);
125
+ });
126
+ }
127
+ function sync(path, options) {
128
+ try {
129
+ return core.sync(path, options || {});
130
+ } catch (er) {
131
+ if (options && options.ignoreErrors || er.code === "EACCES") {
132
+ return false;
133
+ } else {
134
+ throw er;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ });
140
+
141
+ // ../../node_modules/cross-spawn/node_modules/which/which.js
142
+ var require_which = __commonJS({
143
+ "../../node_modules/cross-spawn/node_modules/which/which.js"(exports, module) {
144
+ "use strict";
145
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
146
+ var path = __require("path");
147
+ var COLON = isWindows ? ";" : ":";
148
+ var isexe = require_isexe();
149
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
150
+ var getPathInfo = (cmd, opt) => {
151
+ const colon = opt.colon || COLON;
152
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
153
+ // windows always checks the cwd first
154
+ ...isWindows ? [process.cwd()] : [],
155
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
156
+ "").split(colon)
157
+ ];
158
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
159
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
160
+ if (isWindows) {
161
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
162
+ pathExt.unshift("");
163
+ }
164
+ return {
165
+ pathEnv,
166
+ pathExt,
167
+ pathExtExe
168
+ };
169
+ };
170
+ var which = (cmd, opt, cb) => {
171
+ if (typeof opt === "function") {
172
+ cb = opt;
173
+ opt = {};
174
+ }
175
+ if (!opt)
176
+ opt = {};
177
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
178
+ const found = [];
179
+ const step = (i) => new Promise((resolve, reject) => {
180
+ if (i === pathEnv.length)
181
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
182
+ const ppRaw = pathEnv[i];
183
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
184
+ const pCmd = path.join(pathPart, cmd);
185
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
186
+ resolve(subStep(p, i, 0));
187
+ });
188
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
189
+ if (ii === pathExt.length)
190
+ return resolve(step(i + 1));
191
+ const ext = pathExt[ii];
192
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
193
+ if (!er && is) {
194
+ if (opt.all)
195
+ found.push(p + ext);
196
+ else
197
+ return resolve(p + ext);
198
+ }
199
+ return resolve(subStep(p, i, ii + 1));
200
+ });
201
+ });
202
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
203
+ };
204
+ var whichSync = (cmd, opt) => {
205
+ opt = opt || {};
206
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
207
+ const found = [];
208
+ for (let i = 0; i < pathEnv.length; i++) {
209
+ const ppRaw = pathEnv[i];
210
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
211
+ const pCmd = path.join(pathPart, cmd);
212
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
213
+ for (let j = 0; j < pathExt.length; j++) {
214
+ const cur = p + pathExt[j];
215
+ try {
216
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
217
+ if (is) {
218
+ if (opt.all)
219
+ found.push(cur);
220
+ else
221
+ return cur;
222
+ }
223
+ } catch (ex) {
224
+ }
225
+ }
226
+ }
227
+ if (opt.all && found.length)
228
+ return found;
229
+ if (opt.nothrow)
230
+ return null;
231
+ throw getNotFoundError(cmd);
232
+ };
233
+ module.exports = which;
234
+ which.sync = whichSync;
235
+ }
236
+ });
237
+
238
+ // ../../node_modules/path-key/index.js
239
+ var require_path_key = __commonJS({
240
+ "../../node_modules/path-key/index.js"(exports, module) {
241
+ "use strict";
242
+ var pathKey = (options = {}) => {
243
+ const environment = options.env || process.env;
244
+ const platform = options.platform || process.platform;
245
+ if (platform !== "win32") {
246
+ return "PATH";
247
+ }
248
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
249
+ };
250
+ module.exports = pathKey;
251
+ module.exports.default = pathKey;
252
+ }
253
+ });
254
+
255
+ // ../../node_modules/cross-spawn/lib/util/resolveCommand.js
256
+ var require_resolveCommand = __commonJS({
257
+ "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
258
+ "use strict";
259
+ var path = __require("path");
260
+ var which = require_which();
261
+ var getPathKey = require_path_key();
262
+ function resolveCommandAttempt(parsed, withoutPathExt) {
263
+ const env = parsed.options.env || process.env;
264
+ const cwd = process.cwd();
265
+ const hasCustomCwd = parsed.options.cwd != null;
266
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
267
+ if (shouldSwitchCwd) {
268
+ try {
269
+ process.chdir(parsed.options.cwd);
270
+ } catch (err) {
271
+ }
272
+ }
273
+ let resolved;
274
+ try {
275
+ resolved = which.sync(parsed.command, {
276
+ path: env[getPathKey({ env })],
277
+ pathExt: withoutPathExt ? path.delimiter : void 0
278
+ });
279
+ } catch (e) {
280
+ } finally {
281
+ if (shouldSwitchCwd) {
282
+ process.chdir(cwd);
283
+ }
284
+ }
285
+ if (resolved) {
286
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
287
+ }
288
+ return resolved;
289
+ }
290
+ function resolveCommand(parsed) {
291
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
292
+ }
293
+ module.exports = resolveCommand;
294
+ }
295
+ });
296
+
297
+ // ../../node_modules/cross-spawn/lib/util/escape.js
298
+ var require_escape = __commonJS({
299
+ "../../node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
300
+ "use strict";
301
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
302
+ function escapeCommand(arg) {
303
+ arg = arg.replace(metaCharsRegExp, "^$1");
304
+ return arg;
305
+ }
306
+ function escapeArgument(arg, doubleEscapeMetaChars) {
307
+ arg = `${arg}`;
308
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
309
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
310
+ arg = `"${arg}"`;
311
+ arg = arg.replace(metaCharsRegExp, "^$1");
312
+ if (doubleEscapeMetaChars) {
313
+ arg = arg.replace(metaCharsRegExp, "^$1");
314
+ }
315
+ return arg;
316
+ }
317
+ module.exports.command = escapeCommand;
318
+ module.exports.argument = escapeArgument;
319
+ }
320
+ });
321
+
322
+ // ../../node_modules/shebang-regex/index.js
323
+ var require_shebang_regex = __commonJS({
324
+ "../../node_modules/shebang-regex/index.js"(exports, module) {
325
+ "use strict";
326
+ module.exports = /^#!(.*)/;
327
+ }
328
+ });
329
+
330
+ // ../../node_modules/shebang-command/index.js
331
+ var require_shebang_command = __commonJS({
332
+ "../../node_modules/shebang-command/index.js"(exports, module) {
333
+ "use strict";
334
+ var shebangRegex = require_shebang_regex();
335
+ module.exports = (string = "") => {
336
+ const match = string.match(shebangRegex);
337
+ if (!match) {
338
+ return null;
339
+ }
340
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
341
+ const binary = path.split("/").pop();
342
+ if (binary === "env") {
343
+ return argument;
344
+ }
345
+ return argument ? `${binary} ${argument}` : binary;
346
+ };
347
+ }
348
+ });
349
+
350
+ // ../../node_modules/cross-spawn/lib/util/readShebang.js
351
+ var require_readShebang = __commonJS({
352
+ "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
353
+ "use strict";
354
+ var fs = __require("fs");
355
+ var shebangCommand = require_shebang_command();
356
+ function readShebang(command) {
357
+ const size = 150;
358
+ const buffer = Buffer.alloc(size);
359
+ let fd;
360
+ try {
361
+ fd = fs.openSync(command, "r");
362
+ fs.readSync(fd, buffer, 0, size, 0);
363
+ fs.closeSync(fd);
364
+ } catch (e) {
365
+ }
366
+ return shebangCommand(buffer.toString());
367
+ }
368
+ module.exports = readShebang;
369
+ }
370
+ });
371
+
372
+ // ../../node_modules/cross-spawn/lib/parse.js
373
+ var require_parse = __commonJS({
374
+ "../../node_modules/cross-spawn/lib/parse.js"(exports, module) {
375
+ "use strict";
376
+ var path = __require("path");
377
+ var resolveCommand = require_resolveCommand();
378
+ var escape = require_escape();
379
+ var readShebang = require_readShebang();
380
+ var isWin = process.platform === "win32";
381
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
382
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
383
+ function detectShebang(parsed) {
384
+ parsed.file = resolveCommand(parsed);
385
+ const shebang = parsed.file && readShebang(parsed.file);
386
+ if (shebang) {
387
+ parsed.args.unshift(parsed.file);
388
+ parsed.command = shebang;
389
+ return resolveCommand(parsed);
390
+ }
391
+ return parsed.file;
392
+ }
393
+ function parseNonShell(parsed) {
394
+ if (!isWin) {
395
+ return parsed;
396
+ }
397
+ const commandFile = detectShebang(parsed);
398
+ const needsShell = !isExecutableRegExp.test(commandFile);
399
+ if (parsed.options.forceShell || needsShell) {
400
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
401
+ parsed.command = path.normalize(parsed.command);
402
+ parsed.command = escape.command(parsed.command);
403
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
404
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
405
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
406
+ parsed.command = process.env.comspec || "cmd.exe";
407
+ parsed.options.windowsVerbatimArguments = true;
408
+ }
409
+ return parsed;
410
+ }
411
+ function parse(command, args, options) {
412
+ if (args && !Array.isArray(args)) {
413
+ options = args;
414
+ args = null;
415
+ }
416
+ args = args ? args.slice(0) : [];
417
+ options = Object.assign({}, options);
418
+ const parsed = {
419
+ command,
420
+ args,
421
+ options,
422
+ file: void 0,
423
+ original: {
424
+ command,
425
+ args
426
+ }
427
+ };
428
+ return options.shell ? parsed : parseNonShell(parsed);
429
+ }
430
+ module.exports = parse;
431
+ }
432
+ });
433
+
434
+ // ../../node_modules/cross-spawn/lib/enoent.js
435
+ var require_enoent = __commonJS({
436
+ "../../node_modules/cross-spawn/lib/enoent.js"(exports, module) {
437
+ "use strict";
438
+ var isWin = process.platform === "win32";
439
+ function notFoundError(original, syscall) {
440
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
441
+ code: "ENOENT",
442
+ errno: "ENOENT",
443
+ syscall: `${syscall} ${original.command}`,
444
+ path: original.command,
445
+ spawnargs: original.args
446
+ });
447
+ }
448
+ function hookChildProcess(cp, parsed) {
449
+ if (!isWin) {
450
+ return;
451
+ }
452
+ const originalEmit = cp.emit;
453
+ cp.emit = function(name, arg1) {
454
+ if (name === "exit") {
455
+ const err = verifyENOENT(arg1, parsed);
456
+ if (err) {
457
+ return originalEmit.call(cp, "error", err);
458
+ }
459
+ }
460
+ return originalEmit.apply(cp, arguments);
461
+ };
462
+ }
463
+ function verifyENOENT(status, parsed) {
464
+ if (isWin && status === 1 && !parsed.file) {
465
+ return notFoundError(parsed.original, "spawn");
466
+ }
467
+ return null;
468
+ }
469
+ function verifyENOENTSync(status, parsed) {
470
+ if (isWin && status === 1 && !parsed.file) {
471
+ return notFoundError(parsed.original, "spawnSync");
472
+ }
473
+ return null;
474
+ }
475
+ module.exports = {
476
+ hookChildProcess,
477
+ verifyENOENT,
478
+ verifyENOENTSync,
479
+ notFoundError
480
+ };
481
+ }
482
+ });
483
+
484
+ // ../../node_modules/cross-spawn/index.js
485
+ var require_cross_spawn = __commonJS({
486
+ "../../node_modules/cross-spawn/index.js"(exports, module) {
487
+ "use strict";
488
+ var cp = __require("child_process");
489
+ var parse = require_parse();
490
+ var enoent = require_enoent();
491
+ function spawn(command, args, options) {
492
+ const parsed = parse(command, args, options);
493
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
494
+ enoent.hookChildProcess(spawned, parsed);
495
+ return spawned;
496
+ }
497
+ function spawnSync(command, args, options) {
498
+ const parsed = parse(command, args, options);
499
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
500
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
501
+ return result;
502
+ }
503
+ module.exports = spawn;
504
+ module.exports.spawn = spawn;
505
+ module.exports.sync = spawnSync;
506
+ module.exports._parse = parse;
507
+ module.exports._enoent = enoent;
508
+ }
509
+ });
510
+
511
+ // ../../node_modules/strip-final-newline/index.js
512
+ var require_strip_final_newline = __commonJS({
513
+ "../../node_modules/strip-final-newline/index.js"(exports, module) {
514
+ "use strict";
515
+ module.exports = (input) => {
516
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
517
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
518
+ if (input[input.length - 1] === LF) {
519
+ input = input.slice(0, input.length - 1);
520
+ }
521
+ if (input[input.length - 1] === CR) {
522
+ input = input.slice(0, input.length - 1);
523
+ }
524
+ return input;
525
+ };
526
+ }
527
+ });
528
+
529
+ // ../../node_modules/npm-run-path/index.js
530
+ var require_npm_run_path = __commonJS({
531
+ "../../node_modules/npm-run-path/index.js"(exports, module) {
532
+ "use strict";
533
+ var path = __require("path");
534
+ var pathKey = require_path_key();
535
+ var npmRunPath = (options) => {
536
+ options = {
537
+ cwd: process.cwd(),
538
+ path: process.env[pathKey()],
539
+ execPath: process.execPath,
540
+ ...options
541
+ };
542
+ let previous;
543
+ let cwdPath = path.resolve(options.cwd);
544
+ const result = [];
545
+ while (previous !== cwdPath) {
546
+ result.push(path.join(cwdPath, "node_modules/.bin"));
547
+ previous = cwdPath;
548
+ cwdPath = path.resolve(cwdPath, "..");
549
+ }
550
+ const execPathDir = path.resolve(options.cwd, options.execPath, "..");
551
+ result.push(execPathDir);
552
+ return result.concat(options.path).join(path.delimiter);
553
+ };
554
+ module.exports = npmRunPath;
555
+ module.exports.default = npmRunPath;
556
+ module.exports.env = (options) => {
557
+ options = {
558
+ env: process.env,
559
+ ...options
560
+ };
561
+ const env = { ...options.env };
562
+ const path2 = pathKey({ env });
563
+ options.path = env[path2];
564
+ env[path2] = module.exports(options);
565
+ return env;
566
+ };
567
+ }
568
+ });
569
+
570
+ // ../../node_modules/mimic-fn/index.js
571
+ var require_mimic_fn = __commonJS({
572
+ "../../node_modules/mimic-fn/index.js"(exports, module) {
573
+ "use strict";
574
+ var mimicFn = (to, from) => {
575
+ for (const prop of Reflect.ownKeys(from)) {
576
+ Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
577
+ }
578
+ return to;
579
+ };
580
+ module.exports = mimicFn;
581
+ module.exports.default = mimicFn;
582
+ }
583
+ });
584
+
585
+ // ../../node_modules/onetime/index.js
586
+ var require_onetime = __commonJS({
587
+ "../../node_modules/onetime/index.js"(exports, module) {
588
+ "use strict";
589
+ var mimicFn = require_mimic_fn();
590
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
591
+ var onetime = (function_, options = {}) => {
592
+ if (typeof function_ !== "function") {
593
+ throw new TypeError("Expected a function");
594
+ }
595
+ let returnValue;
596
+ let callCount = 0;
597
+ const functionName = function_.displayName || function_.name || "<anonymous>";
598
+ const onetime2 = function(...arguments_) {
599
+ calledFunctions.set(onetime2, ++callCount);
600
+ if (callCount === 1) {
601
+ returnValue = function_.apply(this, arguments_);
602
+ function_ = null;
603
+ } else if (options.throw === true) {
604
+ throw new Error(`Function \`${functionName}\` can only be called once`);
605
+ }
606
+ return returnValue;
607
+ };
608
+ mimicFn(onetime2, function_);
609
+ calledFunctions.set(onetime2, callCount);
610
+ return onetime2;
611
+ };
612
+ module.exports = onetime;
613
+ module.exports.default = onetime;
614
+ module.exports.callCount = (function_) => {
615
+ if (!calledFunctions.has(function_)) {
616
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
617
+ }
618
+ return calledFunctions.get(function_);
619
+ };
620
+ }
621
+ });
622
+
623
+ // ../../node_modules/human-signals/build/src/core.js
624
+ var require_core = __commonJS({
625
+ "../../node_modules/human-signals/build/src/core.js"(exports) {
626
+ "use strict";
627
+ Object.defineProperty(exports, "__esModule", { value: true });
628
+ exports.SIGNALS = void 0;
629
+ var SIGNALS = [
630
+ {
631
+ name: "SIGHUP",
632
+ number: 1,
633
+ action: "terminate",
634
+ description: "Terminal closed",
635
+ standard: "posix"
636
+ },
637
+ {
638
+ name: "SIGINT",
639
+ number: 2,
640
+ action: "terminate",
641
+ description: "User interruption with CTRL-C",
642
+ standard: "ansi"
643
+ },
644
+ {
645
+ name: "SIGQUIT",
646
+ number: 3,
647
+ action: "core",
648
+ description: "User interruption with CTRL-\\",
649
+ standard: "posix"
650
+ },
651
+ {
652
+ name: "SIGILL",
653
+ number: 4,
654
+ action: "core",
655
+ description: "Invalid machine instruction",
656
+ standard: "ansi"
657
+ },
658
+ {
659
+ name: "SIGTRAP",
660
+ number: 5,
661
+ action: "core",
662
+ description: "Debugger breakpoint",
663
+ standard: "posix"
664
+ },
665
+ {
666
+ name: "SIGABRT",
667
+ number: 6,
668
+ action: "core",
669
+ description: "Aborted",
670
+ standard: "ansi"
671
+ },
672
+ {
673
+ name: "SIGIOT",
674
+ number: 6,
675
+ action: "core",
676
+ description: "Aborted",
677
+ standard: "bsd"
678
+ },
679
+ {
680
+ name: "SIGBUS",
681
+ number: 7,
682
+ action: "core",
683
+ description: "Bus error due to misaligned, non-existing address or paging error",
684
+ standard: "bsd"
685
+ },
686
+ {
687
+ name: "SIGEMT",
688
+ number: 7,
689
+ action: "terminate",
690
+ description: "Command should be emulated but is not implemented",
691
+ standard: "other"
692
+ },
693
+ {
694
+ name: "SIGFPE",
695
+ number: 8,
696
+ action: "core",
697
+ description: "Floating point arithmetic error",
698
+ standard: "ansi"
699
+ },
700
+ {
701
+ name: "SIGKILL",
702
+ number: 9,
703
+ action: "terminate",
704
+ description: "Forced termination",
705
+ standard: "posix",
706
+ forced: true
707
+ },
708
+ {
709
+ name: "SIGUSR1",
710
+ number: 10,
711
+ action: "terminate",
712
+ description: "Application-specific signal",
713
+ standard: "posix"
714
+ },
715
+ {
716
+ name: "SIGSEGV",
717
+ number: 11,
718
+ action: "core",
719
+ description: "Segmentation fault",
720
+ standard: "ansi"
721
+ },
722
+ {
723
+ name: "SIGUSR2",
724
+ number: 12,
725
+ action: "terminate",
726
+ description: "Application-specific signal",
727
+ standard: "posix"
728
+ },
729
+ {
730
+ name: "SIGPIPE",
731
+ number: 13,
732
+ action: "terminate",
733
+ description: "Broken pipe or socket",
734
+ standard: "posix"
735
+ },
736
+ {
737
+ name: "SIGALRM",
738
+ number: 14,
739
+ action: "terminate",
740
+ description: "Timeout or timer",
741
+ standard: "posix"
742
+ },
743
+ {
744
+ name: "SIGTERM",
745
+ number: 15,
746
+ action: "terminate",
747
+ description: "Termination",
748
+ standard: "ansi"
749
+ },
750
+ {
751
+ name: "SIGSTKFLT",
752
+ number: 16,
753
+ action: "terminate",
754
+ description: "Stack is empty or overflowed",
755
+ standard: "other"
756
+ },
757
+ {
758
+ name: "SIGCHLD",
759
+ number: 17,
760
+ action: "ignore",
761
+ description: "Child process terminated, paused or unpaused",
762
+ standard: "posix"
763
+ },
764
+ {
765
+ name: "SIGCLD",
766
+ number: 17,
767
+ action: "ignore",
768
+ description: "Child process terminated, paused or unpaused",
769
+ standard: "other"
770
+ },
771
+ {
772
+ name: "SIGCONT",
773
+ number: 18,
774
+ action: "unpause",
775
+ description: "Unpaused",
776
+ standard: "posix",
777
+ forced: true
778
+ },
779
+ {
780
+ name: "SIGSTOP",
781
+ number: 19,
782
+ action: "pause",
783
+ description: "Paused",
784
+ standard: "posix",
785
+ forced: true
786
+ },
787
+ {
788
+ name: "SIGTSTP",
789
+ number: 20,
790
+ action: "pause",
791
+ description: 'Paused using CTRL-Z or "suspend"',
792
+ standard: "posix"
793
+ },
794
+ {
795
+ name: "SIGTTIN",
796
+ number: 21,
797
+ action: "pause",
798
+ description: "Background process cannot read terminal input",
799
+ standard: "posix"
800
+ },
801
+ {
802
+ name: "SIGBREAK",
803
+ number: 21,
804
+ action: "terminate",
805
+ description: "User interruption with CTRL-BREAK",
806
+ standard: "other"
807
+ },
808
+ {
809
+ name: "SIGTTOU",
810
+ number: 22,
811
+ action: "pause",
812
+ description: "Background process cannot write to terminal output",
813
+ standard: "posix"
814
+ },
815
+ {
816
+ name: "SIGURG",
817
+ number: 23,
818
+ action: "ignore",
819
+ description: "Socket received out-of-band data",
820
+ standard: "bsd"
821
+ },
822
+ {
823
+ name: "SIGXCPU",
824
+ number: 24,
825
+ action: "core",
826
+ description: "Process timed out",
827
+ standard: "bsd"
828
+ },
829
+ {
830
+ name: "SIGXFSZ",
831
+ number: 25,
832
+ action: "core",
833
+ description: "File too big",
834
+ standard: "bsd"
835
+ },
836
+ {
837
+ name: "SIGVTALRM",
838
+ number: 26,
839
+ action: "terminate",
840
+ description: "Timeout or timer",
841
+ standard: "bsd"
842
+ },
843
+ {
844
+ name: "SIGPROF",
845
+ number: 27,
846
+ action: "terminate",
847
+ description: "Timeout or timer",
848
+ standard: "bsd"
849
+ },
850
+ {
851
+ name: "SIGWINCH",
852
+ number: 28,
853
+ action: "ignore",
854
+ description: "Terminal window size changed",
855
+ standard: "bsd"
856
+ },
857
+ {
858
+ name: "SIGIO",
859
+ number: 29,
860
+ action: "terminate",
861
+ description: "I/O is available",
862
+ standard: "other"
863
+ },
864
+ {
865
+ name: "SIGPOLL",
866
+ number: 29,
867
+ action: "terminate",
868
+ description: "Watched event",
869
+ standard: "other"
870
+ },
871
+ {
872
+ name: "SIGINFO",
873
+ number: 29,
874
+ action: "ignore",
875
+ description: "Request for process information",
876
+ standard: "other"
877
+ },
878
+ {
879
+ name: "SIGPWR",
880
+ number: 30,
881
+ action: "terminate",
882
+ description: "Device running out of power",
883
+ standard: "systemv"
884
+ },
885
+ {
886
+ name: "SIGSYS",
887
+ number: 31,
888
+ action: "core",
889
+ description: "Invalid system call",
890
+ standard: "other"
891
+ },
892
+ {
893
+ name: "SIGUNUSED",
894
+ number: 31,
895
+ action: "terminate",
896
+ description: "Invalid system call",
897
+ standard: "other"
898
+ }
899
+ ];
900
+ exports.SIGNALS = SIGNALS;
901
+ }
902
+ });
903
+
904
+ // ../../node_modules/human-signals/build/src/realtime.js
905
+ var require_realtime = __commonJS({
906
+ "../../node_modules/human-signals/build/src/realtime.js"(exports) {
907
+ "use strict";
908
+ Object.defineProperty(exports, "__esModule", { value: true });
909
+ exports.SIGRTMAX = exports.getRealtimeSignals = void 0;
910
+ var getRealtimeSignals = function() {
911
+ const length = SIGRTMAX - SIGRTMIN + 1;
912
+ return Array.from({ length }, getRealtimeSignal);
913
+ };
914
+ exports.getRealtimeSignals = getRealtimeSignals;
915
+ var getRealtimeSignal = function(value, index) {
916
+ return {
917
+ name: `SIGRT${index + 1}`,
918
+ number: SIGRTMIN + index,
919
+ action: "terminate",
920
+ description: "Application-specific signal (realtime)",
921
+ standard: "posix"
922
+ };
923
+ };
924
+ var SIGRTMIN = 34;
925
+ var SIGRTMAX = 64;
926
+ exports.SIGRTMAX = SIGRTMAX;
927
+ }
928
+ });
929
+
930
+ // ../../node_modules/human-signals/build/src/signals.js
931
+ var require_signals = __commonJS({
932
+ "../../node_modules/human-signals/build/src/signals.js"(exports) {
933
+ "use strict";
934
+ Object.defineProperty(exports, "__esModule", { value: true });
935
+ exports.getSignals = void 0;
936
+ var _os = __require("os");
937
+ var _core = require_core();
938
+ var _realtime = require_realtime();
939
+ var getSignals = function() {
940
+ const realtimeSignals = (0, _realtime.getRealtimeSignals)();
941
+ const signals = [..._core.SIGNALS, ...realtimeSignals].map(normalizeSignal);
942
+ return signals;
943
+ };
944
+ exports.getSignals = getSignals;
945
+ var normalizeSignal = function({
946
+ name,
947
+ number: defaultNumber,
948
+ description,
949
+ action,
950
+ forced = false,
951
+ standard
952
+ }) {
953
+ const {
954
+ signals: { [name]: constantSignal }
955
+ } = _os.constants;
956
+ const supported = constantSignal !== void 0;
957
+ const number = supported ? constantSignal : defaultNumber;
958
+ return { name, number, description, supported, action, forced, standard };
959
+ };
960
+ }
961
+ });
962
+
963
+ // ../../node_modules/human-signals/build/src/main.js
964
+ var require_main = __commonJS({
965
+ "../../node_modules/human-signals/build/src/main.js"(exports) {
966
+ "use strict";
967
+ Object.defineProperty(exports, "__esModule", { value: true });
968
+ exports.signalsByNumber = exports.signalsByName = void 0;
969
+ var _os = __require("os");
970
+ var _signals = require_signals();
971
+ var _realtime = require_realtime();
972
+ var getSignalsByName = function() {
973
+ const signals = (0, _signals.getSignals)();
974
+ return signals.reduce(getSignalByName, {});
975
+ };
976
+ var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
977
+ return {
978
+ ...signalByNameMemo,
979
+ [name]: { name, number, description, supported, action, forced, standard }
980
+ };
981
+ };
982
+ var signalsByName = getSignalsByName();
983
+ exports.signalsByName = signalsByName;
984
+ var getSignalsByNumber = function() {
985
+ const signals = (0, _signals.getSignals)();
986
+ const length = _realtime.SIGRTMAX + 1;
987
+ const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals));
988
+ return Object.assign({}, ...signalsA);
989
+ };
990
+ var getSignalByNumber = function(number, signals) {
991
+ const signal = findSignalByNumber(number, signals);
992
+ if (signal === void 0) {
993
+ return {};
994
+ }
995
+ const { name, description, supported, action, forced, standard } = signal;
996
+ return {
997
+ [number]: {
998
+ name,
999
+ number,
1000
+ description,
1001
+ supported,
1002
+ action,
1003
+ forced,
1004
+ standard
1005
+ }
1006
+ };
1007
+ };
1008
+ var findSignalByNumber = function(number, signals) {
1009
+ const signal = signals.find(({ name }) => _os.constants.signals[name] === number);
1010
+ if (signal !== void 0) {
1011
+ return signal;
1012
+ }
1013
+ return signals.find((signalA) => signalA.number === number);
1014
+ };
1015
+ var signalsByNumber = getSignalsByNumber();
1016
+ exports.signalsByNumber = signalsByNumber;
1017
+ }
1018
+ });
1019
+
1020
+ // ../../node_modules/execa/lib/error.js
1021
+ var require_error = __commonJS({
1022
+ "../../node_modules/execa/lib/error.js"(exports, module) {
1023
+ "use strict";
1024
+ var { signalsByName } = require_main();
1025
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1026
+ if (timedOut) {
1027
+ return `timed out after ${timeout} milliseconds`;
1028
+ }
1029
+ if (isCanceled) {
1030
+ return "was canceled";
1031
+ }
1032
+ if (errorCode !== void 0) {
1033
+ return `failed with ${errorCode}`;
1034
+ }
1035
+ if (signal !== void 0) {
1036
+ return `was killed with ${signal} (${signalDescription})`;
1037
+ }
1038
+ if (exitCode !== void 0) {
1039
+ return `failed with exit code ${exitCode}`;
1040
+ }
1041
+ return "failed";
1042
+ };
1043
+ var makeError = ({
1044
+ stdout,
1045
+ stderr,
1046
+ all,
1047
+ error,
1048
+ signal,
1049
+ exitCode,
1050
+ command,
1051
+ timedOut,
1052
+ isCanceled,
1053
+ killed,
1054
+ parsed: { options: { timeout } }
1055
+ }) => {
1056
+ exitCode = exitCode === null ? void 0 : exitCode;
1057
+ signal = signal === null ? void 0 : signal;
1058
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1059
+ const errorCode = error && error.code;
1060
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1061
+ const execaMessage = `Command ${prefix}: ${command}`;
1062
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1063
+ const shortMessage = isError ? `${execaMessage}
1064
+ ${error.message}` : execaMessage;
1065
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1066
+ if (isError) {
1067
+ error.originalMessage = error.message;
1068
+ error.message = message;
1069
+ } else {
1070
+ error = new Error(message);
1071
+ }
1072
+ error.shortMessage = shortMessage;
1073
+ error.command = command;
1074
+ error.exitCode = exitCode;
1075
+ error.signal = signal;
1076
+ error.signalDescription = signalDescription;
1077
+ error.stdout = stdout;
1078
+ error.stderr = stderr;
1079
+ if (all !== void 0) {
1080
+ error.all = all;
1081
+ }
1082
+ if ("bufferedData" in error) {
1083
+ delete error.bufferedData;
1084
+ }
1085
+ error.failed = true;
1086
+ error.timedOut = Boolean(timedOut);
1087
+ error.isCanceled = isCanceled;
1088
+ error.killed = killed && !timedOut;
1089
+ return error;
1090
+ };
1091
+ module.exports = makeError;
1092
+ }
1093
+ });
1094
+
1095
+ // ../../node_modules/execa/lib/stdio.js
1096
+ var require_stdio = __commonJS({
1097
+ "../../node_modules/execa/lib/stdio.js"(exports, module) {
1098
+ "use strict";
1099
+ var aliases = ["stdin", "stdout", "stderr"];
1100
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1101
+ var normalizeStdio = (options) => {
1102
+ if (!options) {
1103
+ return;
1104
+ }
1105
+ const { stdio } = options;
1106
+ if (stdio === void 0) {
1107
+ return aliases.map((alias) => options[alias]);
1108
+ }
1109
+ if (hasAlias(options)) {
1110
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1111
+ }
1112
+ if (typeof stdio === "string") {
1113
+ return stdio;
1114
+ }
1115
+ if (!Array.isArray(stdio)) {
1116
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1117
+ }
1118
+ const length = Math.max(stdio.length, aliases.length);
1119
+ return Array.from({ length }, (value, index) => stdio[index]);
1120
+ };
1121
+ module.exports = normalizeStdio;
1122
+ module.exports.node = (options) => {
1123
+ const stdio = normalizeStdio(options);
1124
+ if (stdio === "ipc") {
1125
+ return "ipc";
1126
+ }
1127
+ if (stdio === void 0 || typeof stdio === "string") {
1128
+ return [stdio, stdio, stdio, "ipc"];
1129
+ }
1130
+ if (stdio.includes("ipc")) {
1131
+ return stdio;
1132
+ }
1133
+ return [...stdio, "ipc"];
1134
+ };
1135
+ }
1136
+ });
1137
+
1138
+ // ../../node_modules/signal-exit/signals.js
1139
+ var require_signals2 = __commonJS({
1140
+ "../../node_modules/signal-exit/signals.js"(exports, module) {
1141
+ "use strict";
1142
+ module.exports = [
1143
+ "SIGABRT",
1144
+ "SIGALRM",
1145
+ "SIGHUP",
1146
+ "SIGINT",
1147
+ "SIGTERM"
1148
+ ];
1149
+ if (process.platform !== "win32") {
1150
+ module.exports.push(
1151
+ "SIGVTALRM",
1152
+ "SIGXCPU",
1153
+ "SIGXFSZ",
1154
+ "SIGUSR2",
1155
+ "SIGTRAP",
1156
+ "SIGSYS",
1157
+ "SIGQUIT",
1158
+ "SIGIOT"
1159
+ // should detect profiler and enable/disable accordingly.
1160
+ // see #21
1161
+ // 'SIGPROF'
1162
+ );
1163
+ }
1164
+ if (process.platform === "linux") {
1165
+ module.exports.push(
1166
+ "SIGIO",
1167
+ "SIGPOLL",
1168
+ "SIGPWR",
1169
+ "SIGSTKFLT",
1170
+ "SIGUNUSED"
1171
+ );
1172
+ }
1173
+ }
1174
+ });
1175
+
1176
+ // ../../node_modules/signal-exit/index.js
1177
+ var require_signal_exit = __commonJS({
1178
+ "../../node_modules/signal-exit/index.js"(exports, module) {
1179
+ "use strict";
1180
+ var process2 = global.process;
1181
+ var processOk = function(process3) {
1182
+ return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
1183
+ };
1184
+ if (!processOk(process2)) {
1185
+ module.exports = function() {
1186
+ return function() {
1187
+ };
1188
+ };
1189
+ } else {
1190
+ assert = __require("assert");
1191
+ signals = require_signals2();
1192
+ isWin = /^win/i.test(process2.platform);
1193
+ EE = __require("events");
1194
+ if (typeof EE !== "function") {
1195
+ EE = EE.EventEmitter;
1196
+ }
1197
+ if (process2.__signal_exit_emitter__) {
1198
+ emitter = process2.__signal_exit_emitter__;
1199
+ } else {
1200
+ emitter = process2.__signal_exit_emitter__ = new EE();
1201
+ emitter.count = 0;
1202
+ emitter.emitted = {};
1203
+ }
1204
+ if (!emitter.infinite) {
1205
+ emitter.setMaxListeners(Infinity);
1206
+ emitter.infinite = true;
1207
+ }
1208
+ module.exports = function(cb, opts) {
1209
+ if (!processOk(global.process)) {
1210
+ return function() {
1211
+ };
1212
+ }
1213
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1214
+ if (loaded === false) {
1215
+ load();
1216
+ }
1217
+ var ev = "exit";
1218
+ if (opts && opts.alwaysLast) {
1219
+ ev = "afterexit";
1220
+ }
1221
+ var remove = function() {
1222
+ emitter.removeListener(ev, cb);
1223
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1224
+ unload();
1225
+ }
1226
+ };
1227
+ emitter.on(ev, cb);
1228
+ return remove;
1229
+ };
1230
+ unload = function unload2() {
1231
+ if (!loaded || !processOk(global.process)) {
1232
+ return;
1233
+ }
1234
+ loaded = false;
1235
+ signals.forEach(function(sig) {
1236
+ try {
1237
+ process2.removeListener(sig, sigListeners[sig]);
1238
+ } catch (er) {
1239
+ }
1240
+ });
1241
+ process2.emit = originalProcessEmit;
1242
+ process2.reallyExit = originalProcessReallyExit;
1243
+ emitter.count -= 1;
1244
+ };
1245
+ module.exports.unload = unload;
1246
+ emit = function emit2(event, code, signal) {
1247
+ if (emitter.emitted[event]) {
1248
+ return;
1249
+ }
1250
+ emitter.emitted[event] = true;
1251
+ emitter.emit(event, code, signal);
1252
+ };
1253
+ sigListeners = {};
1254
+ signals.forEach(function(sig) {
1255
+ sigListeners[sig] = function listener() {
1256
+ if (!processOk(global.process)) {
1257
+ return;
1258
+ }
1259
+ var listeners = process2.listeners(sig);
1260
+ if (listeners.length === emitter.count) {
1261
+ unload();
1262
+ emit("exit", null, sig);
1263
+ emit("afterexit", null, sig);
1264
+ if (isWin && sig === "SIGHUP") {
1265
+ sig = "SIGINT";
1266
+ }
1267
+ process2.kill(process2.pid, sig);
1268
+ }
1269
+ };
1270
+ });
1271
+ module.exports.signals = function() {
1272
+ return signals;
1273
+ };
1274
+ loaded = false;
1275
+ load = function load2() {
1276
+ if (loaded || !processOk(global.process)) {
1277
+ return;
1278
+ }
1279
+ loaded = true;
1280
+ emitter.count += 1;
1281
+ signals = signals.filter(function(sig) {
1282
+ try {
1283
+ process2.on(sig, sigListeners[sig]);
1284
+ return true;
1285
+ } catch (er) {
1286
+ return false;
1287
+ }
1288
+ });
1289
+ process2.emit = processEmit;
1290
+ process2.reallyExit = processReallyExit;
1291
+ };
1292
+ module.exports.load = load;
1293
+ originalProcessReallyExit = process2.reallyExit;
1294
+ processReallyExit = function processReallyExit2(code) {
1295
+ if (!processOk(global.process)) {
1296
+ return;
1297
+ }
1298
+ process2.exitCode = code || /* istanbul ignore next */
1299
+ 0;
1300
+ emit("exit", process2.exitCode, null);
1301
+ emit("afterexit", process2.exitCode, null);
1302
+ originalProcessReallyExit.call(process2, process2.exitCode);
1303
+ };
1304
+ originalProcessEmit = process2.emit;
1305
+ processEmit = function processEmit2(ev, arg) {
1306
+ if (ev === "exit" && processOk(global.process)) {
1307
+ if (arg !== void 0) {
1308
+ process2.exitCode = arg;
1309
+ }
1310
+ var ret = originalProcessEmit.apply(this, arguments);
1311
+ emit("exit", process2.exitCode, null);
1312
+ emit("afterexit", process2.exitCode, null);
1313
+ return ret;
1314
+ } else {
1315
+ return originalProcessEmit.apply(this, arguments);
1316
+ }
1317
+ };
1318
+ }
1319
+ var assert;
1320
+ var signals;
1321
+ var isWin;
1322
+ var EE;
1323
+ var emitter;
1324
+ var unload;
1325
+ var emit;
1326
+ var sigListeners;
1327
+ var loaded;
1328
+ var load;
1329
+ var originalProcessReallyExit;
1330
+ var processReallyExit;
1331
+ var originalProcessEmit;
1332
+ var processEmit;
1333
+ }
1334
+ });
1335
+
1336
+ // ../../node_modules/execa/lib/kill.js
1337
+ var require_kill = __commonJS({
1338
+ "../../node_modules/execa/lib/kill.js"(exports, module) {
1339
+ "use strict";
1340
+ var os = __require("os");
1341
+ var onExit = require_signal_exit();
1342
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1343
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1344
+ const killResult = kill(signal);
1345
+ setKillTimeout(kill, signal, options, killResult);
1346
+ return killResult;
1347
+ };
1348
+ var setKillTimeout = (kill, signal, options, killResult) => {
1349
+ if (!shouldForceKill(signal, options, killResult)) {
1350
+ return;
1351
+ }
1352
+ const timeout = getForceKillAfterTimeout(options);
1353
+ const t = setTimeout(() => {
1354
+ kill("SIGKILL");
1355
+ }, timeout);
1356
+ if (t.unref) {
1357
+ t.unref();
1358
+ }
1359
+ };
1360
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => {
1361
+ return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1362
+ };
1363
+ var isSigterm = (signal) => {
1364
+ return signal === os.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1365
+ };
1366
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1367
+ if (forceKillAfterTimeout === true) {
1368
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1369
+ }
1370
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1371
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1372
+ }
1373
+ return forceKillAfterTimeout;
1374
+ };
1375
+ var spawnedCancel = (spawned, context) => {
1376
+ const killResult = spawned.kill();
1377
+ if (killResult) {
1378
+ context.isCanceled = true;
1379
+ }
1380
+ };
1381
+ var timeoutKill = (spawned, signal, reject) => {
1382
+ spawned.kill(signal);
1383
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1384
+ };
1385
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1386
+ if (timeout === 0 || timeout === void 0) {
1387
+ return spawnedPromise;
1388
+ }
1389
+ if (!Number.isFinite(timeout) || timeout < 0) {
1390
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1391
+ }
1392
+ let timeoutId;
1393
+ const timeoutPromise = new Promise((resolve, reject) => {
1394
+ timeoutId = setTimeout(() => {
1395
+ timeoutKill(spawned, killSignal, reject);
1396
+ }, timeout);
1397
+ });
1398
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1399
+ clearTimeout(timeoutId);
1400
+ });
1401
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1402
+ };
1403
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1404
+ if (!cleanup || detached) {
1405
+ return timedPromise;
1406
+ }
1407
+ const removeExitHandler = onExit(() => {
1408
+ spawned.kill();
1409
+ });
1410
+ return timedPromise.finally(() => {
1411
+ removeExitHandler();
1412
+ });
1413
+ };
1414
+ module.exports = {
1415
+ spawnedKill,
1416
+ spawnedCancel,
1417
+ setupTimeout,
1418
+ setExitHandler
1419
+ };
1420
+ }
1421
+ });
1422
+
1423
+ // ../../node_modules/is-stream/index.js
1424
+ var require_is_stream = __commonJS({
1425
+ "../../node_modules/is-stream/index.js"(exports, module) {
1426
+ "use strict";
1427
+ var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1428
+ isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1429
+ isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
1430
+ isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream);
1431
+ isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function" && typeof stream._transformState === "object";
1432
+ module.exports = isStream;
1433
+ }
1434
+ });
1435
+
1436
+ // ../../node_modules/get-stream/buffer-stream.js
1437
+ var require_buffer_stream = __commonJS({
1438
+ "../../node_modules/get-stream/buffer-stream.js"(exports, module) {
1439
+ "use strict";
1440
+ var { PassThrough: PassThroughStream } = __require("stream");
1441
+ module.exports = (options) => {
1442
+ options = { ...options };
1443
+ const { array } = options;
1444
+ let { encoding } = options;
1445
+ const isBuffer = encoding === "buffer";
1446
+ let objectMode = false;
1447
+ if (array) {
1448
+ objectMode = !(encoding || isBuffer);
1449
+ } else {
1450
+ encoding = encoding || "utf8";
1451
+ }
1452
+ if (isBuffer) {
1453
+ encoding = null;
1454
+ }
1455
+ const stream = new PassThroughStream({ objectMode });
1456
+ if (encoding) {
1457
+ stream.setEncoding(encoding);
1458
+ }
1459
+ let length = 0;
1460
+ const chunks = [];
1461
+ stream.on("data", (chunk) => {
1462
+ chunks.push(chunk);
1463
+ if (objectMode) {
1464
+ length = chunks.length;
1465
+ } else {
1466
+ length += chunk.length;
1467
+ }
1468
+ });
1469
+ stream.getBufferedValue = () => {
1470
+ if (array) {
1471
+ return chunks;
1472
+ }
1473
+ return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
1474
+ };
1475
+ stream.getBufferedLength = () => length;
1476
+ return stream;
1477
+ };
1478
+ }
1479
+ });
1480
+
1481
+ // ../../node_modules/get-stream/index.js
1482
+ var require_get_stream = __commonJS({
1483
+ "../../node_modules/get-stream/index.js"(exports, module) {
1484
+ "use strict";
1485
+ var { constants: BufferConstants } = __require("buffer");
1486
+ var stream = __require("stream");
1487
+ var { promisify } = __require("util");
1488
+ var bufferStream = require_buffer_stream();
1489
+ var streamPipelinePromisified = promisify(stream.pipeline);
1490
+ var MaxBufferError = class extends Error {
1491
+ constructor() {
1492
+ super("maxBuffer exceeded");
1493
+ this.name = "MaxBufferError";
1494
+ }
1495
+ };
1496
+ async function getStream(inputStream, options) {
1497
+ if (!inputStream) {
1498
+ throw new Error("Expected a stream");
1499
+ }
1500
+ options = {
1501
+ maxBuffer: Infinity,
1502
+ ...options
1503
+ };
1504
+ const { maxBuffer } = options;
1505
+ const stream2 = bufferStream(options);
1506
+ await new Promise((resolve, reject) => {
1507
+ const rejectPromise = (error) => {
1508
+ if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
1509
+ error.bufferedData = stream2.getBufferedValue();
1510
+ }
1511
+ reject(error);
1512
+ };
1513
+ (async () => {
1514
+ try {
1515
+ await streamPipelinePromisified(inputStream, stream2);
1516
+ resolve();
1517
+ } catch (error) {
1518
+ rejectPromise(error);
1519
+ }
1520
+ })();
1521
+ stream2.on("data", () => {
1522
+ if (stream2.getBufferedLength() > maxBuffer) {
1523
+ rejectPromise(new MaxBufferError());
1524
+ }
1525
+ });
1526
+ });
1527
+ return stream2.getBufferedValue();
1528
+ }
1529
+ module.exports = getStream;
1530
+ module.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
1531
+ module.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
1532
+ module.exports.MaxBufferError = MaxBufferError;
1533
+ }
1534
+ });
1535
+
1536
+ // ../../node_modules/merge-stream/index.js
1537
+ var require_merge_stream = __commonJS({
1538
+ "../../node_modules/merge-stream/index.js"(exports, module) {
1539
+ "use strict";
1540
+ var { PassThrough } = __require("stream");
1541
+ module.exports = function() {
1542
+ var sources = [];
1543
+ var output = new PassThrough({ objectMode: true });
1544
+ output.setMaxListeners(0);
1545
+ output.add = add;
1546
+ output.isEmpty = isEmpty;
1547
+ output.on("unpipe", remove);
1548
+ Array.prototype.slice.call(arguments).forEach(add);
1549
+ return output;
1550
+ function add(source) {
1551
+ if (Array.isArray(source)) {
1552
+ source.forEach(add);
1553
+ return this;
1554
+ }
1555
+ sources.push(source);
1556
+ source.once("end", remove.bind(null, source));
1557
+ source.once("error", output.emit.bind(output, "error"));
1558
+ source.pipe(output, { end: false });
1559
+ return this;
1560
+ }
1561
+ function isEmpty() {
1562
+ return sources.length == 0;
1563
+ }
1564
+ function remove(source) {
1565
+ sources = sources.filter(function(it) {
1566
+ return it !== source;
1567
+ });
1568
+ if (!sources.length && output.readable) {
1569
+ output.end();
1570
+ }
1571
+ }
1572
+ };
1573
+ }
1574
+ });
1575
+
1576
+ // ../../node_modules/execa/lib/stream.js
1577
+ var require_stream = __commonJS({
1578
+ "../../node_modules/execa/lib/stream.js"(exports, module) {
1579
+ "use strict";
1580
+ var isStream = require_is_stream();
1581
+ var getStream = require_get_stream();
1582
+ var mergeStream = require_merge_stream();
1583
+ var handleInput = (spawned, input) => {
1584
+ if (input === void 0 || spawned.stdin === void 0) {
1585
+ return;
1586
+ }
1587
+ if (isStream(input)) {
1588
+ input.pipe(spawned.stdin);
1589
+ } else {
1590
+ spawned.stdin.end(input);
1591
+ }
1592
+ };
1593
+ var makeAllStream = (spawned, { all }) => {
1594
+ if (!all || !spawned.stdout && !spawned.stderr) {
1595
+ return;
1596
+ }
1597
+ const mixed = mergeStream();
1598
+ if (spawned.stdout) {
1599
+ mixed.add(spawned.stdout);
1600
+ }
1601
+ if (spawned.stderr) {
1602
+ mixed.add(spawned.stderr);
1603
+ }
1604
+ return mixed;
1605
+ };
1606
+ var getBufferedData = async (stream, streamPromise) => {
1607
+ if (!stream) {
1608
+ return;
1609
+ }
1610
+ stream.destroy();
1611
+ try {
1612
+ return await streamPromise;
1613
+ } catch (error) {
1614
+ return error.bufferedData;
1615
+ }
1616
+ };
1617
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1618
+ if (!stream || !buffer) {
1619
+ return;
1620
+ }
1621
+ if (encoding) {
1622
+ return getStream(stream, { encoding, maxBuffer });
1623
+ }
1624
+ return getStream.buffer(stream, { maxBuffer });
1625
+ };
1626
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1627
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1628
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1629
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1630
+ try {
1631
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1632
+ } catch (error) {
1633
+ return Promise.all([
1634
+ { error, signal: error.signal, timedOut: error.timedOut },
1635
+ getBufferedData(stdout, stdoutPromise),
1636
+ getBufferedData(stderr, stderrPromise),
1637
+ getBufferedData(all, allPromise)
1638
+ ]);
1639
+ }
1640
+ };
1641
+ var validateInputSync = ({ input }) => {
1642
+ if (isStream(input)) {
1643
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1644
+ }
1645
+ };
1646
+ module.exports = {
1647
+ handleInput,
1648
+ makeAllStream,
1649
+ getSpawnedResult,
1650
+ validateInputSync
1651
+ };
1652
+ }
1653
+ });
1654
+
1655
+ // ../../node_modules/execa/lib/promise.js
1656
+ var require_promise = __commonJS({
1657
+ "../../node_modules/execa/lib/promise.js"(exports, module) {
1658
+ "use strict";
1659
+ var nativePromisePrototype = (async () => {
1660
+ })().constructor.prototype;
1661
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1662
+ property,
1663
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1664
+ ]);
1665
+ var mergePromise = (spawned, promise) => {
1666
+ for (const [property, descriptor] of descriptors) {
1667
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1668
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1669
+ }
1670
+ return spawned;
1671
+ };
1672
+ var getSpawnedPromise = (spawned) => {
1673
+ return new Promise((resolve, reject) => {
1674
+ spawned.on("exit", (exitCode, signal) => {
1675
+ resolve({ exitCode, signal });
1676
+ });
1677
+ spawned.on("error", (error) => {
1678
+ reject(error);
1679
+ });
1680
+ if (spawned.stdin) {
1681
+ spawned.stdin.on("error", (error) => {
1682
+ reject(error);
1683
+ });
1684
+ }
1685
+ });
1686
+ };
1687
+ module.exports = {
1688
+ mergePromise,
1689
+ getSpawnedPromise
1690
+ };
1691
+ }
1692
+ });
1693
+
1694
+ // ../../node_modules/execa/lib/command.js
1695
+ var require_command = __commonJS({
1696
+ "../../node_modules/execa/lib/command.js"(exports, module) {
1697
+ "use strict";
1698
+ var SPACES_REGEXP = / +/g;
1699
+ var joinCommand = (file, args = []) => {
1700
+ if (!Array.isArray(args)) {
1701
+ return file;
1702
+ }
1703
+ return [file, ...args].join(" ");
1704
+ };
1705
+ var parseCommand = (command) => {
1706
+ const tokens = [];
1707
+ for (const token of command.trim().split(SPACES_REGEXP)) {
1708
+ const previousToken = tokens[tokens.length - 1];
1709
+ if (previousToken && previousToken.endsWith("\\")) {
1710
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
1711
+ } else {
1712
+ tokens.push(token);
1713
+ }
1714
+ }
1715
+ return tokens;
1716
+ };
1717
+ module.exports = {
1718
+ joinCommand,
1719
+ parseCommand
1720
+ };
1721
+ }
1722
+ });
1723
+
1724
+ // ../../node_modules/execa/index.js
1725
+ var require_execa = __commonJS({
1726
+ "../../node_modules/execa/index.js"(exports, module) {
1727
+ "use strict";
1728
+ var path = __require("path");
1729
+ var childProcess = __require("child_process");
1730
+ var crossSpawn = require_cross_spawn();
1731
+ var stripFinalNewline = require_strip_final_newline();
1732
+ var npmRunPath = require_npm_run_path();
1733
+ var onetime = require_onetime();
1734
+ var makeError = require_error();
1735
+ var normalizeStdio = require_stdio();
1736
+ var { spawnedKill, spawnedCancel, setupTimeout, setExitHandler } = require_kill();
1737
+ var { handleInput, getSpawnedResult, makeAllStream, validateInputSync } = require_stream();
1738
+ var { mergePromise, getSpawnedPromise } = require_promise();
1739
+ var { joinCommand, parseCommand } = require_command();
1740
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1741
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1742
+ const env = extendEnv ? { ...process.env, ...envOption } : envOption;
1743
+ if (preferLocal) {
1744
+ return npmRunPath.env({ env, cwd: localDir, execPath });
1745
+ }
1746
+ return env;
1747
+ };
1748
+ var handleArguments = (file, args, options = {}) => {
1749
+ const parsed = crossSpawn._parse(file, args, options);
1750
+ file = parsed.command;
1751
+ args = parsed.args;
1752
+ options = parsed.options;
1753
+ options = {
1754
+ maxBuffer: DEFAULT_MAX_BUFFER,
1755
+ buffer: true,
1756
+ stripFinalNewline: true,
1757
+ extendEnv: true,
1758
+ preferLocal: false,
1759
+ localDir: options.cwd || process.cwd(),
1760
+ execPath: process.execPath,
1761
+ encoding: "utf8",
1762
+ reject: true,
1763
+ cleanup: true,
1764
+ all: false,
1765
+ windowsHide: true,
1766
+ ...options
1767
+ };
1768
+ options.env = getEnv(options);
1769
+ options.stdio = normalizeStdio(options);
1770
+ if (process.platform === "win32" && path.basename(file, ".exe") === "cmd") {
1771
+ args.unshift("/q");
1772
+ }
1773
+ return { file, args, options, parsed };
1774
+ };
1775
+ var handleOutput = (options, value, error) => {
1776
+ if (typeof value !== "string" && !Buffer.isBuffer(value)) {
1777
+ return error === void 0 ? void 0 : "";
1778
+ }
1779
+ if (options.stripFinalNewline) {
1780
+ return stripFinalNewline(value);
1781
+ }
1782
+ return value;
1783
+ };
1784
+ var execa = (file, args, options) => {
1785
+ const parsed = handleArguments(file, args, options);
1786
+ const command = joinCommand(file, args);
1787
+ let spawned;
1788
+ try {
1789
+ spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
1790
+ } catch (error) {
1791
+ const dummySpawned = new childProcess.ChildProcess();
1792
+ const errorPromise = Promise.reject(makeError({
1793
+ error,
1794
+ stdout: "",
1795
+ stderr: "",
1796
+ all: "",
1797
+ command,
1798
+ parsed,
1799
+ timedOut: false,
1800
+ isCanceled: false,
1801
+ killed: false
1802
+ }));
1803
+ return mergePromise(dummySpawned, errorPromise);
1804
+ }
1805
+ const spawnedPromise = getSpawnedPromise(spawned);
1806
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1807
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1808
+ const context = { isCanceled: false };
1809
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1810
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
1811
+ const handlePromise = async () => {
1812
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1813
+ const stdout = handleOutput(parsed.options, stdoutResult);
1814
+ const stderr = handleOutput(parsed.options, stderrResult);
1815
+ const all = handleOutput(parsed.options, allResult);
1816
+ if (error || exitCode !== 0 || signal !== null) {
1817
+ const returnedError = makeError({
1818
+ error,
1819
+ exitCode,
1820
+ signal,
1821
+ stdout,
1822
+ stderr,
1823
+ all,
1824
+ command,
1825
+ parsed,
1826
+ timedOut,
1827
+ isCanceled: context.isCanceled,
1828
+ killed: spawned.killed
1829
+ });
1830
+ if (!parsed.options.reject) {
1831
+ return returnedError;
1832
+ }
1833
+ throw returnedError;
1834
+ }
1835
+ return {
1836
+ command,
1837
+ exitCode: 0,
1838
+ stdout,
1839
+ stderr,
1840
+ all,
1841
+ failed: false,
1842
+ timedOut: false,
1843
+ isCanceled: false,
1844
+ killed: false
1845
+ };
1846
+ };
1847
+ const handlePromiseOnce = onetime(handlePromise);
1848
+ handleInput(spawned, parsed.options.input);
1849
+ spawned.all = makeAllStream(spawned, parsed.options);
1850
+ return mergePromise(spawned, handlePromiseOnce);
1851
+ };
1852
+ module.exports = execa;
1853
+ module.exports.sync = (file, args, options) => {
1854
+ const parsed = handleArguments(file, args, options);
1855
+ const command = joinCommand(file, args);
1856
+ validateInputSync(parsed.options);
1857
+ let result;
1858
+ try {
1859
+ result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
1860
+ } catch (error) {
1861
+ throw makeError({
1862
+ error,
1863
+ stdout: "",
1864
+ stderr: "",
1865
+ all: "",
1866
+ command,
1867
+ parsed,
1868
+ timedOut: false,
1869
+ isCanceled: false,
1870
+ killed: false
1871
+ });
1872
+ }
1873
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
1874
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
1875
+ if (result.error || result.status !== 0 || result.signal !== null) {
1876
+ const error = makeError({
1877
+ stdout,
1878
+ stderr,
1879
+ error: result.error,
1880
+ signal: result.signal,
1881
+ exitCode: result.status,
1882
+ command,
1883
+ parsed,
1884
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
1885
+ isCanceled: false,
1886
+ killed: result.signal !== null
1887
+ });
1888
+ if (!parsed.options.reject) {
1889
+ return error;
1890
+ }
1891
+ throw error;
1892
+ }
1893
+ return {
1894
+ command,
1895
+ exitCode: 0,
1896
+ stdout,
1897
+ stderr,
1898
+ failed: false,
1899
+ timedOut: false,
1900
+ isCanceled: false,
1901
+ killed: false
1902
+ };
1903
+ };
1904
+ module.exports.command = (command, options) => {
1905
+ const [file, ...args] = parseCommand(command);
1906
+ return execa(file, args, options);
1907
+ };
1908
+ module.exports.commandSync = (command, options) => {
1909
+ const [file, ...args] = parseCommand(command);
1910
+ return execa.sync(file, args, options);
1911
+ };
1912
+ module.exports.node = (scriptPath, args, options = {}) => {
1913
+ if (args && !Array.isArray(args) && typeof args === "object") {
1914
+ options = args;
1915
+ args = [];
1916
+ }
1917
+ const stdio = normalizeStdio.node(options);
1918
+ const defaultExecArgv = process.execArgv.filter((arg) => !arg.startsWith("--inspect"));
1919
+ const {
1920
+ nodePath = process.execPath,
1921
+ nodeOptions = defaultExecArgv
1922
+ } = options;
1923
+ return execa(
1924
+ nodePath,
1925
+ [
1926
+ ...nodeOptions,
1927
+ scriptPath,
1928
+ ...Array.isArray(args) ? args : []
1929
+ ],
1930
+ {
1931
+ ...options,
1932
+ stdin: void 0,
1933
+ stdout: void 0,
1934
+ stderr: void 0,
1935
+ stdio,
1936
+ shell: false
1937
+ }
1938
+ );
1939
+ };
1940
+ }
1941
+ });
1942
+
1943
+ // src/utils/emoji-handler.ts
1944
+ import { logger } from "@elizaos/core";
1945
+ var config = {
1946
+ enabled: true,
1947
+ forceDisable: false
1948
+ };
1949
+ var EMOJIS = {
1950
+ // Status indicators
1951
+ success: { emoji: "\u2705", fallback: "[OK]" },
1952
+ error: { emoji: "\u274C", fallback: "[ERROR]" },
1953
+ warning: { emoji: "\u26A0\uFE0F", fallback: "[WARNING]" },
1954
+ info: { emoji: "\u2139\uFE0F", fallback: "[INFO]" },
1955
+ // Actions
1956
+ rocket: { emoji: "\u{1F680}", fallback: ">>" },
1957
+ sparkles: { emoji: "\u2728", fallback: "*" },
1958
+ party: { emoji: "\u{1F389}", fallback: "[DONE]" },
1959
+ // Objects/Tools
1960
+ package: { emoji: "\u{1F4E6}", fallback: "[PKG]" },
1961
+ link: { emoji: "\u{1F517}", fallback: "[LINK]" },
1962
+ lightbulb: { emoji: "\u{1F4A1}", fallback: "[TIP]" },
1963
+ clipboard: { emoji: "\u{1F4CB}", fallback: "[LIST]" },
1964
+ // Platforms
1965
+ penguin: { emoji: "\u{1F427}", fallback: "[LINUX]" },
1966
+ globe: { emoji: "\u{1F310}", fallback: "[WEB]" },
1967
+ // Arrows and pointers
1968
+ rightArrow: { emoji: "\u2192", fallback: "->" },
1969
+ bullet: { emoji: "\u2022", fallback: "*" }
1970
+ };
1971
+ function detectEmojiSupport() {
1972
+ if (config.forceDisable) {
1973
+ return false;
1974
+ }
1975
+ const term = process.env.TERM || "";
1976
+ const termProgram = process.env.TERM_PROGRAM || "";
1977
+ const colorTerm = process.env.COLORTERM;
1978
+ const ciEnv = process.env.CI;
1979
+ if (ciEnv === "true" || process.env.GITHUB_ACTIONS) {
1980
+ return false;
1981
+ }
1982
+ if (process.platform === "win32") {
1983
+ if (termProgram === "vscode" || process.env.WT_SESSION || process.env.WT_PROFILE_ID || termProgram === "Windows Terminal") {
1984
+ return true;
1985
+ }
1986
+ if (process.env.PSModulePath && process.env.POWERSHELL_TELEMETRY_OPTOUT !== void 0) {
1987
+ return true;
1988
+ }
1989
+ return false;
1990
+ }
1991
+ if (process.platform === "darwin" || process.platform === "linux") {
1992
+ if (termProgram === "vscode" || termProgram === "iTerm.app" || termProgram === "Apple_Terminal" || term.includes("xterm") || term.includes("screen") || colorTerm) {
1993
+ return true;
1994
+ }
1995
+ }
1996
+ if (term.includes("256color") || term.includes("truecolor")) {
1997
+ return true;
1998
+ }
1999
+ return false;
2000
+ }
2001
+ function getEmoji(key) {
2002
+ const emojiDef = EMOJIS[key];
2003
+ if (!emojiDef) {
2004
+ logger.warn(`Unknown emoji key: ${key}`);
2005
+ return "";
2006
+ }
2007
+ return config.enabled && detectEmojiSupport() ? emojiDef.emoji : emojiDef.fallback;
2008
+ }
2009
+ function configureEmojis(newConfig) {
2010
+ config = { ...config, ...newConfig };
2011
+ }
2012
+ function withEmoji(key, message, spacing = true) {
2013
+ const emoji2 = getEmoji(key);
2014
+ const space = spacing && emoji2 ? " " : "";
2015
+ return `${emoji2}${space}${message}`;
2016
+ }
2017
+ var emoji = {
2018
+ success: (msg) => withEmoji("success", msg),
2019
+ error: (msg) => withEmoji("error", msg),
2020
+ warning: (msg) => withEmoji("warning", msg),
2021
+ info: (msg) => withEmoji("info", msg),
2022
+ rocket: (msg) => withEmoji("rocket", msg),
2023
+ package: (msg) => withEmoji("package", msg),
2024
+ link: (msg) => withEmoji("link", msg),
2025
+ tip: (msg) => withEmoji("lightbulb", msg),
2026
+ list: (msg) => withEmoji("clipboard", msg),
2027
+ penguin: (msg) => withEmoji("penguin", msg),
2028
+ bullet: (msg) => withEmoji("bullet", msg)
2029
+ };
2030
+ function initializeEmojiSupport() {
2031
+ const supported = detectEmojiSupport();
2032
+ if (process.env.DEBUG || process.env.ELIZA_DEBUG) {
2033
+ logger.debug(
2034
+ `Emoji support: ${supported ? "enabled" : "disabled"} (platform: ${process.platform}, term: ${process.env.TERM || "unknown"})`
2035
+ );
2036
+ }
2037
+ }
2038
+ initializeEmojiSupport();
2039
+
2040
+ // src/utils/bun-exec.ts
2041
+ import { logger as logger2 } from "@elizaos/core";
2042
+ var COMMAND_EXISTS_TIMEOUT_MS = 5e3;
2043
+ var ProcessExecutionError = class extends Error {
2044
+ constructor(message, exitCode, stderr, command) {
2045
+ super(message);
2046
+ this.exitCode = exitCode;
2047
+ this.stderr = stderr;
2048
+ this.command = command;
2049
+ this.name = "ProcessExecutionError";
2050
+ }
2051
+ };
2052
+ var ProcessTimeoutError = class extends Error {
2053
+ constructor(message, command, timeout) {
2054
+ super(message);
2055
+ this.command = command;
2056
+ this.timeout = timeout;
2057
+ this.name = "ProcessTimeoutError";
2058
+ }
2059
+ };
2060
+ function escapeShellArg(arg) {
2061
+ if (arg === "") {
2062
+ return '""';
2063
+ }
2064
+ const escaped = JSON.stringify(arg);
2065
+ return escaped;
2066
+ }
2067
+ async function readStreamSafe(stream, streamName) {
2068
+ if (!stream || typeof stream === "number") {
2069
+ return "";
2070
+ }
2071
+ try {
2072
+ const text = await new Response(stream).text();
2073
+ return text;
2074
+ } catch (error) {
2075
+ logger2.debug(`[bunExec] Error reading ${streamName}:`, error);
2076
+ return "";
2077
+ }
2078
+ }
2079
+ async function bunExec(command, args = [], options = {}) {
2080
+ let proc = null;
2081
+ let timeoutId = null;
2082
+ try {
2083
+ const escapedArgs = args.map(escapeShellArg);
2084
+ const fullCommand = [command, ...escapedArgs].join(" ");
2085
+ logger2.debug(`[bunExec] Executing: ${fullCommand}`);
2086
+ proc = Bun.spawn([command, ...args], {
2087
+ cwd: options.cwd,
2088
+ env: { ...process.env, ...options.env },
2089
+ stdout: options.stdout || options.stdio || "pipe",
2090
+ stderr: options.stderr || options.stdio || "pipe"
2091
+ });
2092
+ if (options.signal) {
2093
+ options.signal.addEventListener("abort", () => {
2094
+ if (proc && proc.exitCode === null) {
2095
+ proc.kill();
2096
+ }
2097
+ });
2098
+ }
2099
+ const timeoutPromise = new Promise((_, reject) => {
2100
+ if (options.timeout && options.timeout > 0) {
2101
+ const timeoutMs = options.timeout;
2102
+ timeoutId = setTimeout(() => {
2103
+ if (proc && proc.exitCode === null) {
2104
+ proc.kill();
2105
+ }
2106
+ reject(
2107
+ new ProcessTimeoutError(
2108
+ `Command timed out after ${timeoutMs}ms`,
2109
+ fullCommand,
2110
+ timeoutMs
2111
+ )
2112
+ );
2113
+ }, timeoutMs);
2114
+ }
2115
+ });
2116
+ const [stdout, stderr, exitCode] = await Promise.race([
2117
+ // Normal execution path - all operations run concurrently
2118
+ Promise.all([
2119
+ readStreamSafe(proc.stdout, "stdout"),
2120
+ readStreamSafe(proc.stderr, "stderr"),
2121
+ proc.exited
2122
+ ]),
2123
+ // Timeout path
2124
+ timeoutPromise
2125
+ ]);
2126
+ if (timeoutId) {
2127
+ clearTimeout(timeoutId);
2128
+ }
2129
+ const success = exitCode === 0;
2130
+ if (!success && options.stdio !== "ignore") {
2131
+ logger2.debug(`[bunExec] Command failed with exit code ${exitCode}`);
2132
+ if (stderr) {
2133
+ logger2.debug(`[bunExec] stderr: ${stderr}`);
2134
+ }
2135
+ }
2136
+ return {
2137
+ stdout: stdout.trim(),
2138
+ stderr: stderr.trim(),
2139
+ exitCode,
2140
+ success
2141
+ };
2142
+ } catch (error) {
2143
+ if (timeoutId) {
2144
+ clearTimeout(timeoutId);
2145
+ }
2146
+ if (error instanceof ProcessTimeoutError) {
2147
+ throw error;
2148
+ }
2149
+ if (error instanceof Error) {
2150
+ throw new ProcessExecutionError(
2151
+ `Command execution failed: ${error.message}`,
2152
+ null,
2153
+ "",
2154
+ command
2155
+ );
2156
+ }
2157
+ throw error;
2158
+ } finally {
2159
+ if (proc && proc.exitCode === null) {
2160
+ try {
2161
+ proc.kill();
2162
+ logger2.debug("[bunExec] Killed still-running process in cleanup");
2163
+ } catch (cleanupError) {
2164
+ logger2.debug(
2165
+ "[bunExec] Process cleanup error (process may have already exited):",
2166
+ cleanupError
2167
+ );
2168
+ }
2169
+ }
2170
+ }
2171
+ }
2172
+ async function bunExecSimple(command, args = [], options = {}) {
2173
+ const result = await bunExec(command, args, options);
2174
+ if (!result.success && options.stdio !== "ignore") {
2175
+ throw new ProcessExecutionError(
2176
+ `Command failed: ${command} ${args.map(escapeShellArg).join(" ")}`,
2177
+ result.exitCode,
2178
+ result.stderr,
2179
+ command
2180
+ );
2181
+ }
2182
+ return { stdout: result.stdout };
2183
+ }
2184
+ async function bunExecInherit(command, args = [], options = {}) {
2185
+ return bunExec(command, args, {
2186
+ ...options,
2187
+ stdio: "inherit"
2188
+ });
2189
+ }
2190
+ async function commandExists(command) {
2191
+ try {
2192
+ if (process.platform === "win32") {
2193
+ const result = await bunExec("where", [command], {
2194
+ stdio: "ignore",
2195
+ timeout: COMMAND_EXISTS_TIMEOUT_MS
2196
+ });
2197
+ return result.success;
2198
+ } else {
2199
+ const result = await bunExec("which", [command], {
2200
+ stdio: "ignore",
2201
+ timeout: COMMAND_EXISTS_TIMEOUT_MS
2202
+ });
2203
+ return result.success;
2204
+ }
2205
+ } catch {
2206
+ return false;
2207
+ }
2208
+ }
2209
+
2210
+ // src/utils/bun-installation-helper.ts
2211
+ import { logger as logger3 } from "@elizaos/core";
2212
+ function displayBunInstallationTipCompact() {
2213
+ return "Please install Bun from https://bun.sh";
2214
+ }
2215
+
2216
+ // src/utils/run-bun.ts
2217
+ async function runBunCommand(args, cwd, silent = false) {
2218
+ const finalArgs = [...args];
2219
+ const isInstallCommand = args[0] === "install";
2220
+ const isCI = process.env.CI || process.env.ELIZA_TEST_MODE === "true";
2221
+ if (isCI && isInstallCommand) {
2222
+ if (!finalArgs.includes("--frozen-lockfile")) {
2223
+ finalArgs.push("--frozen-lockfile");
2224
+ }
2225
+ console.info("\u2705 Using CI-optimized flags for faster installation...");
2226
+ }
2227
+ try {
2228
+ const result = silent ? await bunExec("bun", finalArgs, { cwd }) : await bunExecInherit("bun", finalArgs, { cwd });
2229
+ if (silent && !result.success) {
2230
+ throw new Error(
2231
+ `Bun command failed with exit code ${result.exitCode}: ${result.stderr || result.stdout}`
2232
+ );
2233
+ }
2234
+ } catch (error) {
2235
+ if (error.code === "ENOENT" || error.message?.includes("bun: command not found")) {
2236
+ throw new Error(`Bun command not found. ${displayBunInstallationTipCompact()}`);
2237
+ }
2238
+ if (isCI && isInstallCommand && (error.message?.includes("frozen-lockfile") || error.message?.includes("install"))) {
2239
+ console.warn("CI-optimized install failed, retrying with basic args...");
2240
+ const retryResult = silent ? await bunExec("bun", args, { cwd }) : await bunExecInherit("bun", args, { cwd });
2241
+ if (silent && !retryResult.success) {
2242
+ throw new Error(
2243
+ `Bun command failed with exit code ${retryResult.exitCode}: ${retryResult.stderr || retryResult.stdout}`
2244
+ );
2245
+ }
2246
+ } else {
2247
+ throw error;
2248
+ }
2249
+ }
2250
+ }
2251
+
2252
+ export {
2253
+ bunExec,
2254
+ bunExecSimple,
2255
+ bunExecInherit,
2256
+ commandExists,
2257
+ configureEmojis,
2258
+ emoji,
2259
+ require_execa,
2260
+ displayBunInstallationTipCompact,
2261
+ runBunCommand
2262
+ };