create-vue 3.22.0 → 3.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -24
- package/README.md +1 -1
- package/bundle.js +459 -1313
- package/locales/en-US.json +0 -8
- package/locales/fr-FR.json +0 -8
- package/locales/tr-TR.json +0 -8
- package/locales/zh-Hans.json +0 -8
- package/locales/zh-Hant.json +0 -8
- package/package.json +11 -22
- package/template/base/package.json +4 -4
- package/template/config/cypress/package.json +1 -1
- package/template/config/cypress-ct/package.json +2 -2
- package/template/config/jsx/package.json +3 -3
- package/template/config/pinia/package.json +1 -1
- package/template/config/router/package.json +2 -2
- package/template/config/typescript/package.json +3 -3
- package/template/config/vitest/package.json +3 -3
- package/template/formatting/oxfmt/package.json +1 -1
- package/template/linting/base/package.json +1 -1
- package/template/linting/core/js/package.json +2 -2
- package/template/linting/core/ts/package.json +2 -2
- package/template/linting/cypress/package.json +1 -1
- package/template/linting/oxlint/package.json +2 -2
- package/template/linting/playwright/package.json +1 -1
- package/template/linting/vitest/package.json +1 -1
- package/template/tsconfig/base/package.json +1 -1
- package/template/tsconfig/base/tsconfig.node.json +0 -1
- package/template/tsconfig/cypress/cypress/tsconfig.json +5 -1
- package/template/tsconfig/vitest/package.json +1 -1
- package/template/bare/nightwatch-ct/src/__tests__/App.spec.js +0 -14
- package/template/config/nightwatch/.vscode/extensions.json +0 -3
- package/template/config/nightwatch/_gitignore +0 -2
- package/template/config/nightwatch/nightwatch/nightwatch.d.ts +0 -13
- package/template/config/nightwatch/nightwatch.conf.cjs +0 -153
- package/template/config/nightwatch/package.json +0 -15
- package/template/config/nightwatch/tests/e2e/example.js +0 -11
- package/template/config/nightwatch/vite.config.js.data.mjs +0 -12
- package/template/config/nightwatch-ct/nightwatch/index.html +0 -16
- package/template/config/nightwatch-ct/package.json +0 -11
- package/template/config/nightwatch-ct/src/components/__tests__/HelloWorld.spec.js +0 -16
- package/template/config/nightwatch-ct/vite.config.js.data.mjs +0 -16
- package/template/tsconfig/nightwatch/nightwatch/tsconfig.json +0 -19
- package/template/tsconfig/nightwatch-ct/tsconfig.app.json +0 -18
package/bundle.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-vue v3.22.
|
|
2
|
+
/*! create-vue v3.22.2 | MIT */
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
|
-
import
|
|
5
|
+
import "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
7
|
-
import
|
|
7
|
+
import "node:path";
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
|
-
import { parseArgs, stripVTControlCharacters } from "node:util";
|
|
9
|
+
import { parseArgs, stripVTControlCharacters, styleText } from "node:util";
|
|
10
10
|
import N, { stdin, stdout } from "node:process";
|
|
11
|
-
import
|
|
11
|
+
import "node:readline";
|
|
12
12
|
import ot from "node:readline";
|
|
13
|
-
import
|
|
13
|
+
import "node:tty";
|
|
14
14
|
import * as path from "path";
|
|
15
|
-
|
|
16
15
|
//#region \0rolldown/runtime.js
|
|
17
16
|
var __create = Object.create;
|
|
18
17
|
var __defProp = Object.defineProperty;
|
|
@@ -22,16 +21,12 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
22
21
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
22
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
24
23
|
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
|
+
key = keys[i];
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
35
30
|
}
|
|
36
31
|
return to;
|
|
37
32
|
};
|
|
@@ -40,79 +35,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
35
|
enumerable: true
|
|
41
36
|
}) : target, mod));
|
|
42
37
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
46
|
-
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
47
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
48
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
49
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
50
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
51
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
52
|
-
};
|
|
53
|
-
let replaceClose = (string, close, replace, index) => {
|
|
54
|
-
let result = "", cursor = 0;
|
|
55
|
-
do {
|
|
56
|
-
result += string.substring(cursor, index) + replace;
|
|
57
|
-
cursor = index + close.length;
|
|
58
|
-
index = string.indexOf(close, cursor);
|
|
59
|
-
} while (~index);
|
|
60
|
-
return result + string.substring(cursor);
|
|
61
|
-
};
|
|
62
|
-
let createColors = (enabled = isColorSupported) => {
|
|
63
|
-
let f = enabled ? formatter : () => String;
|
|
64
|
-
return {
|
|
65
|
-
isColorSupported: enabled,
|
|
66
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
67
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
68
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
69
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
70
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
71
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
72
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
73
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
74
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
75
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
76
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
77
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
78
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
79
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
80
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
81
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
82
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
83
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
84
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
85
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
86
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
87
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
88
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
89
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
90
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
91
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
92
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
93
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
94
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
95
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
96
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
97
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
98
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
99
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
100
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
101
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
102
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
103
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
104
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
105
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
106
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
module.exports = createColors();
|
|
110
|
-
module.exports.createColors = createColors;
|
|
111
|
-
}));
|
|
112
|
-
|
|
113
38
|
//#endregion
|
|
114
|
-
//#region node_modules/.pnpm
|
|
115
|
-
var
|
|
39
|
+
//#region node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
40
|
+
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
116
41
|
const ESC = "\x1B";
|
|
117
42
|
const CSI = `${ESC}[`;
|
|
118
43
|
const beep = "\x07";
|
|
@@ -141,42 +66,35 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
141
66
|
save: `${ESC}7`,
|
|
142
67
|
restore: `${ESC}8`
|
|
143
68
|
};
|
|
144
|
-
const scroll = {
|
|
145
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
146
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
147
|
-
};
|
|
148
|
-
const erase = {
|
|
149
|
-
screen: `${CSI}2J`,
|
|
150
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
151
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
152
|
-
line: `${CSI}2K`,
|
|
153
|
-
lineEnd: `${CSI}K`,
|
|
154
|
-
lineStart: `${CSI}1K`,
|
|
155
|
-
lines(count) {
|
|
156
|
-
let clear = "";
|
|
157
|
-
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
158
|
-
if (count) clear += cursor.left;
|
|
159
|
-
return clear;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
69
|
module.exports = {
|
|
163
70
|
cursor,
|
|
164
|
-
scroll
|
|
165
|
-
|
|
71
|
+
scroll: {
|
|
72
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
73
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
74
|
+
},
|
|
75
|
+
erase: {
|
|
76
|
+
screen: `${CSI}2J`,
|
|
77
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
78
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
79
|
+
line: `${CSI}2K`,
|
|
80
|
+
lineEnd: `${CSI}K`,
|
|
81
|
+
lineStart: `${CSI}1K`,
|
|
82
|
+
lines(count) {
|
|
83
|
+
let clear = "";
|
|
84
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
85
|
+
if (count) clear += cursor.left;
|
|
86
|
+
return clear;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
166
89
|
beep
|
|
167
90
|
};
|
|
168
|
-
}));
|
|
169
|
-
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region node_modules/.pnpm/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
|
|
172
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
173
|
-
var import_src = require_src();
|
|
174
|
-
function B(t, e, s) {
|
|
91
|
+
})))();
|
|
92
|
+
function x$1(t, e, s) {
|
|
175
93
|
if (!s.some((u) => !u.disabled)) return t;
|
|
176
94
|
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
177
|
-
return s[n].disabled ?
|
|
95
|
+
return s[n].disabled ? x$1(n, e < 0 ? -1 : 1, s) : n;
|
|
178
96
|
}
|
|
179
|
-
const at
|
|
97
|
+
const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft$1 = {
|
|
180
98
|
limit: Infinity,
|
|
181
99
|
ellipsis: ""
|
|
182
100
|
}, X$1 = (t, e = {}, s = {}) => {
|
|
@@ -186,9 +104,9 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
186
104
|
if (w > C || o >= p && o > h) {
|
|
187
105
|
const ut = t.slice(C, w) || t.slice(h, o);
|
|
188
106
|
v = 0;
|
|
189
|
-
for (const Y of ut.replaceAll(ct
|
|
107
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
190
108
|
const $ = Y.codePointAt(0) || 0;
|
|
191
|
-
if (lt
|
|
109
|
+
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
192
110
|
F = !0;
|
|
193
111
|
break t;
|
|
194
112
|
}
|
|
@@ -197,12 +115,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
197
115
|
C = w = 0;
|
|
198
116
|
}
|
|
199
117
|
if (o >= p) break;
|
|
200
|
-
if (M
|
|
201
|
-
if (v = M
|
|
118
|
+
if (M.lastIndex = o, M.test(t)) {
|
|
119
|
+
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
202
120
|
F = !0;
|
|
203
121
|
break;
|
|
204
122
|
}
|
|
205
|
-
c += f, C = h, w = o, o = h = M
|
|
123
|
+
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
206
124
|
continue;
|
|
207
125
|
}
|
|
208
126
|
if (O.lastIndex = o, O.test(t)) {
|
|
@@ -249,7 +167,7 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
249
167
|
limit: Infinity,
|
|
250
168
|
ellipsis: "",
|
|
251
169
|
ellipsisWidth: 0
|
|
252
|
-
}, S = (t, e = {}) => X$1(t, pt$1, e).width,
|
|
170
|
+
}, S = (t, e = {}) => X$1(t, pt$1, e).width, T = "\x1B", Z = "", Ft$1 = 39, j = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
|
|
253
171
|
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
254
172
|
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
255
173
|
if (t === 1 || t === 2) return 22;
|
|
@@ -259,12 +177,12 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
259
177
|
if (t === 8) return 28;
|
|
260
178
|
if (t === 9) return 29;
|
|
261
179
|
if (t === 0) return 0;
|
|
262
|
-
}, st
|
|
180
|
+
}, st = (t) => `${T}${Q$1}${t}${tt}`, it = (t) => `${T}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
263
181
|
const i = e[Symbol.iterator]();
|
|
264
182
|
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
265
183
|
for (; !l.done;) {
|
|
266
184
|
const m = l.value, A = S(m);
|
|
267
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m ===
|
|
185
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
268
186
|
}
|
|
269
187
|
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
270
188
|
}, vt$1 = (t) => {
|
|
@@ -304,9 +222,9 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
304
222
|
let m = g.next(), A = g.next(), V = 0;
|
|
305
223
|
for (; !m.done;) {
|
|
306
224
|
const h = m.value, o = A.value;
|
|
307
|
-
if (i += h, h ===
|
|
308
|
-
et
|
|
309
|
-
const F = et
|
|
225
|
+
if (i += h, h === T || h === Z) {
|
|
226
|
+
et.lastIndex = V + 1;
|
|
227
|
+
const F = et.exec(E)?.groups;
|
|
310
228
|
if (F?.code !== void 0) {
|
|
311
229
|
const d = Number.parseFloat(F.code);
|
|
312
230
|
r = d === Ft$1 ? void 0 : d;
|
|
@@ -314,8 +232,8 @@ const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 17
|
|
|
314
232
|
}
|
|
315
233
|
const p = r ? mt$1(r) : void 0;
|
|
316
234
|
o === `
|
|
317
|
-
` ? (n && (i += it
|
|
318
|
-
` && (r && p && (i += st
|
|
235
|
+
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
236
|
+
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
319
237
|
}
|
|
320
238
|
return i;
|
|
321
239
|
};
|
|
@@ -355,7 +273,7 @@ function H$1(t, e) {
|
|
|
355
273
|
for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
|
|
356
274
|
return !1;
|
|
357
275
|
}
|
|
358
|
-
function _t(t, e) {
|
|
276
|
+
function _t$1(t, e) {
|
|
359
277
|
if (t === e) return;
|
|
360
278
|
const s = t.split(`
|
|
361
279
|
`), i = e.split(`
|
|
@@ -368,53 +286,25 @@ function _t(t, e) {
|
|
|
368
286
|
numLines: r
|
|
369
287
|
};
|
|
370
288
|
}
|
|
371
|
-
|
|
289
|
+
globalThis.process.platform.startsWith("win");
|
|
290
|
+
const z$1 = Symbol("clack:cancel");
|
|
372
291
|
function Ct$1(t) {
|
|
373
|
-
return t === z;
|
|
292
|
+
return t === z$1;
|
|
374
293
|
}
|
|
375
|
-
function
|
|
294
|
+
function W$1(t, e) {
|
|
376
295
|
const s = t;
|
|
377
296
|
s.isTTY && s.setRawMode(e);
|
|
378
297
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
output: e,
|
|
383
|
-
prompt: "",
|
|
384
|
-
tabSize: 1
|
|
385
|
-
});
|
|
386
|
-
k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
|
|
387
|
-
const n = (u, { name: a, sequence: l }) => {
|
|
388
|
-
if (H$1([
|
|
389
|
-
String(u),
|
|
390
|
-
a,
|
|
391
|
-
l
|
|
392
|
-
], "cancel")) {
|
|
393
|
-
i && e.write(import_src.cursor.show), process.exit(0);
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
if (!s) return;
|
|
397
|
-
const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
398
|
-
k.moveCursor(e, g, m, () => {
|
|
399
|
-
k.clearLine(e, 1, () => {
|
|
400
|
-
t.once("keypress", n);
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
|
-
};
|
|
404
|
-
return i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
|
|
405
|
-
t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
const rt$1 = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt$1 = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
409
|
-
function xt(t, e, s, i = s) {
|
|
410
|
-
return K$1(e, rt$1(t ?? stdout) - s.length, {
|
|
298
|
+
const rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
299
|
+
function Bt$1(t, e, s, i = s) {
|
|
300
|
+
return K$1(e, rt(t ?? stdout) - s.length, {
|
|
411
301
|
hard: !0,
|
|
412
302
|
trim: !1
|
|
413
303
|
}).split(`
|
|
414
304
|
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
415
305
|
`);
|
|
416
306
|
}
|
|
417
|
-
var
|
|
307
|
+
var B = class {
|
|
418
308
|
input;
|
|
419
309
|
output;
|
|
420
310
|
_abortSignal;
|
|
@@ -457,7 +347,7 @@ var x$1 = class {
|
|
|
457
347
|
prompt() {
|
|
458
348
|
return new Promise((e) => {
|
|
459
349
|
if (this._abortSignal) {
|
|
460
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
|
|
350
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$1);
|
|
461
351
|
this._abortSignal.addEventListener("abort", () => {
|
|
462
352
|
this.state = "cancel", this.close();
|
|
463
353
|
}, { once: !0 });
|
|
@@ -468,10 +358,10 @@ var x$1 = class {
|
|
|
468
358
|
prompt: "",
|
|
469
359
|
escapeCodeTimeout: 50,
|
|
470
360
|
terminal: !0
|
|
471
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
472
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
361
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
362
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(this.value);
|
|
473
363
|
}), this.once("cancel", () => {
|
|
474
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
364
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(z$1);
|
|
475
365
|
});
|
|
476
366
|
});
|
|
477
367
|
}
|
|
@@ -509,7 +399,7 @@ var x$1 = class {
|
|
|
509
399
|
}
|
|
510
400
|
close() {
|
|
511
401
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
512
|
-
`),
|
|
402
|
+
`), W$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
513
403
|
}
|
|
514
404
|
restoreCursor() {
|
|
515
405
|
const e = K$1(this._prevFrame, process.stdout.columns, {
|
|
@@ -527,7 +417,7 @@ var x$1 = class {
|
|
|
527
417
|
if (e !== this._prevFrame) {
|
|
528
418
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
529
419
|
else {
|
|
530
|
-
const s = _t(this._prevFrame, e), i = nt
|
|
420
|
+
const s = _t$1(this._prevFrame, e), i = nt(this.output);
|
|
531
421
|
if (this.restoreCursor(), s) {
|
|
532
422
|
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
533
423
|
let u = s.lines.find((a) => a >= r);
|
|
@@ -561,75 +451,7 @@ var x$1 = class {
|
|
|
561
451
|
}
|
|
562
452
|
}
|
|
563
453
|
};
|
|
564
|
-
|
|
565
|
-
if (t === void 0 || e.length === 0) return 0;
|
|
566
|
-
const s = e.findIndex((i) => i.value === t);
|
|
567
|
-
return s !== -1 ? s : 0;
|
|
568
|
-
}
|
|
569
|
-
function Dt$1(t, e) {
|
|
570
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
571
|
-
}
|
|
572
|
-
function St$1(t, e) {
|
|
573
|
-
if (e) return t ? e : e[0];
|
|
574
|
-
}
|
|
575
|
-
var Vt$1 = class extends x$1 {
|
|
576
|
-
filteredOptions;
|
|
577
|
-
multiple;
|
|
578
|
-
isNavigating = !1;
|
|
579
|
-
selectedValues = [];
|
|
580
|
-
focusedValue;
|
|
581
|
-
#t = 0;
|
|
582
|
-
#s = "";
|
|
583
|
-
#i;
|
|
584
|
-
#e;
|
|
585
|
-
get cursor() {
|
|
586
|
-
return this.#t;
|
|
587
|
-
}
|
|
588
|
-
get userInputWithCursor() {
|
|
589
|
-
if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
590
|
-
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
591
|
-
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
592
|
-
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
593
|
-
}
|
|
594
|
-
get options() {
|
|
595
|
-
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
596
|
-
}
|
|
597
|
-
constructor(e) {
|
|
598
|
-
super(e), this.#e = e.options;
|
|
599
|
-
const s = this.options;
|
|
600
|
-
this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$1;
|
|
601
|
-
let i;
|
|
602
|
-
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
|
|
603
|
-
const n = s.findIndex((u) => u.value === r);
|
|
604
|
-
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
605
|
-
}
|
|
606
|
-
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
607
|
-
}
|
|
608
|
-
_isActionKey(e, s) {
|
|
609
|
-
return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
|
|
610
|
-
}
|
|
611
|
-
#r(e, s) {
|
|
612
|
-
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
613
|
-
i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
|
|
614
|
-
}
|
|
615
|
-
deselectAll() {
|
|
616
|
-
this.selectedValues = [];
|
|
617
|
-
}
|
|
618
|
-
toggleSelected(e) {
|
|
619
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
620
|
-
}
|
|
621
|
-
#n(e) {
|
|
622
|
-
if (e !== this.#s) {
|
|
623
|
-
this.#s = e;
|
|
624
|
-
const s = this.options;
|
|
625
|
-
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
626
|
-
this.#t = B(wt$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
|
|
627
|
-
const r = this.filteredOptions[this.#t];
|
|
628
|
-
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
var kt$1 = class extends x$1 {
|
|
454
|
+
var kt$1 = class extends B {
|
|
633
455
|
get cursor() {
|
|
634
456
|
return this.value ? 0 : 1;
|
|
635
457
|
}
|
|
@@ -646,58 +468,7 @@ var kt$1 = class extends x$1 {
|
|
|
646
468
|
});
|
|
647
469
|
}
|
|
648
470
|
};
|
|
649
|
-
|
|
650
|
-
options;
|
|
651
|
-
cursor = 0;
|
|
652
|
-
#t;
|
|
653
|
-
getGroupItems(e) {
|
|
654
|
-
return this.options.filter((s) => s.group === e);
|
|
655
|
-
}
|
|
656
|
-
isGroupSelected(e) {
|
|
657
|
-
const s = this.getGroupItems(e), i = this.value;
|
|
658
|
-
return i === void 0 ? !1 : s.every((r) => i.includes(r.value));
|
|
659
|
-
}
|
|
660
|
-
toggleValue() {
|
|
661
|
-
const e = this.options[this.cursor];
|
|
662
|
-
if (this.value === void 0 && (this.value = []), e.group === !0) {
|
|
663
|
-
const s = e.value, i = this.getGroupItems(s);
|
|
664
|
-
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
665
|
-
} else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
666
|
-
}
|
|
667
|
-
constructor(e) {
|
|
668
|
-
super(e, !1);
|
|
669
|
-
const { options: s } = e;
|
|
670
|
-
this.#t = e.selectableGroups !== !1, this.options = Object.entries(s).flatMap(([i, r]) => [{
|
|
671
|
-
value: i,
|
|
672
|
-
group: !0,
|
|
673
|
-
label: i
|
|
674
|
-
}, ...r.map((n) => ({
|
|
675
|
-
...n,
|
|
676
|
-
group: i
|
|
677
|
-
}))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
678
|
-
switch (i) {
|
|
679
|
-
case "left":
|
|
680
|
-
case "up": {
|
|
681
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
682
|
-
const r = this.options[this.cursor]?.group === !0;
|
|
683
|
-
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
684
|
-
break;
|
|
685
|
-
}
|
|
686
|
-
case "down":
|
|
687
|
-
case "right": {
|
|
688
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
689
|
-
const r = this.options[this.cursor]?.group === !0;
|
|
690
|
-
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
case "space":
|
|
694
|
-
this.toggleValue();
|
|
695
|
-
break;
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
var Lt$1 = class extends x$1 {
|
|
471
|
+
let Lt$1 = class extends B {
|
|
701
472
|
options;
|
|
702
473
|
cursor = 0;
|
|
703
474
|
get _value() {
|
|
@@ -722,17 +493,17 @@ var Lt$1 = class extends x$1 {
|
|
|
722
493
|
constructor(e) {
|
|
723
494
|
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
724
495
|
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
725
|
-
this.cursor = this.options[s].disabled ?
|
|
496
|
+
this.cursor = this.options[s].disabled ? x$1(s, 1, this.options) : s, this.on("key", (i) => {
|
|
726
497
|
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
727
498
|
}), this.on("cursor", (i) => {
|
|
728
499
|
switch (i) {
|
|
729
500
|
case "left":
|
|
730
501
|
case "up":
|
|
731
|
-
this.cursor =
|
|
502
|
+
this.cursor = x$1(this.cursor, -1, this.options);
|
|
732
503
|
break;
|
|
733
504
|
case "down":
|
|
734
505
|
case "right":
|
|
735
|
-
this.cursor =
|
|
506
|
+
this.cursor = x$1(this.cursor, 1, this.options);
|
|
736
507
|
break;
|
|
737
508
|
case "space":
|
|
738
509
|
this.toggleValue();
|
|
@@ -741,31 +512,7 @@ var Lt$1 = class extends x$1 {
|
|
|
741
512
|
});
|
|
742
513
|
}
|
|
743
514
|
};
|
|
744
|
-
|
|
745
|
-
_mask = "•";
|
|
746
|
-
get cursor() {
|
|
747
|
-
return this._cursor;
|
|
748
|
-
}
|
|
749
|
-
get masked() {
|
|
750
|
-
return this.userInput.replaceAll(/./g, this._mask);
|
|
751
|
-
}
|
|
752
|
-
get userInputWithCursor() {
|
|
753
|
-
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
754
|
-
const e = this.userInput;
|
|
755
|
-
if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
756
|
-
const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
|
|
757
|
-
return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
|
|
758
|
-
}
|
|
759
|
-
clear() {
|
|
760
|
-
this._clearUserInput();
|
|
761
|
-
}
|
|
762
|
-
constructor({ mask: e, ...s }) {
|
|
763
|
-
super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
|
|
764
|
-
this._setValue(i);
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
var Wt$1 = class extends x$1 {
|
|
515
|
+
var Tt$1 = class extends B {
|
|
769
516
|
options;
|
|
770
517
|
cursor = 0;
|
|
771
518
|
get _selectedValue() {
|
|
@@ -777,43 +524,28 @@ var Wt$1 = class extends x$1 {
|
|
|
777
524
|
constructor(e) {
|
|
778
525
|
super(e, !1), this.options = e.options;
|
|
779
526
|
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
780
|
-
this.cursor = this.options[i].disabled ?
|
|
527
|
+
this.cursor = this.options[i].disabled ? x$1(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
781
528
|
switch (r) {
|
|
782
529
|
case "left":
|
|
783
530
|
case "up":
|
|
784
|
-
this.cursor =
|
|
531
|
+
this.cursor = x$1(this.cursor, -1, this.options);
|
|
785
532
|
break;
|
|
786
533
|
case "down":
|
|
787
534
|
case "right":
|
|
788
|
-
this.cursor =
|
|
535
|
+
this.cursor = x$1(this.cursor, 1, this.options);
|
|
789
536
|
break;
|
|
790
537
|
}
|
|
791
538
|
this.changeValue();
|
|
792
539
|
});
|
|
793
540
|
}
|
|
794
541
|
};
|
|
795
|
-
var
|
|
796
|
-
options;
|
|
797
|
-
cursor = 0;
|
|
798
|
-
constructor(e) {
|
|
799
|
-
super(e, !1), this.options = e.options;
|
|
800
|
-
const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
|
|
801
|
-
this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
|
|
802
|
-
if (!r) return;
|
|
803
|
-
const u = s && n.shift ? r.toUpperCase() : r;
|
|
804
|
-
if (!i.includes(u)) return;
|
|
805
|
-
const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
|
|
806
|
-
a && (this.value = a.value, this.state = "submit", this.emit("submit"));
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
|
-
};
|
|
810
|
-
var $t$1 = class extends x$1 {
|
|
542
|
+
var $t = class extends B {
|
|
811
543
|
get userInputWithCursor() {
|
|
812
544
|
if (this.state === "submit") return this.userInput;
|
|
813
545
|
const e = this.userInput;
|
|
814
546
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
815
547
|
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
816
|
-
return `${s}${
|
|
548
|
+
return `${s}${styleText("inverse", i)}${r.join("")}`;
|
|
817
549
|
}
|
|
818
550
|
get cursor() {
|
|
819
551
|
return this._cursor;
|
|
@@ -829,587 +561,340 @@ var $t$1 = class extends x$1 {
|
|
|
829
561
|
});
|
|
830
562
|
}
|
|
831
563
|
};
|
|
832
|
-
|
|
833
564
|
//#endregion
|
|
834
|
-
//#region node_modules/.pnpm/@clack+prompts@1.0
|
|
835
|
-
function
|
|
565
|
+
//#region node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
|
|
566
|
+
function pt() {
|
|
836
567
|
return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
837
568
|
}
|
|
838
|
-
const
|
|
839
|
-
|
|
569
|
+
const ee = pt(), I = (e, r) => ee ? e : r, Re = I("◆", "*"), $e = I("■", "x"), de = I("▲", "x"), V = I("◇", "o"), he = I("┌", "T"), h = I("│", "|"), x = I("└", "—");
|
|
570
|
+
I("┐", "T");
|
|
571
|
+
I("┘", "—");
|
|
572
|
+
const z = I("●", ">"), H = I("○", " "), te = I("◻", "[•]"), U = I("◼", "[+]"), q = I("◻", "[ ]");
|
|
573
|
+
I("▪", "•");
|
|
574
|
+
I("─", "-");
|
|
575
|
+
I("╮", "+");
|
|
576
|
+
I("├", "+");
|
|
577
|
+
I("╯", "+");
|
|
578
|
+
I("╰", "+");
|
|
579
|
+
I("╭", "+");
|
|
580
|
+
const fe = I("●", "•"), Fe = I("◆", "*"), ye = I("▲", "!"), Ee = I("■", "x"), W = (e) => {
|
|
581
|
+
switch (e) {
|
|
840
582
|
case "initial":
|
|
841
|
-
case "active": return
|
|
842
|
-
case "cancel": return
|
|
843
|
-
case "error": return
|
|
844
|
-
case "submit": return
|
|
583
|
+
case "active": return styleText("cyan", Re);
|
|
584
|
+
case "cancel": return styleText("red", $e);
|
|
585
|
+
case "error": return styleText("yellow", de);
|
|
586
|
+
case "submit": return styleText("green", V);
|
|
845
587
|
}
|
|
846
|
-
},
|
|
847
|
-
switch (
|
|
588
|
+
}, ve = (e) => {
|
|
589
|
+
switch (e) {
|
|
848
590
|
case "initial":
|
|
849
|
-
case "active": return
|
|
850
|
-
case "cancel": return
|
|
851
|
-
case "error": return
|
|
852
|
-
case "submit": return
|
|
591
|
+
case "active": return styleText("cyan", h);
|
|
592
|
+
case "cancel": return styleText("red", h);
|
|
593
|
+
case "error": return styleText("yellow", h);
|
|
594
|
+
case "submit": return styleText("green", h);
|
|
853
595
|
}
|
|
854
|
-
},
|
|
596
|
+
}, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, gt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ft = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ft = /\p{M}+/gu, yt = {
|
|
855
597
|
limit: Infinity,
|
|
856
598
|
ellipsis: ""
|
|
857
|
-
},
|
|
858
|
-
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ?
|
|
859
|
-
let $ = 0, m = 0,
|
|
860
|
-
|
|
861
|
-
if (
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
for (const
|
|
865
|
-
const
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
break
|
|
599
|
+
}, Le = (e, r = {}, s = {}) => {
|
|
600
|
+
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
601
|
+
let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
|
|
602
|
+
e: for (;;) {
|
|
603
|
+
if (b > A || m >= d && m > $) {
|
|
604
|
+
const T = e.slice(A, b) || e.slice($, m);
|
|
605
|
+
F = 0;
|
|
606
|
+
for (const M of T.replaceAll(Ft, "")) {
|
|
607
|
+
const O = M.codePointAt(0) || 0;
|
|
608
|
+
if (gt(O) ? S = f : ft(O) ? S = E : c !== g && mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
|
|
609
|
+
y = !0;
|
|
610
|
+
break e;
|
|
869
611
|
}
|
|
870
|
-
|
|
612
|
+
F += M.length, w += S;
|
|
871
613
|
}
|
|
872
|
-
|
|
614
|
+
A = b = 0;
|
|
873
615
|
}
|
|
874
|
-
if (m >=
|
|
875
|
-
if (
|
|
876
|
-
if (
|
|
877
|
-
|
|
616
|
+
if (m >= d) break;
|
|
617
|
+
if (ne.lastIndex = m, ne.test(e)) {
|
|
618
|
+
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
619
|
+
y = !0;
|
|
878
620
|
break;
|
|
879
621
|
}
|
|
880
|
-
|
|
622
|
+
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
881
623
|
continue;
|
|
882
624
|
}
|
|
883
|
-
if (
|
|
884
|
-
if (
|
|
885
|
-
|
|
625
|
+
if (we.lastIndex = m, we.test(e)) {
|
|
626
|
+
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
627
|
+
y = !0;
|
|
886
628
|
break;
|
|
887
629
|
}
|
|
888
|
-
|
|
630
|
+
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
889
631
|
continue;
|
|
890
632
|
}
|
|
891
|
-
if (
|
|
892
|
-
if (
|
|
893
|
-
|
|
633
|
+
if (re.lastIndex = m, re.test(e)) {
|
|
634
|
+
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
635
|
+
y = !0;
|
|
894
636
|
break;
|
|
895
637
|
}
|
|
896
|
-
|
|
638
|
+
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
897
639
|
continue;
|
|
898
640
|
}
|
|
899
|
-
if (
|
|
900
|
-
if (
|
|
901
|
-
|
|
641
|
+
if (ie.lastIndex = m, ie.test(e)) {
|
|
642
|
+
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
643
|
+
y = !0;
|
|
902
644
|
break;
|
|
903
645
|
}
|
|
904
|
-
|
|
646
|
+
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
905
647
|
continue;
|
|
906
648
|
}
|
|
907
|
-
if (
|
|
908
|
-
if (
|
|
909
|
-
|
|
649
|
+
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
650
|
+
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
651
|
+
y = !0;
|
|
910
652
|
break;
|
|
911
653
|
}
|
|
912
|
-
|
|
654
|
+
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
913
655
|
continue;
|
|
914
656
|
}
|
|
915
657
|
m += 1;
|
|
916
658
|
}
|
|
917
659
|
return {
|
|
918
|
-
width:
|
|
919
|
-
index:
|
|
920
|
-
truncated:
|
|
921
|
-
ellipsed:
|
|
660
|
+
width: y ? C : w,
|
|
661
|
+
index: y ? v : d,
|
|
662
|
+
truncated: y,
|
|
663
|
+
ellipsed: y && i >= o
|
|
922
664
|
};
|
|
923
|
-
},
|
|
665
|
+
}, Et = {
|
|
924
666
|
limit: Infinity,
|
|
925
667
|
ellipsis: "",
|
|
926
668
|
ellipsisWidth: 0
|
|
927
|
-
},
|
|
928
|
-
if (
|
|
929
|
-
if (
|
|
930
|
-
if (
|
|
931
|
-
if (
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
934
|
-
if (
|
|
935
|
-
if (
|
|
936
|
-
if (
|
|
937
|
-
},
|
|
669
|
+
}, D = (e, r = {}) => Le(e, Et, r).width, ae = "\x1B", je = "", vt = 39, Ce = "\x07", ke = "[", wt = "]", Ve = "m", Se = `${wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), At = (e) => {
|
|
670
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
671
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
672
|
+
if (e === 1 || e === 2) return 22;
|
|
673
|
+
if (e === 3) return 23;
|
|
674
|
+
if (e === 4) return 24;
|
|
675
|
+
if (e === 7) return 27;
|
|
676
|
+
if (e === 8) return 28;
|
|
677
|
+
if (e === 9) return 29;
|
|
678
|
+
if (e === 0) return 0;
|
|
679
|
+
}, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct = (e) => e.map((r) => D(r)), Ie = (e, r, s) => {
|
|
938
680
|
const i = r[Symbol.iterator]();
|
|
939
|
-
let a = !1, o = !1, u =
|
|
681
|
+
let a = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
|
|
940
682
|
for (; !n.done;) {
|
|
941
|
-
const
|
|
942
|
-
l +
|
|
683
|
+
const f = n.value, g = D(f);
|
|
684
|
+
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
943
685
|
}
|
|
944
|
-
u =
|
|
945
|
-
},
|
|
946
|
-
const r =
|
|
686
|
+
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
687
|
+
}, St = (e) => {
|
|
688
|
+
const r = e.split(" ");
|
|
947
689
|
let s = r.length;
|
|
948
|
-
for (; s > 0 && !(
|
|
949
|
-
return s === r.length ?
|
|
950
|
-
},
|
|
951
|
-
if (s.trim !== !1 &&
|
|
690
|
+
for (; s > 0 && !(D(r[s - 1]) > 0);) s--;
|
|
691
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
692
|
+
}, It = (e, r, s = {}) => {
|
|
693
|
+
if (s.trim !== !1 && e.trim() === "") return "";
|
|
952
694
|
let i = "", a, o;
|
|
953
|
-
const u =
|
|
695
|
+
const u = e.split(" "), l = Ct(u);
|
|
954
696
|
let n = [""];
|
|
955
697
|
for (const [$, m] of u.entries()) {
|
|
956
698
|
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
957
|
-
let
|
|
958
|
-
if ($ !== 0 && (
|
|
959
|
-
const
|
|
960
|
-
Math.floor((l[$] - 1) / r) <
|
|
699
|
+
let d = D(n.at(-1) ?? "");
|
|
700
|
+
if ($ !== 0 && (d >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), d = 0), (d > 0 || s.trim === !1) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
701
|
+
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
702
|
+
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
961
703
|
continue;
|
|
962
704
|
}
|
|
963
|
-
if (
|
|
964
|
-
if (s.wordWrap === !1 &&
|
|
965
|
-
|
|
705
|
+
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
706
|
+
if (s.wordWrap === !1 && d < r) {
|
|
707
|
+
Ie(n, m, r);
|
|
966
708
|
continue;
|
|
967
709
|
}
|
|
968
710
|
n.push("");
|
|
969
711
|
}
|
|
970
|
-
if (
|
|
971
|
-
|
|
712
|
+
if (d + l[$] > r && s.wordWrap === !1) {
|
|
713
|
+
Ie(n, m, r);
|
|
972
714
|
continue;
|
|
973
715
|
}
|
|
974
716
|
n[n.length - 1] += m;
|
|
975
717
|
}
|
|
976
|
-
s.trim !== !1 && (n = n.map(($) =>
|
|
718
|
+
s.trim !== !1 && (n = n.map(($) => St($)));
|
|
977
719
|
const c = n.join(`
|
|
978
|
-
`),
|
|
979
|
-
let
|
|
980
|
-
for (; !
|
|
981
|
-
const $ =
|
|
982
|
-
if (i += $, $ ===
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
if (
|
|
986
|
-
const v = Number.parseFloat(
|
|
987
|
-
a = v ===
|
|
988
|
-
} else
|
|
989
|
-
}
|
|
990
|
-
const
|
|
720
|
+
`), p = c[Symbol.iterator]();
|
|
721
|
+
let f = p.next(), g = p.next(), E = 0;
|
|
722
|
+
for (; !f.done;) {
|
|
723
|
+
const $ = f.value, m = g.value;
|
|
724
|
+
if (i += $, $ === ae || $ === je) {
|
|
725
|
+
He.lastIndex = E + 1;
|
|
726
|
+
const y = He.exec(c)?.groups;
|
|
727
|
+
if (y?.code !== void 0) {
|
|
728
|
+
const v = Number.parseFloat(y.code);
|
|
729
|
+
a = v === vt ? void 0 : v;
|
|
730
|
+
} else y?.uri !== void 0 && (o = y.uri.length === 0 ? void 0 : y.uri);
|
|
731
|
+
}
|
|
732
|
+
const d = a ? At(a) : void 0;
|
|
991
733
|
m === `
|
|
992
|
-
` ? (o && (i +=
|
|
993
|
-
` && (a &&
|
|
734
|
+
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
735
|
+
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
994
736
|
}
|
|
995
737
|
return i;
|
|
996
738
|
};
|
|
997
|
-
function J(
|
|
998
|
-
return String(
|
|
739
|
+
function J(e, r, s) {
|
|
740
|
+
return String(e).normalize().replaceAll(`\r
|
|
999
741
|
`, `
|
|
1000
742
|
`).split(`
|
|
1001
|
-
`).map((i) =>
|
|
743
|
+
`).map((i) => It(i, r, s)).join(`
|
|
1002
744
|
`);
|
|
1003
745
|
}
|
|
1004
|
-
const
|
|
746
|
+
const bt = (e, r, s, i, a) => {
|
|
1005
747
|
let o = r, u = 0;
|
|
1006
748
|
for (let l = s; l < i; l++) {
|
|
1007
|
-
const n =
|
|
749
|
+
const n = e[l];
|
|
1008
750
|
if (o = o - n.length, u++, o <= a) break;
|
|
1009
751
|
}
|
|
1010
752
|
return {
|
|
1011
753
|
lineCount: o,
|
|
1012
754
|
removals: u
|
|
1013
755
|
};
|
|
1014
|
-
}, X = (
|
|
1015
|
-
const
|
|
1016
|
-
let
|
|
1017
|
-
|
|
1018
|
-
let
|
|
1019
|
-
const
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1022
|
-
const
|
|
1023
|
-
for (let A =
|
|
1024
|
-
const
|
|
756
|
+
}, X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
757
|
+
const l = rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
758
|
+
let g = 0;
|
|
759
|
+
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
760
|
+
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
761
|
+
const m = Math.min(g + f, r.length), d = [];
|
|
762
|
+
let F = 0;
|
|
763
|
+
E && F++, $ && F++;
|
|
764
|
+
const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
765
|
+
for (let A = y; A < v; A++) {
|
|
766
|
+
const b = J(s(r[A], A === e), l, {
|
|
1025
767
|
hard: !0,
|
|
1026
768
|
trim: !1
|
|
1027
769
|
}).split(`
|
|
1028
770
|
`);
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
if (
|
|
1032
|
-
let A = 0,
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
for (const A of
|
|
1039
|
-
return
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
return t.label ?? String(t.value ?? "");
|
|
1043
|
-
}
|
|
1044
|
-
function Jt(t, r) {
|
|
1045
|
-
if (!t) return !0;
|
|
1046
|
-
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
|
|
1047
|
-
return s.includes(o) || i.includes(o) || a.includes(o);
|
|
1048
|
-
}
|
|
1049
|
-
function Be(t, r) {
|
|
1050
|
-
const s = [];
|
|
1051
|
-
for (const i of r) t.includes(i.value) && s.push(i);
|
|
1052
|
-
return s;
|
|
1053
|
-
}
|
|
1054
|
-
const Xt = (t) => new Vt$1({
|
|
1055
|
-
options: t.options,
|
|
1056
|
-
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
1057
|
-
initialUserInput: t.initialUserInput,
|
|
1058
|
-
filter: t.filter ?? ((r, s) => Jt(r, s)),
|
|
1059
|
-
signal: t.signal,
|
|
1060
|
-
input: t.input,
|
|
1061
|
-
output: t.output,
|
|
1062
|
-
validate: t.validate,
|
|
1063
|
-
render() {
|
|
1064
|
-
const r = t.withGuide ?? _.withGuide, s = r ? [`${import_picocolors.default.gray(d)}`, `${W(this.state)} ${t.message}`] : [`${W(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
|
|
1065
|
-
const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors.default.dim(` (${n.hint})`) : "";
|
|
1066
|
-
switch (c) {
|
|
1067
|
-
case "active": return `${import_picocolors.default.green(Q)} ${g}${F}`;
|
|
1068
|
-
case "inactive": return `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(g)}`;
|
|
1069
|
-
case "disabled": return `${import_picocolors.default.gray(H)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(g))}`;
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
switch (this.state) {
|
|
1073
|
-
case "submit": {
|
|
1074
|
-
const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors.default.gray(d) : "";
|
|
1075
|
-
return `${s.join(`
|
|
1076
|
-
`)}
|
|
1077
|
-
${g}${c}`;
|
|
1078
|
-
}
|
|
1079
|
-
case "cancel": {
|
|
1080
|
-
const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "", c = r ? import_picocolors.default.gray(d) : "";
|
|
1081
|
-
return `${s.join(`
|
|
1082
|
-
`)}
|
|
1083
|
-
${c}${n}`;
|
|
1084
|
-
}
|
|
1085
|
-
default: {
|
|
1086
|
-
const n = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x) : "";
|
|
1087
|
-
let F = "";
|
|
1088
|
-
if (this.isNavigating || u) {
|
|
1089
|
-
const f = u ? o : i;
|
|
1090
|
-
F = f !== "" ? ` ${import_picocolors.default.dim(f)}` : "";
|
|
1091
|
-
} else F = ` ${this.userInputWithCursor}`;
|
|
1092
|
-
const p = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors.default.yellow(this.error)}`] : [];
|
|
1093
|
-
r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors.default.dim("Search:")}${F}${p}`, ...E, ...$);
|
|
1094
|
-
const h = [`${c}${[
|
|
1095
|
-
`${import_picocolors.default.dim("↑/↓")} to select`,
|
|
1096
|
-
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1097
|
-
`${import_picocolors.default.dim("Type:")} to search`
|
|
1098
|
-
].join(" • ")}`, g], y = this.filteredOptions.length === 0 ? [] : X({
|
|
1099
|
-
cursor: this.cursor,
|
|
1100
|
-
options: this.filteredOptions,
|
|
1101
|
-
columnPadding: r ? 3 : 0,
|
|
1102
|
-
rowPadding: s.length + h.length,
|
|
1103
|
-
style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"),
|
|
1104
|
-
maxItems: t.maxItems,
|
|
1105
|
-
output: t.output
|
|
1106
|
-
});
|
|
1107
|
-
return [
|
|
1108
|
-
...s,
|
|
1109
|
-
...y.map((f) => `${c}${f}`),
|
|
1110
|
-
...h
|
|
1111
|
-
].join(`
|
|
1112
|
-
`);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}).prompt(), xe = (t) => {
|
|
1117
|
-
const r = (i, a, o, u) => {
|
|
1118
|
-
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors.default.green(U) : import_picocolors.default.dim(q);
|
|
1119
|
-
return i.disabled ? `${import_picocolors.default.gray(q)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors.default.dim(n)}`;
|
|
1120
|
-
}, s = new Vt$1({
|
|
1121
|
-
options: t.options,
|
|
1122
|
-
multiple: !0,
|
|
1123
|
-
filter: t.filter ?? ((i, a) => Jt(i, a)),
|
|
1124
|
-
validate: () => {
|
|
1125
|
-
if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
|
|
1126
|
-
},
|
|
1127
|
-
initialValue: t.initialValues,
|
|
1128
|
-
signal: t.signal,
|
|
1129
|
-
input: t.input,
|
|
1130
|
-
output: t.output,
|
|
1131
|
-
render() {
|
|
1132
|
-
const i = `${import_picocolors.default.gray(d)}
|
|
1133
|
-
${W(this.state)} ${t.message}
|
|
1134
|
-
`, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
1135
|
-
switch (this.state) {
|
|
1136
|
-
case "submit": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
1137
|
-
case "cancel": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
|
|
1138
|
-
default: {
|
|
1139
|
-
const g = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, F = [
|
|
1140
|
-
`${import_picocolors.default.dim("↑/↓")} to navigate`,
|
|
1141
|
-
`${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1142
|
-
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1143
|
-
`${import_picocolors.default.dim("Type:")} to search`
|
|
1144
|
-
], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
|
|
1145
|
-
...`${i}${g(d)}`.split(`
|
|
1146
|
-
`),
|
|
1147
|
-
`${g(d)} ${import_picocolors.default.dim("Search:")} ${l}${c}`,
|
|
1148
|
-
...p,
|
|
1149
|
-
...E
|
|
1150
|
-
], m = [`${g(d)} ${F.join(" • ")}`, `${g(x)}`], h = X({
|
|
1151
|
-
cursor: this.cursor,
|
|
1152
|
-
options: this.filteredOptions,
|
|
1153
|
-
style: (y, f) => r(y, f, this.selectedValues, this.focusedValue),
|
|
1154
|
-
maxItems: t.maxItems,
|
|
1155
|
-
output: t.output,
|
|
1156
|
-
rowPadding: $.length + m.length
|
|
1157
|
-
});
|
|
1158
|
-
return [
|
|
1159
|
-
...$,
|
|
1160
|
-
...h.map((y) => `${g(d)} ${y}`),
|
|
1161
|
-
...m
|
|
1162
|
-
].join(`
|
|
1163
|
-
`);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
return s.prompt();
|
|
1169
|
-
}, _e = [
|
|
1170
|
-
Lt,
|
|
1171
|
-
mt,
|
|
1172
|
-
gt,
|
|
1173
|
-
pt
|
|
1174
|
-
], De = [
|
|
1175
|
-
ht,
|
|
1176
|
-
Ot,
|
|
1177
|
-
x,
|
|
1178
|
-
Pt
|
|
1179
|
-
];
|
|
1180
|
-
function Yt(t, r, s, i) {
|
|
1181
|
-
let a = s, o = s;
|
|
1182
|
-
return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
|
|
1183
|
-
}
|
|
1184
|
-
const Te = (t) => t, Me = (t = "", r = "", s) => {
|
|
1185
|
-
const i = s?.output ?? process.stdout, a = rt$1(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = (s?.rounded ? _e : De).map(g), p = g(rt), E = g(d), $ = M(c), m = M(r), h = a - $;
|
|
1186
|
-
let y = Math.floor(a * n) - $;
|
|
1187
|
-
if (s?.width === "auto") {
|
|
1188
|
-
const _ = t.split(`
|
|
1189
|
-
`);
|
|
1190
|
-
let D = m + u * 2;
|
|
1191
|
-
for (const Y of _) {
|
|
1192
|
-
const L = M(Y) + l * 2;
|
|
1193
|
-
L > D && (D = L);
|
|
1194
|
-
}
|
|
1195
|
-
const T = D + o;
|
|
1196
|
-
T < y && (y = T);
|
|
1197
|
-
}
|
|
1198
|
-
y % 2 !== 0 && (y < h ? y++ : y--);
|
|
1199
|
-
const f = y - o, v = f - u * 2, S = m > v ? `${r.slice(0, v - 3)}...` : r, [I, B] = Yt(M(S), f, u, s?.titleAlign), A = J(t, f - l * 2, {
|
|
1200
|
-
hard: !0,
|
|
1201
|
-
trim: !1
|
|
1202
|
-
});
|
|
1203
|
-
i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
|
|
1204
|
-
`);
|
|
1205
|
-
const w = A.split(`
|
|
1206
|
-
`);
|
|
1207
|
-
for (const _ of w) {
|
|
1208
|
-
const [D, T] = Yt(M(_), f, l, s?.contentAlign);
|
|
1209
|
-
i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
|
|
1210
|
-
`);
|
|
1211
|
-
}
|
|
1212
|
-
i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
|
|
1213
|
-
`);
|
|
1214
|
-
}, Re = (t) => {
|
|
1215
|
-
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
771
|
+
d.push(b), F += b.length;
|
|
772
|
+
}
|
|
773
|
+
if (F > p) {
|
|
774
|
+
let A = 0, b = 0, w = F;
|
|
775
|
+
const S = e - y, T = (M, O) => bt(d, w, M, O, p);
|
|
776
|
+
E ? ({lineCount: w, removals: A} = T(0, S), w > p && ({lineCount: w, removals: b} = T(S + 1, d.length))) : ({lineCount: w, removals: b} = T(S + 1, d.length), w > p && ({lineCount: w, removals: A} = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
|
|
777
|
+
}
|
|
778
|
+
const C = [];
|
|
779
|
+
E && C.push(c);
|
|
780
|
+
for (const A of d) for (const b of A) C.push(b);
|
|
781
|
+
return $ && C.push(c), C;
|
|
782
|
+
}, Rt = (e) => {
|
|
783
|
+
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1216
784
|
return new kt$1({
|
|
1217
785
|
active: r,
|
|
1218
786
|
inactive: s,
|
|
1219
|
-
signal:
|
|
1220
|
-
input:
|
|
1221
|
-
output:
|
|
1222
|
-
initialValue:
|
|
787
|
+
signal: e.signal,
|
|
788
|
+
input: e.input,
|
|
789
|
+
output: e.output,
|
|
790
|
+
initialValue: e.initialValue ?? !0,
|
|
1223
791
|
render() {
|
|
1224
|
-
const i =
|
|
1225
|
-
` : ""}${W(this.state)} ${
|
|
792
|
+
const i = e.withGuide ?? _.withGuide, a = `${i ? `${styleText("gray", h)}
|
|
793
|
+
` : ""}${W(this.state)} ${e.message}
|
|
1226
794
|
`, o = this.value ? r : s;
|
|
1227
795
|
switch (this.state) {
|
|
1228
|
-
case "submit": return `${a}${i ? `${
|
|
1229
|
-
case "cancel": return `${a}${i ? `${
|
|
1230
|
-
${
|
|
796
|
+
case "submit": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText("dim", o)}`;
|
|
797
|
+
case "cancel": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText(["strikethrough", "dim"], o)}${i ? `
|
|
798
|
+
${styleText("gray", h)}` : ""}`;
|
|
1231
799
|
default: {
|
|
1232
|
-
const u = i ? `${
|
|
1233
|
-
return `${a}${u}${this.value ? `${
|
|
1234
|
-
${
|
|
1235
|
-
` : ` ${
|
|
800
|
+
const u = i ? `${styleText("cyan", h)} ` : "", l = i ? styleText("cyan", x) : "";
|
|
801
|
+
return `${a}${u}${this.value ? `${styleText("green", z)} ${r}` : `${styleText("dim", H)} ${styleText("dim", r)}`}${e.vertical ? i ? `
|
|
802
|
+
${styleText("cyan", h)} ` : `
|
|
803
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
1236
804
|
${l}
|
|
1237
|
-
`;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}).prompt();
|
|
1242
|
-
}, Oe = async (t, r) => {
|
|
1243
|
-
const s = {}, i = Object.keys(t);
|
|
1244
|
-
for (const a of i) {
|
|
1245
|
-
const o = t[a], u = await o({ results: s })?.catch((l) => {
|
|
1246
|
-
throw l;
|
|
1247
|
-
});
|
|
1248
|
-
if (typeof r?.onCancel == "function" && Ct$1(u)) {
|
|
1249
|
-
s[a] = "canceled", r.onCancel({ results: s });
|
|
1250
|
-
continue;
|
|
1251
|
-
}
|
|
1252
|
-
s[a] = u;
|
|
1253
|
-
}
|
|
1254
|
-
return s;
|
|
1255
|
-
}, Pe = (t) => {
|
|
1256
|
-
const { selectableGroups: r = !0, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
|
|
1257
|
-
const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), F = c && g && g.group === !0, p = c ? r ? `${F ? x : d} ` : " " : "";
|
|
1258
|
-
let E = "";
|
|
1259
|
-
if (s > 0 && !c) {
|
|
1260
|
-
const m = `
|
|
1261
|
-
${import_picocolors.default.cyan(d)}`;
|
|
1262
|
-
E = `${m.repeat(s - 1)}${m} `;
|
|
1263
|
-
}
|
|
1264
|
-
if (u === "active") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.cyan(st)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1265
|
-
if (u === "group-active") return `${E}${p}${import_picocolors.default.cyan(st)} ${import_picocolors.default.dim(n)}`;
|
|
1266
|
-
if (u === "group-active-selected") return `${E}${p}${import_picocolors.default.green(U)} ${import_picocolors.default.dim(n)}`;
|
|
1267
|
-
if (u === "selected") {
|
|
1268
|
-
const m = c || r ? import_picocolors.default.green(U) : "";
|
|
1269
|
-
return `${E}${import_picocolors.default.dim(p)}${m} ${import_picocolors.default.dim(n)}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1270
|
-
}
|
|
1271
|
-
if (u === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}`;
|
|
1272
|
-
if (u === "active-selected") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.green(U)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1273
|
-
if (u === "submitted") return `${import_picocolors.default.dim(n)}`;
|
|
1274
|
-
const $ = c || r ? import_picocolors.default.dim(q) : "";
|
|
1275
|
-
return `${E}${import_picocolors.default.dim(p)}${$} ${import_picocolors.default.dim(n)}`;
|
|
1276
|
-
}, a = t.required ?? !0;
|
|
1277
|
-
return new yt$1({
|
|
1278
|
-
options: t.options,
|
|
1279
|
-
signal: t.signal,
|
|
1280
|
-
input: t.input,
|
|
1281
|
-
output: t.output,
|
|
1282
|
-
initialValues: t.initialValues,
|
|
1283
|
-
required: a,
|
|
1284
|
-
cursorAt: t.cursorAt,
|
|
1285
|
-
selectableGroups: r,
|
|
1286
|
-
validate(o) {
|
|
1287
|
-
if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
1288
|
-
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1289
|
-
},
|
|
1290
|
-
render() {
|
|
1291
|
-
const o = `${import_picocolors.default.gray(d)}
|
|
1292
|
-
${W(this.state)} ${t.message}
|
|
1293
|
-
`, u = this.value ?? [];
|
|
1294
|
-
switch (this.state) {
|
|
1295
|
-
case "submit": {
|
|
1296
|
-
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors.default.dim(", "))}`;
|
|
1297
|
-
return `${o}${import_picocolors.default.gray(d)}${n}`;
|
|
1298
|
-
}
|
|
1299
|
-
case "cancel": {
|
|
1300
|
-
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1301
|
-
return `${o}${import_picocolors.default.gray(d)} ${l.trim() ? `${l}
|
|
1302
|
-
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1303
|
-
}
|
|
1304
|
-
case "error": {
|
|
1305
|
-
const l = this.error.split(`
|
|
1306
|
-
`).map((n, c) => c === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(n)}` : ` ${n}`).join(`
|
|
1307
|
-
`);
|
|
1308
|
-
return `${o}${import_picocolors.default.yellow(d)} ${this.options.map((n, c, g) => {
|
|
1309
|
-
const F = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
|
|
1310
|
-
return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
|
|
1311
|
-
}).join(`
|
|
1312
|
-
${import_picocolors.default.yellow(d)} `)}
|
|
1313
|
-
${l}
|
|
1314
|
-
`;
|
|
1315
|
-
}
|
|
1316
|
-
default: {
|
|
1317
|
-
const l = this.options.map((c, g, F) => {
|
|
1318
|
-
const p = u.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
|
|
1319
|
-
let m = "";
|
|
1320
|
-
return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
|
|
1321
|
-
`) ? " " : ""}${m}`;
|
|
1322
|
-
}).join(`
|
|
1323
|
-
${import_picocolors.default.cyan(d)}`), n = l.startsWith(`
|
|
1324
|
-
`) ? "" : " ";
|
|
1325
|
-
return `${o}${import_picocolors.default.cyan(d)}${n}${l}
|
|
1326
|
-
${import_picocolors.default.cyan(x)}
|
|
1327
805
|
`;
|
|
1328
806
|
}
|
|
1329
807
|
}
|
|
1330
808
|
}
|
|
1331
809
|
}).prompt();
|
|
1332
810
|
}, R = {
|
|
1333
|
-
message: (
|
|
1334
|
-
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "",
|
|
1335
|
-
for (let
|
|
1336
|
-
const
|
|
811
|
+
message: (e = [], { symbol: r = styleText("gray", h), secondarySymbol: s = styleText("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
812
|
+
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
|
|
813
|
+
for (let g = 0; g < a; g++) u.push(n);
|
|
814
|
+
const f = Array.isArray(e) ? e : e.split(`
|
|
1337
815
|
`);
|
|
1338
|
-
if (
|
|
1339
|
-
const [
|
|
1340
|
-
|
|
1341
|
-
for (const $ of E) $.length > 0 ? u.push(`${
|
|
816
|
+
if (f.length > 0) {
|
|
817
|
+
const [g, ...E] = f;
|
|
818
|
+
g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
|
|
819
|
+
for (const $ of E) $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
|
|
1342
820
|
}
|
|
1343
821
|
i.write(`${u.join(`
|
|
1344
822
|
`)}
|
|
1345
823
|
`);
|
|
1346
824
|
},
|
|
1347
|
-
info: (
|
|
1348
|
-
R.message(
|
|
825
|
+
info: (e, r) => {
|
|
826
|
+
R.message(e, {
|
|
1349
827
|
...r,
|
|
1350
|
-
symbol:
|
|
828
|
+
symbol: styleText("blue", fe)
|
|
1351
829
|
});
|
|
1352
830
|
},
|
|
1353
|
-
success: (
|
|
1354
|
-
R.message(
|
|
831
|
+
success: (e, r) => {
|
|
832
|
+
R.message(e, {
|
|
1355
833
|
...r,
|
|
1356
|
-
symbol:
|
|
834
|
+
symbol: styleText("green", Fe)
|
|
1357
835
|
});
|
|
1358
836
|
},
|
|
1359
|
-
step: (
|
|
1360
|
-
R.message(
|
|
837
|
+
step: (e, r) => {
|
|
838
|
+
R.message(e, {
|
|
1361
839
|
...r,
|
|
1362
|
-
symbol:
|
|
840
|
+
symbol: styleText("green", V)
|
|
1363
841
|
});
|
|
1364
842
|
},
|
|
1365
|
-
warn: (
|
|
1366
|
-
R.message(
|
|
843
|
+
warn: (e, r) => {
|
|
844
|
+
R.message(e, {
|
|
1367
845
|
...r,
|
|
1368
|
-
symbol:
|
|
846
|
+
symbol: styleText("yellow", ye)
|
|
1369
847
|
});
|
|
1370
848
|
},
|
|
1371
|
-
warning: (
|
|
1372
|
-
R.warn(
|
|
849
|
+
warning: (e, r) => {
|
|
850
|
+
R.warn(e, r);
|
|
1373
851
|
},
|
|
1374
|
-
error: (
|
|
1375
|
-
R.message(
|
|
852
|
+
error: (e, r) => {
|
|
853
|
+
R.message(e, {
|
|
1376
854
|
...r,
|
|
1377
|
-
symbol:
|
|
855
|
+
symbol: styleText("red", Ee)
|
|
1378
856
|
});
|
|
1379
857
|
}
|
|
1380
|
-
},
|
|
1381
|
-
|
|
858
|
+
}, Nt = (e = "", r) => {
|
|
859
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", x)} ` : "";
|
|
860
|
+
s.write(`${i}${styleText("red", e)}
|
|
1382
861
|
|
|
1383
862
|
`);
|
|
1384
|
-
},
|
|
1385
|
-
|
|
863
|
+
}, Wt = (e = "", r) => {
|
|
864
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", he)} ` : "";
|
|
865
|
+
s.write(`${i}${e}
|
|
1386
866
|
`);
|
|
1387
|
-
},
|
|
1388
|
-
|
|
1389
|
-
${
|
|
867
|
+
}, Gt = (e = "", r) => {
|
|
868
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", h)}
|
|
869
|
+
${styleText("gray", x)} ` : "";
|
|
870
|
+
s.write(`${i}${e}
|
|
1390
871
|
|
|
1391
872
|
`);
|
|
1392
|
-
},
|
|
873
|
+
}, Q = (e, r) => e.split(`
|
|
1393
874
|
`).map((s) => r(s)).join(`
|
|
1394
|
-
`),
|
|
875
|
+
`), Lt = (e) => {
|
|
1395
876
|
const r = (i, a) => {
|
|
1396
877
|
const o = i.label ?? String(i.value);
|
|
1397
|
-
return a === "disabled" ? `${
|
|
1398
|
-
}, s =
|
|
878
|
+
return a === "disabled" ? `${styleText("gray", q)} ${Q(o, (u) => styleText(["strikethrough", "gray"], u))}${i.hint ? ` ${styleText("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", te)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", U)} ${Q(o, (u) => styleText("dim", u))}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q(o, (u) => styleText(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${styleText("green", U)} ${o}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q(o, (u) => styleText("dim", u))}` : `${styleText("dim", q)} ${Q(o, (u) => styleText("dim", u))}`;
|
|
879
|
+
}, s = e.required ?? !0;
|
|
1399
880
|
return new Lt$1({
|
|
1400
|
-
options:
|
|
1401
|
-
signal:
|
|
1402
|
-
input:
|
|
1403
|
-
output:
|
|
1404
|
-
initialValues:
|
|
881
|
+
options: e.options,
|
|
882
|
+
signal: e.signal,
|
|
883
|
+
input: e.input,
|
|
884
|
+
output: e.output,
|
|
885
|
+
initialValues: e.initialValues,
|
|
1405
886
|
required: s,
|
|
1406
|
-
cursorAt:
|
|
887
|
+
cursorAt: e.cursorAt,
|
|
1407
888
|
validate(i) {
|
|
1408
889
|
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
1409
|
-
${
|
|
890
|
+
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
891
|
+
"gray",
|
|
892
|
+
"bgWhite",
|
|
893
|
+
"inverse"
|
|
894
|
+
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1410
895
|
},
|
|
1411
896
|
render() {
|
|
1412
|
-
const i =
|
|
897
|
+
const i = Bt$1(e.output, e.message, `${ve(this.state)} `, `${W(this.state)} `), a = `${styleText("gray", h)}
|
|
1413
898
|
${i}
|
|
1414
899
|
`, o = this.value ?? [], u = (l, n) => {
|
|
1415
900
|
if (l.disabled) return r(l, "disabled");
|
|
@@ -1418,28 +903,28 @@ ${i}
|
|
|
1418
903
|
};
|
|
1419
904
|
switch (this.state) {
|
|
1420
905
|
case "submit": {
|
|
1421
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(
|
|
1422
|
-
return `${a}${
|
|
906
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
907
|
+
return `${a}${Bt$1(e.output, l, `${styleText("gray", h)} `)}`;
|
|
1423
908
|
}
|
|
1424
909
|
case "cancel": {
|
|
1425
|
-
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(
|
|
1426
|
-
if (l.trim() === "") return `${a}${
|
|
1427
|
-
return `${a}${
|
|
1428
|
-
${
|
|
910
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(styleText("dim", ", "));
|
|
911
|
+
if (l.trim() === "") return `${a}${styleText("gray", h)}`;
|
|
912
|
+
return `${a}${Bt$1(e.output, l, `${styleText("gray", h)} `)}
|
|
913
|
+
${styleText("gray", h)}`;
|
|
1429
914
|
}
|
|
1430
915
|
case "error": {
|
|
1431
|
-
const l = `${
|
|
1432
|
-
`).map((
|
|
916
|
+
const l = `${styleText("yellow", h)} `, n = this.error.split(`
|
|
917
|
+
`).map((f, g) => g === 0 ? `${styleText("yellow", x)} ${styleText("yellow", f)}` : ` ${f}`).join(`
|
|
1433
918
|
`), c = a.split(`
|
|
1434
|
-
`).length,
|
|
919
|
+
`).length, p = n.split(`
|
|
1435
920
|
`).length + 1;
|
|
1436
921
|
return `${a}${l}${X({
|
|
1437
|
-
output:
|
|
922
|
+
output: e.output,
|
|
1438
923
|
options: this.options,
|
|
1439
924
|
cursor: this.cursor,
|
|
1440
|
-
maxItems:
|
|
925
|
+
maxItems: e.maxItems,
|
|
1441
926
|
columnPadding: l.length,
|
|
1442
|
-
rowPadding: c +
|
|
927
|
+
rowPadding: c + p,
|
|
1443
928
|
style: u
|
|
1444
929
|
}).join(`
|
|
1445
930
|
${l}`)}
|
|
@@ -1447,228 +932,71 @@ ${n}
|
|
|
1447
932
|
`;
|
|
1448
933
|
}
|
|
1449
934
|
default: {
|
|
1450
|
-
const l = `${
|
|
935
|
+
const l = `${styleText("cyan", h)} `, n = a.split(`
|
|
1451
936
|
`).length;
|
|
1452
937
|
return `${a}${l}${X({
|
|
1453
|
-
output:
|
|
938
|
+
output: e.output,
|
|
1454
939
|
options: this.options,
|
|
1455
940
|
cursor: this.cursor,
|
|
1456
|
-
maxItems:
|
|
941
|
+
maxItems: e.maxItems,
|
|
1457
942
|
columnPadding: l.length,
|
|
1458
943
|
rowPadding: n + 2,
|
|
1459
944
|
style: u
|
|
1460
945
|
}).join(`
|
|
1461
946
|
${l}`)}
|
|
1462
|
-
${
|
|
947
|
+
${styleText("cyan", x)}
|
|
1463
948
|
`;
|
|
1464
949
|
}
|
|
1465
950
|
}
|
|
1466
951
|
}
|
|
1467
952
|
}).prompt();
|
|
1468
|
-
}, Ge = (t) => import_picocolors.default.dim(t), ke = (t, r, s) => {
|
|
1469
|
-
const i = {
|
|
1470
|
-
hard: !0,
|
|
1471
|
-
trim: !1
|
|
1472
|
-
}, a = J(t, r, i).split(`
|
|
1473
|
-
`), o = a.reduce((n, c) => Math.max(M(c), n), 0);
|
|
1474
|
-
return J(t, r - (a.map(s).reduce((n, c) => Math.max(M(c), n), 0) - o), i);
|
|
1475
|
-
}, Ve = (t = "", r = "", s) => {
|
|
1476
|
-
const i = s?.output ?? N.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = [
|
|
1477
|
-
"",
|
|
1478
|
-
...ke(t, rt$1(i) - 6, o).split(`
|
|
1479
|
-
`).map(o),
|
|
1480
|
-
""
|
|
1481
|
-
], l = M(r), n = Math.max(u.reduce((p, E) => {
|
|
1482
|
-
const $ = M(E);
|
|
1483
|
-
return $ > p ? $ : p;
|
|
1484
|
-
}, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d)} ${p}${" ".repeat(n - M(p))}${import_picocolors.default.gray(d)}`).join(`
|
|
1485
|
-
`), g = a ? `${import_picocolors.default.gray(d)}
|
|
1486
|
-
` : "", F = a ? Wt : gt;
|
|
1487
|
-
i.write(`${g}${import_picocolors.default.green(V)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt.repeat(Math.max(n - l - 1, 1)) + mt)}
|
|
1488
|
-
${c}
|
|
1489
|
-
${import_picocolors.default.gray(F + rt.repeat(n + 2) + pt)}
|
|
1490
|
-
`);
|
|
1491
|
-
}, He = (t) => new Mt$1({
|
|
1492
|
-
validate: t.validate,
|
|
1493
|
-
mask: t.mask ?? Nt,
|
|
1494
|
-
signal: t.signal,
|
|
1495
|
-
input: t.input,
|
|
1496
|
-
output: t.output,
|
|
1497
|
-
render() {
|
|
1498
|
-
const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors.default.gray(d)}
|
|
1499
|
-
` : ""}${W(this.state)} ${t.message}
|
|
1500
|
-
`, i = this.userInputWithCursor, a = this.masked;
|
|
1501
|
-
switch (this.state) {
|
|
1502
|
-
case "error": {
|
|
1503
|
-
const o = r ? `${import_picocolors.default.yellow(d)} ` : "", u = r ? `${import_picocolors.default.yellow(x)} ` : "", l = a ?? "";
|
|
1504
|
-
return t.clearOnError && this.clear(), `${s.trim()}
|
|
1505
|
-
${o}${l}
|
|
1506
|
-
${u}${import_picocolors.default.yellow(this.error)}
|
|
1507
|
-
`;
|
|
1508
|
-
}
|
|
1509
|
-
case "submit": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.dim(a) : ""}`;
|
|
1510
|
-
case "cancel": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.strikethrough(import_picocolors.default.dim(a)) : ""}${a && r ? `
|
|
1511
|
-
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1512
|
-
default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${i}
|
|
1513
|
-
${r ? import_picocolors.default.cyan(x) : ""}
|
|
1514
|
-
`;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
}).prompt(), Ue = (t) => {
|
|
1518
|
-
const r = t.validate;
|
|
1519
|
-
return Xt({
|
|
1520
|
-
...t,
|
|
1521
|
-
initialUserInput: t.initialValue ?? t.root ?? process.cwd(),
|
|
1522
|
-
maxItems: 5,
|
|
1523
|
-
validate(s) {
|
|
1524
|
-
if (!Array.isArray(s)) {
|
|
1525
|
-
if (!s) return "Please select a path";
|
|
1526
|
-
if (r) return r(s);
|
|
1527
|
-
}
|
|
1528
|
-
},
|
|
1529
|
-
options() {
|
|
1530
|
-
const s = this.userInput;
|
|
1531
|
-
if (s === "") return [];
|
|
1532
|
-
try {
|
|
1533
|
-
let i;
|
|
1534
|
-
return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((a) => {
|
|
1535
|
-
const o = join(i, a);
|
|
1536
|
-
return {
|
|
1537
|
-
name: a,
|
|
1538
|
-
path: o,
|
|
1539
|
-
isDirectory: lstatSync(o).isDirectory()
|
|
1540
|
-
};
|
|
1541
|
-
}).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
|
|
1542
|
-
} catch {
|
|
1543
|
-
return [];
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
}, Ke = import_picocolors.default.magenta, bt = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et ? [
|
|
1548
|
-
"◒",
|
|
1549
|
-
"◐",
|
|
1550
|
-
"◓",
|
|
1551
|
-
"◑"
|
|
1552
|
-
] : [
|
|
1553
|
-
"•",
|
|
1554
|
-
"o",
|
|
1555
|
-
"O",
|
|
1556
|
-
"0"
|
|
1557
|
-
], delay: u = et ? 80 : 120, signal: l, ...n } = {}) => {
|
|
1558
|
-
const c = ct();
|
|
1559
|
-
let g, F, p = !1, E = !1, $ = "", m, h = performance.now();
|
|
1560
|
-
const y = rt$1(s), f = n?.styleFrame ?? Ke, v = (b) => {
|
|
1561
|
-
const O = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
|
|
1562
|
-
E = b === 1, p && (L(O, b), E && typeof r == "function" && r());
|
|
1563
|
-
}, S = () => v(2), I = () => v(1), B = () => {
|
|
1564
|
-
process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", I), process.on("SIGTERM", I), process.on("exit", v), l && l.addEventListener("abort", I);
|
|
1565
|
-
}, A = () => {
|
|
1566
|
-
process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", I), process.removeListener("SIGTERM", I), process.removeListener("exit", v), l && l.removeEventListener("abort", I);
|
|
1567
|
-
}, w = () => {
|
|
1568
|
-
if (m === void 0) return;
|
|
1569
|
-
c && s.write(`
|
|
1570
|
-
`);
|
|
1571
|
-
const b = J(m, y, {
|
|
1572
|
-
hard: !0,
|
|
1573
|
-
trim: !1
|
|
1574
|
-
}).split(`
|
|
1575
|
-
`);
|
|
1576
|
-
b.length > 1 && s.write(import_src.cursor.up(b.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1577
|
-
}, _$1 = (b) => b.replace(/\.+$/, ""), D = (b) => {
|
|
1578
|
-
const O = (performance.now() - b) / 1e3, j = Math.floor(O / 60), G = Math.floor(O % 60);
|
|
1579
|
-
return j > 0 ? `[${j}m ${G}s]` : `[${G}s]`;
|
|
1580
|
-
}, T = n.withGuide ?? _.withGuide, Y = (b = "") => {
|
|
1581
|
-
p = !0, g = Bt({ output: s }), $ = _$1(b), h = performance.now(), T && s.write(`${import_picocolors.default.gray(d)}
|
|
1582
|
-
`);
|
|
1583
|
-
let O = 0, j = 0;
|
|
1584
|
-
B(), F = setInterval(() => {
|
|
1585
|
-
if (c && $ === m) return;
|
|
1586
|
-
w(), m = $;
|
|
1587
|
-
const G = f(o[O]);
|
|
1588
|
-
let tt;
|
|
1589
|
-
if (c) tt = `${G} ${$}...`;
|
|
1590
|
-
else if (t === "timer") tt = `${G} ${$} ${D(h)}`;
|
|
1591
|
-
else {
|
|
1592
|
-
const te = ".".repeat(Math.floor(j)).slice(0, 3);
|
|
1593
|
-
tt = `${G} ${$}${te}`;
|
|
1594
|
-
}
|
|
1595
|
-
const Zt = J(tt, y, {
|
|
1596
|
-
hard: !0,
|
|
1597
|
-
trim: !1
|
|
1598
|
-
});
|
|
1599
|
-
s.write(Zt), O = O + 1 < o.length ? O + 1 : 0, j = j < 4 ? j + .125 : 0;
|
|
1600
|
-
}, u);
|
|
1601
|
-
}, L = (b = "", O = 0, j = !1) => {
|
|
1602
|
-
if (!p) return;
|
|
1603
|
-
p = !1, clearInterval(F), w();
|
|
1604
|
-
const G = O === 0 ? import_picocolors.default.green(V) : O === 1 ? import_picocolors.default.red(dt) : import_picocolors.default.red($t);
|
|
1605
|
-
$ = b ?? $, j || (t === "timer" ? s.write(`${G} ${$} ${D(h)}
|
|
1606
|
-
`) : s.write(`${G} ${$}
|
|
1607
|
-
`)), A(), g();
|
|
1608
|
-
};
|
|
1609
|
-
return {
|
|
1610
|
-
start: Y,
|
|
1611
|
-
stop: (b = "") => L(b, 0),
|
|
1612
|
-
message: (b = "") => {
|
|
1613
|
-
$ = _$1(b ?? $);
|
|
1614
|
-
},
|
|
1615
|
-
cancel: (b = "") => L(b, 1),
|
|
1616
|
-
error: (b = "") => L(b, 2),
|
|
1617
|
-
clear: () => L("", 0, !0),
|
|
1618
|
-
get isCancelled() {
|
|
1619
|
-
return E;
|
|
1620
|
-
}
|
|
1621
|
-
};
|
|
1622
|
-
}, zt = {
|
|
1623
|
-
light: C("─", "-"),
|
|
1624
|
-
heavy: C("━", "="),
|
|
1625
|
-
block: C("█", "#")
|
|
1626
953
|
};
|
|
1627
|
-
|
|
1628
|
-
|
|
954
|
+
I("─", "-"), I("━", "="), I("█", "#");
|
|
955
|
+
const oe = (e, r) => e.includes(`
|
|
956
|
+
`) ? e.split(`
|
|
1629
957
|
`).map((s) => r(s)).join(`
|
|
1630
|
-
`) : r(
|
|
958
|
+
`) : r(e), Jt = (e) => {
|
|
1631
959
|
const r = (s, i) => {
|
|
1632
960
|
const a = s.label ?? String(s.value);
|
|
1633
961
|
switch (i) {
|
|
1634
|
-
case "disabled": return `${
|
|
1635
|
-
case "selected": return `${
|
|
1636
|
-
case "active": return `${
|
|
1637
|
-
case "cancelled": return `${
|
|
1638
|
-
default: return `${
|
|
962
|
+
case "disabled": return `${styleText("gray", H)} ${oe(a, (o) => styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
963
|
+
case "selected": return `${oe(a, (o) => styleText("dim", o))}`;
|
|
964
|
+
case "active": return `${styleText("green", z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
965
|
+
case "cancelled": return `${oe(a, (o) => styleText(["strikethrough", "dim"], o))}`;
|
|
966
|
+
default: return `${styleText("dim", H)} ${oe(a, (o) => styleText("dim", o))}`;
|
|
1639
967
|
}
|
|
1640
968
|
};
|
|
1641
|
-
return new
|
|
1642
|
-
options:
|
|
1643
|
-
signal:
|
|
1644
|
-
input:
|
|
1645
|
-
output:
|
|
1646
|
-
initialValue:
|
|
969
|
+
return new Tt$1({
|
|
970
|
+
options: e.options,
|
|
971
|
+
signal: e.signal,
|
|
972
|
+
input: e.input,
|
|
973
|
+
output: e.output,
|
|
974
|
+
initialValue: e.initialValue,
|
|
1647
975
|
render() {
|
|
1648
|
-
const s =
|
|
976
|
+
const s = e.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${ve(this.state)} `, o = Bt$1(e.output, e.message, a, i), u = `${s ? `${styleText("gray", h)}
|
|
1649
977
|
` : ""}${o}
|
|
1650
978
|
`;
|
|
1651
979
|
switch (this.state) {
|
|
1652
980
|
case "submit": {
|
|
1653
|
-
const l = s ? `${
|
|
1654
|
-
return `${u}${
|
|
981
|
+
const l = s ? `${styleText("gray", h)} ` : "";
|
|
982
|
+
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "selected"), l)}`;
|
|
1655
983
|
}
|
|
1656
984
|
case "cancel": {
|
|
1657
|
-
const l = s ? `${
|
|
1658
|
-
return `${u}${
|
|
1659
|
-
${
|
|
985
|
+
const l = s ? `${styleText("gray", h)} ` : "";
|
|
986
|
+
return `${u}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
|
|
987
|
+
${styleText("gray", h)}` : ""}`;
|
|
1660
988
|
}
|
|
1661
989
|
default: {
|
|
1662
|
-
const l = s ? `${
|
|
1663
|
-
`).length,
|
|
990
|
+
const l = s ? `${styleText("cyan", h)} ` : "", n = s ? styleText("cyan", x) : "", c = u.split(`
|
|
991
|
+
`).length, p = s ? 2 : 1;
|
|
1664
992
|
return `${u}${l}${X({
|
|
1665
|
-
output:
|
|
993
|
+
output: e.output,
|
|
1666
994
|
cursor: this.cursor,
|
|
1667
995
|
options: this.options,
|
|
1668
|
-
maxItems:
|
|
996
|
+
maxItems: e.maxItems,
|
|
1669
997
|
columnPadding: l.length,
|
|
1670
|
-
rowPadding: c +
|
|
1671
|
-
style: (
|
|
998
|
+
rowPadding: c + p,
|
|
999
|
+
style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
|
|
1672
1000
|
}).join(`
|
|
1673
1001
|
${l}`)}
|
|
1674
1002
|
${n}
|
|
@@ -1677,228 +1005,132 @@ ${n}
|
|
|
1677
1005
|
}
|
|
1678
1006
|
}
|
|
1679
1007
|
}).prompt();
|
|
1680
|
-
},
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
return i === "selected" ? `${import_picocolors.default.dim(a)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1684
|
-
};
|
|
1685
|
-
return new Tt$1({
|
|
1686
|
-
options: t.options,
|
|
1687
|
-
signal: t.signal,
|
|
1688
|
-
input: t.input,
|
|
1689
|
-
output: t.output,
|
|
1690
|
-
initialValue: t.initialValue,
|
|
1691
|
-
caseSensitive: t.caseSensitive,
|
|
1692
|
-
render() {
|
|
1693
|
-
const s = t.withGuide ?? _.withGuide, i = `${s ? `${import_picocolors.default.gray(d)}
|
|
1694
|
-
` : ""}${W(this.state)} ${t.message}
|
|
1695
|
-
`;
|
|
1696
|
-
switch (this.state) {
|
|
1697
|
-
case "submit": {
|
|
1698
|
-
const a = s ? `${import_picocolors.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0];
|
|
1699
|
-
return `${i}${xt(t.output, r(o, "selected"), a)}`;
|
|
1700
|
-
}
|
|
1701
|
-
case "cancel": {
|
|
1702
|
-
const a = s ? `${import_picocolors.default.gray(d)} ` : "";
|
|
1703
|
-
return `${i}${xt(t.output, r(this.options[0], "cancelled"), a)}${s ? `
|
|
1704
|
-
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1705
|
-
}
|
|
1706
|
-
default: {
|
|
1707
|
-
const a = s ? `${import_picocolors.default.cyan(d)} ` : "", o = s ? import_picocolors.default.cyan(x) : "";
|
|
1708
|
-
return `${i}${this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
|
|
1709
|
-
`)}
|
|
1710
|
-
${o}
|
|
1711
|
-
`;
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
}).prompt();
|
|
1716
|
-
}, Qt = `${import_picocolors.default.gray(d)} `, K = {
|
|
1717
|
-
message: async (t, { symbol: r = import_picocolors.default.gray(d) } = {}) => {
|
|
1718
|
-
process.stdout.write(`${import_picocolors.default.gray(d)}
|
|
1008
|
+
}, Qe = `${styleText("gray", h)} `, K = {
|
|
1009
|
+
message: async (e, { symbol: r = styleText("gray", h) } = {}) => {
|
|
1010
|
+
process.stdout.write(`${styleText("gray", h)}
|
|
1719
1011
|
${r} `);
|
|
1720
1012
|
let s = 3;
|
|
1721
|
-
for await (let i of
|
|
1013
|
+
for await (let i of e) {
|
|
1722
1014
|
i = i.replace(/\n/g, `
|
|
1723
|
-
${
|
|
1015
|
+
${Qe}`), i.includes(`
|
|
1724
1016
|
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1725
1017
|
`))).length);
|
|
1726
1018
|
const a = stripVTControlCharacters(i).length;
|
|
1727
1019
|
s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
|
|
1728
|
-
${
|
|
1020
|
+
${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1729
1021
|
}
|
|
1730
1022
|
process.stdout.write(`
|
|
1731
1023
|
`);
|
|
1732
1024
|
},
|
|
1733
|
-
info: (
|
|
1734
|
-
success: (
|
|
1735
|
-
step: (
|
|
1736
|
-
warn: (
|
|
1737
|
-
warning: (
|
|
1738
|
-
error: (
|
|
1739
|
-
},
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}, ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe = (t) => {
|
|
1748
|
-
const r = t.output ?? process.stdout, s = rt$1(r), i = import_picocolors.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === !0, l = !ct() && Mt(r);
|
|
1749
|
-
r.write(`${i}
|
|
1750
|
-
`), r.write(`${import_picocolors.default.green(V)} ${t.title}
|
|
1751
|
-
`);
|
|
1752
|
-
for (let h = 0; h < a; h++) r.write(`${i}
|
|
1753
|
-
`);
|
|
1754
|
-
const n = [{
|
|
1755
|
-
value: "",
|
|
1756
|
-
full: ""
|
|
1757
|
-
}];
|
|
1758
|
-
let c = !1;
|
|
1759
|
-
const g = (h) => {
|
|
1760
|
-
if (n.length === 0) return;
|
|
1761
|
-
let y = 0;
|
|
1762
|
-
h && (y += a + 2);
|
|
1763
|
-
for (const f of n) {
|
|
1764
|
-
const { value: v, result: S } = f;
|
|
1765
|
-
let I = S?.message ?? v;
|
|
1766
|
-
if (I.length === 0) continue;
|
|
1767
|
-
S === void 0 && f.header !== void 0 && f.header !== "" && (I += `
|
|
1768
|
-
${f.header}`);
|
|
1769
|
-
const B = I.split(`
|
|
1770
|
-
`).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
|
|
1771
|
-
y += B;
|
|
1772
|
-
}
|
|
1773
|
-
y > 0 && (y += 1, r.write(import_src.erase.lines(y)));
|
|
1774
|
-
}, F = (h, y, f) => {
|
|
1775
|
-
const v = f ? `${h.full}
|
|
1776
|
-
${h.value}` : h.value;
|
|
1777
|
-
h.header !== void 0 && h.header !== "" && R.message(h.header.split(`
|
|
1778
|
-
`).map(import_picocolors.default.bold), {
|
|
1779
|
-
output: r,
|
|
1780
|
-
secondarySymbol: i,
|
|
1781
|
-
symbol: i,
|
|
1782
|
-
spacing: 0
|
|
1783
|
-
}), R.message(v.split(`
|
|
1784
|
-
`).map(import_picocolors.default.dim), {
|
|
1785
|
-
output: r,
|
|
1786
|
-
secondarySymbol: i,
|
|
1787
|
-
symbol: i,
|
|
1788
|
-
spacing: y ?? a
|
|
1789
|
-
});
|
|
1790
|
-
}, p = () => {
|
|
1791
|
-
for (const h of n) {
|
|
1792
|
-
const { header: y, value: f, full: v } = h;
|
|
1793
|
-
(y === void 0 || y.length === 0) && f.length === 0 || F(h, void 0, u === !0 && v.length > 0);
|
|
1794
|
-
}
|
|
1795
|
-
}, E = (h, y, f) => {
|
|
1796
|
-
if (g(!1), (f?.raw !== !0 || !c) && h.value !== "" && (h.value += `
|
|
1797
|
-
`), h.value += ze(y), c = f?.raw === !0, t.limit !== void 0) {
|
|
1798
|
-
const v = h.value.split(`
|
|
1799
|
-
`), S = v.length - t.limit;
|
|
1800
|
-
if (S > 0) {
|
|
1801
|
-
const I = v.splice(0, S);
|
|
1802
|
-
u && (h.full += (h.full === "" ? "" : `
|
|
1803
|
-
`) + I.join(`
|
|
1804
|
-
`));
|
|
1805
|
-
}
|
|
1806
|
-
h.value = v.join(`
|
|
1807
|
-
`);
|
|
1808
|
-
}
|
|
1809
|
-
l && $();
|
|
1810
|
-
}, $ = () => {
|
|
1811
|
-
for (const h of n) h.result ? h.result.status === "error" ? R.error(h.result.message, {
|
|
1812
|
-
output: r,
|
|
1813
|
-
secondarySymbol: i,
|
|
1814
|
-
spacing: 0
|
|
1815
|
-
}) : R.success(h.result.message, {
|
|
1816
|
-
output: r,
|
|
1817
|
-
secondarySymbol: i,
|
|
1818
|
-
spacing: 0
|
|
1819
|
-
}) : h.value !== "" && F(h, 0);
|
|
1820
|
-
}, m = (h, y) => {
|
|
1821
|
-
g(!1), h.result = y, l && $();
|
|
1822
|
-
};
|
|
1823
|
-
return {
|
|
1824
|
-
message(h, y) {
|
|
1825
|
-
E(n[0], h, y);
|
|
1826
|
-
},
|
|
1827
|
-
group(h) {
|
|
1828
|
-
const y = {
|
|
1829
|
-
header: h,
|
|
1830
|
-
value: "",
|
|
1831
|
-
full: ""
|
|
1832
|
-
};
|
|
1833
|
-
return n.push(y), {
|
|
1834
|
-
message(f, v) {
|
|
1835
|
-
E(y, f, v);
|
|
1836
|
-
},
|
|
1837
|
-
error(f) {
|
|
1838
|
-
m(y, {
|
|
1839
|
-
status: "error",
|
|
1840
|
-
message: f
|
|
1841
|
-
});
|
|
1842
|
-
},
|
|
1843
|
-
success(f) {
|
|
1844
|
-
m(y, {
|
|
1845
|
-
status: "success",
|
|
1846
|
-
message: f
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
};
|
|
1850
|
-
},
|
|
1851
|
-
error(h, y) {
|
|
1852
|
-
g(!0), R.error(h, {
|
|
1853
|
-
output: r,
|
|
1854
|
-
secondarySymbol: i,
|
|
1855
|
-
spacing: 1
|
|
1856
|
-
}), y?.showLog !== !1 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1857
|
-
},
|
|
1858
|
-
success(h, y) {
|
|
1859
|
-
g(!0), R.success(h, {
|
|
1860
|
-
output: r,
|
|
1861
|
-
secondarySymbol: i,
|
|
1862
|
-
spacing: 1
|
|
1863
|
-
}), y?.showLog === !0 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1864
|
-
}
|
|
1865
|
-
};
|
|
1866
|
-
}, Ze = (t) => new $t$1({
|
|
1867
|
-
validate: t.validate,
|
|
1868
|
-
placeholder: t.placeholder,
|
|
1869
|
-
defaultValue: t.defaultValue,
|
|
1870
|
-
initialValue: t.initialValue,
|
|
1871
|
-
output: t.output,
|
|
1872
|
-
signal: t.signal,
|
|
1873
|
-
input: t.input,
|
|
1025
|
+
info: (e) => K.message(e, { symbol: styleText("blue", fe) }),
|
|
1026
|
+
success: (e) => K.message(e, { symbol: styleText("green", Fe) }),
|
|
1027
|
+
step: (e) => K.message(e, { symbol: styleText("green", V) }),
|
|
1028
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", ye) }),
|
|
1029
|
+
warning: (e) => K.warn(e),
|
|
1030
|
+
error: (e) => K.message(e, { symbol: styleText("red", Ee) })
|
|
1031
|
+
}, Zt = (e) => new $t({
|
|
1032
|
+
validate: e.validate,
|
|
1033
|
+
placeholder: e.placeholder,
|
|
1034
|
+
defaultValue: e.defaultValue,
|
|
1035
|
+
initialValue: e.initialValue,
|
|
1036
|
+
output: e.output,
|
|
1037
|
+
signal: e.signal,
|
|
1038
|
+
input: e.input,
|
|
1874
1039
|
render() {
|
|
1875
|
-
const r =
|
|
1876
|
-
` : ""}${W(this.state)} `}${
|
|
1877
|
-
`, i =
|
|
1040
|
+
const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${styleText("gray", h)}
|
|
1041
|
+
` : ""}${W(this.state)} `}${e.message}
|
|
1042
|
+
`, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1878
1043
|
switch (this.state) {
|
|
1879
1044
|
case "error": {
|
|
1880
|
-
const u = this.error ? ` ${
|
|
1045
|
+
const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", h)} ` : "", n = r ? styleText("yellow", x) : "";
|
|
1881
1046
|
return `${s.trim()}
|
|
1882
1047
|
${l}${a}
|
|
1883
1048
|
${n}${u}
|
|
1884
1049
|
`;
|
|
1885
1050
|
}
|
|
1886
1051
|
case "submit": {
|
|
1887
|
-
const u = o ? ` ${
|
|
1888
|
-
return `${s}${r ?
|
|
1052
|
+
const u = o ? ` ${styleText("dim", o)}` : "";
|
|
1053
|
+
return `${s}${r ? styleText("gray", h) : ""}${u}`;
|
|
1889
1054
|
}
|
|
1890
1055
|
case "cancel": {
|
|
1891
|
-
const u = o ? ` ${
|
|
1056
|
+
const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h) : "";
|
|
1892
1057
|
return `${s}${l}${u}${o.trim() ? `
|
|
1893
1058
|
${l}` : ""}`;
|
|
1894
1059
|
}
|
|
1895
|
-
default: return `${s}${r ? `${
|
|
1896
|
-
${r ?
|
|
1060
|
+
default: return `${s}${r ? `${styleText("cyan", h)} ` : ""}${a}
|
|
1061
|
+
${r ? styleText("cyan", x) : ""}
|
|
1897
1062
|
`;
|
|
1898
1063
|
}
|
|
1899
1064
|
}
|
|
1900
1065
|
}).prompt();
|
|
1901
|
-
|
|
1066
|
+
//#endregion
|
|
1067
|
+
//#region node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
1068
|
+
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1069
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
1070
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
1071
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
1072
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1073
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1074
|
+
};
|
|
1075
|
+
let replaceClose = (string, close, replace, index) => {
|
|
1076
|
+
let result = "", cursor = 0;
|
|
1077
|
+
do {
|
|
1078
|
+
result += string.substring(cursor, index) + replace;
|
|
1079
|
+
cursor = index + close.length;
|
|
1080
|
+
index = string.indexOf(close, cursor);
|
|
1081
|
+
} while (~index);
|
|
1082
|
+
return result + string.substring(cursor);
|
|
1083
|
+
};
|
|
1084
|
+
let createColors = (enabled = isColorSupported) => {
|
|
1085
|
+
let f = enabled ? formatter : () => String;
|
|
1086
|
+
return {
|
|
1087
|
+
isColorSupported: enabled,
|
|
1088
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
1089
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1090
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1091
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1092
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1093
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1094
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1095
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1096
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
1097
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
1098
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
1099
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1100
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1101
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1102
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1103
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
1104
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1105
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1106
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1107
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1108
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1109
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1110
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1111
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1112
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1113
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1114
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1115
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1116
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1117
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1118
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1119
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1120
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1121
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1122
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1123
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1124
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1125
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1126
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1127
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1128
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
module.exports = createColors();
|
|
1132
|
+
module.exports.createColors = createColors;
|
|
1133
|
+
}));
|
|
1902
1134
|
//#endregion
|
|
1903
1135
|
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/utils.js
|
|
1904
1136
|
/**
|
|
@@ -2075,7 +1307,6 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2075
1307
|
return o;
|
|
2076
1308
|
};
|
|
2077
1309
|
}));
|
|
2078
|
-
|
|
2079
1310
|
//#endregion
|
|
2080
1311
|
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/package.json
|
|
2081
1312
|
var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2114,7 +1345,6 @@ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2114
1345
|
"scripts": { "test": "npx jake test" }
|
|
2115
1346
|
};
|
|
2116
1347
|
}));
|
|
2117
|
-
|
|
2118
1348
|
//#endregion
|
|
2119
1349
|
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/ejs.js
|
|
2120
1350
|
var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2782,13 +2012,12 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2782
2012
|
/* istanbul ignore if */
|
|
2783
2013
|
if (typeof window != "undefined") window.ejs = exports;
|
|
2784
2014
|
}));
|
|
2785
|
-
|
|
2786
2015
|
//#endregion
|
|
2787
2016
|
//#region utils/banners.ts
|
|
2017
|
+
var import_picocolors = require_picocolors();
|
|
2788
2018
|
var import_ejs = /* @__PURE__ */ __toESM(require_ejs(), 1);
|
|
2789
2019
|
const defaultBanner = "Vue.js - The Progressive JavaScript Framework";
|
|
2790
2020
|
const gradientBanner = "\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";
|
|
2791
|
-
|
|
2792
2021
|
//#endregion
|
|
2793
2022
|
//#region utils/deepMerge.ts
|
|
2794
2023
|
const isObject = (val) => val && typeof val === "object";
|
|
@@ -2808,7 +2037,6 @@ function deepMerge(target, obj) {
|
|
|
2808
2037
|
}
|
|
2809
2038
|
return target;
|
|
2810
2039
|
}
|
|
2811
|
-
|
|
2812
2040
|
//#endregion
|
|
2813
2041
|
//#region utils/sortDependencies.ts
|
|
2814
2042
|
function sortDependencies(packageJson) {
|
|
@@ -2829,7 +2057,6 @@ function sortDependencies(packageJson) {
|
|
|
2829
2057
|
...sorted
|
|
2830
2058
|
};
|
|
2831
2059
|
}
|
|
2832
|
-
|
|
2833
2060
|
//#endregion
|
|
2834
2061
|
//#region utils/renderTemplate.ts
|
|
2835
2062
|
/**
|
|
@@ -2881,7 +2108,6 @@ function renderTemplate(src, dest, callbacks) {
|
|
|
2881
2108
|
}
|
|
2882
2109
|
fs.copyFileSync(src, dest);
|
|
2883
2110
|
}
|
|
2884
|
-
|
|
2885
2111
|
//#endregion
|
|
2886
2112
|
//#region utils/directoryTraverse.ts
|
|
2887
2113
|
function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
|
|
@@ -2912,7 +2138,6 @@ function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
|
|
|
2912
2138
|
fileCallback(fullpath);
|
|
2913
2139
|
}
|
|
2914
2140
|
}
|
|
2915
|
-
|
|
2916
2141
|
//#endregion
|
|
2917
2142
|
//#region utils/getCommand.ts
|
|
2918
2143
|
function getCommand(packageManager, scriptName, args) {
|
|
@@ -2921,7 +2146,6 @@ function getCommand(packageManager, scriptName, args) {
|
|
|
2921
2146
|
if (args) return packageManager === "npm" ? `npm run ${scriptName} -- ${args}` : `${packageManager} ${scriptName} ${args}`;
|
|
2922
2147
|
else return packageManager === "npm" ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
|
|
2923
2148
|
}
|
|
2924
|
-
|
|
2925
2149
|
//#endregion
|
|
2926
2150
|
//#region utils/generateReadme.ts
|
|
2927
2151
|
const sfcTypeSupportDoc = [
|
|
@@ -2931,7 +2155,7 @@ const sfcTypeSupportDoc = [
|
|
|
2931
2155
|
"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 [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.",
|
|
2932
2156
|
""
|
|
2933
2157
|
].join("\n");
|
|
2934
|
-
function generateReadme({ projectName, packageManager, needsTypeScript, needsCypress,
|
|
2158
|
+
function generateReadme({ projectName, packageManager, needsTypeScript, needsCypress, needsCypressCT, needsPlaywright, needsVitest, needsEslint }) {
|
|
2935
2159
|
const commandFor = (scriptName, args) => getCommand(packageManager, scriptName, args);
|
|
2936
2160
|
let readme = `# ${projectName}
|
|
2937
2161
|
|
|
@@ -2957,10 +2181,8 @@ See [Vite Configuration Reference](https://vite.dev/config/).
|
|
|
2957
2181
|
## Project Setup
|
|
2958
2182
|
|
|
2959
2183
|
`;
|
|
2960
|
-
let installCommand = commandFor("install");
|
|
2961
|
-
if (packageManager === "pnpm" && needsNightwatch) installCommand += `\npnpm approve-builds # for pnpm 10+`;
|
|
2962
2184
|
let npmScriptsDescriptions = `\`\`\`sh
|
|
2963
|
-
${
|
|
2185
|
+
${commandFor("install")}
|
|
2964
2186
|
\`\`\`
|
|
2965
2187
|
|
|
2966
2188
|
### Compile and Hot-Reload for Development
|
|
@@ -3005,31 +2227,6 @@ But it's still recommended to test the production build with \`test:e2e\` before
|
|
|
3005
2227
|
${commandFor("build")}
|
|
3006
2228
|
${commandFor("test:e2e")}
|
|
3007
2229
|
\`\`\`
|
|
3008
|
-
`;
|
|
3009
|
-
if (needsNightwatch) npmScriptsDescriptions += `
|
|
3010
|
-
### Run End-to-End Tests with [Nightwatch](https://nightwatchjs.org/)
|
|
3011
|
-
|
|
3012
|
-
\`\`\`sh
|
|
3013
|
-
# When using CI, the project must be built first.
|
|
3014
|
-
${commandFor("build")}
|
|
3015
|
-
|
|
3016
|
-
# Runs the end-to-end tests
|
|
3017
|
-
${commandFor("test:e2e")}
|
|
3018
|
-
# Runs the tests only on Chrome
|
|
3019
|
-
${commandFor("test:e2e", "--env chrome")}
|
|
3020
|
-
# Runs the tests of a specific file
|
|
3021
|
-
${commandFor("test:e2e", `tests/e2e/example.${needsTypeScript ? "ts" : "js"}`)}
|
|
3022
|
-
# Runs the tests in debug mode
|
|
3023
|
-
${commandFor("test:e2e", "--debug")}
|
|
3024
|
-
\`\`\`
|
|
3025
|
-
`;
|
|
3026
|
-
if (needsNightwatchCT) npmScriptsDescriptions += `
|
|
3027
|
-
### Run Headed Component Tests with [Nightwatch Component Testing](https://nightwatchjs.org/guide/component-testing/introduction.html)
|
|
3028
|
-
|
|
3029
|
-
\`\`\`sh
|
|
3030
|
-
${commandFor("test:unit")}
|
|
3031
|
-
${commandFor("test:unit -- --headless # for headless testing")}
|
|
3032
|
-
\`\`\`
|
|
3033
2230
|
`;
|
|
3034
2231
|
if (needsPlaywright) npmScriptsDescriptions += `
|
|
3035
2232
|
### Run End-to-End Tests with [Playwright](https://playwright.dev)
|
|
@@ -3061,7 +2258,6 @@ ${commandFor("lint")}
|
|
|
3061
2258
|
readme += npmScriptsDescriptions;
|
|
3062
2259
|
return readme;
|
|
3063
2260
|
}
|
|
3064
|
-
|
|
3065
2261
|
//#endregion
|
|
3066
2262
|
//#region utils/getLanguage.ts
|
|
3067
2263
|
/**
|
|
@@ -3108,7 +2304,6 @@ async function getLanguage(localesRoot) {
|
|
|
3108
2304
|
const fallbackPath = path$1.resolve(localesRoot, "en-US.json");
|
|
3109
2305
|
return fs.existsSync(languageFilePath) ? await loadLanguageFile(languageFilePath) : await loadLanguageFile(fallbackPath);
|
|
3110
2306
|
}
|
|
3111
|
-
|
|
3112
2307
|
//#endregion
|
|
3113
2308
|
//#region utils/trimBoilerplate.ts
|
|
3114
2309
|
function replaceContent(filepath, replacer) {
|
|
@@ -3136,7 +2331,6 @@ function emptyRouterConfig(rootDir, needsTypeScript) {
|
|
|
3136
2331
|
const srcDir = path.resolve(rootDir, "src");
|
|
3137
2332
|
replaceContent(path.resolve(srcDir, needsTypeScript ? "router/index.ts" : "router/index.js"), (content) => content.replace(`import HomeView from '../views/HomeView.vue'\n`, "").replace(/routes:\s*\[[\s\S]*?\],/, "routes: [],"));
|
|
3138
2333
|
}
|
|
3139
|
-
|
|
3140
2334
|
//#endregion
|
|
3141
2335
|
//#region utils/applyVueBeta.ts
|
|
3142
2336
|
const CORE_VUE_PACKAGES = [
|
|
@@ -3191,7 +2385,6 @@ peerDependencyRules:
|
|
|
3191
2385
|
fs.writeFileSync(path$1.resolve(root, "pnpm-workspace.yaml"), yamlContent, "utf-8");
|
|
3192
2386
|
}
|
|
3193
2387
|
}
|
|
3194
|
-
|
|
3195
2388
|
//#endregion
|
|
3196
2389
|
//#region utils/packageManager.ts
|
|
3197
2390
|
/**
|
|
@@ -3216,12 +2409,10 @@ function getPackageManagerOptions(preferred) {
|
|
|
3216
2409
|
"bun"
|
|
3217
2410
|
].filter((pm) => pm !== preferred)];
|
|
3218
2411
|
}
|
|
3219
|
-
|
|
3220
2412
|
//#endregion
|
|
3221
2413
|
//#region package.json
|
|
3222
2414
|
var name = "create-vue";
|
|
3223
|
-
var version = "3.22.
|
|
3224
|
-
|
|
2415
|
+
var version = "3.22.2";
|
|
3225
2416
|
//#endregion
|
|
3226
2417
|
//#region index.ts
|
|
3227
2418
|
const language = await getLanguage(fileURLToPath(new URL("./locales", import.meta.url)));
|
|
@@ -3237,14 +2428,12 @@ const FEATURE_FLAGS = [
|
|
|
3237
2428
|
"with-tests",
|
|
3238
2429
|
"vitest",
|
|
3239
2430
|
"cypress",
|
|
3240
|
-
"nightwatch",
|
|
3241
2431
|
"playwright",
|
|
3242
2432
|
"eslint",
|
|
3243
2433
|
"prettier",
|
|
3244
2434
|
"eslint-with-prettier",
|
|
3245
2435
|
"oxlint",
|
|
3246
2436
|
"oxfmt",
|
|
3247
|
-
"vite-beta",
|
|
3248
2437
|
"vue-beta"
|
|
3249
2438
|
];
|
|
3250
2439
|
const FEATURE_OPTIONS = [
|
|
@@ -3277,20 +2466,13 @@ const FEATURE_OPTIONS = [
|
|
|
3277
2466
|
label: language.needsPrettier.message
|
|
3278
2467
|
}
|
|
3279
2468
|
];
|
|
3280
|
-
const EXPERIMENTAL_FEATURE_OPTIONS = [
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
label: language.needsViteBeta.message
|
|
3288
|
-
},
|
|
3289
|
-
{
|
|
3290
|
-
value: "vue-beta",
|
|
3291
|
-
label: language.needsVueBeta.message
|
|
3292
|
-
}
|
|
3293
|
-
];
|
|
2469
|
+
const EXPERIMENTAL_FEATURE_OPTIONS = [{
|
|
2470
|
+
value: "oxfmt",
|
|
2471
|
+
label: language.needsOxfmt.message
|
|
2472
|
+
}, {
|
|
2473
|
+
value: "vue-beta",
|
|
2474
|
+
label: language.needsVueBeta.message
|
|
2475
|
+
}];
|
|
3294
2476
|
function isValidPackageName(projectName) {
|
|
3295
2477
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
3296
2478
|
}
|
|
@@ -3314,7 +2496,7 @@ function emptyDir(dir) {
|
|
|
3314
2496
|
async function unwrapPrompt(maybeCancelPromise) {
|
|
3315
2497
|
const result = await maybeCancelPromise;
|
|
3316
2498
|
if (Ct$1(result)) {
|
|
3317
|
-
|
|
2499
|
+
Nt((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
3318
2500
|
process.exit(0);
|
|
3319
2501
|
}
|
|
3320
2502
|
return result;
|
|
@@ -3353,17 +2535,12 @@ Available feature flags:
|
|
|
3353
2535
|
If used without ${(0, import_picocolors.cyan)("--vitest")}, it will also add Cypress Component Testing.
|
|
3354
2536
|
--playwright
|
|
3355
2537
|
Add Playwright for end-to-end testing.
|
|
3356
|
-
--nightwatch
|
|
3357
|
-
Add Nightwatch for end-to-end testing.
|
|
3358
|
-
If used without ${(0, import_picocolors.cyan)("--vitest")}, it will also add Nightwatch Component Testing.
|
|
3359
2538
|
--eslint
|
|
3360
2539
|
Add ESLint for code quality.
|
|
3361
2540
|
--prettier
|
|
3362
2541
|
Add Prettier for code formatting.
|
|
3363
2542
|
--oxfmt
|
|
3364
2543
|
Add Oxfmt for code formatting.
|
|
3365
|
-
--vite-beta
|
|
3366
|
-
Use Vite 8 Beta instead of Vite for building the project.
|
|
3367
2544
|
--vue-beta
|
|
3368
2545
|
Use Vue 3.6 Beta. Requires specifying a package manager in interactive mode.
|
|
3369
2546
|
|
|
@@ -3377,8 +2554,6 @@ Deprecated feature flags:
|
|
|
3377
2554
|
Please use ${(0, import_picocolors.cyan)("--eslint --prettier")} instead.
|
|
3378
2555
|
--oxlint
|
|
3379
2556
|
Oxlint is now always included when ESLint is selected.
|
|
3380
|
-
--rolldown-vite
|
|
3381
|
-
Please use ${(0, import_picocolors.cyan)("--vite-beta")} instead.
|
|
3382
2557
|
`;
|
|
3383
2558
|
async function init() {
|
|
3384
2559
|
const cwd = process.cwd();
|
|
@@ -3418,62 +2593,54 @@ async function init() {
|
|
|
3418
2593
|
experimentFeatures: [],
|
|
3419
2594
|
needsBareboneTemplates: false
|
|
3420
2595
|
};
|
|
3421
|
-
|
|
3422
|
-
if (!targetDir) targetDir = result.projectName = result.packageName = (await unwrapPrompt(
|
|
2596
|
+
Wt(process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner);
|
|
2597
|
+
if (!targetDir) targetDir = result.projectName = result.packageName = (await unwrapPrompt(Zt({
|
|
3423
2598
|
message: language.projectName.message,
|
|
3424
2599
|
placeholder: defaultProjectName,
|
|
3425
2600
|
defaultValue: defaultProjectName,
|
|
3426
|
-
validate: (value) => value
|
|
3427
|
-
})))
|
|
2601
|
+
validate: (value) => !value || value.trim().length > 0 ? void 0 : language.projectName.invalidMessage
|
|
2602
|
+
})))?.trim() || defaultProjectName;
|
|
3428
2603
|
if (!canSkipEmptying(targetDir) && !forceOverwrite) {
|
|
3429
|
-
result.shouldOverwrite = await unwrapPrompt(
|
|
2604
|
+
result.shouldOverwrite = await unwrapPrompt(Rt({
|
|
3430
2605
|
message: `${targetDir === "." ? language.shouldOverwrite.dirForPrompts.current : `${language.shouldOverwrite.dirForPrompts.target} "${targetDir}"`} ${language.shouldOverwrite.message}`,
|
|
3431
2606
|
initialValue: false
|
|
3432
2607
|
}));
|
|
3433
2608
|
if (!result.shouldOverwrite) {
|
|
3434
|
-
|
|
2609
|
+
Nt((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
3435
2610
|
process.exit(0);
|
|
3436
2611
|
}
|
|
3437
2612
|
}
|
|
3438
|
-
if (!isValidPackageName(targetDir)) result.packageName = await unwrapPrompt(
|
|
2613
|
+
if (!isValidPackageName(targetDir)) result.packageName = await unwrapPrompt(Zt({
|
|
3439
2614
|
message: language.packageName.message,
|
|
3440
2615
|
initialValue: toValidPackageName(targetDir),
|
|
3441
2616
|
validate: (value) => isValidPackageName(value) ? void 0 : language.packageName.invalidMessage
|
|
3442
2617
|
}));
|
|
3443
2618
|
if (!isFeatureFlagsUsed) {
|
|
3444
|
-
result.needsTypeScript = await unwrapPrompt(
|
|
2619
|
+
result.needsTypeScript = await unwrapPrompt(Rt({
|
|
3445
2620
|
message: language.needsTypeScript.message,
|
|
3446
2621
|
initialValue: true
|
|
3447
2622
|
}));
|
|
3448
|
-
result.features = await unwrapPrompt(
|
|
2623
|
+
result.features = await unwrapPrompt(Lt({
|
|
3449
2624
|
message: `${language.featureSelection.message} ${(0, import_picocolors.dim)(language.featureSelection.hint)}`,
|
|
3450
2625
|
options: FEATURE_OPTIONS,
|
|
3451
2626
|
required: false
|
|
3452
2627
|
}));
|
|
3453
2628
|
if (result.features.includes("e2e")) {
|
|
3454
2629
|
const hasVitest = result.features.includes("vitest");
|
|
3455
|
-
result.e2eFramework = await unwrapPrompt(
|
|
2630
|
+
result.e2eFramework = await unwrapPrompt(Jt({
|
|
3456
2631
|
message: `${language.e2eSelection.message} ${(0, import_picocolors.dim)(language.e2eSelection.hint)}`,
|
|
3457
|
-
options: [
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
hint: hasVitest ? language.e2eSelection.selectOptions.cypress.desc : language.e2eSelection.selectOptions.cypress.hintOnComponentTesting
|
|
3467
|
-
},
|
|
3468
|
-
{
|
|
3469
|
-
value: "nightwatch",
|
|
3470
|
-
label: language.e2eSelection.selectOptions.nightwatch.title,
|
|
3471
|
-
hint: hasVitest ? language.e2eSelection.selectOptions.nightwatch.desc : language.e2eSelection.selectOptions.nightwatch.hintOnComponentTesting
|
|
3472
|
-
}
|
|
3473
|
-
]
|
|
2632
|
+
options: [{
|
|
2633
|
+
value: "playwright",
|
|
2634
|
+
label: language.e2eSelection.selectOptions.playwright.title,
|
|
2635
|
+
hint: language.e2eSelection.selectOptions.playwright.desc
|
|
2636
|
+
}, {
|
|
2637
|
+
value: "cypress",
|
|
2638
|
+
label: language.e2eSelection.selectOptions.cypress.title,
|
|
2639
|
+
hint: hasVitest ? language.e2eSelection.selectOptions.cypress.desc : language.e2eSelection.selectOptions.cypress.hintOnComponentTesting
|
|
2640
|
+
}]
|
|
3474
2641
|
}));
|
|
3475
2642
|
}
|
|
3476
|
-
result.experimentFeatures = await unwrapPrompt(
|
|
2643
|
+
result.experimentFeatures = await unwrapPrompt(Lt({
|
|
3477
2644
|
message: `${language.needsExperimentalFeatures.message} ${(0, import_picocolors.dim)(language.needsExperimentalFeatures.hint)}`,
|
|
3478
2645
|
options: EXPERIMENTAL_FEATURE_OPTIONS,
|
|
3479
2646
|
required: false
|
|
@@ -3483,14 +2650,14 @@ async function init() {
|
|
|
3483
2650
|
value: pm,
|
|
3484
2651
|
label: pm
|
|
3485
2652
|
}));
|
|
3486
|
-
result.packageManager = await unwrapPrompt(
|
|
2653
|
+
result.packageManager = await unwrapPrompt(Jt({
|
|
3487
2654
|
message: `${language.packageManagerSelection.message} ${(0, import_picocolors.dim)(language.packageManagerSelection.hint)}`,
|
|
3488
2655
|
options: packageManagerOptions
|
|
3489
2656
|
}));
|
|
3490
2657
|
}
|
|
3491
2658
|
}
|
|
3492
2659
|
if (argv.bare) result.needsBareboneTemplates = true;
|
|
3493
|
-
else if (!isFeatureFlagsUsed) result.needsBareboneTemplates = await unwrapPrompt(
|
|
2660
|
+
else if (!isFeatureFlagsUsed) result.needsBareboneTemplates = await unwrapPrompt(Rt({
|
|
3494
2661
|
message: language.needsBareboneTemplates.message,
|
|
3495
2662
|
initialValue: false
|
|
3496
2663
|
}));
|
|
@@ -3499,17 +2666,14 @@ async function init() {
|
|
|
3499
2666
|
const needsJsx = argv.jsx || features.includes("jsx");
|
|
3500
2667
|
const needsRouter = argv.router || argv["vue-router"] || features.includes("router");
|
|
3501
2668
|
const needsPinia = argv.pinia || features.includes("pinia");
|
|
3502
|
-
const needsVitest = argv.vitest || argv.tests || features.includes("vitest");
|
|
2669
|
+
const needsVitest = argv.vitest || argv.tests || argv["with-tests"] || features.includes("vitest");
|
|
3503
2670
|
const needsEslint = argv.eslint || argv["eslint-with-prettier"] || features.includes("eslint");
|
|
3504
2671
|
const needsPrettier = argv.prettier || argv["eslint-with-prettier"] || features.includes("prettier");
|
|
3505
2672
|
const needsOxfmt = experimentFeatures.includes("oxfmt") || argv["oxfmt"];
|
|
3506
|
-
const needsViteBeta = experimentFeatures.includes("vite-beta") || argv["vite-beta"] || argv["rolldown-vite"];
|
|
3507
2673
|
const needsVueBeta = experimentFeatures.includes("vue-beta") || argv["vue-beta"];
|
|
3508
2674
|
const { e2eFramework } = result;
|
|
3509
|
-
const needsCypress = argv.cypress || argv.tests || e2eFramework === "cypress";
|
|
2675
|
+
const needsCypress = argv.cypress || argv.tests || argv["with-tests"] || e2eFramework === "cypress";
|
|
3510
2676
|
const needsCypressCT = needsCypress && !needsVitest;
|
|
3511
|
-
const needsNightwatch = argv.nightwatch || e2eFramework === "nightwatch";
|
|
3512
|
-
const needsNightwatchCT = needsNightwatch && !needsVitest;
|
|
3513
2677
|
const needsPlaywright = argv.playwright || e2eFramework === "playwright";
|
|
3514
2678
|
const root = path$1.join(cwd, targetDir);
|
|
3515
2679
|
if (fs.existsSync(root) && result.shouldOverwrite) emptyDir(root);
|
|
@@ -3525,12 +2689,6 @@ async function init() {
|
|
|
3525
2689
|
const render = function render(templateName) {
|
|
3526
2690
|
renderTemplate(path$1.resolve(templateRoot, templateName), root, callbacks);
|
|
3527
2691
|
};
|
|
3528
|
-
const replaceVite = () => {
|
|
3529
|
-
const content = fs.readFileSync(path$1.resolve(root, "package.json"), "utf-8");
|
|
3530
|
-
const json = JSON.parse(content);
|
|
3531
|
-
json.devDependencies.vite = "beta";
|
|
3532
|
-
fs.writeFileSync(path$1.resolve(root, "package.json"), JSON.stringify(json, null, 2));
|
|
3533
|
-
};
|
|
3534
2692
|
render("base");
|
|
3535
2693
|
if (needsJsx) render("config/jsx");
|
|
3536
2694
|
if (needsRouter) render("config/router");
|
|
@@ -3538,8 +2696,6 @@ async function init() {
|
|
|
3538
2696
|
if (needsVitest) render("config/vitest");
|
|
3539
2697
|
if (needsCypress) render("config/cypress");
|
|
3540
2698
|
if (needsCypressCT) render("config/cypress-ct");
|
|
3541
|
-
if (needsNightwatch) render("config/nightwatch");
|
|
3542
|
-
if (needsNightwatchCT) render("config/nightwatch-ct");
|
|
3543
2699
|
if (needsPlaywright) render("config/playwright");
|
|
3544
2700
|
if (needsTypeScript) {
|
|
3545
2701
|
render("config/typescript");
|
|
@@ -3558,11 +2714,6 @@ async function init() {
|
|
|
3558
2714
|
render("tsconfig/vitest");
|
|
3559
2715
|
rootTsConfig.references.push({ path: "./tsconfig.vitest.json" });
|
|
3560
2716
|
}
|
|
3561
|
-
if (needsNightwatch) {
|
|
3562
|
-
render("tsconfig/nightwatch");
|
|
3563
|
-
rootTsConfig.references.push({ path: "./nightwatch/tsconfig.json" });
|
|
3564
|
-
}
|
|
3565
|
-
if (needsNightwatchCT) render("tsconfig/nightwatch-ct");
|
|
3566
2717
|
fs.writeFileSync(path$1.resolve(root, "tsconfig.json"), JSON.stringify(rootTsConfig, null, 2) + "\n", "utf-8");
|
|
3567
2718
|
}
|
|
3568
2719
|
if (needsEslint) {
|
|
@@ -3585,7 +2736,6 @@ async function init() {
|
|
|
3585
2736
|
}
|
|
3586
2737
|
if (needsOxfmt) render("formatting/oxfmt");
|
|
3587
2738
|
else if (needsPrettier) render("formatting/prettier");
|
|
3588
|
-
if (needsViteBeta) replaceVite();
|
|
3589
2739
|
render(`code/${(needsTypeScript ? "typescript-" : "") + (needsRouter ? "router" : "default")}`);
|
|
3590
2740
|
if (needsPinia && needsRouter) render("entry/router-and-pinia");
|
|
3591
2741
|
else if (needsPinia) render("entry/pinia");
|
|
@@ -3608,7 +2758,6 @@ async function init() {
|
|
|
3608
2758
|
if (needsTypeScript) render("bare/typescript");
|
|
3609
2759
|
if (needsVitest) render("bare/vitest");
|
|
3610
2760
|
if (needsCypressCT) render("bare/cypress-ct");
|
|
3611
|
-
if (needsNightwatchCT) render("bare/nightwatch-ct");
|
|
3612
2761
|
}
|
|
3613
2762
|
if (needsTypeScript) {
|
|
3614
2763
|
preOrderDirectoryTraverse(root, () => {}, (filepath) => {
|
|
@@ -3641,9 +2790,7 @@ async function init() {
|
|
|
3641
2790
|
needsTypeScript,
|
|
3642
2791
|
needsVitest,
|
|
3643
2792
|
needsCypress,
|
|
3644
|
-
needsNightwatch,
|
|
3645
2793
|
needsPlaywright,
|
|
3646
|
-
needsNightwatchCT,
|
|
3647
2794
|
needsCypressCT,
|
|
3648
2795
|
needsEslint
|
|
3649
2796
|
}));
|
|
@@ -3659,12 +2806,11 @@ async function init() {
|
|
|
3659
2806
|
${(0, import_picocolors.dim)("|")} ${language.infos.optionalGitCommand}
|
|
3660
2807
|
|
|
3661
2808
|
${(0, import_picocolors.bold)((0, import_picocolors.green)("git init && git add -A && git commit -m \"initial commit\""))}`;
|
|
3662
|
-
|
|
2809
|
+
Gt(outroMessage);
|
|
3663
2810
|
}
|
|
3664
2811
|
init().catch((e) => {
|
|
3665
2812
|
console.error(e);
|
|
3666
2813
|
process.exit(1);
|
|
3667
2814
|
});
|
|
3668
|
-
|
|
3669
2815
|
//#endregion
|
|
3670
|
-
export {
|
|
2816
|
+
export {};
|