create-vue 2.0.6 → 2.1.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.
Files changed (84) hide show
  1. package/LICENSE +153 -1
  2. package/outfile.cjs +498 -2942
  3. package/package.json +15 -10
  4. package/template/base/.vscode/extensions.json +1 -1
  5. package/template/base/node_modules/.bin/vite +17 -0
  6. package/template/base/package.json +5 -10
  7. package/template/{code/default → base}/src/assets/base.css +0 -0
  8. package/template/{code/default → base}/src/assets/logo.svg +0 -0
  9. package/template/base/src/assets/main.css +35 -0
  10. package/template/base/vite.config.js +2 -11
  11. package/template/code/default/src/App.vue +5 -39
  12. package/template/code/default/src/components/icons/IconTooling.vue +0 -2
  13. package/template/code/router/src/App.vue +6 -40
  14. package/template/code/router/src/components/icons/IconTooling.vue +0 -2
  15. package/template/code/typescript-default/src/App.vue +5 -39
  16. package/template/code/typescript-default/src/components/icons/IconTooling.vue +0 -2
  17. package/template/code/typescript-router/src/App.vue +6 -40
  18. package/template/code/typescript-router/src/components/icons/IconTooling.vue +0 -2
  19. package/template/{code/default/cypress/integration/example.spec.js → config/cypress/cypress/e2e/example.cy.js} +0 -0
  20. package/template/config/cypress/cypress/{jsconfig.json → e2e/jsconfig.json} +1 -1
  21. package/template/config/cypress/cypress/support/commands.ts +37 -0
  22. package/template/config/cypress/cypress/support/{index.js → e2e.js} +0 -0
  23. package/template/config/cypress/cypress.config.js +8 -0
  24. package/template/config/cypress/cypress.config.ts +8 -0
  25. package/template/config/cypress/node_modules/.bin/cypress +17 -0
  26. package/template/config/cypress/node_modules/.bin/server-test +17 -0
  27. package/template/config/cypress/node_modules/.bin/start-server-and-test +17 -0
  28. package/template/config/cypress/node_modules/.bin/start-test +17 -0
  29. package/template/config/cypress/package.json +3 -7
  30. package/template/config/cypress-ct/cypress/support/component-index.html +12 -0
  31. package/template/config/cypress-ct/cypress/support/component.js +30 -0
  32. package/template/config/cypress-ct/cypress/support/component.ts +42 -0
  33. package/template/config/cypress-ct/cypress.config.js +15 -0
  34. package/template/config/cypress-ct/cypress.config.ts +15 -0
  35. package/template/config/cypress-ct/node_modules/.bin/cypress +17 -0
  36. package/template/config/cypress-ct/package.json +12 -0
  37. package/template/{code/typescript-default/src/components/__tests__/HelloWorld.spec.ts → config/cypress-ct/src/components/__tests__/HelloWorld.cy.js} +2 -3
  38. package/template/config/jsx/node_modules/.bin/vite +17 -0
  39. package/template/config/jsx/package.json +9 -0
  40. package/template/config/jsx/vite.config.js +23 -0
  41. package/template/config/pinia/package.json +2 -1
  42. package/template/config/router/package.json +1 -1
  43. package/template/config/typescript/env.d.ts +0 -1
  44. package/template/config/typescript/node_modules/.bin/npm-run-all +17 -0
  45. package/template/config/typescript/node_modules/.bin/run-p +17 -0
  46. package/template/config/typescript/node_modules/.bin/run-s +17 -0
  47. package/template/config/typescript/node_modules/.bin/tsc +17 -0
  48. package/template/config/typescript/node_modules/.bin/tsserver +17 -0
  49. package/template/config/typescript/node_modules/.bin/vue-tsc +17 -0
  50. package/template/config/typescript/package.json +7 -5
  51. package/template/config/vitest/node_modules/.bin/vitest +17 -0
  52. package/template/config/vitest/package.json +14 -0
  53. package/template/config/vitest/src/components/__tests__/HelloWorld.spec.js +11 -0
  54. package/template/entry/default/src/main.js +4 -8
  55. package/template/entry/pinia/src/main.js +6 -8
  56. package/template/entry/router/src/main.js +4 -7
  57. package/template/entry/router-and-pinia/src/main.js +6 -8
  58. package/template/eslint/package.json +11 -0
  59. package/template/tsconfig/base/package.json +5 -0
  60. package/template/tsconfig/base/tsconfig.config.json +8 -0
  61. package/template/tsconfig/base/tsconfig.json +16 -0
  62. package/template/tsconfig/cypress/cypress/e2e/tsconfig.json +10 -0
  63. package/template/tsconfig/cypress-ct/tsconfig.app.json +12 -0
  64. package/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json +8 -0
  65. package/template/tsconfig/cypress-ct/tsconfig.json +14 -0
  66. package/template/tsconfig/vitest/package.json +8 -0
  67. package/template/tsconfig/vitest/tsconfig.app.json +12 -0
  68. package/template/tsconfig/vitest/tsconfig.json +14 -0
  69. package/template/tsconfig/vitest/tsconfig.vitest.json +9 -0
  70. package/template/code/default/src/components/__tests__/HelloWorld.spec.js +0 -13
  71. package/template/code/router/cypress/integration/example.spec.js +0 -13
  72. package/template/code/router/src/assets/base.css +0 -74
  73. package/template/code/router/src/assets/logo.svg +0 -1
  74. package/template/code/router/src/components/__tests__/HelloWorld.spec.js +0 -13
  75. package/template/code/typescript-default/cypress/integration/example.spec.ts +0 -8
  76. package/template/code/typescript-default/src/assets/base.css +0 -74
  77. package/template/code/typescript-default/src/assets/logo.svg +0 -1
  78. package/template/code/typescript-router/cypress/integration/example.spec.ts +0 -13
  79. package/template/code/typescript-router/src/assets/base.css +0 -74
  80. package/template/code/typescript-router/src/assets/logo.svg +0 -1
  81. package/template/code/typescript-router/src/components/__tests__/HelloWorld.spec.ts +0 -13
  82. package/template/config/cypress/cypress/plugins/index.js +0 -28
  83. package/template/config/cypress/cypress.json +0 -7
  84. package/template/config/typescript/tsconfig.json +0 -24
package/outfile.cjs CHANGED
@@ -1,29 +1,27 @@
1
1
  #!/usr/bin/env node
2
+ /*! create-vue v2.1.1 | MIT */
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
9
  var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
11
  };
12
- var __reExport = (target, module2, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && key !== "default")
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
17
  }
18
- return target;
19
- };
20
- var __toModule = (module2) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ return to;
22
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
21
 
24
- // node_modules/.pnpm/minimist@1.2.5/node_modules/minimist/index.js
22
+ // node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
25
23
  var require_minimist = __commonJS({
26
- "node_modules/.pnpm/minimist@1.2.5/node_modules/minimist/index.js"(exports, module2) {
24
+ "node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports, module2) {
27
25
  module2.exports = function(args, opts) {
28
26
  if (!opts)
29
27
  opts = {};
@@ -81,7 +79,7 @@ var require_minimist = __commonJS({
81
79
  var o = obj;
82
80
  for (var i2 = 0; i2 < keys.length - 1; i2++) {
83
81
  var key2 = keys[i2];
84
- if (key2 === "__proto__")
82
+ if (isConstructorOrProto(o, key2))
85
83
  return;
86
84
  if (o[key2] === void 0)
87
85
  o[key2] = {};
@@ -92,7 +90,7 @@ var require_minimist = __commonJS({
92
90
  o = o[key2];
93
91
  }
94
92
  var key2 = keys[keys.length - 1];
95
- if (key2 === "__proto__")
93
+ if (isConstructorOrProto(o, key2))
96
94
  return;
97
95
  if (o === Object.prototype || o === Number.prototype || o === String.prototype)
98
96
  o = {};
@@ -220,6 +218,9 @@ var require_minimist = __commonJS({
220
218
  return true;
221
219
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
222
220
  }
221
+ function isConstructorOrProto(obj, key) {
222
+ return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
223
+ }
223
224
  }
224
225
  });
225
226
 
@@ -287,2744 +288,38 @@ var require_kleur = __commonJS({
287
288
  ctx.magenta = $.magenta.bind(ctx);
288
289
  ctx.cyan = $.cyan.bind(ctx);
289
290
  ctx.white = $.white.bind(ctx);
290
- ctx.gray = $.gray.bind(ctx);
291
- ctx.grey = $.grey.bind(ctx);
292
- ctx.bgBlack = $.bgBlack.bind(ctx);
293
- ctx.bgRed = $.bgRed.bind(ctx);
294
- ctx.bgGreen = $.bgGreen.bind(ctx);
295
- ctx.bgYellow = $.bgYellow.bind(ctx);
296
- ctx.bgBlue = $.bgBlue.bind(ctx);
297
- ctx.bgMagenta = $.bgMagenta.bind(ctx);
298
- ctx.bgCyan = $.bgCyan.bind(ctx);
299
- ctx.bgWhite = $.bgWhite.bind(ctx);
300
- return ctx;
301
- }
302
- function init2(open, close) {
303
- let blk = {
304
- open: `[${open}m`,
305
- close: `[${close}m`,
306
- rgx: new RegExp(`\\x1b\\[${close}m`, "g")
307
- };
308
- return function(txt) {
309
- if (this !== void 0 && this.has !== void 0) {
310
- this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
311
- return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
312
- }
313
- return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
314
- };
315
- }
316
- module2.exports = $;
317
- }
318
- });
319
-
320
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/action.js
321
- var require_action = __commonJS({
322
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/action.js"(exports, module2) {
323
- "use strict";
324
- module2.exports = (key, isSelect) => {
325
- if (key.meta && key.name !== "escape")
326
- return;
327
- if (key.ctrl) {
328
- if (key.name === "a")
329
- return "first";
330
- if (key.name === "c")
331
- return "abort";
332
- if (key.name === "d")
333
- return "abort";
334
- if (key.name === "e")
335
- return "last";
336
- if (key.name === "g")
337
- return "reset";
338
- }
339
- if (isSelect) {
340
- if (key.name === "j")
341
- return "down";
342
- if (key.name === "k")
343
- return "up";
344
- }
345
- if (key.name === "return")
346
- return "submit";
347
- if (key.name === "enter")
348
- return "submit";
349
- if (key.name === "backspace")
350
- return "delete";
351
- if (key.name === "delete")
352
- return "deleteForward";
353
- if (key.name === "abort")
354
- return "abort";
355
- if (key.name === "escape")
356
- return "exit";
357
- if (key.name === "tab")
358
- return "next";
359
- if (key.name === "pagedown")
360
- return "nextPage";
361
- if (key.name === "pageup")
362
- return "prevPage";
363
- if (key.name === "home")
364
- return "home";
365
- if (key.name === "end")
366
- return "end";
367
- if (key.name === "up")
368
- return "up";
369
- if (key.name === "down")
370
- return "down";
371
- if (key.name === "right")
372
- return "right";
373
- if (key.name === "left")
374
- return "left";
375
- return false;
376
- };
377
- }
378
- });
379
-
380
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/strip.js
381
- var require_strip = __commonJS({
382
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/strip.js"(exports, module2) {
383
- "use strict";
384
- module2.exports = (str) => {
385
- const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
386
- const RGX = new RegExp(pattern, "g");
387
- return typeof str === "string" ? str.replace(RGX, "") : str;
388
- };
389
- }
390
- });
391
-
392
- // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
393
- var require_src = __commonJS({
394
- "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module2) {
395
- "use strict";
396
- var ESC = "";
397
- var CSI = `${ESC}[`;
398
- var beep = "\x07";
399
- var cursor = {
400
- to(x, y) {
401
- if (!y)
402
- return `${CSI}${x + 1}G`;
403
- return `${CSI}${y + 1};${x + 1}H`;
404
- },
405
- move(x, y) {
406
- let ret = "";
407
- if (x < 0)
408
- ret += `${CSI}${-x}D`;
409
- else if (x > 0)
410
- ret += `${CSI}${x}C`;
411
- if (y < 0)
412
- ret += `${CSI}${-y}A`;
413
- else if (y > 0)
414
- ret += `${CSI}${y}B`;
415
- return ret;
416
- },
417
- up: (count = 1) => `${CSI}${count}A`,
418
- down: (count = 1) => `${CSI}${count}B`,
419
- forward: (count = 1) => `${CSI}${count}C`,
420
- backward: (count = 1) => `${CSI}${count}D`,
421
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
422
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
423
- left: `${CSI}G`,
424
- hide: `${CSI}?25l`,
425
- show: `${CSI}?25h`,
426
- save: `${ESC}7`,
427
- restore: `${ESC}8`
428
- };
429
- var scroll = {
430
- up: (count = 1) => `${CSI}S`.repeat(count),
431
- down: (count = 1) => `${CSI}T`.repeat(count)
432
- };
433
- var erase = {
434
- screen: `${CSI}2J`,
435
- up: (count = 1) => `${CSI}1J`.repeat(count),
436
- down: (count = 1) => `${CSI}J`.repeat(count),
437
- line: `${CSI}2K`,
438
- lineEnd: `${CSI}K`,
439
- lineStart: `${CSI}1K`,
440
- lines(count) {
441
- let clear = "";
442
- for (let i = 0; i < count; i++)
443
- clear += this.line + (i < count - 1 ? cursor.up() : "");
444
- if (count)
445
- clear += cursor.left;
446
- return clear;
447
- }
448
- };
449
- module2.exports = { cursor, scroll, erase, beep };
450
- }
451
- });
452
-
453
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/clear.js
454
- var require_clear = __commonJS({
455
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/clear.js"(exports, module2) {
456
- "use strict";
457
- function _createForOfIteratorHelper(o, allowArrayLike) {
458
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
459
- if (!it) {
460
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
461
- if (it)
462
- o = it;
463
- var i = 0;
464
- var F = function F2() {
465
- };
466
- return { s: F, n: function n() {
467
- if (i >= o.length)
468
- return { done: true };
469
- return { done: false, value: o[i++] };
470
- }, e: function e(_e) {
471
- throw _e;
472
- }, f: F };
473
- }
474
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
475
- }
476
- var normalCompletion = true, didErr = false, err;
477
- return { s: function s() {
478
- it = it.call(o);
479
- }, n: function n() {
480
- var step = it.next();
481
- normalCompletion = step.done;
482
- return step;
483
- }, e: function e(_e2) {
484
- didErr = true;
485
- err = _e2;
486
- }, f: function f() {
487
- try {
488
- if (!normalCompletion && it.return != null)
489
- it.return();
490
- } finally {
491
- if (didErr)
492
- throw err;
493
- }
494
- } };
495
- }
496
- function _unsupportedIterableToArray(o, minLen) {
497
- if (!o)
498
- return;
499
- if (typeof o === "string")
500
- return _arrayLikeToArray(o, minLen);
501
- var n = Object.prototype.toString.call(o).slice(8, -1);
502
- if (n === "Object" && o.constructor)
503
- n = o.constructor.name;
504
- if (n === "Map" || n === "Set")
505
- return Array.from(o);
506
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
507
- return _arrayLikeToArray(o, minLen);
508
- }
509
- function _arrayLikeToArray(arr, len) {
510
- if (len == null || len > arr.length)
511
- len = arr.length;
512
- for (var i = 0, arr2 = new Array(len); i < len; i++)
513
- arr2[i] = arr[i];
514
- return arr2;
515
- }
516
- var strip = require_strip();
517
- var _require = require_src();
518
- var erase = _require.erase;
519
- var cursor = _require.cursor;
520
- var width = (str) => [...strip(str)].length;
521
- module2.exports = function(prompt, perLine) {
522
- if (!perLine)
523
- return erase.line + cursor.to(0);
524
- let rows = 0;
525
- const lines = prompt.split(/\r?\n/);
526
- var _iterator = _createForOfIteratorHelper(lines), _step;
527
- try {
528
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
529
- let line = _step.value;
530
- rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
531
- }
532
- } catch (err) {
533
- _iterator.e(err);
534
- } finally {
535
- _iterator.f();
536
- }
537
- return erase.lines(rows);
538
- };
539
- }
540
- });
541
-
542
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/figures.js
543
- var require_figures = __commonJS({
544
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/figures.js"(exports, module2) {
545
- "use strict";
546
- var main = {
547
- arrowUp: "\u2191",
548
- arrowDown: "\u2193",
549
- arrowLeft: "\u2190",
550
- arrowRight: "\u2192",
551
- radioOn: "\u25C9",
552
- radioOff: "\u25EF",
553
- tick: "\u2714",
554
- cross: "\u2716",
555
- ellipsis: "\u2026",
556
- pointerSmall: "\u203A",
557
- line: "\u2500",
558
- pointer: "\u276F"
559
- };
560
- var win = {
561
- arrowUp: main.arrowUp,
562
- arrowDown: main.arrowDown,
563
- arrowLeft: main.arrowLeft,
564
- arrowRight: main.arrowRight,
565
- radioOn: "(*)",
566
- radioOff: "( )",
567
- tick: "\u221A",
568
- cross: "\xD7",
569
- ellipsis: "...",
570
- pointerSmall: "\xBB",
571
- line: "\u2500",
572
- pointer: ">"
573
- };
574
- var figures = process.platform === "win32" ? win : main;
575
- module2.exports = figures;
576
- }
577
- });
578
-
579
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/style.js
580
- var require_style = __commonJS({
581
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/style.js"(exports, module2) {
582
- "use strict";
583
- var c = require_kleur();
584
- var figures = require_figures();
585
- var styles = Object.freeze({
586
- password: {
587
- scale: 1,
588
- render: (input) => "*".repeat(input.length)
589
- },
590
- emoji: {
591
- scale: 2,
592
- render: (input) => "\u{1F603}".repeat(input.length)
593
- },
594
- invisible: {
595
- scale: 0,
596
- render: (input) => ""
597
- },
598
- default: {
599
- scale: 1,
600
- render: (input) => `${input}`
601
- }
602
- });
603
- var render = (type) => styles[type] || styles.default;
604
- var symbols = Object.freeze({
605
- aborted: c.red(figures.cross),
606
- done: c.green(figures.tick),
607
- exited: c.yellow(figures.cross),
608
- default: c.cyan("?")
609
- });
610
- var symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
611
- var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
612
- var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
613
- module2.exports = {
614
- styles,
615
- render,
616
- symbols,
617
- symbol,
618
- delimiter,
619
- item
620
- };
621
- }
622
- });
623
-
624
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/lines.js
625
- var require_lines = __commonJS({
626
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/lines.js"(exports, module2) {
627
- "use strict";
628
- var strip = require_strip();
629
- module2.exports = function(msg, perLine) {
630
- let lines = String(strip(msg) || "").split(/\r?\n/);
631
- if (!perLine)
632
- return lines.length;
633
- return lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
634
- };
635
- }
636
- });
637
-
638
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/wrap.js
639
- var require_wrap = __commonJS({
640
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/wrap.js"(exports, module2) {
641
- "use strict";
642
- module2.exports = (msg, opts = {}) => {
643
- const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "";
644
- const width = opts.width;
645
- return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => {
646
- if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width)
647
- arr[arr.length - 1] += ` ${w}`;
648
- else
649
- arr.push(`${tab}${w}`);
650
- return arr;
651
- }, [tab]).join("\n")).join("\n");
652
- };
653
- }
654
- });
655
-
656
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/entriesToDisplay.js
657
- var require_entriesToDisplay = __commonJS({
658
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/entriesToDisplay.js"(exports, module2) {
659
- "use strict";
660
- module2.exports = (cursor, total, maxVisible) => {
661
- maxVisible = maxVisible || total;
662
- let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
663
- if (startIndex < 0)
664
- startIndex = 0;
665
- let endIndex = Math.min(startIndex + maxVisible, total);
666
- return {
667
- startIndex,
668
- endIndex
669
- };
670
- };
671
- }
672
- });
673
-
674
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/index.js
675
- var require_util = __commonJS({
676
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/util/index.js"(exports, module2) {
677
- "use strict";
678
- module2.exports = {
679
- action: require_action(),
680
- clear: require_clear(),
681
- style: require_style(),
682
- strip: require_strip(),
683
- figures: require_figures(),
684
- lines: require_lines(),
685
- wrap: require_wrap(),
686
- entriesToDisplay: require_entriesToDisplay()
687
- };
688
- }
689
- });
690
-
691
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/prompt.js
692
- var require_prompt = __commonJS({
693
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/prompt.js"(exports, module2) {
694
- "use strict";
695
- var readline = require("readline");
696
- var _require = require_util();
697
- var action = _require.action;
698
- var EventEmitter = require("events");
699
- var _require2 = require_src();
700
- var beep = _require2.beep;
701
- var cursor = _require2.cursor;
702
- var color = require_kleur();
703
- var Prompt = class extends EventEmitter {
704
- constructor(opts = {}) {
705
- super();
706
- this.firstRender = true;
707
- this.in = opts.stdin || process.stdin;
708
- this.out = opts.stdout || process.stdout;
709
- this.onRender = (opts.onRender || (() => void 0)).bind(this);
710
- const rl = readline.createInterface({
711
- input: this.in,
712
- escapeCodeTimeout: 50
713
- });
714
- readline.emitKeypressEvents(this.in, rl);
715
- if (this.in.isTTY)
716
- this.in.setRawMode(true);
717
- const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
718
- const keypress = (str, key) => {
719
- let a = action(key, isSelect);
720
- if (a === false) {
721
- this._ && this._(str, key);
722
- } else if (typeof this[a] === "function") {
723
- this[a](key);
724
- } else {
725
- this.bell();
726
- }
727
- };
728
- this.close = () => {
729
- this.out.write(cursor.show);
730
- this.in.removeListener("keypress", keypress);
731
- if (this.in.isTTY)
732
- this.in.setRawMode(false);
733
- rl.close();
734
- this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value);
735
- this.closed = true;
736
- };
737
- this.in.on("keypress", keypress);
738
- }
739
- fire() {
740
- this.emit("state", {
741
- value: this.value,
742
- aborted: !!this.aborted,
743
- exited: !!this.exited
744
- });
745
- }
746
- bell() {
747
- this.out.write(beep);
748
- }
749
- render() {
750
- this.onRender(color);
751
- if (this.firstRender)
752
- this.firstRender = false;
753
- }
754
- };
755
- module2.exports = Prompt;
756
- }
757
- });
758
-
759
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/text.js
760
- var require_text = __commonJS({
761
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/text.js"(exports, module2) {
762
- "use strict";
763
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
764
- try {
765
- var info = gen[key](arg);
766
- var value = info.value;
767
- } catch (error) {
768
- reject(error);
769
- return;
770
- }
771
- if (info.done) {
772
- resolve(value);
773
- } else {
774
- Promise.resolve(value).then(_next, _throw);
775
- }
776
- }
777
- function _asyncToGenerator(fn) {
778
- return function() {
779
- var self2 = this, args = arguments;
780
- return new Promise(function(resolve, reject) {
781
- var gen = fn.apply(self2, args);
782
- function _next(value) {
783
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
784
- }
785
- function _throw(err) {
786
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
787
- }
788
- _next(void 0);
789
- });
790
- };
791
- }
792
- var color = require_kleur();
793
- var Prompt = require_prompt();
794
- var _require = require_src();
795
- var erase = _require.erase;
796
- var cursor = _require.cursor;
797
- var _require2 = require_util();
798
- var style = _require2.style;
799
- var clear = _require2.clear;
800
- var lines = _require2.lines;
801
- var figures = _require2.figures;
802
- var TextPrompt = class extends Prompt {
803
- constructor(opts = {}) {
804
- super(opts);
805
- this.transform = style.render(opts.style);
806
- this.scale = this.transform.scale;
807
- this.msg = opts.message;
808
- this.initial = opts.initial || ``;
809
- this.validator = opts.validate || (() => true);
810
- this.value = ``;
811
- this.errorMsg = opts.error || `Please Enter A Valid Value`;
812
- this.cursor = Number(!!this.initial);
813
- this.cursorOffset = 0;
814
- this.clear = clear(``, this.out.columns);
815
- this.render();
816
- }
817
- set value(v) {
818
- if (!v && this.initial) {
819
- this.placeholder = true;
820
- this.rendered = color.gray(this.transform.render(this.initial));
821
- } else {
822
- this.placeholder = false;
823
- this.rendered = this.transform.render(v);
824
- }
825
- this._value = v;
826
- this.fire();
827
- }
828
- get value() {
829
- return this._value;
830
- }
831
- reset() {
832
- this.value = ``;
833
- this.cursor = Number(!!this.initial);
834
- this.cursorOffset = 0;
835
- this.fire();
836
- this.render();
837
- }
838
- exit() {
839
- this.abort();
840
- }
841
- abort() {
842
- this.value = this.value || this.initial;
843
- this.done = this.aborted = true;
844
- this.error = false;
845
- this.red = false;
846
- this.fire();
847
- this.render();
848
- this.out.write("\n");
849
- this.close();
850
- }
851
- validate() {
852
- var _this = this;
853
- return _asyncToGenerator(function* () {
854
- let valid = yield _this.validator(_this.value);
855
- if (typeof valid === `string`) {
856
- _this.errorMsg = valid;
857
- valid = false;
858
- }
859
- _this.error = !valid;
860
- })();
861
- }
862
- submit() {
863
- var _this2 = this;
864
- return _asyncToGenerator(function* () {
865
- _this2.value = _this2.value || _this2.initial;
866
- _this2.cursorOffset = 0;
867
- _this2.cursor = _this2.rendered.length;
868
- yield _this2.validate();
869
- if (_this2.error) {
870
- _this2.red = true;
871
- _this2.fire();
872
- _this2.render();
873
- return;
874
- }
875
- _this2.done = true;
876
- _this2.aborted = false;
877
- _this2.fire();
878
- _this2.render();
879
- _this2.out.write("\n");
880
- _this2.close();
881
- })();
882
- }
883
- next() {
884
- if (!this.placeholder)
885
- return this.bell();
886
- this.value = this.initial;
887
- this.cursor = this.rendered.length;
888
- this.fire();
889
- this.render();
890
- }
891
- moveCursor(n) {
892
- if (this.placeholder)
893
- return;
894
- this.cursor = this.cursor + n;
895
- this.cursorOffset += n;
896
- }
897
- _(c, key) {
898
- let s1 = this.value.slice(0, this.cursor);
899
- let s2 = this.value.slice(this.cursor);
900
- this.value = `${s1}${c}${s2}`;
901
- this.red = false;
902
- this.cursor = this.placeholder ? 0 : s1.length + 1;
903
- this.render();
904
- }
905
- delete() {
906
- if (this.isCursorAtStart())
907
- return this.bell();
908
- let s1 = this.value.slice(0, this.cursor - 1);
909
- let s2 = this.value.slice(this.cursor);
910
- this.value = `${s1}${s2}`;
911
- this.red = false;
912
- if (this.isCursorAtStart()) {
913
- this.cursorOffset = 0;
914
- } else {
915
- this.cursorOffset++;
916
- this.moveCursor(-1);
917
- }
918
- this.render();
919
- }
920
- deleteForward() {
921
- if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
922
- return this.bell();
923
- let s1 = this.value.slice(0, this.cursor);
924
- let s2 = this.value.slice(this.cursor + 1);
925
- this.value = `${s1}${s2}`;
926
- this.red = false;
927
- if (this.isCursorAtEnd()) {
928
- this.cursorOffset = 0;
929
- } else {
930
- this.cursorOffset++;
931
- }
932
- this.render();
933
- }
934
- first() {
935
- this.cursor = 0;
936
- this.render();
937
- }
938
- last() {
939
- this.cursor = this.value.length;
940
- this.render();
941
- }
942
- left() {
943
- if (this.cursor <= 0 || this.placeholder)
944
- return this.bell();
945
- this.moveCursor(-1);
946
- this.render();
947
- }
948
- right() {
949
- if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
950
- return this.bell();
951
- this.moveCursor(1);
952
- this.render();
953
- }
954
- isCursorAtStart() {
955
- return this.cursor === 0 || this.placeholder && this.cursor === 1;
956
- }
957
- isCursorAtEnd() {
958
- return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
959
- }
960
- render() {
961
- if (this.closed)
962
- return;
963
- if (!this.firstRender) {
964
- if (this.outputError)
965
- this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
966
- this.out.write(clear(this.outputText, this.out.columns));
967
- }
968
- super.render();
969
- this.outputError = "";
970
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
971
- if (this.error) {
972
- this.outputError += this.errorMsg.split(`
973
- `).reduce((a, l, i) => a + `
974
- ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
975
- }
976
- this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));
977
- }
978
- };
979
- module2.exports = TextPrompt;
980
- }
981
- });
982
-
983
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/select.js
984
- var require_select = __commonJS({
985
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/select.js"(exports, module2) {
986
- "use strict";
987
- var color = require_kleur();
988
- var Prompt = require_prompt();
989
- var _require = require_util();
990
- var style = _require.style;
991
- var clear = _require.clear;
992
- var figures = _require.figures;
993
- var wrap = _require.wrap;
994
- var entriesToDisplay = _require.entriesToDisplay;
995
- var _require2 = require_src();
996
- var cursor = _require2.cursor;
997
- var SelectPrompt = class extends Prompt {
998
- constructor(opts = {}) {
999
- super(opts);
1000
- this.msg = opts.message;
1001
- this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
1002
- this.warn = opts.warn || "- This option is disabled";
1003
- this.cursor = opts.initial || 0;
1004
- this.choices = opts.choices.map((ch, idx) => {
1005
- if (typeof ch === "string")
1006
- ch = {
1007
- title: ch,
1008
- value: idx
1009
- };
1010
- return {
1011
- title: ch && (ch.title || ch.value || ch),
1012
- value: ch && (ch.value === void 0 ? idx : ch.value),
1013
- description: ch && ch.description,
1014
- selected: ch && ch.selected,
1015
- disabled: ch && ch.disabled
1016
- };
1017
- });
1018
- this.optionsPerPage = opts.optionsPerPage || 10;
1019
- this.value = (this.choices[this.cursor] || {}).value;
1020
- this.clear = clear("", this.out.columns);
1021
- this.render();
1022
- }
1023
- moveCursor(n) {
1024
- this.cursor = n;
1025
- this.value = this.choices[n].value;
1026
- this.fire();
1027
- }
1028
- reset() {
1029
- this.moveCursor(0);
1030
- this.fire();
1031
- this.render();
1032
- }
1033
- exit() {
1034
- this.abort();
1035
- }
1036
- abort() {
1037
- this.done = this.aborted = true;
1038
- this.fire();
1039
- this.render();
1040
- this.out.write("\n");
1041
- this.close();
1042
- }
1043
- submit() {
1044
- if (!this.selection.disabled) {
1045
- this.done = true;
1046
- this.aborted = false;
1047
- this.fire();
1048
- this.render();
1049
- this.out.write("\n");
1050
- this.close();
1051
- } else
1052
- this.bell();
1053
- }
1054
- first() {
1055
- this.moveCursor(0);
1056
- this.render();
1057
- }
1058
- last() {
1059
- this.moveCursor(this.choices.length - 1);
1060
- this.render();
1061
- }
1062
- up() {
1063
- if (this.cursor === 0) {
1064
- this.moveCursor(this.choices.length - 1);
1065
- } else {
1066
- this.moveCursor(this.cursor - 1);
1067
- }
1068
- this.render();
1069
- }
1070
- down() {
1071
- if (this.cursor === this.choices.length - 1) {
1072
- this.moveCursor(0);
1073
- } else {
1074
- this.moveCursor(this.cursor + 1);
1075
- }
1076
- this.render();
1077
- }
1078
- next() {
1079
- this.moveCursor((this.cursor + 1) % this.choices.length);
1080
- this.render();
1081
- }
1082
- _(c, key) {
1083
- if (c === " ")
1084
- return this.submit();
1085
- }
1086
- get selection() {
1087
- return this.choices[this.cursor];
1088
- }
1089
- render() {
1090
- if (this.closed)
1091
- return;
1092
- if (this.firstRender)
1093
- this.out.write(cursor.hide);
1094
- else
1095
- this.out.write(clear(this.outputText, this.out.columns));
1096
- super.render();
1097
- let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
1098
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(" ");
1099
- if (!this.done) {
1100
- this.outputText += "\n";
1101
- for (let i = startIndex; i < endIndex; i++) {
1102
- let title, prefix, desc = "", v = this.choices[i];
1103
- if (i === startIndex && startIndex > 0) {
1104
- prefix = figures.arrowUp;
1105
- } else if (i === endIndex - 1 && endIndex < this.choices.length) {
1106
- prefix = figures.arrowDown;
1107
- } else {
1108
- prefix = " ";
1109
- }
1110
- if (v.disabled) {
1111
- title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
1112
- prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix;
1113
- } else {
1114
- title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
1115
- prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix;
1116
- if (v.description && this.cursor === i) {
1117
- desc = ` - ${v.description}`;
1118
- if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
1119
- desc = "\n" + wrap(v.description, {
1120
- margin: 3,
1121
- width: this.out.columns
1122
- });
1123
- }
1124
- }
1125
- }
1126
- this.outputText += `${prefix} ${title}${color.gray(desc)}
1127
- `;
1128
- }
1129
- }
1130
- this.out.write(this.outputText);
1131
- }
1132
- };
1133
- module2.exports = SelectPrompt;
1134
- }
1135
- });
1136
-
1137
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/toggle.js
1138
- var require_toggle = __commonJS({
1139
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/toggle.js"(exports, module2) {
1140
- "use strict";
1141
- var color = require_kleur();
1142
- var Prompt = require_prompt();
1143
- var _require = require_util();
1144
- var style = _require.style;
1145
- var clear = _require.clear;
1146
- var _require2 = require_src();
1147
- var cursor = _require2.cursor;
1148
- var erase = _require2.erase;
1149
- var TogglePrompt = class extends Prompt {
1150
- constructor(opts = {}) {
1151
- super(opts);
1152
- this.msg = opts.message;
1153
- this.value = !!opts.initial;
1154
- this.active = opts.active || "on";
1155
- this.inactive = opts.inactive || "off";
1156
- this.initialValue = this.value;
1157
- this.render();
1158
- }
1159
- reset() {
1160
- this.value = this.initialValue;
1161
- this.fire();
1162
- this.render();
1163
- }
1164
- exit() {
1165
- this.abort();
1166
- }
1167
- abort() {
1168
- this.done = this.aborted = true;
1169
- this.fire();
1170
- this.render();
1171
- this.out.write("\n");
1172
- this.close();
1173
- }
1174
- submit() {
1175
- this.done = true;
1176
- this.aborted = false;
1177
- this.fire();
1178
- this.render();
1179
- this.out.write("\n");
1180
- this.close();
1181
- }
1182
- deactivate() {
1183
- if (this.value === false)
1184
- return this.bell();
1185
- this.value = false;
1186
- this.render();
1187
- }
1188
- activate() {
1189
- if (this.value === true)
1190
- return this.bell();
1191
- this.value = true;
1192
- this.render();
1193
- }
1194
- delete() {
1195
- this.deactivate();
1196
- }
1197
- left() {
1198
- this.deactivate();
1199
- }
1200
- right() {
1201
- this.activate();
1202
- }
1203
- down() {
1204
- this.deactivate();
1205
- }
1206
- up() {
1207
- this.activate();
1208
- }
1209
- next() {
1210
- this.value = !this.value;
1211
- this.fire();
1212
- this.render();
1213
- }
1214
- _(c, key) {
1215
- if (c === " ") {
1216
- this.value = !this.value;
1217
- } else if (c === "1") {
1218
- this.value = true;
1219
- } else if (c === "0") {
1220
- this.value = false;
1221
- } else
1222
- return this.bell();
1223
- this.render();
1224
- }
1225
- render() {
1226
- if (this.closed)
1227
- return;
1228
- if (this.firstRender)
1229
- this.out.write(cursor.hide);
1230
- else
1231
- this.out.write(clear(this.outputText, this.out.columns));
1232
- super.render();
1233
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray("/"), this.value ? color.cyan().underline(this.active) : this.active].join(" ");
1234
- this.out.write(erase.line + cursor.to(0) + this.outputText);
1235
- }
1236
- };
1237
- module2.exports = TogglePrompt;
1238
- }
1239
- });
1240
-
1241
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/datepart.js
1242
- var require_datepart = __commonJS({
1243
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/datepart.js"(exports, module2) {
1244
- "use strict";
1245
- var DatePart = class {
1246
- constructor({
1247
- token,
1248
- date,
1249
- parts,
1250
- locales
1251
- }) {
1252
- this.token = token;
1253
- this.date = date || new Date();
1254
- this.parts = parts || [this];
1255
- this.locales = locales || {};
1256
- }
1257
- up() {
1258
- }
1259
- down() {
1260
- }
1261
- next() {
1262
- const currentIdx = this.parts.indexOf(this);
1263
- return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
1264
- }
1265
- setTo(val) {
1266
- }
1267
- prev() {
1268
- let parts = [].concat(this.parts).reverse();
1269
- const currentIdx = parts.indexOf(this);
1270
- return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
1271
- }
1272
- toString() {
1273
- return String(this.date);
1274
- }
1275
- };
1276
- module2.exports = DatePart;
1277
- }
1278
- });
1279
-
1280
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/meridiem.js
1281
- var require_meridiem = __commonJS({
1282
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/meridiem.js"(exports, module2) {
1283
- "use strict";
1284
- var DatePart = require_datepart();
1285
- var Meridiem = class extends DatePart {
1286
- constructor(opts = {}) {
1287
- super(opts);
1288
- }
1289
- up() {
1290
- this.date.setHours((this.date.getHours() + 12) % 24);
1291
- }
1292
- down() {
1293
- this.up();
1294
- }
1295
- toString() {
1296
- let meridiem = this.date.getHours() > 12 ? "pm" : "am";
1297
- return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
1298
- }
1299
- };
1300
- module2.exports = Meridiem;
1301
- }
1302
- });
1303
-
1304
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/day.js
1305
- var require_day = __commonJS({
1306
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/day.js"(exports, module2) {
1307
- "use strict";
1308
- var DatePart = require_datepart();
1309
- var pos = (n) => {
1310
- n = n % 10;
1311
- return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
1312
- };
1313
- var Day = class extends DatePart {
1314
- constructor(opts = {}) {
1315
- super(opts);
1316
- }
1317
- up() {
1318
- this.date.setDate(this.date.getDate() + 1);
1319
- }
1320
- down() {
1321
- this.date.setDate(this.date.getDate() - 1);
1322
- }
1323
- setTo(val) {
1324
- this.date.setDate(parseInt(val.substr(-2)));
1325
- }
1326
- toString() {
1327
- let date = this.date.getDate();
1328
- let day = this.date.getDay();
1329
- return this.token === "DD" ? String(date).padStart(2, "0") : this.token === "Do" ? date + pos(date) : this.token === "d" ? day + 1 : this.token === "ddd" ? this.locales.weekdaysShort[day] : this.token === "dddd" ? this.locales.weekdays[day] : date;
1330
- }
1331
- };
1332
- module2.exports = Day;
1333
- }
1334
- });
1335
-
1336
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/hours.js
1337
- var require_hours = __commonJS({
1338
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/hours.js"(exports, module2) {
1339
- "use strict";
1340
- var DatePart = require_datepart();
1341
- var Hours = class extends DatePart {
1342
- constructor(opts = {}) {
1343
- super(opts);
1344
- }
1345
- up() {
1346
- this.date.setHours(this.date.getHours() + 1);
1347
- }
1348
- down() {
1349
- this.date.setHours(this.date.getHours() - 1);
1350
- }
1351
- setTo(val) {
1352
- this.date.setHours(parseInt(val.substr(-2)));
1353
- }
1354
- toString() {
1355
- let hours = this.date.getHours();
1356
- if (/h/.test(this.token))
1357
- hours = hours % 12 || 12;
1358
- return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
1359
- }
1360
- };
1361
- module2.exports = Hours;
1362
- }
1363
- });
1364
-
1365
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/milliseconds.js
1366
- var require_milliseconds = __commonJS({
1367
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/milliseconds.js"(exports, module2) {
1368
- "use strict";
1369
- var DatePart = require_datepart();
1370
- var Milliseconds = class extends DatePart {
1371
- constructor(opts = {}) {
1372
- super(opts);
1373
- }
1374
- up() {
1375
- this.date.setMilliseconds(this.date.getMilliseconds() + 1);
1376
- }
1377
- down() {
1378
- this.date.setMilliseconds(this.date.getMilliseconds() - 1);
1379
- }
1380
- setTo(val) {
1381
- this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
1382
- }
1383
- toString() {
1384
- return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
1385
- }
1386
- };
1387
- module2.exports = Milliseconds;
1388
- }
1389
- });
1390
-
1391
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/minutes.js
1392
- var require_minutes = __commonJS({
1393
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/minutes.js"(exports, module2) {
1394
- "use strict";
1395
- var DatePart = require_datepart();
1396
- var Minutes = class extends DatePart {
1397
- constructor(opts = {}) {
1398
- super(opts);
1399
- }
1400
- up() {
1401
- this.date.setMinutes(this.date.getMinutes() + 1);
1402
- }
1403
- down() {
1404
- this.date.setMinutes(this.date.getMinutes() - 1);
1405
- }
1406
- setTo(val) {
1407
- this.date.setMinutes(parseInt(val.substr(-2)));
1408
- }
1409
- toString() {
1410
- let m = this.date.getMinutes();
1411
- return this.token.length > 1 ? String(m).padStart(2, "0") : m;
1412
- }
1413
- };
1414
- module2.exports = Minutes;
1415
- }
1416
- });
1417
-
1418
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/month.js
1419
- var require_month = __commonJS({
1420
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/month.js"(exports, module2) {
1421
- "use strict";
1422
- var DatePart = require_datepart();
1423
- var Month = class extends DatePart {
1424
- constructor(opts = {}) {
1425
- super(opts);
1426
- }
1427
- up() {
1428
- this.date.setMonth(this.date.getMonth() + 1);
1429
- }
1430
- down() {
1431
- this.date.setMonth(this.date.getMonth() - 1);
1432
- }
1433
- setTo(val) {
1434
- val = parseInt(val.substr(-2)) - 1;
1435
- this.date.setMonth(val < 0 ? 0 : val);
1436
- }
1437
- toString() {
1438
- let month = this.date.getMonth();
1439
- let tl = this.token.length;
1440
- return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
1441
- }
1442
- };
1443
- module2.exports = Month;
1444
- }
1445
- });
1446
-
1447
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/seconds.js
1448
- var require_seconds = __commonJS({
1449
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/seconds.js"(exports, module2) {
1450
- "use strict";
1451
- var DatePart = require_datepart();
1452
- var Seconds = class extends DatePart {
1453
- constructor(opts = {}) {
1454
- super(opts);
1455
- }
1456
- up() {
1457
- this.date.setSeconds(this.date.getSeconds() + 1);
1458
- }
1459
- down() {
1460
- this.date.setSeconds(this.date.getSeconds() - 1);
1461
- }
1462
- setTo(val) {
1463
- this.date.setSeconds(parseInt(val.substr(-2)));
1464
- }
1465
- toString() {
1466
- let s = this.date.getSeconds();
1467
- return this.token.length > 1 ? String(s).padStart(2, "0") : s;
1468
- }
1469
- };
1470
- module2.exports = Seconds;
1471
- }
1472
- });
1473
-
1474
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/year.js
1475
- var require_year = __commonJS({
1476
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/year.js"(exports, module2) {
1477
- "use strict";
1478
- var DatePart = require_datepart();
1479
- var Year = class extends DatePart {
1480
- constructor(opts = {}) {
1481
- super(opts);
1482
- }
1483
- up() {
1484
- this.date.setFullYear(this.date.getFullYear() + 1);
1485
- }
1486
- down() {
1487
- this.date.setFullYear(this.date.getFullYear() - 1);
1488
- }
1489
- setTo(val) {
1490
- this.date.setFullYear(val.substr(-4));
1491
- }
1492
- toString() {
1493
- let year = String(this.date.getFullYear()).padStart(4, "0");
1494
- return this.token.length === 2 ? year.substr(-2) : year;
1495
- }
1496
- };
1497
- module2.exports = Year;
1498
- }
1499
- });
1500
-
1501
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/index.js
1502
- var require_dateparts = __commonJS({
1503
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/dateparts/index.js"(exports, module2) {
1504
- "use strict";
1505
- module2.exports = {
1506
- DatePart: require_datepart(),
1507
- Meridiem: require_meridiem(),
1508
- Day: require_day(),
1509
- Hours: require_hours(),
1510
- Milliseconds: require_milliseconds(),
1511
- Minutes: require_minutes(),
1512
- Month: require_month(),
1513
- Seconds: require_seconds(),
1514
- Year: require_year()
1515
- };
1516
- }
1517
- });
1518
-
1519
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/date.js
1520
- var require_date = __commonJS({
1521
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/date.js"(exports, module2) {
1522
- "use strict";
1523
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1524
- try {
1525
- var info = gen[key](arg);
1526
- var value = info.value;
1527
- } catch (error) {
1528
- reject(error);
1529
- return;
1530
- }
1531
- if (info.done) {
1532
- resolve(value);
1533
- } else {
1534
- Promise.resolve(value).then(_next, _throw);
1535
- }
1536
- }
1537
- function _asyncToGenerator(fn) {
1538
- return function() {
1539
- var self2 = this, args = arguments;
1540
- return new Promise(function(resolve, reject) {
1541
- var gen = fn.apply(self2, args);
1542
- function _next(value) {
1543
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1544
- }
1545
- function _throw(err) {
1546
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1547
- }
1548
- _next(void 0);
1549
- });
1550
- };
1551
- }
1552
- var color = require_kleur();
1553
- var Prompt = require_prompt();
1554
- var _require = require_util();
1555
- var style = _require.style;
1556
- var clear = _require.clear;
1557
- var figures = _require.figures;
1558
- var _require2 = require_src();
1559
- var erase = _require2.erase;
1560
- var cursor = _require2.cursor;
1561
- var _require3 = require_dateparts();
1562
- var DatePart = _require3.DatePart;
1563
- var Meridiem = _require3.Meridiem;
1564
- var Day = _require3.Day;
1565
- var Hours = _require3.Hours;
1566
- var Milliseconds = _require3.Milliseconds;
1567
- var Minutes = _require3.Minutes;
1568
- var Month = _require3.Month;
1569
- var Seconds = _require3.Seconds;
1570
- var Year = _require3.Year;
1571
- var regex = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;
1572
- var regexGroups = {
1573
- 1: ({
1574
- token
1575
- }) => token.replace(/\\(.)/g, "$1"),
1576
- 2: (opts) => new Day(opts),
1577
- 3: (opts) => new Month(opts),
1578
- 4: (opts) => new Year(opts),
1579
- 5: (opts) => new Meridiem(opts),
1580
- 6: (opts) => new Hours(opts),
1581
- 7: (opts) => new Minutes(opts),
1582
- 8: (opts) => new Seconds(opts),
1583
- 9: (opts) => new Milliseconds(opts)
1584
- };
1585
- var dfltLocales = {
1586
- months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
1587
- monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
1588
- weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
1589
- weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
1590
- };
1591
- var DatePrompt = class extends Prompt {
1592
- constructor(opts = {}) {
1593
- super(opts);
1594
- this.msg = opts.message;
1595
- this.cursor = 0;
1596
- this.typed = "";
1597
- this.locales = Object.assign(dfltLocales, opts.locales);
1598
- this._date = opts.initial || new Date();
1599
- this.errorMsg = opts.error || "Please Enter A Valid Value";
1600
- this.validator = opts.validate || (() => true);
1601
- this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
1602
- this.clear = clear("", this.out.columns);
1603
- this.render();
1604
- }
1605
- get value() {
1606
- return this.date;
1607
- }
1608
- get date() {
1609
- return this._date;
1610
- }
1611
- set date(date) {
1612
- if (date)
1613
- this._date.setTime(date.getTime());
1614
- }
1615
- set mask(mask) {
1616
- let result;
1617
- this.parts = [];
1618
- while (result = regex.exec(mask)) {
1619
- let match = result.shift();
1620
- let idx = result.findIndex((gr) => gr != null);
1621
- this.parts.push(idx in regexGroups ? regexGroups[idx]({
1622
- token: result[idx] || match,
1623
- date: this.date,
1624
- parts: this.parts,
1625
- locales: this.locales
1626
- }) : result[idx] || match);
1627
- }
1628
- let parts = this.parts.reduce((arr, i) => {
1629
- if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
1630
- arr[arr.length - 1] += i;
1631
- else
1632
- arr.push(i);
1633
- return arr;
1634
- }, []);
1635
- this.parts.splice(0);
1636
- this.parts.push(...parts);
1637
- this.reset();
1638
- }
1639
- moveCursor(n) {
1640
- this.typed = "";
1641
- this.cursor = n;
1642
- this.fire();
1643
- }
1644
- reset() {
1645
- this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
1646
- this.fire();
1647
- this.render();
1648
- }
1649
- exit() {
1650
- this.abort();
1651
- }
1652
- abort() {
1653
- this.done = this.aborted = true;
1654
- this.error = false;
1655
- this.fire();
1656
- this.render();
1657
- this.out.write("\n");
1658
- this.close();
1659
- }
1660
- validate() {
1661
- var _this = this;
1662
- return _asyncToGenerator(function* () {
1663
- let valid = yield _this.validator(_this.value);
1664
- if (typeof valid === "string") {
1665
- _this.errorMsg = valid;
1666
- valid = false;
1667
- }
1668
- _this.error = !valid;
1669
- })();
1670
- }
1671
- submit() {
1672
- var _this2 = this;
1673
- return _asyncToGenerator(function* () {
1674
- yield _this2.validate();
1675
- if (_this2.error) {
1676
- _this2.color = "red";
1677
- _this2.fire();
1678
- _this2.render();
1679
- return;
1680
- }
1681
- _this2.done = true;
1682
- _this2.aborted = false;
1683
- _this2.fire();
1684
- _this2.render();
1685
- _this2.out.write("\n");
1686
- _this2.close();
1687
- })();
1688
- }
1689
- up() {
1690
- this.typed = "";
1691
- this.parts[this.cursor].up();
1692
- this.render();
1693
- }
1694
- down() {
1695
- this.typed = "";
1696
- this.parts[this.cursor].down();
1697
- this.render();
1698
- }
1699
- left() {
1700
- let prev = this.parts[this.cursor].prev();
1701
- if (prev == null)
1702
- return this.bell();
1703
- this.moveCursor(this.parts.indexOf(prev));
1704
- this.render();
1705
- }
1706
- right() {
1707
- let next = this.parts[this.cursor].next();
1708
- if (next == null)
1709
- return this.bell();
1710
- this.moveCursor(this.parts.indexOf(next));
1711
- this.render();
1712
- }
1713
- next() {
1714
- let next = this.parts[this.cursor].next();
1715
- this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
1716
- this.render();
1717
- }
1718
- _(c) {
1719
- if (/\d/.test(c)) {
1720
- this.typed += c;
1721
- this.parts[this.cursor].setTo(this.typed);
1722
- this.render();
1723
- }
1724
- }
1725
- render() {
1726
- if (this.closed)
1727
- return;
1728
- if (this.firstRender)
1729
- this.out.write(cursor.hide);
1730
- else
1731
- this.out.write(clear(this.outputText, this.out.columns));
1732
- super.render();
1733
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")].join(" ");
1734
- if (this.error) {
1735
- this.outputText += this.errorMsg.split("\n").reduce((a, l, i) => a + `
1736
- ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1737
- }
1738
- this.out.write(erase.line + cursor.to(0) + this.outputText);
1739
- }
1740
- };
1741
- module2.exports = DatePrompt;
1742
- }
1743
- });
1744
-
1745
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/number.js
1746
- var require_number = __commonJS({
1747
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/number.js"(exports, module2) {
1748
- "use strict";
1749
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1750
- try {
1751
- var info = gen[key](arg);
1752
- var value = info.value;
1753
- } catch (error) {
1754
- reject(error);
1755
- return;
1756
- }
1757
- if (info.done) {
1758
- resolve(value);
1759
- } else {
1760
- Promise.resolve(value).then(_next, _throw);
1761
- }
1762
- }
1763
- function _asyncToGenerator(fn) {
1764
- return function() {
1765
- var self2 = this, args = arguments;
1766
- return new Promise(function(resolve, reject) {
1767
- var gen = fn.apply(self2, args);
1768
- function _next(value) {
1769
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1770
- }
1771
- function _throw(err) {
1772
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1773
- }
1774
- _next(void 0);
1775
- });
1776
- };
1777
- }
1778
- var color = require_kleur();
1779
- var Prompt = require_prompt();
1780
- var _require = require_src();
1781
- var cursor = _require.cursor;
1782
- var erase = _require.erase;
1783
- var _require2 = require_util();
1784
- var style = _require2.style;
1785
- var figures = _require2.figures;
1786
- var clear = _require2.clear;
1787
- var lines = _require2.lines;
1788
- var isNumber = /[0-9]/;
1789
- var isDef = (any) => any !== void 0;
1790
- var round = (number, precision) => {
1791
- let factor = Math.pow(10, precision);
1792
- return Math.round(number * factor) / factor;
1793
- };
1794
- var NumberPrompt = class extends Prompt {
1795
- constructor(opts = {}) {
1796
- super(opts);
1797
- this.transform = style.render(opts.style);
1798
- this.msg = opts.message;
1799
- this.initial = isDef(opts.initial) ? opts.initial : "";
1800
- this.float = !!opts.float;
1801
- this.round = opts.round || 2;
1802
- this.inc = opts.increment || 1;
1803
- this.min = isDef(opts.min) ? opts.min : -Infinity;
1804
- this.max = isDef(opts.max) ? opts.max : Infinity;
1805
- this.errorMsg = opts.error || `Please Enter A Valid Value`;
1806
- this.validator = opts.validate || (() => true);
1807
- this.color = `cyan`;
1808
- this.value = ``;
1809
- this.typed = ``;
1810
- this.lastHit = 0;
1811
- this.render();
1812
- }
1813
- set value(v) {
1814
- if (!v && v !== 0) {
1815
- this.placeholder = true;
1816
- this.rendered = color.gray(this.transform.render(`${this.initial}`));
1817
- this._value = ``;
1818
- } else {
1819
- this.placeholder = false;
1820
- this.rendered = this.transform.render(`${round(v, this.round)}`);
1821
- this._value = round(v, this.round);
1822
- }
1823
- this.fire();
1824
- }
1825
- get value() {
1826
- return this._value;
1827
- }
1828
- parse(x) {
1829
- return this.float ? parseFloat(x) : parseInt(x);
1830
- }
1831
- valid(c) {
1832
- return c === `-` || c === `.` && this.float || isNumber.test(c);
1833
- }
1834
- reset() {
1835
- this.typed = ``;
1836
- this.value = ``;
1837
- this.fire();
1838
- this.render();
1839
- }
1840
- exit() {
1841
- this.abort();
1842
- }
1843
- abort() {
1844
- let x = this.value;
1845
- this.value = x !== `` ? x : this.initial;
1846
- this.done = this.aborted = true;
1847
- this.error = false;
1848
- this.fire();
1849
- this.render();
1850
- this.out.write(`
1851
- `);
1852
- this.close();
1853
- }
1854
- validate() {
1855
- var _this = this;
1856
- return _asyncToGenerator(function* () {
1857
- let valid = yield _this.validator(_this.value);
1858
- if (typeof valid === `string`) {
1859
- _this.errorMsg = valid;
1860
- valid = false;
1861
- }
1862
- _this.error = !valid;
1863
- })();
1864
- }
1865
- submit() {
1866
- var _this2 = this;
1867
- return _asyncToGenerator(function* () {
1868
- yield _this2.validate();
1869
- if (_this2.error) {
1870
- _this2.color = `red`;
1871
- _this2.fire();
1872
- _this2.render();
1873
- return;
1874
- }
1875
- let x = _this2.value;
1876
- _this2.value = x !== `` ? x : _this2.initial;
1877
- _this2.done = true;
1878
- _this2.aborted = false;
1879
- _this2.error = false;
1880
- _this2.fire();
1881
- _this2.render();
1882
- _this2.out.write(`
1883
- `);
1884
- _this2.close();
1885
- })();
1886
- }
1887
- up() {
1888
- this.typed = ``;
1889
- if (this.value === "") {
1890
- this.value = this.min - this.inc;
1891
- }
1892
- if (this.value >= this.max)
1893
- return this.bell();
1894
- this.value += this.inc;
1895
- this.color = `cyan`;
1896
- this.fire();
1897
- this.render();
1898
- }
1899
- down() {
1900
- this.typed = ``;
1901
- if (this.value === "") {
1902
- this.value = this.min + this.inc;
1903
- }
1904
- if (this.value <= this.min)
1905
- return this.bell();
1906
- this.value -= this.inc;
1907
- this.color = `cyan`;
1908
- this.fire();
1909
- this.render();
1910
- }
1911
- delete() {
1912
- let val = this.value.toString();
1913
- if (val.length === 0)
1914
- return this.bell();
1915
- this.value = this.parse(val = val.slice(0, -1)) || ``;
1916
- if (this.value !== "" && this.value < this.min) {
1917
- this.value = this.min;
1918
- }
1919
- this.color = `cyan`;
1920
- this.fire();
1921
- this.render();
1922
- }
1923
- next() {
1924
- this.value = this.initial;
1925
- this.fire();
1926
- this.render();
1927
- }
1928
- _(c, key) {
1929
- if (!this.valid(c))
1930
- return this.bell();
1931
- const now = Date.now();
1932
- if (now - this.lastHit > 1e3)
1933
- this.typed = ``;
1934
- this.typed += c;
1935
- this.lastHit = now;
1936
- this.color = `cyan`;
1937
- if (c === `.`)
1938
- return this.fire();
1939
- this.value = Math.min(this.parse(this.typed), this.max);
1940
- if (this.value > this.max)
1941
- this.value = this.max;
1942
- if (this.value < this.min)
1943
- this.value = this.min;
1944
- this.fire();
1945
- this.render();
1946
- }
1947
- render() {
1948
- if (this.closed)
1949
- return;
1950
- if (!this.firstRender) {
1951
- if (this.outputError)
1952
- this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
1953
- this.out.write(clear(this.outputText, this.out.columns));
1954
- }
1955
- super.render();
1956
- this.outputError = "";
1957
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered].join(` `);
1958
- if (this.error) {
1959
- this.outputError += this.errorMsg.split(`
1960
- `).reduce((a, l, i) => a + `
1961
- ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1962
- }
1963
- this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
1964
- }
1965
- };
1966
- module2.exports = NumberPrompt;
1967
- }
1968
- });
1969
-
1970
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/multiselect.js
1971
- var require_multiselect = __commonJS({
1972
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/multiselect.js"(exports, module2) {
1973
- "use strict";
1974
- var color = require_kleur();
1975
- var _require = require_src();
1976
- var cursor = _require.cursor;
1977
- var Prompt = require_prompt();
1978
- var _require2 = require_util();
1979
- var clear = _require2.clear;
1980
- var figures = _require2.figures;
1981
- var style = _require2.style;
1982
- var wrap = _require2.wrap;
1983
- var entriesToDisplay = _require2.entriesToDisplay;
1984
- var MultiselectPrompt = class extends Prompt {
1985
- constructor(opts = {}) {
1986
- super(opts);
1987
- this.msg = opts.message;
1988
- this.cursor = opts.cursor || 0;
1989
- this.scrollIndex = opts.cursor || 0;
1990
- this.hint = opts.hint || "";
1991
- this.warn = opts.warn || "- This option is disabled -";
1992
- this.minSelected = opts.min;
1993
- this.showMinError = false;
1994
- this.maxChoices = opts.max;
1995
- this.instructions = opts.instructions;
1996
- this.optionsPerPage = opts.optionsPerPage || 10;
1997
- this.value = opts.choices.map((ch, idx) => {
1998
- if (typeof ch === "string")
1999
- ch = {
2000
- title: ch,
2001
- value: idx
2002
- };
2003
- return {
2004
- title: ch && (ch.title || ch.value || ch),
2005
- description: ch && ch.description,
2006
- value: ch && (ch.value === void 0 ? idx : ch.value),
2007
- selected: ch && ch.selected,
2008
- disabled: ch && ch.disabled
2009
- };
2010
- });
2011
- this.clear = clear("", this.out.columns);
2012
- if (!opts.overrideRender) {
2013
- this.render();
2014
- }
2015
- }
2016
- reset() {
2017
- this.value.map((v) => !v.selected);
2018
- this.cursor = 0;
2019
- this.fire();
2020
- this.render();
2021
- }
2022
- selected() {
2023
- return this.value.filter((v) => v.selected);
2024
- }
2025
- exit() {
2026
- this.abort();
2027
- }
2028
- abort() {
2029
- this.done = this.aborted = true;
2030
- this.fire();
2031
- this.render();
2032
- this.out.write("\n");
2033
- this.close();
2034
- }
2035
- submit() {
2036
- const selected = this.value.filter((e) => e.selected);
2037
- if (this.minSelected && selected.length < this.minSelected) {
2038
- this.showMinError = true;
2039
- this.render();
2040
- } else {
2041
- this.done = true;
2042
- this.aborted = false;
2043
- this.fire();
2044
- this.render();
2045
- this.out.write("\n");
2046
- this.close();
2047
- }
2048
- }
2049
- first() {
2050
- this.cursor = 0;
2051
- this.render();
2052
- }
2053
- last() {
2054
- this.cursor = this.value.length - 1;
2055
- this.render();
2056
- }
2057
- next() {
2058
- this.cursor = (this.cursor + 1) % this.value.length;
2059
- this.render();
2060
- }
2061
- up() {
2062
- if (this.cursor === 0) {
2063
- this.cursor = this.value.length - 1;
2064
- } else {
2065
- this.cursor--;
2066
- }
2067
- this.render();
2068
- }
2069
- down() {
2070
- if (this.cursor === this.value.length - 1) {
2071
- this.cursor = 0;
2072
- } else {
2073
- this.cursor++;
2074
- }
2075
- this.render();
2076
- }
2077
- left() {
2078
- this.value[this.cursor].selected = false;
2079
- this.render();
2080
- }
2081
- right() {
2082
- if (this.value.filter((e) => e.selected).length >= this.maxChoices)
2083
- return this.bell();
2084
- this.value[this.cursor].selected = true;
2085
- this.render();
2086
- }
2087
- handleSpaceToggle() {
2088
- const v = this.value[this.cursor];
2089
- if (v.selected) {
2090
- v.selected = false;
2091
- this.render();
2092
- } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
2093
- return this.bell();
2094
- } else {
2095
- v.selected = true;
2096
- this.render();
2097
- }
2098
- }
2099
- toggleAll() {
2100
- if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) {
2101
- return this.bell();
2102
- }
2103
- const newSelected = !this.value[this.cursor].selected;
2104
- this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected);
2105
- this.render();
2106
- }
2107
- _(c, key) {
2108
- if (c === " ") {
2109
- this.handleSpaceToggle();
2110
- } else if (c === "a") {
2111
- this.toggleAll();
2112
- } else {
2113
- return this.bell();
2114
- }
2115
- }
2116
- renderInstructions() {
2117
- if (this.instructions === void 0 || this.instructions) {
2118
- if (typeof this.instructions === "string") {
2119
- return this.instructions;
2120
- }
2121
- return `
2122
- Instructions:
2123
- ${figures.arrowUp}/${figures.arrowDown}: Highlight option
2124
- ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
2125
- ` + (this.maxChoices === void 0 ? ` a: Toggle all
2126
- ` : "") + ` enter/return: Complete answer`;
2127
- }
2128
- return "";
2129
- }
2130
- renderOption(cursor2, v, i, arrowIndicator) {
2131
- const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ";
2132
- let title, desc;
2133
- if (v.disabled) {
2134
- title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
2135
- } else {
2136
- title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
2137
- if (cursor2 === i && v.description) {
2138
- desc = ` - ${v.description}`;
2139
- if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
2140
- desc = "\n" + wrap(v.description, {
2141
- margin: prefix.length,
2142
- width: this.out.columns
2143
- });
2144
- }
2145
- }
2146
- }
2147
- return prefix + title + color.gray(desc || "");
2148
- }
2149
- paginateOptions(options2) {
2150
- if (options2.length === 0) {
2151
- return color.red("No matches for this query.");
2152
- }
2153
- let _entriesToDisplay = entriesToDisplay(this.cursor, options2.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
2154
- let prefix, styledOptions = [];
2155
- for (let i = startIndex; i < endIndex; i++) {
2156
- if (i === startIndex && startIndex > 0) {
2157
- prefix = figures.arrowUp;
2158
- } else if (i === endIndex - 1 && endIndex < options2.length) {
2159
- prefix = figures.arrowDown;
2160
- } else {
2161
- prefix = " ";
2162
- }
2163
- styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
2164
- }
2165
- return "\n" + styledOptions.join("\n");
2166
- }
2167
- renderOptions(options2) {
2168
- if (!this.done) {
2169
- return this.paginateOptions(options2);
2170
- }
2171
- return "";
2172
- }
2173
- renderDoneOrInstructions() {
2174
- if (this.done) {
2175
- return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
2176
- }
2177
- const output = [color.gray(this.hint), this.renderInstructions()];
2178
- if (this.value[this.cursor].disabled) {
2179
- output.push(color.yellow(this.warn));
2180
- }
2181
- return output.join(" ");
2182
- }
2183
- render() {
2184
- if (this.closed)
2185
- return;
2186
- if (this.firstRender)
2187
- this.out.write(cursor.hide);
2188
- super.render();
2189
- let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
2190
- if (this.showMinError) {
2191
- prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
2192
- this.showMinError = false;
2193
- }
2194
- prompt += this.renderOptions(this.value);
2195
- this.out.write(this.clear + prompt);
2196
- this.clear = clear(prompt, this.out.columns);
2197
- }
2198
- };
2199
- module2.exports = MultiselectPrompt;
2200
- }
2201
- });
2202
-
2203
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/autocomplete.js
2204
- var require_autocomplete = __commonJS({
2205
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/autocomplete.js"(exports, module2) {
2206
- "use strict";
2207
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2208
- try {
2209
- var info = gen[key](arg);
2210
- var value = info.value;
2211
- } catch (error) {
2212
- reject(error);
2213
- return;
2214
- }
2215
- if (info.done) {
2216
- resolve(value);
2217
- } else {
2218
- Promise.resolve(value).then(_next, _throw);
2219
- }
2220
- }
2221
- function _asyncToGenerator(fn) {
2222
- return function() {
2223
- var self2 = this, args = arguments;
2224
- return new Promise(function(resolve, reject) {
2225
- var gen = fn.apply(self2, args);
2226
- function _next(value) {
2227
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2228
- }
2229
- function _throw(err) {
2230
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2231
- }
2232
- _next(void 0);
2233
- });
2234
- };
2235
- }
2236
- var color = require_kleur();
2237
- var Prompt = require_prompt();
2238
- var _require = require_src();
2239
- var erase = _require.erase;
2240
- var cursor = _require.cursor;
2241
- var _require2 = require_util();
2242
- var style = _require2.style;
2243
- var clear = _require2.clear;
2244
- var figures = _require2.figures;
2245
- var wrap = _require2.wrap;
2246
- var entriesToDisplay = _require2.entriesToDisplay;
2247
- var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
2248
- var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
2249
- var getIndex = (arr, valOrTitle) => {
2250
- const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
2251
- return index > -1 ? index : void 0;
2252
- };
2253
- var AutocompletePrompt = class extends Prompt {
2254
- constructor(opts = {}) {
2255
- super(opts);
2256
- this.msg = opts.message;
2257
- this.suggest = opts.suggest;
2258
- this.choices = opts.choices;
2259
- this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
2260
- this.select = this.initial || opts.cursor || 0;
2261
- this.i18n = {
2262
- noMatches: opts.noMatches || "no matches found"
2263
- };
2264
- this.fallback = opts.fallback || this.initial;
2265
- this.clearFirst = opts.clearFirst || false;
2266
- this.suggestions = [];
2267
- this.input = "";
2268
- this.limit = opts.limit || 10;
2269
- this.cursor = 0;
2270
- this.transform = style.render(opts.style);
2271
- this.scale = this.transform.scale;
2272
- this.render = this.render.bind(this);
2273
- this.complete = this.complete.bind(this);
2274
- this.clear = clear("", this.out.columns);
2275
- this.complete(this.render);
2276
- this.render();
2277
- }
2278
- set fallback(fb) {
2279
- this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
2280
- }
2281
- get fallback() {
2282
- let choice;
2283
- if (typeof this._fb === "number")
2284
- choice = this.choices[this._fb];
2285
- else if (typeof this._fb === "string")
2286
- choice = {
2287
- title: this._fb
2288
- };
2289
- return choice || this._fb || {
2290
- title: this.i18n.noMatches
2291
- };
2292
- }
2293
- moveSelect(i) {
2294
- this.select = i;
2295
- if (this.suggestions.length > 0)
2296
- this.value = getVal(this.suggestions, i);
2297
- else
2298
- this.value = this.fallback.value;
2299
- this.fire();
2300
- }
2301
- complete(cb) {
2302
- var _this = this;
2303
- return _asyncToGenerator(function* () {
2304
- const p = _this.completing = _this.suggest(_this.input, _this.choices);
2305
- const suggestions = yield p;
2306
- if (_this.completing !== p)
2307
- return;
2308
- _this.suggestions = suggestions.map((s, i, arr) => ({
2309
- title: getTitle(arr, i),
2310
- value: getVal(arr, i),
2311
- description: s.description
2312
- }));
2313
- _this.completing = false;
2314
- const l = Math.max(suggestions.length - 1, 0);
2315
- _this.moveSelect(Math.min(l, _this.select));
2316
- cb && cb();
2317
- })();
2318
- }
2319
- reset() {
2320
- this.input = "";
2321
- this.complete(() => {
2322
- this.moveSelect(this.initial !== void 0 ? this.initial : 0);
2323
- this.render();
2324
- });
2325
- this.render();
2326
- }
2327
- exit() {
2328
- if (this.clearFirst && this.input.length > 0) {
2329
- this.reset();
2330
- } else {
2331
- this.done = this.exited = true;
2332
- this.aborted = false;
2333
- this.fire();
2334
- this.render();
2335
- this.out.write("\n");
2336
- this.close();
2337
- }
2338
- }
2339
- abort() {
2340
- this.done = this.aborted = true;
2341
- this.exited = false;
2342
- this.fire();
2343
- this.render();
2344
- this.out.write("\n");
2345
- this.close();
2346
- }
2347
- submit() {
2348
- this.done = true;
2349
- this.aborted = this.exited = false;
2350
- this.fire();
2351
- this.render();
2352
- this.out.write("\n");
2353
- this.close();
2354
- }
2355
- _(c, key) {
2356
- let s1 = this.input.slice(0, this.cursor);
2357
- let s2 = this.input.slice(this.cursor);
2358
- this.input = `${s1}${c}${s2}`;
2359
- this.cursor = s1.length + 1;
2360
- this.complete(this.render);
2361
- this.render();
2362
- }
2363
- delete() {
2364
- if (this.cursor === 0)
2365
- return this.bell();
2366
- let s1 = this.input.slice(0, this.cursor - 1);
2367
- let s2 = this.input.slice(this.cursor);
2368
- this.input = `${s1}${s2}`;
2369
- this.complete(this.render);
2370
- this.cursor = this.cursor - 1;
2371
- this.render();
2372
- }
2373
- deleteForward() {
2374
- if (this.cursor * this.scale >= this.rendered.length)
2375
- return this.bell();
2376
- let s1 = this.input.slice(0, this.cursor);
2377
- let s2 = this.input.slice(this.cursor + 1);
2378
- this.input = `${s1}${s2}`;
2379
- this.complete(this.render);
2380
- this.render();
2381
- }
2382
- first() {
2383
- this.moveSelect(0);
2384
- this.render();
2385
- }
2386
- last() {
2387
- this.moveSelect(this.suggestions.length - 1);
2388
- this.render();
2389
- }
2390
- up() {
2391
- if (this.select === 0) {
2392
- this.moveSelect(this.suggestions.length - 1);
2393
- } else {
2394
- this.moveSelect(this.select - 1);
2395
- }
2396
- this.render();
2397
- }
2398
- down() {
2399
- if (this.select === this.suggestions.length - 1) {
2400
- this.moveSelect(0);
2401
- } else {
2402
- this.moveSelect(this.select + 1);
2403
- }
2404
- this.render();
2405
- }
2406
- next() {
2407
- if (this.select === this.suggestions.length - 1) {
2408
- this.moveSelect(0);
2409
- } else
2410
- this.moveSelect(this.select + 1);
2411
- this.render();
2412
- }
2413
- nextPage() {
2414
- this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1));
2415
- this.render();
2416
- }
2417
- prevPage() {
2418
- this.moveSelect(Math.max(this.select - this.limit, 0));
2419
- this.render();
2420
- }
2421
- left() {
2422
- if (this.cursor <= 0)
2423
- return this.bell();
2424
- this.cursor = this.cursor - 1;
2425
- this.render();
2426
- }
2427
- right() {
2428
- if (this.cursor * this.scale >= this.rendered.length)
2429
- return this.bell();
2430
- this.cursor = this.cursor + 1;
2431
- this.render();
2432
- }
2433
- renderOption(v, hovered, isStart, isEnd) {
2434
- let desc;
2435
- let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ";
2436
- let title = hovered ? color.cyan().underline(v.title) : v.title;
2437
- prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix;
2438
- if (v.description) {
2439
- desc = ` - ${v.description}`;
2440
- if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
2441
- desc = "\n" + wrap(v.description, {
2442
- margin: 3,
2443
- width: this.out.columns
2444
- });
2445
- }
2446
- }
2447
- return prefix + " " + title + color.gray(desc || "");
2448
- }
2449
- render() {
2450
- if (this.closed)
2451
- return;
2452
- if (this.firstRender)
2453
- this.out.write(cursor.hide);
2454
- else
2455
- this.out.write(clear(this.outputText, this.out.columns));
2456
- super.render();
2457
- let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
2458
- this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(" ");
2459
- if (!this.done) {
2460
- const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join("\n");
2461
- this.outputText += `
2462
- ` + (suggestions || color.gray(this.fallback.title));
2463
- }
2464
- this.out.write(erase.line + cursor.to(0) + this.outputText);
2465
- }
2466
- };
2467
- module2.exports = AutocompletePrompt;
2468
- }
2469
- });
2470
-
2471
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/autocompleteMultiselect.js
2472
- var require_autocompleteMultiselect = __commonJS({
2473
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/autocompleteMultiselect.js"(exports, module2) {
2474
- "use strict";
2475
- var color = require_kleur();
2476
- var _require = require_src();
2477
- var cursor = _require.cursor;
2478
- var MultiselectPrompt = require_multiselect();
2479
- var _require2 = require_util();
2480
- var clear = _require2.clear;
2481
- var style = _require2.style;
2482
- var figures = _require2.figures;
2483
- var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
2484
- constructor(opts = {}) {
2485
- opts.overrideRender = true;
2486
- super(opts);
2487
- this.inputValue = "";
2488
- this.clear = clear("", this.out.columns);
2489
- this.filteredOptions = this.value;
2490
- this.render();
2491
- }
2492
- last() {
2493
- this.cursor = this.filteredOptions.length - 1;
2494
- this.render();
2495
- }
2496
- next() {
2497
- this.cursor = (this.cursor + 1) % this.filteredOptions.length;
2498
- this.render();
2499
- }
2500
- up() {
2501
- if (this.cursor === 0) {
2502
- this.cursor = this.filteredOptions.length - 1;
2503
- } else {
2504
- this.cursor--;
2505
- }
2506
- this.render();
2507
- }
2508
- down() {
2509
- if (this.cursor === this.filteredOptions.length - 1) {
2510
- this.cursor = 0;
2511
- } else {
2512
- this.cursor++;
2513
- }
2514
- this.render();
2515
- }
2516
- left() {
2517
- this.filteredOptions[this.cursor].selected = false;
2518
- this.render();
2519
- }
2520
- right() {
2521
- if (this.value.filter((e) => e.selected).length >= this.maxChoices)
2522
- return this.bell();
2523
- this.filteredOptions[this.cursor].selected = true;
2524
- this.render();
2525
- }
2526
- delete() {
2527
- if (this.inputValue.length) {
2528
- this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
2529
- this.updateFilteredOptions();
2530
- }
2531
- }
2532
- updateFilteredOptions() {
2533
- const currentHighlight = this.filteredOptions[this.cursor];
2534
- this.filteredOptions = this.value.filter((v) => {
2535
- if (this.inputValue) {
2536
- if (typeof v.title === "string") {
2537
- if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
2538
- return true;
2539
- }
2540
- }
2541
- if (typeof v.value === "string") {
2542
- if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
2543
- return true;
2544
- }
2545
- }
2546
- return false;
2547
- }
2548
- return true;
2549
- });
2550
- const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
2551
- this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
2552
- this.render();
2553
- }
2554
- handleSpaceToggle() {
2555
- const v = this.filteredOptions[this.cursor];
2556
- if (v.selected) {
2557
- v.selected = false;
2558
- this.render();
2559
- } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
2560
- return this.bell();
2561
- } else {
2562
- v.selected = true;
2563
- this.render();
2564
- }
2565
- }
2566
- handleInputChange(c) {
2567
- this.inputValue = this.inputValue + c;
2568
- this.updateFilteredOptions();
2569
- }
2570
- _(c, key) {
2571
- if (c === " ") {
2572
- this.handleSpaceToggle();
2573
- } else {
2574
- this.handleInputChange(c);
2575
- }
2576
- }
2577
- renderInstructions() {
2578
- if (this.instructions === void 0 || this.instructions) {
2579
- if (typeof this.instructions === "string") {
2580
- return this.instructions;
2581
- }
2582
- return `
2583
- Instructions:
2584
- ${figures.arrowUp}/${figures.arrowDown}: Highlight option
2585
- ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
2586
- [a,b,c]/delete: Filter choices
2587
- enter/return: Complete answer
2588
- `;
2589
- }
2590
- return "";
2591
- }
2592
- renderCurrentInput() {
2593
- return `
2594
- Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
2595
- `;
2596
- }
2597
- renderOption(cursor2, v, i) {
2598
- let title;
2599
- if (v.disabled)
2600
- title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
2601
- else
2602
- title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
2603
- return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
2604
- }
2605
- renderDoneOrInstructions() {
2606
- if (this.done) {
2607
- return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
2608
- }
2609
- const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
2610
- if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
2611
- output.push(color.yellow(this.warn));
2612
- }
2613
- return output.join(" ");
2614
- }
2615
- render() {
2616
- if (this.closed)
2617
- return;
2618
- if (this.firstRender)
2619
- this.out.write(cursor.hide);
2620
- super.render();
2621
- let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
2622
- if (this.showMinError) {
2623
- prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
2624
- this.showMinError = false;
2625
- }
2626
- prompt += this.renderOptions(this.filteredOptions);
2627
- this.out.write(this.clear + prompt);
2628
- this.clear = clear(prompt, this.out.columns);
2629
- }
2630
- };
2631
- module2.exports = AutocompleteMultiselectPrompt;
2632
- }
2633
- });
2634
-
2635
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/confirm.js
2636
- var require_confirm = __commonJS({
2637
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/confirm.js"(exports, module2) {
2638
- "use strict";
2639
- var color = require_kleur();
2640
- var Prompt = require_prompt();
2641
- var _require = require_util();
2642
- var style = _require.style;
2643
- var clear = _require.clear;
2644
- var _require2 = require_src();
2645
- var erase = _require2.erase;
2646
- var cursor = _require2.cursor;
2647
- var ConfirmPrompt = class extends Prompt {
2648
- constructor(opts = {}) {
2649
- super(opts);
2650
- this.msg = opts.message;
2651
- this.value = opts.initial;
2652
- this.initialValue = !!opts.initial;
2653
- this.yesMsg = opts.yes || "yes";
2654
- this.yesOption = opts.yesOption || "(Y/n)";
2655
- this.noMsg = opts.no || "no";
2656
- this.noOption = opts.noOption || "(y/N)";
2657
- this.render();
2658
- }
2659
- reset() {
2660
- this.value = this.initialValue;
2661
- this.fire();
2662
- this.render();
2663
- }
2664
- exit() {
2665
- this.abort();
2666
- }
2667
- abort() {
2668
- this.done = this.aborted = true;
2669
- this.fire();
2670
- this.render();
2671
- this.out.write("\n");
2672
- this.close();
2673
- }
2674
- submit() {
2675
- this.value = this.value || false;
2676
- this.done = true;
2677
- this.aborted = false;
2678
- this.fire();
2679
- this.render();
2680
- this.out.write("\n");
2681
- this.close();
2682
- }
2683
- _(c, key) {
2684
- if (c.toLowerCase() === "y") {
2685
- this.value = true;
2686
- return this.submit();
2687
- }
2688
- if (c.toLowerCase() === "n") {
2689
- this.value = false;
2690
- return this.submit();
2691
- }
2692
- return this.bell();
2693
- }
2694
- render() {
2695
- if (this.closed)
2696
- return;
2697
- if (this.firstRender)
2698
- this.out.write(cursor.hide);
2699
- else
2700
- this.out.write(clear(this.outputText, this.out.columns));
2701
- super.render();
2702
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(" ");
2703
- this.out.write(erase.line + cursor.to(0) + this.outputText);
2704
- }
2705
- };
2706
- module2.exports = ConfirmPrompt;
2707
- }
2708
- });
2709
-
2710
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/index.js
2711
- var require_elements = __commonJS({
2712
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/index.js"(exports, module2) {
2713
- "use strict";
2714
- module2.exports = {
2715
- TextPrompt: require_text(),
2716
- SelectPrompt: require_select(),
2717
- TogglePrompt: require_toggle(),
2718
- DatePrompt: require_date(),
2719
- NumberPrompt: require_number(),
2720
- MultiselectPrompt: require_multiselect(),
2721
- AutocompletePrompt: require_autocomplete(),
2722
- AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
2723
- ConfirmPrompt: require_confirm()
2724
- };
2725
- }
2726
- });
2727
-
2728
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/prompts.js
2729
- var require_prompts = __commonJS({
2730
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/prompts.js"(exports) {
2731
- "use strict";
2732
- var $ = exports;
2733
- var el = require_elements();
2734
- var noop = (v) => v;
2735
- function toPrompt(type, args, opts = {}) {
2736
- return new Promise((res, rej) => {
2737
- const p = new el[type](args);
2738
- const onAbort = opts.onAbort || noop;
2739
- const onSubmit = opts.onSubmit || noop;
2740
- const onExit = opts.onExit || noop;
2741
- p.on("state", args.onState || noop);
2742
- p.on("submit", (x) => res(onSubmit(x)));
2743
- p.on("exit", (x) => res(onExit(x)));
2744
- p.on("abort", (x) => rej(onAbort(x)));
2745
- });
2746
- }
2747
- $.text = (args) => toPrompt("TextPrompt", args);
2748
- $.password = (args) => {
2749
- args.style = "password";
2750
- return $.text(args);
2751
- };
2752
- $.invisible = (args) => {
2753
- args.style = "invisible";
2754
- return $.text(args);
2755
- };
2756
- $.number = (args) => toPrompt("NumberPrompt", args);
2757
- $.date = (args) => toPrompt("DatePrompt", args);
2758
- $.confirm = (args) => toPrompt("ConfirmPrompt", args);
2759
- $.list = (args) => {
2760
- const sep = args.separator || ",";
2761
- return toPrompt("TextPrompt", args, {
2762
- onSubmit: (str) => str.split(sep).map((s) => s.trim())
2763
- });
2764
- };
2765
- $.toggle = (args) => toPrompt("TogglePrompt", args);
2766
- $.select = (args) => toPrompt("SelectPrompt", args);
2767
- $.multiselect = (args) => {
2768
- args.choices = [].concat(args.choices || []);
2769
- const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2770
- return toPrompt("MultiselectPrompt", args, {
2771
- onAbort: toSelected,
2772
- onSubmit: toSelected
2773
- });
2774
- };
2775
- $.autocompleteMultiselect = (args) => {
2776
- args.choices = [].concat(args.choices || []);
2777
- const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2778
- return toPrompt("AutocompleteMultiselectPrompt", args, {
2779
- onAbort: toSelected,
2780
- onSubmit: toSelected
2781
- });
2782
- };
2783
- var byTitle = (input, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase()));
2784
- $.autocomplete = (args) => {
2785
- args.suggest = args.suggest || byTitle;
2786
- args.choices = [].concat(args.choices || []);
2787
- return toPrompt("AutocompletePrompt", args);
2788
- };
2789
- }
2790
- });
2791
-
2792
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/index.js
2793
- var require_dist = __commonJS({
2794
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/index.js"(exports, module2) {
2795
- "use strict";
2796
- function ownKeys(object, enumerableOnly) {
2797
- var keys = Object.keys(object);
2798
- if (Object.getOwnPropertySymbols) {
2799
- var symbols = Object.getOwnPropertySymbols(object);
2800
- if (enumerableOnly) {
2801
- symbols = symbols.filter(function(sym) {
2802
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2803
- });
2804
- }
2805
- keys.push.apply(keys, symbols);
2806
- }
2807
- return keys;
2808
- }
2809
- function _objectSpread(target) {
2810
- for (var i = 1; i < arguments.length; i++) {
2811
- var source = arguments[i] != null ? arguments[i] : {};
2812
- if (i % 2) {
2813
- ownKeys(Object(source), true).forEach(function(key) {
2814
- _defineProperty(target, key, source[key]);
2815
- });
2816
- } else if (Object.getOwnPropertyDescriptors) {
2817
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2818
- } else {
2819
- ownKeys(Object(source)).forEach(function(key) {
2820
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2821
- });
2822
- }
2823
- }
2824
- return target;
2825
- }
2826
- function _defineProperty(obj, key, value) {
2827
- if (key in obj) {
2828
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
2829
- } else {
2830
- obj[key] = value;
2831
- }
2832
- return obj;
2833
- }
2834
- function _createForOfIteratorHelper(o, allowArrayLike) {
2835
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
2836
- if (!it) {
2837
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
2838
- if (it)
2839
- o = it;
2840
- var i = 0;
2841
- var F = function F2() {
2842
- };
2843
- return { s: F, n: function n() {
2844
- if (i >= o.length)
2845
- return { done: true };
2846
- return { done: false, value: o[i++] };
2847
- }, e: function e(_e) {
2848
- throw _e;
2849
- }, f: F };
2850
- }
2851
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2852
- }
2853
- var normalCompletion = true, didErr = false, err;
2854
- return { s: function s() {
2855
- it = it.call(o);
2856
- }, n: function n() {
2857
- var step = it.next();
2858
- normalCompletion = step.done;
2859
- return step;
2860
- }, e: function e(_e2) {
2861
- didErr = true;
2862
- err = _e2;
2863
- }, f: function f() {
2864
- try {
2865
- if (!normalCompletion && it.return != null)
2866
- it.return();
2867
- } finally {
2868
- if (didErr)
2869
- throw err;
2870
- }
2871
- } };
2872
- }
2873
- function _unsupportedIterableToArray(o, minLen) {
2874
- if (!o)
2875
- return;
2876
- if (typeof o === "string")
2877
- return _arrayLikeToArray(o, minLen);
2878
- var n = Object.prototype.toString.call(o).slice(8, -1);
2879
- if (n === "Object" && o.constructor)
2880
- n = o.constructor.name;
2881
- if (n === "Map" || n === "Set")
2882
- return Array.from(o);
2883
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
2884
- return _arrayLikeToArray(o, minLen);
2885
- }
2886
- function _arrayLikeToArray(arr, len) {
2887
- if (len == null || len > arr.length)
2888
- len = arr.length;
2889
- for (var i = 0, arr2 = new Array(len); i < len; i++)
2890
- arr2[i] = arr[i];
2891
- return arr2;
2892
- }
2893
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2894
- try {
2895
- var info = gen[key](arg);
2896
- var value = info.value;
2897
- } catch (error) {
2898
- reject(error);
2899
- return;
2900
- }
2901
- if (info.done) {
2902
- resolve(value);
2903
- } else {
2904
- Promise.resolve(value).then(_next, _throw);
2905
- }
2906
- }
2907
- function _asyncToGenerator(fn) {
2908
- return function() {
2909
- var self2 = this, args = arguments;
2910
- return new Promise(function(resolve, reject) {
2911
- var gen = fn.apply(self2, args);
2912
- function _next(value) {
2913
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2914
- }
2915
- function _throw(err) {
2916
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2917
- }
2918
- _next(void 0);
2919
- });
2920
- };
2921
- }
2922
- var prompts2 = require_prompts();
2923
- var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
2924
- var noop = () => {
2925
- };
2926
- function prompt() {
2927
- return _prompt.apply(this, arguments);
2928
- }
2929
- function _prompt() {
2930
- _prompt = _asyncToGenerator(function* (questions = [], {
2931
- onSubmit = noop,
2932
- onCancel = noop
2933
- } = {}) {
2934
- const answers = {};
2935
- const override2 = prompt._override || {};
2936
- questions = [].concat(questions);
2937
- let answer, question, quit, name, type, lastPrompt;
2938
- const getFormattedAnswer = /* @__PURE__ */ function() {
2939
- var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
2940
- if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
2941
- return;
2942
- }
2943
- return question2.format ? yield question2.format(answer2, answers) : answer2;
2944
- });
2945
- return function getFormattedAnswer2(_x, _x2) {
2946
- return _ref.apply(this, arguments);
2947
- };
2948
- }();
2949
- var _iterator = _createForOfIteratorHelper(questions), _step;
2950
- try {
2951
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
2952
- question = _step.value;
2953
- var _question = question;
2954
- name = _question.name;
2955
- type = _question.type;
2956
- if (typeof type === "function") {
2957
- type = yield type(answer, _objectSpread({}, answers), question);
2958
- question["type"] = type;
2959
- }
2960
- if (!type)
2961
- continue;
2962
- for (let key in question) {
2963
- if (passOn.includes(key))
2964
- continue;
2965
- let value = question[key];
2966
- question[key] = typeof value === "function" ? yield value(answer, _objectSpread({}, answers), lastPrompt) : value;
2967
- }
2968
- lastPrompt = question;
2969
- if (typeof question.message !== "string") {
2970
- throw new Error("prompt message is required");
2971
- }
2972
- var _question2 = question;
2973
- name = _question2.name;
2974
- type = _question2.type;
2975
- if (prompts2[type] === void 0) {
2976
- throw new Error(`prompt type (${type}) is not defined`);
2977
- }
2978
- if (override2[question.name] !== void 0) {
2979
- answer = yield getFormattedAnswer(question, override2[question.name]);
2980
- if (answer !== void 0) {
2981
- answers[name] = answer;
2982
- continue;
2983
- }
2984
- }
2985
- try {
2986
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts2[type](question);
2987
- answers[name] = answer = yield getFormattedAnswer(question, answer, true);
2988
- quit = yield onSubmit(question, answer, answers);
2989
- } catch (err) {
2990
- quit = !(yield onCancel(question, answers));
2991
- }
2992
- if (quit)
2993
- return answers;
2994
- }
2995
- } catch (err) {
2996
- _iterator.e(err);
2997
- } finally {
2998
- _iterator.f();
2999
- }
3000
- return answers;
3001
- });
3002
- return _prompt.apply(this, arguments);
3003
- }
3004
- function getInjectedAnswer(injected, deafultValue) {
3005
- const answer = injected.shift();
3006
- if (answer instanceof Error) {
3007
- throw answer;
3008
- }
3009
- return answer === void 0 ? deafultValue : answer;
3010
- }
3011
- function inject(answers) {
3012
- prompt._injected = (prompt._injected || []).concat(answers);
291
+ ctx.gray = $.gray.bind(ctx);
292
+ ctx.grey = $.grey.bind(ctx);
293
+ ctx.bgBlack = $.bgBlack.bind(ctx);
294
+ ctx.bgRed = $.bgRed.bind(ctx);
295
+ ctx.bgGreen = $.bgGreen.bind(ctx);
296
+ ctx.bgYellow = $.bgYellow.bind(ctx);
297
+ ctx.bgBlue = $.bgBlue.bind(ctx);
298
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
299
+ ctx.bgCyan = $.bgCyan.bind(ctx);
300
+ ctx.bgWhite = $.bgWhite.bind(ctx);
301
+ return ctx;
3013
302
  }
3014
- function override(answers) {
3015
- prompt._override = Object.assign({}, answers);
303
+ function init2(open, close) {
304
+ let blk = {
305
+ open: `\x1B[${open}m`,
306
+ close: `\x1B[${close}m`,
307
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
308
+ };
309
+ return function(txt) {
310
+ if (this !== void 0 && this.has !== void 0) {
311
+ this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
312
+ return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
313
+ }
314
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
315
+ };
3016
316
  }
3017
- module2.exports = Object.assign(prompt, {
3018
- prompt,
3019
- prompts: prompts2,
3020
- inject,
3021
- override
3022
- });
317
+ module2.exports = $;
3023
318
  }
3024
319
  });
3025
320
 
3026
321
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/action.js
3027
- var require_action2 = __commonJS({
322
+ var require_action = __commonJS({
3028
323
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/action.js"(exports, module2) {
3029
324
  "use strict";
3030
325
  module2.exports = (key, isSelect) => {
@@ -3084,7 +379,7 @@ var require_action2 = __commonJS({
3084
379
  });
3085
380
 
3086
381
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/strip.js
3087
- var require_strip2 = __commonJS({
382
+ var require_strip = __commonJS({
3088
383
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/strip.js"(exports, module2) {
3089
384
  "use strict";
3090
385
  module2.exports = (str) => {
@@ -3098,11 +393,72 @@ var require_strip2 = __commonJS({
3098
393
  }
3099
394
  });
3100
395
 
396
+ // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
397
+ var require_src = __commonJS({
398
+ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module2) {
399
+ "use strict";
400
+ var ESC = "\x1B";
401
+ var CSI = `${ESC}[`;
402
+ var beep = "\x07";
403
+ var cursor = {
404
+ to(x, y) {
405
+ if (!y)
406
+ return `${CSI}${x + 1}G`;
407
+ return `${CSI}${y + 1};${x + 1}H`;
408
+ },
409
+ move(x, y) {
410
+ let ret = "";
411
+ if (x < 0)
412
+ ret += `${CSI}${-x}D`;
413
+ else if (x > 0)
414
+ ret += `${CSI}${x}C`;
415
+ if (y < 0)
416
+ ret += `${CSI}${-y}A`;
417
+ else if (y > 0)
418
+ ret += `${CSI}${y}B`;
419
+ return ret;
420
+ },
421
+ up: (count = 1) => `${CSI}${count}A`,
422
+ down: (count = 1) => `${CSI}${count}B`,
423
+ forward: (count = 1) => `${CSI}${count}C`,
424
+ backward: (count = 1) => `${CSI}${count}D`,
425
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
426
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
427
+ left: `${CSI}G`,
428
+ hide: `${CSI}?25l`,
429
+ show: `${CSI}?25h`,
430
+ save: `${ESC}7`,
431
+ restore: `${ESC}8`
432
+ };
433
+ var scroll = {
434
+ up: (count = 1) => `${CSI}S`.repeat(count),
435
+ down: (count = 1) => `${CSI}T`.repeat(count)
436
+ };
437
+ var erase = {
438
+ screen: `${CSI}2J`,
439
+ up: (count = 1) => `${CSI}1J`.repeat(count),
440
+ down: (count = 1) => `${CSI}J`.repeat(count),
441
+ line: `${CSI}2K`,
442
+ lineEnd: `${CSI}K`,
443
+ lineStart: `${CSI}1K`,
444
+ lines(count) {
445
+ let clear = "";
446
+ for (let i = 0; i < count; i++)
447
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
448
+ if (count)
449
+ clear += cursor.left;
450
+ return clear;
451
+ }
452
+ };
453
+ module2.exports = { cursor, scroll, erase, beep };
454
+ }
455
+ });
456
+
3101
457
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/clear.js
3102
- var require_clear2 = __commonJS({
458
+ var require_clear = __commonJS({
3103
459
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/clear.js"(exports, module2) {
3104
460
  "use strict";
3105
- var strip = require_strip2();
461
+ var strip = require_strip();
3106
462
  var { erase, cursor } = require_src();
3107
463
  var width = (str) => [...strip(str)].length;
3108
464
  module2.exports = function(prompt, perLine) {
@@ -3119,7 +475,7 @@ var require_clear2 = __commonJS({
3119
475
  });
3120
476
 
3121
477
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/figures.js
3122
- var require_figures2 = __commonJS({
478
+ var require_figures = __commonJS({
3123
479
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/figures.js"(exports, module2) {
3124
480
  "use strict";
3125
481
  var main = {
@@ -3156,11 +512,11 @@ var require_figures2 = __commonJS({
3156
512
  });
3157
513
 
3158
514
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/style.js
3159
- var require_style2 = __commonJS({
515
+ var require_style = __commonJS({
3160
516
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/style.js"(exports, module2) {
3161
517
  "use strict";
3162
518
  var c = require_kleur();
3163
- var figures = require_figures2();
519
+ var figures = require_figures();
3164
520
  var styles = Object.freeze({
3165
521
  password: { scale: 1, render: (input) => "*".repeat(input.length) },
3166
522
  emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
@@ -3189,10 +545,10 @@ var require_style2 = __commonJS({
3189
545
  });
3190
546
 
3191
547
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/lines.js
3192
- var require_lines2 = __commonJS({
548
+ var require_lines = __commonJS({
3193
549
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/lines.js"(exports, module2) {
3194
550
  "use strict";
3195
- var strip = require_strip2();
551
+ var strip = require_strip();
3196
552
  module2.exports = function(msg, perLine) {
3197
553
  let lines = String(strip(msg) || "").split(/\r?\n/);
3198
554
  if (!perLine)
@@ -3203,7 +559,7 @@ var require_lines2 = __commonJS({
3203
559
  });
3204
560
 
3205
561
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/wrap.js
3206
- var require_wrap2 = __commonJS({
562
+ var require_wrap = __commonJS({
3207
563
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/wrap.js"(exports, module2) {
3208
564
  "use strict";
3209
565
  module2.exports = (msg, opts = {}) => {
@@ -3221,7 +577,7 @@ var require_wrap2 = __commonJS({
3221
577
  });
3222
578
 
3223
579
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/entriesToDisplay.js
3224
- var require_entriesToDisplay2 = __commonJS({
580
+ var require_entriesToDisplay = __commonJS({
3225
581
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/entriesToDisplay.js"(exports, module2) {
3226
582
  "use strict";
3227
583
  module2.exports = (cursor, total, maxVisible) => {
@@ -3236,28 +592,28 @@ var require_entriesToDisplay2 = __commonJS({
3236
592
  });
3237
593
 
3238
594
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/index.js
3239
- var require_util2 = __commonJS({
595
+ var require_util = __commonJS({
3240
596
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/util/index.js"(exports, module2) {
3241
597
  "use strict";
3242
598
  module2.exports = {
3243
- action: require_action2(),
3244
- clear: require_clear2(),
3245
- style: require_style2(),
3246
- strip: require_strip2(),
3247
- figures: require_figures2(),
3248
- lines: require_lines2(),
3249
- wrap: require_wrap2(),
3250
- entriesToDisplay: require_entriesToDisplay2()
599
+ action: require_action(),
600
+ clear: require_clear(),
601
+ style: require_style(),
602
+ strip: require_strip(),
603
+ figures: require_figures(),
604
+ lines: require_lines(),
605
+ wrap: require_wrap(),
606
+ entriesToDisplay: require_entriesToDisplay()
3251
607
  };
3252
608
  }
3253
609
  });
3254
610
 
3255
611
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/prompt.js
3256
- var require_prompt2 = __commonJS({
612
+ var require_prompt = __commonJS({
3257
613
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/prompt.js"(exports, module2) {
3258
614
  "use strict";
3259
615
  var readline = require("readline");
3260
- var { action } = require_util2();
616
+ var { action } = require_util();
3261
617
  var EventEmitter = require("events");
3262
618
  var { beep, cursor } = require_src();
3263
619
  var color = require_kleur();
@@ -3315,12 +671,12 @@ var require_prompt2 = __commonJS({
3315
671
  });
3316
672
 
3317
673
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/text.js
3318
- var require_text2 = __commonJS({
674
+ var require_text = __commonJS({
3319
675
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/text.js"(exports, module2) {
3320
676
  var color = require_kleur();
3321
- var Prompt = require_prompt2();
677
+ var Prompt = require_prompt();
3322
678
  var { erase, cursor } = require_src();
3323
- var { style, clear, lines, figures } = require_util2();
679
+ var { style, clear, lines, figures } = require_util();
3324
680
  var TextPrompt = class extends Prompt {
3325
681
  constructor(opts = {}) {
3326
682
  super(opts);
@@ -3502,12 +858,12 @@ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
3502
858
  });
3503
859
 
3504
860
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/select.js
3505
- var require_select2 = __commonJS({
861
+ var require_select = __commonJS({
3506
862
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/select.js"(exports, module2) {
3507
863
  "use strict";
3508
864
  var color = require_kleur();
3509
- var Prompt = require_prompt2();
3510
- var { style, clear, figures, wrap, entriesToDisplay } = require_util2();
865
+ var Prompt = require_prompt();
866
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util();
3511
867
  var { cursor } = require_src();
3512
868
  var SelectPrompt = class extends Prompt {
3513
869
  constructor(opts = {}) {
@@ -3649,11 +1005,11 @@ var require_select2 = __commonJS({
3649
1005
  });
3650
1006
 
3651
1007
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/toggle.js
3652
- var require_toggle2 = __commonJS({
1008
+ var require_toggle = __commonJS({
3653
1009
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/toggle.js"(exports, module2) {
3654
1010
  var color = require_kleur();
3655
- var Prompt = require_prompt2();
3656
- var { style, clear } = require_util2();
1011
+ var Prompt = require_prompt();
1012
+ var { style, clear } = require_util();
3657
1013
  var { cursor, erase } = require_src();
3658
1014
  var TogglePrompt = class extends Prompt {
3659
1015
  constructor(opts = {}) {
@@ -3755,7 +1111,7 @@ var require_toggle2 = __commonJS({
3755
1111
  });
3756
1112
 
3757
1113
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/datepart.js
3758
- var require_datepart2 = __commonJS({
1114
+ var require_datepart = __commonJS({
3759
1115
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/datepart.js"(exports, module2) {
3760
1116
  "use strict";
3761
1117
  var DatePart = class {
@@ -3789,10 +1145,10 @@ var require_datepart2 = __commonJS({
3789
1145
  });
3790
1146
 
3791
1147
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/meridiem.js
3792
- var require_meridiem2 = __commonJS({
1148
+ var require_meridiem = __commonJS({
3793
1149
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/meridiem.js"(exports, module2) {
3794
1150
  "use strict";
3795
- var DatePart = require_datepart2();
1151
+ var DatePart = require_datepart();
3796
1152
  var Meridiem = class extends DatePart {
3797
1153
  constructor(opts = {}) {
3798
1154
  super(opts);
@@ -3813,10 +1169,10 @@ var require_meridiem2 = __commonJS({
3813
1169
  });
3814
1170
 
3815
1171
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/day.js
3816
- var require_day2 = __commonJS({
1172
+ var require_day = __commonJS({
3817
1173
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/day.js"(exports, module2) {
3818
1174
  "use strict";
3819
- var DatePart = require_datepart2();
1175
+ var DatePart = require_datepart();
3820
1176
  var pos = (n) => {
3821
1177
  n = n % 10;
3822
1178
  return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
@@ -3845,10 +1201,10 @@ var require_day2 = __commonJS({
3845
1201
  });
3846
1202
 
3847
1203
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/hours.js
3848
- var require_hours2 = __commonJS({
1204
+ var require_hours = __commonJS({
3849
1205
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/hours.js"(exports, module2) {
3850
1206
  "use strict";
3851
- var DatePart = require_datepart2();
1207
+ var DatePart = require_datepart();
3852
1208
  var Hours = class extends DatePart {
3853
1209
  constructor(opts = {}) {
3854
1210
  super(opts);
@@ -3874,10 +1230,10 @@ var require_hours2 = __commonJS({
3874
1230
  });
3875
1231
 
3876
1232
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/milliseconds.js
3877
- var require_milliseconds2 = __commonJS({
1233
+ var require_milliseconds = __commonJS({
3878
1234
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module2) {
3879
1235
  "use strict";
3880
- var DatePart = require_datepart2();
1236
+ var DatePart = require_datepart();
3881
1237
  var Milliseconds = class extends DatePart {
3882
1238
  constructor(opts = {}) {
3883
1239
  super(opts);
@@ -3900,10 +1256,10 @@ var require_milliseconds2 = __commonJS({
3900
1256
  });
3901
1257
 
3902
1258
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/minutes.js
3903
- var require_minutes2 = __commonJS({
1259
+ var require_minutes = __commonJS({
3904
1260
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/minutes.js"(exports, module2) {
3905
1261
  "use strict";
3906
- var DatePart = require_datepart2();
1262
+ var DatePart = require_datepart();
3907
1263
  var Minutes = class extends DatePart {
3908
1264
  constructor(opts = {}) {
3909
1265
  super(opts);
@@ -3927,10 +1283,10 @@ var require_minutes2 = __commonJS({
3927
1283
  });
3928
1284
 
3929
1285
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/month.js
3930
- var require_month2 = __commonJS({
1286
+ var require_month = __commonJS({
3931
1287
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/month.js"(exports, module2) {
3932
1288
  "use strict";
3933
- var DatePart = require_datepart2();
1289
+ var DatePart = require_datepart();
3934
1290
  var Month = class extends DatePart {
3935
1291
  constructor(opts = {}) {
3936
1292
  super(opts);
@@ -3956,10 +1312,10 @@ var require_month2 = __commonJS({
3956
1312
  });
3957
1313
 
3958
1314
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/seconds.js
3959
- var require_seconds2 = __commonJS({
1315
+ var require_seconds = __commonJS({
3960
1316
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/seconds.js"(exports, module2) {
3961
1317
  "use strict";
3962
- var DatePart = require_datepart2();
1318
+ var DatePart = require_datepart();
3963
1319
  var Seconds = class extends DatePart {
3964
1320
  constructor(opts = {}) {
3965
1321
  super(opts);
@@ -3983,10 +1339,10 @@ var require_seconds2 = __commonJS({
3983
1339
  });
3984
1340
 
3985
1341
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/year.js
3986
- var require_year2 = __commonJS({
1342
+ var require_year = __commonJS({
3987
1343
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/year.js"(exports, module2) {
3988
1344
  "use strict";
3989
- var DatePart = require_datepart2();
1345
+ var DatePart = require_datepart();
3990
1346
  var Year = class extends DatePart {
3991
1347
  constructor(opts = {}) {
3992
1348
  super(opts);
@@ -4010,32 +1366,32 @@ var require_year2 = __commonJS({
4010
1366
  });
4011
1367
 
4012
1368
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/index.js
4013
- var require_dateparts2 = __commonJS({
1369
+ var require_dateparts = __commonJS({
4014
1370
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/dateparts/index.js"(exports, module2) {
4015
1371
  "use strict";
4016
1372
  module2.exports = {
4017
- DatePart: require_datepart2(),
4018
- Meridiem: require_meridiem2(),
4019
- Day: require_day2(),
4020
- Hours: require_hours2(),
4021
- Milliseconds: require_milliseconds2(),
4022
- Minutes: require_minutes2(),
4023
- Month: require_month2(),
4024
- Seconds: require_seconds2(),
4025
- Year: require_year2()
1373
+ DatePart: require_datepart(),
1374
+ Meridiem: require_meridiem(),
1375
+ Day: require_day(),
1376
+ Hours: require_hours(),
1377
+ Milliseconds: require_milliseconds(),
1378
+ Minutes: require_minutes(),
1379
+ Month: require_month(),
1380
+ Seconds: require_seconds(),
1381
+ Year: require_year()
4026
1382
  };
4027
1383
  }
4028
1384
  });
4029
1385
 
4030
1386
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/date.js
4031
- var require_date2 = __commonJS({
1387
+ var require_date = __commonJS({
4032
1388
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/date.js"(exports, module2) {
4033
1389
  "use strict";
4034
1390
  var color = require_kleur();
4035
- var Prompt = require_prompt2();
4036
- var { style, clear, figures } = require_util2();
1391
+ var Prompt = require_prompt();
1392
+ var { style, clear, figures } = require_util();
4037
1393
  var { erase, cursor } = require_src();
4038
- var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts2();
1394
+ var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts();
4039
1395
  var regex = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;
4040
1396
  var regexGroups = {
4041
1397
  1: ({ token }) => token.replace(/\\(.)/g, "$1"),
@@ -4203,12 +1559,12 @@ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
4203
1559
  });
4204
1560
 
4205
1561
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/number.js
4206
- var require_number2 = __commonJS({
1562
+ var require_number = __commonJS({
4207
1563
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/number.js"(exports, module2) {
4208
1564
  var color = require_kleur();
4209
- var Prompt = require_prompt2();
1565
+ var Prompt = require_prompt();
4210
1566
  var { cursor, erase } = require_src();
4211
- var { style, figures, clear, lines } = require_util2();
1567
+ var { style, figures, clear, lines } = require_util();
4212
1568
  var isNumber = /[0-9]/;
4213
1569
  var isDef = (any) => any !== void 0;
4214
1570
  var round = (number, precision) => {
@@ -4391,13 +1747,13 @@ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
4391
1747
  });
4392
1748
 
4393
1749
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/multiselect.js
4394
- var require_multiselect2 = __commonJS({
1750
+ var require_multiselect = __commonJS({
4395
1751
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/multiselect.js"(exports, module2) {
4396
1752
  "use strict";
4397
1753
  var color = require_kleur();
4398
1754
  var { cursor } = require_src();
4399
- var Prompt = require_prompt2();
4400
- var { clear, figures, style, wrap, entriesToDisplay } = require_util2();
1755
+ var Prompt = require_prompt();
1756
+ var { clear, figures, style, wrap, entriesToDisplay } = require_util();
4401
1757
  var MultiselectPrompt = class extends Prompt {
4402
1758
  constructor(opts = {}) {
4403
1759
  super(opts);
@@ -4617,13 +1973,13 @@ Instructions:
4617
1973
  });
4618
1974
 
4619
1975
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/autocomplete.js
4620
- var require_autocomplete2 = __commonJS({
1976
+ var require_autocomplete = __commonJS({
4621
1977
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/autocomplete.js"(exports, module2) {
4622
1978
  "use strict";
4623
1979
  var color = require_kleur();
4624
- var Prompt = require_prompt2();
1980
+ var Prompt = require_prompt();
4625
1981
  var { erase, cursor } = require_src();
4626
- var { style, clear, figures, wrap, entriesToDisplay } = require_util2();
1982
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util();
4627
1983
  var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
4628
1984
  var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
4629
1985
  var getIndex = (arr, valOrTitle) => {
@@ -4838,13 +2194,13 @@ var require_autocomplete2 = __commonJS({
4838
2194
  });
4839
2195
 
4840
2196
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/autocompleteMultiselect.js
4841
- var require_autocompleteMultiselect2 = __commonJS({
2197
+ var require_autocompleteMultiselect = __commonJS({
4842
2198
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module2) {
4843
2199
  "use strict";
4844
2200
  var color = require_kleur();
4845
2201
  var { cursor } = require_src();
4846
- var MultiselectPrompt = require_multiselect2();
4847
- var { clear, style, figures } = require_util2();
2202
+ var MultiselectPrompt = require_multiselect();
2203
+ var { clear, style, figures } = require_util();
4848
2204
  var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
4849
2205
  constructor(opts = {}) {
4850
2206
  opts.overrideRender = true;
@@ -5003,11 +2359,11 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter so
5003
2359
  });
5004
2360
 
5005
2361
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/confirm.js
5006
- var require_confirm2 = __commonJS({
2362
+ var require_confirm = __commonJS({
5007
2363
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/confirm.js"(exports, module2) {
5008
2364
  var color = require_kleur();
5009
- var Prompt = require_prompt2();
5010
- var { style, clear } = require_util2();
2365
+ var Prompt = require_prompt();
2366
+ var { style, clear } = require_util();
5011
2367
  var { erase, cursor } = require_src();
5012
2368
  var ConfirmPrompt = class extends Prompt {
5013
2369
  constructor(opts = {}) {
@@ -5078,29 +2434,29 @@ var require_confirm2 = __commonJS({
5078
2434
  });
5079
2435
 
5080
2436
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/index.js
5081
- var require_elements2 = __commonJS({
2437
+ var require_elements = __commonJS({
5082
2438
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/index.js"(exports, module2) {
5083
2439
  "use strict";
5084
2440
  module2.exports = {
5085
- TextPrompt: require_text2(),
5086
- SelectPrompt: require_select2(),
5087
- TogglePrompt: require_toggle2(),
5088
- DatePrompt: require_date2(),
5089
- NumberPrompt: require_number2(),
5090
- MultiselectPrompt: require_multiselect2(),
5091
- AutocompletePrompt: require_autocomplete2(),
5092
- AutocompleteMultiselectPrompt: require_autocompleteMultiselect2(),
5093
- ConfirmPrompt: require_confirm2()
2441
+ TextPrompt: require_text(),
2442
+ SelectPrompt: require_select(),
2443
+ TogglePrompt: require_toggle(),
2444
+ DatePrompt: require_date(),
2445
+ NumberPrompt: require_number(),
2446
+ MultiselectPrompt: require_multiselect(),
2447
+ AutocompletePrompt: require_autocomplete(),
2448
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
2449
+ ConfirmPrompt: require_confirm()
5094
2450
  };
5095
2451
  }
5096
2452
  });
5097
2453
 
5098
2454
  // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/prompts.js
5099
- var require_prompts2 = __commonJS({
2455
+ var require_prompts = __commonJS({
5100
2456
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/prompts.js"(exports) {
5101
2457
  "use strict";
5102
2458
  var $ = exports;
5103
- var el = require_elements2();
2459
+ var el = require_elements();
5104
2460
  var noop = (v) => v;
5105
2461
  function toPrompt(type, args, opts = {}) {
5106
2462
  return new Promise((res, rej) => {
@@ -5163,7 +2519,7 @@ var require_prompts2 = __commonJS({
5163
2519
  var require_lib = __commonJS({
5164
2520
  "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/index.js"(exports, module2) {
5165
2521
  "use strict";
5166
- var prompts2 = require_prompts2();
2522
+ var prompts2 = require_prompts();
5167
2523
  var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
5168
2524
  var noop = () => {
5169
2525
  };
@@ -5236,29 +2592,11 @@ var require_lib = __commonJS({
5236
2592
  }
5237
2593
  });
5238
2594
 
5239
- // node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/index.js
5240
- var require_prompts3 = __commonJS({
5241
- "node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/index.js"(exports, module2) {
5242
- function isNodeLT(tar) {
5243
- tar = (Array.isArray(tar) ? tar : tar.split(".")).map(Number);
5244
- let i = 0, src = process.versions.node.split(".").map(Number);
5245
- for (; i < tar.length; i++) {
5246
- if (src[i] > tar[i])
5247
- return false;
5248
- if (tar[i] > src[i])
5249
- return true;
5250
- }
5251
- return false;
5252
- }
5253
- module2.exports = isNodeLT("8.6.0") ? require_dist() : require_lib();
5254
- }
5255
- });
5256
-
5257
- // index.js
5258
- var import_fs4 = __toModule(require("fs"));
5259
- var import_path3 = __toModule(require("path"));
5260
- var import_minimist = __toModule(require_minimist());
5261
- var import_prompts = __toModule(require_prompts3());
2595
+ // index.ts
2596
+ var fs4 = __toESM(require("fs"), 1);
2597
+ var path4 = __toESM(require("path"), 1);
2598
+ var import_minimist = __toESM(require_minimist(), 1);
2599
+ var import_prompts = __toESM(require_lib(), 1);
5262
2600
 
5263
2601
  // node_modules/.pnpm/kolorist@1.5.1/node_modules/kolorist/dist/esm/index.mjs
5264
2602
  var enabled = true;
@@ -5294,8 +2632,8 @@ var options = {
5294
2632
  supportLevel
5295
2633
  };
5296
2634
  function kolorist(start, end, level = 1) {
5297
- const open = `[${start}m`;
5298
- const close = `[${end}m`;
2635
+ const open = `\x1B[${start}m`;
2636
+ const close = `\x1B[${end}m`;
5299
2637
  const regex = new RegExp(`\\x1b\\[${end}m`, "g");
5300
2638
  return (str) => {
5301
2639
  return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
@@ -5342,13 +2680,13 @@ var bgLightMagenta = kolorist(105, 49);
5342
2680
  var bgLightCyan = kolorist(106, 49);
5343
2681
  var bgLightGray = kolorist(47, 49);
5344
2682
 
5345
- // utils/renderTemplate.js
5346
- var import_fs = __toModule(require("fs"));
5347
- var import_path = __toModule(require("path"));
2683
+ // utils/renderTemplate.ts
2684
+ var fs = __toESM(require("fs"), 1);
2685
+ var path = __toESM(require("path"), 1);
5348
2686
 
5349
- // utils/deepMerge.js
2687
+ // utils/deepMerge.ts
5350
2688
  var isObject = (val) => val && typeof val === "object";
5351
- var mergeArrayWithDedupe = (a, b) => Array.from(new Set([...a, ...b]));
2689
+ var mergeArrayWithDedupe = (a, b) => Array.from(/* @__PURE__ */ new Set([...a, ...b]));
5352
2690
  function deepMerge(target, obj) {
5353
2691
  for (const key of Object.keys(obj)) {
5354
2692
  const oldVal = target[key];
@@ -5365,7 +2703,7 @@ function deepMerge(target, obj) {
5365
2703
  }
5366
2704
  var deepMerge_default = deepMerge;
5367
2705
 
5368
- // utils/sortDependencies.js
2706
+ // utils/sortDependencies.ts
5369
2707
  function sortDependencies(packageJson) {
5370
2708
  const sorted = {};
5371
2709
  const depTypes = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
@@ -5383,40 +2721,43 @@ function sortDependencies(packageJson) {
5383
2721
  };
5384
2722
  }
5385
2723
 
5386
- // utils/renderTemplate.js
2724
+ // utils/renderTemplate.ts
5387
2725
  function renderTemplate(src, dest) {
5388
- const stats = import_fs.default.statSync(src);
2726
+ const stats = fs.statSync(src);
5389
2727
  if (stats.isDirectory()) {
5390
- import_fs.default.mkdirSync(dest, { recursive: true });
5391
- for (const file of import_fs.default.readdirSync(src)) {
5392
- renderTemplate(import_path.default.resolve(src, file), import_path.default.resolve(dest, file));
2728
+ if (path.basename(src) === "node_modules") {
2729
+ return;
2730
+ }
2731
+ fs.mkdirSync(dest, { recursive: true });
2732
+ for (const file of fs.readdirSync(src)) {
2733
+ renderTemplate(path.resolve(src, file), path.resolve(dest, file));
5393
2734
  }
5394
2735
  return;
5395
2736
  }
5396
- const filename = import_path.default.basename(src);
5397
- if (filename === "package.json" && import_fs.default.existsSync(dest)) {
5398
- const existing = JSON.parse(import_fs.default.readFileSync(dest));
5399
- const newPackage = JSON.parse(import_fs.default.readFileSync(src));
2737
+ const filename = path.basename(src);
2738
+ if (filename === "package.json" && fs.existsSync(dest)) {
2739
+ const existing = JSON.parse(fs.readFileSync(dest, "utf8"));
2740
+ const newPackage = JSON.parse(fs.readFileSync(src, "utf8"));
5400
2741
  const pkg = sortDependencies(deepMerge_default(existing, newPackage));
5401
- import_fs.default.writeFileSync(dest, JSON.stringify(pkg, null, 2) + "\n");
2742
+ fs.writeFileSync(dest, JSON.stringify(pkg, null, 2) + "\n");
5402
2743
  return;
5403
2744
  }
5404
2745
  if (filename.startsWith("_")) {
5405
- dest = import_path.default.resolve(import_path.default.dirname(dest), filename.replace(/^_/, "."));
2746
+ dest = path.resolve(path.dirname(dest), filename.replace(/^_/, "."));
5406
2747
  }
5407
- import_fs.default.copyFileSync(src, dest);
2748
+ fs.copyFileSync(src, dest);
5408
2749
  }
5409
2750
  var renderTemplate_default = renderTemplate;
5410
2751
 
5411
- // utils/directoryTraverse.js
5412
- var import_fs2 = __toModule(require("fs"));
5413
- var import_path2 = __toModule(require("path"));
2752
+ // utils/directoryTraverse.ts
2753
+ var fs2 = __toESM(require("fs"), 1);
2754
+ var path2 = __toESM(require("path"), 1);
5414
2755
  function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
5415
- for (const filename of import_fs2.default.readdirSync(dir)) {
5416
- const fullpath = import_path2.default.resolve(dir, filename);
5417
- if (import_fs2.default.lstatSync(fullpath).isDirectory()) {
2756
+ for (const filename of fs2.readdirSync(dir)) {
2757
+ const fullpath = path2.resolve(dir, filename);
2758
+ if (fs2.lstatSync(fullpath).isDirectory()) {
5418
2759
  dirCallback(fullpath);
5419
- if (import_fs2.default.existsSync(fullpath)) {
2760
+ if (fs2.existsSync(fullpath)) {
5420
2761
  preOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
5421
2762
  }
5422
2763
  continue;
@@ -5425,9 +2766,9 @@ function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
5425
2766
  }
5426
2767
  }
5427
2768
  function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
5428
- for (const filename of import_fs2.default.readdirSync(dir)) {
5429
- const fullpath = import_path2.default.resolve(dir, filename);
5430
- if (import_fs2.default.lstatSync(fullpath).isDirectory()) {
2769
+ for (const filename of fs2.readdirSync(dir)) {
2770
+ const fullpath = path2.resolve(dir, filename);
2771
+ if (fs2.lstatSync(fullpath).isDirectory()) {
5431
2772
  postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
5432
2773
  dirCallback(fullpath);
5433
2774
  continue;
@@ -5436,10 +2777,7 @@ function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
5436
2777
  }
5437
2778
  }
5438
2779
 
5439
- // utils/generateReadme.js
5440
- var import_fs3 = __toModule(require("fs"));
5441
-
5442
- // utils/getCommand.js
2780
+ // utils/getCommand.ts
5443
2781
  function getCommand(packageManager, scriptName) {
5444
2782
  if (scriptName === "install") {
5445
2783
  return packageManager === "yarn" ? "yarn" : `${packageManager} install`;
@@ -5447,21 +2785,37 @@ function getCommand(packageManager, scriptName) {
5447
2785
  return packageManager === "npm" ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
5448
2786
  }
5449
2787
 
5450
- // utils/generateReadme.js
5451
- var sfcTypeSupportDoc = "\n## Type Support for `.vue` Imports in TS\n\nSince TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates.\n\nHowever, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can run `Volar: Switch TS Plugin on/off` from VSCode command palette.\n";
2788
+ // utils/generateReadme.ts
2789
+ var sfcTypeSupportDoc = [
2790
+ "",
2791
+ "## Type Support for `.vue` Imports in TS",
2792
+ "",
2793
+ "TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.",
2794
+ "",
2795
+ "If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:",
2796
+ "",
2797
+ "1. Disable the built-in TypeScript Extension",
2798
+ " 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette",
2799
+ " 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`",
2800
+ "2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.",
2801
+ ""
2802
+ ].join("\n");
5452
2803
  function generateReadme({
5453
2804
  projectName,
5454
2805
  packageManager,
5455
2806
  needsTypeScript,
5456
- needsTests
2807
+ needsCypress,
2808
+ needsCypressCT,
2809
+ needsVitest,
2810
+ needsEslint
5457
2811
  }) {
5458
2812
  let readme = `# ${projectName}
5459
2813
 
5460
- This template should help get you started developing with Vue 2 in Vite.
2814
+ This template should help get you started developing with Vue 3 in Vite.
5461
2815
 
5462
2816
  ## Recommended IDE Setup
5463
2817
 
5464
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) (and disable Vetur).
2818
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
5465
2819
  ${needsTypeScript ? sfcTypeSupportDoc : ""}
5466
2820
  ## Customize configuration
5467
2821
 
@@ -5486,50 +2840,178 @@ ${getCommand(packageManager, "dev")}
5486
2840
  ${getCommand(packageManager, "build")}
5487
2841
  \`\`\`
5488
2842
  `;
5489
- if (needsTests) {
2843
+ if (needsVitest) {
5490
2844
  npmScriptsDescriptions += `
5491
- ### Run Unit Tests with [Cypress Component Testing](https://docs.cypress.io/guides/component-testing/introduction)
2845
+ ### Run Unit Tests with [Vitest](https://vitest.dev/)
5492
2846
 
5493
2847
  \`\`\`sh
5494
- ${getCommand(packageManager, "test:unit")} # or \`${getCommand(packageManager, "test:unit:ci")}\` for headless testing
2848
+ ${getCommand(packageManager, "test:unit")}
5495
2849
  \`\`\`
2850
+ `;
2851
+ }
2852
+ if (needsCypressCT) {
2853
+ npmScriptsDescriptions += `
2854
+ ### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
5496
2855
 
2856
+ \`\`\`sh
2857
+ ${getCommand(packageManager, "test:unit")} # or \`${getCommand(packageManager, "test:unit:ci")}\` for headless testing
2858
+ \`\`\`
2859
+ `;
2860
+ }
2861
+ if (needsCypress) {
2862
+ npmScriptsDescriptions += `
5497
2863
  ### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
5498
2864
 
5499
2865
  \`\`\`sh
5500
2866
  ${getCommand(packageManager, "build")}
5501
2867
  ${getCommand(packageManager, "test:e2e")} # or \`${getCommand(packageManager, "test:e2e:ci")}\` for headless testing
5502
2868
  \`\`\`
2869
+ `;
2870
+ }
2871
+ if (needsEslint) {
2872
+ npmScriptsDescriptions += `
2873
+ ### Lint with [ESLint](https://eslint.org/)
2874
+
2875
+ \`\`\`sh
2876
+ ${getCommand(packageManager, "lint")}
2877
+ \`\`\`
5503
2878
  `;
5504
2879
  }
5505
2880
  readme += npmScriptsDescriptions;
5506
2881
  return readme;
5507
2882
  }
5508
2883
 
5509
- // index.js
2884
+ // utils/renderEslint.ts
2885
+ var fs3 = __toESM(require("fs"), 1);
2886
+ var path3 = __toESM(require("path"), 1);
2887
+
2888
+ // template/eslint/package.json
2889
+ var devDependencies = {
2890
+ "@rushstack/eslint-patch": "^1.1.0",
2891
+ "@vue/eslint-config-prettier": "^7.0.0",
2892
+ "@vue/eslint-config-typescript": "^11.0.0",
2893
+ eslint: "^8.5.0",
2894
+ "eslint-plugin-cypress": "^2.12.1",
2895
+ "eslint-plugin-vue": "^9.0.0",
2896
+ prettier: "^2.5.1"
2897
+ };
2898
+
2899
+ // utils/renderEslint.ts
2900
+ var dependencies = {};
2901
+ function addEslintDependency(name) {
2902
+ dependencies[name] = devDependencies[name];
2903
+ }
2904
+ addEslintDependency("eslint");
2905
+ addEslintDependency("eslint-plugin-vue");
2906
+ var config = {
2907
+ root: true,
2908
+ extends: ["plugin:vue/essential"]
2909
+ };
2910
+ function configureEslint({ language, styleGuide, needsPrettier, needsCypress, needsCypressCT }) {
2911
+ switch (`${styleGuide}-${language}`) {
2912
+ case "default-javascript":
2913
+ config.extends.push("eslint:recommended");
2914
+ break;
2915
+ case "default-typescript":
2916
+ addEslintDependency("@vue/eslint-config-typescript");
2917
+ config.extends.push("eslint:recommended");
2918
+ config.extends.push("@vue/eslint-config-typescript/recommended");
2919
+ break;
2920
+ }
2921
+ if (needsPrettier) {
2922
+ addEslintDependency("prettier");
2923
+ addEslintDependency("@vue/eslint-config-prettier");
2924
+ config.extends.push("@vue/eslint-config-prettier");
2925
+ }
2926
+ if (needsCypress) {
2927
+ const cypressOverrides = [
2928
+ {
2929
+ files: needsCypressCT ? ["**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}", "cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}"] : ["cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}"],
2930
+ extends: ["plugin:cypress/recommended"]
2931
+ }
2932
+ ];
2933
+ addEslintDependency("eslint-plugin-cypress");
2934
+ config.overrides = cypressOverrides;
2935
+ }
2936
+ let configuration = "/* eslint-env node */\n";
2937
+ if (styleGuide !== "default" || language !== "javascript" || needsPrettier) {
2938
+ addEslintDependency("@rushstack/eslint-patch");
2939
+ configuration += `require("@rushstack/eslint-patch/modern-module-resolution");
2940
+
2941
+ `;
2942
+ }
2943
+ configuration += `module.exports = ${JSON.stringify(config, void 0, 2)}
2944
+ `;
2945
+ return {
2946
+ dependencies,
2947
+ configuration
2948
+ };
2949
+ }
2950
+ function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier }) {
2951
+ const { dependencies: dependencies2, configuration } = configureEslint({
2952
+ language: needsTypeScript ? "typescript" : "javascript",
2953
+ styleGuide: "default",
2954
+ needsPrettier,
2955
+ needsCypress,
2956
+ needsCypressCT
2957
+ });
2958
+ const packageJsonPath = path3.resolve(rootDir, "package.json");
2959
+ const existingPkg = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
2960
+ const pkg = sortDependencies(deepMerge_default(existingPkg, {
2961
+ scripts: {
2962
+ lint: needsTypeScript ? "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" : "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
2963
+ },
2964
+ devDependencies: dependencies2
2965
+ }));
2966
+ fs3.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2) + "\n");
2967
+ const eslintrcPath = path3.resolve(rootDir, ".eslintrc.cjs");
2968
+ fs3.writeFileSync(eslintrcPath, configuration);
2969
+ }
2970
+
2971
+ // utils/banner.ts
2972
+ var banner = "\x1B[38;2;66;211;146mV\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;67;209;149ms\x1B[39m \x1B[38;2;68;206;152m-\x1B[39m \x1B[38;2;69;204;155mT\x1B[39m\x1B[38;2;70;201;158mh\x1B[39m\x1B[38;2;71;199;162me\x1B[39m \x1B[38;2;72;196;165mP\x1B[39m\x1B[38;2;73;194;168mr\x1B[39m\x1B[38;2;74;192;171mo\x1B[39m\x1B[38;2;75;189;174mg\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m\x1B[38;2;77;184;180me\x1B[39m\x1B[38;2;78;182;183ms\x1B[39m\x1B[38;2;79;179;186ms\x1B[39m\x1B[38;2;80;177;190mi\x1B[39m\x1B[38;2;81;175;193mv\x1B[39m\x1B[38;2;82;172;196me\x1B[39m \x1B[38;2;83;170;199mJ\x1B[39m\x1B[38;2;83;167;202ma\x1B[39m\x1B[38;2;84;165;205mv\x1B[39m\x1B[38;2;85;162;208ma\x1B[39m\x1B[38;2;86;160;211mS\x1B[39m\x1B[38;2;87;158;215mc\x1B[39m\x1B[38;2;88;155;218mr\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mp\x1B[39m\x1B[38;2;91;148;227mt\x1B[39m \x1B[38;2;92;145;230mF\x1B[39m\x1B[38;2;93;143;233mr\x1B[39m\x1B[38;2;94;141;236ma\x1B[39m\x1B[38;2;95;138;239mm\x1B[39m\x1B[38;2;96;136;243me\x1B[39m\x1B[38;2;97;133;246mw\x1B[39m\x1B[38;2;98;131;249mo\x1B[39m\x1B[38;2;99;128;252mr\x1B[39m\x1B[38;2;100;126;255mk\x1B[39m";
2973
+ var banner_default = banner;
2974
+
2975
+ // index.ts
5510
2976
  function isValidPackageName(projectName) {
5511
2977
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
5512
2978
  }
5513
2979
  function toValidPackageName(projectName) {
5514
2980
  return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
5515
2981
  }
5516
- function canSafelyOverwrite(dir) {
5517
- return !import_fs4.default.existsSync(dir) || import_fs4.default.readdirSync(dir).length === 0;
2982
+ function canSkipEmptying(dir) {
2983
+ if (!fs4.existsSync(dir)) {
2984
+ return true;
2985
+ }
2986
+ const files = fs4.readdirSync(dir);
2987
+ if (files.length === 0) {
2988
+ return true;
2989
+ }
2990
+ if (files.length === 1 && files[0] === ".git") {
2991
+ return true;
2992
+ }
2993
+ return false;
5518
2994
  }
5519
2995
  function emptyDir(dir) {
5520
- postOrderDirectoryTraverse(dir, (dir2) => import_fs4.default.rmdirSync(dir2), (file) => import_fs4.default.unlinkSync(file));
2996
+ if (!fs4.existsSync(dir)) {
2997
+ return;
2998
+ }
2999
+ postOrderDirectoryTraverse(dir, (dir2) => fs4.rmdirSync(dir2), (file) => fs4.unlinkSync(file));
5521
3000
  }
5522
3001
  async function init() {
3002
+ console.log(`
3003
+ ${banner_default}
3004
+ `);
5523
3005
  const cwd = process.cwd();
5524
3006
  const argv = (0, import_minimist.default)(process.argv.slice(2), {
5525
3007
  alias: {
5526
3008
  typescript: ["ts"],
5527
- "with-tests": ["tests", "cypress"],
3009
+ "with-tests": ["tests"],
5528
3010
  router: ["vue-router"]
5529
3011
  },
5530
3012
  boolean: true
5531
3013
  });
5532
- const isFeatureFlagsUsed = typeof (argv.default || argv.ts || argv.router || argv.pinia || argv.tests) === "boolean";
3014
+ const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.eslint) === "boolean";
5533
3015
  let targetDir = argv._[0];
5534
3016
  const defaultProjectName = !targetDir ? "vue-project" : targetDir;
5535
3017
  const forceOverwrite = argv.force;
@@ -5545,7 +3027,7 @@ async function init() {
5545
3027
  },
5546
3028
  {
5547
3029
  name: "shouldOverwrite",
5548
- type: () => canSafelyOverwrite(targetDir) || forceOverwrite ? null : "confirm",
3030
+ type: () => canSkipEmptying(targetDir) || forceOverwrite ? null : "confirm",
5549
3031
  message: () => {
5550
3032
  const dirForPrompt = targetDir === "." ? "Current directory" : `Target directory "${targetDir}"`;
5551
3033
  return `${dirForPrompt} is not empty. Remove existing files and continue?`;
@@ -5553,7 +3035,7 @@ async function init() {
5553
3035
  },
5554
3036
  {
5555
3037
  name: "overwriteChecker",
5556
- type: (prev, values = {}) => {
3038
+ type: (prev, values) => {
5557
3039
  if (values.shouldOverwrite === false) {
5558
3040
  throw new Error(red("\u2716") + " Operation cancelled");
5559
3041
  }
@@ -5575,6 +3057,14 @@ async function init() {
5575
3057
  active: "Yes",
5576
3058
  inactive: "No"
5577
3059
  },
3060
+ {
3061
+ name: "needsJsx",
3062
+ type: () => isFeatureFlagsUsed ? null : "toggle",
3063
+ message: "Add JSX Support?",
3064
+ initial: false,
3065
+ active: "Yes",
3066
+ inactive: "No"
3067
+ },
5578
3068
  {
5579
3069
  name: "needsRouter",
5580
3070
  type: () => isFeatureFlagsUsed ? null : "toggle",
@@ -5592,9 +3082,38 @@ async function init() {
5592
3082
  inactive: "No"
5593
3083
  },
5594
3084
  {
5595
- name: "needsTests",
3085
+ name: "needsVitest",
3086
+ type: () => isFeatureFlagsUsed ? null : "toggle",
3087
+ message: "Add Vitest for Unit Testing?",
3088
+ initial: false,
3089
+ active: "Yes",
3090
+ inactive: "No"
3091
+ },
3092
+ {
3093
+ name: "needsCypress",
3094
+ type: () => isFeatureFlagsUsed ? null : "toggle",
3095
+ message: (prev, answers) => answers.needsVitest ? "Add Cypress for End-to-End testing?" : "Add Cypress for both Unit and End-to-End testing?",
3096
+ initial: false,
3097
+ active: "Yes",
3098
+ inactive: "No"
3099
+ },
3100
+ {
3101
+ name: "needsEslint",
5596
3102
  type: () => isFeatureFlagsUsed ? null : "toggle",
5597
- message: "Add Cypress for testing?",
3103
+ message: "Add ESLint for code quality?",
3104
+ initial: false,
3105
+ active: "Yes",
3106
+ inactive: "No"
3107
+ },
3108
+ {
3109
+ name: "needsPrettier",
3110
+ type: (prev, values) => {
3111
+ if (isFeatureFlagsUsed || !values.needsEslint) {
3112
+ return null;
3113
+ }
3114
+ return "toggle";
3115
+ },
3116
+ message: "Add Prettier for code formatting?",
5598
3117
  initial: false,
5599
3118
  active: "Yes",
5600
3119
  inactive: "No"
@@ -5609,40 +3128,68 @@ async function init() {
5609
3128
  process.exit(1);
5610
3129
  }
5611
3130
  const {
5612
- packageName = toValidPackageName(defaultProjectName),
5613
- shouldOverwrite,
3131
+ projectName,
3132
+ packageName = projectName ?? defaultProjectName,
3133
+ shouldOverwrite = argv.force,
3134
+ needsJsx = argv.jsx,
5614
3135
  needsTypeScript = argv.typescript,
5615
3136
  needsRouter = argv.router,
5616
3137
  needsPinia = argv.pinia,
5617
- needsTests = argv.tests
3138
+ needsCypress = argv.cypress || argv.tests,
3139
+ needsVitest = argv.vitest || argv.tests,
3140
+ needsEslint = argv.eslint || argv["eslint-with-prettier"],
3141
+ needsPrettier = argv["eslint-with-prettier"]
5618
3142
  } = result;
5619
- const root = import_path3.default.join(cwd, targetDir);
5620
- if (shouldOverwrite) {
3143
+ const needsCypressCT = needsCypress && !needsVitest;
3144
+ const root = path4.join(cwd, targetDir);
3145
+ if (fs4.existsSync(root) && shouldOverwrite) {
5621
3146
  emptyDir(root);
5622
- } else if (!import_fs4.default.existsSync(root)) {
5623
- import_fs4.default.mkdirSync(root);
3147
+ } else if (!fs4.existsSync(root)) {
3148
+ fs4.mkdirSync(root);
5624
3149
  }
5625
3150
  console.log(`
5626
3151
  Scaffolding project in ${root}...`);
5627
3152
  const pkg = { name: packageName, version: "0.0.0" };
5628
- import_fs4.default.writeFileSync(import_path3.default.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
5629
- const templateRoot = import_path3.default.resolve(__dirname, "template");
3153
+ fs4.writeFileSync(path4.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
3154
+ const templateRoot = path4.resolve(__dirname, "template");
5630
3155
  const render = function render2(templateName) {
5631
- const templateDir = import_path3.default.resolve(templateRoot, templateName);
3156
+ const templateDir = path4.resolve(templateRoot, templateName);
5632
3157
  renderTemplate_default(templateDir, root);
5633
3158
  };
5634
3159
  render("base");
3160
+ if (needsJsx) {
3161
+ render("config/jsx");
3162
+ }
5635
3163
  if (needsRouter) {
5636
3164
  render("config/router");
5637
3165
  }
5638
3166
  if (needsPinia) {
5639
3167
  render("config/pinia");
5640
3168
  }
5641
- if (needsTests) {
3169
+ if (needsVitest) {
3170
+ render("config/vitest");
3171
+ }
3172
+ if (needsCypress) {
5642
3173
  render("config/cypress");
5643
3174
  }
3175
+ if (needsCypressCT) {
3176
+ render("config/cypress-ct");
3177
+ }
5644
3178
  if (needsTypeScript) {
5645
3179
  render("config/typescript");
3180
+ render("tsconfig/base");
3181
+ if (needsCypress) {
3182
+ render("tsconfig/cypress");
3183
+ }
3184
+ if (needsCypressCT) {
3185
+ render("tsconfig/cypress-ct");
3186
+ }
3187
+ if (needsVitest) {
3188
+ render("tsconfig/vitest");
3189
+ }
3190
+ }
3191
+ if (needsEslint) {
3192
+ renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier });
5646
3193
  }
5647
3194
  const codeTemplate = (needsTypeScript ? "typescript-" : "") + (needsRouter ? "router" : "default");
5648
3195
  render(`code/${codeTemplate}`);
@@ -5659,39 +3206,48 @@ Scaffolding project in ${root}...`);
5659
3206
  preOrderDirectoryTraverse(root, () => {
5660
3207
  }, (filepath) => {
5661
3208
  if (filepath.endsWith(".js")) {
5662
- import_fs4.default.renameSync(filepath, filepath.replace(/\.js$/, ".ts"));
5663
- } else if (import_path3.default.basename(filepath) === "jsconfig.json") {
5664
- import_fs4.default.renameSync(filepath, filepath.replace(/jsconfig\.json$/, "tsconfig.json"));
3209
+ const tsFilePath = filepath.replace(/\.js$/, ".ts");
3210
+ if (fs4.existsSync(tsFilePath)) {
3211
+ fs4.unlinkSync(filepath);
3212
+ } else {
3213
+ fs4.renameSync(filepath, tsFilePath);
3214
+ }
3215
+ } else if (path4.basename(filepath) === "jsconfig.json") {
3216
+ fs4.unlinkSync(filepath);
5665
3217
  }
5666
3218
  });
5667
- const indexHtmlPath = import_path3.default.resolve(root, "index.html");
5668
- const indexHtmlContent = import_fs4.default.readFileSync(indexHtmlPath, "utf8");
5669
- import_fs4.default.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
5670
- }
5671
- if (!needsTests) {
5672
- preOrderDirectoryTraverse(root, (dirpath) => {
5673
- const dirname = import_path3.default.basename(dirpath);
5674
- if (dirname === "cypress" || dirname === "__tests__") {
5675
- emptyDir(dirpath);
5676
- import_fs4.default.rmdirSync(dirpath);
5677
- }
5678
- }, () => {
3219
+ const indexHtmlPath = path4.resolve(root, "index.html");
3220
+ const indexHtmlContent = fs4.readFileSync(indexHtmlPath, "utf8");
3221
+ fs4.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
3222
+ } else {
3223
+ preOrderDirectoryTraverse(root, () => {
3224
+ }, (filepath) => {
3225
+ if (filepath.endsWith(".ts")) {
3226
+ fs4.unlinkSync(filepath);
3227
+ }
5679
3228
  });
5680
3229
  }
5681
- const packageManager = /pnpm/.test(process.env.npm_execpath) ? "pnpm" : /yarn/.test(process.env.npm_execpath) ? "yarn" : "npm";
5682
- import_fs4.default.writeFileSync(import_path3.default.resolve(root, "README.md"), generateReadme({
5683
- projectName: result.projectName || defaultProjectName,
3230
+ const userAgent = process.env.npm_config_user_agent ?? "";
3231
+ const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npm";
3232
+ fs4.writeFileSync(path4.resolve(root, "README.md"), generateReadme({
3233
+ projectName: result.projectName ?? defaultProjectName,
5684
3234
  packageManager,
5685
3235
  needsTypeScript,
5686
- needsTests
3236
+ needsVitest,
3237
+ needsCypress,
3238
+ needsCypressCT,
3239
+ needsEslint
5687
3240
  }));
5688
3241
  console.log(`
5689
3242
  Done. Now run:
5690
3243
  `);
5691
3244
  if (root !== cwd) {
5692
- console.log(` ${bold(green(`cd ${import_path3.default.relative(cwd, root)}`))}`);
3245
+ console.log(` ${bold(green(`cd ${path4.relative(cwd, root)}`))}`);
5693
3246
  }
5694
3247
  console.log(` ${bold(green(getCommand(packageManager, "install")))}`);
3248
+ if (needsPrettier) {
3249
+ console.log(` ${bold(green(getCommand(packageManager, "lint")))}`);
3250
+ }
5695
3251
  console.log(` ${bold(green(getCommand(packageManager, "dev")))}`);
5696
3252
  console.log();
5697
3253
  }