vite-plus 0.1.16-alpha.3 → 0.1.16
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 +59 -0
- package/dist/{agent-_Qy0g_lF.js → agent-E1Gv83vW.js} +511 -319
- package/dist/bin.js +7 -6
- package/dist/config/bin.js +1 -1
- package/dist/create/bin.js +12 -12
- package/dist/migration/bin.js +7 -7
- package/dist/staged/bin.js +4 -4
- package/dist/versions.js +2 -2
- package/dist/{workspace-CR7saZlK.js → workspace-DIiBk5nk.js} +3 -3
- package/package.json +13 -13
- package/skills/vite-plus/docs/guide/index.md +4 -4
- package/skills/vite-plus/docs/guide/troubleshooting.md +33 -0
- package/templates/monorepo/_yarnrc.yml +1 -1
|
@@ -10,12 +10,331 @@ import { downloadPackageManager, mergeJsonConfig, mergeTsdownConfig, rewriteEsli
|
|
|
10
10
|
import fs from "node:fs";
|
|
11
11
|
import { styleText } from "node:util";
|
|
12
12
|
import process$1, { stdin, stdout } from "node:process";
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
13
|
+
import * as _ from "node:readline";
|
|
14
|
+
import P from "node:readline";
|
|
15
15
|
import { ReadStream } from "node:tty";
|
|
16
16
|
import fsPromises from "node:fs/promises";
|
|
17
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
18
|
+
const isAmbiguous$1 = (x) => {
|
|
19
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
20
|
+
};
|
|
21
|
+
const isFullWidth$1 = (x) => {
|
|
22
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
23
|
+
};
|
|
24
|
+
const isWide$1 = (x) => {
|
|
25
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
26
|
+
};
|
|
17
27
|
//#endregion
|
|
18
|
-
//#region ../../node_modules/.pnpm
|
|
28
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
29
|
+
const ANSI_RE$1 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
30
|
+
const CONTROL_RE$1 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
31
|
+
const TAB_RE$1 = /\t{1,1000}/y;
|
|
32
|
+
const EMOJI_RE$1 = /[\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;
|
|
33
|
+
const LATIN_RE$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
34
|
+
const MODIFIER_RE$1 = /\p{M}+/gu;
|
|
35
|
+
const NO_TRUNCATION$3 = {
|
|
36
|
+
limit: Infinity,
|
|
37
|
+
ellipsis: ""
|
|
38
|
+
};
|
|
39
|
+
const getStringTruncatedWidth$1 = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
40
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
41
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
42
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth$1(ELLIPSIS, NO_TRUNCATION$3, widthOptions).width : 0);
|
|
43
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
44
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
45
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
46
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
47
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
48
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
49
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
50
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
51
|
+
let indexPrev = 0;
|
|
52
|
+
let index = 0;
|
|
53
|
+
let length = input.length;
|
|
54
|
+
let lengthExtra = 0;
|
|
55
|
+
let truncationEnabled = false;
|
|
56
|
+
let truncationIndex = length;
|
|
57
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
58
|
+
let unmatchedStart = 0;
|
|
59
|
+
let unmatchedEnd = 0;
|
|
60
|
+
let width = 0;
|
|
61
|
+
let widthExtra = 0;
|
|
62
|
+
outer: while (true) {
|
|
63
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
64
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
65
|
+
lengthExtra = 0;
|
|
66
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE$1, "")) {
|
|
67
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
68
|
+
if (isFullWidth$1(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
69
|
+
else if (isWide$1(codePoint)) widthExtra = WIDE_WIDTH;
|
|
70
|
+
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous$1(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
71
|
+
else widthExtra = REGULAR_WIDTH;
|
|
72
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
73
|
+
if (width + widthExtra > LIMIT) {
|
|
74
|
+
truncationEnabled = true;
|
|
75
|
+
break outer;
|
|
76
|
+
}
|
|
77
|
+
lengthExtra += char.length;
|
|
78
|
+
width += widthExtra;
|
|
79
|
+
}
|
|
80
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
81
|
+
}
|
|
82
|
+
if (index >= length) break;
|
|
83
|
+
LATIN_RE$1.lastIndex = index;
|
|
84
|
+
if (LATIN_RE$1.test(input)) {
|
|
85
|
+
lengthExtra = LATIN_RE$1.lastIndex - index;
|
|
86
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
87
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
88
|
+
if (width + widthExtra > LIMIT) {
|
|
89
|
+
truncationEnabled = true;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
width += widthExtra;
|
|
93
|
+
unmatchedStart = indexPrev;
|
|
94
|
+
unmatchedEnd = index;
|
|
95
|
+
index = indexPrev = LATIN_RE$1.lastIndex;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
ANSI_RE$1.lastIndex = index;
|
|
99
|
+
if (ANSI_RE$1.test(input)) {
|
|
100
|
+
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
101
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
102
|
+
truncationEnabled = true;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
width += ANSI_WIDTH;
|
|
106
|
+
unmatchedStart = indexPrev;
|
|
107
|
+
unmatchedEnd = index;
|
|
108
|
+
index = indexPrev = ANSI_RE$1.lastIndex;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
CONTROL_RE$1.lastIndex = index;
|
|
112
|
+
if (CONTROL_RE$1.test(input)) {
|
|
113
|
+
lengthExtra = CONTROL_RE$1.lastIndex - index;
|
|
114
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
115
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
116
|
+
if (width + widthExtra > LIMIT) {
|
|
117
|
+
truncationEnabled = true;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
width += widthExtra;
|
|
121
|
+
unmatchedStart = indexPrev;
|
|
122
|
+
unmatchedEnd = index;
|
|
123
|
+
index = indexPrev = CONTROL_RE$1.lastIndex;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
TAB_RE$1.lastIndex = index;
|
|
127
|
+
if (TAB_RE$1.test(input)) {
|
|
128
|
+
lengthExtra = TAB_RE$1.lastIndex - index;
|
|
129
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
130
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
131
|
+
if (width + widthExtra > LIMIT) {
|
|
132
|
+
truncationEnabled = true;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
width += widthExtra;
|
|
136
|
+
unmatchedStart = indexPrev;
|
|
137
|
+
unmatchedEnd = index;
|
|
138
|
+
index = indexPrev = TAB_RE$1.lastIndex;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
EMOJI_RE$1.lastIndex = index;
|
|
142
|
+
if (EMOJI_RE$1.test(input)) {
|
|
143
|
+
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
144
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
145
|
+
truncationEnabled = true;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
width += EMOJI_WIDTH;
|
|
149
|
+
unmatchedStart = indexPrev;
|
|
150
|
+
unmatchedEnd = index;
|
|
151
|
+
index = indexPrev = EMOJI_RE$1.lastIndex;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
index += 1;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
158
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
159
|
+
truncated: truncationEnabled,
|
|
160
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
165
|
+
const NO_TRUNCATION$2 = {
|
|
166
|
+
limit: Infinity,
|
|
167
|
+
ellipsis: "",
|
|
168
|
+
ellipsisWidth: 0
|
|
169
|
+
};
|
|
170
|
+
const fastStringWidth$1 = (input, options = {}) => {
|
|
171
|
+
return getStringTruncatedWidth$1(input, NO_TRUNCATION$2, options).width;
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
175
|
+
const ESC$1 = "\x1B";
|
|
176
|
+
const CSI$1 = "";
|
|
177
|
+
const END_CODE$1 = 39;
|
|
178
|
+
const ANSI_ESCAPE_BELL$1 = "\x07";
|
|
179
|
+
const ANSI_CSI$1 = "[";
|
|
180
|
+
const ANSI_OSC$1 = "]";
|
|
181
|
+
const ANSI_SGR_TERMINATOR$1 = "m";
|
|
182
|
+
const ANSI_ESCAPE_LINK$1 = `${ANSI_OSC$1}8;;`;
|
|
183
|
+
const GROUP_REGEX$1 = new RegExp(`(?:\\${ANSI_CSI$1}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK$1}(?<uri>.*)${ANSI_ESCAPE_BELL$1})`, "y");
|
|
184
|
+
const getClosingCode$1 = (openingCode) => {
|
|
185
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
186
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
187
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
188
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
189
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
190
|
+
if (openingCode === 3) return 23;
|
|
191
|
+
if (openingCode === 4) return 24;
|
|
192
|
+
if (openingCode === 7) return 27;
|
|
193
|
+
if (openingCode === 8) return 28;
|
|
194
|
+
if (openingCode === 9) return 29;
|
|
195
|
+
if (openingCode === 0) return 0;
|
|
196
|
+
};
|
|
197
|
+
const wrapAnsiCode$1 = (code) => `${ESC$1}${ANSI_CSI$1}${code}${ANSI_SGR_TERMINATOR$1}`;
|
|
198
|
+
const wrapAnsiHyperlink$1 = (url) => `${ESC$1}${ANSI_ESCAPE_LINK$1}${url}${ANSI_ESCAPE_BELL$1}`;
|
|
199
|
+
const wrapWord$1 = (rows, word, columns) => {
|
|
200
|
+
const characters = word[Symbol.iterator]();
|
|
201
|
+
let isInsideEscape = false;
|
|
202
|
+
let isInsideLinkEscape = false;
|
|
203
|
+
let lastRow = rows.at(-1);
|
|
204
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth$1(lastRow);
|
|
205
|
+
let currentCharacter = characters.next();
|
|
206
|
+
let nextCharacter = characters.next();
|
|
207
|
+
let rawCharacterIndex = 0;
|
|
208
|
+
while (!currentCharacter.done) {
|
|
209
|
+
const character = currentCharacter.value;
|
|
210
|
+
const characterLength = fastStringWidth$1(character);
|
|
211
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
212
|
+
else {
|
|
213
|
+
rows.push(character);
|
|
214
|
+
visible = 0;
|
|
215
|
+
}
|
|
216
|
+
if (character === ESC$1 || character === CSI$1) {
|
|
217
|
+
isInsideEscape = true;
|
|
218
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK$1, rawCharacterIndex + 1);
|
|
219
|
+
}
|
|
220
|
+
if (isInsideEscape) {
|
|
221
|
+
if (isInsideLinkEscape) {
|
|
222
|
+
if (character === ANSI_ESCAPE_BELL$1) {
|
|
223
|
+
isInsideEscape = false;
|
|
224
|
+
isInsideLinkEscape = false;
|
|
225
|
+
}
|
|
226
|
+
} else if (character === ANSI_SGR_TERMINATOR$1) isInsideEscape = false;
|
|
227
|
+
} else {
|
|
228
|
+
visible += characterLength;
|
|
229
|
+
if (visible === columns && !nextCharacter.done) {
|
|
230
|
+
rows.push("");
|
|
231
|
+
visible = 0;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
currentCharacter = nextCharacter;
|
|
235
|
+
nextCharacter = characters.next();
|
|
236
|
+
rawCharacterIndex += character.length;
|
|
237
|
+
}
|
|
238
|
+
lastRow = rows.at(-1);
|
|
239
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
240
|
+
};
|
|
241
|
+
const stringVisibleTrimSpacesRight$1 = (string) => {
|
|
242
|
+
const words = string.split(" ");
|
|
243
|
+
let last = words.length;
|
|
244
|
+
while (last) {
|
|
245
|
+
if (fastStringWidth$1(words[last - 1])) break;
|
|
246
|
+
last--;
|
|
247
|
+
}
|
|
248
|
+
if (last === words.length) return string;
|
|
249
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
250
|
+
};
|
|
251
|
+
const exec$1 = (string, columns, options = {}) => {
|
|
252
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
253
|
+
let returnValue = "";
|
|
254
|
+
let escapeCode;
|
|
255
|
+
let escapeUrl;
|
|
256
|
+
const words = string.split(" ");
|
|
257
|
+
let rows = [""];
|
|
258
|
+
let rowLength = 0;
|
|
259
|
+
for (let index = 0; index < words.length; index++) {
|
|
260
|
+
const word = words[index];
|
|
261
|
+
if (options.trim !== false) {
|
|
262
|
+
const row = rows.at(-1) ?? "";
|
|
263
|
+
const trimmed = row.trimStart();
|
|
264
|
+
if (row.length !== trimmed.length) {
|
|
265
|
+
rows[rows.length - 1] = trimmed;
|
|
266
|
+
rowLength = fastStringWidth$1(trimmed);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (index !== 0) {
|
|
270
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
271
|
+
rows.push("");
|
|
272
|
+
rowLength = 0;
|
|
273
|
+
}
|
|
274
|
+
if (rowLength || options.trim === false) {
|
|
275
|
+
rows[rows.length - 1] += " ";
|
|
276
|
+
rowLength++;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const wordLength = fastStringWidth$1(word);
|
|
280
|
+
if (options.hard && wordLength > columns) {
|
|
281
|
+
const remainingColumns = columns - rowLength;
|
|
282
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
283
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
284
|
+
wrapWord$1(rows, word, columns);
|
|
285
|
+
rowLength = fastStringWidth$1(rows.at(-1) ?? "");
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
289
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
290
|
+
wrapWord$1(rows, word, columns);
|
|
291
|
+
rowLength = fastStringWidth$1(rows.at(-1) ?? "");
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
rows.push("");
|
|
295
|
+
rowLength = 0;
|
|
296
|
+
}
|
|
297
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
298
|
+
wrapWord$1(rows, word, columns);
|
|
299
|
+
rowLength = fastStringWidth$1(rows.at(-1) ?? "");
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
rows[rows.length - 1] += word;
|
|
303
|
+
rowLength += wordLength;
|
|
304
|
+
}
|
|
305
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight$1(row));
|
|
306
|
+
const preString = rows.join("\n");
|
|
307
|
+
let inSurrogate = false;
|
|
308
|
+
for (let i = 0; i < preString.length; i++) {
|
|
309
|
+
const character = preString[i];
|
|
310
|
+
returnValue += character;
|
|
311
|
+
if (!inSurrogate) inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
312
|
+
else continue;
|
|
313
|
+
if (character === ESC$1 || character === CSI$1) {
|
|
314
|
+
GROUP_REGEX$1.lastIndex = i + 1;
|
|
315
|
+
const groups = GROUP_REGEX$1.exec(preString)?.groups;
|
|
316
|
+
if (groups?.code !== void 0) {
|
|
317
|
+
const code = Number.parseFloat(groups.code);
|
|
318
|
+
escapeCode = code === END_CODE$1 ? void 0 : code;
|
|
319
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
320
|
+
}
|
|
321
|
+
if (preString[i + 1] === "\n") {
|
|
322
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink$1("");
|
|
323
|
+
const closingCode = escapeCode ? getClosingCode$1(escapeCode) : void 0;
|
|
324
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode$1(closingCode);
|
|
325
|
+
} else if (character === "\n") {
|
|
326
|
+
if (escapeCode && getClosingCode$1(escapeCode)) returnValue += wrapAnsiCode$1(escapeCode);
|
|
327
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink$1(escapeUrl);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return returnValue;
|
|
331
|
+
};
|
|
332
|
+
const CRLF_OR_LF$1 = /\r?\n/;
|
|
333
|
+
function wrapAnsi$1(string, columns, options) {
|
|
334
|
+
return String(string).normalize().split(CRLF_OR_LF$1).map((line) => exec$1(line, columns, options)).join("\n");
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
19
338
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20
339
|
const ESC = "\x1B";
|
|
21
340
|
const CSI = `${ESC}[`;
|
|
@@ -68,162 +387,12 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68
387
|
beep
|
|
69
388
|
};
|
|
70
389
|
})))();
|
|
71
|
-
function
|
|
72
|
-
if (!
|
|
73
|
-
const
|
|
74
|
-
return
|
|
390
|
+
function d(r, t, e) {
|
|
391
|
+
if (!e.some((o) => !o.disabled)) return r;
|
|
392
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
393
|
+
return e[n].disabled ? d(n, t < 0 ? -1 : 1, e) : n;
|
|
75
394
|
}
|
|
76
|
-
const
|
|
77
|
-
limit: Infinity,
|
|
78
|
-
ellipsis: ""
|
|
79
|
-
}, X = (t, e = {}, s = {}) => {
|
|
80
|
-
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
81
|
-
let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
82
|
-
t: for (;;) {
|
|
83
|
-
if (w > C || o >= p && o > h) {
|
|
84
|
-
const ut = t.slice(C, w) || t.slice(h, o);
|
|
85
|
-
v = 0;
|
|
86
|
-
for (const Y of ut.replaceAll(ct, "")) {
|
|
87
|
-
const $ = Y.codePointAt(0) || 0;
|
|
88
|
-
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) {
|
|
89
|
-
F = !0;
|
|
90
|
-
break t;
|
|
91
|
-
}
|
|
92
|
-
v += Y.length, c += f;
|
|
93
|
-
}
|
|
94
|
-
C = w = 0;
|
|
95
|
-
}
|
|
96
|
-
if (o >= p) break;
|
|
97
|
-
if (M.lastIndex = o, M.test(t)) {
|
|
98
|
-
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
99
|
-
F = !0;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (O.lastIndex = o, O.test(t)) {
|
|
106
|
-
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
107
|
-
F = !0;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (y.lastIndex = o, y.test(t)) {
|
|
114
|
-
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
115
|
-
F = !0;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (L.lastIndex = o, L.test(t)) {
|
|
122
|
-
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
123
|
-
F = !0;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (P.lastIndex = o, P.test(t)) {
|
|
130
|
-
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
131
|
-
F = !0;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
o += 1;
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
width: F ? b : c,
|
|
141
|
-
index: F ? d : p,
|
|
142
|
-
truncated: F,
|
|
143
|
-
ellipsed: F && i >= n
|
|
144
|
-
};
|
|
145
|
-
}, pt = {
|
|
146
|
-
limit: Infinity,
|
|
147
|
-
ellipsis: "",
|
|
148
|
-
ellipsisWidth: 0
|
|
149
|
-
}, S = (t, e = {}) => X(t, pt, e).width, T = "\x1B", Z = "", Ft = 39, j = "\x07", Q = "[", dt = "]", tt = "m", U = `${dt}8;;`, et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y"), mt = (t) => {
|
|
150
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
151
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
152
|
-
if (t === 1 || t === 2) return 22;
|
|
153
|
-
if (t === 3) return 23;
|
|
154
|
-
if (t === 4) return 24;
|
|
155
|
-
if (t === 7) return 27;
|
|
156
|
-
if (t === 8) return 28;
|
|
157
|
-
if (t === 9) return 29;
|
|
158
|
-
if (t === 0) return 0;
|
|
159
|
-
}, st = (t) => `${T}${Q}${t}${tt}`, it = (t) => `${T}${U}${t}${j}`, gt = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
160
|
-
const i = e[Symbol.iterator]();
|
|
161
|
-
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
162
|
-
for (; !l.done;) {
|
|
163
|
-
const m = l.value, A = S(m);
|
|
164
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = !0, n = e.startsWith(U, 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;
|
|
165
|
-
}
|
|
166
|
-
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
167
|
-
}, vt = (t) => {
|
|
168
|
-
const e = t.split(" ");
|
|
169
|
-
let s = e.length;
|
|
170
|
-
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
171
|
-
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
172
|
-
}, Et = (t, e, s = {}) => {
|
|
173
|
-
if (s.trim !== !1 && t.trim() === "") return "";
|
|
174
|
-
let i = "", r, n;
|
|
175
|
-
const u = t.split(" "), a = gt(u);
|
|
176
|
-
let l = [""];
|
|
177
|
-
for (const [h, o] of u.entries()) {
|
|
178
|
-
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
179
|
-
let p = S(l.at(-1) ?? "");
|
|
180
|
-
if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
181
|
-
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
182
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
186
|
-
if (s.wordWrap === !1 && p < e) {
|
|
187
|
-
G(l, o, e);
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
l.push("");
|
|
191
|
-
}
|
|
192
|
-
if (p + a[h] > e && s.wordWrap === !1) {
|
|
193
|
-
G(l, o, e);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
l[l.length - 1] += o;
|
|
197
|
-
}
|
|
198
|
-
s.trim !== !1 && (l = l.map((h) => vt(h)));
|
|
199
|
-
const E = l.join(`
|
|
200
|
-
`), g = E[Symbol.iterator]();
|
|
201
|
-
let m = g.next(), A = g.next(), V = 0;
|
|
202
|
-
for (; !m.done;) {
|
|
203
|
-
const h = m.value, o = A.value;
|
|
204
|
-
if (i += h, h === T || h === Z) {
|
|
205
|
-
et.lastIndex = V + 1;
|
|
206
|
-
const F = et.exec(E)?.groups;
|
|
207
|
-
if (F?.code !== void 0) {
|
|
208
|
-
const d = Number.parseFloat(F.code);
|
|
209
|
-
r = d === Ft ? void 0 : d;
|
|
210
|
-
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
211
|
-
}
|
|
212
|
-
const p = r ? mt(r) : void 0;
|
|
213
|
-
o === `
|
|
214
|
-
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
215
|
-
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
216
|
-
}
|
|
217
|
-
return i;
|
|
218
|
-
};
|
|
219
|
-
function K(t, e, s) {
|
|
220
|
-
return String(t).normalize().replaceAll(`\r
|
|
221
|
-
`, `
|
|
222
|
-
`).split(`
|
|
223
|
-
`).map((i) => Et(i, e, s)).join(`
|
|
224
|
-
`);
|
|
225
|
-
}
|
|
226
|
-
const _ = {
|
|
395
|
+
const u = {
|
|
227
396
|
actions: new Set([
|
|
228
397
|
"up",
|
|
229
398
|
"down",
|
|
@@ -245,73 +414,96 @@ const _ = {
|
|
|
245
414
|
cancel: "Canceled",
|
|
246
415
|
error: "Something went wrong"
|
|
247
416
|
},
|
|
248
|
-
withGuide: !0
|
|
417
|
+
withGuide: !0,
|
|
418
|
+
date: {
|
|
419
|
+
monthNames: [...[
|
|
420
|
+
"January",
|
|
421
|
+
"February",
|
|
422
|
+
"March",
|
|
423
|
+
"April",
|
|
424
|
+
"May",
|
|
425
|
+
"June",
|
|
426
|
+
"July",
|
|
427
|
+
"August",
|
|
428
|
+
"September",
|
|
429
|
+
"October",
|
|
430
|
+
"November",
|
|
431
|
+
"December"
|
|
432
|
+
]],
|
|
433
|
+
messages: {
|
|
434
|
+
required: "Please enter a valid date",
|
|
435
|
+
invalidMonth: "There are only 12 months in a year",
|
|
436
|
+
invalidDay: (r, t) => `There are only ${r} days in ${t}`,
|
|
437
|
+
afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
438
|
+
beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
439
|
+
}
|
|
440
|
+
}
|
|
249
441
|
};
|
|
250
|
-
function
|
|
251
|
-
if (typeof
|
|
252
|
-
for (const
|
|
442
|
+
function V(r, t) {
|
|
443
|
+
if (typeof r == "string") return u.aliases.get(r) === t;
|
|
444
|
+
for (const e of r) if (e !== void 0 && V(e, t)) return !0;
|
|
253
445
|
return !1;
|
|
254
446
|
}
|
|
255
|
-
function
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
`),
|
|
259
|
-
`),
|
|
260
|
-
for (let
|
|
447
|
+
function j(r, t) {
|
|
448
|
+
if (r === t) return;
|
|
449
|
+
const e = r.split(`
|
|
450
|
+
`), s = t.split(`
|
|
451
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
452
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
261
453
|
return {
|
|
262
454
|
lines: n,
|
|
263
|
-
numLinesBefore:
|
|
264
|
-
numLinesAfter:
|
|
265
|
-
numLines:
|
|
455
|
+
numLinesBefore: e.length,
|
|
456
|
+
numLinesAfter: s.length,
|
|
457
|
+
numLines: i
|
|
266
458
|
};
|
|
267
459
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
270
|
-
return
|
|
460
|
+
const Y = globalThis.process.platform.startsWith("win"), C = Symbol("clack:cancel");
|
|
461
|
+
function q(r) {
|
|
462
|
+
return r === C;
|
|
271
463
|
}
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
|
|
464
|
+
function w(r, t) {
|
|
465
|
+
const e = r;
|
|
466
|
+
e.isTTY && e.setRawMode(t);
|
|
275
467
|
}
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
input:
|
|
279
|
-
output:
|
|
468
|
+
function z({ input: r = stdin, output: t = stdout, overwrite: e = !0, hideCursor: s = !0 } = {}) {
|
|
469
|
+
const i = _.createInterface({
|
|
470
|
+
input: r,
|
|
471
|
+
output: t,
|
|
280
472
|
prompt: "",
|
|
281
473
|
tabSize: 1
|
|
282
474
|
});
|
|
283
|
-
|
|
284
|
-
const n = (
|
|
285
|
-
if (
|
|
286
|
-
String(
|
|
475
|
+
_.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
|
|
476
|
+
const n = (o, { name: a, sequence: h }) => {
|
|
477
|
+
if (V([
|
|
478
|
+
String(o),
|
|
287
479
|
a,
|
|
288
|
-
|
|
480
|
+
h
|
|
289
481
|
], "cancel")) {
|
|
290
|
-
|
|
482
|
+
s && t.write(import_src.cursor.show), process.exit(0);
|
|
291
483
|
return;
|
|
292
484
|
}
|
|
293
|
-
if (!
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
485
|
+
if (!e) return;
|
|
486
|
+
const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
|
|
487
|
+
_.moveCursor(t, f, v, () => {
|
|
488
|
+
_.clearLine(t, 1, () => {
|
|
489
|
+
r.once("keypress", n);
|
|
298
490
|
});
|
|
299
491
|
});
|
|
300
492
|
};
|
|
301
|
-
return
|
|
302
|
-
|
|
493
|
+
return s && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
494
|
+
r.off("keypress", n), s && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !Y && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
303
495
|
};
|
|
304
496
|
}
|
|
305
|
-
const
|
|
306
|
-
function
|
|
307
|
-
return
|
|
497
|
+
const O = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
498
|
+
function R(r, t, e, s = e) {
|
|
499
|
+
return wrapAnsi$1(t, O(r ?? stdout) - e.length, {
|
|
308
500
|
hard: !0,
|
|
309
501
|
trim: !1
|
|
310
502
|
}).split(`
|
|
311
|
-
`).map((n,
|
|
503
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
312
504
|
`);
|
|
313
505
|
}
|
|
314
|
-
|
|
506
|
+
let p = class {
|
|
315
507
|
input;
|
|
316
508
|
output;
|
|
317
509
|
_abortSignal;
|
|
@@ -326,60 +518,60 @@ var B = class {
|
|
|
326
518
|
error = "";
|
|
327
519
|
value;
|
|
328
520
|
userInput = "";
|
|
329
|
-
constructor(
|
|
330
|
-
const { input:
|
|
331
|
-
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track =
|
|
521
|
+
constructor(t, e = !0) {
|
|
522
|
+
const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
|
|
523
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
332
524
|
}
|
|
333
525
|
unsubscribe() {
|
|
334
526
|
this._subscribers.clear();
|
|
335
527
|
}
|
|
336
|
-
setSubscriber(
|
|
337
|
-
const
|
|
338
|
-
|
|
528
|
+
setSubscriber(t, e) {
|
|
529
|
+
const s = this._subscribers.get(t) ?? [];
|
|
530
|
+
s.push(e), this._subscribers.set(t, s);
|
|
339
531
|
}
|
|
340
|
-
on(
|
|
341
|
-
this.setSubscriber(
|
|
532
|
+
on(t, e) {
|
|
533
|
+
this.setSubscriber(t, { cb: e });
|
|
342
534
|
}
|
|
343
|
-
once(
|
|
344
|
-
this.setSubscriber(
|
|
345
|
-
cb:
|
|
535
|
+
once(t, e) {
|
|
536
|
+
this.setSubscriber(t, {
|
|
537
|
+
cb: e,
|
|
346
538
|
once: !0
|
|
347
539
|
});
|
|
348
540
|
}
|
|
349
|
-
emit(
|
|
350
|
-
const
|
|
351
|
-
for (const n of
|
|
352
|
-
for (const n of
|
|
541
|
+
emit(t, ...e) {
|
|
542
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
543
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
544
|
+
for (const n of i) n();
|
|
353
545
|
}
|
|
354
546
|
prompt() {
|
|
355
|
-
return new Promise((
|
|
547
|
+
return new Promise((t) => {
|
|
356
548
|
if (this._abortSignal) {
|
|
357
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
549
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(C);
|
|
358
550
|
this._abortSignal.addEventListener("abort", () => {
|
|
359
551
|
this.state = "cancel", this.close();
|
|
360
552
|
}, { once: !0 });
|
|
361
553
|
}
|
|
362
|
-
this.rl =
|
|
554
|
+
this.rl = P.createInterface({
|
|
363
555
|
input: this.input,
|
|
364
556
|
tabSize: 2,
|
|
365
557
|
prompt: "",
|
|
366
558
|
escapeCodeTimeout: 50,
|
|
367
559
|
terminal: !0
|
|
368
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
369
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
560
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
561
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(this.value);
|
|
370
562
|
}), this.once("cancel", () => {
|
|
371
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
563
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w(this.input, !1), t(C);
|
|
372
564
|
});
|
|
373
565
|
});
|
|
374
566
|
}
|
|
375
|
-
_isActionKey(
|
|
376
|
-
return
|
|
567
|
+
_isActionKey(t, e) {
|
|
568
|
+
return t === " ";
|
|
377
569
|
}
|
|
378
|
-
_setValue(
|
|
379
|
-
this.value =
|
|
570
|
+
_setValue(t) {
|
|
571
|
+
this.value = t, this.emit("value", this.value);
|
|
380
572
|
}
|
|
381
|
-
_setUserInput(
|
|
382
|
-
this.userInput =
|
|
573
|
+
_setUserInput(t, e) {
|
|
574
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
383
575
|
}
|
|
384
576
|
_clearUserInput() {
|
|
385
577
|
this.rl?.write(null, {
|
|
@@ -387,130 +579,130 @@ var B = class {
|
|
|
387
579
|
name: "u"
|
|
388
580
|
}), this._setUserInput("");
|
|
389
581
|
}
|
|
390
|
-
onKeypress(
|
|
391
|
-
if (this._track &&
|
|
582
|
+
onKeypress(t, e) {
|
|
583
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
392
584
|
ctrl: !0,
|
|
393
585
|
name: "h"
|
|
394
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"),
|
|
586
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
|
|
395
587
|
if (this.opts.validate) {
|
|
396
|
-
const
|
|
397
|
-
|
|
588
|
+
const s = this.opts.validate(this.value);
|
|
589
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
398
590
|
}
|
|
399
591
|
this.state !== "error" && (this.state = "submit");
|
|
400
592
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
593
|
+
V([
|
|
594
|
+
t,
|
|
595
|
+
e?.name,
|
|
596
|
+
e?.sequence
|
|
405
597
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
406
598
|
}
|
|
407
599
|
close() {
|
|
408
600
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
409
|
-
`),
|
|
601
|
+
`), w(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
410
602
|
}
|
|
411
603
|
restoreCursor() {
|
|
412
|
-
const
|
|
604
|
+
const t = wrapAnsi$1(this._prevFrame, process.stdout.columns, {
|
|
413
605
|
hard: !0,
|
|
414
606
|
trim: !1
|
|
415
607
|
}).split(`
|
|
416
608
|
`).length - 1;
|
|
417
|
-
this.output.write(import_src.cursor.move(-999,
|
|
609
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
418
610
|
}
|
|
419
611
|
render() {
|
|
420
|
-
const
|
|
612
|
+
const t = wrapAnsi$1(this._render(this) ?? "", process.stdout.columns, {
|
|
421
613
|
hard: !0,
|
|
422
614
|
trim: !1
|
|
423
615
|
});
|
|
424
|
-
if (
|
|
616
|
+
if (t !== this._prevFrame) {
|
|
425
617
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
426
618
|
else {
|
|
427
|
-
const
|
|
428
|
-
if (this.restoreCursor(),
|
|
429
|
-
const
|
|
430
|
-
let
|
|
431
|
-
if (
|
|
432
|
-
this._prevFrame =
|
|
619
|
+
const e = j(this._prevFrame, t), s = A(this.output);
|
|
620
|
+
if (this.restoreCursor(), e) {
|
|
621
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
622
|
+
let o = e.lines.find((a) => a >= i);
|
|
623
|
+
if (o === void 0) {
|
|
624
|
+
this._prevFrame = t;
|
|
433
625
|
return;
|
|
434
626
|
}
|
|
435
|
-
if (
|
|
436
|
-
this.output.write(import_src.cursor.move(0,
|
|
437
|
-
const a =
|
|
627
|
+
if (e.lines.length === 1) {
|
|
628
|
+
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
629
|
+
const a = t.split(`
|
|
438
630
|
`);
|
|
439
|
-
this.output.write(a[
|
|
631
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, a.length - o - 1));
|
|
440
632
|
return;
|
|
441
|
-
} else if (
|
|
442
|
-
if (
|
|
633
|
+
} else if (e.lines.length > 1) {
|
|
634
|
+
if (i < n) o = i;
|
|
443
635
|
else {
|
|
444
|
-
const
|
|
445
|
-
|
|
636
|
+
const h = o - n;
|
|
637
|
+
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
446
638
|
}
|
|
447
639
|
this.output.write(import_src.erase.down());
|
|
448
|
-
const a =
|
|
449
|
-
`).slice(
|
|
640
|
+
const a = t.split(`
|
|
641
|
+
`).slice(o);
|
|
450
642
|
this.output.write(a.join(`
|
|
451
|
-
`)), this._prevFrame =
|
|
643
|
+
`)), this._prevFrame = t;
|
|
452
644
|
return;
|
|
453
645
|
}
|
|
454
646
|
}
|
|
455
647
|
this.output.write(import_src.erase.down());
|
|
456
648
|
}
|
|
457
|
-
this.output.write(
|
|
649
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
458
650
|
}
|
|
459
651
|
}
|
|
460
652
|
};
|
|
461
|
-
var
|
|
653
|
+
var Q = class extends p {
|
|
462
654
|
get cursor() {
|
|
463
655
|
return this.value ? 0 : 1;
|
|
464
656
|
}
|
|
465
657
|
get _value() {
|
|
466
658
|
return this.cursor === 0;
|
|
467
659
|
}
|
|
468
|
-
constructor(
|
|
469
|
-
super(
|
|
660
|
+
constructor(t) {
|
|
661
|
+
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
470
662
|
this.value = this._value;
|
|
471
|
-
}), this.on("confirm", (
|
|
472
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
663
|
+
}), this.on("confirm", (e) => {
|
|
664
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
473
665
|
}), this.on("cursor", () => {
|
|
474
666
|
this.value = !this.value;
|
|
475
667
|
});
|
|
476
668
|
}
|
|
477
669
|
};
|
|
478
|
-
let
|
|
670
|
+
let it = class extends p {
|
|
479
671
|
options;
|
|
480
672
|
cursor = 0;
|
|
481
673
|
get _value() {
|
|
482
674
|
return this.options[this.cursor].value;
|
|
483
675
|
}
|
|
484
676
|
get _enabledOptions() {
|
|
485
|
-
return this.options.filter((
|
|
677
|
+
return this.options.filter((t) => t.disabled !== !0);
|
|
486
678
|
}
|
|
487
679
|
toggleAll() {
|
|
488
|
-
const
|
|
489
|
-
this.value = this.value !== void 0 && this.value.length ===
|
|
680
|
+
const t = this._enabledOptions;
|
|
681
|
+
this.value = this.value !== void 0 && this.value.length === t.length ? [] : t.map((s) => s.value);
|
|
490
682
|
}
|
|
491
683
|
toggleInvert() {
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
494
|
-
this.value = this._enabledOptions.filter((
|
|
684
|
+
const t = this.value;
|
|
685
|
+
if (!t) return;
|
|
686
|
+
this.value = this._enabledOptions.filter((s) => !t.includes(s.value)).map((s) => s.value);
|
|
495
687
|
}
|
|
496
688
|
toggleValue() {
|
|
497
689
|
this.value === void 0 && (this.value = []);
|
|
498
|
-
this.value = this.value.includes(this._value) ? this.value.filter((
|
|
690
|
+
this.value = this.value.includes(this._value) ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
499
691
|
}
|
|
500
|
-
constructor(
|
|
501
|
-
super(
|
|
502
|
-
const
|
|
503
|
-
this.cursor = this.options[
|
|
504
|
-
|
|
505
|
-
}), this.on("cursor", (
|
|
506
|
-
switch (
|
|
692
|
+
constructor(t) {
|
|
693
|
+
super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
|
|
694
|
+
const e = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), 0);
|
|
695
|
+
this.cursor = this.options[e].disabled ? d(e, 1, this.options) : e, this.on("key", (s) => {
|
|
696
|
+
s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
|
|
697
|
+
}), this.on("cursor", (s) => {
|
|
698
|
+
switch (s) {
|
|
507
699
|
case "left":
|
|
508
700
|
case "up":
|
|
509
|
-
this.cursor =
|
|
701
|
+
this.cursor = d(this.cursor, -1, this.options);
|
|
510
702
|
break;
|
|
511
703
|
case "down":
|
|
512
704
|
case "right":
|
|
513
|
-
this.cursor =
|
|
705
|
+
this.cursor = d(this.cursor, 1, this.options);
|
|
514
706
|
break;
|
|
515
707
|
case "space":
|
|
516
708
|
this.toggleValue();
|
|
@@ -519,7 +711,7 @@ let Lt = class extends B {
|
|
|
519
711
|
});
|
|
520
712
|
}
|
|
521
713
|
};
|
|
522
|
-
var
|
|
714
|
+
var nt = class extends p {
|
|
523
715
|
options;
|
|
524
716
|
cursor = 0;
|
|
525
717
|
get _selectedValue() {
|
|
@@ -528,43 +720,43 @@ var Tt = class extends B {
|
|
|
528
720
|
changeValue() {
|
|
529
721
|
this.value = this._selectedValue.value;
|
|
530
722
|
}
|
|
531
|
-
constructor(
|
|
532
|
-
super(
|
|
533
|
-
const
|
|
534
|
-
this.cursor = this.options[
|
|
535
|
-
switch (
|
|
723
|
+
constructor(t) {
|
|
724
|
+
super(t, !1), this.options = t.options;
|
|
725
|
+
const e = this.options.findIndex(({ value: i }) => i === t.initialValue), s = e === -1 ? 0 : e;
|
|
726
|
+
this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
|
|
727
|
+
switch (i) {
|
|
536
728
|
case "left":
|
|
537
729
|
case "up":
|
|
538
|
-
this.cursor =
|
|
730
|
+
this.cursor = d(this.cursor, -1, this.options);
|
|
539
731
|
break;
|
|
540
732
|
case "down":
|
|
541
733
|
case "right":
|
|
542
|
-
this.cursor =
|
|
734
|
+
this.cursor = d(this.cursor, 1, this.options);
|
|
543
735
|
break;
|
|
544
736
|
}
|
|
545
737
|
this.changeValue();
|
|
546
738
|
});
|
|
547
739
|
}
|
|
548
740
|
};
|
|
549
|
-
var
|
|
741
|
+
var at = class extends p {
|
|
550
742
|
get userInputWithCursor() {
|
|
551
743
|
if (this.state === "submit") return this.userInput;
|
|
552
|
-
const
|
|
553
|
-
if (this.cursor >=
|
|
554
|
-
const
|
|
555
|
-
return `${
|
|
744
|
+
const t = this.userInput;
|
|
745
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
746
|
+
const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
|
|
747
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
556
748
|
}
|
|
557
749
|
get cursor() {
|
|
558
750
|
return this._cursor;
|
|
559
751
|
}
|
|
560
|
-
constructor(
|
|
752
|
+
constructor(t) {
|
|
561
753
|
super({
|
|
562
|
-
...
|
|
563
|
-
initialUserInput:
|
|
564
|
-
}), this.on("userInput", (
|
|
565
|
-
this._setValue(
|
|
754
|
+
...t,
|
|
755
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
756
|
+
}), this.on("userInput", (e) => {
|
|
757
|
+
this._setValue(e);
|
|
566
758
|
}), this.on("finalize", () => {
|
|
567
|
-
this.value || (this.value =
|
|
759
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
568
760
|
});
|
|
569
761
|
}
|
|
570
762
|
};
|
|
@@ -1018,11 +1210,11 @@ const trimLines = (groups, initialLineCount, startIndex, endIndex, maxLines) =>
|
|
|
1018
1210
|
const limitOptions = (params) => {
|
|
1019
1211
|
const { cursor, options, style } = params;
|
|
1020
1212
|
const output = params.output ?? process.stdout;
|
|
1021
|
-
const columns =
|
|
1213
|
+
const columns = O(output);
|
|
1022
1214
|
const columnPadding = params.columnPadding ?? 0;
|
|
1023
1215
|
const rowPadding = params.rowPadding ?? 4;
|
|
1024
1216
|
const maxWidth = columns - columnPadding;
|
|
1025
|
-
const rows =
|
|
1217
|
+
const rows = A(output);
|
|
1026
1218
|
const overflowFormat = import_picocolors.default.dim("...");
|
|
1027
1219
|
const paramMaxItems = params.maxItems ?? Number.POSITIVE_INFINITY;
|
|
1028
1220
|
const outputMaxItems = Math.max(rows - rowPadding, 0);
|
|
@@ -1077,7 +1269,7 @@ const limitOptions = (params) => {
|
|
|
1077
1269
|
const confirm = (opts) => {
|
|
1078
1270
|
const active = opts.active ?? "Yes";
|
|
1079
1271
|
const inactive = opts.inactive ?? "No";
|
|
1080
|
-
return new
|
|
1272
|
+
return new Q({
|
|
1081
1273
|
active,
|
|
1082
1274
|
inactive,
|
|
1083
1275
|
signal: opts.signal,
|
|
@@ -1185,7 +1377,7 @@ const multiselect = (opts) => {
|
|
|
1185
1377
|
return withMarkerAndCheckbox(import_picocolors.default.dim(" "), import_picocolors.default.dim(S_CHECKBOX_INACTIVE), S_CHECKBOX_INACTIVE.length, label, import_picocolors.default.dim);
|
|
1186
1378
|
};
|
|
1187
1379
|
const required = opts.required ?? true;
|
|
1188
|
-
return new
|
|
1380
|
+
return new it({
|
|
1189
1381
|
options: opts.options,
|
|
1190
1382
|
signal: opts.signal,
|
|
1191
1383
|
input: opts.input,
|
|
@@ -1202,7 +1394,7 @@ const multiselect = (opts) => {
|
|
|
1202
1394
|
const formatMessageLines = (message) => {
|
|
1203
1395
|
return message.split("\n").map((line, index) => `${index === 0 ? `${symbol(this.state)} ` : nestedPrefix}${line}`).join("\n");
|
|
1204
1396
|
};
|
|
1205
|
-
const wrappedMessage = hasGuide ?
|
|
1397
|
+
const wrappedMessage = hasGuide ? R(opts.output, opts.message, `${symbolBar(this.state)} `, `${symbol(this.state)} `) : formatMessageLines(opts.message);
|
|
1206
1398
|
const title = `${hasGuide ? `${import_picocolors.default.gray(S_BAR)}\n` : ""}${wrappedMessage}\n`;
|
|
1207
1399
|
const value = this.value ?? [];
|
|
1208
1400
|
const styleOption = (option, active) => {
|
|
@@ -1216,13 +1408,13 @@ const multiselect = (opts) => {
|
|
|
1216
1408
|
case "submit": {
|
|
1217
1409
|
const submitText = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
1218
1410
|
const submitPrefix = hasGuide ? `${import_picocolors.default.gray(S_BAR)} ` : nestedPrefix;
|
|
1219
|
-
return `${title}${
|
|
1411
|
+
return `${title}${R(opts.output, submitText, submitPrefix)}\n`;
|
|
1220
1412
|
}
|
|
1221
1413
|
case "cancel": {
|
|
1222
1414
|
const label = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1223
1415
|
if (label.trim() === "") return hasGuide ? `${title}${import_picocolors.default.gray(S_BAR)}\n` : `${title.trimEnd()}\n`;
|
|
1224
1416
|
const cancelPrefix = hasGuide ? `${import_picocolors.default.gray(S_BAR)} ` : nestedPrefix;
|
|
1225
|
-
const wrappedLabel =
|
|
1417
|
+
const wrappedLabel = R(opts.output, label, cancelPrefix);
|
|
1226
1418
|
return hasGuide ? `${title}${wrappedLabel}\n${import_picocolors.default.gray(S_BAR)}\n` : `${title}${wrappedLabel}\n`;
|
|
1227
1419
|
}
|
|
1228
1420
|
case "error": {
|
|
@@ -1288,14 +1480,14 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1288
1480
|
let _prevMessage;
|
|
1289
1481
|
let _origin = performance.now();
|
|
1290
1482
|
let _elapsedMs = 0;
|
|
1291
|
-
const columns =
|
|
1483
|
+
const columns = O(output);
|
|
1292
1484
|
const styleFn = opts?.styleFrame ?? defaultStyleFn;
|
|
1293
1485
|
const getElapsedMs = () => {
|
|
1294
1486
|
if (!isSpinnerActive) return _elapsedMs;
|
|
1295
1487
|
return _elapsedMs + (performance.now() - _origin);
|
|
1296
1488
|
};
|
|
1297
1489
|
const handleExit = (code) => {
|
|
1298
|
-
const msg = code > 1 ? errorMessage ??
|
|
1490
|
+
const msg = code > 1 ? errorMessage ?? u.messages.error : cancelMessage ?? u.messages.cancel;
|
|
1299
1491
|
isCancelled = code === 1;
|
|
1300
1492
|
if (isSpinnerActive) {
|
|
1301
1493
|
_stop(msg, code);
|
|
@@ -1334,7 +1526,7 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1334
1526
|
const hasGuide = opts.withGuide ?? false;
|
|
1335
1527
|
const startLoop = () => {
|
|
1336
1528
|
isSpinnerActive = true;
|
|
1337
|
-
unblock =
|
|
1529
|
+
unblock = z({ output });
|
|
1338
1530
|
_origin = performance.now();
|
|
1339
1531
|
_prevMessage = void 0;
|
|
1340
1532
|
if (hasGuide) output.write(`${import_picocolors.default.gray(S_BAR)}\n`);
|
|
@@ -1436,7 +1628,7 @@ const select = (opts) => {
|
|
|
1436
1628
|
default: return withMarker(import_picocolors.default.dim(" "), label, (text) => text, hint);
|
|
1437
1629
|
}
|
|
1438
1630
|
};
|
|
1439
|
-
return new
|
|
1631
|
+
return new nt({
|
|
1440
1632
|
options: opts.options,
|
|
1441
1633
|
signal: opts.signal,
|
|
1442
1634
|
input: opts.input,
|
|
@@ -1449,16 +1641,16 @@ const select = (opts) => {
|
|
|
1449
1641
|
return message.split("\n").map((line, index) => `${index === 0 ? `${symbol(this.state)} ` : nestedPrefix}${line}`).join("\n");
|
|
1450
1642
|
};
|
|
1451
1643
|
const hasMessage = opts.message.trim().length > 0;
|
|
1452
|
-
const messageLines = !hasMessage ? "" : hasGuide ?
|
|
1644
|
+
const messageLines = !hasMessage ? "" : hasGuide ? R(opts.output, opts.message, `${symbolBar(this.state)} `, `${symbol(this.state)} `) : formatMessageLines(opts.message);
|
|
1453
1645
|
const title = hasMessage ? `${hasGuide ? `${import_picocolors.default.gray(S_BAR)}\n` : ""}${messageLines}\n` : "";
|
|
1454
1646
|
switch (this.state) {
|
|
1455
1647
|
case "submit": {
|
|
1456
1648
|
const submitPrefix = hasGuide ? `${import_picocolors.default.gray(S_BAR)} ` : nestedPrefix;
|
|
1457
|
-
return `${title}${
|
|
1649
|
+
return `${title}${R(opts.output, opt(this.options[this.cursor], "selected"), submitPrefix)}\n`;
|
|
1458
1650
|
}
|
|
1459
1651
|
case "cancel": {
|
|
1460
1652
|
const cancelPrefix = hasGuide ? `${import_picocolors.default.gray(S_BAR)} ` : nestedPrefix;
|
|
1461
|
-
return `${title}${
|
|
1653
|
+
return `${title}${R(opts.output, opt(this.options[this.cursor], "cancelled"), cancelPrefix)}${hasGuide ? `\n${import_picocolors.default.gray(S_BAR)}` : ""}\n`;
|
|
1462
1654
|
}
|
|
1463
1655
|
default: {
|
|
1464
1656
|
const prefix = hasGuide ? `${import_picocolors.default.blue(S_BAR)} ` : nestedPrefix;
|
|
@@ -1480,7 +1672,7 @@ const select = (opts) => {
|
|
|
1480
1672
|
}).prompt();
|
|
1481
1673
|
};
|
|
1482
1674
|
const text = (opts) => {
|
|
1483
|
-
return new
|
|
1675
|
+
return new at({
|
|
1484
1676
|
validate: opts.validate,
|
|
1485
1677
|
placeholder: opts.placeholder,
|
|
1486
1678
|
defaultValue: opts.defaultValue,
|
|
@@ -2908,7 +3100,7 @@ async function selectPackageManager(interactive, silent = false) {
|
|
|
2908
3100
|
],
|
|
2909
3101
|
initialValue: PackageManager.pnpm
|
|
2910
3102
|
});
|
|
2911
|
-
if (
|
|
3103
|
+
if (q(selected)) cancelAndExit();
|
|
2912
3104
|
return selected;
|
|
2913
3105
|
} else {
|
|
2914
3106
|
if (!silent) log.info(`Using default package manager: ${accent(PackageManager.pnpm)}`);
|
|
@@ -3020,7 +3212,7 @@ async function promptGitHooks(options) {
|
|
|
3020
3212
|
message: "Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?",
|
|
3021
3213
|
initialValue: true
|
|
3022
3214
|
});
|
|
3023
|
-
if (
|
|
3215
|
+
if (q(selected)) {
|
|
3024
3216
|
cancelAndExit();
|
|
3025
3217
|
return false;
|
|
3026
3218
|
}
|
|
@@ -4569,7 +4761,7 @@ async function selectAgentTargetPaths({ interactive, agent, onCancel }) {
|
|
|
4569
4761
|
initialValues: ["chatgpt-codex"],
|
|
4570
4762
|
required: false
|
|
4571
4763
|
});
|
|
4572
|
-
if (
|
|
4764
|
+
if (q(selectedAgents)) {
|
|
4573
4765
|
onCancel();
|
|
4574
4766
|
return;
|
|
4575
4767
|
}
|
|
@@ -4725,7 +4917,7 @@ async function writeAgentInstructions({ projectRoot, targetPath, targetPaths, in
|
|
|
4725
4917
|
}],
|
|
4726
4918
|
initialValue: "skip"
|
|
4727
4919
|
});
|
|
4728
|
-
conflictAction =
|
|
4920
|
+
conflictAction = q(action) || action === "skip" ? "skip" : "append";
|
|
4729
4921
|
} else conflictAction = "skip";
|
|
4730
4922
|
if (conflictAction === "append") await appendAgentContent(destinationPath, targetPathToWrite, existingContent, incomingContent, silent);
|
|
4731
4923
|
else {
|
|
@@ -4797,4 +4989,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
4797
4989
|
};
|
|
4798
4990
|
}
|
|
4799
4991
|
//#endregion
|
|
4800
|
-
export { selectPackageManager as A, log as B, readYamlFile as C, promptGitHooks as D, downloadPackageManager$1 as E, PackageManager as F, text as G, outro as H, require_semver as I, require_picocolors as K, cancel as L, displayRelative as M, templatesDir as N, runViteFmt as O, DependencyType as P, confirm as R, editYamlFile as S, defaultInteractive as T, select as U, multiselect as V, spinner as W, migratePrettierToOxfmt as _, writeAgentInstructions as a, rewriteMonorepoProject as b, detectEslintProject as c, ensurePreCommitHook as d, hasStagedConfigInViteConfig as f, migrateNodeVersionManagerFile as g, migrateEslintToOxlint as h, updateExistingAgentInstructions as i, upgradeYarn as j, runViteInstall as k, detectNodeVersionManagerFile as l, mergeViteConfigFiles as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, installGitHooks as p,
|
|
4992
|
+
export { selectPackageManager as A, log as B, readYamlFile as C, promptGitHooks as D, downloadPackageManager$1 as E, PackageManager as F, text as G, outro as H, require_semver as I, require_picocolors as K, cancel as L, displayRelative as M, templatesDir as N, runViteFmt as O, DependencyType as P, confirm as R, editYamlFile as S, defaultInteractive as T, select as U, multiselect as V, spinner as W, migratePrettierToOxfmt as _, writeAgentInstructions as a, rewriteMonorepoProject as b, detectEslintProject as c, ensurePreCommitHook as d, hasStagedConfigInViteConfig as f, migrateNodeVersionManagerFile as g, migrateEslintToOxlint as h, updateExistingAgentInstructions as i, upgradeYarn as j, runViteInstall as k, detectNodeVersionManagerFile as l, mergeViteConfigFiles as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, installGitHooks as p, q, selectAgentTargetPaths as r, checkVitestVersion as s, detectAgentConflicts as t, detectPrettierProject as u, preflightGitHooksSetup as v, cancelAndExit as w, rewriteStandaloneProject as x, rewriteMonorepo as y, intro as z };
|