@donotdev/cli 0.1.45 → 0.2.0
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/dependencies-matrix.json +191 -150
- package/dist/bin/commands/agent-setup.js +632 -524
- package/dist/bin/commands/build.js +1239 -935
- package/dist/bin/commands/bump.js +1285 -946
- package/dist/bin/commands/cacheout.js +543 -405
- package/dist/bin/commands/coach.js +546 -408
- package/dist/bin/commands/create-app.js +1198 -862
- package/dist/bin/commands/create-project.js +1238 -902
- package/dist/bin/commands/db.js +139128 -93775
- package/dist/bin/commands/deploy.js +2308 -1936
- package/dist/bin/commands/dev.js +912 -662
- package/dist/bin/commands/doctor.js +634 -526
- package/dist/bin/commands/emu.js +1093 -785
- package/dist/bin/commands/format.js +588 -450
- package/dist/bin/commands/get-demo.js +1043 -756
- package/dist/bin/commands/make-admin.js +20974 -38424
- package/dist/bin/commands/preview.js +913 -663
- package/dist/bin/commands/seed.js +139129 -93776
- package/dist/bin/commands/setup-cicd.js +1130 -817
- package/dist/bin/commands/setup.js +1299 -960
- package/dist/bin/commands/staging.js +2308 -1936
- package/dist/bin/commands/sync-secrets.js +996 -733
- package/dist/bin/commands/type-check.js +733 -598
- package/dist/bin/commands/wai.js +533 -395
- package/dist/bin/dndev.js +9 -8
- package/dist/index.js +2720 -2290
- package/package.json +3 -3
- package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
- package/templates/app-next/src/app/layout.tsx.example +19 -1
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
- package/templates/functions-firebase/src/billing/index.ts.example +0 -1
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
- package/templates/functions-firebase/src/index.ts.example +0 -1
- package/templates/functions-supabase/supabase/config.toml.example +4 -0
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
- package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
- package/templates/functions-vercel/.env.example +9 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
- package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
- package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
- package/templates/root-consumer/.claude/settings.json.example +11 -1
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
- package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
|
@@ -5,16 +5,25 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (
|
|
8
|
+
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
18
27
|
};
|
|
19
28
|
var __export = (target, all) => {
|
|
20
29
|
for (var name in all)
|
|
@@ -37,31 +46,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
46
|
mod
|
|
38
47
|
));
|
|
39
48
|
|
|
40
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
41
|
-
var
|
|
49
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
50
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
42
51
|
var init_utils = __esm({
|
|
43
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
52
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
44
53
|
init_utils2();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
55
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
56
|
+
return (input) => {
|
|
57
|
+
let surrogatePairsNr = 0;
|
|
58
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
59
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
60
|
+
surrogatePairsNr += 1;
|
|
61
|
+
}
|
|
62
|
+
return input.length - surrogatePairsNr;
|
|
63
|
+
};
|
|
64
|
+
})();
|
|
48
65
|
isFullWidth = (x) => {
|
|
49
66
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
50
67
|
};
|
|
51
|
-
|
|
52
|
-
return x
|
|
68
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
69
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || 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 >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
53
70
|
};
|
|
54
71
|
}
|
|
55
72
|
});
|
|
56
73
|
|
|
57
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
58
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
74
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
75
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
59
76
|
var init_dist = __esm({
|
|
60
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
77
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
61
78
|
init_utils2();
|
|
62
79
|
init_utils();
|
|
63
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
80
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
64
81
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
82
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
65
83
|
TAB_RE = /\t{1,1000}/y;
|
|
66
84
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
67
85
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -71,14 +89,21 @@ var init_dist = __esm({
|
|
|
71
89
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
72
90
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
73
91
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
74
|
-
const ANSI_WIDTH =
|
|
92
|
+
const ANSI_WIDTH = 0;
|
|
75
93
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
76
94
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
77
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
78
95
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
79
|
-
const FULL_WIDTH_WIDTH =
|
|
96
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
80
97
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
81
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
98
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
99
|
+
const PARSE_BLOCKS = [
|
|
100
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
101
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
102
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
103
|
+
[TAB_RE, TAB_WIDTH],
|
|
104
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
105
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
106
|
+
];
|
|
82
107
|
let indexPrev = 0;
|
|
83
108
|
let index = 0;
|
|
84
109
|
let length = input.length;
|
|
@@ -98,10 +123,8 @@ var init_dist = __esm({
|
|
|
98
123
|
const codePoint = char.codePointAt(0) || 0;
|
|
99
124
|
if (isFullWidth(codePoint)) {
|
|
100
125
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
101
|
-
} else if (
|
|
126
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
102
127
|
widthExtra = WIDE_WIDTH;
|
|
103
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
104
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
105
128
|
} else {
|
|
106
129
|
widthExtra = REGULAR_WIDTH;
|
|
107
130
|
}
|
|
@@ -117,88 +140,28 @@ var init_dist = __esm({
|
|
|
117
140
|
}
|
|
118
141
|
unmatchedStart = unmatchedEnd = 0;
|
|
119
142
|
}
|
|
120
|
-
if (index >= length)
|
|
121
|
-
break;
|
|
122
|
-
LATIN_RE.lastIndex = index;
|
|
123
|
-
if (LATIN_RE.test(input)) {
|
|
124
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
125
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
126
|
-
if (width + widthExtra > truncationLimit) {
|
|
127
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
128
|
-
}
|
|
129
|
-
if (width + widthExtra > LIMIT) {
|
|
130
|
-
truncationEnabled = true;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
width += widthExtra;
|
|
134
|
-
unmatchedStart = indexPrev;
|
|
135
|
-
unmatchedEnd = index;
|
|
136
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
ANSI_RE.lastIndex = index;
|
|
140
|
-
if (ANSI_RE.test(input)) {
|
|
141
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
142
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
143
|
-
}
|
|
144
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
145
|
-
truncationEnabled = true;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
width += ANSI_WIDTH;
|
|
149
|
-
unmatchedStart = indexPrev;
|
|
150
|
-
unmatchedEnd = index;
|
|
151
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
CONTROL_RE.lastIndex = index;
|
|
155
|
-
if (CONTROL_RE.test(input)) {
|
|
156
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
157
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
158
|
-
if (width + widthExtra > truncationLimit) {
|
|
159
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
160
|
-
}
|
|
161
|
-
if (width + widthExtra > LIMIT) {
|
|
162
|
-
truncationEnabled = true;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
width += widthExtra;
|
|
166
|
-
unmatchedStart = indexPrev;
|
|
167
|
-
unmatchedEnd = index;
|
|
168
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
TAB_RE.lastIndex = index;
|
|
172
|
-
if (TAB_RE.test(input)) {
|
|
173
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
174
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
175
|
-
if (width + widthExtra > truncationLimit) {
|
|
176
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
177
|
-
}
|
|
178
|
-
if (width + widthExtra > LIMIT) {
|
|
179
|
-
truncationEnabled = true;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
width += widthExtra;
|
|
183
|
-
unmatchedStart = indexPrev;
|
|
184
|
-
unmatchedEnd = index;
|
|
185
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
186
|
-
continue;
|
|
143
|
+
if (index >= length) {
|
|
144
|
+
break outer;
|
|
187
145
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
147
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
148
|
+
BLOCK_RE.lastIndex = index;
|
|
149
|
+
if (BLOCK_RE.test(input)) {
|
|
150
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
151
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
152
|
+
if (width + widthExtra > truncationLimit) {
|
|
153
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
154
|
+
}
|
|
155
|
+
if (width + widthExtra > LIMIT) {
|
|
156
|
+
truncationEnabled = true;
|
|
157
|
+
break outer;
|
|
158
|
+
}
|
|
159
|
+
width += widthExtra;
|
|
160
|
+
unmatchedStart = indexPrev;
|
|
161
|
+
unmatchedEnd = index;
|
|
162
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
163
|
+
continue outer;
|
|
196
164
|
}
|
|
197
|
-
width += EMOJI_WIDTH;
|
|
198
|
-
unmatchedStart = indexPrev;
|
|
199
|
-
unmatchedEnd = index;
|
|
200
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
201
|
-
continue;
|
|
202
165
|
}
|
|
203
166
|
index += 1;
|
|
204
167
|
}
|
|
@@ -213,10 +176,10 @@ var init_dist = __esm({
|
|
|
213
176
|
}
|
|
214
177
|
});
|
|
215
178
|
|
|
216
|
-
// node_modules/.bun/fast-string-width@
|
|
179
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
217
180
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
218
181
|
var init_dist2 = __esm({
|
|
219
|
-
"node_modules/.bun/fast-string-width@
|
|
182
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
220
183
|
init_utils2();
|
|
221
184
|
init_dist();
|
|
222
185
|
NO_TRUNCATION2 = {
|
|
@@ -231,13 +194,13 @@ var init_dist2 = __esm({
|
|
|
231
194
|
}
|
|
232
195
|
});
|
|
233
196
|
|
|
234
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
197
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
235
198
|
function wrapAnsi(string, columns, options) {
|
|
236
199
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
237
200
|
}
|
|
238
201
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
239
202
|
var init_main = __esm({
|
|
240
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
203
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
241
204
|
init_utils2();
|
|
242
205
|
init_dist2();
|
|
243
206
|
ESC = "\x1B";
|
|
@@ -401,16 +364,19 @@ var init_main = __esm({
|
|
|
401
364
|
}
|
|
402
365
|
const preString = rows.join("\n");
|
|
403
366
|
let inSurrogate = false;
|
|
404
|
-
for (let
|
|
405
|
-
const character = preString[
|
|
367
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
368
|
+
const character = preString[i2];
|
|
406
369
|
returnValue += character;
|
|
407
370
|
if (!inSurrogate) {
|
|
408
371
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
372
|
+
if (inSurrogate) {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
409
375
|
} else {
|
|
410
|
-
|
|
376
|
+
inSurrogate = false;
|
|
411
377
|
}
|
|
412
378
|
if (character === ESC || character === CSI) {
|
|
413
|
-
GROUP_REGEX.lastIndex =
|
|
379
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
414
380
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
415
381
|
const groups = groupsResult?.groups;
|
|
416
382
|
if (groups?.code !== void 0) {
|
|
@@ -420,7 +386,7 @@ var init_main = __esm({
|
|
|
420
386
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
421
387
|
}
|
|
422
388
|
}
|
|
423
|
-
if (preString[
|
|
389
|
+
if (preString[i2 + 1] === "\n") {
|
|
424
390
|
if (escapeUrl) {
|
|
425
391
|
returnValue += wrapAnsiHyperlink("");
|
|
426
392
|
}
|
|
@@ -451,7 +417,7 @@ var require_src = __commonJS({
|
|
|
451
417
|
var ESC2 = "\x1B";
|
|
452
418
|
var CSI2 = `${ESC2}[`;
|
|
453
419
|
var beep = "\x07";
|
|
454
|
-
var
|
|
420
|
+
var cursor3 = {
|
|
455
421
|
to(x, y2) {
|
|
456
422
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
457
423
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -480,7 +446,7 @@ var require_src = __commonJS({
|
|
|
480
446
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
481
447
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
482
448
|
};
|
|
483
|
-
var
|
|
449
|
+
var erase3 = {
|
|
484
450
|
screen: `${CSI2}2J`,
|
|
485
451
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
486
452
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -489,89 +455,169 @@ var require_src = __commonJS({
|
|
|
489
455
|
lineStart: `${CSI2}1K`,
|
|
490
456
|
lines(count) {
|
|
491
457
|
let clear = "";
|
|
492
|
-
for (let
|
|
493
|
-
clear += this.line + (
|
|
458
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
459
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
494
460
|
if (count)
|
|
495
|
-
clear +=
|
|
461
|
+
clear += cursor3.left;
|
|
496
462
|
return clear;
|
|
497
463
|
}
|
|
498
464
|
};
|
|
499
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
465
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
500
466
|
}
|
|
501
467
|
});
|
|
502
468
|
|
|
503
|
-
// node_modules/.bun/@clack+core@1.
|
|
504
|
-
import { styleText
|
|
505
|
-
import { stdout
|
|
506
|
-
import * as
|
|
507
|
-
import
|
|
508
|
-
import { ReadStream
|
|
509
|
-
function
|
|
510
|
-
if (!
|
|
511
|
-
|
|
512
|
-
|
|
469
|
+
// node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
470
|
+
import { styleText } from "node:util";
|
|
471
|
+
import { stdout, stdin } from "node:process";
|
|
472
|
+
import * as l from "node:readline";
|
|
473
|
+
import l__default from "node:readline";
|
|
474
|
+
import { ReadStream } from "node:tty";
|
|
475
|
+
function findCursor(s, o, l2) {
|
|
476
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
477
|
+
return s;
|
|
478
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
479
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
480
|
+
}
|
|
481
|
+
function isAccessible(n3) {
|
|
482
|
+
if (n3 !== void 0) return n3;
|
|
483
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
484
|
+
const e = process.env.ACCESSIBLE;
|
|
485
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
513
486
|
}
|
|
514
|
-
function
|
|
515
|
-
if (typeof
|
|
516
|
-
|
|
487
|
+
function isActionKey(n3, e) {
|
|
488
|
+
if (typeof n3 == "string")
|
|
489
|
+
return settings.aliases.get(n3) === e;
|
|
490
|
+
for (const s of n3)
|
|
491
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
492
|
+
return true;
|
|
517
493
|
return false;
|
|
518
494
|
}
|
|
519
|
-
function
|
|
520
|
-
if (
|
|
521
|
-
const e =
|
|
522
|
-
`),
|
|
523
|
-
`),
|
|
524
|
-
for (let
|
|
525
|
-
|
|
495
|
+
function diffLines(i2, s) {
|
|
496
|
+
if (i2 === s) return;
|
|
497
|
+
const e = i2.split(`
|
|
498
|
+
`), t2 = s.split(`
|
|
499
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
500
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
501
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
502
|
+
return {
|
|
503
|
+
lines: f,
|
|
504
|
+
numLinesBefore: e.length,
|
|
505
|
+
numLinesAfter: t2.length,
|
|
506
|
+
numLines: r2
|
|
507
|
+
};
|
|
526
508
|
}
|
|
527
|
-
function
|
|
528
|
-
return
|
|
509
|
+
function isCancel(e) {
|
|
510
|
+
return e === CANCEL_SYMBOL;
|
|
529
511
|
}
|
|
530
|
-
function
|
|
531
|
-
const
|
|
532
|
-
|
|
512
|
+
function setRawMode(e, r2) {
|
|
513
|
+
const o = e;
|
|
514
|
+
o.isTTY && o.setRawMode(r2);
|
|
533
515
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
516
|
+
function block({
|
|
517
|
+
input: e = stdin,
|
|
518
|
+
output: r2 = stdout,
|
|
519
|
+
overwrite: o = true,
|
|
520
|
+
hideCursor: n3 = true
|
|
521
|
+
} = {}) {
|
|
522
|
+
const s = l.createInterface({
|
|
523
|
+
input: e,
|
|
524
|
+
output: r2,
|
|
525
|
+
prompt: "",
|
|
526
|
+
tabSize: 1
|
|
527
|
+
});
|
|
528
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
529
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
530
|
+
const c2 = String(f);
|
|
531
|
+
if (isActionKey([c2, a2, w], "cancel")) {
|
|
532
|
+
n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
541
533
|
return;
|
|
542
534
|
}
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
535
|
+
if (!o) return;
|
|
536
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
537
|
+
l.moveCursor(r2, i2, m, () => {
|
|
538
|
+
l.clearLine(r2, 1, () => {
|
|
539
|
+
e.once("keypress", t2);
|
|
548
540
|
});
|
|
549
541
|
});
|
|
550
542
|
};
|
|
551
|
-
return
|
|
552
|
-
|
|
543
|
+
return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
544
|
+
e.off("keypress", t2), n3 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
553
545
|
};
|
|
554
546
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
return wrapAnsi(
|
|
558
|
-
|
|
547
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
548
|
+
const f = getColumns(e ?? stdout);
|
|
549
|
+
return wrapAnsi(r2, f - o.length, {
|
|
550
|
+
hard: true,
|
|
551
|
+
trim: false
|
|
552
|
+
}).split(`
|
|
553
|
+
`).map((c2, i2, m) => {
|
|
554
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
555
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
556
|
+
}).join(`
|
|
559
557
|
`);
|
|
560
558
|
}
|
|
561
|
-
|
|
559
|
+
function runValidation(e, a2) {
|
|
560
|
+
if ("~standard" in e) {
|
|
561
|
+
const n3 = e["~standard"].validate(a2);
|
|
562
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
563
|
+
}
|
|
564
|
+
return e(a2);
|
|
565
|
+
}
|
|
566
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1, n2;
|
|
562
567
|
var init_dist3 = __esm({
|
|
563
|
-
"node_modules/.bun/@clack+core@1.
|
|
568
|
+
"node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
|
|
564
569
|
init_utils2();
|
|
565
570
|
init_main();
|
|
566
571
|
import_sisteransi = __toESM(require_src(), 1);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
572
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
573
|
+
t = [
|
|
574
|
+
"January",
|
|
575
|
+
"February",
|
|
576
|
+
"March",
|
|
577
|
+
"April",
|
|
578
|
+
"May",
|
|
579
|
+
"June",
|
|
580
|
+
"July",
|
|
581
|
+
"August",
|
|
582
|
+
"September",
|
|
583
|
+
"October",
|
|
584
|
+
"November",
|
|
585
|
+
"December"
|
|
586
|
+
];
|
|
587
|
+
settings = {
|
|
588
|
+
actions: new Set(a$1),
|
|
589
|
+
aliases: /* @__PURE__ */ new Map([
|
|
590
|
+
// vim support
|
|
591
|
+
["k", "up"],
|
|
592
|
+
["j", "down"],
|
|
593
|
+
["h", "left"],
|
|
594
|
+
["l", "right"],
|
|
595
|
+
["", "cancel"],
|
|
596
|
+
// opinionated defaults!
|
|
597
|
+
["escape", "cancel"]
|
|
598
|
+
]),
|
|
599
|
+
messages: {
|
|
600
|
+
cancel: "Canceled",
|
|
601
|
+
error: "Something went wrong"
|
|
602
|
+
},
|
|
603
|
+
withGuide: true,
|
|
604
|
+
accessible: void 0,
|
|
605
|
+
date: {
|
|
606
|
+
monthNames: [...t],
|
|
607
|
+
messages: {
|
|
608
|
+
required: "Please enter a valid date",
|
|
609
|
+
invalidMonth: "There are only 12 months in a year",
|
|
610
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
611
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
612
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
R = globalThis.process.platform.startsWith("win");
|
|
617
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
618
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
619
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
620
|
+
y = class {
|
|
575
621
|
input;
|
|
576
622
|
output;
|
|
577
623
|
_abortSignal;
|
|
@@ -586,46 +632,92 @@ var init_dist3 = __esm({
|
|
|
586
632
|
error = "";
|
|
587
633
|
value;
|
|
588
634
|
userInput = "";
|
|
635
|
+
/**
|
|
636
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
637
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
638
|
+
* and the `ACCESSIBLE` env var.
|
|
639
|
+
*/
|
|
640
|
+
get accessible() {
|
|
641
|
+
return isAccessible(this.opts.accessible);
|
|
642
|
+
}
|
|
589
643
|
constructor(t2, e = true) {
|
|
590
|
-
const { input:
|
|
591
|
-
this.opts =
|
|
644
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
645
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
592
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Unsubscribe all listeners
|
|
649
|
+
*/
|
|
593
650
|
unsubscribe() {
|
|
594
651
|
this._subscribers.clear();
|
|
595
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* Set a subscriber with opts
|
|
655
|
+
* @param event - The event name
|
|
656
|
+
*/
|
|
596
657
|
setSubscriber(t2, e) {
|
|
597
|
-
const
|
|
598
|
-
|
|
658
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
659
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
599
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Subscribe to an event
|
|
663
|
+
* @param event - The event name
|
|
664
|
+
* @param cb - The callback
|
|
665
|
+
*/
|
|
600
666
|
on(t2, e) {
|
|
601
667
|
this.setSubscriber(t2, { cb: e });
|
|
602
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* Subscribe to an event once
|
|
671
|
+
* @param event - The event name
|
|
672
|
+
* @param cb - The callback
|
|
673
|
+
*/
|
|
603
674
|
once(t2, e) {
|
|
604
675
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
605
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Emit an event with data
|
|
679
|
+
* @param event - The event name
|
|
680
|
+
* @param data - The data to pass to the callback
|
|
681
|
+
*/
|
|
606
682
|
emit(t2, ...e) {
|
|
607
|
-
const
|
|
608
|
-
for (const
|
|
609
|
-
|
|
683
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
684
|
+
for (const r2 of i2)
|
|
685
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
686
|
+
for (const r2 of s)
|
|
687
|
+
r2();
|
|
610
688
|
}
|
|
611
689
|
prompt() {
|
|
612
690
|
return new Promise((t2) => {
|
|
613
691
|
if (this._abortSignal) {
|
|
614
|
-
if (this._abortSignal.aborted)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
692
|
+
if (this._abortSignal.aborted)
|
|
693
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
694
|
+
this._abortSignal.addEventListener(
|
|
695
|
+
"abort",
|
|
696
|
+
() => {
|
|
697
|
+
this.state = "cancel", this.close();
|
|
698
|
+
},
|
|
699
|
+
{ once: true }
|
|
700
|
+
);
|
|
618
701
|
}
|
|
619
|
-
this.rl =
|
|
620
|
-
|
|
702
|
+
this.rl = l__default.createInterface({
|
|
703
|
+
input: this.input,
|
|
704
|
+
tabSize: 2,
|
|
705
|
+
prompt: "",
|
|
706
|
+
escapeCodeTimeout: 50,
|
|
707
|
+
terminal: true
|
|
708
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
709
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
621
710
|
}), this.once("cancel", () => {
|
|
622
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
711
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
623
712
|
});
|
|
624
713
|
});
|
|
625
714
|
}
|
|
626
715
|
_isActionKey(t2, e) {
|
|
627
716
|
return t2 === " ";
|
|
628
717
|
}
|
|
718
|
+
_shouldSubmit(t2, e) {
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
629
721
|
_setValue(t2) {
|
|
630
722
|
this.value = t2, this.emit("value", this.value);
|
|
631
723
|
}
|
|
@@ -635,19 +727,22 @@ var init_dist3 = __esm({
|
|
|
635
727
|
_clearUserInput() {
|
|
636
728
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
637
729
|
}
|
|
638
|
-
onKeypress(t2, e) {
|
|
639
|
-
if (this.
|
|
640
|
-
if (this.
|
|
641
|
-
|
|
642
|
-
|
|
730
|
+
async onKeypress(t2, e) {
|
|
731
|
+
if (this.state !== "validating") {
|
|
732
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
733
|
+
if (this.opts.validate) {
|
|
734
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
735
|
+
let s;
|
|
736
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
737
|
+
}
|
|
738
|
+
this.state !== "error" && (this.state = "submit");
|
|
643
739
|
}
|
|
644
|
-
this.state
|
|
740
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
645
741
|
}
|
|
646
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
647
742
|
}
|
|
648
743
|
close() {
|
|
649
744
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
650
|
-
`),
|
|
745
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
651
746
|
}
|
|
652
747
|
restoreCursor() {
|
|
653
748
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -655,34 +750,39 @@ var init_dist3 = __esm({
|
|
|
655
750
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
656
751
|
}
|
|
657
752
|
render() {
|
|
658
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
753
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
754
|
+
hard: true,
|
|
755
|
+
trim: false
|
|
756
|
+
});
|
|
659
757
|
if (t2 !== this._prevFrame) {
|
|
660
|
-
if (this.state === "initial")
|
|
758
|
+
if (this.state === "initial")
|
|
759
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
661
760
|
else {
|
|
662
|
-
const e =
|
|
761
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
663
762
|
if (this.restoreCursor(), e) {
|
|
664
|
-
const
|
|
665
|
-
let
|
|
666
|
-
if (
|
|
763
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
764
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
765
|
+
if (n3 === void 0) {
|
|
667
766
|
this._prevFrame = t2;
|
|
668
767
|
return;
|
|
669
768
|
}
|
|
670
769
|
if (e.lines.length === 1) {
|
|
671
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
672
|
-
const
|
|
770
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
771
|
+
const o = t2.split(`
|
|
673
772
|
`);
|
|
674
|
-
this.output.write(
|
|
773
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
675
774
|
return;
|
|
676
775
|
} else if (e.lines.length > 1) {
|
|
677
|
-
if (
|
|
776
|
+
if (s < r2)
|
|
777
|
+
n3 = s;
|
|
678
778
|
else {
|
|
679
|
-
const
|
|
680
|
-
|
|
779
|
+
const h2 = n3 - r2;
|
|
780
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
681
781
|
}
|
|
682
782
|
this.output.write(import_sisteransi.erase.down());
|
|
683
|
-
const
|
|
684
|
-
`).slice(
|
|
685
|
-
this.output.write(
|
|
783
|
+
const f = t2.split(`
|
|
784
|
+
`).slice(n3);
|
|
785
|
+
this.output.write(f.join(`
|
|
686
786
|
`)), this._prevFrame = t2;
|
|
687
787
|
return;
|
|
688
788
|
}
|
|
@@ -693,7 +793,7 @@ var init_dist3 = __esm({
|
|
|
693
793
|
}
|
|
694
794
|
}
|
|
695
795
|
};
|
|
696
|
-
|
|
796
|
+
r = class extends y {
|
|
697
797
|
get cursor() {
|
|
698
798
|
return this.value ? 0 : 1;
|
|
699
799
|
}
|
|
@@ -703,54 +803,60 @@ var init_dist3 = __esm({
|
|
|
703
803
|
constructor(t2) {
|
|
704
804
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
705
805
|
this.value = this._value;
|
|
706
|
-
}), this.on("confirm", (
|
|
707
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
806
|
+
}), this.on("confirm", (i2) => {
|
|
807
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
708
808
|
}), this.on("cursor", () => {
|
|
709
809
|
this.value = !this.value;
|
|
710
810
|
});
|
|
711
811
|
}
|
|
712
812
|
};
|
|
713
|
-
|
|
813
|
+
n$1 = class n extends y {
|
|
714
814
|
options;
|
|
715
815
|
cursor = 0;
|
|
716
816
|
get _selectedValue() {
|
|
717
817
|
return this.options[this.cursor];
|
|
718
818
|
}
|
|
719
819
|
changeValue() {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
820
|
+
const e = this._selectedValue;
|
|
821
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
822
|
+
}
|
|
823
|
+
constructor(e) {
|
|
824
|
+
super(e, false), this.options = e.options;
|
|
825
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
826
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
827
|
+
switch (s) {
|
|
727
828
|
case "left":
|
|
728
829
|
case "up":
|
|
729
|
-
this.cursor =
|
|
830
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
730
831
|
break;
|
|
731
832
|
case "down":
|
|
732
833
|
case "right":
|
|
733
|
-
this.cursor =
|
|
834
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
734
835
|
break;
|
|
735
836
|
}
|
|
736
837
|
this.changeValue();
|
|
737
838
|
});
|
|
738
839
|
}
|
|
739
840
|
};
|
|
740
|
-
|
|
841
|
+
n2 = class extends y {
|
|
741
842
|
get userInputWithCursor() {
|
|
742
|
-
if (this.state === "submit")
|
|
843
|
+
if (this.state === "submit")
|
|
844
|
+
return this.userInput;
|
|
743
845
|
const t2 = this.userInput;
|
|
744
|
-
if (this.cursor >= t2.length)
|
|
745
|
-
|
|
746
|
-
|
|
846
|
+
if (this.cursor >= t2.length)
|
|
847
|
+
return `${this.userInput}\u2588`;
|
|
848
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
849
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
747
850
|
}
|
|
748
851
|
get cursor() {
|
|
749
852
|
return this._cursor;
|
|
750
853
|
}
|
|
751
854
|
constructor(t2) {
|
|
752
|
-
super({
|
|
753
|
-
|
|
855
|
+
super({
|
|
856
|
+
...t2,
|
|
857
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
858
|
+
}), this.on("userInput", (r2) => {
|
|
859
|
+
this._setValue(r2);
|
|
754
860
|
}), this.on("finalize", () => {
|
|
755
861
|
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
756
862
|
});
|
|
@@ -759,328 +865,503 @@ var init_dist3 = __esm({
|
|
|
759
865
|
}
|
|
760
866
|
});
|
|
761
867
|
|
|
762
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
763
|
-
import { styleText as
|
|
764
|
-
import
|
|
765
|
-
import { existsSync
|
|
766
|
-
import { dirname
|
|
767
|
-
function
|
|
768
|
-
|
|
868
|
+
// node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
869
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
870
|
+
import process$1 from "node:process";
|
|
871
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
872
|
+
import { dirname, join } from "node:path";
|
|
873
|
+
function isUnicodeSupported() {
|
|
874
|
+
if (process$1.platform !== "win32") {
|
|
875
|
+
return process$1.env.TERM !== "linux";
|
|
876
|
+
}
|
|
877
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
769
878
|
}
|
|
770
|
-
|
|
879
|
+
function formatInstructionFooter(o, e) {
|
|
880
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
881
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
882
|
+
}
|
|
883
|
+
var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
|
|
771
884
|
var init_dist4 = __esm({
|
|
772
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
885
|
+
"node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
773
886
|
init_utils2();
|
|
774
887
|
init_dist3();
|
|
775
888
|
init_dist3();
|
|
776
889
|
init_main();
|
|
777
890
|
init_dist2();
|
|
778
891
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
switch (
|
|
892
|
+
unicode = isUnicodeSupported();
|
|
893
|
+
isCI = () => process.env.CI === "true";
|
|
894
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
895
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
896
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
897
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
898
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
899
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
900
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
901
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
902
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
903
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
904
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
905
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
906
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
907
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
908
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
909
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
910
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
911
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
912
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
913
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
914
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
915
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
916
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
917
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
918
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
919
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
920
|
+
symbol = (o) => {
|
|
921
|
+
switch (o) {
|
|
809
922
|
case "initial":
|
|
810
923
|
case "active":
|
|
811
|
-
return
|
|
924
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
812
925
|
case "cancel":
|
|
813
|
-
return
|
|
926
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
814
927
|
case "error":
|
|
815
|
-
return
|
|
928
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
816
929
|
case "submit":
|
|
817
|
-
return
|
|
930
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
931
|
+
case "validating":
|
|
932
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
818
933
|
}
|
|
819
934
|
};
|
|
820
|
-
|
|
821
|
-
switch (
|
|
935
|
+
symbolBar = (o) => {
|
|
936
|
+
switch (o) {
|
|
822
937
|
case "initial":
|
|
823
938
|
case "active":
|
|
824
|
-
return
|
|
939
|
+
return styleText2("cyan", S_BAR);
|
|
825
940
|
case "cancel":
|
|
826
|
-
return
|
|
941
|
+
return styleText2("red", S_BAR);
|
|
827
942
|
case "error":
|
|
828
|
-
return
|
|
943
|
+
return styleText2("yellow", S_BAR);
|
|
829
944
|
case "submit":
|
|
830
|
-
return
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
let
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
945
|
+
return styleText2("green", S_BAR);
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
I = (l2, e, w, p, b, C2 = false) => {
|
|
949
|
+
let r2 = e, O = 0;
|
|
950
|
+
if (C2)
|
|
951
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
952
|
+
const m = l2[i2];
|
|
953
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
954
|
+
}
|
|
955
|
+
else
|
|
956
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
957
|
+
const m = l2[i2];
|
|
958
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
959
|
+
}
|
|
960
|
+
return { lineCount: r2, removals: O };
|
|
961
|
+
};
|
|
962
|
+
limitOptions = ({
|
|
963
|
+
cursor: l2,
|
|
964
|
+
options: e,
|
|
965
|
+
style: w,
|
|
966
|
+
output: p = process.stdout,
|
|
967
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
968
|
+
columnPadding: C2 = 0,
|
|
969
|
+
rowPadding: r2 = 4
|
|
970
|
+
}) => {
|
|
971
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
847
972
|
let f = 0;
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
973
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
974
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
975
|
+
0
|
|
976
|
+
));
|
|
977
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
978
|
+
const W2 = Math.min(
|
|
979
|
+
f + a2,
|
|
980
|
+
e.length
|
|
981
|
+
), s = [];
|
|
982
|
+
let g = 0;
|
|
983
|
+
d && g++, c2 && g++;
|
|
984
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
|
|
985
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
986
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
987
|
+
hard: true,
|
|
988
|
+
trim: false
|
|
989
|
+
}).split(`
|
|
852
990
|
`);
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
if (
|
|
856
|
-
let
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
991
|
+
s.push(h2), g += h2.length;
|
|
992
|
+
}
|
|
993
|
+
if (g > v) {
|
|
994
|
+
let t2 = 0, n3 = 0, o = g;
|
|
995
|
+
const h2 = l2 - T;
|
|
996
|
+
let u3 = v;
|
|
997
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
998
|
+
s,
|
|
999
|
+
o,
|
|
1000
|
+
h2 + 1,
|
|
1001
|
+
s.length,
|
|
1002
|
+
u3,
|
|
1003
|
+
true
|
|
1004
|
+
);
|
|
1005
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
1006
|
+
}
|
|
1007
|
+
const x = [];
|
|
1008
|
+
d && x.push(M);
|
|
1009
|
+
for (const t2 of s)
|
|
1010
|
+
for (const n3 of t2)
|
|
1011
|
+
x.push(n3);
|
|
1012
|
+
return c2 && x.push(M), x;
|
|
1013
|
+
};
|
|
1014
|
+
confirm = (e) => {
|
|
1015
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
1016
|
+
return new r({
|
|
1017
|
+
active: a2,
|
|
1018
|
+
inactive: o,
|
|
1019
|
+
signal: e.signal,
|
|
1020
|
+
input: e.input,
|
|
1021
|
+
output: e.output,
|
|
1022
|
+
initialValue: e.initialValue ?? true,
|
|
1023
|
+
render() {
|
|
1024
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1025
|
+
e.output,
|
|
1026
|
+
e.message,
|
|
1027
|
+
l2,
|
|
1028
|
+
u3
|
|
1029
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1030
|
+
` : ""}${f}
|
|
1031
|
+
`, c2 = this.value ? a2 : o;
|
|
1032
|
+
switch (this.state) {
|
|
1033
|
+
case "submit": {
|
|
1034
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1035
|
+
return `${s}${r2}${styleText2("dim", c2)}`;
|
|
1036
|
+
}
|
|
1037
|
+
case "cancel": {
|
|
1038
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1039
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
|
|
1040
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1041
|
+
}
|
|
1042
|
+
default: {
|
|
1043
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1044
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1045
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1046
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1047
|
+
${g}
|
|
887
1048
|
`;
|
|
1049
|
+
}
|
|
888
1050
|
}
|
|
889
1051
|
}
|
|
890
|
-
}
|
|
1052
|
+
}).prompt();
|
|
891
1053
|
};
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1054
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
1055
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1056
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1057
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1058
|
+
];
|
|
1059
|
+
log = {
|
|
1060
|
+
message: (s = [], {
|
|
1061
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1062
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1063
|
+
output: m = process.stdout,
|
|
1064
|
+
spacing: l2 = 1,
|
|
1065
|
+
withGuide: c2
|
|
1066
|
+
} = {}) => {
|
|
1067
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1068
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1069
|
+
t2.push(f);
|
|
1070
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
896
1071
|
`);
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1072
|
+
if (g.length > 0) {
|
|
1073
|
+
const [i2, ...y2] = g;
|
|
1074
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1075
|
+
for (const p of y2)
|
|
1076
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1077
|
+
}
|
|
1078
|
+
m.write(`${t2.join(`
|
|
903
1079
|
`)}
|
|
904
1080
|
`);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1081
|
+
},
|
|
1082
|
+
info: (s, e) => {
|
|
1083
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1084
|
+
},
|
|
1085
|
+
success: (s, e) => {
|
|
1086
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1087
|
+
},
|
|
1088
|
+
step: (s, e) => {
|
|
1089
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1090
|
+
},
|
|
1091
|
+
warn: (s, e) => {
|
|
1092
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1093
|
+
},
|
|
1094
|
+
/** alias for `log.warn()`. */
|
|
1095
|
+
warning: (s, e) => {
|
|
1096
|
+
log.warn(s, e);
|
|
1097
|
+
},
|
|
1098
|
+
error: (s, e) => {
|
|
1099
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
cancel = (o = "", t2) => {
|
|
1103
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1104
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
921
1105
|
|
|
922
1106
|
`);
|
|
923
1107
|
};
|
|
924
|
-
|
|
925
|
-
const
|
|
926
|
-
|
|
1108
|
+
intro = (o = "", t2) => {
|
|
1109
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1110
|
+
i2.write(`${e}${o}
|
|
927
1111
|
`);
|
|
928
1112
|
};
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
${
|
|
932
|
-
|
|
1113
|
+
outro = (o = "", t2) => {
|
|
1114
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1115
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1116
|
+
i2.write(`${e}${o}
|
|
933
1117
|
|
|
934
1118
|
`);
|
|
935
1119
|
};
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1120
|
+
W$1 = (o) => o;
|
|
1121
|
+
C = (o, e, s) => {
|
|
1122
|
+
const a2 = {
|
|
1123
|
+
hard: true,
|
|
1124
|
+
trim: false
|
|
1125
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1126
|
+
`), c2 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c2);
|
|
1127
|
+
return wrapAnsi(o, g, a2);
|
|
1128
|
+
};
|
|
1129
|
+
note = (o = "", e = "", s) => {
|
|
1130
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
|
|
1131
|
+
`).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1132
|
+
g.reduce((m, F) => {
|
|
1133
|
+
const O = dist_default2(F);
|
|
1134
|
+
return O > m ? O : m;
|
|
1135
|
+
}, 0),
|
|
1136
|
+
n3
|
|
1137
|
+
) + 2, h2 = g.map(
|
|
1138
|
+
(m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
|
|
1139
|
+
).join(`
|
|
1140
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1141
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1142
|
+
a2.write(
|
|
1143
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1144
|
+
"gray",
|
|
1145
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1146
|
+
)}
|
|
1147
|
+
${h2}
|
|
1148
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1149
|
+
`
|
|
1150
|
+
);
|
|
954
1151
|
};
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1152
|
+
W = (l2) => styleText2("magenta", l2);
|
|
1153
|
+
spinner = ({
|
|
1154
|
+
indicator: l2 = "dots",
|
|
1155
|
+
onCancel: h2,
|
|
1156
|
+
output: n3 = process.stdout,
|
|
1157
|
+
cancelMessage: G,
|
|
1158
|
+
errorMessage: O,
|
|
1159
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1160
|
+
delay: F = unicode ? 80 : 120,
|
|
1161
|
+
signal: m,
|
|
1162
|
+
...I2
|
|
1163
|
+
} = {}) => {
|
|
1164
|
+
const u3 = isCI();
|
|
1165
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1166
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1167
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1168
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1169
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1170
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
|
|
1171
|
+
}, H = () => {
|
|
1172
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
|
|
1173
|
+
}, y2 = () => {
|
|
1174
|
+
if (p === void 0) return;
|
|
1175
|
+
u3 && n3.write(`
|
|
969
1176
|
`);
|
|
970
|
-
const
|
|
1177
|
+
const r2 = wrapAnsi(p, x, {
|
|
1178
|
+
hard: true,
|
|
1179
|
+
trim: false
|
|
1180
|
+
}).split(`
|
|
971
1181
|
`);
|
|
972
|
-
|
|
973
|
-
},
|
|
974
|
-
const
|
|
975
|
-
return
|
|
976
|
-
},
|
|
977
|
-
|
|
1182
|
+
r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
|
|
1183
|
+
}, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1184
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1185
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1186
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1187
|
+
d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
978
1188
|
`);
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
if (
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1189
|
+
let r2 = 0, t2 = 0;
|
|
1190
|
+
A(), T = setInterval(() => {
|
|
1191
|
+
if (u3 && s === p)
|
|
1192
|
+
return;
|
|
1193
|
+
y2(), p = s;
|
|
1194
|
+
const o = k(E[r2]);
|
|
1195
|
+
let v;
|
|
1196
|
+
if (u3)
|
|
1197
|
+
v = `${o} ${s}...`;
|
|
1198
|
+
else if (l2 === "timer")
|
|
1199
|
+
v = `${o} ${s} ${_(w)}`;
|
|
987
1200
|
else {
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1201
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1202
|
+
v = `${o} ${s}${B}`;
|
|
1203
|
+
}
|
|
1204
|
+
const j = wrapAnsi(v, x, {
|
|
1205
|
+
hard: true,
|
|
1206
|
+
trim: false
|
|
1207
|
+
});
|
|
1208
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1209
|
+
}, F);
|
|
1210
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1211
|
+
if (!d) return;
|
|
1212
|
+
d = false, clearInterval(T), y2();
|
|
1213
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1214
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1215
|
+
`) : n3.write(`${o} ${s}
|
|
1216
|
+
`)), H(), M();
|
|
1001
1217
|
};
|
|
1002
|
-
return {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1218
|
+
return {
|
|
1219
|
+
start: P,
|
|
1220
|
+
stop: (e = "") => a2(e, 0),
|
|
1221
|
+
message: (e = "") => {
|
|
1222
|
+
s = C2(e ?? s);
|
|
1223
|
+
},
|
|
1224
|
+
cancel: (e = "") => a2(e, 1),
|
|
1225
|
+
error: (e = "") => a2(e, 2),
|
|
1226
|
+
clear: () => a2("", 0, true),
|
|
1227
|
+
get isCancelled() {
|
|
1228
|
+
return S;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
u2 = {
|
|
1233
|
+
light: unicodeOr("\u2500", "-"),
|
|
1234
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1235
|
+
block: unicodeOr("\u2588", "#")
|
|
1236
|
+
};
|
|
1237
|
+
SELECT_INSTRUCTIONS = [
|
|
1238
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1239
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1240
|
+
];
|
|
1241
|
+
c = (t2, o) => t2.includes(`
|
|
1242
|
+
`) ? t2.split(`
|
|
1243
|
+
`).map((d) => o(d)).join(`
|
|
1244
|
+
`) : o(t2);
|
|
1245
|
+
select = (t2) => {
|
|
1246
|
+
const o = (n3, m) => {
|
|
1247
|
+
if (n3 === void 0)
|
|
1248
|
+
return "";
|
|
1249
|
+
const s = n3.label ?? String(n3.value);
|
|
1250
|
+
switch (m) {
|
|
1017
1251
|
case "disabled":
|
|
1018
|
-
return `${
|
|
1252
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1019
1253
|
case "selected":
|
|
1020
|
-
return `${
|
|
1254
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1021
1255
|
case "active":
|
|
1022
|
-
return `${
|
|
1256
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1023
1257
|
case "cancelled":
|
|
1024
|
-
return `${
|
|
1258
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1025
1259
|
default:
|
|
1026
|
-
return `${
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
return new
|
|
1030
|
-
|
|
1031
|
-
|
|
1260
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1261
|
+
}
|
|
1262
|
+
}, d = t2.showInstructions ?? true;
|
|
1263
|
+
return new n$1({
|
|
1264
|
+
options: t2.options,
|
|
1265
|
+
signal: t2.signal,
|
|
1266
|
+
input: t2.input,
|
|
1267
|
+
output: t2.output,
|
|
1268
|
+
initialValue: t2.initialValue,
|
|
1269
|
+
render() {
|
|
1270
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1271
|
+
t2.output,
|
|
1272
|
+
t2.message,
|
|
1273
|
+
s,
|
|
1274
|
+
m
|
|
1275
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1276
|
+
` : ""}${i2}
|
|
1032
1277
|
`;
|
|
1278
|
+
switch (this.state) {
|
|
1279
|
+
case "submit": {
|
|
1280
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1281
|
+
t2.output,
|
|
1282
|
+
o(this.options[this.cursor], "selected"),
|
|
1283
|
+
r2
|
|
1284
|
+
);
|
|
1285
|
+
return `${u3}${a2}`;
|
|
1286
|
+
}
|
|
1287
|
+
case "cancel": {
|
|
1288
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1289
|
+
t2.output,
|
|
1290
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1291
|
+
r2
|
|
1292
|
+
);
|
|
1293
|
+
return `${u3}${a2}${n3 ? `
|
|
1294
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1295
|
+
}
|
|
1296
|
+
default: {
|
|
1297
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1298
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1299
|
+
`), b = p.length + 1;
|
|
1300
|
+
return `${u3}${r2}${limitOptions({
|
|
1301
|
+
output: t2.output,
|
|
1302
|
+
cursor: this.cursor,
|
|
1303
|
+
options: this.options,
|
|
1304
|
+
maxItems: t2.maxItems,
|
|
1305
|
+
columnPadding: r2.length,
|
|
1306
|
+
rowPadding: a2 + b,
|
|
1307
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1308
|
+
}).join(`
|
|
1309
|
+
${r2}`)}
|
|
1310
|
+
${f}
|
|
1311
|
+
`;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}).prompt();
|
|
1316
|
+
};
|
|
1317
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
1318
|
+
text = (t2) => new n2({
|
|
1319
|
+
validate: t2.validate,
|
|
1320
|
+
placeholder: t2.placeholder,
|
|
1321
|
+
defaultValue: t2.defaultValue,
|
|
1322
|
+
initialValue: t2.initialValue,
|
|
1323
|
+
output: t2.output,
|
|
1324
|
+
signal: t2.signal,
|
|
1325
|
+
input: t2.input,
|
|
1326
|
+
render() {
|
|
1327
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1328
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1329
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1330
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1331
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
1332
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1033
1333
|
switch (this.state) {
|
|
1334
|
+
case "validating": {
|
|
1335
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1336
|
+
return `${l2}${n3}${c2}
|
|
1337
|
+
${i2} ${$}
|
|
1338
|
+
`;
|
|
1339
|
+
}
|
|
1340
|
+
case "error": {
|
|
1341
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1342
|
+
return `${l2.trim()}
|
|
1343
|
+
${i2}${o}
|
|
1344
|
+
${c2}${n3}
|
|
1345
|
+
`;
|
|
1346
|
+
}
|
|
1034
1347
|
case "submit": {
|
|
1035
|
-
const
|
|
1036
|
-
return `${
|
|
1348
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1349
|
+
return `${l2}${i2}${n3}`;
|
|
1037
1350
|
}
|
|
1038
1351
|
case "cancel": {
|
|
1039
|
-
const
|
|
1040
|
-
return `${
|
|
1041
|
-
${
|
|
1352
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1353
|
+
return `${l2}${i2}${n3}${s.trim() ? `
|
|
1354
|
+
${i2}` : ""}`;
|
|
1042
1355
|
}
|
|
1043
1356
|
default: {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
${c2}`)}
|
|
1048
|
-
${a}
|
|
1357
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1358
|
+
return `${l2}${n3}${o}
|
|
1359
|
+
${i2}
|
|
1049
1360
|
`;
|
|
1050
1361
|
}
|
|
1051
1362
|
}
|
|
1052
|
-
} }).prompt();
|
|
1053
|
-
};
|
|
1054
|
-
je = `${t("gray", d2)} `;
|
|
1055
|
-
Ot = (e) => new at({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
|
|
1056
|
-
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${t("gray", d2)}
|
|
1057
|
-
` : ""}${V2(this.state)} `}${e.message}
|
|
1058
|
-
`, r = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1059
|
-
switch (this.state) {
|
|
1060
|
-
case "error": {
|
|
1061
|
-
const o = this.error ? ` ${t("yellow", this.error)}` : "", c2 = i ? `${t("yellow", d2)} ` : "", a = i ? t("yellow", E2) : "";
|
|
1062
|
-
return `${s.trim()}
|
|
1063
|
-
${c2}${u2}
|
|
1064
|
-
${a}${o}
|
|
1065
|
-
`;
|
|
1066
|
-
}
|
|
1067
|
-
case "submit": {
|
|
1068
|
-
const o = n ? ` ${t("dim", n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1069
|
-
return `${s}${c2}${o}`;
|
|
1070
|
-
}
|
|
1071
|
-
case "cancel": {
|
|
1072
|
-
const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1073
|
-
return `${s}${c2}${o}${n.trim() ? `
|
|
1074
|
-
${c2}` : ""}`;
|
|
1075
|
-
}
|
|
1076
|
-
default: {
|
|
1077
|
-
const o = i ? `${t("cyan", d2)} ` : "", c2 = i ? t("cyan", E2) : "";
|
|
1078
|
-
return `${s}${o}${u2}
|
|
1079
|
-
${c2}
|
|
1080
|
-
`;
|
|
1081
|
-
}
|
|
1082
1363
|
}
|
|
1083
|
-
}
|
|
1364
|
+
}).prompt();
|
|
1084
1365
|
}
|
|
1085
1366
|
});
|
|
1086
1367
|
|
|
@@ -1088,21 +1369,21 @@ ${c2}
|
|
|
1088
1369
|
var cli_output_exports = {};
|
|
1089
1370
|
__export(cli_output_exports, {
|
|
1090
1371
|
LogLevel: () => LogLevel,
|
|
1091
|
-
cancel: () =>
|
|
1372
|
+
cancel: () => cancel,
|
|
1092
1373
|
colorUtils: () => colorUtils,
|
|
1093
1374
|
displayDoNotDevError: () => displayDoNotDevError,
|
|
1094
1375
|
error: () => error,
|
|
1095
1376
|
getLogLevel: () => getLogLevel,
|
|
1096
1377
|
info: () => info,
|
|
1097
|
-
intro: () =>
|
|
1098
|
-
isCancel: () =>
|
|
1378
|
+
intro: () => intro,
|
|
1379
|
+
isCancel: () => isCancel,
|
|
1099
1380
|
isDebug: () => isDebug,
|
|
1100
1381
|
isVerbose: () => isVerbose,
|
|
1101
|
-
log: () =>
|
|
1102
|
-
note: () =>
|
|
1103
|
-
outro: () =>
|
|
1382
|
+
log: () => log2,
|
|
1383
|
+
note: () => note,
|
|
1384
|
+
outro: () => outro,
|
|
1104
1385
|
setLogLevel: () => setLogLevel,
|
|
1105
|
-
spinner: () =>
|
|
1386
|
+
spinner: () => spinner,
|
|
1106
1387
|
success: () => success,
|
|
1107
1388
|
warn: () => warn
|
|
1108
1389
|
});
|
|
@@ -1114,9 +1395,9 @@ function supportsColor() {
|
|
|
1114
1395
|
}
|
|
1115
1396
|
return process.stdout.isTTY === true;
|
|
1116
1397
|
}
|
|
1117
|
-
function colorize(
|
|
1118
|
-
if (!supportsColor()) return
|
|
1119
|
-
return `${color}${
|
|
1398
|
+
function colorize(text2, color) {
|
|
1399
|
+
if (!supportsColor()) return text2;
|
|
1400
|
+
return `${color}${text2}${colors.reset}`;
|
|
1120
1401
|
}
|
|
1121
1402
|
function setLogLevel(level) {
|
|
1122
1403
|
currentLogLevel = level;
|
|
@@ -1178,9 +1459,9 @@ ${contextStr}`;
|
|
|
1178
1459
|
|
|
1179
1460
|
Original error: ${originalMsg}`;
|
|
1180
1461
|
}
|
|
1181
|
-
|
|
1462
|
+
log.error(message);
|
|
1182
1463
|
}
|
|
1183
|
-
var colors, colorUtils, LogLevel, currentLogLevel,
|
|
1464
|
+
var colors, colorUtils, LogLevel, currentLogLevel, log2, error, warn, info, success;
|
|
1184
1465
|
var init_cli_output = __esm({
|
|
1185
1466
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1186
1467
|
"use strict";
|
|
@@ -1225,7 +1506,7 @@ var init_cli_output = __esm({
|
|
|
1225
1506
|
currentLogLevel = envLevel;
|
|
1226
1507
|
}
|
|
1227
1508
|
}
|
|
1228
|
-
|
|
1509
|
+
log2 = {
|
|
1229
1510
|
/**
|
|
1230
1511
|
* Logs an error message (always shows unless Quiet level)
|
|
1231
1512
|
* Uses clack's log.error + explicit red color
|
|
@@ -1233,7 +1514,7 @@ var init_cli_output = __esm({
|
|
|
1233
1514
|
error(...args) {
|
|
1234
1515
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1235
1516
|
const message = formatMessage(...args);
|
|
1236
|
-
|
|
1517
|
+
log.error(colorize(message, colors.brightRed));
|
|
1237
1518
|
},
|
|
1238
1519
|
/**
|
|
1239
1520
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1242,7 +1523,7 @@ var init_cli_output = __esm({
|
|
|
1242
1523
|
warn(...args) {
|
|
1243
1524
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1244
1525
|
const message = formatMessage(...args);
|
|
1245
|
-
|
|
1526
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1246
1527
|
},
|
|
1247
1528
|
/**
|
|
1248
1529
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1251,7 +1532,7 @@ var init_cli_output = __esm({
|
|
|
1251
1532
|
info(...args) {
|
|
1252
1533
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1253
1534
|
const message = formatMessage(...args);
|
|
1254
|
-
|
|
1535
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1255
1536
|
},
|
|
1256
1537
|
/**
|
|
1257
1538
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1260,7 +1541,7 @@ var init_cli_output = __esm({
|
|
|
1260
1541
|
success(...args) {
|
|
1261
1542
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1262
1543
|
const message = formatMessage(...args);
|
|
1263
|
-
|
|
1544
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1264
1545
|
},
|
|
1265
1546
|
/**
|
|
1266
1547
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1269,7 +1550,7 @@ var init_cli_output = __esm({
|
|
|
1269
1550
|
debug(...args) {
|
|
1270
1551
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1271
1552
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1272
|
-
|
|
1553
|
+
log.message(
|
|
1273
1554
|
colorize(
|
|
1274
1555
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1275
1556
|
colors.gray
|
|
@@ -1283,7 +1564,7 @@ var init_cli_output = __esm({
|
|
|
1283
1564
|
trace(...args) {
|
|
1284
1565
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1285
1566
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1286
|
-
|
|
1567
|
+
log.message(
|
|
1287
1568
|
colorize(
|
|
1288
1569
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1289
1570
|
colors.gray
|
|
@@ -1291,10 +1572,10 @@ var init_cli_output = __esm({
|
|
|
1291
1572
|
);
|
|
1292
1573
|
}
|
|
1293
1574
|
};
|
|
1294
|
-
error =
|
|
1295
|
-
warn =
|
|
1296
|
-
info =
|
|
1297
|
-
success =
|
|
1575
|
+
error = log2.error.bind(log2);
|
|
1576
|
+
warn = log2.warn.bind(log2);
|
|
1577
|
+
info = log2.info.bind(log2);
|
|
1578
|
+
success = log2.success.bind(log2);
|
|
1298
1579
|
}
|
|
1299
1580
|
});
|
|
1300
1581
|
|
|
@@ -1654,9 +1935,9 @@ var require_is_glob = __commonJS({
|
|
|
1654
1935
|
index += 2;
|
|
1655
1936
|
var close = chars[open];
|
|
1656
1937
|
if (close) {
|
|
1657
|
-
var
|
|
1658
|
-
if (
|
|
1659
|
-
index =
|
|
1938
|
+
var n3 = str.indexOf(close, index);
|
|
1939
|
+
if (n3 !== -1) {
|
|
1940
|
+
index = n3 + 1;
|
|
1660
1941
|
}
|
|
1661
1942
|
}
|
|
1662
1943
|
if (str[index] === "!") {
|
|
@@ -1682,9 +1963,9 @@ var require_is_glob = __commonJS({
|
|
|
1682
1963
|
index += 2;
|
|
1683
1964
|
var close = chars[open];
|
|
1684
1965
|
if (close) {
|
|
1685
|
-
var
|
|
1686
|
-
if (
|
|
1687
|
-
index =
|
|
1966
|
+
var n3 = str.indexOf(close, index);
|
|
1967
|
+
if (n3 !== -1) {
|
|
1968
|
+
index = n3 + 1;
|
|
1688
1969
|
}
|
|
1689
1970
|
}
|
|
1690
1971
|
if (str[index] === "!") {
|
|
@@ -1762,8 +2043,8 @@ var require_utils = __commonJS({
|
|
|
1762
2043
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1763
2044
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1764
2045
|
};
|
|
1765
|
-
exports.escapeNode = (
|
|
1766
|
-
const node =
|
|
2046
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
2047
|
+
const node = block2.nodes[n3];
|
|
1767
2048
|
if (!node) return;
|
|
1768
2049
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1769
2050
|
if (node.escaped !== true) {
|
|
@@ -1780,15 +2061,15 @@ var require_utils = __commonJS({
|
|
|
1780
2061
|
}
|
|
1781
2062
|
return false;
|
|
1782
2063
|
};
|
|
1783
|
-
exports.isInvalidBrace = (
|
|
1784
|
-
if (
|
|
1785
|
-
if (
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
2064
|
+
exports.isInvalidBrace = (block2) => {
|
|
2065
|
+
if (block2.type !== "brace") return false;
|
|
2066
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
2067
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
2068
|
+
block2.invalid = true;
|
|
1788
2069
|
return true;
|
|
1789
2070
|
}
|
|
1790
|
-
if (
|
|
1791
|
-
|
|
2071
|
+
if (block2.open !== true || block2.close !== true) {
|
|
2072
|
+
block2.invalid = true;
|
|
1792
2073
|
return true;
|
|
1793
2074
|
}
|
|
1794
2075
|
return false;
|
|
@@ -1807,8 +2088,8 @@ var require_utils = __commonJS({
|
|
|
1807
2088
|
exports.flatten = (...args) => {
|
|
1808
2089
|
const result = [];
|
|
1809
2090
|
const flat = (arr) => {
|
|
1810
|
-
for (let
|
|
1811
|
-
const ele = arr[
|
|
2091
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
2092
|
+
const ele = arr[i2];
|
|
1812
2093
|
if (Array.isArray(ele)) {
|
|
1813
2094
|
flat(ele);
|
|
1814
2095
|
continue;
|
|
@@ -1902,9 +2183,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1902
2183
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1903
2184
|
return toRegexRange.cache[cacheKey].result;
|
|
1904
2185
|
}
|
|
1905
|
-
let
|
|
2186
|
+
let a2 = Math.min(min, max);
|
|
1906
2187
|
let b = Math.max(min, max);
|
|
1907
|
-
if (Math.abs(
|
|
2188
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1908
2189
|
let result = min + "|" + max;
|
|
1909
2190
|
if (opts.capture) {
|
|
1910
2191
|
return `(${result})`;
|
|
@@ -1915,20 +2196,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1915
2196
|
return `(?:${result})`;
|
|
1916
2197
|
}
|
|
1917
2198
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1918
|
-
let state = { min, max, a, b };
|
|
2199
|
+
let state = { min, max, a: a2, b };
|
|
1919
2200
|
let positives = [];
|
|
1920
2201
|
let negatives = [];
|
|
1921
2202
|
if (isPadded) {
|
|
1922
2203
|
state.isPadded = isPadded;
|
|
1923
2204
|
state.maxLen = String(state.max).length;
|
|
1924
2205
|
}
|
|
1925
|
-
if (
|
|
2206
|
+
if (a2 < 0) {
|
|
1926
2207
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1927
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1928
|
-
|
|
2208
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2209
|
+
a2 = state.a = 0;
|
|
1929
2210
|
}
|
|
1930
2211
|
if (b >= 0) {
|
|
1931
|
-
positives = splitToPatterns(
|
|
2212
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1932
2213
|
}
|
|
1933
2214
|
state.negatives = negatives;
|
|
1934
2215
|
state.positives = positives;
|
|
@@ -1976,8 +2257,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1976
2257
|
let digits = zipped.length;
|
|
1977
2258
|
let pattern = "";
|
|
1978
2259
|
let count = 0;
|
|
1979
|
-
for (let
|
|
1980
|
-
let [startDigit, stopDigit] = zipped[
|
|
2260
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2261
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1981
2262
|
if (startDigit === stopDigit) {
|
|
1982
2263
|
pattern += startDigit;
|
|
1983
2264
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1996,8 +2277,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1996
2277
|
let tokens = [];
|
|
1997
2278
|
let start = min;
|
|
1998
2279
|
let prev;
|
|
1999
|
-
for (let
|
|
2000
|
-
let max2 = ranges[
|
|
2280
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2281
|
+
let max2 = ranges[i2];
|
|
2001
2282
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
2002
2283
|
let zeros = "";
|
|
2003
2284
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -2032,13 +2313,13 @@ var require_to_regex_range = __commonJS({
|
|
|
2032
2313
|
}
|
|
2033
2314
|
return result;
|
|
2034
2315
|
}
|
|
2035
|
-
function zip(
|
|
2316
|
+
function zip(a2, b) {
|
|
2036
2317
|
let arr = [];
|
|
2037
|
-
for (let
|
|
2318
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
2038
2319
|
return arr;
|
|
2039
2320
|
}
|
|
2040
|
-
function compare(
|
|
2041
|
-
return
|
|
2321
|
+
function compare(a2, b) {
|
|
2322
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
2042
2323
|
}
|
|
2043
2324
|
function contains(arr, key, val) {
|
|
2044
2325
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -2056,8 +2337,8 @@ var require_to_regex_range = __commonJS({
|
|
|
2056
2337
|
}
|
|
2057
2338
|
return "";
|
|
2058
2339
|
}
|
|
2059
|
-
function toCharacterClass(
|
|
2060
|
-
return `[${
|
|
2340
|
+
function toCharacterClass(a2, b, options) {
|
|
2341
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
2061
2342
|
}
|
|
2062
2343
|
function hasPadding(str) {
|
|
2063
2344
|
return /^-?(0+)\d/.test(str);
|
|
@@ -2136,8 +2417,8 @@ var require_fill_range = __commonJS({
|
|
|
2136
2417
|
return negative ? "-" + input : input;
|
|
2137
2418
|
};
|
|
2138
2419
|
var toSequence = (parts, options, maxLen) => {
|
|
2139
|
-
parts.negatives.sort((
|
|
2140
|
-
parts.positives.sort((
|
|
2420
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2421
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2141
2422
|
let prefix = options.capture ? "" : "?:";
|
|
2142
2423
|
let positives = "";
|
|
2143
2424
|
let negatives = "";
|
|
@@ -2158,12 +2439,12 @@ var require_fill_range = __commonJS({
|
|
|
2158
2439
|
}
|
|
2159
2440
|
return result;
|
|
2160
2441
|
};
|
|
2161
|
-
var toRange = (
|
|
2442
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
2162
2443
|
if (isNumbers) {
|
|
2163
|
-
return toRegexRange(
|
|
2444
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
2164
2445
|
}
|
|
2165
|
-
let start = String.fromCharCode(
|
|
2166
|
-
if (
|
|
2446
|
+
let start = String.fromCharCode(a2);
|
|
2447
|
+
if (a2 === b) return start;
|
|
2167
2448
|
let stop = String.fromCharCode(b);
|
|
2168
2449
|
return `[${start}-${stop}]`;
|
|
2169
2450
|
};
|
|
@@ -2189,15 +2470,15 @@ var require_fill_range = __commonJS({
|
|
|
2189
2470
|
return [];
|
|
2190
2471
|
};
|
|
2191
2472
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2192
|
-
let
|
|
2473
|
+
let a2 = Number(start);
|
|
2193
2474
|
let b = Number(end);
|
|
2194
|
-
if (!Number.isInteger(
|
|
2475
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2195
2476
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2196
2477
|
return [];
|
|
2197
2478
|
}
|
|
2198
|
-
if (
|
|
2479
|
+
if (a2 === 0) a2 = 0;
|
|
2199
2480
|
if (b === 0) b = 0;
|
|
2200
|
-
let descending =
|
|
2481
|
+
let descending = a2 > b;
|
|
2201
2482
|
let startString = String(start);
|
|
2202
2483
|
let endString = String(end);
|
|
2203
2484
|
let stepString = String(step);
|
|
@@ -2213,13 +2494,13 @@ var require_fill_range = __commonJS({
|
|
|
2213
2494
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2214
2495
|
let range = [];
|
|
2215
2496
|
let index = 0;
|
|
2216
|
-
while (descending ?
|
|
2497
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2217
2498
|
if (options.toRegex === true && step > 1) {
|
|
2218
|
-
push(
|
|
2499
|
+
push(a2);
|
|
2219
2500
|
} else {
|
|
2220
|
-
range.push(pad(format(
|
|
2501
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2221
2502
|
}
|
|
2222
|
-
|
|
2503
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2223
2504
|
index++;
|
|
2224
2505
|
}
|
|
2225
2506
|
if (options.toRegex === true) {
|
|
@@ -2232,19 +2513,19 @@ var require_fill_range = __commonJS({
|
|
|
2232
2513
|
return invalidRange(start, end, options);
|
|
2233
2514
|
}
|
|
2234
2515
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2235
|
-
let
|
|
2516
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2236
2517
|
let b = `${end}`.charCodeAt(0);
|
|
2237
|
-
let descending =
|
|
2238
|
-
let min = Math.min(
|
|
2239
|
-
let max = Math.max(
|
|
2518
|
+
let descending = a2 > b;
|
|
2519
|
+
let min = Math.min(a2, b);
|
|
2520
|
+
let max = Math.max(a2, b);
|
|
2240
2521
|
if (options.toRegex && step === 1) {
|
|
2241
2522
|
return toRange(min, max, false, options);
|
|
2242
2523
|
}
|
|
2243
2524
|
let range = [];
|
|
2244
2525
|
let index = 0;
|
|
2245
|
-
while (descending ?
|
|
2246
|
-
range.push(format(
|
|
2247
|
-
|
|
2526
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2527
|
+
range.push(format(a2, index));
|
|
2528
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2248
2529
|
index++;
|
|
2249
2530
|
}
|
|
2250
2531
|
if (options.toRegex === true) {
|
|
@@ -2367,18 +2648,18 @@ var require_expand = __commonJS({
|
|
|
2367
2648
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2368
2649
|
const walk = (node, parent = {}) => {
|
|
2369
2650
|
node.queue = [];
|
|
2370
|
-
let
|
|
2371
|
-
let
|
|
2372
|
-
while (
|
|
2373
|
-
|
|
2374
|
-
|
|
2651
|
+
let p = parent;
|
|
2652
|
+
let q = parent.queue;
|
|
2653
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2654
|
+
p = p.parent;
|
|
2655
|
+
q = p.queue;
|
|
2375
2656
|
}
|
|
2376
2657
|
if (node.invalid || node.dollar) {
|
|
2377
|
-
|
|
2658
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2378
2659
|
return;
|
|
2379
2660
|
}
|
|
2380
2661
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2381
|
-
|
|
2662
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2382
2663
|
return;
|
|
2383
2664
|
}
|
|
2384
2665
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2390,26 +2671,26 @@ var require_expand = __commonJS({
|
|
|
2390
2671
|
if (range.length === 0) {
|
|
2391
2672
|
range = stringify2(node, options);
|
|
2392
2673
|
}
|
|
2393
|
-
|
|
2674
|
+
q.push(append(q.pop(), range));
|
|
2394
2675
|
node.nodes = [];
|
|
2395
2676
|
return;
|
|
2396
2677
|
}
|
|
2397
2678
|
const enclose = utils.encloseBrace(node);
|
|
2398
2679
|
let queue = node.queue;
|
|
2399
|
-
let
|
|
2400
|
-
while (
|
|
2401
|
-
|
|
2402
|
-
queue =
|
|
2680
|
+
let block2 = node;
|
|
2681
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2682
|
+
block2 = block2.parent;
|
|
2683
|
+
queue = block2.queue;
|
|
2403
2684
|
}
|
|
2404
|
-
for (let
|
|
2405
|
-
const child = node.nodes[
|
|
2685
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2686
|
+
const child = node.nodes[i2];
|
|
2406
2687
|
if (child.type === "comma" && node.type === "brace") {
|
|
2407
|
-
if (
|
|
2688
|
+
if (i2 === 1) queue.push("");
|
|
2408
2689
|
queue.push("");
|
|
2409
2690
|
continue;
|
|
2410
2691
|
}
|
|
2411
2692
|
if (child.type === "close") {
|
|
2412
|
-
|
|
2693
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2413
2694
|
continue;
|
|
2414
2695
|
}
|
|
2415
2696
|
if (child.value && child.type !== "open") {
|
|
@@ -2576,7 +2857,7 @@ var require_parse = __commonJS({
|
|
|
2576
2857
|
}
|
|
2577
2858
|
const ast = { type: "root", input, nodes: [] };
|
|
2578
2859
|
const stack = [ast];
|
|
2579
|
-
let
|
|
2860
|
+
let block2 = ast;
|
|
2580
2861
|
let prev = ast;
|
|
2581
2862
|
let brackets = 0;
|
|
2582
2863
|
const length = input.length;
|
|
@@ -2592,15 +2873,15 @@ var require_parse = __commonJS({
|
|
|
2592
2873
|
prev.value += node.value;
|
|
2593
2874
|
return;
|
|
2594
2875
|
}
|
|
2595
|
-
|
|
2596
|
-
node.parent =
|
|
2876
|
+
block2.nodes.push(node);
|
|
2877
|
+
node.parent = block2;
|
|
2597
2878
|
node.prev = prev;
|
|
2598
2879
|
prev = node;
|
|
2599
2880
|
return node;
|
|
2600
2881
|
};
|
|
2601
2882
|
push({ type: "bos" });
|
|
2602
2883
|
while (index < length) {
|
|
2603
|
-
|
|
2884
|
+
block2 = stack[stack.length - 1];
|
|
2604
2885
|
value = advance();
|
|
2605
2886
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2606
2887
|
continue;
|
|
@@ -2637,19 +2918,19 @@ var require_parse = __commonJS({
|
|
|
2637
2918
|
continue;
|
|
2638
2919
|
}
|
|
2639
2920
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2640
|
-
|
|
2641
|
-
stack.push(
|
|
2921
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2922
|
+
stack.push(block2);
|
|
2642
2923
|
push({ type: "text", value });
|
|
2643
2924
|
continue;
|
|
2644
2925
|
}
|
|
2645
2926
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2646
|
-
if (
|
|
2927
|
+
if (block2.type !== "paren") {
|
|
2647
2928
|
push({ type: "text", value });
|
|
2648
2929
|
continue;
|
|
2649
2930
|
}
|
|
2650
|
-
|
|
2931
|
+
block2 = stack.pop();
|
|
2651
2932
|
push({ type: "text", value });
|
|
2652
|
-
|
|
2933
|
+
block2 = stack[stack.length - 1];
|
|
2653
2934
|
continue;
|
|
2654
2935
|
}
|
|
2655
2936
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2674,7 +2955,7 @@ var require_parse = __commonJS({
|
|
|
2674
2955
|
}
|
|
2675
2956
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2676
2957
|
depth++;
|
|
2677
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2958
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2678
2959
|
const brace = {
|
|
2679
2960
|
type: "brace",
|
|
2680
2961
|
open: true,
|
|
@@ -2685,52 +2966,52 @@ var require_parse = __commonJS({
|
|
|
2685
2966
|
ranges: 0,
|
|
2686
2967
|
nodes: []
|
|
2687
2968
|
};
|
|
2688
|
-
|
|
2689
|
-
stack.push(
|
|
2969
|
+
block2 = push(brace);
|
|
2970
|
+
stack.push(block2);
|
|
2690
2971
|
push({ type: "open", value });
|
|
2691
2972
|
continue;
|
|
2692
2973
|
}
|
|
2693
2974
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2694
|
-
if (
|
|
2975
|
+
if (block2.type !== "brace") {
|
|
2695
2976
|
push({ type: "text", value });
|
|
2696
2977
|
continue;
|
|
2697
2978
|
}
|
|
2698
2979
|
const type = "close";
|
|
2699
|
-
|
|
2700
|
-
|
|
2980
|
+
block2 = stack.pop();
|
|
2981
|
+
block2.close = true;
|
|
2701
2982
|
push({ type, value });
|
|
2702
2983
|
depth--;
|
|
2703
|
-
|
|
2984
|
+
block2 = stack[stack.length - 1];
|
|
2704
2985
|
continue;
|
|
2705
2986
|
}
|
|
2706
2987
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2707
|
-
if (
|
|
2708
|
-
|
|
2709
|
-
const open =
|
|
2710
|
-
|
|
2988
|
+
if (block2.ranges > 0) {
|
|
2989
|
+
block2.ranges = 0;
|
|
2990
|
+
const open = block2.nodes.shift();
|
|
2991
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2711
2992
|
}
|
|
2712
2993
|
push({ type: "comma", value });
|
|
2713
|
-
|
|
2994
|
+
block2.commas++;
|
|
2714
2995
|
continue;
|
|
2715
2996
|
}
|
|
2716
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2717
|
-
const siblings =
|
|
2997
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2998
|
+
const siblings = block2.nodes;
|
|
2718
2999
|
if (depth === 0 || siblings.length === 0) {
|
|
2719
3000
|
push({ type: "text", value });
|
|
2720
3001
|
continue;
|
|
2721
3002
|
}
|
|
2722
3003
|
if (prev.type === "dot") {
|
|
2723
|
-
|
|
3004
|
+
block2.range = [];
|
|
2724
3005
|
prev.value += value;
|
|
2725
3006
|
prev.type = "range";
|
|
2726
|
-
if (
|
|
2727
|
-
|
|
2728
|
-
|
|
3007
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
3008
|
+
block2.invalid = true;
|
|
3009
|
+
block2.ranges = 0;
|
|
2729
3010
|
prev.type = "text";
|
|
2730
3011
|
continue;
|
|
2731
3012
|
}
|
|
2732
|
-
|
|
2733
|
-
|
|
3013
|
+
block2.ranges++;
|
|
3014
|
+
block2.args = [];
|
|
2734
3015
|
continue;
|
|
2735
3016
|
}
|
|
2736
3017
|
if (prev.type === "range") {
|
|
@@ -2738,7 +3019,7 @@ var require_parse = __commonJS({
|
|
|
2738
3019
|
const before = siblings[siblings.length - 1];
|
|
2739
3020
|
before.value += prev.value + value;
|
|
2740
3021
|
prev = before;
|
|
2741
|
-
|
|
3022
|
+
block2.ranges--;
|
|
2742
3023
|
continue;
|
|
2743
3024
|
}
|
|
2744
3025
|
push({ type: "dot", value });
|
|
@@ -2747,9 +3028,9 @@ var require_parse = __commonJS({
|
|
|
2747
3028
|
push({ type: "text", value });
|
|
2748
3029
|
}
|
|
2749
3030
|
do {
|
|
2750
|
-
|
|
2751
|
-
if (
|
|
2752
|
-
|
|
3031
|
+
block2 = stack.pop();
|
|
3032
|
+
if (block2.type !== "root") {
|
|
3033
|
+
block2.nodes.forEach((node) => {
|
|
2753
3034
|
if (!node.nodes) {
|
|
2754
3035
|
if (node.type === "open") node.isOpen = true;
|
|
2755
3036
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2758,8 +3039,8 @@ var require_parse = __commonJS({
|
|
|
2758
3039
|
}
|
|
2759
3040
|
});
|
|
2760
3041
|
const parent = stack[stack.length - 1];
|
|
2761
|
-
const index2 = parent.nodes.indexOf(
|
|
2762
|
-
parent.nodes.splice(index2, 1, ...
|
|
3042
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
3043
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2763
3044
|
}
|
|
2764
3045
|
} while (stack.length > 0);
|
|
2765
3046
|
push({ type: "eos" });
|
|
@@ -3392,9 +3673,9 @@ var require_scan = __commonJS({
|
|
|
3392
3673
|
if (opts.parts === true || opts.tokens === true) {
|
|
3393
3674
|
let prevIndex;
|
|
3394
3675
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3395
|
-
const
|
|
3396
|
-
const
|
|
3397
|
-
const value = input.slice(
|
|
3676
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3677
|
+
const i2 = slashes[idx];
|
|
3678
|
+
const value = input.slice(n3, i2);
|
|
3398
3679
|
if (opts.tokens) {
|
|
3399
3680
|
if (idx === 0 && start !== 0) {
|
|
3400
3681
|
tokens[idx].isPrefix = true;
|
|
@@ -3408,7 +3689,7 @@ var require_scan = __commonJS({
|
|
|
3408
3689
|
if (idx !== 0 || value !== "") {
|
|
3409
3690
|
parts.push(value);
|
|
3410
3691
|
}
|
|
3411
|
-
prevIndex =
|
|
3692
|
+
prevIndex = i2;
|
|
3412
3693
|
}
|
|
3413
3694
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3414
3695
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3537,15 +3818,15 @@ var require_parse2 = __commonJS({
|
|
|
3537
3818
|
};
|
|
3538
3819
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3539
3820
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3540
|
-
for (let
|
|
3541
|
-
for (let
|
|
3542
|
-
const
|
|
3543
|
-
const b = values[
|
|
3544
|
-
const char =
|
|
3545
|
-
if (!char ||
|
|
3821
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3822
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3823
|
+
const a2 = values[i2];
|
|
3824
|
+
const b = values[j];
|
|
3825
|
+
const char = a2[0];
|
|
3826
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3546
3827
|
continue;
|
|
3547
3828
|
}
|
|
3548
|
-
if (
|
|
3829
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3549
3830
|
return true;
|
|
3550
3831
|
}
|
|
3551
3832
|
}
|
|
@@ -3560,8 +3841,8 @@ var require_parse2 = __commonJS({
|
|
|
3560
3841
|
let paren = 0;
|
|
3561
3842
|
let quote = 0;
|
|
3562
3843
|
let escaped = false;
|
|
3563
|
-
for (let
|
|
3564
|
-
const ch = pattern[
|
|
3844
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3845
|
+
const ch = pattern[i2];
|
|
3565
3846
|
if (escaped === true) {
|
|
3566
3847
|
escaped = false;
|
|
3567
3848
|
continue;
|
|
@@ -3595,13 +3876,13 @@ var require_parse2 = __commonJS({
|
|
|
3595
3876
|
if (ch === ")") {
|
|
3596
3877
|
paren--;
|
|
3597
3878
|
if (paren === 0) {
|
|
3598
|
-
if (requireEnd === true &&
|
|
3879
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3599
3880
|
return;
|
|
3600
3881
|
}
|
|
3601
3882
|
return {
|
|
3602
3883
|
type: pattern[0],
|
|
3603
|
-
body: pattern.slice(2,
|
|
3604
|
-
end:
|
|
3884
|
+
body: pattern.slice(2, i2),
|
|
3885
|
+
end: i2
|
|
3605
3886
|
};
|
|
3606
3887
|
}
|
|
3607
3888
|
}
|
|
@@ -3733,7 +4014,7 @@ var require_parse2 = __commonJS({
|
|
|
3733
4014
|
let prev = bos;
|
|
3734
4015
|
let value;
|
|
3735
4016
|
const eos = () => state.index === len - 1;
|
|
3736
|
-
const peek = state.peek = (
|
|
4017
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3737
4018
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3738
4019
|
const remaining = () => input.slice(state.index + 1);
|
|
3739
4020
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3814,10 +4095,10 @@ var require_parse2 = __commonJS({
|
|
|
3814
4095
|
open.type = "text";
|
|
3815
4096
|
open.value = literal;
|
|
3816
4097
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3817
|
-
for (let
|
|
3818
|
-
tokens[
|
|
3819
|
-
tokens[
|
|
3820
|
-
delete tokens[
|
|
4098
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
4099
|
+
tokens[i2].value = "";
|
|
4100
|
+
tokens[i2].output = "";
|
|
4101
|
+
delete tokens[i2].suffix;
|
|
3821
4102
|
}
|
|
3822
4103
|
state.output = token.output + open.output;
|
|
3823
4104
|
state.backtrack = true;
|
|
@@ -4060,13 +4341,13 @@ var require_parse2 = __commonJS({
|
|
|
4060
4341
|
if (brace.dots === true) {
|
|
4061
4342
|
const arr = tokens.slice();
|
|
4062
4343
|
const range = [];
|
|
4063
|
-
for (let
|
|
4344
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
4064
4345
|
tokens.pop();
|
|
4065
|
-
if (arr[
|
|
4346
|
+
if (arr[i2].type === "brace") {
|
|
4066
4347
|
break;
|
|
4067
4348
|
}
|
|
4068
|
-
if (arr[
|
|
4069
|
-
range.unshift(arr[
|
|
4349
|
+
if (arr[i2].type !== "dots") {
|
|
4350
|
+
range.unshift(arr[i2].value);
|
|
4070
4351
|
}
|
|
4071
4352
|
}
|
|
4072
4353
|
output = expandRange(range, opts);
|
|
@@ -4525,7 +4806,7 @@ var require_picomatch = __commonJS({
|
|
|
4525
4806
|
};
|
|
4526
4807
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4527
4808
|
picomatch.parse = (pattern, options) => {
|
|
4528
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4809
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4529
4810
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4530
4811
|
};
|
|
4531
4812
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4609,8 +4890,8 @@ var require_micromatch = __commonJS({
|
|
|
4609
4890
|
options.onResult(state);
|
|
4610
4891
|
}
|
|
4611
4892
|
};
|
|
4612
|
-
for (let
|
|
4613
|
-
let isMatch = picomatch(String(patterns[
|
|
4893
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4894
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4614
4895
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4615
4896
|
if (negated) negatives++;
|
|
4616
4897
|
for (let item of list) {
|
|
@@ -4632,7 +4913,7 @@ var require_micromatch = __commonJS({
|
|
|
4632
4913
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4633
4914
|
}
|
|
4634
4915
|
if (options.nonull === true || options.nullglob === true) {
|
|
4635
|
-
return options.unescape ? patterns.map((
|
|
4916
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4636
4917
|
}
|
|
4637
4918
|
}
|
|
4638
4919
|
return matches;
|
|
@@ -4662,7 +4943,7 @@ var require_micromatch = __commonJS({
|
|
|
4662
4943
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4663
4944
|
}
|
|
4664
4945
|
if (Array.isArray(pattern)) {
|
|
4665
|
-
return pattern.some((
|
|
4946
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4666
4947
|
}
|
|
4667
4948
|
if (typeof pattern === "string") {
|
|
4668
4949
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4707,7 +4988,7 @@ var require_micromatch = __commonJS({
|
|
|
4707
4988
|
if (typeof str !== "string") {
|
|
4708
4989
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4709
4990
|
}
|
|
4710
|
-
return [].concat(patterns).every((
|
|
4991
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4711
4992
|
};
|
|
4712
4993
|
micromatch.capture = (glob2, input, options) => {
|
|
4713
4994
|
let posix = utils.isWindows(options);
|
|
@@ -4858,7 +5139,7 @@ var require_pattern = __commonJS({
|
|
|
4858
5139
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4859
5140
|
function expandBraceExpansion(pattern) {
|
|
4860
5141
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4861
|
-
patterns.sort((
|
|
5142
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4862
5143
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4863
5144
|
}
|
|
4864
5145
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4939,8 +5220,8 @@ var require_merge2 = __commonJS({
|
|
|
4939
5220
|
}
|
|
4940
5221
|
const mergedStream = PassThrough(options);
|
|
4941
5222
|
function addStream() {
|
|
4942
|
-
for (let
|
|
4943
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5223
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5224
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4944
5225
|
}
|
|
4945
5226
|
mergeStream();
|
|
4946
5227
|
return this;
|
|
@@ -4989,8 +5270,8 @@ var require_merge2 = __commonJS({
|
|
|
4989
5270
|
stream.pipe(mergedStream, { end: false });
|
|
4990
5271
|
stream.resume();
|
|
4991
5272
|
}
|
|
4992
|
-
for (let
|
|
4993
|
-
pipe(streams[
|
|
5273
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5274
|
+
pipe(streams[i2]);
|
|
4994
5275
|
}
|
|
4995
5276
|
next();
|
|
4996
5277
|
}
|
|
@@ -5021,8 +5302,8 @@ var require_merge2 = __commonJS({
|
|
|
5021
5302
|
}
|
|
5022
5303
|
streams.pause();
|
|
5023
5304
|
} else {
|
|
5024
|
-
for (let
|
|
5025
|
-
streams[
|
|
5305
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5306
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
5026
5307
|
}
|
|
5027
5308
|
}
|
|
5028
5309
|
return streams;
|
|
@@ -5104,13 +5385,13 @@ var require_tasks = __commonJS({
|
|
|
5104
5385
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5105
5386
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
5106
5387
|
var utils = require_utils3();
|
|
5107
|
-
function generate(input,
|
|
5108
|
-
const patterns = processPatterns(input,
|
|
5109
|
-
const ignore = processPatterns(
|
|
5388
|
+
function generate(input, settings2) {
|
|
5389
|
+
const patterns = processPatterns(input, settings2);
|
|
5390
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
5110
5391
|
const positivePatterns = getPositivePatterns(patterns);
|
|
5111
5392
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
5112
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
5113
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5393
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5394
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
5114
5395
|
const staticTasks = convertPatternsToTasks(
|
|
5115
5396
|
staticPatterns,
|
|
5116
5397
|
negativePatterns,
|
|
@@ -5126,12 +5407,12 @@ var require_tasks = __commonJS({
|
|
|
5126
5407
|
return staticTasks.concat(dynamicTasks);
|
|
5127
5408
|
}
|
|
5128
5409
|
exports.generate = generate;
|
|
5129
|
-
function processPatterns(input,
|
|
5410
|
+
function processPatterns(input, settings2) {
|
|
5130
5411
|
let patterns = input;
|
|
5131
|
-
if (
|
|
5412
|
+
if (settings2.braceExpansion) {
|
|
5132
5413
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
5133
5414
|
}
|
|
5134
|
-
if (
|
|
5415
|
+
if (settings2.baseNameMatch) {
|
|
5135
5416
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
5136
5417
|
}
|
|
5137
5418
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -5162,7 +5443,7 @@ var require_tasks = __commonJS({
|
|
|
5162
5443
|
}
|
|
5163
5444
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
5164
5445
|
function groupPatternsByBaseDirectory(patterns) {
|
|
5165
|
-
const
|
|
5446
|
+
const group2 = {};
|
|
5166
5447
|
return patterns.reduce((collection, pattern) => {
|
|
5167
5448
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
5168
5449
|
if (base in collection) {
|
|
@@ -5171,7 +5452,7 @@ var require_tasks = __commonJS({
|
|
|
5171
5452
|
collection[base] = [pattern];
|
|
5172
5453
|
}
|
|
5173
5454
|
return collection;
|
|
5174
|
-
},
|
|
5455
|
+
}, group2);
|
|
5175
5456
|
}
|
|
5176
5457
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5177
5458
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5200,26 +5481,26 @@ var require_async = __commonJS({
|
|
|
5200
5481
|
init_utils2();
|
|
5201
5482
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5202
5483
|
exports.read = void 0;
|
|
5203
|
-
function read2(path,
|
|
5204
|
-
|
|
5484
|
+
function read2(path, settings2, callback) {
|
|
5485
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5205
5486
|
if (lstatError !== null) {
|
|
5206
5487
|
callFailureCallback(callback, lstatError);
|
|
5207
5488
|
return;
|
|
5208
5489
|
}
|
|
5209
|
-
if (!lstat.isSymbolicLink() || !
|
|
5490
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5210
5491
|
callSuccessCallback(callback, lstat);
|
|
5211
5492
|
return;
|
|
5212
5493
|
}
|
|
5213
|
-
|
|
5494
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5214
5495
|
if (statError !== null) {
|
|
5215
|
-
if (
|
|
5496
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5216
5497
|
callFailureCallback(callback, statError);
|
|
5217
5498
|
return;
|
|
5218
5499
|
}
|
|
5219
5500
|
callSuccessCallback(callback, lstat);
|
|
5220
5501
|
return;
|
|
5221
5502
|
}
|
|
5222
|
-
if (
|
|
5503
|
+
if (settings2.markSymbolicLink) {
|
|
5223
5504
|
stat.isSymbolicLink = () => true;
|
|
5224
5505
|
}
|
|
5225
5506
|
callSuccessCallback(callback, stat);
|
|
@@ -5243,19 +5524,19 @@ var require_sync = __commonJS({
|
|
|
5243
5524
|
init_utils2();
|
|
5244
5525
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5245
5526
|
exports.read = void 0;
|
|
5246
|
-
function read2(path,
|
|
5247
|
-
const lstat =
|
|
5248
|
-
if (!lstat.isSymbolicLink() || !
|
|
5527
|
+
function read2(path, settings2) {
|
|
5528
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5529
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5249
5530
|
return lstat;
|
|
5250
5531
|
}
|
|
5251
5532
|
try {
|
|
5252
|
-
const stat =
|
|
5253
|
-
if (
|
|
5533
|
+
const stat = settings2.fs.statSync(path);
|
|
5534
|
+
if (settings2.markSymbolicLink) {
|
|
5254
5535
|
stat.isSymbolicLink = () => true;
|
|
5255
5536
|
}
|
|
5256
5537
|
return stat;
|
|
5257
5538
|
} catch (error2) {
|
|
5258
|
-
if (!
|
|
5539
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5259
5540
|
return lstat;
|
|
5260
5541
|
}
|
|
5261
5542
|
throw error2;
|
|
@@ -5332,8 +5613,8 @@ var require_out = __commonJS({
|
|
|
5332
5613
|
}
|
|
5333
5614
|
exports.stat = stat;
|
|
5334
5615
|
function statSync3(path, optionsOrSettings) {
|
|
5335
|
-
const
|
|
5336
|
-
return sync.read(path,
|
|
5616
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5617
|
+
return sync.read(path, settings2);
|
|
5337
5618
|
}
|
|
5338
5619
|
exports.statSync = statSync3;
|
|
5339
5620
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5381,8 +5662,8 @@ var require_run_parallel = __commonJS({
|
|
|
5381
5662
|
if (isSync) queueMicrotask2(end);
|
|
5382
5663
|
else end();
|
|
5383
5664
|
}
|
|
5384
|
-
function each(
|
|
5385
|
-
results[
|
|
5665
|
+
function each(i2, err, result) {
|
|
5666
|
+
results[i2] = result;
|
|
5386
5667
|
if (--pending === 0 || err) {
|
|
5387
5668
|
done(err);
|
|
5388
5669
|
}
|
|
@@ -5396,9 +5677,9 @@ var require_run_parallel = __commonJS({
|
|
|
5396
5677
|
});
|
|
5397
5678
|
});
|
|
5398
5679
|
} else {
|
|
5399
|
-
tasks.forEach(function(task,
|
|
5680
|
+
tasks.forEach(function(task, i2) {
|
|
5400
5681
|
task(function(err, result) {
|
|
5401
|
-
each(
|
|
5682
|
+
each(i2, err, result);
|
|
5402
5683
|
});
|
|
5403
5684
|
});
|
|
5404
5685
|
}
|
|
@@ -5473,11 +5754,11 @@ var require_common = __commonJS({
|
|
|
5473
5754
|
init_utils2();
|
|
5474
5755
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5475
5756
|
exports.joinPathSegments = void 0;
|
|
5476
|
-
function joinPathSegments(
|
|
5477
|
-
if (
|
|
5478
|
-
return
|
|
5757
|
+
function joinPathSegments(a2, b, separator) {
|
|
5758
|
+
if (a2.endsWith(separator)) {
|
|
5759
|
+
return a2 + b;
|
|
5479
5760
|
}
|
|
5480
|
-
return
|
|
5761
|
+
return a2 + separator + b;
|
|
5481
5762
|
}
|
|
5482
5763
|
exports.joinPathSegments = joinPathSegments;
|
|
5483
5764
|
}
|
|
@@ -5495,16 +5776,16 @@ var require_async2 = __commonJS({
|
|
|
5495
5776
|
var constants_1 = require_constants3();
|
|
5496
5777
|
var utils = require_utils4();
|
|
5497
5778
|
var common = require_common();
|
|
5498
|
-
function read2(directory,
|
|
5499
|
-
if (!
|
|
5500
|
-
readdirWithFileTypes(directory,
|
|
5779
|
+
function read2(directory, settings2, callback) {
|
|
5780
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5781
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5501
5782
|
return;
|
|
5502
5783
|
}
|
|
5503
|
-
readdir2(directory,
|
|
5784
|
+
readdir2(directory, settings2, callback);
|
|
5504
5785
|
}
|
|
5505
5786
|
exports.read = read2;
|
|
5506
|
-
function readdirWithFileTypes(directory,
|
|
5507
|
-
|
|
5787
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5788
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5508
5789
|
if (readdirError !== null) {
|
|
5509
5790
|
callFailureCallback(callback, readdirError);
|
|
5510
5791
|
return;
|
|
@@ -5512,13 +5793,13 @@ var require_async2 = __commonJS({
|
|
|
5512
5793
|
const entries = dirents.map((dirent) => ({
|
|
5513
5794
|
dirent,
|
|
5514
5795
|
name: dirent.name,
|
|
5515
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5796
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5516
5797
|
}));
|
|
5517
|
-
if (!
|
|
5798
|
+
if (!settings2.followSymbolicLinks) {
|
|
5518
5799
|
callSuccessCallback(callback, entries);
|
|
5519
5800
|
return;
|
|
5520
5801
|
}
|
|
5521
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5802
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5522
5803
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5523
5804
|
if (rplError !== null) {
|
|
5524
5805
|
callFailureCallback(callback, rplError);
|
|
@@ -5529,15 +5810,15 @@ var require_async2 = __commonJS({
|
|
|
5529
5810
|
});
|
|
5530
5811
|
}
|
|
5531
5812
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5532
|
-
function makeRplTaskEntry(entry,
|
|
5813
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5533
5814
|
return (done) => {
|
|
5534
5815
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5535
5816
|
done(null, entry);
|
|
5536
5817
|
return;
|
|
5537
5818
|
}
|
|
5538
|
-
|
|
5819
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5539
5820
|
if (statError !== null) {
|
|
5540
|
-
if (
|
|
5821
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5541
5822
|
done(statError);
|
|
5542
5823
|
return;
|
|
5543
5824
|
}
|
|
@@ -5549,16 +5830,16 @@ var require_async2 = __commonJS({
|
|
|
5549
5830
|
});
|
|
5550
5831
|
};
|
|
5551
5832
|
}
|
|
5552
|
-
function readdir2(directory,
|
|
5553
|
-
|
|
5833
|
+
function readdir2(directory, settings2, callback) {
|
|
5834
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5554
5835
|
if (readdirError !== null) {
|
|
5555
5836
|
callFailureCallback(callback, readdirError);
|
|
5556
5837
|
return;
|
|
5557
5838
|
}
|
|
5558
5839
|
const tasks = names.map((name) => {
|
|
5559
|
-
const path = common.joinPathSegments(directory, name,
|
|
5840
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5560
5841
|
return (done) => {
|
|
5561
|
-
fsStat.stat(path,
|
|
5842
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5562
5843
|
if (error2 !== null) {
|
|
5563
5844
|
done(error2);
|
|
5564
5845
|
return;
|
|
@@ -5568,7 +5849,7 @@ var require_async2 = __commonJS({
|
|
|
5568
5849
|
path,
|
|
5569
5850
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5570
5851
|
};
|
|
5571
|
-
if (
|
|
5852
|
+
if (settings2.stats) {
|
|
5572
5853
|
entry.stats = stats;
|
|
5573
5854
|
}
|
|
5574
5855
|
done(null, entry);
|
|
@@ -5605,27 +5886,27 @@ var require_sync2 = __commonJS({
|
|
|
5605
5886
|
var constants_1 = require_constants3();
|
|
5606
5887
|
var utils = require_utils4();
|
|
5607
5888
|
var common = require_common();
|
|
5608
|
-
function read2(directory,
|
|
5609
|
-
if (!
|
|
5610
|
-
return readdirWithFileTypes(directory,
|
|
5889
|
+
function read2(directory, settings2) {
|
|
5890
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5891
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5611
5892
|
}
|
|
5612
|
-
return readdir2(directory,
|
|
5893
|
+
return readdir2(directory, settings2);
|
|
5613
5894
|
}
|
|
5614
5895
|
exports.read = read2;
|
|
5615
|
-
function readdirWithFileTypes(directory,
|
|
5616
|
-
const dirents =
|
|
5896
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5897
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5617
5898
|
return dirents.map((dirent) => {
|
|
5618
5899
|
const entry = {
|
|
5619
5900
|
dirent,
|
|
5620
5901
|
name: dirent.name,
|
|
5621
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5902
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5622
5903
|
};
|
|
5623
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5904
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5624
5905
|
try {
|
|
5625
|
-
const stats =
|
|
5906
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5626
5907
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5627
5908
|
} catch (error2) {
|
|
5628
|
-
if (
|
|
5909
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5629
5910
|
throw error2;
|
|
5630
5911
|
}
|
|
5631
5912
|
}
|
|
@@ -5634,17 +5915,17 @@ var require_sync2 = __commonJS({
|
|
|
5634
5915
|
});
|
|
5635
5916
|
}
|
|
5636
5917
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5637
|
-
function readdir2(directory,
|
|
5638
|
-
const names =
|
|
5918
|
+
function readdir2(directory, settings2) {
|
|
5919
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5639
5920
|
return names.map((name) => {
|
|
5640
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5641
|
-
const stats = fsStat.statSync(entryPath,
|
|
5921
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5922
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5642
5923
|
const entry = {
|
|
5643
5924
|
name,
|
|
5644
5925
|
path: entryPath,
|
|
5645
5926
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5646
5927
|
};
|
|
5647
|
-
if (
|
|
5928
|
+
if (settings2.stats) {
|
|
5648
5929
|
entry.stats = stats;
|
|
5649
5930
|
}
|
|
5650
5931
|
return entry;
|
|
@@ -5731,8 +6012,8 @@ var require_out2 = __commonJS({
|
|
|
5731
6012
|
}
|
|
5732
6013
|
exports.scandir = scandir;
|
|
5733
6014
|
function scandirSync(path, optionsOrSettings) {
|
|
5734
|
-
const
|
|
5735
|
-
return sync.read(path,
|
|
6015
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6016
|
+
return sync.read(path, settings2);
|
|
5736
6017
|
}
|
|
5737
6018
|
exports.scandirSync = scandirSync;
|
|
5738
6019
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5776,9 +6057,9 @@ var require_reusify = __commonJS({
|
|
|
5776
6057
|
}
|
|
5777
6058
|
});
|
|
5778
6059
|
|
|
5779
|
-
// node_modules/.bun/fastq@1.20.
|
|
6060
|
+
// node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
|
|
5780
6061
|
var require_queue = __commonJS({
|
|
5781
|
-
"node_modules/.bun/fastq@1.20.
|
|
6062
|
+
"node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
|
|
5782
6063
|
"use strict";
|
|
5783
6064
|
init_utils2();
|
|
5784
6065
|
var reusify = require_reusify();
|
|
@@ -5958,11 +6239,12 @@ var require_queue = __commonJS({
|
|
|
5958
6239
|
current.value = null;
|
|
5959
6240
|
current.callback = noop;
|
|
5960
6241
|
current.errorHandler = null;
|
|
6242
|
+
current.next = null;
|
|
5961
6243
|
if (errorHandler2) {
|
|
5962
6244
|
errorHandler2(new Error("abort"), val);
|
|
5963
6245
|
}
|
|
5964
6246
|
callback.call(context2, new Error("abort"));
|
|
5965
|
-
|
|
6247
|
+
cache.release(current);
|
|
5966
6248
|
current = next;
|
|
5967
6249
|
}
|
|
5968
6250
|
self.drain = noop;
|
|
@@ -6013,7 +6295,7 @@ var require_queue = __commonJS({
|
|
|
6013
6295
|
queue.drained = drained;
|
|
6014
6296
|
return queue;
|
|
6015
6297
|
function push(value) {
|
|
6016
|
-
var
|
|
6298
|
+
var p = new Promise(function(resolve4, reject) {
|
|
6017
6299
|
pushCb(value, function(err, result) {
|
|
6018
6300
|
if (err) {
|
|
6019
6301
|
reject(err);
|
|
@@ -6022,11 +6304,11 @@ var require_queue = __commonJS({
|
|
|
6022
6304
|
resolve4(result);
|
|
6023
6305
|
});
|
|
6024
6306
|
});
|
|
6025
|
-
|
|
6026
|
-
return
|
|
6307
|
+
p.catch(noop);
|
|
6308
|
+
return p;
|
|
6027
6309
|
}
|
|
6028
6310
|
function unshift(value) {
|
|
6029
|
-
var
|
|
6311
|
+
var p = new Promise(function(resolve4, reject) {
|
|
6030
6312
|
unshiftCb(value, function(err, result) {
|
|
6031
6313
|
if (err) {
|
|
6032
6314
|
reject(err);
|
|
@@ -6035,11 +6317,11 @@ var require_queue = __commonJS({
|
|
|
6035
6317
|
resolve4(result);
|
|
6036
6318
|
});
|
|
6037
6319
|
});
|
|
6038
|
-
|
|
6039
|
-
return
|
|
6320
|
+
p.catch(noop);
|
|
6321
|
+
return p;
|
|
6040
6322
|
}
|
|
6041
6323
|
function drained() {
|
|
6042
|
-
var
|
|
6324
|
+
var p = new Promise(function(resolve4) {
|
|
6043
6325
|
process.nextTick(function() {
|
|
6044
6326
|
if (queue.idle()) {
|
|
6045
6327
|
resolve4();
|
|
@@ -6053,7 +6335,7 @@ var require_queue = __commonJS({
|
|
|
6053
6335
|
}
|
|
6054
6336
|
});
|
|
6055
6337
|
});
|
|
6056
|
-
return
|
|
6338
|
+
return p;
|
|
6057
6339
|
}
|
|
6058
6340
|
}
|
|
6059
6341
|
module.exports = fastqueue;
|
|
@@ -6068,11 +6350,11 @@ var require_common2 = __commonJS({
|
|
|
6068
6350
|
init_utils2();
|
|
6069
6351
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6070
6352
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
6071
|
-
function isFatalError(
|
|
6072
|
-
if (
|
|
6353
|
+
function isFatalError(settings2, error2) {
|
|
6354
|
+
if (settings2.errorFilter === null) {
|
|
6073
6355
|
return true;
|
|
6074
6356
|
}
|
|
6075
|
-
return !
|
|
6357
|
+
return !settings2.errorFilter(error2);
|
|
6076
6358
|
}
|
|
6077
6359
|
exports.isFatalError = isFatalError;
|
|
6078
6360
|
function isAppliedFilter(filter, value) {
|
|
@@ -6083,14 +6365,14 @@ var require_common2 = __commonJS({
|
|
|
6083
6365
|
return filepath.split(/[/\\]/).join(separator);
|
|
6084
6366
|
}
|
|
6085
6367
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
6086
|
-
function joinPathSegments(
|
|
6087
|
-
if (
|
|
6368
|
+
function joinPathSegments(a2, b, separator) {
|
|
6369
|
+
if (a2 === "") {
|
|
6088
6370
|
return b;
|
|
6089
6371
|
}
|
|
6090
|
-
if (
|
|
6091
|
-
return
|
|
6372
|
+
if (a2.endsWith(separator)) {
|
|
6373
|
+
return a2 + b;
|
|
6092
6374
|
}
|
|
6093
|
-
return
|
|
6375
|
+
return a2 + separator + b;
|
|
6094
6376
|
}
|
|
6095
6377
|
exports.joinPathSegments = joinPathSegments;
|
|
6096
6378
|
}
|
|
@@ -6437,14 +6719,14 @@ var require_out3 = __commonJS({
|
|
|
6437
6719
|
}
|
|
6438
6720
|
exports.walk = walk;
|
|
6439
6721
|
function walkSync(directory, optionsOrSettings) {
|
|
6440
|
-
const
|
|
6441
|
-
const provider = new sync_1.default(directory,
|
|
6722
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6723
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6442
6724
|
return provider.read();
|
|
6443
6725
|
}
|
|
6444
6726
|
exports.walkSync = walkSync;
|
|
6445
6727
|
function walkStream(directory, optionsOrSettings) {
|
|
6446
|
-
const
|
|
6447
|
-
const provider = new stream_1.default(directory,
|
|
6728
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6729
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6448
6730
|
return provider.read();
|
|
6449
6731
|
}
|
|
6450
6732
|
exports.walkStream = walkStream;
|
|
@@ -6530,8 +6812,8 @@ var require_stream3 = __commonJS({
|
|
|
6530
6812
|
done();
|
|
6531
6813
|
}).catch(done);
|
|
6532
6814
|
};
|
|
6533
|
-
for (let
|
|
6534
|
-
stream.write(
|
|
6815
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6816
|
+
stream.write(i2);
|
|
6535
6817
|
}
|
|
6536
6818
|
return stream;
|
|
6537
6819
|
}
|
|
@@ -7192,14 +7474,14 @@ var require_out4 = __commonJS({
|
|
|
7192
7474
|
function generateTasks(source, options) {
|
|
7193
7475
|
assertPatternsInput(source);
|
|
7194
7476
|
const patterns = [].concat(source);
|
|
7195
|
-
const
|
|
7196
|
-
return taskManager.generate(patterns,
|
|
7477
|
+
const settings2 = new settings_1.default(options);
|
|
7478
|
+
return taskManager.generate(patterns, settings2);
|
|
7197
7479
|
}
|
|
7198
7480
|
FastGlob2.generateTasks = generateTasks;
|
|
7199
7481
|
function isDynamicPattern(source, options) {
|
|
7200
7482
|
assertPatternsInput(source);
|
|
7201
|
-
const
|
|
7202
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7483
|
+
const settings2 = new settings_1.default(options);
|
|
7484
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7203
7485
|
}
|
|
7204
7486
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7205
7487
|
function escapePath(source) {
|
|
@@ -7241,9 +7523,9 @@ var require_out4 = __commonJS({
|
|
|
7241
7523
|
})(FastGlob || (FastGlob = {}));
|
|
7242
7524
|
function getWorks(source, _Provider, options) {
|
|
7243
7525
|
const patterns = [].concat(source);
|
|
7244
|
-
const
|
|
7245
|
-
const tasks = taskManager.generate(patterns,
|
|
7246
|
-
const provider = new _Provider(
|
|
7526
|
+
const settings2 = new settings_1.default(options);
|
|
7527
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7528
|
+
const provider = new _Provider(settings2);
|
|
7247
7529
|
return tasks.map(provider.read, provider);
|
|
7248
7530
|
}
|
|
7249
7531
|
function assertPatternsInput(input) {
|
|
@@ -7421,14 +7703,14 @@ import "node:fs";
|
|
|
7421
7703
|
import { createRequire } from "node:module";
|
|
7422
7704
|
import {
|
|
7423
7705
|
resolve,
|
|
7424
|
-
join,
|
|
7425
|
-
dirname,
|
|
7706
|
+
join as join2,
|
|
7707
|
+
dirname as dirname2,
|
|
7426
7708
|
relative,
|
|
7427
7709
|
normalize,
|
|
7428
7710
|
sep,
|
|
7429
7711
|
extname
|
|
7430
7712
|
} from "node:path";
|
|
7431
|
-
import "node:url";
|
|
7713
|
+
import { fileURLToPath } from "node:url";
|
|
7432
7714
|
function safeExecuteAsync(fn, message) {
|
|
7433
7715
|
return fn().catch((error2) => {
|
|
7434
7716
|
throw new Error(
|
|
@@ -7436,7 +7718,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7436
7718
|
);
|
|
7437
7719
|
});
|
|
7438
7720
|
}
|
|
7439
|
-
var import_fast_glob, constants,
|
|
7721
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7440
7722
|
var init_PathResolver = __esm({
|
|
7441
7723
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7442
7724
|
"use strict";
|
|
@@ -7449,7 +7731,7 @@ var init_PathResolver = __esm({
|
|
|
7449
7731
|
getPatternsFor: getPatternsFor || void 0,
|
|
7450
7732
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7451
7733
|
};
|
|
7452
|
-
|
|
7734
|
+
log3 = {
|
|
7453
7735
|
error: (message, error2) => {
|
|
7454
7736
|
},
|
|
7455
7737
|
warn: (message, error2) => {
|
|
@@ -7485,6 +7767,7 @@ var init_PathResolver = __esm({
|
|
|
7485
7767
|
options;
|
|
7486
7768
|
_repoRoot;
|
|
7487
7769
|
_appRoot = null;
|
|
7770
|
+
_writtenPaths = null;
|
|
7488
7771
|
/**
|
|
7489
7772
|
* Get or create singleton instance
|
|
7490
7773
|
* @param options - Configuration options
|
|
@@ -7570,7 +7853,7 @@ var init_PathResolver = __esm({
|
|
|
7570
7853
|
*/
|
|
7571
7854
|
getDirname(path) {
|
|
7572
7855
|
if (!path) return "";
|
|
7573
|
-
return this.normalizePath(
|
|
7856
|
+
return this.normalizePath(dirname2(path));
|
|
7574
7857
|
}
|
|
7575
7858
|
/**
|
|
7576
7859
|
* Resolve package path using Node's module resolution
|
|
@@ -7582,7 +7865,7 @@ var init_PathResolver = __esm({
|
|
|
7582
7865
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7583
7866
|
try {
|
|
7584
7867
|
const basePath = fromPath || this.getAppRoot();
|
|
7585
|
-
const require3 = createRequire(
|
|
7868
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7586
7869
|
const resolved = require3.resolve(packageSpecifier);
|
|
7587
7870
|
return this.normalizePath(resolved);
|
|
7588
7871
|
} catch (error2) {
|
|
@@ -7734,7 +8017,7 @@ var init_PathResolver = __esm({
|
|
|
7734
8017
|
return cleanContent;
|
|
7735
8018
|
} catch (error2) {
|
|
7736
8019
|
if (this.options.debug) {
|
|
7737
|
-
|
|
8020
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7738
8021
|
}
|
|
7739
8022
|
return null;
|
|
7740
8023
|
}
|
|
@@ -7762,7 +8045,7 @@ var init_PathResolver = __esm({
|
|
|
7762
8045
|
return cleanContent;
|
|
7763
8046
|
} catch (error2) {
|
|
7764
8047
|
if (this.options.debug) {
|
|
7765
|
-
|
|
8048
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7766
8049
|
}
|
|
7767
8050
|
return null;
|
|
7768
8051
|
}
|
|
@@ -7784,16 +8067,16 @@ var init_PathResolver = __esm({
|
|
|
7784
8067
|
verbose = false
|
|
7785
8068
|
} = options;
|
|
7786
8069
|
const normalizedPath = this.normalizePath(filePath);
|
|
7787
|
-
const dir = this.normalizePath(
|
|
8070
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7788
8071
|
const fileExists = this.pathExists(normalizedPath);
|
|
7789
8072
|
if (fileExists && !overwrite) {
|
|
7790
8073
|
if (verbose) {
|
|
7791
|
-
|
|
8074
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7792
8075
|
}
|
|
7793
8076
|
return false;
|
|
7794
8077
|
}
|
|
7795
8078
|
if (dryRun) {
|
|
7796
|
-
|
|
8079
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7797
8080
|
return true;
|
|
7798
8081
|
}
|
|
7799
8082
|
try {
|
|
@@ -7803,22 +8086,23 @@ var init_PathResolver = __esm({
|
|
|
7803
8086
|
}
|
|
7804
8087
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7805
8088
|
let writeContent;
|
|
7806
|
-
if (
|
|
8089
|
+
if (Buffer2.isBuffer(content)) {
|
|
7807
8090
|
writeContent = content;
|
|
7808
8091
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7809
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8092
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8093
|
+
`;
|
|
7810
8094
|
} else {
|
|
7811
8095
|
writeContent = String(content);
|
|
7812
8096
|
}
|
|
7813
8097
|
try {
|
|
7814
8098
|
return await safeExecuteAsync(async () => {
|
|
7815
|
-
if (
|
|
8099
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7816
8100
|
await fs.promises.writeFile(normalizedPath, writeContent);
|
|
7817
8101
|
} else {
|
|
7818
8102
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7819
8103
|
}
|
|
7820
8104
|
if (verbose) {
|
|
7821
|
-
|
|
8105
|
+
log3.info(
|
|
7822
8106
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7823
8107
|
);
|
|
7824
8108
|
}
|
|
@@ -7845,16 +8129,16 @@ var init_PathResolver = __esm({
|
|
|
7845
8129
|
verbose = false
|
|
7846
8130
|
} = options;
|
|
7847
8131
|
const normalizedPath = this.normalizePath(filePath);
|
|
7848
|
-
const dir = this.normalizePath(
|
|
8132
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7849
8133
|
const fileExists = this.pathExists(normalizedPath);
|
|
7850
8134
|
if (fileExists && !overwrite) {
|
|
7851
8135
|
if (verbose) {
|
|
7852
|
-
|
|
8136
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7853
8137
|
}
|
|
7854
8138
|
return false;
|
|
7855
8139
|
}
|
|
7856
8140
|
if (dryRun) {
|
|
7857
|
-
|
|
8141
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7858
8142
|
return true;
|
|
7859
8143
|
}
|
|
7860
8144
|
try {
|
|
@@ -7864,21 +8148,23 @@ var init_PathResolver = __esm({
|
|
|
7864
8148
|
}
|
|
7865
8149
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7866
8150
|
let writeContent;
|
|
7867
|
-
if (
|
|
8151
|
+
if (Buffer2.isBuffer(content)) {
|
|
7868
8152
|
writeContent = content;
|
|
7869
8153
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7870
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8154
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8155
|
+
`;
|
|
7871
8156
|
} else {
|
|
7872
8157
|
writeContent = String(content);
|
|
7873
8158
|
}
|
|
7874
8159
|
try {
|
|
7875
|
-
if (
|
|
8160
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7876
8161
|
fs.writeFileSync(normalizedPath, writeContent);
|
|
7877
8162
|
} else {
|
|
7878
8163
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7879
8164
|
}
|
|
8165
|
+
this._writtenPaths?.add(normalizedPath);
|
|
7880
8166
|
if (verbose) {
|
|
7881
|
-
|
|
8167
|
+
log3.info(
|
|
7882
8168
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7883
8169
|
);
|
|
7884
8170
|
}
|
|
@@ -7903,15 +8189,15 @@ var init_PathResolver = __esm({
|
|
|
7903
8189
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7904
8190
|
if (fileExists && !overwrite) {
|
|
7905
8191
|
if (verbose) {
|
|
7906
|
-
|
|
8192
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7907
8193
|
}
|
|
7908
8194
|
return false;
|
|
7909
8195
|
}
|
|
7910
8196
|
if (dryRun) {
|
|
7911
|
-
|
|
8197
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7912
8198
|
return true;
|
|
7913
8199
|
}
|
|
7914
|
-
const dir = this.normalizePath(
|
|
8200
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7915
8201
|
try {
|
|
7916
8202
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7917
8203
|
} catch (error2) {
|
|
@@ -7921,7 +8207,7 @@ var init_PathResolver = __esm({
|
|
|
7921
8207
|
return await safeExecuteAsync(async () => {
|
|
7922
8208
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7923
8209
|
if (verbose) {
|
|
7924
|
-
|
|
8210
|
+
log3.info(
|
|
7925
8211
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7926
8212
|
);
|
|
7927
8213
|
}
|
|
@@ -7945,15 +8231,15 @@ var init_PathResolver = __esm({
|
|
|
7945
8231
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7946
8232
|
if (fileExists && !overwrite) {
|
|
7947
8233
|
if (verbose) {
|
|
7948
|
-
|
|
8234
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7949
8235
|
}
|
|
7950
8236
|
return false;
|
|
7951
8237
|
}
|
|
7952
8238
|
if (dryRun) {
|
|
7953
|
-
|
|
8239
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7954
8240
|
return true;
|
|
7955
8241
|
}
|
|
7956
|
-
const dir = this.normalizePath(
|
|
8242
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7957
8243
|
try {
|
|
7958
8244
|
fs.mkdirSync(dir, { recursive: true });
|
|
7959
8245
|
} catch (error2) {
|
|
@@ -7961,8 +8247,9 @@ var init_PathResolver = __esm({
|
|
|
7961
8247
|
}
|
|
7962
8248
|
try {
|
|
7963
8249
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
8250
|
+
this._writtenPaths?.add(normalizedDestPath);
|
|
7964
8251
|
if (verbose) {
|
|
7965
|
-
|
|
8252
|
+
log3.info(
|
|
7966
8253
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7967
8254
|
);
|
|
7968
8255
|
}
|
|
@@ -7979,7 +8266,7 @@ var init_PathResolver = __esm({
|
|
|
7979
8266
|
return fs.existsSync(filePath);
|
|
7980
8267
|
} catch (error2) {
|
|
7981
8268
|
if (!silent) {
|
|
7982
|
-
|
|
8269
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7983
8270
|
}
|
|
7984
8271
|
return false;
|
|
7985
8272
|
}
|
|
@@ -8005,7 +8292,7 @@ var init_PathResolver = __esm({
|
|
|
8005
8292
|
return fs.readdirSync(dirPath, options);
|
|
8006
8293
|
} catch (error2) {
|
|
8007
8294
|
if (this.options.debug) {
|
|
8008
|
-
|
|
8295
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
8009
8296
|
}
|
|
8010
8297
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
8011
8298
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -8023,11 +8310,29 @@ var init_PathResolver = __esm({
|
|
|
8023
8310
|
return fs.statSync(filePath);
|
|
8024
8311
|
} catch (error2) {
|
|
8025
8312
|
if (this.options.debug) {
|
|
8026
|
-
|
|
8313
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
8027
8314
|
}
|
|
8028
8315
|
return null;
|
|
8029
8316
|
}
|
|
8030
8317
|
}
|
|
8318
|
+
/**
|
|
8319
|
+
* Resolve the real path of a file, following symlinks
|
|
8320
|
+
* @param filePath - Path to resolve
|
|
8321
|
+
* @returns Resolved real path
|
|
8322
|
+
*/
|
|
8323
|
+
realpathSync(filePath) {
|
|
8324
|
+
return fs.realpathSync(filePath);
|
|
8325
|
+
}
|
|
8326
|
+
/**
|
|
8327
|
+
* Watch a directory for changes
|
|
8328
|
+
* @param dirPath - Directory to watch
|
|
8329
|
+
* @param options - fs.watch options
|
|
8330
|
+
* @param callback - Callback for change events
|
|
8331
|
+
* @returns FSWatcher instance
|
|
8332
|
+
*/
|
|
8333
|
+
watch(dirPath, options, callback) {
|
|
8334
|
+
return fs.watch(dirPath, options, callback);
|
|
8335
|
+
}
|
|
8031
8336
|
/**
|
|
8032
8337
|
* Get file stats synchronously (follows symlinks)
|
|
8033
8338
|
* Returns null if file doesn't exist (graceful degradation)
|
|
@@ -8040,7 +8345,7 @@ var init_PathResolver = __esm({
|
|
|
8040
8345
|
return fs.lstatSync(filePath);
|
|
8041
8346
|
} catch (error2) {
|
|
8042
8347
|
if (this.options.debug) {
|
|
8043
|
-
|
|
8348
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
8044
8349
|
}
|
|
8045
8350
|
return null;
|
|
8046
8351
|
}
|
|
@@ -8107,6 +8412,28 @@ var init_PathResolver = __esm({
|
|
|
8107
8412
|
* Get app root (where vite.config.ts is, Vite's config.root)
|
|
8108
8413
|
* Falls back to repoRoot if not set
|
|
8109
8414
|
*/
|
|
8415
|
+
/**
|
|
8416
|
+
* Start recording every path written by writeSync/copySync.
|
|
8417
|
+
* Lets a generator know exactly which files the current run produced,
|
|
8418
|
+
* without comparing file timestamps to a clock.
|
|
8419
|
+
*/
|
|
8420
|
+
startWriteRecording() {
|
|
8421
|
+
this._writtenPaths = /* @__PURE__ */ new Set();
|
|
8422
|
+
}
|
|
8423
|
+
/**
|
|
8424
|
+
* Stop recording and return the normalized paths written since
|
|
8425
|
+
* startWriteRecording().
|
|
8426
|
+
*/
|
|
8427
|
+
stopWriteRecording() {
|
|
8428
|
+
if (!this._writtenPaths) {
|
|
8429
|
+
throw new Error(
|
|
8430
|
+
"stopWriteRecording() called without startWriteRecording()"
|
|
8431
|
+
);
|
|
8432
|
+
}
|
|
8433
|
+
const written = this._writtenPaths;
|
|
8434
|
+
this._writtenPaths = null;
|
|
8435
|
+
return written;
|
|
8436
|
+
}
|
|
8110
8437
|
getAppRoot() {
|
|
8111
8438
|
if (!this._appRoot) {
|
|
8112
8439
|
return this._repoRoot;
|
|
@@ -8129,7 +8456,7 @@ var init_PathResolver = __esm({
|
|
|
8129
8456
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
8130
8457
|
*/
|
|
8131
8458
|
isMonorepo() {
|
|
8132
|
-
const packagesDir =
|
|
8459
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
8133
8460
|
return this.pathExists(packagesDir);
|
|
8134
8461
|
}
|
|
8135
8462
|
/**
|
|
@@ -8146,7 +8473,7 @@ var init_PathResolver = __esm({
|
|
|
8146
8473
|
* Find files matching pattern within directory
|
|
8147
8474
|
*/
|
|
8148
8475
|
async findFiles(directory, pattern, options = {}) {
|
|
8149
|
-
const searchPattern = this.normalizePath(
|
|
8476
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
8150
8477
|
const appRoot = this.getAppRoot();
|
|
8151
8478
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
8152
8479
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8193,7 +8520,7 @@ var init_PathResolver = __esm({
|
|
|
8193
8520
|
return null;
|
|
8194
8521
|
}
|
|
8195
8522
|
const resolvedPath = this.normalizePath(
|
|
8196
|
-
|
|
8523
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8197
8524
|
);
|
|
8198
8525
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8199
8526
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8364,6 +8691,15 @@ var init_PathResolver = __esm({
|
|
|
8364
8691
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8365
8692
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8366
8693
|
}
|
|
8694
|
+
/**
|
|
8695
|
+
* Get absolute path to empty flag component module.
|
|
8696
|
+
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8697
|
+
* to replace unused flag files at build time.
|
|
8698
|
+
*/
|
|
8699
|
+
getEmptyFlagModulePath() {
|
|
8700
|
+
const __dirname2 = dirname2(fileURLToPath(import.meta.url));
|
|
8701
|
+
return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
|
|
8702
|
+
}
|
|
8367
8703
|
/**
|
|
8368
8704
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8369
8705
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8389,13 +8725,13 @@ var init_PathResolver = __esm({
|
|
|
8389
8725
|
const maxLevels = this.options.maxLevels;
|
|
8390
8726
|
while (levelsChecked < maxLevels) {
|
|
8391
8727
|
const toolingPath = this.normalizePath(
|
|
8392
|
-
|
|
8728
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8393
8729
|
);
|
|
8394
|
-
const corePath = this.normalizePath(
|
|
8730
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8395
8731
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8396
8732
|
return currentDir;
|
|
8397
8733
|
}
|
|
8398
|
-
const appsDir =
|
|
8734
|
+
const appsDir = join2(currentDir, "apps");
|
|
8399
8735
|
if (this.pathExists(appsDir)) {
|
|
8400
8736
|
const appsDirStat = this.statSync(appsDir);
|
|
8401
8737
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8403,15 +8739,15 @@ var init_PathResolver = __esm({
|
|
|
8403
8739
|
}
|
|
8404
8740
|
}
|
|
8405
8741
|
const packageJsonPath = this.normalizePath(
|
|
8406
|
-
|
|
8742
|
+
join2(currentDir, "package.json")
|
|
8407
8743
|
);
|
|
8408
8744
|
if (this.pathExists(packageJsonPath)) {
|
|
8409
|
-
const parentDir2 = this.normalizePath(
|
|
8745
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8410
8746
|
if (parentDir2 === currentDir) {
|
|
8411
8747
|
return currentDir;
|
|
8412
8748
|
}
|
|
8413
8749
|
}
|
|
8414
|
-
const parentDir = this.normalizePath(
|
|
8750
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8415
8751
|
if (parentDir === currentDir) {
|
|
8416
8752
|
break;
|
|
8417
8753
|
}
|
|
@@ -8462,7 +8798,7 @@ __export(pathResolver_exports, {
|
|
|
8462
8798
|
isWithinApp: () => isWithinApp,
|
|
8463
8799
|
isWithinRepoRoot: () => isWithinRepoRoot,
|
|
8464
8800
|
joinPath: () => joinPath,
|
|
8465
|
-
lstatSync: () =>
|
|
8801
|
+
lstatSync: () => lstatSync3,
|
|
8466
8802
|
normalizePath: () => normalizePath,
|
|
8467
8803
|
openFile: () => openFile,
|
|
8468
8804
|
pathExists: () => pathExists,
|
|
@@ -8470,7 +8806,7 @@ __export(pathResolver_exports, {
|
|
|
8470
8806
|
read: () => read,
|
|
8471
8807
|
readSync: () => readSync,
|
|
8472
8808
|
readdir: () => readdir,
|
|
8473
|
-
readdirSync: () =>
|
|
8809
|
+
readdirSync: () => readdirSync3,
|
|
8474
8810
|
remove: () => remove,
|
|
8475
8811
|
removeSync: () => removeSync,
|
|
8476
8812
|
resolveAppPath: () => resolveAppPath,
|
|
@@ -8487,8 +8823,8 @@ __export(pathResolver_exports, {
|
|
|
8487
8823
|
});
|
|
8488
8824
|
import { createRequire as createRequire2 } from "node:module";
|
|
8489
8825
|
import {
|
|
8490
|
-
join as
|
|
8491
|
-
dirname as
|
|
8826
|
+
join as join3,
|
|
8827
|
+
dirname as dirname3,
|
|
8492
8828
|
basename as basename2,
|
|
8493
8829
|
extname as extname2,
|
|
8494
8830
|
relative as relative2,
|
|
@@ -8497,11 +8833,11 @@ import {
|
|
|
8497
8833
|
isAbsolute as pathIsAbsolute
|
|
8498
8834
|
} from "node:path";
|
|
8499
8835
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8500
|
-
function
|
|
8836
|
+
function readdirSync3(dirPath, options) {
|
|
8501
8837
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8502
8838
|
}
|
|
8503
8839
|
function getDirnameFromUrl(importMetaUrl) {
|
|
8504
|
-
return
|
|
8840
|
+
return dirname3(fileURLToPath2(importMetaUrl));
|
|
8505
8841
|
}
|
|
8506
8842
|
function findNodeModulesDir(startDir) {
|
|
8507
8843
|
let currentDir = normalizePath(startDir);
|
|
@@ -8564,7 +8900,7 @@ function getTemplatesRoot() {
|
|
|
8564
8900
|
const mode = detectExecutionMode();
|
|
8565
8901
|
if (mode === "development") {
|
|
8566
8902
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
8567
|
-
const frameworkRoot = normalizePath(
|
|
8903
|
+
const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
|
|
8568
8904
|
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8569
8905
|
} else {
|
|
8570
8906
|
try {
|
|
@@ -8580,7 +8916,7 @@ function getTemplatesRoot() {
|
|
|
8580
8916
|
try {
|
|
8581
8917
|
const req = createRequire2(import.meta.url);
|
|
8582
8918
|
const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
|
|
8583
|
-
const cliRoot2 = normalizePath(
|
|
8919
|
+
const cliRoot2 = normalizePath(dirname3(cliPackageJsonPath));
|
|
8584
8920
|
const templatesPath = normalizePath(cliRoot2, "templates");
|
|
8585
8921
|
if (pathExists(templatesPath)) {
|
|
8586
8922
|
return templatesPath;
|
|
@@ -8632,20 +8968,20 @@ async function isBinaryFile(filePath) {
|
|
|
8632
8968
|
try {
|
|
8633
8969
|
let fileHandle = null;
|
|
8634
8970
|
try {
|
|
8635
|
-
const buffer =
|
|
8971
|
+
const buffer = Buffer2.alloc(4096);
|
|
8636
8972
|
const fs2 = await import("node:fs");
|
|
8637
8973
|
fileHandle = await fs2.promises.open(filePath, "r");
|
|
8638
8974
|
const { bytesRead } = await fileHandle.read(buffer, 0, 4096, 0);
|
|
8639
8975
|
if (bytesRead === 0) {
|
|
8640
8976
|
return false;
|
|
8641
8977
|
}
|
|
8642
|
-
for (let
|
|
8643
|
-
if (buffer[
|
|
8978
|
+
for (let i2 = 0; i2 < bytesRead; i2++) {
|
|
8979
|
+
if (buffer[i2] === 0) {
|
|
8644
8980
|
return true;
|
|
8645
8981
|
}
|
|
8646
8982
|
}
|
|
8647
|
-
for (let
|
|
8648
|
-
const byte = buffer[
|
|
8983
|
+
for (let i2 = 0; i2 < bytesRead; i2++) {
|
|
8984
|
+
const byte = buffer[i2];
|
|
8649
8985
|
if (byte && (byte < 9 || byte > 13 && byte < 32 && byte !== 27)) {
|
|
8650
8986
|
return true;
|
|
8651
8987
|
}
|
|
@@ -8657,8 +8993,8 @@ async function isBinaryFile(filePath) {
|
|
|
8657
8993
|
}
|
|
8658
8994
|
}
|
|
8659
8995
|
} catch (err) {
|
|
8660
|
-
const { log:
|
|
8661
|
-
|
|
8996
|
+
const { log: log4 } = await Promise.resolve().then(() => (init_cli_output(), cli_output_exports));
|
|
8997
|
+
log4.warn(`Error checking if file is binary: ${filePath}`, err);
|
|
8662
8998
|
return true;
|
|
8663
8999
|
}
|
|
8664
9000
|
}
|
|
@@ -8666,8 +9002,8 @@ async function glob(pattern, options = {}) {
|
|
|
8666
9002
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8667
9003
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8668
9004
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8669
|
-
const relativePatterns = patterns.map((
|
|
8670
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
9005
|
+
const relativePatterns = patterns.map((p) => {
|
|
9006
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8671
9007
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8672
9008
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8673
9009
|
}
|
|
@@ -8693,8 +9029,8 @@ function globSync(pattern, options = {}) {
|
|
|
8693
9029
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8694
9030
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8695
9031
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8696
|
-
const relativePatterns = patterns.map((
|
|
8697
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
9032
|
+
const relativePatterns = patterns.map((p) => {
|
|
9033
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8698
9034
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8699
9035
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8700
9036
|
}
|
|
@@ -8718,7 +9054,7 @@ function globSync(pattern, options = {}) {
|
|
|
8718
9054
|
globstar: true,
|
|
8719
9055
|
throwErrorOnBrokenSymbolicLink: options.throwErrorOnBrokenSymbolicLink
|
|
8720
9056
|
});
|
|
8721
|
-
return results.map((
|
|
9057
|
+
return results.map((p) => pathResolverInstance.normalizePath(p));
|
|
8722
9058
|
}
|
|
8723
9059
|
async function pathExistsAsync(filePath) {
|
|
8724
9060
|
try {
|
|
@@ -8737,7 +9073,7 @@ async function openFile(filePath, flags) {
|
|
|
8737
9073
|
function stripBom(content) {
|
|
8738
9074
|
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
8739
9075
|
}
|
|
8740
|
-
var pathResolverInstance, getPathResolver, getRepoRoot, getAppRoot, setAppRoot, resolvePackage, resolveFrameworkPackage, resolvePackageAsset, resolveAppPath, resolveRepoPath, resolvePath, normalizePath, getRelativePath, createImportPath, getFileInfo, pathExists, read, readSync, write, writeSync, copy, copySync, remove, removeSync, statSync2,
|
|
9076
|
+
var pathResolverInstance, getPathResolver, getRepoRoot, getAppRoot, setAppRoot, resolvePackage, resolveFrameworkPackage, resolvePackageAsset, resolveAppPath, resolveRepoPath, resolvePath, normalizePath, getRelativePath, createImportPath, getFileInfo, pathExists, read, readSync, write, writeSync, copy, copySync, remove, removeSync, statSync2, lstatSync3, ensureDir, ensureDirSync, readdir, isWithinApp, findFiles, clearPathCache, fromAppRoot, getRelativePathBetween, getDirname, getBasename, getExtname, getDirnameFromPath, isAbsolute, joinPath, isWithinRepoRoot;
|
|
8741
9077
|
var init_pathResolver = __esm({
|
|
8742
9078
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
8743
9079
|
"use strict";
|
|
@@ -8755,7 +9091,7 @@ var init_pathResolver = __esm({
|
|
|
8755
9091
|
resolveRepoPath = (relativePath) => pathResolverInstance.resolveRepoPath(relativePath);
|
|
8756
9092
|
resolvePath = (relativePath, baseDir) => pathResolverInstance.resolvePath(relativePath, baseDir);
|
|
8757
9093
|
normalizePath = (...pathSegments) => {
|
|
8758
|
-
return pathResolverInstance.normalizePath(
|
|
9094
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8759
9095
|
};
|
|
8760
9096
|
getRelativePath = (absolutePath) => pathResolverInstance.getRelativePath(absolutePath);
|
|
8761
9097
|
createImportPath = (absolutePath) => pathResolverInstance.createImportPath(absolutePath);
|
|
@@ -8770,7 +9106,7 @@ var init_pathResolver = __esm({
|
|
|
8770
9106
|
remove = async (path) => pathResolverInstance.remove(path);
|
|
8771
9107
|
removeSync = (path) => pathResolverInstance.removeSync(path);
|
|
8772
9108
|
statSync2 = (filePath) => pathResolverInstance.statSync(filePath);
|
|
8773
|
-
|
|
9109
|
+
lstatSync3 = (filePath) => pathResolverInstance.lstatSync(filePath);
|
|
8774
9110
|
ensureDir = async (dirPath) => pathResolverInstance.ensureDir(dirPath);
|
|
8775
9111
|
ensureDirSync = (dirPath) => pathResolverInstance.ensureDirSync(dirPath);
|
|
8776
9112
|
readdir = async (dirPath, options) => pathResolverInstance.readdir(dirPath, options);
|
|
@@ -8778,13 +9114,13 @@ var init_pathResolver = __esm({
|
|
|
8778
9114
|
findFiles = async (directory, pattern, options = {}) => pathResolverInstance.findFiles(directory, pattern, options);
|
|
8779
9115
|
clearPathCache = () => pathResolverInstance.clearCache();
|
|
8780
9116
|
fromAppRoot = (...pathSegments) => {
|
|
8781
|
-
return pathResolverInstance.resolveAppPath(
|
|
9117
|
+
return pathResolverInstance.resolveAppPath(join3(...pathSegments));
|
|
8782
9118
|
};
|
|
8783
9119
|
getRelativePathBetween = (from, to) => {
|
|
8784
9120
|
return normalizePath(relative2(from, to));
|
|
8785
9121
|
};
|
|
8786
9122
|
getDirname = (filePath) => {
|
|
8787
|
-
return normalizePath(
|
|
9123
|
+
return normalizePath(dirname3(filePath));
|
|
8788
9124
|
};
|
|
8789
9125
|
getBasename = (filePath, ext) => {
|
|
8790
9126
|
return basename2(filePath, ext);
|
|
@@ -8793,7 +9129,7 @@ var init_pathResolver = __esm({
|
|
|
8793
9129
|
return extname2(filePath);
|
|
8794
9130
|
};
|
|
8795
9131
|
getDirnameFromPath = (filePath) => {
|
|
8796
|
-
return pathResolverInstance.normalizePath(
|
|
9132
|
+
return pathResolverInstance.normalizePath(dirname3(filePath));
|
|
8797
9133
|
};
|
|
8798
9134
|
isAbsolute = (filePath) => {
|
|
8799
9135
|
return pathIsAbsolute(filePath);
|
|
@@ -8859,10 +9195,10 @@ var init_typed_file_operations = __esm({
|
|
|
8859
9195
|
});
|
|
8860
9196
|
|
|
8861
9197
|
// packages/tooling/src/bundler/utils.ts
|
|
8862
|
-
import { Buffer } from "node:buffer";
|
|
9198
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8863
9199
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8864
9200
|
import { createRequire as createRequire3 } from "node:module";
|
|
8865
|
-
import { dirname as
|
|
9201
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8866
9202
|
import process from "node:process";
|
|
8867
9203
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8868
9204
|
var require2, __filename, __dirname;
|
|
@@ -8871,12 +9207,12 @@ var init_utils2 = __esm({
|
|
|
8871
9207
|
"use strict";
|
|
8872
9208
|
require2 = createRequire3(import.meta.url);
|
|
8873
9209
|
__filename = fileURLToPath3(import.meta.url);
|
|
8874
|
-
__dirname =
|
|
9210
|
+
__dirname = dirname4(__filename);
|
|
8875
9211
|
if (typeof globalThis !== "undefined") {
|
|
8876
9212
|
globalThis.require = require2;
|
|
8877
9213
|
globalThis.__filename = __filename;
|
|
8878
9214
|
globalThis.__dirname = __dirname;
|
|
8879
|
-
globalThis.Buffer =
|
|
9215
|
+
globalThis.Buffer = Buffer2;
|
|
8880
9216
|
globalThis.process = process;
|
|
8881
9217
|
if (typeof global === "undefined") {
|
|
8882
9218
|
globalThis.global = globalThis;
|
|
@@ -8887,24 +9223,24 @@ var init_utils2 = __esm({
|
|
|
8887
9223
|
|
|
8888
9224
|
// packages/tooling/src/utils/cli-input.ts
|
|
8889
9225
|
async function askForInput(message, defaultValue = "") {
|
|
8890
|
-
const result = await
|
|
9226
|
+
const result = await text({
|
|
8891
9227
|
message,
|
|
8892
9228
|
placeholder: defaultValue || void 0,
|
|
8893
9229
|
defaultValue: defaultValue || void 0
|
|
8894
9230
|
});
|
|
8895
|
-
if (
|
|
8896
|
-
|
|
9231
|
+
if (isCancel(result)) {
|
|
9232
|
+
cancel("Operation cancelled.");
|
|
8897
9233
|
process.exit(0);
|
|
8898
9234
|
}
|
|
8899
9235
|
return result;
|
|
8900
9236
|
}
|
|
8901
9237
|
async function askForConfirmation(message, defaultValue = false) {
|
|
8902
|
-
const result = await
|
|
9238
|
+
const result = await confirm({
|
|
8903
9239
|
message,
|
|
8904
9240
|
initialValue: defaultValue
|
|
8905
9241
|
});
|
|
8906
|
-
if (
|
|
8907
|
-
|
|
9242
|
+
if (isCancel(result)) {
|
|
9243
|
+
cancel("Operation cancelled.");
|
|
8908
9244
|
process.exit(0);
|
|
8909
9245
|
}
|
|
8910
9246
|
return result;
|
|
@@ -8915,13 +9251,13 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8915
9251
|
label: choice.title,
|
|
8916
9252
|
hint: choice.hint
|
|
8917
9253
|
}));
|
|
8918
|
-
const result = await
|
|
9254
|
+
const result = await select({
|
|
8919
9255
|
message,
|
|
8920
9256
|
options,
|
|
8921
9257
|
initialValue: choices[defaultValue]?.value
|
|
8922
9258
|
});
|
|
8923
|
-
if (
|
|
8924
|
-
|
|
9259
|
+
if (isCancel(result)) {
|
|
9260
|
+
cancel("Operation cancelled.");
|
|
8925
9261
|
process.exit(0);
|
|
8926
9262
|
}
|
|
8927
9263
|
return result;
|
|
@@ -8950,7 +9286,7 @@ init_pathResolver();
|
|
|
8950
9286
|
init_typed_file_operations();
|
|
8951
9287
|
async function copyTemplateFiles(sourceDir, destDir, replacements) {
|
|
8952
9288
|
if (!pathExists(sourceDir)) {
|
|
8953
|
-
|
|
9289
|
+
log2.warn(`Warning: Template directory does not exist: ${sourceDir}`);
|
|
8954
9290
|
return;
|
|
8955
9291
|
}
|
|
8956
9292
|
const files = await glob("**/*", {
|
|
@@ -9020,8 +9356,8 @@ async function isTextFile(filePath) {
|
|
|
9020
9356
|
try {
|
|
9021
9357
|
const buffer = await read(filePath, { format: "buffer" });
|
|
9022
9358
|
if (buffer.length === 0) return true;
|
|
9023
|
-
for (let
|
|
9024
|
-
if (buffer[
|
|
9359
|
+
for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
|
|
9360
|
+
if (buffer[i2] === 0) return false;
|
|
9025
9361
|
}
|
|
9026
9362
|
return true;
|
|
9027
9363
|
} catch {
|
|
@@ -9046,7 +9382,7 @@ async function replacePlaceholders(filePath, replacements) {
|
|
|
9046
9382
|
}
|
|
9047
9383
|
await write(filePath, content, { overwrite: true });
|
|
9048
9384
|
} catch (error2) {
|
|
9049
|
-
|
|
9385
|
+
log2.warn(
|
|
9050
9386
|
`Warning: Could not process file ${filePath}: ${error2.message || "Unknown error"}`
|
|
9051
9387
|
);
|
|
9052
9388
|
}
|
|
@@ -9100,14 +9436,14 @@ function isReservedAppName(name) {
|
|
|
9100
9436
|
async function updateRootPackageJson(rootDir, appNames) {
|
|
9101
9437
|
const packageJsonPath = joinPath(rootDir, "package.json");
|
|
9102
9438
|
if (!pathExists(packageJsonPath)) {
|
|
9103
|
-
|
|
9439
|
+
log2.warn("Root package.json not found, skipping script updates");
|
|
9104
9440
|
return;
|
|
9105
9441
|
}
|
|
9106
9442
|
try {
|
|
9107
9443
|
const packageJson = await read(packageJsonPath, { format: "json" });
|
|
9108
9444
|
packageJson.scripts = packageJson.scripts || {};
|
|
9109
9445
|
} catch (error2) {
|
|
9110
|
-
|
|
9446
|
+
log2.warn(
|
|
9111
9447
|
`Warning: Could not update root package.json: ${error2.message || "Unknown error"}`
|
|
9112
9448
|
);
|
|
9113
9449
|
}
|
|
@@ -9115,14 +9451,14 @@ async function updateRootPackageJson(rootDir, appNames) {
|
|
|
9115
9451
|
async function mergeRootPackageJson(rootDir, allAppNames, options = {}) {
|
|
9116
9452
|
const packageJsonPath = joinPath(rootDir, "package.json");
|
|
9117
9453
|
if (!pathExists(packageJsonPath)) {
|
|
9118
|
-
|
|
9454
|
+
log2.warn("Root package.json not found, skipping merge");
|
|
9119
9455
|
return;
|
|
9120
9456
|
}
|
|
9121
9457
|
try {
|
|
9122
9458
|
const packageJson = await read(packageJsonPath, { format: "json" });
|
|
9123
9459
|
packageJson.scripts = packageJson.scripts || {};
|
|
9124
9460
|
} catch (error2) {
|
|
9125
|
-
|
|
9461
|
+
log2.warn(
|
|
9126
9462
|
`Warning: Could not merge root package.json: ${error2.message || "Unknown error"}`
|
|
9127
9463
|
);
|
|
9128
9464
|
}
|
|
@@ -9130,7 +9466,7 @@ async function mergeRootPackageJson(rootDir, allAppNames, options = {}) {
|
|
|
9130
9466
|
async function mergeRootTsConfig(rootDir, allAppNames, includeFunctions = false) {
|
|
9131
9467
|
const tsconfigPath = joinPath(rootDir, "tsconfig.json");
|
|
9132
9468
|
if (!pathExists(tsconfigPath)) {
|
|
9133
|
-
|
|
9469
|
+
log2.warn("Root tsconfig.json not found, skipping merge");
|
|
9134
9470
|
return;
|
|
9135
9471
|
}
|
|
9136
9472
|
try {
|
|
@@ -9153,10 +9489,10 @@ async function mergeRootTsConfig(rootDir, allAppNames, includeFunctions = false)
|
|
|
9153
9489
|
}
|
|
9154
9490
|
if (updated) {
|
|
9155
9491
|
await write(tsconfigPath, tsconfig, { format: "json", overwrite: true });
|
|
9156
|
-
|
|
9492
|
+
log2.info("Merged root tsconfig.json");
|
|
9157
9493
|
}
|
|
9158
9494
|
} catch (error2) {
|
|
9159
|
-
|
|
9495
|
+
log2.warn(
|
|
9160
9496
|
`Warning: Could not merge root tsconfig.json: ${error2.message || "Unknown error"}`
|
|
9161
9497
|
);
|
|
9162
9498
|
}
|
|
@@ -9164,7 +9500,7 @@ async function mergeRootTsConfig(rootDir, allAppNames, includeFunctions = false)
|
|
|
9164
9500
|
async function mergeRootTurboJson(rootDir) {
|
|
9165
9501
|
const turboJsonPath = joinPath(rootDir, "turbo.json");
|
|
9166
9502
|
if (!pathExists(turboJsonPath)) {
|
|
9167
|
-
|
|
9503
|
+
log2.warn("Root turbo.json not found, skipping merge");
|
|
9168
9504
|
return;
|
|
9169
9505
|
}
|
|
9170
9506
|
try {
|
|
@@ -9216,10 +9552,10 @@ async function mergeRootTurboJson(rootDir) {
|
|
|
9216
9552
|
format: "json",
|
|
9217
9553
|
overwrite: true
|
|
9218
9554
|
});
|
|
9219
|
-
|
|
9555
|
+
log2.info("Merged root turbo.json");
|
|
9220
9556
|
}
|
|
9221
9557
|
} catch (error2) {
|
|
9222
|
-
|
|
9558
|
+
log2.warn(
|
|
9223
9559
|
`Warning: Could not merge root turbo.json: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
9224
9560
|
);
|
|
9225
9561
|
}
|
|
@@ -9289,16 +9625,16 @@ function loadMatrix(mode) {
|
|
|
9289
9625
|
return cachedMatrix;
|
|
9290
9626
|
}
|
|
9291
9627
|
function resolveGroup(groupName, matrix) {
|
|
9292
|
-
const
|
|
9293
|
-
if (!
|
|
9628
|
+
const group2 = matrix.groups[groupName];
|
|
9629
|
+
if (!group2) return {};
|
|
9294
9630
|
const result = {};
|
|
9295
|
-
if (
|
|
9296
|
-
for (const included of
|
|
9631
|
+
if (group2.includes) {
|
|
9632
|
+
for (const included of group2.includes) {
|
|
9297
9633
|
Object.assign(result, resolveGroup(included, matrix));
|
|
9298
9634
|
}
|
|
9299
9635
|
}
|
|
9300
|
-
if (
|
|
9301
|
-
Object.assign(result,
|
|
9636
|
+
if (group2.packages) {
|
|
9637
|
+
Object.assign(result, group2.packages);
|
|
9302
9638
|
}
|
|
9303
9639
|
return result;
|
|
9304
9640
|
}
|
|
@@ -9660,9 +9996,9 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9660
9996
|
}
|
|
9661
9997
|
if (mode === "published") {
|
|
9662
9998
|
const overrides = {};
|
|
9663
|
-
for (const [groupName,
|
|
9999
|
+
for (const [groupName, group2] of Object.entries(matrix.groups || {})) {
|
|
9664
10000
|
if (groupName.startsWith("@donotdev/")) {
|
|
9665
|
-
const version =
|
|
10001
|
+
const version = group2.packages?.[groupName];
|
|
9666
10002
|
if (version) {
|
|
9667
10003
|
overrides[groupName] = version.replace(/^\^/, "");
|
|
9668
10004
|
}
|
|
@@ -9694,7 +10030,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9694
10030
|
workspaceRoot = workspaceRoot || currentDir;
|
|
9695
10031
|
}
|
|
9696
10032
|
templatesRoot = templatesRoot || getTemplatesRoot();
|
|
9697
|
-
|
|
10033
|
+
intro("\u{1F680} DoNotDev App Creator");
|
|
9698
10034
|
if (!appName) {
|
|
9699
10035
|
appName = await askForInput(
|
|
9700
10036
|
`App name - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
|
|
@@ -9756,18 +10092,18 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9756
10092
|
1
|
|
9757
10093
|
);
|
|
9758
10094
|
if (action === "skip") {
|
|
9759
|
-
|
|
10095
|
+
log2.info(`\u23ED\uFE0F Skipping app: ${appName}`);
|
|
9760
10096
|
return;
|
|
9761
10097
|
}
|
|
9762
10098
|
if (action === "replace") {
|
|
9763
10099
|
await remove(appDir);
|
|
9764
10100
|
}
|
|
9765
10101
|
} else {
|
|
9766
|
-
|
|
10102
|
+
log2.info(`\u23ED\uFE0F App "${appName}" already exists, skipping.`);
|
|
9767
10103
|
return;
|
|
9768
10104
|
}
|
|
9769
10105
|
}
|
|
9770
|
-
const s =
|
|
10106
|
+
const s = spinner();
|
|
9771
10107
|
s.start(`Creating app: ${appName}`);
|
|
9772
10108
|
await ensureDir(appDir);
|
|
9773
10109
|
const builder = appTemplate;
|
|
@@ -9892,7 +10228,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9892
10228
|
joinPath(templatesRoot, functionsTemplateName)
|
|
9893
10229
|
);
|
|
9894
10230
|
if (!functionsTemplateExists) {
|
|
9895
|
-
|
|
10231
|
+
log2.warn(
|
|
9896
10232
|
`Functions template "${functionsTemplateName}" not found \u2014 skipping functions scaffolding.`
|
|
9897
10233
|
);
|
|
9898
10234
|
} else {
|
|
@@ -9956,7 +10292,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9956
10292
|
});
|
|
9957
10293
|
if (firebaseJson.hosting?.rewrites && Array.isArray(firebaseJson.hosting.rewrites)) {
|
|
9958
10294
|
firebaseJson.hosting.rewrites = firebaseJson.hosting.rewrites.filter(
|
|
9959
|
-
(
|
|
10295
|
+
(r2) => r2.destination !== "/index.html"
|
|
9960
10296
|
);
|
|
9961
10297
|
}
|
|
9962
10298
|
if (firebaseJson.hosting) {
|
|
@@ -10070,16 +10406,16 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10070
10406
|
const appsDir = joinPath(workspaceRoot, "apps");
|
|
10071
10407
|
const allDirs = pathExists(appsDir) ? (await readdir(appsDir, {
|
|
10072
10408
|
withFileTypes: true
|
|
10073
|
-
})).filter((
|
|
10409
|
+
})).filter((d) => d.isDirectory()).map((d) => d.name).filter(isValidFileName) : [];
|
|
10074
10410
|
await updateRootPackageJson(workspaceRoot, allDirs);
|
|
10075
10411
|
}
|
|
10076
10412
|
if (isInteractive) {
|
|
10077
|
-
|
|
10413
|
+
outro("\u{1F389} App created successfully!");
|
|
10078
10414
|
const firebaseStep = row.functionsTemplate === "functions-firebase" ? `2. Set Firebase project: cd apps/${appName} && firebase use --add (or edit .firebaserc)
|
|
10079
10415
|
3. bun install
|
|
10080
10416
|
4. bun run dev` : `2. bun install
|
|
10081
10417
|
3. bun run dev`;
|
|
10082
|
-
|
|
10418
|
+
note(
|
|
10083
10419
|
`Next steps:
|
|
10084
10420
|
|
|
10085
10421
|
1. cd apps/${appName}
|
|
@@ -10154,20 +10490,20 @@ function detectExecutionMode2() {
|
|
|
10154
10490
|
}
|
|
10155
10491
|
async function main(_options, name) {
|
|
10156
10492
|
try {
|
|
10157
|
-
|
|
10493
|
+
intro("\u{1F680} DoNotDev Project Creator");
|
|
10158
10494
|
try {
|
|
10159
10495
|
const { execSync } = await import("node:child_process");
|
|
10160
10496
|
execSync("bun --version", { stdio: "ignore" });
|
|
10161
10497
|
} catch {
|
|
10162
|
-
|
|
10163
|
-
|
|
10498
|
+
log2.error("bun is required but not installed.");
|
|
10499
|
+
note(
|
|
10164
10500
|
"Install bun:\n\n curl -fsSL https://bun.sh/install | bash\n\nThen re-run: dndev init",
|
|
10165
10501
|
"Missing dependency"
|
|
10166
10502
|
);
|
|
10167
10503
|
process.exit(1);
|
|
10168
10504
|
}
|
|
10169
10505
|
if (SHOW_WIP2) {
|
|
10170
|
-
|
|
10506
|
+
note("WIP mode enabled - showing experimental features", "\u{1F527} Debug");
|
|
10171
10507
|
}
|
|
10172
10508
|
const executionMode = detectExecutionMode2();
|
|
10173
10509
|
const monorepoRoot = process.cwd();
|
|
@@ -10176,7 +10512,7 @@ async function main(_options, name) {
|
|
|
10176
10512
|
while (!projectName) {
|
|
10177
10513
|
const projectNameInput = await askForInput("Project name", "my-project");
|
|
10178
10514
|
if (!isValidFileName(projectNameInput)) {
|
|
10179
|
-
|
|
10515
|
+
log2.warn(
|
|
10180
10516
|
`Invalid project name "${projectNameInput}". Use only letters, numbers, dashes (-), and underscores (_).`
|
|
10181
10517
|
);
|
|
10182
10518
|
continue;
|
|
@@ -10197,7 +10533,7 @@ async function main(_options, name) {
|
|
|
10197
10533
|
1
|
|
10198
10534
|
);
|
|
10199
10535
|
if (action === "cancel") {
|
|
10200
|
-
|
|
10536
|
+
outro("Project creation cancelled.");
|
|
10201
10537
|
process.exit(0);
|
|
10202
10538
|
}
|
|
10203
10539
|
if (action === "replace") {
|
|
@@ -10206,17 +10542,17 @@ async function main(_options, name) {
|
|
|
10206
10542
|
false
|
|
10207
10543
|
);
|
|
10208
10544
|
if (!confirmDelete) {
|
|
10209
|
-
|
|
10545
|
+
outro("Project creation cancelled.");
|
|
10210
10546
|
process.exit(0);
|
|
10211
10547
|
}
|
|
10212
|
-
const s2 =
|
|
10548
|
+
const s2 = spinner();
|
|
10213
10549
|
s2.start("Removing existing project...");
|
|
10214
10550
|
await remove(projectDirNormalized);
|
|
10215
10551
|
s2.stop("Removed existing project");
|
|
10216
10552
|
}
|
|
10217
10553
|
if (action === "merge") {
|
|
10218
|
-
|
|
10219
|
-
|
|
10554
|
+
log2.warn("Root file merging is at your own risk!");
|
|
10555
|
+
note(
|
|
10220
10556
|
"Make sure you have a backup or git commit\nYou can rollback if something breaks\nWe will merge: package.json, tsconfig.json, turbo.json\nWe will skip: bunfig.toml, firebase.json, SETUP.md",
|
|
10221
10557
|
"\u26A0\uFE0F Warning"
|
|
10222
10558
|
);
|
|
@@ -10225,11 +10561,11 @@ async function main(_options, name) {
|
|
|
10225
10561
|
false
|
|
10226
10562
|
);
|
|
10227
10563
|
if (!confirmMerge) {
|
|
10228
|
-
|
|
10564
|
+
outro("Merge cancelled. Root files will not be modified.");
|
|
10229
10565
|
process.exit(0);
|
|
10230
10566
|
}
|
|
10231
10567
|
isMergeMode = true;
|
|
10232
|
-
|
|
10568
|
+
note("Merge mode: Merging root files, creating new apps", "\u{1F527} Mode");
|
|
10233
10569
|
}
|
|
10234
10570
|
}
|
|
10235
10571
|
let appNames = [];
|
|
@@ -10246,21 +10582,21 @@ async function main(_options, name) {
|
|
|
10246
10582
|
const trimmedName = appNameInput.trim();
|
|
10247
10583
|
isFirstApp = false;
|
|
10248
10584
|
if (appNames.includes(trimmedName)) {
|
|
10249
|
-
|
|
10585
|
+
log2.warn(`'${trimmedName}' already exists. Choose a different name.`);
|
|
10250
10586
|
continue;
|
|
10251
10587
|
}
|
|
10252
10588
|
if (isReservedAppName(trimmedName)) {
|
|
10253
|
-
|
|
10589
|
+
log2.warn(`'${trimmedName}' is reserved for framework demos.`);
|
|
10254
10590
|
continue;
|
|
10255
10591
|
}
|
|
10256
10592
|
if (!isValidFileName(trimmedName)) {
|
|
10257
|
-
|
|
10593
|
+
log2.warn(
|
|
10258
10594
|
`Invalid app name "${trimmedName}". Use only letters, numbers, dashes (-), and underscores (_).`
|
|
10259
10595
|
);
|
|
10260
10596
|
continue;
|
|
10261
10597
|
}
|
|
10262
10598
|
appNames.push(trimmedName);
|
|
10263
|
-
|
|
10599
|
+
note(`Configuring "${trimmedName}"...`, "\u2699\uFE0F");
|
|
10264
10600
|
const config = await collectAppConfig(trimmedName);
|
|
10265
10601
|
appConfigs[trimmedName] = config;
|
|
10266
10602
|
if (config.backend !== "none" || config.functions !== "none")
|
|
@@ -10276,8 +10612,8 @@ async function main(_options, name) {
|
|
|
10276
10612
|
const existingAppDirs = [];
|
|
10277
10613
|
if (pathExists(appsDir)) {
|
|
10278
10614
|
try {
|
|
10279
|
-
const entries =
|
|
10280
|
-
(
|
|
10615
|
+
const entries = readdirSync3(appsDir, { withFileTypes: true }).sort(
|
|
10616
|
+
(a2, b) => a2.name.localeCompare(b.name)
|
|
10281
10617
|
);
|
|
10282
10618
|
for (const entry of entries) {
|
|
10283
10619
|
if (entry.isDirectory()) {
|
|
@@ -10306,36 +10642,36 @@ async function main(_options, name) {
|
|
|
10306
10642
|
);
|
|
10307
10643
|
if (replaceAction === "replace") {
|
|
10308
10644
|
appsToCreate.push(appName);
|
|
10309
|
-
const s2 =
|
|
10645
|
+
const s2 = spinner();
|
|
10310
10646
|
s2.start(`Removing existing app "${appName}"...`);
|
|
10311
10647
|
await remove(appDir);
|
|
10312
10648
|
s2.stop(`Removed existing app "${appName}"`);
|
|
10313
10649
|
} else {
|
|
10314
10650
|
appsToSkip.push(appName);
|
|
10315
|
-
|
|
10651
|
+
note(`Skipping app "${appName}" (already exists)`, "\u23ED\uFE0F Skip");
|
|
10316
10652
|
}
|
|
10317
10653
|
} else {
|
|
10318
10654
|
appsToCreate.push(appName);
|
|
10319
10655
|
}
|
|
10320
10656
|
}
|
|
10321
10657
|
if (appsToCreate.length === 0) {
|
|
10322
|
-
|
|
10658
|
+
outro("No new apps to create. All requested apps already exist.");
|
|
10323
10659
|
process.exit(0);
|
|
10324
10660
|
}
|
|
10325
10661
|
if (appsToSkip.length > 0) {
|
|
10326
|
-
|
|
10662
|
+
note(
|
|
10327
10663
|
`Skipped ${appsToSkip.length} app(s): ${appsToSkip.join(", ")}`,
|
|
10328
10664
|
"\u23ED\uFE0F Skipped"
|
|
10329
10665
|
);
|
|
10330
10666
|
}
|
|
10331
10667
|
appNames = appsToCreate;
|
|
10332
10668
|
}
|
|
10333
|
-
|
|
10669
|
+
log2.info(
|
|
10334
10670
|
`Creating project "${projectName}" with ${appNames.length} app(s): ${appNames.join(", ")}`
|
|
10335
10671
|
);
|
|
10336
10672
|
for (const appName of appNames) {
|
|
10337
10673
|
if (!appConfigs[appName]) {
|
|
10338
|
-
|
|
10674
|
+
log2.warn(`Missing config for app "${appName}", using defaults`);
|
|
10339
10675
|
appConfigs[appName] = {
|
|
10340
10676
|
template: "vite",
|
|
10341
10677
|
host: "none",
|
|
@@ -10350,7 +10686,7 @@ async function main(_options, name) {
|
|
|
10350
10686
|
}
|
|
10351
10687
|
}
|
|
10352
10688
|
const setupGithubActions = true;
|
|
10353
|
-
const s =
|
|
10689
|
+
const s = spinner();
|
|
10354
10690
|
if (!isMergeMode) {
|
|
10355
10691
|
s.start("Creating project structure...");
|
|
10356
10692
|
await ensureDir(projectDirNormalized);
|
|
@@ -10518,7 +10854,7 @@ async function main(_options, name) {
|
|
|
10518
10854
|
s.stop("Root files merged");
|
|
10519
10855
|
}
|
|
10520
10856
|
if (installDemoApp) {
|
|
10521
|
-
const sDemo =
|
|
10857
|
+
const sDemo = spinner();
|
|
10522
10858
|
sDemo.start("Copying demo app...");
|
|
10523
10859
|
const demoAppDir = joinPath(projectDirNormalized, "apps", "demo");
|
|
10524
10860
|
const demoTemplateDir = joinPath(templatesRoot, "app-demo");
|
|
@@ -10574,7 +10910,7 @@ async function main(_options, name) {
|
|
|
10574
10910
|
}
|
|
10575
10911
|
}
|
|
10576
10912
|
if (installCockpitApp) {
|
|
10577
|
-
const sCockpit =
|
|
10913
|
+
const sCockpit = spinner();
|
|
10578
10914
|
sCockpit.start("Copying cockpit app...");
|
|
10579
10915
|
const cockpitAppDir = joinPath(projectDirNormalized, "apps", "dndev");
|
|
10580
10916
|
const cockpitTemplateDir = joinPath(templatesRoot, "app-dndev");
|
|
@@ -10628,11 +10964,11 @@ async function main(_options, name) {
|
|
|
10628
10964
|
sCockpit.stop("Cockpit app copied");
|
|
10629
10965
|
}
|
|
10630
10966
|
}
|
|
10631
|
-
|
|
10967
|
+
log2.info("Creating apps...");
|
|
10632
10968
|
for (const appName of appNames) {
|
|
10633
10969
|
const appConfig = appConfigs[appName];
|
|
10634
10970
|
if (!appConfig) {
|
|
10635
|
-
|
|
10971
|
+
log2.error(`Configuration not found for app: ${appName}`);
|
|
10636
10972
|
continue;
|
|
10637
10973
|
}
|
|
10638
10974
|
await createApp(appName, appConfig, projectDirNormalized, templatesRoot);
|
|
@@ -10643,9 +10979,9 @@ async function main(_options, name) {
|
|
|
10643
10979
|
isMergeMode ? allAppNames : appNames
|
|
10644
10980
|
);
|
|
10645
10981
|
s.stop("Root package.json updated");
|
|
10646
|
-
|
|
10982
|
+
outro("\u{1F389} Project created successfully!");
|
|
10647
10983
|
const cdCommand = executionMode === "development" ? `cd ../${projectName}` : `cd ${projectName}`;
|
|
10648
|
-
|
|
10984
|
+
note(
|
|
10649
10985
|
`1. ${cdCommand}
|
|
10650
10986
|
2. bun install
|
|
10651
10987
|
3. Open the project in your IDE
|
|
@@ -10663,7 +10999,7 @@ Claude Code / Windsurf: MCP auto-connects, nothing to do
|
|
|
10663
10999
|
"\u{1F4CB} Next Steps"
|
|
10664
11000
|
);
|
|
10665
11001
|
} catch (error2) {
|
|
10666
|
-
|
|
11002
|
+
log2.error("Error creating project:", error2);
|
|
10667
11003
|
throw error2;
|
|
10668
11004
|
}
|
|
10669
11005
|
}
|