create-rstack 1.8.2 → 1.9.1
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/index.d.ts +66 -1
- package/dist/index.js +1858 -984
- package/package.json +9 -10
- package/template-biome/package.json +1 -1
- package/template-eslint/react-ts/package.json +1 -1
- package/template-eslint/svelte-js/package.json +1 -1
- package/template-eslint/svelte-ts/package.json +2 -2
- package/template-eslint/vanilla-ts/package.json +1 -1
- package/template-eslint/vue-ts/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import node_fs from "node:fs";
|
|
3
|
-
import node_path, { dirname } from "node:path";
|
|
3
|
+
import node_path, { delimiter, dirname, normalize as external_node_path_normalize, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import node_util, { styleText } from "node:util";
|
|
6
|
-
import node_process, { stdin, stdout } from "node:process";
|
|
6
|
+
import node_process, { cwd as external_node_process_cwd, stdin, stdout } from "node:process";
|
|
7
7
|
import node_readline from "node:readline";
|
|
8
8
|
import node_tty from "node:tty";
|
|
9
9
|
import node_os from "node:os";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
import { spawn } from "node:child_process";
|
|
12
|
+
import { PassThrough } from "node:stream";
|
|
10
13
|
import { createRequire as __rspack_createRequire } from "node:module";
|
|
11
14
|
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
12
15
|
var __webpack_modules__ = {};
|
|
@@ -207,192 +210,6 @@ __webpack_require__.add({
|
|
|
207
210
|
};
|
|
208
211
|
}
|
|
209
212
|
},
|
|
210
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
211
|
-
const cp = __webpack_require__("child_process");
|
|
212
|
-
const parse = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js");
|
|
213
|
-
const enoent = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");
|
|
214
|
-
function spawn(command, args, options) {
|
|
215
|
-
const parsed = parse(command, args, options);
|
|
216
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
217
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
218
|
-
return spawned;
|
|
219
|
-
}
|
|
220
|
-
function spawnSync(command, args, options) {
|
|
221
|
-
const parsed = parse(command, args, options);
|
|
222
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
223
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
224
|
-
return result;
|
|
225
|
-
}
|
|
226
|
-
module.exports = spawn;
|
|
227
|
-
module.exports.spawn = spawn;
|
|
228
|
-
module.exports.sync = spawnSync;
|
|
229
|
-
module.exports._parse = parse;
|
|
230
|
-
module.exports._enoent = enoent;
|
|
231
|
-
},
|
|
232
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js" (module) {
|
|
233
|
-
const isWin = 'win32' === process.platform;
|
|
234
|
-
function notFoundError(original, syscall) {
|
|
235
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
236
|
-
code: 'ENOENT',
|
|
237
|
-
errno: 'ENOENT',
|
|
238
|
-
syscall: `${syscall} ${original.command}`,
|
|
239
|
-
path: original.command,
|
|
240
|
-
spawnargs: original.args
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function hookChildProcess(cp, parsed) {
|
|
244
|
-
if (!isWin) return;
|
|
245
|
-
const originalEmit = cp.emit;
|
|
246
|
-
cp.emit = function(name, arg1) {
|
|
247
|
-
if ('exit' === name) {
|
|
248
|
-
const err = verifyENOENT(arg1, parsed);
|
|
249
|
-
if (err) return originalEmit.call(cp, 'error', err);
|
|
250
|
-
}
|
|
251
|
-
return originalEmit.apply(cp, arguments);
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function verifyENOENT(status, parsed) {
|
|
255
|
-
if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
function verifyENOENTSync(status, parsed) {
|
|
259
|
-
if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
module.exports = {
|
|
263
|
-
hookChildProcess,
|
|
264
|
-
verifyENOENT,
|
|
265
|
-
verifyENOENTSync,
|
|
266
|
-
notFoundError
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
270
|
-
const path = __webpack_require__("path");
|
|
271
|
-
const resolveCommand = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js");
|
|
272
|
-
const escape = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js");
|
|
273
|
-
const readShebang = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js");
|
|
274
|
-
const isWin = 'win32' === process.platform;
|
|
275
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
276
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
277
|
-
function detectShebang(parsed) {
|
|
278
|
-
parsed.file = resolveCommand(parsed);
|
|
279
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
280
|
-
if (shebang) {
|
|
281
|
-
parsed.args.unshift(parsed.file);
|
|
282
|
-
parsed.command = shebang;
|
|
283
|
-
return resolveCommand(parsed);
|
|
284
|
-
}
|
|
285
|
-
return parsed.file;
|
|
286
|
-
}
|
|
287
|
-
function parseNonShell(parsed) {
|
|
288
|
-
if (!isWin) return parsed;
|
|
289
|
-
const commandFile = detectShebang(parsed);
|
|
290
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
291
|
-
if (parsed.options.forceShell || needsShell) {
|
|
292
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
293
|
-
parsed.command = path.normalize(parsed.command);
|
|
294
|
-
parsed.command = escape.command(parsed.command);
|
|
295
|
-
parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
296
|
-
const shellCommand = [
|
|
297
|
-
parsed.command
|
|
298
|
-
].concat(parsed.args).join(' ');
|
|
299
|
-
parsed.args = [
|
|
300
|
-
'/d',
|
|
301
|
-
'/s',
|
|
302
|
-
'/c',
|
|
303
|
-
`"${shellCommand}"`
|
|
304
|
-
];
|
|
305
|
-
parsed.command = process.env.comspec || 'cmd.exe';
|
|
306
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
307
|
-
}
|
|
308
|
-
return parsed;
|
|
309
|
-
}
|
|
310
|
-
function parse(command, args, options) {
|
|
311
|
-
if (args && !Array.isArray(args)) {
|
|
312
|
-
options = args;
|
|
313
|
-
args = null;
|
|
314
|
-
}
|
|
315
|
-
args = args ? args.slice(0) : [];
|
|
316
|
-
options = Object.assign({}, options);
|
|
317
|
-
const parsed = {
|
|
318
|
-
command,
|
|
319
|
-
args,
|
|
320
|
-
options,
|
|
321
|
-
file: void 0,
|
|
322
|
-
original: {
|
|
323
|
-
command,
|
|
324
|
-
args
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
328
|
-
}
|
|
329
|
-
module.exports = parse;
|
|
330
|
-
},
|
|
331
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js" (module) {
|
|
332
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
333
|
-
function escapeCommand(arg) {
|
|
334
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
335
|
-
return arg;
|
|
336
|
-
}
|
|
337
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
338
|
-
arg = `${arg}`;
|
|
339
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
340
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
|
|
341
|
-
arg = `"${arg}"`;
|
|
342
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
343
|
-
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
|
|
344
|
-
return arg;
|
|
345
|
-
}
|
|
346
|
-
module.exports.command = escapeCommand;
|
|
347
|
-
module.exports.argument = escapeArgument;
|
|
348
|
-
},
|
|
349
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
350
|
-
const fs = __webpack_require__("fs");
|
|
351
|
-
const shebangCommand = __webpack_require__("./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");
|
|
352
|
-
function readShebang(command) {
|
|
353
|
-
const size = 150;
|
|
354
|
-
const buffer = Buffer.alloc(size);
|
|
355
|
-
let fd;
|
|
356
|
-
try {
|
|
357
|
-
fd = fs.openSync(command, 'r');
|
|
358
|
-
fs.readSync(fd, buffer, 0, size, 0);
|
|
359
|
-
fs.closeSync(fd);
|
|
360
|
-
} catch (e) {}
|
|
361
|
-
return shebangCommand(buffer.toString());
|
|
362
|
-
}
|
|
363
|
-
module.exports = readShebang;
|
|
364
|
-
},
|
|
365
|
-
"./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
366
|
-
const path = __webpack_require__("path");
|
|
367
|
-
const which = __webpack_require__("./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js");
|
|
368
|
-
const getPathKey = __webpack_require__("./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");
|
|
369
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
370
|
-
const env = parsed.options.env || process.env;
|
|
371
|
-
const cwd = process.cwd();
|
|
372
|
-
const hasCustomCwd = null != parsed.options.cwd;
|
|
373
|
-
const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
|
|
374
|
-
if (shouldSwitchCwd) try {
|
|
375
|
-
process.chdir(parsed.options.cwd);
|
|
376
|
-
} catch (err) {}
|
|
377
|
-
let resolved;
|
|
378
|
-
try {
|
|
379
|
-
resolved = which.sync(parsed.command, {
|
|
380
|
-
path: env[getPathKey({
|
|
381
|
-
env
|
|
382
|
-
})],
|
|
383
|
-
pathExt: withoutPathExt ? path.delimiter : void 0
|
|
384
|
-
});
|
|
385
|
-
} catch (e) {} finally{
|
|
386
|
-
if (shouldSwitchCwd) process.chdir(cwd);
|
|
387
|
-
}
|
|
388
|
-
if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
389
|
-
return resolved;
|
|
390
|
-
}
|
|
391
|
-
function resolveCommand(parsed) {
|
|
392
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
393
|
-
}
|
|
394
|
-
module.exports = resolveCommand;
|
|
395
|
-
},
|
|
396
213
|
"./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
397
214
|
var isMergeableObject = function(value) {
|
|
398
215
|
return isNonNullObject(value) && !isSpecial(value);
|
|
@@ -476,102 +293,6 @@ __webpack_require__.add({
|
|
|
476
293
|
var deepmerge_1 = deepmerge;
|
|
477
294
|
module.exports = deepmerge_1;
|
|
478
295
|
},
|
|
479
|
-
"./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
480
|
-
__webpack_require__("fs");
|
|
481
|
-
var core;
|
|
482
|
-
core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js") : __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js");
|
|
483
|
-
module.exports = isexe;
|
|
484
|
-
isexe.sync = sync;
|
|
485
|
-
function isexe(path, options, cb) {
|
|
486
|
-
if ('function' == typeof options) {
|
|
487
|
-
cb = options;
|
|
488
|
-
options = {};
|
|
489
|
-
}
|
|
490
|
-
if (!cb) {
|
|
491
|
-
if ('function' != typeof Promise) throw new TypeError('callback not provided');
|
|
492
|
-
return new Promise(function(resolve, reject) {
|
|
493
|
-
isexe(path, options || {}, function(er, is) {
|
|
494
|
-
if (er) reject(er);
|
|
495
|
-
else resolve(is);
|
|
496
|
-
});
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
core(path, options || {}, function(er, is) {
|
|
500
|
-
if (er) {
|
|
501
|
-
if ('EACCES' === er.code || options && options.ignoreErrors) {
|
|
502
|
-
er = null;
|
|
503
|
-
is = false;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
cb(er, is);
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
function sync(path, options) {
|
|
510
|
-
try {
|
|
511
|
-
return core.sync(path, options || {});
|
|
512
|
-
} catch (er) {
|
|
513
|
-
if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
|
|
514
|
-
throw er;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
"./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
519
|
-
module.exports = isexe;
|
|
520
|
-
isexe.sync = sync;
|
|
521
|
-
var fs = __webpack_require__("fs");
|
|
522
|
-
function isexe(path, options, cb) {
|
|
523
|
-
fs.stat(path, function(er, stat) {
|
|
524
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
function sync(path, options) {
|
|
528
|
-
return checkStat(fs.statSync(path), options);
|
|
529
|
-
}
|
|
530
|
-
function checkStat(stat, options) {
|
|
531
|
-
return stat.isFile() && checkMode(stat, options);
|
|
532
|
-
}
|
|
533
|
-
function checkMode(stat, options) {
|
|
534
|
-
var mod = stat.mode;
|
|
535
|
-
var uid = stat.uid;
|
|
536
|
-
var gid = stat.gid;
|
|
537
|
-
var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
|
|
538
|
-
var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
|
|
539
|
-
var u = parseInt('100', 8);
|
|
540
|
-
var g = parseInt('010', 8);
|
|
541
|
-
var o = parseInt('001', 8);
|
|
542
|
-
var ug = u | g;
|
|
543
|
-
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
|
|
544
|
-
return ret;
|
|
545
|
-
}
|
|
546
|
-
},
|
|
547
|
-
"./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
548
|
-
module.exports = isexe;
|
|
549
|
-
isexe.sync = sync;
|
|
550
|
-
var fs = __webpack_require__("fs");
|
|
551
|
-
function checkPathExt(path, options) {
|
|
552
|
-
var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
|
|
553
|
-
if (!pathext) return true;
|
|
554
|
-
pathext = pathext.split(';');
|
|
555
|
-
if (-1 !== pathext.indexOf('')) return true;
|
|
556
|
-
for(var i = 0; i < pathext.length; i++){
|
|
557
|
-
var p = pathext[i].toLowerCase();
|
|
558
|
-
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
559
|
-
}
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
function checkStat(stat, path, options) {
|
|
563
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
564
|
-
return checkPathExt(path, options);
|
|
565
|
-
}
|
|
566
|
-
function isexe(path, options, cb) {
|
|
567
|
-
fs.stat(path, function(er, stat) {
|
|
568
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
function sync(path, options) {
|
|
572
|
-
return checkStat(fs.statSync(path), path, options);
|
|
573
|
-
}
|
|
574
|
-
},
|
|
575
296
|
"./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js" (module) {
|
|
576
297
|
function hasKey(obj, keys) {
|
|
577
298
|
var o = obj;
|
|
@@ -751,30 +472,6 @@ __webpack_require__.add({
|
|
|
751
472
|
return argv;
|
|
752
473
|
};
|
|
753
474
|
},
|
|
754
|
-
"./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js" (module) {
|
|
755
|
-
const pathKey = (options = {})=>{
|
|
756
|
-
const environment = options.env || process.env;
|
|
757
|
-
const platform = options.platform || process.platform;
|
|
758
|
-
if ('win32' !== platform) return 'PATH';
|
|
759
|
-
return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
|
|
760
|
-
};
|
|
761
|
-
module.exports = pathKey;
|
|
762
|
-
module.exports["default"] = pathKey;
|
|
763
|
-
},
|
|
764
|
-
"./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
765
|
-
const shebangRegex = __webpack_require__("./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
|
|
766
|
-
module.exports = (string = '')=>{
|
|
767
|
-
const match = string.match(shebangRegex);
|
|
768
|
-
if (!match) return null;
|
|
769
|
-
const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
|
|
770
|
-
const binary = path.split('/').pop();
|
|
771
|
-
if ('env' === binary) return argument;
|
|
772
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
773
|
-
};
|
|
774
|
-
},
|
|
775
|
-
"./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js" (module) {
|
|
776
|
-
module.exports = /^#!(.*)/;
|
|
777
|
-
},
|
|
778
475
|
"./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js" (module) {
|
|
779
476
|
const ESC = '\x1B';
|
|
780
477
|
const CSI = `${ESC}[`;
|
|
@@ -829,268 +526,328 @@ __webpack_require__.add({
|
|
|
829
526
|
beep
|
|
830
527
|
};
|
|
831
528
|
},
|
|
832
|
-
"./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
833
|
-
const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
|
|
834
|
-
const path = __webpack_require__("path");
|
|
835
|
-
const COLON = isWindows ? ';' : ':';
|
|
836
|
-
const isexe = __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js");
|
|
837
|
-
const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
|
|
838
|
-
code: 'ENOENT'
|
|
839
|
-
});
|
|
840
|
-
const getPathInfo = (cmd, opt)=>{
|
|
841
|
-
const colon = opt.colon || COLON;
|
|
842
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
|
|
843
|
-
''
|
|
844
|
-
] : [
|
|
845
|
-
...isWindows ? [
|
|
846
|
-
process.cwd()
|
|
847
|
-
] : [],
|
|
848
|
-
...(opt.path || process.env.PATH || '').split(colon)
|
|
849
|
-
];
|
|
850
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
|
|
851
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [
|
|
852
|
-
''
|
|
853
|
-
];
|
|
854
|
-
if (isWindows) {
|
|
855
|
-
if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
|
|
856
|
-
}
|
|
857
|
-
return {
|
|
858
|
-
pathEnv,
|
|
859
|
-
pathExt,
|
|
860
|
-
pathExtExe
|
|
861
|
-
};
|
|
862
|
-
};
|
|
863
|
-
const which = (cmd, opt, cb)=>{
|
|
864
|
-
if ('function' == typeof opt) {
|
|
865
|
-
cb = opt;
|
|
866
|
-
opt = {};
|
|
867
|
-
}
|
|
868
|
-
if (!opt) opt = {};
|
|
869
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
870
|
-
const found = [];
|
|
871
|
-
const step = (i)=>new Promise((resolve, reject)=>{
|
|
872
|
-
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
873
|
-
const ppRaw = pathEnv[i];
|
|
874
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
875
|
-
const pCmd = path.join(pathPart, cmd);
|
|
876
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
877
|
-
resolve(subStep(p, i, 0));
|
|
878
|
-
});
|
|
879
|
-
const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
|
|
880
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
881
|
-
const ext = pathExt[ii];
|
|
882
|
-
isexe(p + ext, {
|
|
883
|
-
pathExt: pathExtExe
|
|
884
|
-
}, (er, is)=>{
|
|
885
|
-
if (!er && is) if (!opt.all) return resolve(p + ext);
|
|
886
|
-
else found.push(p + ext);
|
|
887
|
-
return resolve(subStep(p, i, ii + 1));
|
|
888
|
-
});
|
|
889
|
-
});
|
|
890
|
-
return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
|
|
891
|
-
};
|
|
892
|
-
const whichSync = (cmd, opt)=>{
|
|
893
|
-
opt = opt || {};
|
|
894
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
895
|
-
const found = [];
|
|
896
|
-
for(let i = 0; i < pathEnv.length; i++){
|
|
897
|
-
const ppRaw = pathEnv[i];
|
|
898
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
899
|
-
const pCmd = path.join(pathPart, cmd);
|
|
900
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
901
|
-
for(let j = 0; j < pathExt.length; j++){
|
|
902
|
-
const cur = p + pathExt[j];
|
|
903
|
-
try {
|
|
904
|
-
const is = isexe.sync(cur, {
|
|
905
|
-
pathExt: pathExtExe
|
|
906
|
-
});
|
|
907
|
-
if (is) if (!opt.all) return cur;
|
|
908
|
-
else found.push(cur);
|
|
909
|
-
} catch (ex) {}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
if (opt.all && found.length) return found;
|
|
913
|
-
if (opt.nothrow) return null;
|
|
914
|
-
throw getNotFoundError(cmd);
|
|
915
|
-
};
|
|
916
|
-
module.exports = which;
|
|
917
|
-
which.sync = whichSync;
|
|
918
|
-
},
|
|
919
|
-
child_process (module) {
|
|
920
|
-
module.exports = __rspack_createRequire_require("child_process");
|
|
921
|
-
},
|
|
922
|
-
fs (module) {
|
|
923
|
-
module.exports = __rspack_createRequire_require("fs");
|
|
924
|
-
},
|
|
925
529
|
"node:fs?31c0" (module) {
|
|
926
530
|
module.exports = __rspack_createRequire_require("node:fs");
|
|
927
531
|
},
|
|
928
532
|
"node:fs/promises" (module) {
|
|
929
533
|
module.exports = __rspack_createRequire_require("node:fs/promises");
|
|
930
|
-
},
|
|
931
|
-
path (module) {
|
|
932
|
-
module.exports = __rspack_createRequire_require("path");
|
|
933
534
|
}
|
|
934
535
|
});
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
const
|
|
536
|
+
const isAmbiguous = (x)=>0xA1 === x || 0xA4 === x || 0xA7 === x || 0xA8 === x || 0xAA === x || 0xAD === x || 0xAE === x || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || 0xC6 === x || 0xD0 === x || 0xD7 === x || 0xD8 === x || x >= 0xDE && x <= 0xE1 || 0xE6 === x || x >= 0xE8 && x <= 0xEA || 0xEC === x || 0xED === x || 0xF0 === x || 0xF2 === x || 0xF3 === x || x >= 0xF7 && x <= 0xFA || 0xFC === x || 0xFE === x || 0x101 === x || 0x111 === x || 0x113 === x || 0x11B === x || 0x126 === x || 0x127 === x || 0x12B === x || x >= 0x131 && x <= 0x133 || 0x138 === x || x >= 0x13F && x <= 0x142 || 0x144 === x || x >= 0x148 && x <= 0x14B || 0x14D === x || 0x152 === x || 0x153 === x || 0x166 === x || 0x167 === x || 0x16B === x || 0x1CE === x || 0x1D0 === x || 0x1D2 === x || 0x1D4 === x || 0x1D6 === x || 0x1D8 === x || 0x1DA === x || 0x1DC === x || 0x251 === x || 0x261 === x || 0x2C4 === x || 0x2C7 === x || x >= 0x2C9 && x <= 0x2CB || 0x2CD === x || 0x2D0 === x || x >= 0x2D8 && x <= 0x2DB || 0x2DD === x || 0x2DF === x || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || 0x401 === x || x >= 0x410 && x <= 0x44F || 0x451 === x || 0x2010 === x || x >= 0x2013 && x <= 0x2016 || 0x2018 === x || 0x2019 === x || 0x201C === x || 0x201D === x || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || 0x2030 === x || 0x2032 === x || 0x2033 === x || 0x2035 === x || 0x203B === x || 0x203E === x || 0x2074 === x || 0x207F === x || x >= 0x2081 && x <= 0x2084 || 0x20AC === x || 0x2103 === x || 0x2105 === x || 0x2109 === x || 0x2113 === x || 0x2116 === x || 0x2121 === x || 0x2122 === x || 0x2126 === x || 0x212B === x || 0x2153 === x || 0x2154 === x || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || 0x2189 === x || x >= 0x2190 && x <= 0x2199 || 0x21B8 === x || 0x21B9 === x || 0x21D2 === x || 0x21D4 === x || 0x21E7 === x || 0x2200 === x || 0x2202 === x || 0x2203 === x || 0x2207 === x || 0x2208 === x || 0x220B === x || 0x220F === x || 0x2211 === x || 0x2215 === x || 0x221A === x || x >= 0x221D && x <= 0x2220 || 0x2223 === x || 0x2225 === x || x >= 0x2227 && x <= 0x222C || 0x222E === x || x >= 0x2234 && x <= 0x2237 || 0x223C === x || 0x223D === x || 0x2248 === x || 0x224C === x || 0x2252 === x || 0x2260 === x || 0x2261 === x || x >= 0x2264 && x <= 0x2267 || 0x226A === x || 0x226B === x || 0x226E === x || 0x226F === x || 0x2282 === x || 0x2283 === x || 0x2286 === x || 0x2287 === x || 0x2295 === x || 0x2299 === x || 0x22A5 === x || 0x22BF === x || 0x2312 === x || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || 0x25A0 === x || 0x25A1 === x || x >= 0x25A3 && x <= 0x25A9 || 0x25B2 === x || 0x25B3 === x || 0x25B6 === x || 0x25B7 === x || 0x25BC === x || 0x25BD === x || 0x25C0 === x || 0x25C1 === x || x >= 0x25C6 && x <= 0x25C8 || 0x25CB === x || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || 0x25EF === x || 0x2605 === x || 0x2606 === x || 0x2609 === x || 0x260E === x || 0x260F === x || 0x261C === x || 0x261E === x || 0x2640 === x || 0x2642 === x || 0x2660 === x || 0x2661 === x || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || 0x266C === x || 0x266D === x || 0x266F === x || 0x269E === x || 0x269F === x || 0x26BF === x || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || 0x26E3 === x || 0x26E8 === x || 0x26E9 === x || x >= 0x26EB && x <= 0x26F1 || 0x26F4 === x || x >= 0x26F6 && x <= 0x26F9 || 0x26FB === x || 0x26FC === x || 0x26FE === x || 0x26FF === x || 0x273D === x || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || 0xFFFD === x || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || 0x1F18F === x || 0x1F190 === x || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;
|
|
537
|
+
const isFullWidth = (x)=>0x3000 === x || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;
|
|
538
|
+
const isWide = (x)=>x >= 0x1100 && x <= 0x115F || 0x231A === x || 0x231B === x || 0x2329 === x || 0x232A === x || x >= 0x23E9 && x <= 0x23EC || 0x23F0 === x || 0x23F3 === x || 0x25FD === x || 0x25FE === x || 0x2614 === x || 0x2615 === x || x >= 0x2648 && x <= 0x2653 || 0x267F === x || 0x2693 === x || 0x26A1 === x || 0x26AA === x || 0x26AB === x || 0x26BD === x || 0x26BE === x || 0x26C4 === x || 0x26C5 === x || 0x26CE === x || 0x26D4 === x || 0x26EA === x || 0x26F2 === x || 0x26F3 === x || 0x26F5 === x || 0x26FA === x || 0x26FD === x || 0x2705 === x || 0x270A === x || 0x270B === x || 0x2728 === x || 0x274C === x || 0x274E === x || x >= 0x2753 && x <= 0x2755 || 0x2757 === x || x >= 0x2795 && x <= 0x2797 || 0x27B0 === x || 0x27BF === x || 0x2B1B === x || 0x2B1C === x || 0x2B50 === x || 0x2B55 === x || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || 0x16FF0 === x || 0x16FF1 === x || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || 0x1AFFD === x || 0x1AFFE === x || x >= 0x1B000 && x <= 0x1B122 || 0x1B132 === x || x >= 0x1B150 && x <= 0x1B152 || 0x1B155 === x || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || 0x1F004 === x || 0x1F0CF === x || 0x1F18E === x || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || 0x1F250 === x || 0x1F251 === x || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || 0x1F3F4 === x || x >= 0x1F3F8 && x <= 0x1F43E || 0x1F440 === x || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || 0x1F57A === x || 0x1F595 === x || 0x1F596 === x || 0x1F5A4 === x || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || 0x1F6CC === x || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || 0x1F6EB === x || 0x1F6EC === x || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || 0x1F7F0 === x || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;
|
|
539
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
540
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
541
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
542
|
+
const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
543
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
544
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
545
|
+
const NO_TRUNCATION = {
|
|
942
546
|
limit: 1 / 0,
|
|
943
|
-
ellipsis:
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
547
|
+
ellipsis: ''
|
|
548
|
+
};
|
|
549
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})=>{
|
|
550
|
+
const LIMIT = truncationOptions.limit ?? 1 / 0;
|
|
551
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? '';
|
|
552
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
553
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
554
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
555
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
556
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
557
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
558
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
559
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
560
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
561
|
+
let indexPrev = 0;
|
|
562
|
+
let index = 0;
|
|
563
|
+
let length = input.length;
|
|
564
|
+
let lengthExtra = 0;
|
|
565
|
+
let truncationEnabled = false;
|
|
566
|
+
let truncationIndex = length;
|
|
567
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
568
|
+
let unmatchedStart = 0;
|
|
569
|
+
let unmatchedEnd = 0;
|
|
570
|
+
let width = 0;
|
|
571
|
+
let widthExtra = 0;
|
|
572
|
+
outer: while(true){
|
|
573
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
574
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
575
|
+
lengthExtra = 0;
|
|
576
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, '')){
|
|
577
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
578
|
+
widthExtra = isFullWidth(codePoint) ? FULL_WIDTH_WIDTH : isWide(codePoint) ? WIDE_WIDTH : AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint) ? AMBIGUOUS_WIDTH : REGULAR_WIDTH;
|
|
579
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
580
|
+
if (width + widthExtra > LIMIT) {
|
|
581
|
+
truncationEnabled = true;
|
|
582
|
+
break outer;
|
|
956
583
|
}
|
|
957
|
-
|
|
584
|
+
lengthExtra += char.length;
|
|
585
|
+
width += widthExtra;
|
|
958
586
|
}
|
|
959
|
-
|
|
960
|
-
}
|
|
961
|
-
if (
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
587
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
588
|
+
}
|
|
589
|
+
if (index >= length) break;
|
|
590
|
+
LATIN_RE.lastIndex = index;
|
|
591
|
+
if (LATIN_RE.test(input)) {
|
|
592
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
593
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
594
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
595
|
+
if (width + widthExtra > LIMIT) {
|
|
596
|
+
truncationEnabled = true;
|
|
965
597
|
break;
|
|
966
598
|
}
|
|
967
|
-
|
|
599
|
+
width += widthExtra;
|
|
600
|
+
unmatchedStart = indexPrev;
|
|
601
|
+
unmatchedEnd = index;
|
|
602
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
968
603
|
continue;
|
|
969
604
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
605
|
+
ANSI_RE.lastIndex = index;
|
|
606
|
+
if (ANSI_RE.test(input)) {
|
|
607
|
+
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
608
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
609
|
+
truncationEnabled = true;
|
|
973
610
|
break;
|
|
974
611
|
}
|
|
975
|
-
|
|
612
|
+
width += ANSI_WIDTH;
|
|
613
|
+
unmatchedStart = indexPrev;
|
|
614
|
+
unmatchedEnd = index;
|
|
615
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
976
616
|
continue;
|
|
977
617
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
618
|
+
CONTROL_RE.lastIndex = index;
|
|
619
|
+
if (CONTROL_RE.test(input)) {
|
|
620
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
621
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
622
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
623
|
+
if (width + widthExtra > LIMIT) {
|
|
624
|
+
truncationEnabled = true;
|
|
981
625
|
break;
|
|
982
626
|
}
|
|
983
|
-
|
|
627
|
+
width += widthExtra;
|
|
628
|
+
unmatchedStart = indexPrev;
|
|
629
|
+
unmatchedEnd = index;
|
|
630
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
984
631
|
continue;
|
|
985
632
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
633
|
+
TAB_RE.lastIndex = index;
|
|
634
|
+
if (TAB_RE.test(input)) {
|
|
635
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
636
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
637
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
638
|
+
if (width + widthExtra > LIMIT) {
|
|
639
|
+
truncationEnabled = true;
|
|
989
640
|
break;
|
|
990
641
|
}
|
|
991
|
-
|
|
642
|
+
width += widthExtra;
|
|
643
|
+
unmatchedStart = indexPrev;
|
|
644
|
+
unmatchedEnd = index;
|
|
645
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
992
646
|
continue;
|
|
993
647
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
648
|
+
EMOJI_RE.lastIndex = index;
|
|
649
|
+
if (EMOJI_RE.test(input)) {
|
|
650
|
+
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
651
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
652
|
+
truncationEnabled = true;
|
|
997
653
|
break;
|
|
998
654
|
}
|
|
999
|
-
|
|
655
|
+
width += EMOJI_WIDTH;
|
|
656
|
+
unmatchedStart = indexPrev;
|
|
657
|
+
unmatchedEnd = index;
|
|
658
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
1000
659
|
continue;
|
|
1001
660
|
}
|
|
1002
|
-
|
|
661
|
+
index += 1;
|
|
1003
662
|
}
|
|
1004
663
|
return {
|
|
1005
|
-
width:
|
|
1006
|
-
index:
|
|
1007
|
-
truncated:
|
|
1008
|
-
ellipsed:
|
|
664
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
665
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
666
|
+
truncated: truncationEnabled,
|
|
667
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
1009
668
|
};
|
|
1010
|
-
}
|
|
669
|
+
};
|
|
670
|
+
const dist = getStringTruncatedWidth;
|
|
671
|
+
const dist_NO_TRUNCATION = {
|
|
1011
672
|
limit: 1 / 0,
|
|
1012
|
-
ellipsis:
|
|
673
|
+
ellipsis: '',
|
|
1013
674
|
ellipsisWidth: 0
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
675
|
+
};
|
|
676
|
+
const fastStringWidth = (input, options = {})=>dist(input, dist_NO_TRUNCATION, options).width;
|
|
677
|
+
const fast_string_width_dist = fastStringWidth;
|
|
678
|
+
const ESC = '\x1B';
|
|
679
|
+
const CSI = '\x9B';
|
|
680
|
+
const END_CODE = 39;
|
|
681
|
+
const ANSI_ESCAPE_BELL = '\u0007';
|
|
682
|
+
const ANSI_CSI = '[';
|
|
683
|
+
const ANSI_OSC = ']';
|
|
684
|
+
const ANSI_SGR_TERMINATOR = 'm';
|
|
685
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
686
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
|
|
687
|
+
const getClosingCode = (openingCode)=>{
|
|
688
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
689
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
690
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
691
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
692
|
+
if (1 === openingCode || 2 === openingCode) return 22;
|
|
693
|
+
if (3 === openingCode) return 23;
|
|
694
|
+
if (4 === openingCode) return 24;
|
|
695
|
+
if (7 === openingCode) return 27;
|
|
696
|
+
if (8 === openingCode) return 28;
|
|
697
|
+
if (9 === openingCode) return 29;
|
|
698
|
+
if (0 === openingCode) return 0;
|
|
699
|
+
};
|
|
700
|
+
const wrapAnsiCode = (code)=>`${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
701
|
+
const wrapAnsiHyperlink = (url)=>`${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
702
|
+
const wrapWord = (rows, word, columns)=>{
|
|
703
|
+
const characters = word[Symbol.iterator]();
|
|
704
|
+
let isInsideEscape = false;
|
|
705
|
+
let isInsideLinkEscape = false;
|
|
706
|
+
let lastRow = rows.at(-1);
|
|
707
|
+
let visible = void 0 === lastRow ? 0 : fast_string_width_dist(lastRow);
|
|
708
|
+
let currentCharacter = characters.next();
|
|
709
|
+
let nextCharacter = characters.next();
|
|
710
|
+
let rawCharacterIndex = 0;
|
|
711
|
+
while(!currentCharacter.done){
|
|
712
|
+
const character = currentCharacter.value;
|
|
713
|
+
const characterLength = fast_string_width_dist(character);
|
|
714
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
715
|
+
else {
|
|
716
|
+
rows.push(character);
|
|
717
|
+
visible = 0;
|
|
718
|
+
}
|
|
719
|
+
if (character === ESC || character === CSI) {
|
|
720
|
+
isInsideEscape = true;
|
|
721
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
722
|
+
}
|
|
723
|
+
if (isInsideEscape) {
|
|
724
|
+
if (isInsideLinkEscape) {
|
|
725
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
726
|
+
isInsideEscape = false;
|
|
727
|
+
isInsideLinkEscape = false;
|
|
728
|
+
}
|
|
729
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
730
|
+
} else {
|
|
731
|
+
visible += characterLength;
|
|
732
|
+
if (visible === columns && !nextCharacter.done) {
|
|
733
|
+
rows.push('');
|
|
734
|
+
visible = 0;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
currentCharacter = nextCharacter;
|
|
738
|
+
nextCharacter = characters.next();
|
|
739
|
+
rawCharacterIndex += character.length;
|
|
740
|
+
}
|
|
741
|
+
lastRow = rows.at(-1);
|
|
742
|
+
if (!visible && void 0 !== lastRow && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
743
|
+
};
|
|
744
|
+
const stringVisibleTrimSpacesRight = (string)=>{
|
|
745
|
+
const words = string.split(' ');
|
|
746
|
+
let last = words.length;
|
|
747
|
+
while(last){
|
|
748
|
+
if (fast_string_width_dist(words[last - 1])) break;
|
|
749
|
+
last--;
|
|
750
|
+
}
|
|
751
|
+
if (last === words.length) return string;
|
|
752
|
+
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
|
753
|
+
};
|
|
754
|
+
const exec = (string, columns, options = {})=>{
|
|
755
|
+
if (false !== options.trim && '' === string.trim()) return '';
|
|
756
|
+
let returnValue = '';
|
|
757
|
+
let escapeCode;
|
|
758
|
+
let escapeUrl;
|
|
759
|
+
const words = string.split(' ');
|
|
760
|
+
let rows = [
|
|
761
|
+
''
|
|
1043
762
|
];
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1048
|
-
const
|
|
1049
|
-
|
|
763
|
+
let rowLength = 0;
|
|
764
|
+
for(let index = 0; index < words.length; index++){
|
|
765
|
+
const word = words[index];
|
|
766
|
+
if (false !== options.trim) {
|
|
767
|
+
const row = rows.at(-1) ?? '';
|
|
768
|
+
const trimmed = row.trimStart();
|
|
769
|
+
if (row.length !== trimmed.length) {
|
|
770
|
+
rows[rows.length - 1] = trimmed;
|
|
771
|
+
rowLength = fast_string_width_dist(trimmed);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (0 !== index) {
|
|
775
|
+
if (rowLength >= columns && (false === options.wordWrap || false === options.trim)) {
|
|
776
|
+
rows.push('');
|
|
777
|
+
rowLength = 0;
|
|
778
|
+
}
|
|
779
|
+
if (rowLength || false === options.trim) {
|
|
780
|
+
rows[rows.length - 1] += ' ';
|
|
781
|
+
rowLength++;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
const wordLength = fast_string_width_dist(word);
|
|
785
|
+
if (options.hard && wordLength > columns) {
|
|
786
|
+
const remainingColumns = columns - rowLength;
|
|
787
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
788
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
789
|
+
if (breaksStartingNextLine < breaksStartingThisLine) rows.push('');
|
|
790
|
+
wrapWord(rows, word, columns);
|
|
791
|
+
rowLength = fast_string_width_dist(rows.at(-1) ?? '');
|
|
1050
792
|
continue;
|
|
1051
793
|
}
|
|
1052
|
-
if (
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
794
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
795
|
+
if (false === options.wordWrap && rowLength < columns) {
|
|
796
|
+
wrapWord(rows, word, columns);
|
|
797
|
+
rowLength = fast_string_width_dist(rows.at(-1) ?? '');
|
|
1055
798
|
continue;
|
|
1056
799
|
}
|
|
1057
|
-
|
|
800
|
+
rows.push('');
|
|
801
|
+
rowLength = 0;
|
|
1058
802
|
}
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
803
|
+
if (rowLength + wordLength > columns && false === options.wordWrap) {
|
|
804
|
+
wrapWord(rows, word, columns);
|
|
805
|
+
rowLength = fast_string_width_dist(rows.at(-1) ?? '');
|
|
1061
806
|
continue;
|
|
1062
807
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
let
|
|
1069
|
-
for(;
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
808
|
+
rows[rows.length - 1] += word;
|
|
809
|
+
rowLength += wordLength;
|
|
810
|
+
}
|
|
811
|
+
if (false !== options.trim) rows = rows.map((row)=>stringVisibleTrimSpacesRight(row));
|
|
812
|
+
const preString = rows.join('\n');
|
|
813
|
+
let inSurrogate = false;
|
|
814
|
+
for(let i = 0; i < preString.length; i++){
|
|
815
|
+
const character = preString[i];
|
|
816
|
+
returnValue += character;
|
|
817
|
+
if (!inSurrogate) {
|
|
818
|
+
inSurrogate = character >= '\ud800' && character <= '\udbff';
|
|
819
|
+
if (character === ESC || character === CSI) {
|
|
820
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
821
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
822
|
+
const groups = groupsResult?.groups;
|
|
823
|
+
if (groups?.code !== void 0) {
|
|
824
|
+
const code = Number.parseFloat(groups.code);
|
|
825
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
826
|
+
} else if (groups?.uri !== void 0) escapeUrl = 0 === groups.uri.length ? void 0 : groups.uri;
|
|
827
|
+
}
|
|
828
|
+
if ('\n' === preString[i + 1]) {
|
|
829
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink('');
|
|
830
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
831
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
832
|
+
} else if ('\n' === character) {
|
|
833
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
834
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return returnValue;
|
|
1085
839
|
};
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
840
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
841
|
+
function wrapAnsi(string, columns, options) {
|
|
842
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line, columns, options)).join('\n');
|
|
843
|
+
}
|
|
844
|
+
const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
|
|
845
|
+
function dist_d(r, t, e) {
|
|
846
|
+
if (!e.some((o)=>!o.disabled)) return r;
|
|
847
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
848
|
+
return e[n].disabled ? dist_d(n, t < 0 ? -1 : 1, e) : n;
|
|
1092
849
|
}
|
|
1093
|
-
const
|
|
850
|
+
const E = [
|
|
1094
851
|
"up",
|
|
1095
852
|
"down",
|
|
1096
853
|
"left",
|
|
@@ -1098,8 +855,21 @@ const At = [
|
|
|
1098
855
|
"space",
|
|
1099
856
|
"enter",
|
|
1100
857
|
"cancel"
|
|
1101
|
-
],
|
|
1102
|
-
|
|
858
|
+
], dist_G = [
|
|
859
|
+
"January",
|
|
860
|
+
"February",
|
|
861
|
+
"March",
|
|
862
|
+
"April",
|
|
863
|
+
"May",
|
|
864
|
+
"June",
|
|
865
|
+
"July",
|
|
866
|
+
"August",
|
|
867
|
+
"September",
|
|
868
|
+
"October",
|
|
869
|
+
"November",
|
|
870
|
+
"December"
|
|
871
|
+
], dist_u = {
|
|
872
|
+
actions: new Set(E),
|
|
1103
873
|
aliases: new Map([
|
|
1104
874
|
[
|
|
1105
875
|
"k",
|
|
@@ -1130,46 +900,58 @@ const At = [
|
|
|
1130
900
|
cancel: "Canceled",
|
|
1131
901
|
error: "Something went wrong"
|
|
1132
902
|
},
|
|
1133
|
-
withGuide: !0
|
|
903
|
+
withGuide: !0,
|
|
904
|
+
date: {
|
|
905
|
+
monthNames: [
|
|
906
|
+
...dist_G
|
|
907
|
+
],
|
|
908
|
+
messages: {
|
|
909
|
+
required: "Please enter a valid date",
|
|
910
|
+
invalidMonth: "There are only 12 months in a year",
|
|
911
|
+
invalidDay: (r, t)=>`There are only ${r} days in ${t}`,
|
|
912
|
+
afterMin: (r)=>`Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
913
|
+
beforeMax: (r)=>`Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
914
|
+
}
|
|
915
|
+
}
|
|
1134
916
|
};
|
|
1135
|
-
function
|
|
1136
|
-
if ("string" == typeof
|
|
1137
|
-
for (const
|
|
917
|
+
function V(r, t) {
|
|
918
|
+
if ("string" == typeof r) return dist_u.aliases.get(r) === t;
|
|
919
|
+
for (const e of r)if (void 0 !== e && V(e, t)) return !0;
|
|
1138
920
|
return !1;
|
|
1139
921
|
}
|
|
1140
|
-
function
|
|
1141
|
-
if (
|
|
1142
|
-
const
|
|
1143
|
-
`),
|
|
1144
|
-
`),
|
|
1145
|
-
for(let
|
|
922
|
+
function dist_j(r, t) {
|
|
923
|
+
if (r === t) return;
|
|
924
|
+
const e = r.split(`
|
|
925
|
+
`), s = t.split(`
|
|
926
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
927
|
+
for(let o = 0; o < i; o++)e[o] !== s[o] && n.push(o);
|
|
1146
928
|
return {
|
|
1147
929
|
lines: n,
|
|
1148
|
-
numLinesBefore:
|
|
1149
|
-
numLinesAfter:
|
|
1150
|
-
numLines:
|
|
930
|
+
numLinesBefore: e.length,
|
|
931
|
+
numLinesAfter: s.length,
|
|
932
|
+
numLines: i
|
|
1151
933
|
};
|
|
1152
934
|
}
|
|
1153
935
|
globalThis.process.platform.startsWith("win");
|
|
1154
|
-
const
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
936
|
+
const dist_C = Symbol("clack:cancel");
|
|
937
|
+
function dist_q(r) {
|
|
938
|
+
return r === dist_C;
|
|
1157
939
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const
|
|
1160
|
-
|
|
940
|
+
function w(r, t) {
|
|
941
|
+
const e = r;
|
|
942
|
+
e.isTTY && e.setRawMode(t);
|
|
1161
943
|
}
|
|
1162
|
-
const
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
1165
|
-
return
|
|
944
|
+
const O = (r)=>"columns" in r && "number" == typeof r.columns ? r.columns : 80, dist_A = (r)=>"rows" in r && "number" == typeof r.rows ? r.rows : 20;
|
|
945
|
+
function dist_R(r, t, e, s = e) {
|
|
946
|
+
const i = O(r ?? stdout);
|
|
947
|
+
return wrapAnsi(t, i - e.length, {
|
|
1166
948
|
hard: !0,
|
|
1167
949
|
trim: !1
|
|
1168
950
|
}).split(`
|
|
1169
|
-
`).map((n,
|
|
951
|
+
`).map((n, o)=>`${0 === o ? s : e}${n}`).join(`
|
|
1170
952
|
`);
|
|
1171
953
|
}
|
|
1172
|
-
class
|
|
954
|
+
let dist_p = class {
|
|
1173
955
|
input;
|
|
1174
956
|
output;
|
|
1175
957
|
_abortSignal;
|
|
@@ -1184,37 +966,37 @@ class dist_B {
|
|
|
1184
966
|
error = "";
|
|
1185
967
|
value;
|
|
1186
968
|
userInput = "";
|
|
1187
|
-
constructor(
|
|
1188
|
-
const { input:
|
|
1189
|
-
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track =
|
|
969
|
+
constructor(t, e = !0){
|
|
970
|
+
const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
|
|
971
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
1190
972
|
}
|
|
1191
973
|
unsubscribe() {
|
|
1192
974
|
this._subscribers.clear();
|
|
1193
975
|
}
|
|
1194
|
-
setSubscriber(
|
|
1195
|
-
const
|
|
1196
|
-
|
|
976
|
+
setSubscriber(t, e) {
|
|
977
|
+
const s = this._subscribers.get(t) ?? [];
|
|
978
|
+
s.push(e), this._subscribers.set(t, s);
|
|
1197
979
|
}
|
|
1198
|
-
on(
|
|
1199
|
-
this.setSubscriber(
|
|
1200
|
-
cb:
|
|
980
|
+
on(t, e) {
|
|
981
|
+
this.setSubscriber(t, {
|
|
982
|
+
cb: e
|
|
1201
983
|
});
|
|
1202
984
|
}
|
|
1203
|
-
once(
|
|
1204
|
-
this.setSubscriber(
|
|
1205
|
-
cb:
|
|
985
|
+
once(t, e) {
|
|
986
|
+
this.setSubscriber(t, {
|
|
987
|
+
cb: e,
|
|
1206
988
|
once: !0
|
|
1207
989
|
});
|
|
1208
990
|
}
|
|
1209
|
-
emit(
|
|
1210
|
-
const
|
|
1211
|
-
for (const n of
|
|
1212
|
-
for (const n of
|
|
991
|
+
emit(t, ...e) {
|
|
992
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
993
|
+
for (const n of s)n.cb(...e), n.once && i.push(()=>s.splice(s.indexOf(n), 1));
|
|
994
|
+
for (const n of i)n();
|
|
1213
995
|
}
|
|
1214
996
|
prompt() {
|
|
1215
|
-
return new Promise((
|
|
997
|
+
return new Promise((t)=>{
|
|
1216
998
|
if (this._abortSignal) {
|
|
1217
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
999
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(dist_C);
|
|
1218
1000
|
this._abortSignal.addEventListener("abort", ()=>{
|
|
1219
1001
|
this.state = "cancel", this.close();
|
|
1220
1002
|
}, {
|
|
@@ -1227,21 +1009,21 @@ class dist_B {
|
|
|
1227
1009
|
prompt: "",
|
|
1228
1010
|
escapeCodeTimeout: 50,
|
|
1229
1011
|
terminal: !0
|
|
1230
|
-
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
1231
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render),
|
|
1012
|
+
}), this.rl.prompt(), void 0 !== this.opts.initialUserInput && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
|
|
1013
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(this.value);
|
|
1232
1014
|
}), this.once("cancel", ()=>{
|
|
1233
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render),
|
|
1015
|
+
this.output.write(src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(dist_C);
|
|
1234
1016
|
});
|
|
1235
1017
|
});
|
|
1236
1018
|
}
|
|
1237
|
-
_isActionKey(
|
|
1238
|
-
return " " ===
|
|
1019
|
+
_isActionKey(t, e) {
|
|
1020
|
+
return " " === t;
|
|
1239
1021
|
}
|
|
1240
|
-
_setValue(
|
|
1241
|
-
this.value =
|
|
1022
|
+
_setValue(t) {
|
|
1023
|
+
this.value = t, this.emit("value", this.value);
|
|
1242
1024
|
}
|
|
1243
|
-
_setUserInput(
|
|
1244
|
-
this.userInput =
|
|
1025
|
+
_setUserInput(t, e) {
|
|
1026
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
1245
1027
|
}
|
|
1246
1028
|
_clearUserInput() {
|
|
1247
1029
|
this.rl?.write(null, {
|
|
@@ -1249,121 +1031,280 @@ class dist_B {
|
|
|
1249
1031
|
name: "u"
|
|
1250
1032
|
}), this._setUserInput("");
|
|
1251
1033
|
}
|
|
1252
|
-
onKeypress(
|
|
1253
|
-
if (this._track && "return" !==
|
|
1034
|
+
onKeypress(t, e) {
|
|
1035
|
+
if (this._track && "return" !== e.name && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
1254
1036
|
ctrl: !0,
|
|
1255
1037
|
name: "h"
|
|
1256
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"),
|
|
1038
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), "error" === this.state && (this.state = "active"), e?.name && (!this._track && dist_u.aliases.has(e.name) && this.emit("cursor", dist_u.aliases.get(e.name)), dist_u.actions.has(e.name) && this.emit("cursor", e.name)), t && ("y" === t.toLowerCase() || "n" === t.toLowerCase()) && this.emit("confirm", "y" === t.toLowerCase()), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
|
|
1257
1039
|
if (this.opts.validate) {
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1040
|
+
const s = this.opts.validate(this.value);
|
|
1041
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
1260
1042
|
}
|
|
1261
1043
|
"error" !== this.state && (this.state = "submit");
|
|
1262
1044
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1045
|
+
V([
|
|
1046
|
+
t,
|
|
1047
|
+
e?.name,
|
|
1048
|
+
e?.sequence
|
|
1267
1049
|
], "cancel") && (this.state = "cancel"), ("submit" === this.state || "cancel" === this.state) && this.emit("finalize"), this.render(), ("submit" === this.state || "cancel" === this.state) && this.close();
|
|
1268
1050
|
}
|
|
1269
1051
|
close() {
|
|
1270
1052
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1271
|
-
`),
|
|
1053
|
+
`), w(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1272
1054
|
}
|
|
1273
1055
|
restoreCursor() {
|
|
1274
|
-
const
|
|
1056
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
1275
1057
|
hard: !0,
|
|
1276
1058
|
trim: !1
|
|
1277
1059
|
}).split(`
|
|
1278
1060
|
`).length - 1;
|
|
1279
|
-
this.output.write(src.cursor.move(-999, -1 *
|
|
1061
|
+
this.output.write(src.cursor.move(-999, -1 * t));
|
|
1280
1062
|
}
|
|
1281
1063
|
render() {
|
|
1282
|
-
const
|
|
1064
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
1283
1065
|
hard: !0,
|
|
1284
1066
|
trim: !1
|
|
1285
1067
|
});
|
|
1286
|
-
if (
|
|
1068
|
+
if (t !== this._prevFrame) {
|
|
1287
1069
|
if ("initial" === this.state) this.output.write(src.cursor.hide);
|
|
1288
1070
|
else {
|
|
1289
|
-
const
|
|
1290
|
-
if (this.restoreCursor(),
|
|
1291
|
-
const
|
|
1292
|
-
let
|
|
1293
|
-
if (void 0 ===
|
|
1294
|
-
this._prevFrame =
|
|
1071
|
+
const e = dist_j(this._prevFrame, t), s = dist_A(this.output);
|
|
1072
|
+
if (this.restoreCursor(), e) {
|
|
1073
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
1074
|
+
let o = e.lines.find((a)=>a >= i);
|
|
1075
|
+
if (void 0 === o) {
|
|
1076
|
+
this._prevFrame = t;
|
|
1295
1077
|
return;
|
|
1296
1078
|
}
|
|
1297
|
-
if (1 ===
|
|
1298
|
-
this.output.write(src.cursor.move(0,
|
|
1299
|
-
const a =
|
|
1079
|
+
if (1 === e.lines.length) {
|
|
1080
|
+
this.output.write(src.cursor.move(0, o - n)), this.output.write(src.erase.lines(1));
|
|
1081
|
+
const a = t.split(`
|
|
1300
1082
|
`);
|
|
1301
|
-
this.output.write(a[
|
|
1083
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(src.cursor.move(0, a.length - o - 1));
|
|
1302
1084
|
return;
|
|
1303
1085
|
}
|
|
1304
|
-
if (
|
|
1305
|
-
if (
|
|
1086
|
+
if (e.lines.length > 1) {
|
|
1087
|
+
if (i < n) o = i;
|
|
1306
1088
|
else {
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1089
|
+
const h = o - n;
|
|
1090
|
+
h > 0 && this.output.write(src.cursor.move(0, h));
|
|
1309
1091
|
}
|
|
1310
1092
|
this.output.write(src.erase.down());
|
|
1311
|
-
const a =
|
|
1312
|
-
`).slice(
|
|
1093
|
+
const a = t.split(`
|
|
1094
|
+
`).slice(o);
|
|
1313
1095
|
this.output.write(a.join(`
|
|
1314
|
-
`)), this._prevFrame =
|
|
1096
|
+
`)), this._prevFrame = t;
|
|
1315
1097
|
return;
|
|
1316
1098
|
}
|
|
1317
1099
|
}
|
|
1318
1100
|
this.output.write(src.erase.down());
|
|
1319
1101
|
}
|
|
1320
|
-
this.output.write(
|
|
1102
|
+
this.output.write(t), "initial" === this.state && (this.state = "active"), this._prevFrame = t;
|
|
1321
1103
|
}
|
|
1322
1104
|
}
|
|
1105
|
+
};
|
|
1106
|
+
function dist_W(r, t) {
|
|
1107
|
+
if (void 0 === r || 0 === t.length) return 0;
|
|
1108
|
+
const e = t.findIndex((s)=>s.value === r);
|
|
1109
|
+
return -1 !== e ? e : 0;
|
|
1323
1110
|
}
|
|
1324
|
-
|
|
1111
|
+
function dist_B(r, t) {
|
|
1112
|
+
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
1113
|
+
}
|
|
1114
|
+
function J(r, t) {
|
|
1115
|
+
if (t) return r ? t : t[0];
|
|
1116
|
+
}
|
|
1117
|
+
let H = class extends dist_p {
|
|
1118
|
+
filteredOptions;
|
|
1119
|
+
multiple;
|
|
1120
|
+
isNavigating = !1;
|
|
1121
|
+
selectedValues = [];
|
|
1122
|
+
focusedValue;
|
|
1123
|
+
#e = 0;
|
|
1124
|
+
#o = "";
|
|
1125
|
+
#t;
|
|
1126
|
+
#n;
|
|
1127
|
+
#a;
|
|
1128
|
+
get cursor() {
|
|
1129
|
+
return this.#e;
|
|
1130
|
+
}
|
|
1131
|
+
get userInputWithCursor() {
|
|
1132
|
+
if (!this.userInput) return styleText([
|
|
1133
|
+
"inverse",
|
|
1134
|
+
"hidden"
|
|
1135
|
+
], "_");
|
|
1136
|
+
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
1137
|
+
const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
|
|
1138
|
+
return `${t}${styleText("inverse", e)}${s.join("")}`;
|
|
1139
|
+
}
|
|
1140
|
+
get options() {
|
|
1141
|
+
return "function" == typeof this.#n ? this.#n() : this.#n;
|
|
1142
|
+
}
|
|
1143
|
+
constructor(t){
|
|
1144
|
+
super(t), this.#n = t.options, this.#a = t.placeholder;
|
|
1145
|
+
const e = this.options;
|
|
1146
|
+
this.filteredOptions = [
|
|
1147
|
+
...e
|
|
1148
|
+
], this.multiple = !0 === t.multiple, this.#t = "function" == typeof t.options ? t.filter : t.filter ?? dist_B;
|
|
1149
|
+
let s;
|
|
1150
|
+
if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? s = t.initialValue : s = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [
|
|
1151
|
+
this.options[0].value
|
|
1152
|
+
]), s) for (const i of s){
|
|
1153
|
+
const n = e.findIndex((o)=>o.value === i);
|
|
1154
|
+
-1 !== n && (this.toggleSelected(i), this.#e = n);
|
|
1155
|
+
}
|
|
1156
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n)=>this.#s(i, n)), this.on("userInput", (i)=>this.#i(i));
|
|
1157
|
+
}
|
|
1158
|
+
_isActionKey(t, e) {
|
|
1159
|
+
return " " === t || this.multiple && this.isNavigating && "space" === e.name && void 0 !== t && "" !== t;
|
|
1160
|
+
}
|
|
1161
|
+
#s(t, e) {
|
|
1162
|
+
const s = "up" === e.name, i = "down" === e.name, n = "return" === e.name, o = "" === this.userInput || " " === this.userInput, a = this.#a, h = this.options, l = void 0 !== a && "" !== a && h.some((f)=>!f.disabled && (this.#t ? this.#t(a, f) : !0));
|
|
1163
|
+
if ("tab" === e.name && o && l) {
|
|
1164
|
+
" " === this.userInput && this._clearUserInput(), this._setUserInput(a, !0), this.isNavigating = !1;
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
s || i ? (this.#e = dist_d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [
|
|
1168
|
+
this.focusedValue
|
|
1169
|
+
]), this.isNavigating = !0) : n ? this.value = J(this.multiple, this.selectedValues) : this.multiple ? void 0 !== this.focusedValue && ("tab" === e.name || this.isNavigating && "space" === e.name) ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [
|
|
1170
|
+
this.focusedValue
|
|
1171
|
+
]), this.isNavigating = !1);
|
|
1172
|
+
}
|
|
1173
|
+
deselectAll() {
|
|
1174
|
+
this.selectedValues = [];
|
|
1175
|
+
}
|
|
1176
|
+
toggleSelected(t) {
|
|
1177
|
+
0 !== this.filteredOptions.length && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e)=>e !== t) : this.selectedValues = [
|
|
1178
|
+
...this.selectedValues,
|
|
1179
|
+
t
|
|
1180
|
+
] : this.selectedValues = [
|
|
1181
|
+
t
|
|
1182
|
+
]);
|
|
1183
|
+
}
|
|
1184
|
+
#i(t) {
|
|
1185
|
+
if (t !== this.#o) {
|
|
1186
|
+
this.#o = t;
|
|
1187
|
+
const e = this.options;
|
|
1188
|
+
t && this.#t ? this.filteredOptions = e.filter((n)=>this.#t?.(t, n)) : this.filteredOptions = [
|
|
1189
|
+
...e
|
|
1190
|
+
];
|
|
1191
|
+
const s = dist_W(this.focusedValue, this.filteredOptions);
|
|
1192
|
+
this.#e = dist_d(s, 0, this.filteredOptions);
|
|
1193
|
+
const i = this.filteredOptions[this.#e];
|
|
1194
|
+
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
class st extends dist_p {
|
|
1199
|
+
options;
|
|
1200
|
+
cursor = 0;
|
|
1201
|
+
#e;
|
|
1202
|
+
getGroupItems(t) {
|
|
1203
|
+
return this.options.filter((e)=>e.group === t);
|
|
1204
|
+
}
|
|
1205
|
+
isGroupSelected(t) {
|
|
1206
|
+
const e = this.getGroupItems(t), s = this.value;
|
|
1207
|
+
return void 0 === s ? !1 : e.every((i)=>s.includes(i.value));
|
|
1208
|
+
}
|
|
1209
|
+
toggleValue() {
|
|
1210
|
+
const t = this.options[this.cursor];
|
|
1211
|
+
if (void 0 === this.value && (this.value = []), !0 === t.group) {
|
|
1212
|
+
const e = t.value, s = this.getGroupItems(e);
|
|
1213
|
+
this.isGroupSelected(e) ? this.value = this.value.filter((i)=>-1 === s.findIndex((n)=>n.value === i)) : this.value = [
|
|
1214
|
+
...this.value,
|
|
1215
|
+
...s.map((i)=>i.value)
|
|
1216
|
+
], this.value = Array.from(new Set(this.value));
|
|
1217
|
+
} else {
|
|
1218
|
+
const e = this.value.includes(t.value);
|
|
1219
|
+
this.value = e ? this.value.filter((s)=>s !== t.value) : [
|
|
1220
|
+
...this.value,
|
|
1221
|
+
t.value
|
|
1222
|
+
];
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
constructor(t){
|
|
1226
|
+
super(t, !1);
|
|
1227
|
+
const { options: e } = t;
|
|
1228
|
+
this.#e = !1 !== t.selectableGroups, this.options = Object.entries(e).flatMap(([s, i])=>[
|
|
1229
|
+
{
|
|
1230
|
+
value: s,
|
|
1231
|
+
group: !0,
|
|
1232
|
+
label: s
|
|
1233
|
+
},
|
|
1234
|
+
...i.map((n)=>({
|
|
1235
|
+
...n,
|
|
1236
|
+
group: s
|
|
1237
|
+
}))
|
|
1238
|
+
]), this.value = [
|
|
1239
|
+
...t.initialValues ?? []
|
|
1240
|
+
], this.cursor = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s)=>{
|
|
1241
|
+
switch(s){
|
|
1242
|
+
case "left":
|
|
1243
|
+
case "up":
|
|
1244
|
+
{
|
|
1245
|
+
this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1;
|
|
1246
|
+
const i = this.options[this.cursor]?.group === !0;
|
|
1247
|
+
!this.#e && i && (this.cursor = 0 === this.cursor ? this.options.length - 1 : this.cursor - 1);
|
|
1248
|
+
break;
|
|
1249
|
+
}
|
|
1250
|
+
case "down":
|
|
1251
|
+
case "right":
|
|
1252
|
+
{
|
|
1253
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1254
|
+
const i = this.options[this.cursor]?.group === !0;
|
|
1255
|
+
!this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
case "space":
|
|
1259
|
+
this.toggleValue();
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
let it = class extends dist_p {
|
|
1325
1266
|
options;
|
|
1326
1267
|
cursor = 0;
|
|
1327
1268
|
get _value() {
|
|
1328
1269
|
return this.options[this.cursor].value;
|
|
1329
1270
|
}
|
|
1330
1271
|
get _enabledOptions() {
|
|
1331
|
-
return this.options.filter((
|
|
1272
|
+
return this.options.filter((t)=>!0 !== t.disabled);
|
|
1332
1273
|
}
|
|
1333
1274
|
toggleAll() {
|
|
1334
|
-
const
|
|
1335
|
-
this.value =
|
|
1275
|
+
const t = this._enabledOptions, e = void 0 !== this.value && this.value.length === t.length;
|
|
1276
|
+
this.value = e ? [] : t.map((s)=>s.value);
|
|
1336
1277
|
}
|
|
1337
1278
|
toggleInvert() {
|
|
1338
|
-
const
|
|
1339
|
-
if (!
|
|
1340
|
-
const
|
|
1341
|
-
this.value =
|
|
1279
|
+
const t = this.value;
|
|
1280
|
+
if (!t) return;
|
|
1281
|
+
const e = this._enabledOptions.filter((s)=>!t.includes(s.value));
|
|
1282
|
+
this.value = e.map((s)=>s.value);
|
|
1342
1283
|
}
|
|
1343
1284
|
toggleValue() {
|
|
1344
1285
|
void 0 === this.value && (this.value = []);
|
|
1345
|
-
const
|
|
1346
|
-
this.value =
|
|
1286
|
+
const t = this.value.includes(this._value);
|
|
1287
|
+
this.value = t ? this.value.filter((e)=>e !== this._value) : [
|
|
1347
1288
|
...this.value,
|
|
1348
1289
|
this._value
|
|
1349
1290
|
];
|
|
1350
1291
|
}
|
|
1351
|
-
constructor(
|
|
1352
|
-
super(
|
|
1353
|
-
...
|
|
1292
|
+
constructor(t){
|
|
1293
|
+
super(t, !1), this.options = t.options, this.value = [
|
|
1294
|
+
...t.initialValues ?? []
|
|
1354
1295
|
];
|
|
1355
|
-
const
|
|
1356
|
-
this.cursor = this.options[
|
|
1357
|
-
"a" ===
|
|
1358
|
-
}), this.on("cursor", (
|
|
1359
|
-
switch(
|
|
1296
|
+
const e = Math.max(this.options.findIndex(({ value: s })=>s === t.cursorAt), 0);
|
|
1297
|
+
this.cursor = this.options[e].disabled ? dist_d(e, 1, this.options) : e, this.on("key", (s)=>{
|
|
1298
|
+
"a" === s && this.toggleAll(), "i" === s && this.toggleInvert();
|
|
1299
|
+
}), this.on("cursor", (s)=>{
|
|
1300
|
+
switch(s){
|
|
1360
1301
|
case "left":
|
|
1361
1302
|
case "up":
|
|
1362
|
-
this.cursor =
|
|
1303
|
+
this.cursor = dist_d(this.cursor, -1, this.options);
|
|
1363
1304
|
break;
|
|
1364
1305
|
case "down":
|
|
1365
1306
|
case "right":
|
|
1366
|
-
this.cursor =
|
|
1307
|
+
this.cursor = dist_d(this.cursor, 1, this.options);
|
|
1367
1308
|
break;
|
|
1368
1309
|
case "space":
|
|
1369
1310
|
this.toggleValue();
|
|
@@ -1372,7 +1313,7 @@ let Lt = class extends dist_B {
|
|
|
1372
1313
|
});
|
|
1373
1314
|
}
|
|
1374
1315
|
};
|
|
1375
|
-
class
|
|
1316
|
+
class nt extends dist_p {
|
|
1376
1317
|
options;
|
|
1377
1318
|
cursor = 0;
|
|
1378
1319
|
get _selectedValue() {
|
|
@@ -1381,287 +1322,379 @@ class Tt extends dist_B {
|
|
|
1381
1322
|
changeValue() {
|
|
1382
1323
|
this.value = this._selectedValue.value;
|
|
1383
1324
|
}
|
|
1384
|
-
constructor(
|
|
1385
|
-
super(
|
|
1386
|
-
const
|
|
1387
|
-
this.cursor = this.options[
|
|
1388
|
-
switch(
|
|
1325
|
+
constructor(t){
|
|
1326
|
+
super(t, !1), this.options = t.options;
|
|
1327
|
+
const e = this.options.findIndex(({ value: i })=>i === t.initialValue), s = -1 === e ? 0 : e;
|
|
1328
|
+
this.cursor = this.options[s].disabled ? dist_d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i)=>{
|
|
1329
|
+
switch(i){
|
|
1389
1330
|
case "left":
|
|
1390
1331
|
case "up":
|
|
1391
|
-
this.cursor =
|
|
1332
|
+
this.cursor = dist_d(this.cursor, -1, this.options);
|
|
1392
1333
|
break;
|
|
1393
1334
|
case "down":
|
|
1394
1335
|
case "right":
|
|
1395
|
-
this.cursor =
|
|
1336
|
+
this.cursor = dist_d(this.cursor, 1, this.options);
|
|
1396
1337
|
break;
|
|
1397
1338
|
}
|
|
1398
1339
|
this.changeValue();
|
|
1399
1340
|
});
|
|
1400
1341
|
}
|
|
1401
1342
|
}
|
|
1402
|
-
class
|
|
1343
|
+
class at extends dist_p {
|
|
1403
1344
|
get userInputWithCursor() {
|
|
1404
1345
|
if ("submit" === this.state) return this.userInput;
|
|
1405
|
-
const
|
|
1406
|
-
if (this.cursor >=
|
|
1407
|
-
const
|
|
1408
|
-
return `${
|
|
1346
|
+
const t = this.userInput;
|
|
1347
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
1348
|
+
const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
|
|
1349
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
1409
1350
|
}
|
|
1410
1351
|
get cursor() {
|
|
1411
1352
|
return this._cursor;
|
|
1412
1353
|
}
|
|
1413
|
-
constructor(
|
|
1354
|
+
constructor(t){
|
|
1414
1355
|
super({
|
|
1415
|
-
...
|
|
1416
|
-
initialUserInput:
|
|
1417
|
-
}), this.on("userInput", (
|
|
1418
|
-
this._setValue(
|
|
1356
|
+
...t,
|
|
1357
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
1358
|
+
}), this.on("userInput", (e)=>{
|
|
1359
|
+
this._setValue(e);
|
|
1419
1360
|
}), this.on("finalize", ()=>{
|
|
1420
|
-
this.value || (this.value =
|
|
1361
|
+
this.value || (this.value = t.defaultValue), void 0 === this.value && (this.value = "");
|
|
1421
1362
|
});
|
|
1422
1363
|
}
|
|
1423
1364
|
}
|
|
1424
|
-
function
|
|
1365
|
+
function Ze() {
|
|
1425
1366
|
return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
|
|
1426
1367
|
}
|
|
1427
|
-
const ee =
|
|
1368
|
+
const ee = Ze(), ae = ()=>"true" === process.env.CI, Te = (e)=>!0 === e.isTTY, dist_w = (e, i)=>ee ? e : i, _e = dist_w("\u25C6", "*"), oe = dist_w("\u25A0", "x"), ue = dist_w("\u25B2", "x"), dist_F = dist_w("\u25C7", "o"), prompts_dist_d = (dist_w("\u250C", "T"), dist_w("\u2502", "|")), dist_E = dist_w("\u2514", "\u2014"), dist_z = (dist_w("\u2510", "T"), dist_w("\u2518", "\u2014"), dist_w("\u25CF", ">")), dist_H = dist_w("\u25CB", " "), te = dist_w("\u25FB", "[\u2022]"), dist_U = dist_w("\u25FC", "[+]"), dist_J = dist_w("\u25FB", "[ ]"), se = (dist_w("\u25AA", "\u2022"), dist_w("\u2500", "-")), ce = dist_w("\u256E", "+"), Ge = dist_w("\u251C", "+"), $e = dist_w("\u256F", "+"), de = dist_w("\u2570", "+"), he = (dist_w("\u256D", "+"), dist_w("\u25CF", "\u2022")), pe = dist_w("\u25C6", "*"), me = dist_w("\u25B2", "!"), ge = dist_w("\u25A0", "x"), dist_V = (e)=>{
|
|
1428
1369
|
switch(e){
|
|
1429
1370
|
case "initial":
|
|
1430
1371
|
case "active":
|
|
1431
|
-
return styleText("cyan",
|
|
1372
|
+
return styleText("cyan", _e);
|
|
1432
1373
|
case "cancel":
|
|
1433
|
-
return styleText("red",
|
|
1374
|
+
return styleText("red", oe);
|
|
1434
1375
|
case "error":
|
|
1435
|
-
return styleText("yellow",
|
|
1376
|
+
return styleText("yellow", ue);
|
|
1436
1377
|
case "submit":
|
|
1437
|
-
return styleText("green",
|
|
1378
|
+
return styleText("green", dist_F);
|
|
1438
1379
|
}
|
|
1439
|
-
}
|
|
1380
|
+
}, ye = (e)=>{
|
|
1440
1381
|
switch(e){
|
|
1441
1382
|
case "initial":
|
|
1442
1383
|
case "active":
|
|
1443
|
-
return styleText("cyan",
|
|
1384
|
+
return styleText("cyan", prompts_dist_d);
|
|
1444
1385
|
case "cancel":
|
|
1445
|
-
return styleText("red",
|
|
1386
|
+
return styleText("red", prompts_dist_d);
|
|
1446
1387
|
case "error":
|
|
1447
|
-
return styleText("yellow",
|
|
1388
|
+
return styleText("yellow", prompts_dist_d);
|
|
1448
1389
|
case "submit":
|
|
1449
|
-
return styleText("green",
|
|
1450
|
-
}
|
|
1451
|
-
}, dist_mt = (e)=>161 === e || 164 === e || 167 === e || 168 === e || 170 === e || 173 === e || 174 === e || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || 198 === e || 208 === e || 215 === e || 216 === e || e >= 222 && e <= 225 || 230 === e || e >= 232 && e <= 234 || 236 === e || 237 === e || 240 === e || 242 === e || 243 === e || e >= 247 && e <= 250 || 252 === e || 254 === e || 257 === e || 273 === e || 275 === e || 283 === e || 294 === e || 295 === e || 299 === e || e >= 305 && e <= 307 || 312 === e || e >= 319 && e <= 322 || 324 === e || e >= 328 && e <= 331 || 333 === e || 338 === e || 339 === e || 358 === e || 359 === e || 363 === e || 462 === e || 464 === e || 466 === e || 468 === e || 470 === e || 472 === e || 474 === e || 476 === e || 593 === e || 609 === e || 708 === e || 711 === e || e >= 713 && e <= 715 || 717 === e || 720 === e || e >= 728 && e <= 731 || 733 === e || 735 === e || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || 1025 === e || e >= 1040 && e <= 1103 || 1105 === e || 8208 === e || e >= 8211 && e <= 8214 || 8216 === e || 8217 === e || 8220 === e || 8221 === e || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || 8240 === e || 8242 === e || 8243 === e || 8245 === e || 8251 === e || 8254 === e || 8308 === e || 8319 === e || e >= 8321 && e <= 8324 || 8364 === e || 8451 === e || 8453 === e || 8457 === e || 8467 === e || 8470 === e || 8481 === e || 8482 === e || 8486 === e || 8491 === e || 8531 === e || 8532 === e || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || 8585 === e || e >= 8592 && e <= 8601 || 8632 === e || 8633 === e || 8658 === e || 8660 === e || 8679 === e || 8704 === e || 8706 === e || 8707 === e || 8711 === e || 8712 === e || 8715 === e || 8719 === e || 8721 === e || 8725 === e || 8730 === e || e >= 8733 && e <= 8736 || 8739 === e || 8741 === e || e >= 8743 && e <= 8748 || 8750 === e || e >= 8756 && e <= 8759 || 8764 === e || 8765 === e || 8776 === e || 8780 === e || 8786 === e || 8800 === e || 8801 === e || e >= 8804 && e <= 8807 || 8810 === e || 8811 === e || 8814 === e || 8815 === e || 8834 === e || 8835 === e || 8838 === e || 8839 === e || 8853 === e || 8857 === e || 8869 === e || 8895 === e || 8978 === e || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || 9632 === e || 9633 === e || e >= 9635 && e <= 9641 || 9650 === e || 9651 === e || 9654 === e || 9655 === e || 9660 === e || 9661 === e || 9664 === e || 9665 === e || e >= 9670 && e <= 9672 || 9675 === e || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || 9711 === e || 9733 === e || 9734 === e || 9737 === e || 9742 === e || 9743 === e || 9756 === e || 9758 === e || 9792 === e || 9794 === e || 9824 === e || 9825 === e || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || 9836 === e || 9837 === e || 9839 === e || 9886 === e || 9887 === e || 9919 === e || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || 9955 === e || 9960 === e || 9961 === e || e >= 9963 && e <= 9969 || 9972 === e || e >= 9974 && e <= 9977 || 9979 === e || 9980 === e || 9982 === e || 9983 === e || 10045 === e || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || 65533 === e || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || 127375 === e || 127376 === e || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, dist_gt = (e)=>12288 === e || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, dist_ft = (e)=>e >= 4352 && e <= 4447 || 8986 === e || 8987 === e || 9001 === e || 9002 === e || e >= 9193 && e <= 9196 || 9200 === e || 9203 === e || 9725 === e || 9726 === e || 9748 === e || 9749 === e || e >= 9800 && e <= 9811 || 9855 === e || 9875 === e || 9889 === e || 9898 === e || 9899 === e || 9917 === e || 9918 === e || 9924 === e || 9925 === e || 9934 === e || 9940 === e || 9962 === e || 9970 === e || 9971 === e || 9973 === e || 9978 === e || 9981 === e || 9989 === e || 9994 === e || 9995 === e || 10024 === e || 10060 === e || 10062 === e || e >= 10067 && e <= 10069 || 10071 === e || e >= 10133 && e <= 10135 || 10160 === e || 10175 === e || 11035 === e || 11036 === e || 11088 === e || 11093 === e || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || 94192 === e || 94193 === e || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || 110589 === e || 110590 === e || e >= 110592 && e <= 110882 || 110898 === e || e >= 110928 && e <= 110930 || 110933 === e || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || 126980 === e || 127183 === e || 127374 === e || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || 127568 === e || 127569 === e || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || 127988 === e || e >= 127992 && e <= 128062 || 128064 === e || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || 128378 === e || 128405 === e || 128406 === e || 128420 === e || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || 128716 === e || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || 128747 === e || 128748 === e || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || 129008 === e || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, dist_Ft = /\p{M}+/gu, dist_yt = {
|
|
1452
|
-
limit: 1 / 0,
|
|
1453
|
-
ellipsis: ""
|
|
1454
|
-
}, Le = (e, r = {}, s = {})=>{
|
|
1455
|
-
const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, dist_yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
1456
|
-
let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
|
|
1457
|
-
e: for(;;){
|
|
1458
|
-
if (b > A || m >= d && m > $) {
|
|
1459
|
-
const T = e.slice(A, b) || e.slice($, m);
|
|
1460
|
-
F = 0;
|
|
1461
|
-
for (const M of T.replaceAll(dist_Ft, "")){
|
|
1462
|
-
const O = M.codePointAt(0) || 0;
|
|
1463
|
-
if (dist_gt(O) ? S = f : dist_ft(O) ? S = E : c !== g && dist_mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
|
|
1464
|
-
y = !0;
|
|
1465
|
-
break e;
|
|
1466
|
-
}
|
|
1467
|
-
F += M.length, w += S;
|
|
1468
|
-
}
|
|
1469
|
-
A = b = 0;
|
|
1470
|
-
}
|
|
1471
|
-
if (m >= d) break;
|
|
1472
|
-
if (ne.lastIndex = m, ne.test(e)) {
|
|
1473
|
-
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
1474
|
-
y = !0;
|
|
1475
|
-
break;
|
|
1476
|
-
}
|
|
1477
|
-
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
1478
|
-
continue;
|
|
1479
|
-
}
|
|
1480
|
-
if (we.lastIndex = m, we.test(e)) {
|
|
1481
|
-
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
1482
|
-
y = !0;
|
|
1483
|
-
break;
|
|
1484
|
-
}
|
|
1485
|
-
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
1486
|
-
continue;
|
|
1487
|
-
}
|
|
1488
|
-
if (re.lastIndex = m, re.test(e)) {
|
|
1489
|
-
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
1490
|
-
y = !0;
|
|
1491
|
-
break;
|
|
1492
|
-
}
|
|
1493
|
-
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
1494
|
-
continue;
|
|
1495
|
-
}
|
|
1496
|
-
if (ie.lastIndex = m, ie.test(e)) {
|
|
1497
|
-
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
1498
|
-
y = !0;
|
|
1499
|
-
break;
|
|
1500
|
-
}
|
|
1501
|
-
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
1502
|
-
continue;
|
|
1503
|
-
}
|
|
1504
|
-
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
1505
|
-
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
1506
|
-
y = !0;
|
|
1507
|
-
break;
|
|
1508
|
-
}
|
|
1509
|
-
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
1510
|
-
continue;
|
|
1511
|
-
}
|
|
1512
|
-
m += 1;
|
|
1390
|
+
return styleText("green", prompts_dist_d);
|
|
1513
1391
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
};
|
|
1520
|
-
}, dist_Et = {
|
|
1521
|
-
limit: 1 / 0,
|
|
1522
|
-
ellipsis: "",
|
|
1523
|
-
ellipsisWidth: 0
|
|
1524
|
-
}, D = (e, r = {})=>Le(e, dist_Et, r).width, ae = "\x1B", je = "\x9B", dist_vt = 39, Ce = "\x07", ke = "[", dist_wt = "]", Ve = "m", Se = `${dist_wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), dist_At = (e)=>{
|
|
1525
|
-
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
1526
|
-
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
1527
|
-
if (1 === e || 2 === e) return 22;
|
|
1528
|
-
if (3 === e) return 23;
|
|
1529
|
-
if (4 === e) return 24;
|
|
1530
|
-
if (7 === e) return 27;
|
|
1531
|
-
if (8 === e) return 28;
|
|
1532
|
-
if (9 === e) return 29;
|
|
1533
|
-
if (0 === e) return 0;
|
|
1534
|
-
}, Ue = (e)=>`${ae}${ke}${e}${Ve}`, Ke = (e)=>`${ae}${Se}${e}${Ce}`, dist_Ct = (e)=>e.map((r)=>D(r)), Ie = (e, r, s)=>{
|
|
1535
|
-
const i = r[Symbol.iterator]();
|
|
1536
|
-
let a = !1, o = !1, u = e.at(-1), l = void 0 === u ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
|
|
1537
|
-
for(; !n.done;){
|
|
1538
|
-
const f = n.value, g = D(f);
|
|
1539
|
-
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l !== s || c.done || (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
1540
|
-
}
|
|
1541
|
-
u = e.at(-1), !l && void 0 !== u && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1542
|
-
}, dist_St = (e)=>{
|
|
1543
|
-
const r = e.split(" ");
|
|
1544
|
-
let s = r.length;
|
|
1545
|
-
for(; s > 0 && !(D(r[s - 1]) > 0);)s--;
|
|
1546
|
-
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
1547
|
-
}, dist_It = (e, r, s = {})=>{
|
|
1548
|
-
if (!1 !== s.trim && "" === e.trim()) return "";
|
|
1549
|
-
let i = "", a, o;
|
|
1550
|
-
const u = e.split(" "), l = dist_Ct(u);
|
|
1551
|
-
let n = [
|
|
1552
|
-
""
|
|
1553
|
-
];
|
|
1554
|
-
for (const [$, m] of u.entries()){
|
|
1555
|
-
!1 !== s.trim && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
1556
|
-
let d = D(n.at(-1) ?? "");
|
|
1557
|
-
if (0 !== $ && (d >= r && (!1 === s.wordWrap || !1 === s.trim) && (n.push(""), d = 0), (d > 0 || !1 === s.trim) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
1558
|
-
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
1559
|
-
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
1560
|
-
continue;
|
|
1561
|
-
}
|
|
1562
|
-
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
1563
|
-
if (!1 === s.wordWrap && d < r) {
|
|
1564
|
-
Ie(n, m, r);
|
|
1565
|
-
continue;
|
|
1566
|
-
}
|
|
1567
|
-
n.push("");
|
|
1568
|
-
}
|
|
1569
|
-
if (d + l[$] > r && !1 === s.wordWrap) {
|
|
1570
|
-
Ie(n, m, r);
|
|
1571
|
-
continue;
|
|
1572
|
-
}
|
|
1573
|
-
n[n.length - 1] += m;
|
|
1574
|
-
}
|
|
1575
|
-
!1 !== s.trim && (n = n.map(($)=>dist_St($)));
|
|
1576
|
-
const c = n.join(`
|
|
1577
|
-
`), p = c[Symbol.iterator]();
|
|
1578
|
-
let f = p.next(), g = p.next(), E = 0;
|
|
1579
|
-
for(; !f.done;){
|
|
1580
|
-
const $ = f.value, m = g.value;
|
|
1581
|
-
if (i += $, $ === ae || $ === je) {
|
|
1582
|
-
He.lastIndex = E + 1;
|
|
1583
|
-
const y = He.exec(c)?.groups;
|
|
1584
|
-
if (y?.code !== void 0) {
|
|
1585
|
-
const v = Number.parseFloat(y.code);
|
|
1586
|
-
a = v === dist_vt ? void 0 : v;
|
|
1587
|
-
} else y?.uri !== void 0 && (o = 0 === y.uri.length ? void 0 : y.uri);
|
|
1588
|
-
}
|
|
1589
|
-
const d = a ? dist_At(a) : void 0;
|
|
1590
|
-
m === `
|
|
1591
|
-
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
1592
|
-
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
1593
|
-
}
|
|
1594
|
-
return i;
|
|
1595
|
-
};
|
|
1596
|
-
function dist_J(e, r, s) {
|
|
1597
|
-
return String(e).normalize().replaceAll(`\r
|
|
1598
|
-
`, `
|
|
1599
|
-
`).split(`
|
|
1600
|
-
`).map((i)=>dist_It(i, r, s)).join(`
|
|
1601
|
-
`);
|
|
1602
|
-
}
|
|
1603
|
-
const dist_bt = (e, r, s, i, a)=>{
|
|
1604
|
-
let o = r, u = 0;
|
|
1605
|
-
for(let l = s; l < i; l++){
|
|
1606
|
-
const n = e[l];
|
|
1607
|
-
if (o -= n.length, u++, o <= a) break;
|
|
1392
|
+
}, dist_et = (e, i, s, r, u)=>{
|
|
1393
|
+
let n = i, o = 0;
|
|
1394
|
+
for(let c = s; c < r; c++){
|
|
1395
|
+
const a = e[c];
|
|
1396
|
+
if (n -= a.length, o++, n <= u) break;
|
|
1608
1397
|
}
|
|
1609
1398
|
return {
|
|
1610
|
-
lineCount:
|
|
1611
|
-
removals:
|
|
1399
|
+
lineCount: n,
|
|
1400
|
+
removals: o
|
|
1612
1401
|
};
|
|
1613
|
-
},
|
|
1614
|
-
const
|
|
1615
|
-
let
|
|
1616
|
-
e >=
|
|
1617
|
-
let
|
|
1618
|
-
const
|
|
1619
|
-
let
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
for(let
|
|
1623
|
-
const
|
|
1402
|
+
}, dist_Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = 1 / 0, columnPadding: n = 0, rowPadding: o = 4 })=>{
|
|
1403
|
+
const c = O(r) - n, a = dist_A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
|
|
1404
|
+
let p = 0;
|
|
1405
|
+
e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
|
|
1406
|
+
let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
|
|
1407
|
+
const S = Math.min(p + y, i.length), h = [];
|
|
1408
|
+
let f = 0;
|
|
1409
|
+
m && f++, g && f++;
|
|
1410
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
1411
|
+
for(let b = v; b < T; b++){
|
|
1412
|
+
const x = wrapAnsi(s(i[b], b === e), c, {
|
|
1624
1413
|
hard: !0,
|
|
1625
1414
|
trim: !1
|
|
1626
1415
|
}).split(`
|
|
1627
1416
|
`);
|
|
1628
|
-
|
|
1417
|
+
h.push(x), f += x.length;
|
|
1629
1418
|
}
|
|
1630
|
-
if (
|
|
1631
|
-
let
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1419
|
+
if (f > $) {
|
|
1420
|
+
let b = 0, x = 0, G = f;
|
|
1421
|
+
const M = e - v, R = (j, D)=>dist_et(h, G, j, D, $);
|
|
1422
|
+
m ? ({ lineCount: G, removals: b } = R(0, M), G > $ && ({ lineCount: G, removals: x } = R(M + 1, h.length))) : ({ lineCount: G, removals: x } = R(M + 1, h.length), G > $ && ({ lineCount: G, removals: b } = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
|
|
1634
1423
|
}
|
|
1635
1424
|
const C = [];
|
|
1636
|
-
|
|
1637
|
-
for (const
|
|
1638
|
-
return
|
|
1425
|
+
m && C.push(l);
|
|
1426
|
+
for (const b of h)for (const x of b)C.push(x);
|
|
1427
|
+
return g && C.push(l), C;
|
|
1639
1428
|
};
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1429
|
+
function Me(e) {
|
|
1430
|
+
return e.label ?? String(e.value ?? "");
|
|
1431
|
+
}
|
|
1432
|
+
function Re(e, i) {
|
|
1433
|
+
if (!e) return !0;
|
|
1434
|
+
const s = (i.label ?? String(i.value ?? "")).toLowerCase(), r = (i.hint ?? "").toLowerCase(), u = String(i.value).toLowerCase(), n = e.toLowerCase();
|
|
1435
|
+
return s.includes(n) || r.includes(n) || u.includes(n);
|
|
1436
|
+
}
|
|
1437
|
+
function dist_tt(e, i) {
|
|
1438
|
+
const s = [];
|
|
1439
|
+
for (const r of i)e.includes(r.value) && s.push(r);
|
|
1440
|
+
return s;
|
|
1441
|
+
}
|
|
1442
|
+
const Ae = (e)=>new H({
|
|
1443
|
+
options: e.options,
|
|
1444
|
+
initialValue: e.initialValue ? [
|
|
1445
|
+
e.initialValue
|
|
1446
|
+
] : void 0,
|
|
1447
|
+
initialUserInput: e.initialUserInput,
|
|
1448
|
+
placeholder: e.placeholder,
|
|
1449
|
+
filter: e.filter ?? ((i, s)=>Re(i, s)),
|
|
1450
|
+
signal: e.signal,
|
|
1451
|
+
input: e.input,
|
|
1452
|
+
output: e.output,
|
|
1453
|
+
validate: e.validate,
|
|
1454
|
+
render () {
|
|
1455
|
+
const i = e.withGuide ?? dist_u.withGuide, s = i ? [
|
|
1456
|
+
`${styleText("gray", prompts_dist_d)}`,
|
|
1457
|
+
`${dist_V(this.state)} ${e.message}`
|
|
1458
|
+
] : [
|
|
1459
|
+
`${dist_V(this.state)} ${e.message}`
|
|
1460
|
+
], r = this.userInput, u = this.options, n = e.placeholder, o = "" === r && void 0 !== n, c = (a, l)=>{
|
|
1461
|
+
const $ = Me(a), y = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
|
|
1462
|
+
switch(l){
|
|
1463
|
+
case "active":
|
|
1464
|
+
return `${styleText("green", dist_z)} ${$}${y}`;
|
|
1465
|
+
case "inactive":
|
|
1466
|
+
return `${styleText("dim", dist_H)} ${styleText("dim", $)}`;
|
|
1467
|
+
case "disabled":
|
|
1468
|
+
return `${styleText("gray", dist_H)} ${styleText([
|
|
1469
|
+
"strikethrough",
|
|
1470
|
+
"gray"
|
|
1471
|
+
], $)}`;
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
switch(this.state){
|
|
1475
|
+
case "submit":
|
|
1476
|
+
{
|
|
1477
|
+
const a = dist_tt(this.selectedValues, u), l = a.length > 0 ? ` ${styleText("dim", a.map(Me).join(", "))}` : "", $ = i ? styleText("gray", prompts_dist_d) : "";
|
|
1478
|
+
return `${s.join(`
|
|
1479
|
+
`)}
|
|
1480
|
+
${$}${l}`;
|
|
1481
|
+
}
|
|
1482
|
+
case "cancel":
|
|
1483
|
+
{
|
|
1484
|
+
const a = r ? ` ${styleText([
|
|
1485
|
+
"strikethrough",
|
|
1486
|
+
"dim"
|
|
1487
|
+
], r)}` : "", l = i ? styleText("gray", prompts_dist_d) : "";
|
|
1488
|
+
return `${s.join(`
|
|
1489
|
+
`)}
|
|
1490
|
+
${l}${a}`;
|
|
1491
|
+
}
|
|
1492
|
+
default:
|
|
1493
|
+
{
|
|
1494
|
+
const a = "error" === this.state ? "yellow" : "cyan", l = i ? `${styleText(a, prompts_dist_d)} ` : "", $ = i ? styleText(a, dist_E) : "";
|
|
1495
|
+
let y = "";
|
|
1496
|
+
if (this.isNavigating || o) {
|
|
1497
|
+
const v = o ? n : r;
|
|
1498
|
+
y = "" !== v ? ` ${styleText("dim", v)}` : "";
|
|
1499
|
+
} else y = ` ${this.userInputWithCursor}`;
|
|
1500
|
+
const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "", m = 0 === this.filteredOptions.length && r ? [
|
|
1501
|
+
`${l}${styleText("yellow", "No matches found")}`
|
|
1502
|
+
] : [], g = "error" === this.state ? [
|
|
1503
|
+
`${l}${styleText("yellow", this.error)}`
|
|
1504
|
+
] : [];
|
|
1505
|
+
i && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y}${p}`, ...m, ...g);
|
|
1506
|
+
const S = [
|
|
1507
|
+
`${styleText("dim", "\u2191/\u2193")} to select`,
|
|
1508
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
1509
|
+
`${styleText("dim", "Type:")} to search`
|
|
1510
|
+
], h = [
|
|
1511
|
+
`${l}${S.join(" \u2022 ")}`,
|
|
1512
|
+
$
|
|
1513
|
+
], f = 0 === this.filteredOptions.length ? [] : dist_Y({
|
|
1514
|
+
cursor: this.cursor,
|
|
1515
|
+
options: this.filteredOptions,
|
|
1516
|
+
columnPadding: i ? 3 : 0,
|
|
1517
|
+
rowPadding: s.length + h.length,
|
|
1518
|
+
style: (v, T)=>c(v, v.disabled ? "disabled" : T ? "active" : "inactive"),
|
|
1519
|
+
maxItems: e.maxItems,
|
|
1520
|
+
output: e.output
|
|
1521
|
+
});
|
|
1522
|
+
return [
|
|
1523
|
+
...s,
|
|
1524
|
+
...f.map((v)=>`${l}${v}`),
|
|
1525
|
+
...h
|
|
1526
|
+
].join(`
|
|
1527
|
+
`);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}).prompt();
|
|
1532
|
+
const ht = (e)=>{
|
|
1533
|
+
const { selectableGroups: i = !0, groupSpacing: s = 0 } = e, r = (n, o, c = [])=>{
|
|
1534
|
+
const a = n.label ?? String(n.value), l = "string" == typeof n.group, $ = l && (c[c.indexOf(n) + 1] ?? {
|
|
1535
|
+
group: !0
|
|
1536
|
+
}), y = l && $ && !0 === $.group, p = l ? i ? `${y ? dist_E : prompts_dist_d} ` : " " : "";
|
|
1537
|
+
let m = "";
|
|
1538
|
+
if (s > 0 && !l) {
|
|
1539
|
+
const S = `
|
|
1540
|
+
${styleText("cyan", prompts_dist_d)}`;
|
|
1541
|
+
m = `${S.repeat(s - 1)}${S} `;
|
|
1542
|
+
}
|
|
1543
|
+
if ("active" === o) return `${m}${styleText("dim", p)}${styleText("cyan", te)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
|
|
1544
|
+
if ("group-active" === o) return `${m}${p}${styleText("cyan", te)} ${styleText("dim", a)}`;
|
|
1545
|
+
if ("group-active-selected" === o) return `${m}${p}${styleText("green", dist_U)} ${styleText("dim", a)}`;
|
|
1546
|
+
if ("selected" === o) {
|
|
1547
|
+
const S = l || i ? styleText("green", dist_U) : "";
|
|
1548
|
+
return `${m}${styleText("dim", p)}${S} ${styleText("dim", a)}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
|
|
1549
|
+
}
|
|
1550
|
+
if ("cancelled" === o) return `${styleText([
|
|
1551
|
+
"strikethrough",
|
|
1552
|
+
"dim"
|
|
1553
|
+
], a)}`;
|
|
1554
|
+
if ("active-selected" === o) return `${m}${styleText("dim", p)}${styleText("green", dist_U)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
|
|
1555
|
+
if ("submitted" === o) return `${styleText("dim", a)}`;
|
|
1556
|
+
const g = l || i ? styleText("dim", dist_J) : "";
|
|
1557
|
+
return `${m}${styleText("dim", p)}${g} ${styleText("dim", a)}`;
|
|
1558
|
+
}, u = e.required ?? !0;
|
|
1559
|
+
return new st({
|
|
1560
|
+
options: e.options,
|
|
1561
|
+
signal: e.signal,
|
|
1562
|
+
input: e.input,
|
|
1563
|
+
output: e.output,
|
|
1564
|
+
initialValues: e.initialValues,
|
|
1565
|
+
required: u,
|
|
1566
|
+
cursorAt: e.cursorAt,
|
|
1567
|
+
selectableGroups: i,
|
|
1568
|
+
validate (n) {
|
|
1569
|
+
if (u && (void 0 === n || 0 === n.length)) return `Please select at least one option.
|
|
1570
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1571
|
+
"gray",
|
|
1572
|
+
"bgWhite",
|
|
1573
|
+
"inverse"
|
|
1574
|
+
], " space ")} to select, ${styleText("gray", styleText([
|
|
1575
|
+
"bgWhite",
|
|
1576
|
+
"inverse"
|
|
1577
|
+
], " enter "))} to submit`))}`;
|
|
1578
|
+
},
|
|
1579
|
+
render () {
|
|
1580
|
+
const n = e.withGuide ?? dist_u.withGuide, o = `${n ? `${styleText("gray", prompts_dist_d)}
|
|
1581
|
+
` : ""}${dist_V(this.state)} ${e.message}
|
|
1582
|
+
`, c = this.value ?? [];
|
|
1583
|
+
switch(this.state){
|
|
1584
|
+
case "submit":
|
|
1585
|
+
{
|
|
1586
|
+
const a = this.options.filter(({ value: $ })=>c.includes($)).map(($)=>r($, "submitted")), l = 0 === a.length ? "" : ` ${a.join(styleText("dim", ", "))}`;
|
|
1587
|
+
return `${o}${n ? styleText("gray", prompts_dist_d) : ""}${l}`;
|
|
1588
|
+
}
|
|
1589
|
+
case "cancel":
|
|
1590
|
+
{
|
|
1591
|
+
const a = this.options.filter(({ value: l })=>c.includes(l)).map((l)=>r(l, "cancelled")).join(styleText("dim", ", "));
|
|
1592
|
+
return `${o}${n ? `${styleText("gray", prompts_dist_d)} ` : ""}${a.trim() ? `${a}${n ? `
|
|
1593
|
+
${styleText("gray", prompts_dist_d)}` : ""}` : ""}`;
|
|
1594
|
+
}
|
|
1595
|
+
case "error":
|
|
1596
|
+
{
|
|
1597
|
+
const a = this.error.split(`
|
|
1598
|
+
`).map((l, $)=>0 === $ ? `${n ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", l)}` : ` ${l}`).join(`
|
|
1599
|
+
`);
|
|
1600
|
+
return `${o}${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}${this.options.map((l, $, y)=>{
|
|
1601
|
+
const p = c.includes(l.value) || !0 === l.group && this.isGroupSelected(`${l.value}`), m = $ === this.cursor;
|
|
1602
|
+
return m || "string" != typeof l.group || this.options[this.cursor].value !== l.group ? m && p ? r(l, "active-selected", y) : p ? r(l, "selected", y) : r(l, m ? "active" : "inactive", y) : r(l, p ? "group-active-selected" : "group-active", y);
|
|
1603
|
+
}).join(`
|
|
1604
|
+
${n ? `${styleText("yellow", prompts_dist_d)} ` : ""}`)}
|
|
1605
|
+
${a}
|
|
1606
|
+
`;
|
|
1607
|
+
}
|
|
1608
|
+
default:
|
|
1609
|
+
{
|
|
1610
|
+
const a = this.options.map(($, y, p)=>{
|
|
1611
|
+
const m = c.includes($.value) || !0 === $.group && this.isGroupSelected(`${$.value}`), g = y === this.cursor, S = !g && "string" == typeof $.group && this.options[this.cursor].value === $.group;
|
|
1612
|
+
let h = "";
|
|
1613
|
+
return S ? h = r($, m ? "group-active-selected" : "group-active", p) : g && m ? h = r($, "active-selected", p) : m ? h = r($, "selected", p) : h = r($, g ? "active" : "inactive", p), `${0 !== y && !h.startsWith(`
|
|
1614
|
+
`) ? " " : ""}${h}`;
|
|
1615
|
+
}).join(`
|
|
1616
|
+
${n ? styleText("cyan", prompts_dist_d) : ""}`), l = a.startsWith(`
|
|
1617
|
+
`) ? "" : " ";
|
|
1618
|
+
return `${o}${n ? styleText("cyan", prompts_dist_d) : ""}${l}${a}
|
|
1619
|
+
${n ? styleText("cyan", dist_E) : ""}
|
|
1620
|
+
`;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}).prompt();
|
|
1625
|
+
}, dist_O = {
|
|
1626
|
+
message: (e = [], { symbol: i = styleText("gray", prompts_dist_d), secondarySymbol: s = styleText("gray", prompts_dist_d), output: r = process.stdout, spacing: u = 1, withGuide: n } = {})=>{
|
|
1627
|
+
const o = [], c = n ?? dist_u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
1628
|
+
for(let p = 0; p < u; p++)o.push(a);
|
|
1629
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
1630
|
+
`);
|
|
1631
|
+
if (y.length > 0) {
|
|
1632
|
+
const [p, ...m] = y;
|
|
1633
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
1634
|
+
for (const g of m)g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
1635
|
+
}
|
|
1636
|
+
r.write(`${o.join(`
|
|
1637
|
+
`)}
|
|
1638
|
+
`);
|
|
1639
|
+
},
|
|
1640
|
+
info: (e, i)=>{
|
|
1641
|
+
dist_O.message(e, {
|
|
1642
|
+
...i,
|
|
1643
|
+
symbol: styleText("blue", he)
|
|
1644
|
+
});
|
|
1645
|
+
},
|
|
1646
|
+
success: (e, i)=>{
|
|
1647
|
+
dist_O.message(e, {
|
|
1648
|
+
...i,
|
|
1649
|
+
symbol: styleText("green", pe)
|
|
1650
|
+
});
|
|
1651
|
+
},
|
|
1652
|
+
step: (e, i)=>{
|
|
1653
|
+
dist_O.message(e, {
|
|
1654
|
+
...i,
|
|
1655
|
+
symbol: styleText("green", dist_F)
|
|
1656
|
+
});
|
|
1657
|
+
},
|
|
1658
|
+
warn: (e, i)=>{
|
|
1659
|
+
dist_O.message(e, {
|
|
1660
|
+
...i,
|
|
1661
|
+
symbol: styleText("yellow", me)
|
|
1662
|
+
});
|
|
1663
|
+
},
|
|
1664
|
+
warning: (e, i)=>{
|
|
1665
|
+
dist_O.warn(e, i);
|
|
1666
|
+
},
|
|
1667
|
+
error: (e, i)=>{
|
|
1668
|
+
dist_O.message(e, {
|
|
1669
|
+
...i,
|
|
1670
|
+
symbol: styleText("red", ge)
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}, pt = (e = "", i)=>{
|
|
1674
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", dist_E)} ` : "";
|
|
1675
|
+
s.write(`${r}${styleText("red", e)}
|
|
1643
1676
|
|
|
1644
1677
|
`);
|
|
1645
|
-
},
|
|
1646
|
-
const s =
|
|
1647
|
-
${styleText("gray",
|
|
1648
|
-
s.write(`${
|
|
1678
|
+
}, gt = (e = "", i)=>{
|
|
1679
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_u.withGuide ? `${styleText("gray", prompts_dist_d)}
|
|
1680
|
+
${styleText("gray", dist_E)} ` : "";
|
|
1681
|
+
s.write(`${r}${e}
|
|
1649
1682
|
|
|
1650
1683
|
`);
|
|
1651
|
-
}, dist_Q = (e,
|
|
1652
|
-
`).map((s)=>
|
|
1653
|
-
`),
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
return "disabled" ===
|
|
1684
|
+
}, dist_Q = (e, i)=>e.split(`
|
|
1685
|
+
`).map((s)=>i(s)).join(`
|
|
1686
|
+
`), yt = (e)=>{
|
|
1687
|
+
const i = (r, u)=>{
|
|
1688
|
+
const n = r.label ?? String(r.value);
|
|
1689
|
+
return "disabled" === u ? `${styleText("gray", dist_J)} ${dist_Q(n, (o)=>styleText([
|
|
1657
1690
|
"strikethrough",
|
|
1658
1691
|
"gray"
|
|
1659
|
-
],
|
|
1692
|
+
], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : "active" === u ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "selected" === u ? `${styleText("green", dist_U)} ${dist_Q(n, (o)=>styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "cancelled" === u ? `${dist_Q(n, (o)=>styleText([
|
|
1660
1693
|
"strikethrough",
|
|
1661
1694
|
"dim"
|
|
1662
|
-
],
|
|
1695
|
+
], o))}` : "active-selected" === u ? `${styleText("green", dist_U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "submitted" === u ? `${dist_Q(n, (o)=>styleText("dim", o))}` : `${styleText("dim", dist_J)} ${dist_Q(n, (o)=>styleText("dim", o))}`;
|
|
1663
1696
|
}, s = e.required ?? !0;
|
|
1664
|
-
return new
|
|
1697
|
+
return new it({
|
|
1665
1698
|
options: e.options,
|
|
1666
1699
|
signal: e.signal,
|
|
1667
1700
|
input: e.input,
|
|
@@ -1669,8 +1702,8 @@ ${styleText("gray", dist_x)} ` : "";
|
|
|
1669
1702
|
initialValues: e.initialValues,
|
|
1670
1703
|
required: s,
|
|
1671
1704
|
cursorAt: e.cursorAt,
|
|
1672
|
-
validate (
|
|
1673
|
-
if (s && (void 0 ===
|
|
1705
|
+
validate (r) {
|
|
1706
|
+
if (s && (void 0 === r || 0 === r.length)) return `Please select at least one option.
|
|
1674
1707
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1675
1708
|
"gray",
|
|
1676
1709
|
"bgWhite",
|
|
@@ -1678,157 +1711,278 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
1678
1711
|
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1679
1712
|
},
|
|
1680
1713
|
render () {
|
|
1681
|
-
const
|
|
1682
|
-
${
|
|
1683
|
-
`, o = this.value ?? [],
|
|
1684
|
-
if (
|
|
1685
|
-
const
|
|
1686
|
-
return
|
|
1714
|
+
const r = e.withGuide ?? dist_u.withGuide, u = dist_R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${dist_V(this.state)} `), n = `${r ? `${styleText("gray", prompts_dist_d)}
|
|
1715
|
+
` : ""}${u}
|
|
1716
|
+
`, o = this.value ?? [], c = (a, l)=>{
|
|
1717
|
+
if (a.disabled) return i(a, "disabled");
|
|
1718
|
+
const $ = o.includes(a.value);
|
|
1719
|
+
return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
|
|
1687
1720
|
};
|
|
1688
1721
|
switch(this.state){
|
|
1689
1722
|
case "submit":
|
|
1690
1723
|
{
|
|
1691
|
-
const
|
|
1692
|
-
return `${
|
|
1724
|
+
const a = this.options.filter(({ value: $ })=>o.includes($)).map(($)=>i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = dist_R(e.output, a, r ? `${styleText("gray", prompts_dist_d)} ` : "");
|
|
1725
|
+
return `${n}${l}`;
|
|
1693
1726
|
}
|
|
1694
1727
|
case "cancel":
|
|
1695
1728
|
{
|
|
1696
|
-
const
|
|
1697
|
-
if ("" ===
|
|
1698
|
-
const
|
|
1699
|
-
return `${
|
|
1700
|
-
${styleText("gray",
|
|
1729
|
+
const a = this.options.filter(({ value: $ })=>o.includes($)).map(($)=>i($, "cancelled")).join(styleText("dim", ", "));
|
|
1730
|
+
if ("" === a.trim()) return `${n}${styleText("gray", prompts_dist_d)}`;
|
|
1731
|
+
const l = dist_R(e.output, a, r ? `${styleText("gray", prompts_dist_d)} ` : "");
|
|
1732
|
+
return `${n}${l}${r ? `
|
|
1733
|
+
${styleText("gray", prompts_dist_d)}` : ""}`;
|
|
1701
1734
|
}
|
|
1702
1735
|
case "error":
|
|
1703
1736
|
{
|
|
1704
|
-
const
|
|
1705
|
-
`).map((
|
|
1706
|
-
`),
|
|
1707
|
-
`).length,
|
|
1737
|
+
const a = r ? `${styleText("yellow", prompts_dist_d)} ` : "", l = this.error.split(`
|
|
1738
|
+
`).map((p, m)=>0 === m ? `${r ? `${styleText("yellow", dist_E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
|
|
1739
|
+
`), $ = n.split(`
|
|
1740
|
+
`).length, y = l.split(`
|
|
1708
1741
|
`).length + 1;
|
|
1709
|
-
return `${
|
|
1742
|
+
return `${n}${a}${dist_Y({
|
|
1710
1743
|
output: e.output,
|
|
1711
1744
|
options: this.options,
|
|
1712
1745
|
cursor: this.cursor,
|
|
1713
1746
|
maxItems: e.maxItems,
|
|
1714
|
-
columnPadding:
|
|
1715
|
-
rowPadding:
|
|
1716
|
-
style:
|
|
1747
|
+
columnPadding: a.length,
|
|
1748
|
+
rowPadding: $ + y,
|
|
1749
|
+
style: c
|
|
1717
1750
|
}).join(`
|
|
1718
|
-
${
|
|
1719
|
-
${
|
|
1751
|
+
${a}`)}
|
|
1752
|
+
${l}
|
|
1720
1753
|
`;
|
|
1721
1754
|
}
|
|
1722
1755
|
default:
|
|
1723
1756
|
{
|
|
1724
|
-
const
|
|
1725
|
-
`).length;
|
|
1726
|
-
return `${
|
|
1757
|
+
const a = r ? `${styleText("cyan", prompts_dist_d)} ` : "", l = n.split(`
|
|
1758
|
+
`).length, $ = r ? 2 : 1;
|
|
1759
|
+
return `${n}${a}${dist_Y({
|
|
1727
1760
|
output: e.output,
|
|
1728
1761
|
options: this.options,
|
|
1729
1762
|
cursor: this.cursor,
|
|
1730
1763
|
maxItems: e.maxItems,
|
|
1731
|
-
columnPadding:
|
|
1732
|
-
rowPadding:
|
|
1733
|
-
style:
|
|
1764
|
+
columnPadding: a.length,
|
|
1765
|
+
rowPadding: l + $,
|
|
1766
|
+
style: c
|
|
1734
1767
|
}).join(`
|
|
1735
|
-
${
|
|
1736
|
-
${styleText("cyan",
|
|
1768
|
+
${a}`)}
|
|
1769
|
+
${r ? styleText("cyan", dist_E) : ""}
|
|
1737
1770
|
`;
|
|
1738
1771
|
}
|
|
1739
1772
|
}
|
|
1740
1773
|
}
|
|
1741
1774
|
}).prompt();
|
|
1742
|
-
},
|
|
1743
|
-
const
|
|
1775
|
+
}, ft = (e)=>styleText("dim", e), vt = (e, i, s)=>{
|
|
1776
|
+
const r = {
|
|
1744
1777
|
hard: !0,
|
|
1745
1778
|
trim: !1
|
|
1746
|
-
},
|
|
1747
|
-
`),
|
|
1748
|
-
return
|
|
1749
|
-
},
|
|
1750
|
-
const
|
|
1779
|
+
}, u = wrapAnsi(e, i, r).split(`
|
|
1780
|
+
`), n = u.reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), o = u.map(s).reduce((a, l)=>Math.max(fast_string_width_dist(l), a), 0), c = i - (o - n);
|
|
1781
|
+
return wrapAnsi(e, c, r);
|
|
1782
|
+
}, wt = (e = "", i = "", s)=>{
|
|
1783
|
+
const r = s?.output ?? node_process.stdout, u = s?.withGuide ?? dist_u.withGuide, n = s?.format ?? ft, o = [
|
|
1751
1784
|
"",
|
|
1752
|
-
...
|
|
1753
|
-
`).map(
|
|
1785
|
+
...vt(e, O(r) - 6, n).split(`
|
|
1786
|
+
`).map(n),
|
|
1754
1787
|
""
|
|
1755
|
-
],
|
|
1756
|
-
const
|
|
1757
|
-
return
|
|
1758
|
-
}, 0),
|
|
1759
|
-
`),
|
|
1760
|
-
` : "",
|
|
1761
|
-
|
|
1762
|
-
${
|
|
1763
|
-
${styleText("gray",
|
|
1788
|
+
], c = fast_string_width_dist(i), a = Math.max(o.reduce((p, m)=>{
|
|
1789
|
+
const g = fast_string_width_dist(m);
|
|
1790
|
+
return g > p ? g : p;
|
|
1791
|
+
}, 0), c) + 2, l = o.map((p)=>`${styleText("gray", prompts_dist_d)} ${p}${" ".repeat(a - fast_string_width_dist(p))}${styleText("gray", prompts_dist_d)}`).join(`
|
|
1792
|
+
`), $ = u ? `${styleText("gray", prompts_dist_d)}
|
|
1793
|
+
` : "", y = u ? Ge : de;
|
|
1794
|
+
r.write(`${$}${styleText("green", dist_F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
|
|
1795
|
+
${l}
|
|
1796
|
+
${styleText("gray", y + se.repeat(a + 2) + $e)}
|
|
1764
1797
|
`);
|
|
1765
1798
|
};
|
|
1766
|
-
|
|
1767
|
-
const
|
|
1799
|
+
dist_w("\u2500", "-"), dist_w("\u2501", "="), dist_w("\u2588", "#");
|
|
1800
|
+
const re = (e, i)=>e.includes(`
|
|
1768
1801
|
`) ? e.split(`
|
|
1769
|
-
`).map((s)=>
|
|
1770
|
-
`) :
|
|
1771
|
-
const
|
|
1772
|
-
const
|
|
1773
|
-
switch(
|
|
1802
|
+
`).map((s)=>i(s)).join(`
|
|
1803
|
+
`) : i(e), _t = (e)=>{
|
|
1804
|
+
const i = (s, r)=>{
|
|
1805
|
+
const u = s.label ?? String(s.value);
|
|
1806
|
+
switch(r){
|
|
1774
1807
|
case "disabled":
|
|
1775
|
-
return `${styleText("gray", dist_H)} ${
|
|
1808
|
+
return `${styleText("gray", dist_H)} ${re(u, (n)=>styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1776
1809
|
case "selected":
|
|
1777
|
-
return `${
|
|
1810
|
+
return `${re(u, (n)=>styleText("dim", n))}`;
|
|
1778
1811
|
case "active":
|
|
1779
|
-
return `${styleText("green", dist_z)} ${
|
|
1812
|
+
return `${styleText("green", dist_z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1780
1813
|
case "cancelled":
|
|
1781
|
-
return `${
|
|
1814
|
+
return `${re(u, (n)=>styleText([
|
|
1782
1815
|
"strikethrough",
|
|
1783
1816
|
"dim"
|
|
1784
|
-
],
|
|
1817
|
+
], n))}`;
|
|
1785
1818
|
default:
|
|
1786
|
-
return `${styleText("dim", dist_H)} ${
|
|
1819
|
+
return `${styleText("dim", dist_H)} ${re(u, (n)=>styleText("dim", n))}`;
|
|
1787
1820
|
}
|
|
1788
1821
|
};
|
|
1789
|
-
return new
|
|
1822
|
+
return new nt({
|
|
1790
1823
|
options: e.options,
|
|
1791
1824
|
signal: e.signal,
|
|
1792
1825
|
input: e.input,
|
|
1793
1826
|
output: e.output,
|
|
1794
1827
|
initialValue: e.initialValue,
|
|
1795
1828
|
render () {
|
|
1796
|
-
const s = e.withGuide ??
|
|
1797
|
-
` : ""}${
|
|
1829
|
+
const s = e.withGuide ?? dist_u.withGuide, r = `${dist_V(this.state)} `, u = `${ye(this.state)} `, n = dist_R(e.output, e.message, u, r), o = `${s ? `${styleText("gray", prompts_dist_d)}
|
|
1830
|
+
` : ""}${n}
|
|
1798
1831
|
`;
|
|
1799
1832
|
switch(this.state){
|
|
1800
1833
|
case "submit":
|
|
1801
1834
|
{
|
|
1802
|
-
const
|
|
1803
|
-
return `${
|
|
1835
|
+
const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "selected"), c);
|
|
1836
|
+
return `${o}${a}`;
|
|
1804
1837
|
}
|
|
1805
1838
|
case "cancel":
|
|
1806
1839
|
{
|
|
1807
|
-
const
|
|
1808
|
-
return `${
|
|
1809
|
-
${styleText("gray",
|
|
1840
|
+
const c = s ? `${styleText("gray", prompts_dist_d)} ` : "", a = dist_R(e.output, i(this.options[this.cursor], "cancelled"), c);
|
|
1841
|
+
return `${o}${a}${s ? `
|
|
1842
|
+
${styleText("gray", prompts_dist_d)}` : ""}`;
|
|
1810
1843
|
}
|
|
1811
1844
|
default:
|
|
1812
1845
|
{
|
|
1813
|
-
const
|
|
1814
|
-
`).length,
|
|
1815
|
-
return `${
|
|
1846
|
+
const c = s ? `${styleText("cyan", prompts_dist_d)} ` : "", a = s ? styleText("cyan", dist_E) : "", l = o.split(`
|
|
1847
|
+
`).length, $ = s ? 2 : 1;
|
|
1848
|
+
return `${o}${c}${dist_Y({
|
|
1816
1849
|
output: e.output,
|
|
1817
1850
|
cursor: this.cursor,
|
|
1818
1851
|
options: this.options,
|
|
1819
1852
|
maxItems: e.maxItems,
|
|
1820
|
-
columnPadding:
|
|
1821
|
-
rowPadding:
|
|
1822
|
-
style: (
|
|
1853
|
+
columnPadding: c.length,
|
|
1854
|
+
rowPadding: l + $,
|
|
1855
|
+
style: (y, p)=>i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
|
|
1823
1856
|
}).join(`
|
|
1824
|
-
${
|
|
1825
|
-
${
|
|
1857
|
+
${c}`)}
|
|
1858
|
+
${a}
|
|
1826
1859
|
`;
|
|
1827
1860
|
}
|
|
1828
1861
|
}
|
|
1829
1862
|
}
|
|
1830
1863
|
}).prompt();
|
|
1831
|
-
},
|
|
1864
|
+
}, xt = (styleText("gray", prompts_dist_d), (e)=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "")), Gt = (e)=>{
|
|
1865
|
+
const i = e.output ?? process.stdout, s = O(i), r = styleText("gray", prompts_dist_d), u = e.spacing ?? 1, n = 3, o = !0 === e.retainLog, c = !ae() && Te(i);
|
|
1866
|
+
i.write(`${r}
|
|
1867
|
+
`), i.write(`${styleText("green", dist_F)} ${e.title}
|
|
1868
|
+
`);
|
|
1869
|
+
for(let h = 0; h < u; h++)i.write(`${r}
|
|
1870
|
+
`);
|
|
1871
|
+
const a = [
|
|
1872
|
+
{
|
|
1873
|
+
value: "",
|
|
1874
|
+
full: ""
|
|
1875
|
+
}
|
|
1876
|
+
];
|
|
1877
|
+
let l = !1;
|
|
1878
|
+
const $ = (h)=>{
|
|
1879
|
+
if (0 === a.length) return;
|
|
1880
|
+
let f = 0;
|
|
1881
|
+
h && (f += u + 2);
|
|
1882
|
+
for (const v of a){
|
|
1883
|
+
const { value: T, result: C } = v;
|
|
1884
|
+
let b = C?.message ?? T;
|
|
1885
|
+
if (0 === b.length) continue;
|
|
1886
|
+
void 0 === C && void 0 !== v.header && "" !== v.header && (b += `
|
|
1887
|
+
${v.header}`);
|
|
1888
|
+
const x = b.split(`
|
|
1889
|
+
`).reduce((G, M)=>"" === M ? G + 1 : G + Math.ceil((M.length + n) / s), 0);
|
|
1890
|
+
f += x;
|
|
1891
|
+
}
|
|
1892
|
+
f > 0 && (f += 1, i.write(src.erase.lines(f)));
|
|
1893
|
+
}, y = (h, f, v)=>{
|
|
1894
|
+
const T = v ? `${h.full}
|
|
1895
|
+
${h.value}` : h.value;
|
|
1896
|
+
void 0 !== h.header && "" !== h.header && dist_O.message(h.header.split(`
|
|
1897
|
+
`).map((C)=>styleText("bold", C)), {
|
|
1898
|
+
output: i,
|
|
1899
|
+
secondarySymbol: r,
|
|
1900
|
+
symbol: r,
|
|
1901
|
+
spacing: 0
|
|
1902
|
+
}), dist_O.message(T.split(`
|
|
1903
|
+
`).map((C)=>styleText("dim", C)), {
|
|
1904
|
+
output: i,
|
|
1905
|
+
secondarySymbol: r,
|
|
1906
|
+
symbol: r,
|
|
1907
|
+
spacing: f ?? u
|
|
1908
|
+
});
|
|
1909
|
+
}, p = ()=>{
|
|
1910
|
+
for (const h of a){
|
|
1911
|
+
const { header: f, value: v, full: T } = h;
|
|
1912
|
+
(void 0 === f || 0 === f.length) && 0 === v.length || y(h, void 0, !0 === o && T.length > 0);
|
|
1913
|
+
}
|
|
1914
|
+
}, m = (h, f, v)=>{
|
|
1915
|
+
if ($(!1), v?.raw === !0 && l || "" === h.value || (h.value += `
|
|
1916
|
+
`), h.value += xt(f), l = v?.raw === !0, void 0 !== e.limit) {
|
|
1917
|
+
const T = h.value.split(`
|
|
1918
|
+
`), C = T.length - e.limit;
|
|
1919
|
+
if (C > 0) {
|
|
1920
|
+
const b = T.splice(0, C);
|
|
1921
|
+
o && (h.full += ("" === h.full ? "" : `
|
|
1922
|
+
`) + b.join(`
|
|
1923
|
+
`));
|
|
1924
|
+
}
|
|
1925
|
+
h.value = T.join(`
|
|
1926
|
+
`);
|
|
1927
|
+
}
|
|
1928
|
+
c && g();
|
|
1929
|
+
}, g = ()=>{
|
|
1930
|
+
for (const h of a)h.result ? "error" === h.result.status ? dist_O.error(h.result.message, {
|
|
1931
|
+
output: i,
|
|
1932
|
+
secondarySymbol: r,
|
|
1933
|
+
spacing: 0
|
|
1934
|
+
}) : dist_O.success(h.result.message, {
|
|
1935
|
+
output: i,
|
|
1936
|
+
secondarySymbol: r,
|
|
1937
|
+
spacing: 0
|
|
1938
|
+
}) : "" !== h.value && y(h, 0);
|
|
1939
|
+
}, S = (h, f)=>{
|
|
1940
|
+
$(!1), h.result = f, c && g();
|
|
1941
|
+
};
|
|
1942
|
+
return {
|
|
1943
|
+
message (h, f) {
|
|
1944
|
+
m(a[0], h, f);
|
|
1945
|
+
},
|
|
1946
|
+
group (h) {
|
|
1947
|
+
const f = {
|
|
1948
|
+
header: h,
|
|
1949
|
+
value: "",
|
|
1950
|
+
full: ""
|
|
1951
|
+
};
|
|
1952
|
+
return a.push(f), {
|
|
1953
|
+
message (v, T) {
|
|
1954
|
+
m(f, v, T);
|
|
1955
|
+
},
|
|
1956
|
+
error (v) {
|
|
1957
|
+
S(f, {
|
|
1958
|
+
status: "error",
|
|
1959
|
+
message: v
|
|
1960
|
+
});
|
|
1961
|
+
},
|
|
1962
|
+
success (v) {
|
|
1963
|
+
S(f, {
|
|
1964
|
+
status: "success",
|
|
1965
|
+
message: v
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
};
|
|
1969
|
+
},
|
|
1970
|
+
error (h, f) {
|
|
1971
|
+
$(!0), dist_O.error(h, {
|
|
1972
|
+
output: i,
|
|
1973
|
+
secondarySymbol: r,
|
|
1974
|
+
spacing: 1
|
|
1975
|
+
}), f?.showLog !== !1 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1976
|
+
},
|
|
1977
|
+
success (h, f) {
|
|
1978
|
+
$(!0), dist_O.success(h, {
|
|
1979
|
+
output: i,
|
|
1980
|
+
secondarySymbol: r,
|
|
1981
|
+
spacing: 1
|
|
1982
|
+
}), f?.showLog === !0 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
}, Ot = (e)=>new at({
|
|
1832
1986
|
validate: e.validate,
|
|
1833
1987
|
placeholder: e.placeholder,
|
|
1834
1988
|
defaultValue: e.defaultValue,
|
|
@@ -1837,45 +1991,45 @@ ${n}
|
|
|
1837
1991
|
signal: e.signal,
|
|
1838
1992
|
input: e.input,
|
|
1839
1993
|
render () {
|
|
1840
|
-
const
|
|
1841
|
-
` : ""}${
|
|
1842
|
-
`,
|
|
1994
|
+
const i = e?.withGuide ?? dist_u.withGuide, s = `${i ? `${styleText("gray", prompts_dist_d)}
|
|
1995
|
+
` : ""}${dist_V(this.state)} ${e.message}
|
|
1996
|
+
`, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText([
|
|
1843
1997
|
"inverse",
|
|
1844
1998
|
"hidden"
|
|
1845
|
-
], "_"),
|
|
1999
|
+
], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1846
2000
|
switch(this.state){
|
|
1847
2001
|
case "error":
|
|
1848
2002
|
{
|
|
1849
|
-
const
|
|
2003
|
+
const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", prompts_dist_d)} ` : "", a = i ? styleText("yellow", dist_E) : "";
|
|
1850
2004
|
return `${s.trim()}
|
|
1851
|
-
${
|
|
1852
|
-
${
|
|
2005
|
+
${c}${u}
|
|
2006
|
+
${a}${o}
|
|
1853
2007
|
`;
|
|
1854
2008
|
}
|
|
1855
2009
|
case "submit":
|
|
1856
2010
|
{
|
|
1857
|
-
const
|
|
1858
|
-
return `${s}${
|
|
2011
|
+
const o = n ? ` ${styleText("dim", n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
|
|
2012
|
+
return `${s}${c}${o}`;
|
|
1859
2013
|
}
|
|
1860
2014
|
case "cancel":
|
|
1861
2015
|
{
|
|
1862
|
-
const
|
|
2016
|
+
const o = n ? ` ${styleText([
|
|
1863
2017
|
"strikethrough",
|
|
1864
2018
|
"dim"
|
|
1865
|
-
],
|
|
1866
|
-
return `${s}${
|
|
1867
|
-
${
|
|
2019
|
+
], n)}` : "", c = i ? styleText("gray", prompts_dist_d) : "";
|
|
2020
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
2021
|
+
${c}` : ""}`;
|
|
1868
2022
|
}
|
|
1869
2023
|
default:
|
|
1870
2024
|
{
|
|
1871
|
-
const
|
|
1872
|
-
return `${s}${
|
|
1873
|
-
${
|
|
2025
|
+
const o = i ? `${styleText("cyan", prompts_dist_d)} ` : "", c = i ? styleText("cyan", dist_E) : "";
|
|
2026
|
+
return `${s}${o}${u}
|
|
2027
|
+
${c}
|
|
1874
2028
|
`;
|
|
1875
2029
|
}
|
|
1876
2030
|
}
|
|
1877
2031
|
}
|
|
1878
|
-
}).prompt()
|
|
2032
|
+
}).prompt();
|
|
1879
2033
|
function checkNodeVersion() {
|
|
1880
2034
|
const { versions } = process;
|
|
1881
2035
|
if ("styleText" in node_util || !versions.node || versions.bun || versions.deno) return;
|
|
@@ -2147,9 +2301,637 @@ let createLogger = (options = {})=>{
|
|
|
2147
2301
|
return logger;
|
|
2148
2302
|
};
|
|
2149
2303
|
let src_logger = createLogger();
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2304
|
+
var main_l = (e, t)=>()=>(t || e((t = {
|
|
2305
|
+
exports: {}
|
|
2306
|
+
}).exports, t), t.exports);
|
|
2307
|
+
var main_u = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2308
|
+
const main_d = /^path$/i;
|
|
2309
|
+
const main_f = {
|
|
2310
|
+
key: "PATH",
|
|
2311
|
+
value: ""
|
|
2312
|
+
};
|
|
2313
|
+
function main_p(e) {
|
|
2314
|
+
for(const t in e){
|
|
2315
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !main_d.test(t)) continue;
|
|
2316
|
+
const n = e[t];
|
|
2317
|
+
if (!n) break;
|
|
2318
|
+
return {
|
|
2319
|
+
key: t,
|
|
2320
|
+
value: n
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
return main_f;
|
|
2324
|
+
}
|
|
2325
|
+
function main_m(e, t) {
|
|
2326
|
+
const i = t.value.split(delimiter);
|
|
2327
|
+
const o = [];
|
|
2328
|
+
let s = e;
|
|
2329
|
+
let c;
|
|
2330
|
+
do {
|
|
2331
|
+
o.push(resolve(s, "node_modules", ".bin"));
|
|
2332
|
+
c = s;
|
|
2333
|
+
s = dirname(s);
|
|
2334
|
+
}while (s !== c);
|
|
2335
|
+
const l = o.concat(i).join(delimiter);
|
|
2336
|
+
return {
|
|
2337
|
+
key: t.key,
|
|
2338
|
+
value: l
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function main_h(e, t) {
|
|
2342
|
+
const n = {
|
|
2343
|
+
...process.env,
|
|
2344
|
+
...t
|
|
2345
|
+
};
|
|
2346
|
+
const r = main_m(e, main_p(n));
|
|
2347
|
+
n[r.key] = r.value;
|
|
2348
|
+
return n;
|
|
2349
|
+
}
|
|
2350
|
+
const main_g = (e)=>{
|
|
2351
|
+
let t = e.length;
|
|
2352
|
+
const n = new PassThrough();
|
|
2353
|
+
const r = ()=>{
|
|
2354
|
+
if (0 === --t) n.emit("end");
|
|
2355
|
+
};
|
|
2356
|
+
for (const t of e){
|
|
2357
|
+
t.pipe(n, {
|
|
2358
|
+
end: false
|
|
2359
|
+
});
|
|
2360
|
+
t.on("end", r);
|
|
2361
|
+
}
|
|
2362
|
+
return n;
|
|
2363
|
+
};
|
|
2364
|
+
var main_ = /* @__PURE__ */ main_l((e, t)=>{
|
|
2365
|
+
t.exports = a;
|
|
2366
|
+
a.sync = o;
|
|
2367
|
+
var n = main_u("fs");
|
|
2368
|
+
function r(e, t) {
|
|
2369
|
+
var n = void 0 !== t.pathExt ? t.pathExt : process.env.PATHEXT;
|
|
2370
|
+
if (!n) return true;
|
|
2371
|
+
n = n.split(";");
|
|
2372
|
+
if (-1 !== n.indexOf("")) return true;
|
|
2373
|
+
for(var r = 0; r < n.length; r++){
|
|
2374
|
+
var i = n[r].toLowerCase();
|
|
2375
|
+
if (i && e.substr(-i.length).toLowerCase() === i) return true;
|
|
2376
|
+
}
|
|
2377
|
+
return false;
|
|
2378
|
+
}
|
|
2379
|
+
function i(e, t, n) {
|
|
2380
|
+
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
2381
|
+
return r(t, n);
|
|
2382
|
+
}
|
|
2383
|
+
function a(e, t, r) {
|
|
2384
|
+
n.stat(e, function(n, a) {
|
|
2385
|
+
r(n, n ? false : i(a, e, t));
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
function o(e, t) {
|
|
2389
|
+
return i(n.statSync(e), e, t);
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
var main_v = /* @__PURE__ */ main_l((e, t)=>{
|
|
2393
|
+
t.exports = r;
|
|
2394
|
+
r.sync = i;
|
|
2395
|
+
var n = main_u("fs");
|
|
2396
|
+
function r(e, t, r) {
|
|
2397
|
+
n.stat(e, function(e, n) {
|
|
2398
|
+
r(e, e ? false : a(n, t));
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
function i(e, t) {
|
|
2402
|
+
return a(n.statSync(e), t);
|
|
2403
|
+
}
|
|
2404
|
+
function a(e, t) {
|
|
2405
|
+
return e.isFile() && o(e, t);
|
|
2406
|
+
}
|
|
2407
|
+
function o(e, t) {
|
|
2408
|
+
var n = e.mode;
|
|
2409
|
+
var r = e.uid;
|
|
2410
|
+
var i = e.gid;
|
|
2411
|
+
var a = void 0 !== t.uid ? t.uid : process.getuid && process.getuid();
|
|
2412
|
+
var o = void 0 !== t.gid ? t.gid : process.getgid && process.getgid();
|
|
2413
|
+
var s = parseInt("100", 8);
|
|
2414
|
+
var c = parseInt("010", 8);
|
|
2415
|
+
var l = parseInt("001", 8);
|
|
2416
|
+
var u = s | c;
|
|
2417
|
+
return n & l || n & c && i === o || n & s && r === a || n & u && 0 === a;
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2420
|
+
var main_y = /* @__PURE__ */ main_l((e, t)=>{
|
|
2421
|
+
main_u("fs");
|
|
2422
|
+
var n;
|
|
2423
|
+
n = "win32" === process.platform || global.TESTING_WINDOWS ? main_() : main_v();
|
|
2424
|
+
t.exports = r;
|
|
2425
|
+
r.sync = i;
|
|
2426
|
+
function r(e, t, i) {
|
|
2427
|
+
if ("function" == typeof t) {
|
|
2428
|
+
i = t;
|
|
2429
|
+
t = {};
|
|
2430
|
+
}
|
|
2431
|
+
if (!i) {
|
|
2432
|
+
if ("function" != typeof Promise) throw new TypeError("callback not provided");
|
|
2433
|
+
return new Promise(function(n, i) {
|
|
2434
|
+
r(e, t || {}, function(e, t) {
|
|
2435
|
+
if (e) i(e);
|
|
2436
|
+
else n(t);
|
|
2437
|
+
});
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
n(e, t || {}, function(e, n) {
|
|
2441
|
+
if (e) {
|
|
2442
|
+
if ("EACCES" === e.code || t && t.ignoreErrors) {
|
|
2443
|
+
e = null;
|
|
2444
|
+
n = false;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
i(e, n);
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
function i(e, t) {
|
|
2451
|
+
try {
|
|
2452
|
+
return n.sync(e, t || {});
|
|
2453
|
+
} catch (e) {
|
|
2454
|
+
if (t && t.ignoreErrors || "EACCES" === e.code) return false;
|
|
2455
|
+
throw e;
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
});
|
|
2459
|
+
var main_b = /* @__PURE__ */ main_l((e, t)=>{
|
|
2460
|
+
const n = "win32" === process.platform || "cygwin" === process.env.OSTYPE || "msys" === process.env.OSTYPE;
|
|
2461
|
+
const r = main_u("path");
|
|
2462
|
+
const i = n ? ";" : ":";
|
|
2463
|
+
const a = main_y();
|
|
2464
|
+
const o = (e)=>Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), {
|
|
2465
|
+
code: "ENOENT"
|
|
2466
|
+
});
|
|
2467
|
+
const s = (e, t)=>{
|
|
2468
|
+
const r = t.colon || i;
|
|
2469
|
+
const a = e.match(/\//) || n && e.match(/\\/) ? [
|
|
2470
|
+
""
|
|
2471
|
+
] : [
|
|
2472
|
+
...n ? [
|
|
2473
|
+
process.cwd()
|
|
2474
|
+
] : [],
|
|
2475
|
+
...(t.path || process.env.PATH || "").split(r)
|
|
2476
|
+
];
|
|
2477
|
+
const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
2478
|
+
const s = n ? o.split(r) : [
|
|
2479
|
+
""
|
|
2480
|
+
];
|
|
2481
|
+
if (n) {
|
|
2482
|
+
if (-1 !== e.indexOf(".") && "" !== s[0]) s.unshift("");
|
|
2483
|
+
}
|
|
2484
|
+
return {
|
|
2485
|
+
pathEnv: a,
|
|
2486
|
+
pathExt: s,
|
|
2487
|
+
pathExtExe: o
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
const c = (e, t, n)=>{
|
|
2491
|
+
if ("function" == typeof t) {
|
|
2492
|
+
n = t;
|
|
2493
|
+
t = {};
|
|
2494
|
+
}
|
|
2495
|
+
if (!t) t = {};
|
|
2496
|
+
const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
|
|
2497
|
+
const u = [];
|
|
2498
|
+
const d = (n)=>new Promise((a, s)=>{
|
|
2499
|
+
if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
|
|
2500
|
+
const c = i[n];
|
|
2501
|
+
const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
|
|
2502
|
+
const d = r.join(l, e);
|
|
2503
|
+
a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
|
|
2504
|
+
});
|
|
2505
|
+
const f = (e, n, r)=>new Promise((i, o)=>{
|
|
2506
|
+
if (r === c.length) return i(d(n + 1));
|
|
2507
|
+
const s = c[r];
|
|
2508
|
+
a(e + s, {
|
|
2509
|
+
pathExt: l
|
|
2510
|
+
}, (a, o)=>{
|
|
2511
|
+
if (!a && o) if (!t.all) return i(e + s);
|
|
2512
|
+
else u.push(e + s);
|
|
2513
|
+
return i(f(e, n, r + 1));
|
|
2514
|
+
});
|
|
2515
|
+
});
|
|
2516
|
+
return n ? d(0).then((e)=>n(null, e), n) : d(0);
|
|
2517
|
+
};
|
|
2518
|
+
const l = (e, t)=>{
|
|
2519
|
+
t = t || {};
|
|
2520
|
+
const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
|
|
2521
|
+
const l = [];
|
|
2522
|
+
for(let o = 0; o < n.length; o++){
|
|
2523
|
+
const s = n[o];
|
|
2524
|
+
const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
|
|
2525
|
+
const d = r.join(u, e);
|
|
2526
|
+
const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
|
|
2527
|
+
for(let e = 0; e < i.length; e++){
|
|
2528
|
+
const n = f + i[e];
|
|
2529
|
+
try {
|
|
2530
|
+
if (a.sync(n, {
|
|
2531
|
+
pathExt: c
|
|
2532
|
+
})) if (!t.all) return n;
|
|
2533
|
+
else l.push(n);
|
|
2534
|
+
} catch (e) {}
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
if (t.all && l.length) return l;
|
|
2538
|
+
if (t.nothrow) return null;
|
|
2539
|
+
throw o(e);
|
|
2540
|
+
};
|
|
2541
|
+
t.exports = c;
|
|
2542
|
+
c.sync = l;
|
|
2543
|
+
});
|
|
2544
|
+
var main_x = /* @__PURE__ */ main_l((e, t)=>{
|
|
2545
|
+
const n = (e = {})=>{
|
|
2546
|
+
const t = e.env || process.env;
|
|
2547
|
+
if ("win32" !== (e.platform || process.platform)) return "PATH";
|
|
2548
|
+
return Object.keys(t).reverse().find((e)=>"PATH" === e.toUpperCase()) || "Path";
|
|
2549
|
+
};
|
|
2550
|
+
t.exports = n;
|
|
2551
|
+
t.exports.default = n;
|
|
2552
|
+
});
|
|
2553
|
+
var main_S = /* @__PURE__ */ main_l((e, t)=>{
|
|
2554
|
+
const n = main_u("path");
|
|
2555
|
+
const r = main_b();
|
|
2556
|
+
const i = main_x();
|
|
2557
|
+
function a(e, t) {
|
|
2558
|
+
const a = e.options.env || process.env;
|
|
2559
|
+
const o = process.cwd();
|
|
2560
|
+
const s = null != e.options.cwd;
|
|
2561
|
+
const c = s && void 0 !== process.chdir && !process.chdir.disabled;
|
|
2562
|
+
if (c) try {
|
|
2563
|
+
process.chdir(e.options.cwd);
|
|
2564
|
+
} catch (e) {}
|
|
2565
|
+
let l;
|
|
2566
|
+
try {
|
|
2567
|
+
l = r.sync(e.command, {
|
|
2568
|
+
path: a[i({
|
|
2569
|
+
env: a
|
|
2570
|
+
})],
|
|
2571
|
+
pathExt: t ? n.delimiter : void 0
|
|
2572
|
+
});
|
|
2573
|
+
} catch (e) {} finally{
|
|
2574
|
+
if (c) process.chdir(o);
|
|
2575
|
+
}
|
|
2576
|
+
if (l) l = n.resolve(s ? e.options.cwd : "", l);
|
|
2577
|
+
return l;
|
|
2578
|
+
}
|
|
2579
|
+
function o(e) {
|
|
2580
|
+
return a(e) || a(e, true);
|
|
2581
|
+
}
|
|
2582
|
+
t.exports = o;
|
|
2583
|
+
});
|
|
2584
|
+
var main_C = /* @__PURE__ */ main_l((e, t)=>{
|
|
2585
|
+
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
2586
|
+
function r(e) {
|
|
2587
|
+
e = e.replace(n, "^$1");
|
|
2588
|
+
return e;
|
|
2589
|
+
}
|
|
2590
|
+
function i(e, t) {
|
|
2591
|
+
e = `${e}`;
|
|
2592
|
+
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
2593
|
+
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
2594
|
+
e = `"${e}"`;
|
|
2595
|
+
e = e.replace(n, "^$1");
|
|
2596
|
+
if (t) e = e.replace(n, "^$1");
|
|
2597
|
+
return e;
|
|
2598
|
+
}
|
|
2599
|
+
t.exports.command = r;
|
|
2600
|
+
t.exports.argument = i;
|
|
2601
|
+
});
|
|
2602
|
+
var main_w = /* @__PURE__ */ main_l((e, t)=>{
|
|
2603
|
+
t.exports = /^#!(.*)/;
|
|
2604
|
+
});
|
|
2605
|
+
var main_T = /* @__PURE__ */ main_l((e, t)=>{
|
|
2606
|
+
const n = main_w();
|
|
2607
|
+
t.exports = (e = "")=>{
|
|
2608
|
+
const t = e.match(n);
|
|
2609
|
+
if (!t) return null;
|
|
2610
|
+
const [r, i] = t[0].replace(/#! ?/, "").split(" ");
|
|
2611
|
+
const a = r.split("/").pop();
|
|
2612
|
+
if ("env" === a) return i;
|
|
2613
|
+
return i ? `${a} ${i}` : a;
|
|
2614
|
+
};
|
|
2615
|
+
});
|
|
2616
|
+
var main_E = /* @__PURE__ */ main_l((e, t)=>{
|
|
2617
|
+
const n = main_u("fs");
|
|
2618
|
+
const r = main_T();
|
|
2619
|
+
function i(e) {
|
|
2620
|
+
const t = 150;
|
|
2621
|
+
const i = Buffer.alloc(t);
|
|
2622
|
+
let a;
|
|
2623
|
+
try {
|
|
2624
|
+
a = n.openSync(e, "r");
|
|
2625
|
+
n.readSync(a, i, 0, t, 0);
|
|
2626
|
+
n.closeSync(a);
|
|
2627
|
+
} catch (e) {}
|
|
2628
|
+
return r(i.toString());
|
|
2629
|
+
}
|
|
2630
|
+
t.exports = i;
|
|
2631
|
+
});
|
|
2632
|
+
var main_D = /* @__PURE__ */ main_l((e, t)=>{
|
|
2633
|
+
const n = main_u("path");
|
|
2634
|
+
const r = main_S();
|
|
2635
|
+
const i = main_C();
|
|
2636
|
+
const a = main_E();
|
|
2637
|
+
const o = "win32" === process.platform;
|
|
2638
|
+
const s = /\.(?:com|exe)$/i;
|
|
2639
|
+
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
2640
|
+
function l(e) {
|
|
2641
|
+
e.file = r(e);
|
|
2642
|
+
const t = e.file && a(e.file);
|
|
2643
|
+
if (t) {
|
|
2644
|
+
e.args.unshift(e.file);
|
|
2645
|
+
e.command = t;
|
|
2646
|
+
return r(e);
|
|
2647
|
+
}
|
|
2648
|
+
return e.file;
|
|
2649
|
+
}
|
|
2650
|
+
function d(e) {
|
|
2651
|
+
if (!o) return e;
|
|
2652
|
+
const t = l(e);
|
|
2653
|
+
const r = !s.test(t);
|
|
2654
|
+
if (e.options.forceShell || r) {
|
|
2655
|
+
const r = c.test(t);
|
|
2656
|
+
e.command = n.normalize(e.command);
|
|
2657
|
+
e.command = i.command(e.command);
|
|
2658
|
+
e.args = e.args.map((e)=>i.argument(e, r));
|
|
2659
|
+
e.args = [
|
|
2660
|
+
"/d",
|
|
2661
|
+
"/s",
|
|
2662
|
+
"/c",
|
|
2663
|
+
`"${[
|
|
2664
|
+
e.command
|
|
2665
|
+
].concat(e.args).join(" ")}"`
|
|
2666
|
+
];
|
|
2667
|
+
e.command = process.env.comspec || "cmd.exe";
|
|
2668
|
+
e.options.windowsVerbatimArguments = true;
|
|
2669
|
+
}
|
|
2670
|
+
return e;
|
|
2671
|
+
}
|
|
2672
|
+
function f(e, t, n) {
|
|
2673
|
+
if (t && !Array.isArray(t)) {
|
|
2674
|
+
n = t;
|
|
2675
|
+
t = null;
|
|
2676
|
+
}
|
|
2677
|
+
t = t ? t.slice(0) : [];
|
|
2678
|
+
n = Object.assign({}, n);
|
|
2679
|
+
const r = {
|
|
2680
|
+
command: e,
|
|
2681
|
+
args: t,
|
|
2682
|
+
options: n,
|
|
2683
|
+
file: void 0,
|
|
2684
|
+
original: {
|
|
2685
|
+
command: e,
|
|
2686
|
+
args: t
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
return n.shell ? r : d(r);
|
|
2690
|
+
}
|
|
2691
|
+
t.exports = f;
|
|
2692
|
+
});
|
|
2693
|
+
var main_O = /* @__PURE__ */ main_l((e, t)=>{
|
|
2694
|
+
const n = "win32" === process.platform;
|
|
2695
|
+
function r(e, t) {
|
|
2696
|
+
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
2697
|
+
code: "ENOENT",
|
|
2698
|
+
errno: "ENOENT",
|
|
2699
|
+
syscall: `${t} ${e.command}`,
|
|
2700
|
+
path: e.command,
|
|
2701
|
+
spawnargs: e.args
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
function i(e, t) {
|
|
2705
|
+
if (!n) return;
|
|
2706
|
+
const r = e.emit;
|
|
2707
|
+
e.emit = function(n, i) {
|
|
2708
|
+
if ("exit" === n) {
|
|
2709
|
+
const n = a(i, t);
|
|
2710
|
+
if (n) return r.call(e, "error", n);
|
|
2711
|
+
}
|
|
2712
|
+
return r.apply(e, arguments);
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2715
|
+
function a(e, t) {
|
|
2716
|
+
if (n && 1 === e && !t.file) return r(t.original, "spawn");
|
|
2717
|
+
return null;
|
|
2718
|
+
}
|
|
2719
|
+
function o(e, t) {
|
|
2720
|
+
if (n && 1 === e && !t.file) return r(t.original, "spawnSync");
|
|
2721
|
+
return null;
|
|
2722
|
+
}
|
|
2723
|
+
t.exports = {
|
|
2724
|
+
hookChildProcess: i,
|
|
2725
|
+
verifyENOENT: a,
|
|
2726
|
+
verifyENOENTSync: o,
|
|
2727
|
+
notFoundError: r
|
|
2728
|
+
};
|
|
2729
|
+
});
|
|
2730
|
+
var main_k = /* @__PURE__ */ main_l((e, t)=>{
|
|
2731
|
+
const n = main_u("child_process");
|
|
2732
|
+
const r = main_D();
|
|
2733
|
+
const i = main_O();
|
|
2734
|
+
function a(e, t, a) {
|
|
2735
|
+
const o = r(e, t, a);
|
|
2736
|
+
const s = n.spawn(o.command, o.args, o.options);
|
|
2737
|
+
i.hookChildProcess(s, o);
|
|
2738
|
+
return s;
|
|
2739
|
+
}
|
|
2740
|
+
function o(e, t, a) {
|
|
2741
|
+
const o = r(e, t, a);
|
|
2742
|
+
const s = n.spawnSync(o.command, o.args, o.options);
|
|
2743
|
+
s.error = s.error || i.verifyENOENTSync(s.status, o);
|
|
2744
|
+
return s;
|
|
2745
|
+
}
|
|
2746
|
+
t.exports = a;
|
|
2747
|
+
t.exports.spawn = a;
|
|
2748
|
+
t.exports.sync = o;
|
|
2749
|
+
t.exports._parse = r;
|
|
2750
|
+
t.exports._enoent = i;
|
|
2751
|
+
});
|
|
2752
|
+
var main_A = main_k();
|
|
2753
|
+
var main_j = class extends Error {
|
|
2754
|
+
result;
|
|
2755
|
+
output;
|
|
2756
|
+
get exitCode() {
|
|
2757
|
+
if (null !== this.result.exitCode) return this.result.exitCode;
|
|
2758
|
+
}
|
|
2759
|
+
constructor(e, t){
|
|
2760
|
+
super(`Process exited with non-zero status (${e.exitCode})`);
|
|
2761
|
+
this.result = e;
|
|
2762
|
+
this.output = t;
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
const main_M = {
|
|
2766
|
+
timeout: void 0,
|
|
2767
|
+
persist: false
|
|
2768
|
+
};
|
|
2769
|
+
const main_N = {
|
|
2770
|
+
windowsHide: true
|
|
2771
|
+
};
|
|
2772
|
+
function P(e, t) {
|
|
2773
|
+
return {
|
|
2774
|
+
command: external_node_path_normalize(e),
|
|
2775
|
+
args: t ?? []
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
function main_F(e) {
|
|
2779
|
+
const t = new AbortController();
|
|
2780
|
+
for (const n of e){
|
|
2781
|
+
if (n.aborted) {
|
|
2782
|
+
t.abort();
|
|
2783
|
+
return n;
|
|
2784
|
+
}
|
|
2785
|
+
const e = ()=>{
|
|
2786
|
+
t.abort(n.reason);
|
|
2787
|
+
};
|
|
2788
|
+
n.addEventListener("abort", e, {
|
|
2789
|
+
signal: t.signal
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
return t.signal;
|
|
2793
|
+
}
|
|
2794
|
+
async function main_I(e) {
|
|
2795
|
+
let t = "";
|
|
2796
|
+
for await (const n of e)t += n.toString();
|
|
2797
|
+
return t;
|
|
2798
|
+
}
|
|
2799
|
+
var main_L = class {
|
|
2800
|
+
_process;
|
|
2801
|
+
_aborted = false;
|
|
2802
|
+
_options;
|
|
2803
|
+
_command;
|
|
2804
|
+
_args;
|
|
2805
|
+
_resolveClose;
|
|
2806
|
+
_processClosed;
|
|
2807
|
+
_thrownError;
|
|
2808
|
+
get process() {
|
|
2809
|
+
return this._process;
|
|
2810
|
+
}
|
|
2811
|
+
get pid() {
|
|
2812
|
+
return this._process?.pid;
|
|
2813
|
+
}
|
|
2814
|
+
get exitCode() {
|
|
2815
|
+
if (this._process && null !== this._process.exitCode) return this._process.exitCode;
|
|
2816
|
+
}
|
|
2817
|
+
constructor(e, t, n){
|
|
2818
|
+
this._options = {
|
|
2819
|
+
...main_M,
|
|
2820
|
+
...n
|
|
2821
|
+
};
|
|
2822
|
+
this._command = e;
|
|
2823
|
+
this._args = t ?? [];
|
|
2824
|
+
this._processClosed = new Promise((e)=>{
|
|
2825
|
+
this._resolveClose = e;
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
kill(e) {
|
|
2829
|
+
return this._process?.kill(e) === true;
|
|
2830
|
+
}
|
|
2831
|
+
get aborted() {
|
|
2832
|
+
return this._aborted;
|
|
2833
|
+
}
|
|
2834
|
+
get killed() {
|
|
2835
|
+
return this._process?.killed === true;
|
|
2836
|
+
}
|
|
2837
|
+
pipe(e, t, n) {
|
|
2838
|
+
return main_z(e, t, {
|
|
2839
|
+
...n,
|
|
2840
|
+
stdin: this
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
async *[Symbol.asyncIterator]() {
|
|
2844
|
+
const e = this._process;
|
|
2845
|
+
if (!e) return;
|
|
2846
|
+
const t = [];
|
|
2847
|
+
if (this._streamErr) t.push(this._streamErr);
|
|
2848
|
+
if (this._streamOut) t.push(this._streamOut);
|
|
2849
|
+
const n = main_g(t);
|
|
2850
|
+
const r = node_readline.createInterface({
|
|
2851
|
+
input: n
|
|
2852
|
+
});
|
|
2853
|
+
for await (const e of r)yield e.toString();
|
|
2854
|
+
await this._processClosed;
|
|
2855
|
+
e.removeAllListeners();
|
|
2856
|
+
if (this._thrownError) throw this._thrownError;
|
|
2857
|
+
if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this);
|
|
2858
|
+
}
|
|
2859
|
+
async _waitForOutput() {
|
|
2860
|
+
const e = this._process;
|
|
2861
|
+
if (!e) throw new Error("No process was started");
|
|
2862
|
+
const [t, n] = await Promise.all([
|
|
2863
|
+
this._streamOut ? main_I(this._streamOut) : "",
|
|
2864
|
+
this._streamErr ? main_I(this._streamErr) : ""
|
|
2865
|
+
]);
|
|
2866
|
+
await this._processClosed;
|
|
2867
|
+
if (this._options?.stdin) await this._options.stdin;
|
|
2868
|
+
e.removeAllListeners();
|
|
2869
|
+
if (this._thrownError) throw this._thrownError;
|
|
2870
|
+
const r = {
|
|
2871
|
+
stderr: n,
|
|
2872
|
+
stdout: t,
|
|
2873
|
+
exitCode: this.exitCode
|
|
2874
|
+
};
|
|
2875
|
+
if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_j(this, r);
|
|
2876
|
+
return r;
|
|
2877
|
+
}
|
|
2878
|
+
then(e, t) {
|
|
2879
|
+
return this._waitForOutput().then(e, t);
|
|
2880
|
+
}
|
|
2881
|
+
_streamOut;
|
|
2882
|
+
_streamErr;
|
|
2883
|
+
spawn() {
|
|
2884
|
+
const e = external_node_process_cwd();
|
|
2885
|
+
const n = this._options;
|
|
2886
|
+
const r = {
|
|
2887
|
+
...main_N,
|
|
2888
|
+
...n.nodeOptions
|
|
2889
|
+
};
|
|
2890
|
+
const i = [];
|
|
2891
|
+
this._resetState();
|
|
2892
|
+
if (void 0 !== n.timeout) i.push(AbortSignal.timeout(n.timeout));
|
|
2893
|
+
if (void 0 !== n.signal) i.push(n.signal);
|
|
2894
|
+
if (true === n.persist) r.detached = true;
|
|
2895
|
+
if (i.length > 0) r.signal = main_F(i);
|
|
2896
|
+
r.env = main_h(e, r.env);
|
|
2897
|
+
const { command: a, args: s } = P(this._command, this._args);
|
|
2898
|
+
const c = (0, main_A._parse)(a, s, r);
|
|
2899
|
+
const l = spawn(c.command, c.args, c.options);
|
|
2900
|
+
if (l.stderr) this._streamErr = l.stderr;
|
|
2901
|
+
if (l.stdout) this._streamOut = l.stdout;
|
|
2902
|
+
this._process = l;
|
|
2903
|
+
l.once("error", this._onError);
|
|
2904
|
+
l.once("close", this._onClose);
|
|
2905
|
+
if (void 0 !== n.stdin && l.stdin && n.stdin.process) {
|
|
2906
|
+
const { stdout: e } = n.stdin.process;
|
|
2907
|
+
if (e) e.pipe(l.stdin);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
_resetState() {
|
|
2911
|
+
this._aborted = false;
|
|
2912
|
+
this._processClosed = new Promise((e)=>{
|
|
2913
|
+
this._resolveClose = e;
|
|
2914
|
+
});
|
|
2915
|
+
this._thrownError = void 0;
|
|
2916
|
+
}
|
|
2917
|
+
_onError = (e)=>{
|
|
2918
|
+
if ("AbortError" === e.name && (!(e.cause instanceof Error) || "TimeoutError" !== e.cause.name)) {
|
|
2919
|
+
this._aborted = true;
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
this._thrownError = e;
|
|
2923
|
+
};
|
|
2924
|
+
_onClose = ()=>{
|
|
2925
|
+
if (this._resolveClose) this._resolveClose();
|
|
2926
|
+
};
|
|
2927
|
+
};
|
|
2928
|
+
const main_R = (e, t, n)=>{
|
|
2929
|
+
const r = new main_L(e, t, n);
|
|
2930
|
+
r.spawn();
|
|
2931
|
+
return r;
|
|
2932
|
+
};
|
|
2933
|
+
const main_z = main_R;
|
|
2934
|
+
const dist_0 = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
|
|
2153
2935
|
const cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
2154
2936
|
var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
|
|
2155
2937
|
const minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
|
|
@@ -2157,11 +2939,11 @@ var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
|
|
|
2157
2939
|
const src_filename = fileURLToPath(import.meta.url);
|
|
2158
2940
|
const src_dirname = dirname(src_filename);
|
|
2159
2941
|
function cancelAndExit() {
|
|
2160
|
-
|
|
2942
|
+
pt('Operation cancelled.');
|
|
2161
2943
|
process.exit(0);
|
|
2162
2944
|
}
|
|
2163
2945
|
function checkCancel(value) {
|
|
2164
|
-
if (
|
|
2946
|
+
if (dist_q(value)) cancelAndExit();
|
|
2165
2947
|
return value;
|
|
2166
2948
|
}
|
|
2167
2949
|
function formatProjectName(input) {
|
|
@@ -2191,36 +2973,49 @@ function parseToolsOption(tools) {
|
|
|
2191
2973
|
];
|
|
2192
2974
|
return toolsArr.flatMap((tool)=>tool.split(',')).map((tool)=>tool.trim()).filter(Boolean);
|
|
2193
2975
|
}
|
|
2976
|
+
function parseSkillsOption(skills) {
|
|
2977
|
+
if (void 0 === skills) return null;
|
|
2978
|
+
const skillsArr = Array.isArray(skills) ? skills : [
|
|
2979
|
+
skills
|
|
2980
|
+
];
|
|
2981
|
+
return skillsArr.flatMap((skill)=>skill.split(',')).map((skill)=>skill.trim()).filter(Boolean);
|
|
2982
|
+
}
|
|
2194
2983
|
const BUILTIN_TOOLS = [
|
|
2195
2984
|
'biome',
|
|
2196
2985
|
'eslint',
|
|
2197
2986
|
'prettier'
|
|
2198
2987
|
];
|
|
2199
|
-
function logHelpMessage(name, templates, extraTools) {
|
|
2988
|
+
function logHelpMessage(name, templates, extraTools, extraSkills) {
|
|
2200
2989
|
const toolsList = [
|
|
2201
2990
|
...BUILTIN_TOOLS
|
|
2202
2991
|
];
|
|
2992
|
+
const skillsList = (extraSkills ?? []).map((skill)=>skill.value).filter(Boolean);
|
|
2993
|
+
const hasSkills = skillsList.length > 0;
|
|
2203
2994
|
if (extraTools) {
|
|
2204
2995
|
for (const tool of extraTools)if (tool.value) if ('pre' === tool.order) toolsList.unshift(tool.value);
|
|
2205
2996
|
else toolsList.push(tool.value);
|
|
2206
2997
|
}
|
|
2998
|
+
const skillsOptionLine = hasSkills ? ' --skill <skill> add optional skills, comma separated\n' : '';
|
|
2999
|
+
const optionalSkillsSection = hasSkills ? `
|
|
3000
|
+
Optional skills:
|
|
3001
|
+
${skillsList.join(', ')}` : '';
|
|
2207
3002
|
src_logger.log(`
|
|
2208
3003
|
Usage: create-${name} [dir] [options]
|
|
2209
3004
|
|
|
2210
3005
|
Options:
|
|
2211
3006
|
|
|
2212
3007
|
-h, --help display help for command
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
3008
|
+
-d, --dir <dir> create project in specified directory
|
|
3009
|
+
-t, --template <tpl> specify the template to use
|
|
3010
|
+
--tools <tool> add additional tools, comma separated
|
|
3011
|
+
${skillsOptionLine} --override override files in target directory
|
|
3012
|
+
--packageName <name> specify the package name
|
|
3013
|
+
|
|
3014
|
+
Available templates:
|
|
3015
|
+
${templates.join(', ')}
|
|
2221
3016
|
|
|
2222
|
-
|
|
2223
|
-
|
|
3017
|
+
Optional tools:
|
|
3018
|
+
${toolsList.join(', ')}${optionalSkillsSection}
|
|
2224
3019
|
`);
|
|
2225
3020
|
}
|
|
2226
3021
|
async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
@@ -2257,12 +3052,43 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
2257
3052
|
options.unshift(...filteredExtraTools.filter((tool)=>'pre' === tool.order).map(normalize));
|
|
2258
3053
|
options.push(...filteredExtraTools.filter((tool)=>'pre' !== tool.order).map(normalize));
|
|
2259
3054
|
}
|
|
2260
|
-
return checkCancel(await
|
|
3055
|
+
return checkCancel(await yt({
|
|
2261
3056
|
message: 'Select additional tools (Use <space> to select, <enter> to continue)',
|
|
2262
3057
|
options,
|
|
2263
3058
|
required: false
|
|
2264
3059
|
}));
|
|
2265
3060
|
}
|
|
3061
|
+
function filterExtraSkills(extraSkills, templateName) {
|
|
3062
|
+
return extraSkills?.filter((extraSkill)=>{
|
|
3063
|
+
const when = extraSkill.when ?? (()=>true);
|
|
3064
|
+
return templateName ? when(templateName) : true;
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
function orderExtraSkills(extraSkills) {
|
|
3068
|
+
if (!extraSkills) return [];
|
|
3069
|
+
return [
|
|
3070
|
+
...extraSkills.filter((extraSkill)=>'pre' === extraSkill.order),
|
|
3071
|
+
...extraSkills.filter((extraSkill)=>void 0 === extraSkill.order),
|
|
3072
|
+
...extraSkills.filter((extraSkill)=>'post' === extraSkill.order)
|
|
3073
|
+
];
|
|
3074
|
+
}
|
|
3075
|
+
async function getSkills({ skill, dir, template }, extraSkills, templateName, promptMultiselect = yt) {
|
|
3076
|
+
const parsedSkills = parseSkillsOption(skill);
|
|
3077
|
+
const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
|
|
3078
|
+
if (null !== parsedSkills) return parsedSkills.filter((value)=>filteredExtraSkills?.some((extraSkill)=>extraSkill.value === value));
|
|
3079
|
+
if (dir && template) return [];
|
|
3080
|
+
if (!filteredExtraSkills?.length) return [];
|
|
3081
|
+
const orderedExtraSkills = orderExtraSkills(filteredExtraSkills);
|
|
3082
|
+
return checkCancel(await promptMultiselect({
|
|
3083
|
+
message: 'Select optional skills (Use <space> to select, <enter> to continue)',
|
|
3084
|
+
options: orderedExtraSkills.map((extraSkill)=>({
|
|
3085
|
+
value: extraSkill.value,
|
|
3086
|
+
label: extraSkill.label,
|
|
3087
|
+
hint: extraSkill.source
|
|
3088
|
+
})),
|
|
3089
|
+
required: false
|
|
3090
|
+
}));
|
|
3091
|
+
}
|
|
2266
3092
|
function upperFirst(str) {
|
|
2267
3093
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2268
3094
|
}
|
|
@@ -2280,7 +3106,7 @@ const parseArgv = (processArgv)=>{
|
|
|
2280
3106
|
if (argv['package-name']) argv.packageName = argv['package-name'];
|
|
2281
3107
|
return argv;
|
|
2282
3108
|
};
|
|
2283
|
-
function runCommand(command, cwd, packageManager) {
|
|
3109
|
+
async function runCommand(command, cwd, packageManager) {
|
|
2284
3110
|
if (command.startsWith('npm create ')) {
|
|
2285
3111
|
const createReplacements = {
|
|
2286
3112
|
bun: 'bun create ',
|
|
@@ -2292,21 +3118,63 @@ function runCommand(command, cwd, packageManager) {
|
|
|
2292
3118
|
if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
|
|
2293
3119
|
if ('yarn' === packageManager) command = command.replace('@latest', '');
|
|
2294
3120
|
}
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
3121
|
+
const result = await main_R(command, [], {
|
|
3122
|
+
nodeOptions: {
|
|
3123
|
+
shell: true,
|
|
3124
|
+
stdio: 'inherit',
|
|
3125
|
+
cwd
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
if (0 !== result.exitCode) {
|
|
3129
|
+
const details = [
|
|
3130
|
+
result.stderr,
|
|
3131
|
+
result.stdout
|
|
3132
|
+
].filter(Boolean).join('\n').trim();
|
|
3133
|
+
throw new Error(`Failed to run command: ${command}${details ? `\n${details}` : ''}`);
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
async function runSkillCommand(skill, cwd) {
|
|
3137
|
+
const args = [
|
|
3138
|
+
'-y',
|
|
3139
|
+
'skills',
|
|
3140
|
+
'add',
|
|
3141
|
+
skill.source,
|
|
3142
|
+
'--agent',
|
|
3143
|
+
'universal',
|
|
3144
|
+
'--yes',
|
|
3145
|
+
'--copy',
|
|
3146
|
+
'--skill',
|
|
3147
|
+
skill.skill ?? skill.value
|
|
3148
|
+
];
|
|
3149
|
+
const command = `npx ${args.join(' ')}`;
|
|
3150
|
+
dist_O.info(`Running skill install command: ${color.dim(command)}`);
|
|
3151
|
+
const installationTaskLog = Gt({
|
|
3152
|
+
title: `Installing skill ${skill.value}`
|
|
2299
3153
|
});
|
|
3154
|
+
const proc = main_R('npx', args, {
|
|
3155
|
+
nodeOptions: {
|
|
3156
|
+
cwd,
|
|
3157
|
+
stdio: 'pipe'
|
|
3158
|
+
}
|
|
3159
|
+
});
|
|
3160
|
+
for await (const line of proc)installationTaskLog.message(line);
|
|
3161
|
+
const result = await proc;
|
|
3162
|
+
if (0 !== result.exitCode) {
|
|
3163
|
+
const message = `Failed to install skill "${skill.value}" from "${skill.source}" using command: ${command}`;
|
|
3164
|
+
installationTaskLog.error(message);
|
|
3165
|
+
throw new Error(message);
|
|
3166
|
+
}
|
|
3167
|
+
installationTaskLog.success(`Installed skill ${skill.value}`);
|
|
2300
3168
|
}
|
|
2301
|
-
async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, argv: processArgv = process.argv }) {
|
|
3169
|
+
async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, extraSkills, argv: processArgv = process.argv }) {
|
|
2302
3170
|
src_logger.greet(`\n◆ Create ${upperFirst(name)} Project`);
|
|
2303
|
-
const { isAgent } = await (0,
|
|
3171
|
+
const { isAgent } = await (0, dist_0.determineAgent)();
|
|
2304
3172
|
if (isAgent) {
|
|
2305
3173
|
console.log('');
|
|
2306
3174
|
src_logger.info(`To create a project non-interactively, run: npx -y create-${name} <DIR> --template <TEMPLATE>`);
|
|
2307
3175
|
}
|
|
2308
3176
|
const argv = parseArgv(processArgv);
|
|
2309
|
-
if (argv.help) return void logHelpMessage(name, templates, extraTools);
|
|
3177
|
+
if (argv.help) return void logHelpMessage(name, templates, extraTools, extraSkills);
|
|
2310
3178
|
const cwd = process.cwd();
|
|
2311
3179
|
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
|
|
2312
3180
|
const packageManager = pkgInfo ? pkgInfo.name : 'npm';
|
|
@@ -2314,7 +3182,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2314
3182
|
packageManager
|
|
2315
3183
|
};
|
|
2316
3184
|
if (!version) version = (await readPackageJson(root)).version;
|
|
2317
|
-
const projectName = argv.dir ?? checkCancel(await
|
|
3185
|
+
const projectName = argv.dir ?? checkCancel(await Ot({
|
|
2318
3186
|
message: 'Project name or path',
|
|
2319
3187
|
placeholder: `${name.toLowerCase()}-project`,
|
|
2320
3188
|
defaultValue: `${name.toLowerCase()}-project`,
|
|
@@ -2327,7 +3195,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2327
3195
|
const packageName = argv.packageName || formatted.packageName;
|
|
2328
3196
|
const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
|
|
2329
3197
|
if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
2330
|
-
const option = checkCancel(await
|
|
3198
|
+
const option = checkCancel(await _t({
|
|
2331
3199
|
message: `"${targetDir}" is not empty, please choose:`,
|
|
2332
3200
|
options: [
|
|
2333
3201
|
{
|
|
@@ -2344,6 +3212,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2344
3212
|
}
|
|
2345
3213
|
const templateName = await getTemplateName(argv);
|
|
2346
3214
|
const tools = await getTools(argv, extraTools, templateName);
|
|
3215
|
+
const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
|
|
3216
|
+
const skills = await getSkills(argv, filteredExtraSkills, templateName, yt);
|
|
2347
3217
|
const srcFolder = node_path.join(root, `template-${templateName}`);
|
|
2348
3218
|
const commonFolder = node_path.join(root, 'template-common');
|
|
2349
3219
|
if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
|
|
@@ -2362,6 +3232,10 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2362
3232
|
templateParameters,
|
|
2363
3233
|
skipFiles
|
|
2364
3234
|
});
|
|
3235
|
+
for (const skillValue of skills){
|
|
3236
|
+
const matchedSkill = filteredExtraSkills?.find((extraSkill)=>extraSkill.value === skillValue);
|
|
3237
|
+
if (matchedSkill) await runSkillCommand(matchedSkill, distFolder);
|
|
3238
|
+
}
|
|
2365
3239
|
const packageRoot = node_path.resolve(src_dirname, '..');
|
|
2366
3240
|
const agentsMdSearchDirs = [
|
|
2367
3241
|
commonFolder,
|
|
@@ -2376,7 +3250,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2376
3250
|
distFolder,
|
|
2377
3251
|
addAgentsMdSearchDirs: (dir)=>agentsMdSearchDirs.push(dir)
|
|
2378
3252
|
});
|
|
2379
|
-
if (matchedTool.command) runCommand(matchedTool.command, distFolder, packageManager);
|
|
3253
|
+
if (matchedTool.command) await runCommand(matchedTool.command, distFolder, packageManager);
|
|
2380
3254
|
continue;
|
|
2381
3255
|
}
|
|
2382
3256
|
}
|
|
@@ -2422,8 +3296,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2422
3296
|
`3. ${color.cyan(`${packageManager} install`)}`,
|
|
2423
3297
|
`4. ${color.cyan(`${packageManager} run dev`)}`
|
|
2424
3298
|
];
|
|
2425
|
-
if (nextSteps.length)
|
|
2426
|
-
|
|
3299
|
+
if (nextSteps.length) wt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
|
|
3300
|
+
gt('All set, happy coding!');
|
|
2427
3301
|
}
|
|
2428
3302
|
function sortObjectKeys(obj) {
|
|
2429
3303
|
const sortedKeys = Object.keys(obj).sort();
|
|
@@ -2586,4 +3460,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
|
|
|
2586
3460
|
}
|
|
2587
3461
|
return agentsFiles;
|
|
2588
3462
|
}
|
|
2589
|
-
export { BUILTIN_TOOLS,
|
|
3463
|
+
export { Ae as autocomplete, BUILTIN_TOOLS, Ot as text, _t as select, checkCancel, collectAgentsFiles, copyFolder, create, ht as groupMultiselect, mergeAgentsFiles, mergePackageJson, yt as multiselect };
|