@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 __copyProps = (to, from, except, desc) => {
|
|
20
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -33,31 +42,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
42
|
mod
|
|
34
43
|
));
|
|
35
44
|
|
|
36
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
37
|
-
var
|
|
45
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
46
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
38
47
|
var init_utils = __esm({
|
|
39
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
48
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
40
49
|
init_utils2();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
51
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
52
|
+
return (input) => {
|
|
53
|
+
let surrogatePairsNr = 0;
|
|
54
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
55
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
56
|
+
surrogatePairsNr += 1;
|
|
57
|
+
}
|
|
58
|
+
return input.length - surrogatePairsNr;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
44
61
|
isFullWidth = (x) => {
|
|
45
62
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
46
63
|
};
|
|
47
|
-
|
|
48
|
-
return x
|
|
64
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
65
|
+
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;
|
|
49
66
|
};
|
|
50
67
|
}
|
|
51
68
|
});
|
|
52
69
|
|
|
53
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
54
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
70
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
71
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
55
72
|
var init_dist = __esm({
|
|
56
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
73
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
57
74
|
init_utils2();
|
|
58
75
|
init_utils();
|
|
59
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
76
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
60
77
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
78
|
+
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;
|
|
61
79
|
TAB_RE = /\t{1,1000}/y;
|
|
62
80
|
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");
|
|
63
81
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -67,14 +85,21 @@ var init_dist = __esm({
|
|
|
67
85
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
68
86
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
69
87
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
70
|
-
const ANSI_WIDTH =
|
|
88
|
+
const ANSI_WIDTH = 0;
|
|
71
89
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
72
90
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
73
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
74
91
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
75
|
-
const FULL_WIDTH_WIDTH =
|
|
92
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
76
93
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
77
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
94
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
95
|
+
const PARSE_BLOCKS = [
|
|
96
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
97
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
98
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
99
|
+
[TAB_RE, TAB_WIDTH],
|
|
100
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
101
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
102
|
+
];
|
|
78
103
|
let indexPrev = 0;
|
|
79
104
|
let index = 0;
|
|
80
105
|
let length = input.length;
|
|
@@ -94,10 +119,8 @@ var init_dist = __esm({
|
|
|
94
119
|
const codePoint = char.codePointAt(0) || 0;
|
|
95
120
|
if (isFullWidth(codePoint)) {
|
|
96
121
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
97
|
-
} else if (
|
|
122
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
98
123
|
widthExtra = WIDE_WIDTH;
|
|
99
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
100
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
101
124
|
} else {
|
|
102
125
|
widthExtra = REGULAR_WIDTH;
|
|
103
126
|
}
|
|
@@ -113,88 +136,28 @@ var init_dist = __esm({
|
|
|
113
136
|
}
|
|
114
137
|
unmatchedStart = unmatchedEnd = 0;
|
|
115
138
|
}
|
|
116
|
-
if (index >= length)
|
|
117
|
-
break;
|
|
118
|
-
LATIN_RE.lastIndex = index;
|
|
119
|
-
if (LATIN_RE.test(input)) {
|
|
120
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
121
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
122
|
-
if (width + widthExtra > truncationLimit) {
|
|
123
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
124
|
-
}
|
|
125
|
-
if (width + widthExtra > LIMIT) {
|
|
126
|
-
truncationEnabled = true;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
width += widthExtra;
|
|
130
|
-
unmatchedStart = indexPrev;
|
|
131
|
-
unmatchedEnd = index;
|
|
132
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
ANSI_RE.lastIndex = index;
|
|
136
|
-
if (ANSI_RE.test(input)) {
|
|
137
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
138
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
139
|
-
}
|
|
140
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
141
|
-
truncationEnabled = true;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
width += ANSI_WIDTH;
|
|
145
|
-
unmatchedStart = indexPrev;
|
|
146
|
-
unmatchedEnd = index;
|
|
147
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
148
|
-
continue;
|
|
139
|
+
if (index >= length) {
|
|
140
|
+
break outer;
|
|
149
141
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (TAB_RE.test(input)) {
|
|
169
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
170
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
171
|
-
if (width + widthExtra > truncationLimit) {
|
|
172
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
173
|
-
}
|
|
174
|
-
if (width + widthExtra > LIMIT) {
|
|
175
|
-
truncationEnabled = true;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
width += widthExtra;
|
|
179
|
-
unmatchedStart = indexPrev;
|
|
180
|
-
unmatchedEnd = index;
|
|
181
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
EMOJI_RE.lastIndex = index;
|
|
185
|
-
if (EMOJI_RE.test(input)) {
|
|
186
|
-
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
187
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
188
|
-
}
|
|
189
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
190
|
-
truncationEnabled = true;
|
|
191
|
-
break;
|
|
142
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
143
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
144
|
+
BLOCK_RE.lastIndex = index;
|
|
145
|
+
if (BLOCK_RE.test(input)) {
|
|
146
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
147
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
148
|
+
if (width + widthExtra > truncationLimit) {
|
|
149
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
150
|
+
}
|
|
151
|
+
if (width + widthExtra > LIMIT) {
|
|
152
|
+
truncationEnabled = true;
|
|
153
|
+
break outer;
|
|
154
|
+
}
|
|
155
|
+
width += widthExtra;
|
|
156
|
+
unmatchedStart = indexPrev;
|
|
157
|
+
unmatchedEnd = index;
|
|
158
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
159
|
+
continue outer;
|
|
192
160
|
}
|
|
193
|
-
width += EMOJI_WIDTH;
|
|
194
|
-
unmatchedStart = indexPrev;
|
|
195
|
-
unmatchedEnd = index;
|
|
196
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
197
|
-
continue;
|
|
198
161
|
}
|
|
199
162
|
index += 1;
|
|
200
163
|
}
|
|
@@ -209,10 +172,10 @@ var init_dist = __esm({
|
|
|
209
172
|
}
|
|
210
173
|
});
|
|
211
174
|
|
|
212
|
-
// node_modules/.bun/fast-string-width@
|
|
175
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
213
176
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
214
177
|
var init_dist2 = __esm({
|
|
215
|
-
"node_modules/.bun/fast-string-width@
|
|
178
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
216
179
|
init_utils2();
|
|
217
180
|
init_dist();
|
|
218
181
|
NO_TRUNCATION2 = {
|
|
@@ -227,13 +190,13 @@ var init_dist2 = __esm({
|
|
|
227
190
|
}
|
|
228
191
|
});
|
|
229
192
|
|
|
230
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
193
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
231
194
|
function wrapAnsi(string, columns, options) {
|
|
232
195
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
233
196
|
}
|
|
234
197
|
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;
|
|
235
198
|
var init_main = __esm({
|
|
236
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
199
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
237
200
|
init_utils2();
|
|
238
201
|
init_dist2();
|
|
239
202
|
ESC = "\x1B";
|
|
@@ -397,16 +360,19 @@ var init_main = __esm({
|
|
|
397
360
|
}
|
|
398
361
|
const preString = rows.join("\n");
|
|
399
362
|
let inSurrogate = false;
|
|
400
|
-
for (let
|
|
401
|
-
const character = preString[
|
|
363
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
364
|
+
const character = preString[i2];
|
|
402
365
|
returnValue += character;
|
|
403
366
|
if (!inSurrogate) {
|
|
404
367
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
368
|
+
if (inSurrogate) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
405
371
|
} else {
|
|
406
|
-
|
|
372
|
+
inSurrogate = false;
|
|
407
373
|
}
|
|
408
374
|
if (character === ESC || character === CSI) {
|
|
409
|
-
GROUP_REGEX.lastIndex =
|
|
375
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
410
376
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
411
377
|
const groups = groupsResult?.groups;
|
|
412
378
|
if (groups?.code !== void 0) {
|
|
@@ -416,7 +382,7 @@ var init_main = __esm({
|
|
|
416
382
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
417
383
|
}
|
|
418
384
|
}
|
|
419
|
-
if (preString[
|
|
385
|
+
if (preString[i2 + 1] === "\n") {
|
|
420
386
|
if (escapeUrl) {
|
|
421
387
|
returnValue += wrapAnsiHyperlink("");
|
|
422
388
|
}
|
|
@@ -447,7 +413,7 @@ var require_src = __commonJS({
|
|
|
447
413
|
var ESC2 = "\x1B";
|
|
448
414
|
var CSI2 = `${ESC2}[`;
|
|
449
415
|
var beep = "\x07";
|
|
450
|
-
var
|
|
416
|
+
var cursor3 = {
|
|
451
417
|
to(x, y2) {
|
|
452
418
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
453
419
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -476,7 +442,7 @@ var require_src = __commonJS({
|
|
|
476
442
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
477
443
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
478
444
|
};
|
|
479
|
-
var
|
|
445
|
+
var erase3 = {
|
|
480
446
|
screen: `${CSI2}2J`,
|
|
481
447
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
482
448
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -485,89 +451,169 @@ var require_src = __commonJS({
|
|
|
485
451
|
lineStart: `${CSI2}1K`,
|
|
486
452
|
lines(count) {
|
|
487
453
|
let clear = "";
|
|
488
|
-
for (let
|
|
489
|
-
clear += this.line + (
|
|
454
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
455
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
490
456
|
if (count)
|
|
491
|
-
clear +=
|
|
457
|
+
clear += cursor3.left;
|
|
492
458
|
return clear;
|
|
493
459
|
}
|
|
494
460
|
};
|
|
495
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
461
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
496
462
|
}
|
|
497
463
|
});
|
|
498
464
|
|
|
499
|
-
// node_modules/.bun/@clack+core@1.
|
|
500
|
-
import { styleText
|
|
501
|
-
import { stdout
|
|
502
|
-
import * as
|
|
503
|
-
import
|
|
504
|
-
import { ReadStream
|
|
505
|
-
function
|
|
506
|
-
if (!
|
|
507
|
-
|
|
508
|
-
|
|
465
|
+
// node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
466
|
+
import { styleText } from "node:util";
|
|
467
|
+
import { stdout, stdin } from "node:process";
|
|
468
|
+
import * as l from "node:readline";
|
|
469
|
+
import l__default from "node:readline";
|
|
470
|
+
import { ReadStream } from "node:tty";
|
|
471
|
+
function findCursor(s, o, l2) {
|
|
472
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
473
|
+
return s;
|
|
474
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
475
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
509
476
|
}
|
|
510
|
-
function
|
|
511
|
-
if (
|
|
512
|
-
|
|
477
|
+
function isAccessible(n3) {
|
|
478
|
+
if (n3 !== void 0) return n3;
|
|
479
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
480
|
+
const e = process.env.ACCESSIBLE;
|
|
481
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
482
|
+
}
|
|
483
|
+
function isActionKey(n3, e) {
|
|
484
|
+
if (typeof n3 == "string")
|
|
485
|
+
return settings.aliases.get(n3) === e;
|
|
486
|
+
for (const s of n3)
|
|
487
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
488
|
+
return true;
|
|
513
489
|
return false;
|
|
514
490
|
}
|
|
515
|
-
function
|
|
516
|
-
if (
|
|
517
|
-
const e =
|
|
518
|
-
`),
|
|
519
|
-
`),
|
|
520
|
-
for (let
|
|
521
|
-
|
|
491
|
+
function diffLines(i2, s) {
|
|
492
|
+
if (i2 === s) return;
|
|
493
|
+
const e = i2.split(`
|
|
494
|
+
`), t2 = s.split(`
|
|
495
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
496
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
497
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
498
|
+
return {
|
|
499
|
+
lines: f,
|
|
500
|
+
numLinesBefore: e.length,
|
|
501
|
+
numLinesAfter: t2.length,
|
|
502
|
+
numLines: r2
|
|
503
|
+
};
|
|
522
504
|
}
|
|
523
|
-
function
|
|
524
|
-
return
|
|
505
|
+
function isCancel(e) {
|
|
506
|
+
return e === CANCEL_SYMBOL;
|
|
525
507
|
}
|
|
526
|
-
function
|
|
527
|
-
const
|
|
528
|
-
|
|
508
|
+
function setRawMode(e, r2) {
|
|
509
|
+
const o = e;
|
|
510
|
+
o.isTTY && o.setRawMode(r2);
|
|
529
511
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
512
|
+
function block({
|
|
513
|
+
input: e = stdin,
|
|
514
|
+
output: r2 = stdout,
|
|
515
|
+
overwrite: o = true,
|
|
516
|
+
hideCursor: n3 = true
|
|
517
|
+
} = {}) {
|
|
518
|
+
const s = l.createInterface({
|
|
519
|
+
input: e,
|
|
520
|
+
output: r2,
|
|
521
|
+
prompt: "",
|
|
522
|
+
tabSize: 1
|
|
523
|
+
});
|
|
524
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
525
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
526
|
+
const c2 = String(f);
|
|
527
|
+
if (isActionKey([c2, a2, w], "cancel")) {
|
|
528
|
+
n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
537
529
|
return;
|
|
538
530
|
}
|
|
539
|
-
if (!
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
531
|
+
if (!o) return;
|
|
532
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
533
|
+
l.moveCursor(r2, i2, m, () => {
|
|
534
|
+
l.clearLine(r2, 1, () => {
|
|
535
|
+
e.once("keypress", t2);
|
|
544
536
|
});
|
|
545
537
|
});
|
|
546
538
|
};
|
|
547
|
-
return
|
|
548
|
-
|
|
539
|
+
return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
540
|
+
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();
|
|
549
541
|
};
|
|
550
542
|
}
|
|
551
|
-
function
|
|
552
|
-
const
|
|
553
|
-
return wrapAnsi(
|
|
554
|
-
|
|
543
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
544
|
+
const f = getColumns(e ?? stdout);
|
|
545
|
+
return wrapAnsi(r2, f - o.length, {
|
|
546
|
+
hard: true,
|
|
547
|
+
trim: false
|
|
548
|
+
}).split(`
|
|
549
|
+
`).map((c2, i2, m) => {
|
|
550
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
551
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
552
|
+
}).join(`
|
|
555
553
|
`);
|
|
556
554
|
}
|
|
557
|
-
|
|
555
|
+
function runValidation(e, a2) {
|
|
556
|
+
if ("~standard" in e) {
|
|
557
|
+
const n3 = e["~standard"].validate(a2);
|
|
558
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
559
|
+
}
|
|
560
|
+
return e(a2);
|
|
561
|
+
}
|
|
562
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1;
|
|
558
563
|
var init_dist3 = __esm({
|
|
559
|
-
"node_modules/.bun/@clack+core@1.
|
|
564
|
+
"node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
|
|
560
565
|
init_utils2();
|
|
561
566
|
init_main();
|
|
562
567
|
import_sisteransi = __toESM(require_src(), 1);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
568
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
569
|
+
t = [
|
|
570
|
+
"January",
|
|
571
|
+
"February",
|
|
572
|
+
"March",
|
|
573
|
+
"April",
|
|
574
|
+
"May",
|
|
575
|
+
"June",
|
|
576
|
+
"July",
|
|
577
|
+
"August",
|
|
578
|
+
"September",
|
|
579
|
+
"October",
|
|
580
|
+
"November",
|
|
581
|
+
"December"
|
|
582
|
+
];
|
|
583
|
+
settings = {
|
|
584
|
+
actions: new Set(a$1),
|
|
585
|
+
aliases: /* @__PURE__ */ new Map([
|
|
586
|
+
// vim support
|
|
587
|
+
["k", "up"],
|
|
588
|
+
["j", "down"],
|
|
589
|
+
["h", "left"],
|
|
590
|
+
["l", "right"],
|
|
591
|
+
["", "cancel"],
|
|
592
|
+
// opinionated defaults!
|
|
593
|
+
["escape", "cancel"]
|
|
594
|
+
]),
|
|
595
|
+
messages: {
|
|
596
|
+
cancel: "Canceled",
|
|
597
|
+
error: "Something went wrong"
|
|
598
|
+
},
|
|
599
|
+
withGuide: true,
|
|
600
|
+
accessible: void 0,
|
|
601
|
+
date: {
|
|
602
|
+
monthNames: [...t],
|
|
603
|
+
messages: {
|
|
604
|
+
required: "Please enter a valid date",
|
|
605
|
+
invalidMonth: "There are only 12 months in a year",
|
|
606
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
607
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
608
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
R = globalThis.process.platform.startsWith("win");
|
|
613
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
614
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
615
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
616
|
+
y = class {
|
|
571
617
|
input;
|
|
572
618
|
output;
|
|
573
619
|
_abortSignal;
|
|
@@ -582,46 +628,92 @@ var init_dist3 = __esm({
|
|
|
582
628
|
error = "";
|
|
583
629
|
value;
|
|
584
630
|
userInput = "";
|
|
631
|
+
/**
|
|
632
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
633
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
634
|
+
* and the `ACCESSIBLE` env var.
|
|
635
|
+
*/
|
|
636
|
+
get accessible() {
|
|
637
|
+
return isAccessible(this.opts.accessible);
|
|
638
|
+
}
|
|
585
639
|
constructor(t2, e = true) {
|
|
586
|
-
const { input:
|
|
587
|
-
this.opts =
|
|
640
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
641
|
+
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;
|
|
588
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Unsubscribe all listeners
|
|
645
|
+
*/
|
|
589
646
|
unsubscribe() {
|
|
590
647
|
this._subscribers.clear();
|
|
591
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Set a subscriber with opts
|
|
651
|
+
* @param event - The event name
|
|
652
|
+
*/
|
|
592
653
|
setSubscriber(t2, e) {
|
|
593
|
-
const
|
|
594
|
-
|
|
654
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
655
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
595
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Subscribe to an event
|
|
659
|
+
* @param event - The event name
|
|
660
|
+
* @param cb - The callback
|
|
661
|
+
*/
|
|
596
662
|
on(t2, e) {
|
|
597
663
|
this.setSubscriber(t2, { cb: e });
|
|
598
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* Subscribe to an event once
|
|
667
|
+
* @param event - The event name
|
|
668
|
+
* @param cb - The callback
|
|
669
|
+
*/
|
|
599
670
|
once(t2, e) {
|
|
600
671
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
601
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Emit an event with data
|
|
675
|
+
* @param event - The event name
|
|
676
|
+
* @param data - The data to pass to the callback
|
|
677
|
+
*/
|
|
602
678
|
emit(t2, ...e) {
|
|
603
|
-
const
|
|
604
|
-
for (const
|
|
605
|
-
|
|
679
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
680
|
+
for (const r2 of i2)
|
|
681
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
682
|
+
for (const r2 of s)
|
|
683
|
+
r2();
|
|
606
684
|
}
|
|
607
685
|
prompt() {
|
|
608
686
|
return new Promise((t2) => {
|
|
609
687
|
if (this._abortSignal) {
|
|
610
|
-
if (this._abortSignal.aborted)
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
688
|
+
if (this._abortSignal.aborted)
|
|
689
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
690
|
+
this._abortSignal.addEventListener(
|
|
691
|
+
"abort",
|
|
692
|
+
() => {
|
|
693
|
+
this.state = "cancel", this.close();
|
|
694
|
+
},
|
|
695
|
+
{ once: true }
|
|
696
|
+
);
|
|
614
697
|
}
|
|
615
|
-
this.rl =
|
|
616
|
-
|
|
698
|
+
this.rl = l__default.createInterface({
|
|
699
|
+
input: this.input,
|
|
700
|
+
tabSize: 2,
|
|
701
|
+
prompt: "",
|
|
702
|
+
escapeCodeTimeout: 50,
|
|
703
|
+
terminal: true
|
|
704
|
+
}), 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", () => {
|
|
705
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
617
706
|
}), this.once("cancel", () => {
|
|
618
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
707
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
619
708
|
});
|
|
620
709
|
});
|
|
621
710
|
}
|
|
622
711
|
_isActionKey(t2, e) {
|
|
623
712
|
return t2 === " ";
|
|
624
713
|
}
|
|
714
|
+
_shouldSubmit(t2, e) {
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
625
717
|
_setValue(t2) {
|
|
626
718
|
this.value = t2, this.emit("value", this.value);
|
|
627
719
|
}
|
|
@@ -631,19 +723,22 @@ var init_dist3 = __esm({
|
|
|
631
723
|
_clearUserInput() {
|
|
632
724
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
633
725
|
}
|
|
634
|
-
onKeypress(t2, e) {
|
|
635
|
-
if (this.
|
|
636
|
-
if (this.
|
|
637
|
-
|
|
638
|
-
|
|
726
|
+
async onKeypress(t2, e) {
|
|
727
|
+
if (this.state !== "validating") {
|
|
728
|
+
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)) {
|
|
729
|
+
if (this.opts.validate) {
|
|
730
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
731
|
+
let s;
|
|
732
|
+
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));
|
|
733
|
+
}
|
|
734
|
+
this.state !== "error" && (this.state = "submit");
|
|
639
735
|
}
|
|
640
|
-
this.state
|
|
736
|
+
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();
|
|
641
737
|
}
|
|
642
|
-
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();
|
|
643
738
|
}
|
|
644
739
|
close() {
|
|
645
740
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
646
|
-
`),
|
|
741
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
647
742
|
}
|
|
648
743
|
restoreCursor() {
|
|
649
744
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -651,34 +746,39 @@ var init_dist3 = __esm({
|
|
|
651
746
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
652
747
|
}
|
|
653
748
|
render() {
|
|
654
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
749
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
750
|
+
hard: true,
|
|
751
|
+
trim: false
|
|
752
|
+
});
|
|
655
753
|
if (t2 !== this._prevFrame) {
|
|
656
|
-
if (this.state === "initial")
|
|
754
|
+
if (this.state === "initial")
|
|
755
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
657
756
|
else {
|
|
658
|
-
const e =
|
|
757
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
659
758
|
if (this.restoreCursor(), e) {
|
|
660
|
-
const
|
|
661
|
-
let
|
|
662
|
-
if (
|
|
759
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
760
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
761
|
+
if (n3 === void 0) {
|
|
663
762
|
this._prevFrame = t2;
|
|
664
763
|
return;
|
|
665
764
|
}
|
|
666
765
|
if (e.lines.length === 1) {
|
|
667
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
668
|
-
const
|
|
766
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
767
|
+
const o = t2.split(`
|
|
669
768
|
`);
|
|
670
|
-
this.output.write(
|
|
769
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
671
770
|
return;
|
|
672
771
|
} else if (e.lines.length > 1) {
|
|
673
|
-
if (
|
|
772
|
+
if (s < r2)
|
|
773
|
+
n3 = s;
|
|
674
774
|
else {
|
|
675
|
-
const
|
|
676
|
-
|
|
775
|
+
const h2 = n3 - r2;
|
|
776
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
677
777
|
}
|
|
678
778
|
this.output.write(import_sisteransi.erase.down());
|
|
679
|
-
const
|
|
680
|
-
`).slice(
|
|
681
|
-
this.output.write(
|
|
779
|
+
const f = t2.split(`
|
|
780
|
+
`).slice(n3);
|
|
781
|
+
this.output.write(f.join(`
|
|
682
782
|
`)), this._prevFrame = t2;
|
|
683
783
|
return;
|
|
684
784
|
}
|
|
@@ -689,7 +789,7 @@ var init_dist3 = __esm({
|
|
|
689
789
|
}
|
|
690
790
|
}
|
|
691
791
|
};
|
|
692
|
-
|
|
792
|
+
r = class extends y {
|
|
693
793
|
get cursor() {
|
|
694
794
|
return this.value ? 0 : 1;
|
|
695
795
|
}
|
|
@@ -699,34 +799,35 @@ var init_dist3 = __esm({
|
|
|
699
799
|
constructor(t2) {
|
|
700
800
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
701
801
|
this.value = this._value;
|
|
702
|
-
}), this.on("confirm", (
|
|
703
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
802
|
+
}), this.on("confirm", (i2) => {
|
|
803
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
704
804
|
}), this.on("cursor", () => {
|
|
705
805
|
this.value = !this.value;
|
|
706
806
|
});
|
|
707
807
|
}
|
|
708
808
|
};
|
|
709
|
-
|
|
809
|
+
n$1 = class n extends y {
|
|
710
810
|
options;
|
|
711
811
|
cursor = 0;
|
|
712
812
|
get _selectedValue() {
|
|
713
813
|
return this.options[this.cursor];
|
|
714
814
|
}
|
|
715
815
|
changeValue() {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
816
|
+
const e = this._selectedValue;
|
|
817
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
818
|
+
}
|
|
819
|
+
constructor(e) {
|
|
820
|
+
super(e, false), this.options = e.options;
|
|
821
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
822
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
823
|
+
switch (s) {
|
|
723
824
|
case "left":
|
|
724
825
|
case "up":
|
|
725
|
-
this.cursor =
|
|
826
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
726
827
|
break;
|
|
727
828
|
case "down":
|
|
728
829
|
case "right":
|
|
729
|
-
this.cursor =
|
|
830
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
730
831
|
break;
|
|
731
832
|
}
|
|
732
833
|
this.changeValue();
|
|
@@ -736,299 +837,456 @@ var init_dist3 = __esm({
|
|
|
736
837
|
}
|
|
737
838
|
});
|
|
738
839
|
|
|
739
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
740
|
-
import { styleText as
|
|
741
|
-
import
|
|
742
|
-
import { existsSync
|
|
743
|
-
import { dirname
|
|
744
|
-
function
|
|
745
|
-
|
|
840
|
+
// node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
841
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
842
|
+
import process$1 from "node:process";
|
|
843
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
844
|
+
import { dirname, join } from "node:path";
|
|
845
|
+
function isUnicodeSupported() {
|
|
846
|
+
if (process$1.platform !== "win32") {
|
|
847
|
+
return process$1.env.TERM !== "linux";
|
|
848
|
+
}
|
|
849
|
+
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";
|
|
850
|
+
}
|
|
851
|
+
function formatInstructionFooter(o, e) {
|
|
852
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
853
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
746
854
|
}
|
|
747
|
-
var import_sisteransi2,
|
|
855
|
+
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;
|
|
748
856
|
var init_dist4 = __esm({
|
|
749
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
857
|
+
"node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
750
858
|
init_utils2();
|
|
751
859
|
init_dist3();
|
|
752
860
|
init_dist3();
|
|
753
861
|
init_main();
|
|
754
862
|
init_dist2();
|
|
755
863
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
switch (
|
|
864
|
+
unicode = isUnicodeSupported();
|
|
865
|
+
isCI = () => process.env.CI === "true";
|
|
866
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
867
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
868
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
869
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
870
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
871
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
872
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
873
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
874
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
875
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
876
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
877
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
878
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
879
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
880
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
881
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
882
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
883
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
884
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
885
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
886
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
887
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
888
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
889
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
890
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
891
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
892
|
+
symbol = (o) => {
|
|
893
|
+
switch (o) {
|
|
786
894
|
case "initial":
|
|
787
895
|
case "active":
|
|
788
|
-
return
|
|
896
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
789
897
|
case "cancel":
|
|
790
|
-
return
|
|
898
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
791
899
|
case "error":
|
|
792
|
-
return
|
|
900
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
793
901
|
case "submit":
|
|
794
|
-
return
|
|
902
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
903
|
+
case "validating":
|
|
904
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
795
905
|
}
|
|
796
906
|
};
|
|
797
|
-
|
|
798
|
-
switch (
|
|
907
|
+
symbolBar = (o) => {
|
|
908
|
+
switch (o) {
|
|
799
909
|
case "initial":
|
|
800
910
|
case "active":
|
|
801
|
-
return
|
|
911
|
+
return styleText2("cyan", S_BAR);
|
|
802
912
|
case "cancel":
|
|
803
|
-
return
|
|
913
|
+
return styleText2("red", S_BAR);
|
|
804
914
|
case "error":
|
|
805
|
-
return
|
|
915
|
+
return styleText2("yellow", S_BAR);
|
|
806
916
|
case "submit":
|
|
807
|
-
return
|
|
808
|
-
}
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
let
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
917
|
+
return styleText2("green", S_BAR);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
I = (l2, e, w, p, b, C2 = false) => {
|
|
921
|
+
let r2 = e, O = 0;
|
|
922
|
+
if (C2)
|
|
923
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
924
|
+
const m = l2[i2];
|
|
925
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
926
|
+
}
|
|
927
|
+
else
|
|
928
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
929
|
+
const m = l2[i2];
|
|
930
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
931
|
+
}
|
|
932
|
+
return { lineCount: r2, removals: O };
|
|
933
|
+
};
|
|
934
|
+
limitOptions = ({
|
|
935
|
+
cursor: l2,
|
|
936
|
+
options: e,
|
|
937
|
+
style: w,
|
|
938
|
+
output: p = process.stdout,
|
|
939
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
940
|
+
columnPadding: C2 = 0,
|
|
941
|
+
rowPadding: r2 = 4
|
|
942
|
+
}) => {
|
|
943
|
+
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);
|
|
824
944
|
let f = 0;
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
945
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
946
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
947
|
+
0
|
|
948
|
+
));
|
|
949
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
950
|
+
const W2 = Math.min(
|
|
951
|
+
f + a2,
|
|
952
|
+
e.length
|
|
953
|
+
), s = [];
|
|
954
|
+
let g = 0;
|
|
955
|
+
d && g++, c2 && g++;
|
|
956
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
|
|
957
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
958
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
959
|
+
hard: true,
|
|
960
|
+
trim: false
|
|
961
|
+
}).split(`
|
|
829
962
|
`);
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
if (
|
|
833
|
-
let
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
963
|
+
s.push(h2), g += h2.length;
|
|
964
|
+
}
|
|
965
|
+
if (g > v) {
|
|
966
|
+
let t2 = 0, n3 = 0, o = g;
|
|
967
|
+
const h2 = l2 - T;
|
|
968
|
+
let u3 = v;
|
|
969
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
970
|
+
s,
|
|
971
|
+
o,
|
|
972
|
+
h2 + 1,
|
|
973
|
+
s.length,
|
|
974
|
+
u3,
|
|
975
|
+
true
|
|
976
|
+
);
|
|
977
|
+
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));
|
|
978
|
+
}
|
|
979
|
+
const x = [];
|
|
980
|
+
d && x.push(M);
|
|
981
|
+
for (const t2 of s)
|
|
982
|
+
for (const n3 of t2)
|
|
983
|
+
x.push(n3);
|
|
984
|
+
return c2 && x.push(M), x;
|
|
985
|
+
};
|
|
986
|
+
confirm = (e) => {
|
|
987
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
988
|
+
return new r({
|
|
989
|
+
active: a2,
|
|
990
|
+
inactive: o,
|
|
991
|
+
signal: e.signal,
|
|
992
|
+
input: e.input,
|
|
993
|
+
output: e.output,
|
|
994
|
+
initialValue: e.initialValue ?? true,
|
|
995
|
+
render() {
|
|
996
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
997
|
+
e.output,
|
|
998
|
+
e.message,
|
|
999
|
+
l2,
|
|
1000
|
+
u3
|
|
1001
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1002
|
+
` : ""}${f}
|
|
1003
|
+
`, c2 = this.value ? a2 : o;
|
|
1004
|
+
switch (this.state) {
|
|
1005
|
+
case "submit": {
|
|
1006
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1007
|
+
return `${s}${r2}${styleText2("dim", c2)}`;
|
|
1008
|
+
}
|
|
1009
|
+
case "cancel": {
|
|
1010
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1011
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
|
|
1012
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1013
|
+
}
|
|
1014
|
+
default: {
|
|
1015
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1016
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1017
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1018
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1019
|
+
${g}
|
|
864
1020
|
`;
|
|
1021
|
+
}
|
|
865
1022
|
}
|
|
866
1023
|
}
|
|
867
|
-
}
|
|
1024
|
+
}).prompt();
|
|
868
1025
|
};
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1026
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
1027
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1028
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1029
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1030
|
+
];
|
|
1031
|
+
log = {
|
|
1032
|
+
message: (s = [], {
|
|
1033
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1034
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1035
|
+
output: m = process.stdout,
|
|
1036
|
+
spacing: l2 = 1,
|
|
1037
|
+
withGuide: c2
|
|
1038
|
+
} = {}) => {
|
|
1039
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1040
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1041
|
+
t2.push(f);
|
|
1042
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
873
1043
|
`);
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1044
|
+
if (g.length > 0) {
|
|
1045
|
+
const [i2, ...y2] = g;
|
|
1046
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1047
|
+
for (const p of y2)
|
|
1048
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1049
|
+
}
|
|
1050
|
+
m.write(`${t2.join(`
|
|
880
1051
|
`)}
|
|
881
1052
|
`);
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1053
|
+
},
|
|
1054
|
+
info: (s, e) => {
|
|
1055
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1056
|
+
},
|
|
1057
|
+
success: (s, e) => {
|
|
1058
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1059
|
+
},
|
|
1060
|
+
step: (s, e) => {
|
|
1061
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1062
|
+
},
|
|
1063
|
+
warn: (s, e) => {
|
|
1064
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1065
|
+
},
|
|
1066
|
+
/** alias for `log.warn()`. */
|
|
1067
|
+
warning: (s, e) => {
|
|
1068
|
+
log.warn(s, e);
|
|
1069
|
+
},
|
|
1070
|
+
error: (s, e) => {
|
|
1071
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
cancel = (o = "", t2) => {
|
|
1075
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1076
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
898
1077
|
|
|
899
1078
|
`);
|
|
900
1079
|
};
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
|
|
1080
|
+
intro = (o = "", t2) => {
|
|
1081
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1082
|
+
i2.write(`${e}${o}
|
|
904
1083
|
`);
|
|
905
1084
|
};
|
|
906
|
-
|
|
907
|
-
const
|
|
908
|
-
${
|
|
909
|
-
|
|
1085
|
+
outro = (o = "", t2) => {
|
|
1086
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1087
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1088
|
+
i2.write(`${e}${o}
|
|
910
1089
|
|
|
911
1090
|
`);
|
|
912
1091
|
};
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1092
|
+
W$1 = (o) => o;
|
|
1093
|
+
C = (o, e, s) => {
|
|
1094
|
+
const a2 = {
|
|
1095
|
+
hard: true,
|
|
1096
|
+
trim: false
|
|
1097
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1098
|
+
`), 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);
|
|
1099
|
+
return wrapAnsi(o, g, a2);
|
|
1100
|
+
};
|
|
1101
|
+
note = (o = "", e = "", s) => {
|
|
1102
|
+
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(`
|
|
1103
|
+
`).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1104
|
+
g.reduce((m, F) => {
|
|
1105
|
+
const O = dist_default2(F);
|
|
1106
|
+
return O > m ? O : m;
|
|
1107
|
+
}, 0),
|
|
1108
|
+
n3
|
|
1109
|
+
) + 2, h2 = g.map(
|
|
1110
|
+
(m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
|
|
1111
|
+
).join(`
|
|
1112
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1113
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1114
|
+
a2.write(
|
|
1115
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1116
|
+
"gray",
|
|
1117
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1118
|
+
)}
|
|
1119
|
+
${h2}
|
|
1120
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1121
|
+
`
|
|
1122
|
+
);
|
|
931
1123
|
};
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1124
|
+
W = (l2) => styleText2("magenta", l2);
|
|
1125
|
+
spinner = ({
|
|
1126
|
+
indicator: l2 = "dots",
|
|
1127
|
+
onCancel: h2,
|
|
1128
|
+
output: n3 = process.stdout,
|
|
1129
|
+
cancelMessage: G,
|
|
1130
|
+
errorMessage: O,
|
|
1131
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1132
|
+
delay: F = unicode ? 80 : 120,
|
|
1133
|
+
signal: m,
|
|
1134
|
+
...I2
|
|
1135
|
+
} = {}) => {
|
|
1136
|
+
const u3 = isCI();
|
|
1137
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1138
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1139
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1140
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1141
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1142
|
+
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);
|
|
1143
|
+
}, H = () => {
|
|
1144
|
+
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);
|
|
1145
|
+
}, y2 = () => {
|
|
1146
|
+
if (p === void 0) return;
|
|
1147
|
+
u3 && n3.write(`
|
|
946
1148
|
`);
|
|
947
|
-
const
|
|
1149
|
+
const r2 = wrapAnsi(p, x, {
|
|
1150
|
+
hard: true,
|
|
1151
|
+
trim: false
|
|
1152
|
+
}).split(`
|
|
948
1153
|
`);
|
|
949
|
-
|
|
950
|
-
},
|
|
951
|
-
const
|
|
952
|
-
return
|
|
953
|
-
},
|
|
954
|
-
|
|
1154
|
+
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());
|
|
1155
|
+
}, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1156
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1157
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1158
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1159
|
+
d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
955
1160
|
`);
|
|
956
|
-
let
|
|
957
|
-
|
|
958
|
-
if (
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1161
|
+
let r2 = 0, t2 = 0;
|
|
1162
|
+
A(), T = setInterval(() => {
|
|
1163
|
+
if (u3 && s === p)
|
|
1164
|
+
return;
|
|
1165
|
+
y2(), p = s;
|
|
1166
|
+
const o = k(E[r2]);
|
|
1167
|
+
let v;
|
|
1168
|
+
if (u3)
|
|
1169
|
+
v = `${o} ${s}...`;
|
|
1170
|
+
else if (l2 === "timer")
|
|
1171
|
+
v = `${o} ${s} ${_(w)}`;
|
|
964
1172
|
else {
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1173
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1174
|
+
v = `${o} ${s}${B}`;
|
|
1175
|
+
}
|
|
1176
|
+
const j = wrapAnsi(v, x, {
|
|
1177
|
+
hard: true,
|
|
1178
|
+
trim: false
|
|
1179
|
+
});
|
|
1180
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1181
|
+
}, F);
|
|
1182
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1183
|
+
if (!d) return;
|
|
1184
|
+
d = false, clearInterval(T), y2();
|
|
1185
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1186
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1187
|
+
`) : n3.write(`${o} ${s}
|
|
1188
|
+
`)), H(), M();
|
|
978
1189
|
};
|
|
979
|
-
return {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1190
|
+
return {
|
|
1191
|
+
start: P,
|
|
1192
|
+
stop: (e = "") => a2(e, 0),
|
|
1193
|
+
message: (e = "") => {
|
|
1194
|
+
s = C2(e ?? s);
|
|
1195
|
+
},
|
|
1196
|
+
cancel: (e = "") => a2(e, 1),
|
|
1197
|
+
error: (e = "") => a2(e, 2),
|
|
1198
|
+
clear: () => a2("", 0, true),
|
|
1199
|
+
get isCancelled() {
|
|
1200
|
+
return S;
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
u2 = {
|
|
1205
|
+
light: unicodeOr("\u2500", "-"),
|
|
1206
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1207
|
+
block: unicodeOr("\u2588", "#")
|
|
1208
|
+
};
|
|
1209
|
+
SELECT_INSTRUCTIONS = [
|
|
1210
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1211
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1212
|
+
];
|
|
1213
|
+
c = (t2, o) => t2.includes(`
|
|
1214
|
+
`) ? t2.split(`
|
|
1215
|
+
`).map((d) => o(d)).join(`
|
|
1216
|
+
`) : o(t2);
|
|
1217
|
+
select = (t2) => {
|
|
1218
|
+
const o = (n3, m) => {
|
|
1219
|
+
if (n3 === void 0)
|
|
1220
|
+
return "";
|
|
1221
|
+
const s = n3.label ?? String(n3.value);
|
|
1222
|
+
switch (m) {
|
|
994
1223
|
case "disabled":
|
|
995
|
-
return `${
|
|
1224
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
996
1225
|
case "selected":
|
|
997
|
-
return `${
|
|
1226
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
998
1227
|
case "active":
|
|
999
|
-
return `${
|
|
1228
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1000
1229
|
case "cancelled":
|
|
1001
|
-
return `${
|
|
1230
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1002
1231
|
default:
|
|
1003
|
-
return `${
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
1006
|
-
return new
|
|
1007
|
-
|
|
1008
|
-
|
|
1232
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1233
|
+
}
|
|
1234
|
+
}, d = t2.showInstructions ?? true;
|
|
1235
|
+
return new n$1({
|
|
1236
|
+
options: t2.options,
|
|
1237
|
+
signal: t2.signal,
|
|
1238
|
+
input: t2.input,
|
|
1239
|
+
output: t2.output,
|
|
1240
|
+
initialValue: t2.initialValue,
|
|
1241
|
+
render() {
|
|
1242
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1243
|
+
t2.output,
|
|
1244
|
+
t2.message,
|
|
1245
|
+
s,
|
|
1246
|
+
m
|
|
1247
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1248
|
+
` : ""}${i2}
|
|
1009
1249
|
`;
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
${
|
|
1250
|
+
switch (this.state) {
|
|
1251
|
+
case "submit": {
|
|
1252
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1253
|
+
t2.output,
|
|
1254
|
+
o(this.options[this.cursor], "selected"),
|
|
1255
|
+
r2
|
|
1256
|
+
);
|
|
1257
|
+
return `${u3}${a2}`;
|
|
1258
|
+
}
|
|
1259
|
+
case "cancel": {
|
|
1260
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1261
|
+
t2.output,
|
|
1262
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1263
|
+
r2
|
|
1264
|
+
);
|
|
1265
|
+
return `${u3}${a2}${n3 ? `
|
|
1266
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1267
|
+
}
|
|
1268
|
+
default: {
|
|
1269
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1270
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1271
|
+
`), b = p.length + 1;
|
|
1272
|
+
return `${u3}${r2}${limitOptions({
|
|
1273
|
+
output: t2.output,
|
|
1274
|
+
cursor: this.cursor,
|
|
1275
|
+
options: this.options,
|
|
1276
|
+
maxItems: t2.maxItems,
|
|
1277
|
+
columnPadding: r2.length,
|
|
1278
|
+
rowPadding: a2 + b,
|
|
1279
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1280
|
+
}).join(`
|
|
1281
|
+
${r2}`)}
|
|
1282
|
+
${f}
|
|
1026
1283
|
`;
|
|
1284
|
+
}
|
|
1027
1285
|
}
|
|
1028
1286
|
}
|
|
1029
|
-
}
|
|
1287
|
+
}).prompt();
|
|
1030
1288
|
};
|
|
1031
|
-
|
|
1289
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
1032
1290
|
}
|
|
1033
1291
|
});
|
|
1034
1292
|
|
|
@@ -1041,9 +1299,9 @@ function supportsColor() {
|
|
|
1041
1299
|
}
|
|
1042
1300
|
return process.stdout.isTTY === true;
|
|
1043
1301
|
}
|
|
1044
|
-
function colorize(
|
|
1045
|
-
if (!supportsColor()) return
|
|
1046
|
-
return `${color}${
|
|
1302
|
+
function colorize(text2, color) {
|
|
1303
|
+
if (!supportsColor()) return text2;
|
|
1304
|
+
return `${color}${text2}${colors.reset}`;
|
|
1047
1305
|
}
|
|
1048
1306
|
function stringify(value) {
|
|
1049
1307
|
if (typeof value === "string") return value;
|
|
@@ -1073,7 +1331,7 @@ function stringify(value) {
|
|
|
1073
1331
|
function formatMessage(...args) {
|
|
1074
1332
|
return args.map(stringify).join(" ");
|
|
1075
1333
|
}
|
|
1076
|
-
var colors, currentLogLevel,
|
|
1334
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
1077
1335
|
var init_cli_output = __esm({
|
|
1078
1336
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1079
1337
|
"use strict";
|
|
@@ -1106,7 +1364,7 @@ var init_cli_output = __esm({
|
|
|
1106
1364
|
currentLogLevel = envLevel;
|
|
1107
1365
|
}
|
|
1108
1366
|
}
|
|
1109
|
-
|
|
1367
|
+
log2 = {
|
|
1110
1368
|
/**
|
|
1111
1369
|
* Logs an error message (always shows unless Quiet level)
|
|
1112
1370
|
* Uses clack's log.error + explicit red color
|
|
@@ -1114,7 +1372,7 @@ var init_cli_output = __esm({
|
|
|
1114
1372
|
error(...args) {
|
|
1115
1373
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1116
1374
|
const message = formatMessage(...args);
|
|
1117
|
-
|
|
1375
|
+
log.error(colorize(message, colors.brightRed));
|
|
1118
1376
|
},
|
|
1119
1377
|
/**
|
|
1120
1378
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1123,7 +1381,7 @@ var init_cli_output = __esm({
|
|
|
1123
1381
|
warn(...args) {
|
|
1124
1382
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1125
1383
|
const message = formatMessage(...args);
|
|
1126
|
-
|
|
1384
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1127
1385
|
},
|
|
1128
1386
|
/**
|
|
1129
1387
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1132,7 +1390,7 @@ var init_cli_output = __esm({
|
|
|
1132
1390
|
info(...args) {
|
|
1133
1391
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1134
1392
|
const message = formatMessage(...args);
|
|
1135
|
-
|
|
1393
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1136
1394
|
},
|
|
1137
1395
|
/**
|
|
1138
1396
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1141,7 +1399,7 @@ var init_cli_output = __esm({
|
|
|
1141
1399
|
success(...args) {
|
|
1142
1400
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1143
1401
|
const message = formatMessage(...args);
|
|
1144
|
-
|
|
1402
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1145
1403
|
},
|
|
1146
1404
|
/**
|
|
1147
1405
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1150,7 +1408,7 @@ var init_cli_output = __esm({
|
|
|
1150
1408
|
debug(...args) {
|
|
1151
1409
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1152
1410
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1153
|
-
|
|
1411
|
+
log.message(
|
|
1154
1412
|
colorize(
|
|
1155
1413
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1156
1414
|
colors.gray
|
|
@@ -1164,7 +1422,7 @@ var init_cli_output = __esm({
|
|
|
1164
1422
|
trace(...args) {
|
|
1165
1423
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1166
1424
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1167
|
-
|
|
1425
|
+
log.message(
|
|
1168
1426
|
colorize(
|
|
1169
1427
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1170
1428
|
colors.gray
|
|
@@ -1172,10 +1430,10 @@ var init_cli_output = __esm({
|
|
|
1172
1430
|
);
|
|
1173
1431
|
}
|
|
1174
1432
|
};
|
|
1175
|
-
error =
|
|
1176
|
-
warn =
|
|
1177
|
-
info =
|
|
1178
|
-
success =
|
|
1433
|
+
error = log2.error.bind(log2);
|
|
1434
|
+
warn = log2.warn.bind(log2);
|
|
1435
|
+
info = log2.info.bind(log2);
|
|
1436
|
+
success = log2.success.bind(log2);
|
|
1179
1437
|
}
|
|
1180
1438
|
});
|
|
1181
1439
|
|
|
@@ -1535,9 +1793,9 @@ var require_is_glob = __commonJS({
|
|
|
1535
1793
|
index += 2;
|
|
1536
1794
|
var close = chars[open];
|
|
1537
1795
|
if (close) {
|
|
1538
|
-
var
|
|
1539
|
-
if (
|
|
1540
|
-
index =
|
|
1796
|
+
var n3 = str.indexOf(close, index);
|
|
1797
|
+
if (n3 !== -1) {
|
|
1798
|
+
index = n3 + 1;
|
|
1541
1799
|
}
|
|
1542
1800
|
}
|
|
1543
1801
|
if (str[index] === "!") {
|
|
@@ -1563,9 +1821,9 @@ var require_is_glob = __commonJS({
|
|
|
1563
1821
|
index += 2;
|
|
1564
1822
|
var close = chars[open];
|
|
1565
1823
|
if (close) {
|
|
1566
|
-
var
|
|
1567
|
-
if (
|
|
1568
|
-
index =
|
|
1824
|
+
var n3 = str.indexOf(close, index);
|
|
1825
|
+
if (n3 !== -1) {
|
|
1826
|
+
index = n3 + 1;
|
|
1569
1827
|
}
|
|
1570
1828
|
}
|
|
1571
1829
|
if (str[index] === "!") {
|
|
@@ -1643,8 +1901,8 @@ var require_utils = __commonJS({
|
|
|
1643
1901
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1644
1902
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1645
1903
|
};
|
|
1646
|
-
exports.escapeNode = (
|
|
1647
|
-
const node =
|
|
1904
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1905
|
+
const node = block2.nodes[n3];
|
|
1648
1906
|
if (!node) return;
|
|
1649
1907
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1650
1908
|
if (node.escaped !== true) {
|
|
@@ -1661,15 +1919,15 @@ var require_utils = __commonJS({
|
|
|
1661
1919
|
}
|
|
1662
1920
|
return false;
|
|
1663
1921
|
};
|
|
1664
|
-
exports.isInvalidBrace = (
|
|
1665
|
-
if (
|
|
1666
|
-
if (
|
|
1667
|
-
if (
|
|
1668
|
-
|
|
1922
|
+
exports.isInvalidBrace = (block2) => {
|
|
1923
|
+
if (block2.type !== "brace") return false;
|
|
1924
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1925
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1926
|
+
block2.invalid = true;
|
|
1669
1927
|
return true;
|
|
1670
1928
|
}
|
|
1671
|
-
if (
|
|
1672
|
-
|
|
1929
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1930
|
+
block2.invalid = true;
|
|
1673
1931
|
return true;
|
|
1674
1932
|
}
|
|
1675
1933
|
return false;
|
|
@@ -1688,8 +1946,8 @@ var require_utils = __commonJS({
|
|
|
1688
1946
|
exports.flatten = (...args) => {
|
|
1689
1947
|
const result = [];
|
|
1690
1948
|
const flat = (arr) => {
|
|
1691
|
-
for (let
|
|
1692
|
-
const ele = arr[
|
|
1949
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1950
|
+
const ele = arr[i2];
|
|
1693
1951
|
if (Array.isArray(ele)) {
|
|
1694
1952
|
flat(ele);
|
|
1695
1953
|
continue;
|
|
@@ -1783,9 +2041,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1783
2041
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1784
2042
|
return toRegexRange.cache[cacheKey].result;
|
|
1785
2043
|
}
|
|
1786
|
-
let
|
|
2044
|
+
let a2 = Math.min(min, max);
|
|
1787
2045
|
let b = Math.max(min, max);
|
|
1788
|
-
if (Math.abs(
|
|
2046
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1789
2047
|
let result = min + "|" + max;
|
|
1790
2048
|
if (opts.capture) {
|
|
1791
2049
|
return `(${result})`;
|
|
@@ -1796,20 +2054,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1796
2054
|
return `(?:${result})`;
|
|
1797
2055
|
}
|
|
1798
2056
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1799
|
-
let state = { min, max, a, b };
|
|
2057
|
+
let state = { min, max, a: a2, b };
|
|
1800
2058
|
let positives = [];
|
|
1801
2059
|
let negatives = [];
|
|
1802
2060
|
if (isPadded) {
|
|
1803
2061
|
state.isPadded = isPadded;
|
|
1804
2062
|
state.maxLen = String(state.max).length;
|
|
1805
2063
|
}
|
|
1806
|
-
if (
|
|
2064
|
+
if (a2 < 0) {
|
|
1807
2065
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1808
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1809
|
-
|
|
2066
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2067
|
+
a2 = state.a = 0;
|
|
1810
2068
|
}
|
|
1811
2069
|
if (b >= 0) {
|
|
1812
|
-
positives = splitToPatterns(
|
|
2070
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1813
2071
|
}
|
|
1814
2072
|
state.negatives = negatives;
|
|
1815
2073
|
state.positives = positives;
|
|
@@ -1857,8 +2115,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1857
2115
|
let digits = zipped.length;
|
|
1858
2116
|
let pattern = "";
|
|
1859
2117
|
let count = 0;
|
|
1860
|
-
for (let
|
|
1861
|
-
let [startDigit, stopDigit] = zipped[
|
|
2118
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2119
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1862
2120
|
if (startDigit === stopDigit) {
|
|
1863
2121
|
pattern += startDigit;
|
|
1864
2122
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1877,8 +2135,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1877
2135
|
let tokens = [];
|
|
1878
2136
|
let start = min;
|
|
1879
2137
|
let prev;
|
|
1880
|
-
for (let
|
|
1881
|
-
let max2 = ranges[
|
|
2138
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2139
|
+
let max2 = ranges[i2];
|
|
1882
2140
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1883
2141
|
let zeros = "";
|
|
1884
2142
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1913,13 +2171,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1913
2171
|
}
|
|
1914
2172
|
return result;
|
|
1915
2173
|
}
|
|
1916
|
-
function zip(
|
|
2174
|
+
function zip(a2, b) {
|
|
1917
2175
|
let arr = [];
|
|
1918
|
-
for (let
|
|
2176
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1919
2177
|
return arr;
|
|
1920
2178
|
}
|
|
1921
|
-
function compare(
|
|
1922
|
-
return
|
|
2179
|
+
function compare(a2, b) {
|
|
2180
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1923
2181
|
}
|
|
1924
2182
|
function contains(arr, key, val) {
|
|
1925
2183
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1937,8 +2195,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1937
2195
|
}
|
|
1938
2196
|
return "";
|
|
1939
2197
|
}
|
|
1940
|
-
function toCharacterClass(
|
|
1941
|
-
return `[${
|
|
2198
|
+
function toCharacterClass(a2, b, options) {
|
|
2199
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1942
2200
|
}
|
|
1943
2201
|
function hasPadding(str) {
|
|
1944
2202
|
return /^-?(0+)\d/.test(str);
|
|
@@ -2017,8 +2275,8 @@ var require_fill_range = __commonJS({
|
|
|
2017
2275
|
return negative ? "-" + input : input;
|
|
2018
2276
|
};
|
|
2019
2277
|
var toSequence = (parts, options, maxLen) => {
|
|
2020
|
-
parts.negatives.sort((
|
|
2021
|
-
parts.positives.sort((
|
|
2278
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2279
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2022
2280
|
let prefix = options.capture ? "" : "?:";
|
|
2023
2281
|
let positives = "";
|
|
2024
2282
|
let negatives = "";
|
|
@@ -2039,12 +2297,12 @@ var require_fill_range = __commonJS({
|
|
|
2039
2297
|
}
|
|
2040
2298
|
return result;
|
|
2041
2299
|
};
|
|
2042
|
-
var toRange = (
|
|
2300
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
2043
2301
|
if (isNumbers) {
|
|
2044
|
-
return toRegexRange(
|
|
2302
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
2045
2303
|
}
|
|
2046
|
-
let start = String.fromCharCode(
|
|
2047
|
-
if (
|
|
2304
|
+
let start = String.fromCharCode(a2);
|
|
2305
|
+
if (a2 === b) return start;
|
|
2048
2306
|
let stop = String.fromCharCode(b);
|
|
2049
2307
|
return `[${start}-${stop}]`;
|
|
2050
2308
|
};
|
|
@@ -2070,15 +2328,15 @@ var require_fill_range = __commonJS({
|
|
|
2070
2328
|
return [];
|
|
2071
2329
|
};
|
|
2072
2330
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2073
|
-
let
|
|
2331
|
+
let a2 = Number(start);
|
|
2074
2332
|
let b = Number(end);
|
|
2075
|
-
if (!Number.isInteger(
|
|
2333
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2076
2334
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2077
2335
|
return [];
|
|
2078
2336
|
}
|
|
2079
|
-
if (
|
|
2337
|
+
if (a2 === 0) a2 = 0;
|
|
2080
2338
|
if (b === 0) b = 0;
|
|
2081
|
-
let descending =
|
|
2339
|
+
let descending = a2 > b;
|
|
2082
2340
|
let startString = String(start);
|
|
2083
2341
|
let endString = String(end);
|
|
2084
2342
|
let stepString = String(step);
|
|
@@ -2094,13 +2352,13 @@ var require_fill_range = __commonJS({
|
|
|
2094
2352
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2095
2353
|
let range = [];
|
|
2096
2354
|
let index = 0;
|
|
2097
|
-
while (descending ?
|
|
2355
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2098
2356
|
if (options.toRegex === true && step > 1) {
|
|
2099
|
-
push(
|
|
2357
|
+
push(a2);
|
|
2100
2358
|
} else {
|
|
2101
|
-
range.push(pad(format(
|
|
2359
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2102
2360
|
}
|
|
2103
|
-
|
|
2361
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2104
2362
|
index++;
|
|
2105
2363
|
}
|
|
2106
2364
|
if (options.toRegex === true) {
|
|
@@ -2113,19 +2371,19 @@ var require_fill_range = __commonJS({
|
|
|
2113
2371
|
return invalidRange(start, end, options);
|
|
2114
2372
|
}
|
|
2115
2373
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2116
|
-
let
|
|
2374
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2117
2375
|
let b = `${end}`.charCodeAt(0);
|
|
2118
|
-
let descending =
|
|
2119
|
-
let min = Math.min(
|
|
2120
|
-
let max = Math.max(
|
|
2376
|
+
let descending = a2 > b;
|
|
2377
|
+
let min = Math.min(a2, b);
|
|
2378
|
+
let max = Math.max(a2, b);
|
|
2121
2379
|
if (options.toRegex && step === 1) {
|
|
2122
2380
|
return toRange(min, max, false, options);
|
|
2123
2381
|
}
|
|
2124
2382
|
let range = [];
|
|
2125
2383
|
let index = 0;
|
|
2126
|
-
while (descending ?
|
|
2127
|
-
range.push(format(
|
|
2128
|
-
|
|
2384
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2385
|
+
range.push(format(a2, index));
|
|
2386
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2129
2387
|
index++;
|
|
2130
2388
|
}
|
|
2131
2389
|
if (options.toRegex === true) {
|
|
@@ -2248,18 +2506,18 @@ var require_expand = __commonJS({
|
|
|
2248
2506
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2249
2507
|
const walk = (node, parent = {}) => {
|
|
2250
2508
|
node.queue = [];
|
|
2251
|
-
let
|
|
2252
|
-
let
|
|
2253
|
-
while (
|
|
2254
|
-
|
|
2255
|
-
|
|
2509
|
+
let p = parent;
|
|
2510
|
+
let q = parent.queue;
|
|
2511
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2512
|
+
p = p.parent;
|
|
2513
|
+
q = p.queue;
|
|
2256
2514
|
}
|
|
2257
2515
|
if (node.invalid || node.dollar) {
|
|
2258
|
-
|
|
2516
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2259
2517
|
return;
|
|
2260
2518
|
}
|
|
2261
2519
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2262
|
-
|
|
2520
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2263
2521
|
return;
|
|
2264
2522
|
}
|
|
2265
2523
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2271,26 +2529,26 @@ var require_expand = __commonJS({
|
|
|
2271
2529
|
if (range.length === 0) {
|
|
2272
2530
|
range = stringify2(node, options);
|
|
2273
2531
|
}
|
|
2274
|
-
|
|
2532
|
+
q.push(append(q.pop(), range));
|
|
2275
2533
|
node.nodes = [];
|
|
2276
2534
|
return;
|
|
2277
2535
|
}
|
|
2278
2536
|
const enclose = utils.encloseBrace(node);
|
|
2279
2537
|
let queue = node.queue;
|
|
2280
|
-
let
|
|
2281
|
-
while (
|
|
2282
|
-
|
|
2283
|
-
queue =
|
|
2538
|
+
let block2 = node;
|
|
2539
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2540
|
+
block2 = block2.parent;
|
|
2541
|
+
queue = block2.queue;
|
|
2284
2542
|
}
|
|
2285
|
-
for (let
|
|
2286
|
-
const child = node.nodes[
|
|
2543
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2544
|
+
const child = node.nodes[i2];
|
|
2287
2545
|
if (child.type === "comma" && node.type === "brace") {
|
|
2288
|
-
if (
|
|
2546
|
+
if (i2 === 1) queue.push("");
|
|
2289
2547
|
queue.push("");
|
|
2290
2548
|
continue;
|
|
2291
2549
|
}
|
|
2292
2550
|
if (child.type === "close") {
|
|
2293
|
-
|
|
2551
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2294
2552
|
continue;
|
|
2295
2553
|
}
|
|
2296
2554
|
if (child.value && child.type !== "open") {
|
|
@@ -2457,7 +2715,7 @@ var require_parse = __commonJS({
|
|
|
2457
2715
|
}
|
|
2458
2716
|
const ast = { type: "root", input, nodes: [] };
|
|
2459
2717
|
const stack = [ast];
|
|
2460
|
-
let
|
|
2718
|
+
let block2 = ast;
|
|
2461
2719
|
let prev = ast;
|
|
2462
2720
|
let brackets = 0;
|
|
2463
2721
|
const length = input.length;
|
|
@@ -2473,15 +2731,15 @@ var require_parse = __commonJS({
|
|
|
2473
2731
|
prev.value += node.value;
|
|
2474
2732
|
return;
|
|
2475
2733
|
}
|
|
2476
|
-
|
|
2477
|
-
node.parent =
|
|
2734
|
+
block2.nodes.push(node);
|
|
2735
|
+
node.parent = block2;
|
|
2478
2736
|
node.prev = prev;
|
|
2479
2737
|
prev = node;
|
|
2480
2738
|
return node;
|
|
2481
2739
|
};
|
|
2482
2740
|
push({ type: "bos" });
|
|
2483
2741
|
while (index < length) {
|
|
2484
|
-
|
|
2742
|
+
block2 = stack[stack.length - 1];
|
|
2485
2743
|
value = advance();
|
|
2486
2744
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2487
2745
|
continue;
|
|
@@ -2518,19 +2776,19 @@ var require_parse = __commonJS({
|
|
|
2518
2776
|
continue;
|
|
2519
2777
|
}
|
|
2520
2778
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2521
|
-
|
|
2522
|
-
stack.push(
|
|
2779
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2780
|
+
stack.push(block2);
|
|
2523
2781
|
push({ type: "text", value });
|
|
2524
2782
|
continue;
|
|
2525
2783
|
}
|
|
2526
2784
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2527
|
-
if (
|
|
2785
|
+
if (block2.type !== "paren") {
|
|
2528
2786
|
push({ type: "text", value });
|
|
2529
2787
|
continue;
|
|
2530
2788
|
}
|
|
2531
|
-
|
|
2789
|
+
block2 = stack.pop();
|
|
2532
2790
|
push({ type: "text", value });
|
|
2533
|
-
|
|
2791
|
+
block2 = stack[stack.length - 1];
|
|
2534
2792
|
continue;
|
|
2535
2793
|
}
|
|
2536
2794
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2555,7 +2813,7 @@ var require_parse = __commonJS({
|
|
|
2555
2813
|
}
|
|
2556
2814
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2557
2815
|
depth++;
|
|
2558
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2816
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2559
2817
|
const brace = {
|
|
2560
2818
|
type: "brace",
|
|
2561
2819
|
open: true,
|
|
@@ -2566,52 +2824,52 @@ var require_parse = __commonJS({
|
|
|
2566
2824
|
ranges: 0,
|
|
2567
2825
|
nodes: []
|
|
2568
2826
|
};
|
|
2569
|
-
|
|
2570
|
-
stack.push(
|
|
2827
|
+
block2 = push(brace);
|
|
2828
|
+
stack.push(block2);
|
|
2571
2829
|
push({ type: "open", value });
|
|
2572
2830
|
continue;
|
|
2573
2831
|
}
|
|
2574
2832
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2575
|
-
if (
|
|
2833
|
+
if (block2.type !== "brace") {
|
|
2576
2834
|
push({ type: "text", value });
|
|
2577
2835
|
continue;
|
|
2578
2836
|
}
|
|
2579
2837
|
const type = "close";
|
|
2580
|
-
|
|
2581
|
-
|
|
2838
|
+
block2 = stack.pop();
|
|
2839
|
+
block2.close = true;
|
|
2582
2840
|
push({ type, value });
|
|
2583
2841
|
depth--;
|
|
2584
|
-
|
|
2842
|
+
block2 = stack[stack.length - 1];
|
|
2585
2843
|
continue;
|
|
2586
2844
|
}
|
|
2587
2845
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2588
|
-
if (
|
|
2589
|
-
|
|
2590
|
-
const open =
|
|
2591
|
-
|
|
2846
|
+
if (block2.ranges > 0) {
|
|
2847
|
+
block2.ranges = 0;
|
|
2848
|
+
const open = block2.nodes.shift();
|
|
2849
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2592
2850
|
}
|
|
2593
2851
|
push({ type: "comma", value });
|
|
2594
|
-
|
|
2852
|
+
block2.commas++;
|
|
2595
2853
|
continue;
|
|
2596
2854
|
}
|
|
2597
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2598
|
-
const siblings =
|
|
2855
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2856
|
+
const siblings = block2.nodes;
|
|
2599
2857
|
if (depth === 0 || siblings.length === 0) {
|
|
2600
2858
|
push({ type: "text", value });
|
|
2601
2859
|
continue;
|
|
2602
2860
|
}
|
|
2603
2861
|
if (prev.type === "dot") {
|
|
2604
|
-
|
|
2862
|
+
block2.range = [];
|
|
2605
2863
|
prev.value += value;
|
|
2606
2864
|
prev.type = "range";
|
|
2607
|
-
if (
|
|
2608
|
-
|
|
2609
|
-
|
|
2865
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2866
|
+
block2.invalid = true;
|
|
2867
|
+
block2.ranges = 0;
|
|
2610
2868
|
prev.type = "text";
|
|
2611
2869
|
continue;
|
|
2612
2870
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2871
|
+
block2.ranges++;
|
|
2872
|
+
block2.args = [];
|
|
2615
2873
|
continue;
|
|
2616
2874
|
}
|
|
2617
2875
|
if (prev.type === "range") {
|
|
@@ -2619,7 +2877,7 @@ var require_parse = __commonJS({
|
|
|
2619
2877
|
const before = siblings[siblings.length - 1];
|
|
2620
2878
|
before.value += prev.value + value;
|
|
2621
2879
|
prev = before;
|
|
2622
|
-
|
|
2880
|
+
block2.ranges--;
|
|
2623
2881
|
continue;
|
|
2624
2882
|
}
|
|
2625
2883
|
push({ type: "dot", value });
|
|
@@ -2628,9 +2886,9 @@ var require_parse = __commonJS({
|
|
|
2628
2886
|
push({ type: "text", value });
|
|
2629
2887
|
}
|
|
2630
2888
|
do {
|
|
2631
|
-
|
|
2632
|
-
if (
|
|
2633
|
-
|
|
2889
|
+
block2 = stack.pop();
|
|
2890
|
+
if (block2.type !== "root") {
|
|
2891
|
+
block2.nodes.forEach((node) => {
|
|
2634
2892
|
if (!node.nodes) {
|
|
2635
2893
|
if (node.type === "open") node.isOpen = true;
|
|
2636
2894
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2639,8 +2897,8 @@ var require_parse = __commonJS({
|
|
|
2639
2897
|
}
|
|
2640
2898
|
});
|
|
2641
2899
|
const parent = stack[stack.length - 1];
|
|
2642
|
-
const index2 = parent.nodes.indexOf(
|
|
2643
|
-
parent.nodes.splice(index2, 1, ...
|
|
2900
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2901
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2644
2902
|
}
|
|
2645
2903
|
} while (stack.length > 0);
|
|
2646
2904
|
push({ type: "eos" });
|
|
@@ -3273,9 +3531,9 @@ var require_scan = __commonJS({
|
|
|
3273
3531
|
if (opts.parts === true || opts.tokens === true) {
|
|
3274
3532
|
let prevIndex;
|
|
3275
3533
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3276
|
-
const
|
|
3277
|
-
const
|
|
3278
|
-
const value = input.slice(
|
|
3534
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3535
|
+
const i2 = slashes[idx];
|
|
3536
|
+
const value = input.slice(n3, i2);
|
|
3279
3537
|
if (opts.tokens) {
|
|
3280
3538
|
if (idx === 0 && start !== 0) {
|
|
3281
3539
|
tokens[idx].isPrefix = true;
|
|
@@ -3289,7 +3547,7 @@ var require_scan = __commonJS({
|
|
|
3289
3547
|
if (idx !== 0 || value !== "") {
|
|
3290
3548
|
parts.push(value);
|
|
3291
3549
|
}
|
|
3292
|
-
prevIndex =
|
|
3550
|
+
prevIndex = i2;
|
|
3293
3551
|
}
|
|
3294
3552
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3295
3553
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3418,15 +3676,15 @@ var require_parse2 = __commonJS({
|
|
|
3418
3676
|
};
|
|
3419
3677
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3420
3678
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3421
|
-
for (let
|
|
3422
|
-
for (let
|
|
3423
|
-
const
|
|
3424
|
-
const b = values[
|
|
3425
|
-
const char =
|
|
3426
|
-
if (!char ||
|
|
3679
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3680
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3681
|
+
const a2 = values[i2];
|
|
3682
|
+
const b = values[j];
|
|
3683
|
+
const char = a2[0];
|
|
3684
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3427
3685
|
continue;
|
|
3428
3686
|
}
|
|
3429
|
-
if (
|
|
3687
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3430
3688
|
return true;
|
|
3431
3689
|
}
|
|
3432
3690
|
}
|
|
@@ -3441,8 +3699,8 @@ var require_parse2 = __commonJS({
|
|
|
3441
3699
|
let paren = 0;
|
|
3442
3700
|
let quote = 0;
|
|
3443
3701
|
let escaped = false;
|
|
3444
|
-
for (let
|
|
3445
|
-
const ch = pattern[
|
|
3702
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3703
|
+
const ch = pattern[i2];
|
|
3446
3704
|
if (escaped === true) {
|
|
3447
3705
|
escaped = false;
|
|
3448
3706
|
continue;
|
|
@@ -3476,13 +3734,13 @@ var require_parse2 = __commonJS({
|
|
|
3476
3734
|
if (ch === ")") {
|
|
3477
3735
|
paren--;
|
|
3478
3736
|
if (paren === 0) {
|
|
3479
|
-
if (requireEnd === true &&
|
|
3737
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3480
3738
|
return;
|
|
3481
3739
|
}
|
|
3482
3740
|
return {
|
|
3483
3741
|
type: pattern[0],
|
|
3484
|
-
body: pattern.slice(2,
|
|
3485
|
-
end:
|
|
3742
|
+
body: pattern.slice(2, i2),
|
|
3743
|
+
end: i2
|
|
3486
3744
|
};
|
|
3487
3745
|
}
|
|
3488
3746
|
}
|
|
@@ -3614,7 +3872,7 @@ var require_parse2 = __commonJS({
|
|
|
3614
3872
|
let prev = bos;
|
|
3615
3873
|
let value;
|
|
3616
3874
|
const eos = () => state.index === len - 1;
|
|
3617
|
-
const peek = state.peek = (
|
|
3875
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3618
3876
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3619
3877
|
const remaining = () => input.slice(state.index + 1);
|
|
3620
3878
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3695,10 +3953,10 @@ var require_parse2 = __commonJS({
|
|
|
3695
3953
|
open.type = "text";
|
|
3696
3954
|
open.value = literal;
|
|
3697
3955
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3698
|
-
for (let
|
|
3699
|
-
tokens[
|
|
3700
|
-
tokens[
|
|
3701
|
-
delete tokens[
|
|
3956
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3957
|
+
tokens[i2].value = "";
|
|
3958
|
+
tokens[i2].output = "";
|
|
3959
|
+
delete tokens[i2].suffix;
|
|
3702
3960
|
}
|
|
3703
3961
|
state.output = token.output + open.output;
|
|
3704
3962
|
state.backtrack = true;
|
|
@@ -3941,13 +4199,13 @@ var require_parse2 = __commonJS({
|
|
|
3941
4199
|
if (brace.dots === true) {
|
|
3942
4200
|
const arr = tokens.slice();
|
|
3943
4201
|
const range = [];
|
|
3944
|
-
for (let
|
|
4202
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3945
4203
|
tokens.pop();
|
|
3946
|
-
if (arr[
|
|
4204
|
+
if (arr[i2].type === "brace") {
|
|
3947
4205
|
break;
|
|
3948
4206
|
}
|
|
3949
|
-
if (arr[
|
|
3950
|
-
range.unshift(arr[
|
|
4207
|
+
if (arr[i2].type !== "dots") {
|
|
4208
|
+
range.unshift(arr[i2].value);
|
|
3951
4209
|
}
|
|
3952
4210
|
}
|
|
3953
4211
|
output = expandRange(range, opts);
|
|
@@ -4406,7 +4664,7 @@ var require_picomatch = __commonJS({
|
|
|
4406
4664
|
};
|
|
4407
4665
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4408
4666
|
picomatch.parse = (pattern, options) => {
|
|
4409
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4667
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4410
4668
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4411
4669
|
};
|
|
4412
4670
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4490,8 +4748,8 @@ var require_micromatch = __commonJS({
|
|
|
4490
4748
|
options.onResult(state);
|
|
4491
4749
|
}
|
|
4492
4750
|
};
|
|
4493
|
-
for (let
|
|
4494
|
-
let isMatch = picomatch(String(patterns[
|
|
4751
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4752
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4495
4753
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4496
4754
|
if (negated) negatives++;
|
|
4497
4755
|
for (let item of list) {
|
|
@@ -4513,7 +4771,7 @@ var require_micromatch = __commonJS({
|
|
|
4513
4771
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4514
4772
|
}
|
|
4515
4773
|
if (options.nonull === true || options.nullglob === true) {
|
|
4516
|
-
return options.unescape ? patterns.map((
|
|
4774
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4517
4775
|
}
|
|
4518
4776
|
}
|
|
4519
4777
|
return matches;
|
|
@@ -4543,7 +4801,7 @@ var require_micromatch = __commonJS({
|
|
|
4543
4801
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4544
4802
|
}
|
|
4545
4803
|
if (Array.isArray(pattern)) {
|
|
4546
|
-
return pattern.some((
|
|
4804
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4547
4805
|
}
|
|
4548
4806
|
if (typeof pattern === "string") {
|
|
4549
4807
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4588,7 +4846,7 @@ var require_micromatch = __commonJS({
|
|
|
4588
4846
|
if (typeof str !== "string") {
|
|
4589
4847
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4590
4848
|
}
|
|
4591
|
-
return [].concat(patterns).every((
|
|
4849
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4592
4850
|
};
|
|
4593
4851
|
micromatch.capture = (glob, input, options) => {
|
|
4594
4852
|
let posix = utils.isWindows(options);
|
|
@@ -4739,7 +4997,7 @@ var require_pattern = __commonJS({
|
|
|
4739
4997
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4740
4998
|
function expandBraceExpansion(pattern) {
|
|
4741
4999
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4742
|
-
patterns.sort((
|
|
5000
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4743
5001
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4744
5002
|
}
|
|
4745
5003
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4820,8 +5078,8 @@ var require_merge2 = __commonJS({
|
|
|
4820
5078
|
}
|
|
4821
5079
|
const mergedStream = PassThrough(options);
|
|
4822
5080
|
function addStream() {
|
|
4823
|
-
for (let
|
|
4824
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5081
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5082
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4825
5083
|
}
|
|
4826
5084
|
mergeStream();
|
|
4827
5085
|
return this;
|
|
@@ -4870,8 +5128,8 @@ var require_merge2 = __commonJS({
|
|
|
4870
5128
|
stream.pipe(mergedStream, { end: false });
|
|
4871
5129
|
stream.resume();
|
|
4872
5130
|
}
|
|
4873
|
-
for (let
|
|
4874
|
-
pipe(streams[
|
|
5131
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5132
|
+
pipe(streams[i2]);
|
|
4875
5133
|
}
|
|
4876
5134
|
next();
|
|
4877
5135
|
}
|
|
@@ -4902,8 +5160,8 @@ var require_merge2 = __commonJS({
|
|
|
4902
5160
|
}
|
|
4903
5161
|
streams.pause();
|
|
4904
5162
|
} else {
|
|
4905
|
-
for (let
|
|
4906
|
-
streams[
|
|
5163
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5164
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4907
5165
|
}
|
|
4908
5166
|
}
|
|
4909
5167
|
return streams;
|
|
@@ -4985,13 +5243,13 @@ var require_tasks = __commonJS({
|
|
|
4985
5243
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4986
5244
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4987
5245
|
var utils = require_utils3();
|
|
4988
|
-
function generate(input,
|
|
4989
|
-
const patterns = processPatterns(input,
|
|
4990
|
-
const ignore = processPatterns(
|
|
5246
|
+
function generate(input, settings2) {
|
|
5247
|
+
const patterns = processPatterns(input, settings2);
|
|
5248
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4991
5249
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4992
5250
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4993
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4994
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5251
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5252
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4995
5253
|
const staticTasks = convertPatternsToTasks(
|
|
4996
5254
|
staticPatterns,
|
|
4997
5255
|
negativePatterns,
|
|
@@ -5007,12 +5265,12 @@ var require_tasks = __commonJS({
|
|
|
5007
5265
|
return staticTasks.concat(dynamicTasks);
|
|
5008
5266
|
}
|
|
5009
5267
|
exports.generate = generate;
|
|
5010
|
-
function processPatterns(input,
|
|
5268
|
+
function processPatterns(input, settings2) {
|
|
5011
5269
|
let patterns = input;
|
|
5012
|
-
if (
|
|
5270
|
+
if (settings2.braceExpansion) {
|
|
5013
5271
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
5014
5272
|
}
|
|
5015
|
-
if (
|
|
5273
|
+
if (settings2.baseNameMatch) {
|
|
5016
5274
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
5017
5275
|
}
|
|
5018
5276
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -5043,7 +5301,7 @@ var require_tasks = __commonJS({
|
|
|
5043
5301
|
}
|
|
5044
5302
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
5045
5303
|
function groupPatternsByBaseDirectory(patterns) {
|
|
5046
|
-
const
|
|
5304
|
+
const group2 = {};
|
|
5047
5305
|
return patterns.reduce((collection, pattern) => {
|
|
5048
5306
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
5049
5307
|
if (base in collection) {
|
|
@@ -5052,7 +5310,7 @@ var require_tasks = __commonJS({
|
|
|
5052
5310
|
collection[base] = [pattern];
|
|
5053
5311
|
}
|
|
5054
5312
|
return collection;
|
|
5055
|
-
},
|
|
5313
|
+
}, group2);
|
|
5056
5314
|
}
|
|
5057
5315
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5058
5316
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5081,26 +5339,26 @@ var require_async = __commonJS({
|
|
|
5081
5339
|
init_utils2();
|
|
5082
5340
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5083
5341
|
exports.read = void 0;
|
|
5084
|
-
function read(path,
|
|
5085
|
-
|
|
5342
|
+
function read(path, settings2, callback) {
|
|
5343
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5086
5344
|
if (lstatError !== null) {
|
|
5087
5345
|
callFailureCallback(callback, lstatError);
|
|
5088
5346
|
return;
|
|
5089
5347
|
}
|
|
5090
|
-
if (!lstat.isSymbolicLink() || !
|
|
5348
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5091
5349
|
callSuccessCallback(callback, lstat);
|
|
5092
5350
|
return;
|
|
5093
5351
|
}
|
|
5094
|
-
|
|
5352
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5095
5353
|
if (statError !== null) {
|
|
5096
|
-
if (
|
|
5354
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5097
5355
|
callFailureCallback(callback, statError);
|
|
5098
5356
|
return;
|
|
5099
5357
|
}
|
|
5100
5358
|
callSuccessCallback(callback, lstat);
|
|
5101
5359
|
return;
|
|
5102
5360
|
}
|
|
5103
|
-
if (
|
|
5361
|
+
if (settings2.markSymbolicLink) {
|
|
5104
5362
|
stat.isSymbolicLink = () => true;
|
|
5105
5363
|
}
|
|
5106
5364
|
callSuccessCallback(callback, stat);
|
|
@@ -5124,19 +5382,19 @@ var require_sync = __commonJS({
|
|
|
5124
5382
|
init_utils2();
|
|
5125
5383
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5126
5384
|
exports.read = void 0;
|
|
5127
|
-
function read(path,
|
|
5128
|
-
const lstat =
|
|
5129
|
-
if (!lstat.isSymbolicLink() || !
|
|
5385
|
+
function read(path, settings2) {
|
|
5386
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5387
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5130
5388
|
return lstat;
|
|
5131
5389
|
}
|
|
5132
5390
|
try {
|
|
5133
|
-
const stat =
|
|
5134
|
-
if (
|
|
5391
|
+
const stat = settings2.fs.statSync(path);
|
|
5392
|
+
if (settings2.markSymbolicLink) {
|
|
5135
5393
|
stat.isSymbolicLink = () => true;
|
|
5136
5394
|
}
|
|
5137
5395
|
return stat;
|
|
5138
5396
|
} catch (error2) {
|
|
5139
|
-
if (!
|
|
5397
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5140
5398
|
return lstat;
|
|
5141
5399
|
}
|
|
5142
5400
|
throw error2;
|
|
@@ -5213,8 +5471,8 @@ var require_out = __commonJS({
|
|
|
5213
5471
|
}
|
|
5214
5472
|
exports.stat = stat;
|
|
5215
5473
|
function statSync3(path, optionsOrSettings) {
|
|
5216
|
-
const
|
|
5217
|
-
return sync.read(path,
|
|
5474
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5475
|
+
return sync.read(path, settings2);
|
|
5218
5476
|
}
|
|
5219
5477
|
exports.statSync = statSync3;
|
|
5220
5478
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5262,8 +5520,8 @@ var require_run_parallel = __commonJS({
|
|
|
5262
5520
|
if (isSync) queueMicrotask2(end);
|
|
5263
5521
|
else end();
|
|
5264
5522
|
}
|
|
5265
|
-
function each(
|
|
5266
|
-
results[
|
|
5523
|
+
function each(i2, err, result) {
|
|
5524
|
+
results[i2] = result;
|
|
5267
5525
|
if (--pending === 0 || err) {
|
|
5268
5526
|
done(err);
|
|
5269
5527
|
}
|
|
@@ -5277,9 +5535,9 @@ var require_run_parallel = __commonJS({
|
|
|
5277
5535
|
});
|
|
5278
5536
|
});
|
|
5279
5537
|
} else {
|
|
5280
|
-
tasks.forEach(function(task,
|
|
5538
|
+
tasks.forEach(function(task, i2) {
|
|
5281
5539
|
task(function(err, result) {
|
|
5282
|
-
each(
|
|
5540
|
+
each(i2, err, result);
|
|
5283
5541
|
});
|
|
5284
5542
|
});
|
|
5285
5543
|
}
|
|
@@ -5354,11 +5612,11 @@ var require_common = __commonJS({
|
|
|
5354
5612
|
init_utils2();
|
|
5355
5613
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5356
5614
|
exports.joinPathSegments = void 0;
|
|
5357
|
-
function joinPathSegments(
|
|
5358
|
-
if (
|
|
5359
|
-
return
|
|
5615
|
+
function joinPathSegments(a2, b, separator) {
|
|
5616
|
+
if (a2.endsWith(separator)) {
|
|
5617
|
+
return a2 + b;
|
|
5360
5618
|
}
|
|
5361
|
-
return
|
|
5619
|
+
return a2 + separator + b;
|
|
5362
5620
|
}
|
|
5363
5621
|
exports.joinPathSegments = joinPathSegments;
|
|
5364
5622
|
}
|
|
@@ -5376,16 +5634,16 @@ var require_async2 = __commonJS({
|
|
|
5376
5634
|
var constants_1 = require_constants3();
|
|
5377
5635
|
var utils = require_utils4();
|
|
5378
5636
|
var common = require_common();
|
|
5379
|
-
function read(directory,
|
|
5380
|
-
if (!
|
|
5381
|
-
readdirWithFileTypes(directory,
|
|
5637
|
+
function read(directory, settings2, callback) {
|
|
5638
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5639
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5382
5640
|
return;
|
|
5383
5641
|
}
|
|
5384
|
-
readdir(directory,
|
|
5642
|
+
readdir(directory, settings2, callback);
|
|
5385
5643
|
}
|
|
5386
5644
|
exports.read = read;
|
|
5387
|
-
function readdirWithFileTypes(directory,
|
|
5388
|
-
|
|
5645
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5646
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5389
5647
|
if (readdirError !== null) {
|
|
5390
5648
|
callFailureCallback(callback, readdirError);
|
|
5391
5649
|
return;
|
|
@@ -5393,13 +5651,13 @@ var require_async2 = __commonJS({
|
|
|
5393
5651
|
const entries = dirents.map((dirent) => ({
|
|
5394
5652
|
dirent,
|
|
5395
5653
|
name: dirent.name,
|
|
5396
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5654
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5397
5655
|
}));
|
|
5398
|
-
if (!
|
|
5656
|
+
if (!settings2.followSymbolicLinks) {
|
|
5399
5657
|
callSuccessCallback(callback, entries);
|
|
5400
5658
|
return;
|
|
5401
5659
|
}
|
|
5402
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5660
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5403
5661
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5404
5662
|
if (rplError !== null) {
|
|
5405
5663
|
callFailureCallback(callback, rplError);
|
|
@@ -5410,15 +5668,15 @@ var require_async2 = __commonJS({
|
|
|
5410
5668
|
});
|
|
5411
5669
|
}
|
|
5412
5670
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5413
|
-
function makeRplTaskEntry(entry,
|
|
5671
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5414
5672
|
return (done) => {
|
|
5415
5673
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5416
5674
|
done(null, entry);
|
|
5417
5675
|
return;
|
|
5418
5676
|
}
|
|
5419
|
-
|
|
5677
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5420
5678
|
if (statError !== null) {
|
|
5421
|
-
if (
|
|
5679
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5422
5680
|
done(statError);
|
|
5423
5681
|
return;
|
|
5424
5682
|
}
|
|
@@ -5430,16 +5688,16 @@ var require_async2 = __commonJS({
|
|
|
5430
5688
|
});
|
|
5431
5689
|
};
|
|
5432
5690
|
}
|
|
5433
|
-
function readdir(directory,
|
|
5434
|
-
|
|
5691
|
+
function readdir(directory, settings2, callback) {
|
|
5692
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5435
5693
|
if (readdirError !== null) {
|
|
5436
5694
|
callFailureCallback(callback, readdirError);
|
|
5437
5695
|
return;
|
|
5438
5696
|
}
|
|
5439
5697
|
const tasks = names.map((name) => {
|
|
5440
|
-
const path = common.joinPathSegments(directory, name,
|
|
5698
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5441
5699
|
return (done) => {
|
|
5442
|
-
fsStat.stat(path,
|
|
5700
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5443
5701
|
if (error2 !== null) {
|
|
5444
5702
|
done(error2);
|
|
5445
5703
|
return;
|
|
@@ -5449,7 +5707,7 @@ var require_async2 = __commonJS({
|
|
|
5449
5707
|
path,
|
|
5450
5708
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5451
5709
|
};
|
|
5452
|
-
if (
|
|
5710
|
+
if (settings2.stats) {
|
|
5453
5711
|
entry.stats = stats;
|
|
5454
5712
|
}
|
|
5455
5713
|
done(null, entry);
|
|
@@ -5486,27 +5744,27 @@ var require_sync2 = __commonJS({
|
|
|
5486
5744
|
var constants_1 = require_constants3();
|
|
5487
5745
|
var utils = require_utils4();
|
|
5488
5746
|
var common = require_common();
|
|
5489
|
-
function read(directory,
|
|
5490
|
-
if (!
|
|
5491
|
-
return readdirWithFileTypes(directory,
|
|
5747
|
+
function read(directory, settings2) {
|
|
5748
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5749
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5492
5750
|
}
|
|
5493
|
-
return readdir(directory,
|
|
5751
|
+
return readdir(directory, settings2);
|
|
5494
5752
|
}
|
|
5495
5753
|
exports.read = read;
|
|
5496
|
-
function readdirWithFileTypes(directory,
|
|
5497
|
-
const dirents =
|
|
5754
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5755
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5498
5756
|
return dirents.map((dirent) => {
|
|
5499
5757
|
const entry = {
|
|
5500
5758
|
dirent,
|
|
5501
5759
|
name: dirent.name,
|
|
5502
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5760
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5503
5761
|
};
|
|
5504
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5762
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5505
5763
|
try {
|
|
5506
|
-
const stats =
|
|
5764
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5507
5765
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5508
5766
|
} catch (error2) {
|
|
5509
|
-
if (
|
|
5767
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5510
5768
|
throw error2;
|
|
5511
5769
|
}
|
|
5512
5770
|
}
|
|
@@ -5515,17 +5773,17 @@ var require_sync2 = __commonJS({
|
|
|
5515
5773
|
});
|
|
5516
5774
|
}
|
|
5517
5775
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5518
|
-
function readdir(directory,
|
|
5519
|
-
const names =
|
|
5776
|
+
function readdir(directory, settings2) {
|
|
5777
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5520
5778
|
return names.map((name) => {
|
|
5521
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5522
|
-
const stats = fsStat.statSync(entryPath,
|
|
5779
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5780
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5523
5781
|
const entry = {
|
|
5524
5782
|
name,
|
|
5525
5783
|
path: entryPath,
|
|
5526
5784
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5527
5785
|
};
|
|
5528
|
-
if (
|
|
5786
|
+
if (settings2.stats) {
|
|
5529
5787
|
entry.stats = stats;
|
|
5530
5788
|
}
|
|
5531
5789
|
return entry;
|
|
@@ -5612,8 +5870,8 @@ var require_out2 = __commonJS({
|
|
|
5612
5870
|
}
|
|
5613
5871
|
exports.scandir = scandir;
|
|
5614
5872
|
function scandirSync(path, optionsOrSettings) {
|
|
5615
|
-
const
|
|
5616
|
-
return sync.read(path,
|
|
5873
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5874
|
+
return sync.read(path, settings2);
|
|
5617
5875
|
}
|
|
5618
5876
|
exports.scandirSync = scandirSync;
|
|
5619
5877
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5657,9 +5915,9 @@ var require_reusify = __commonJS({
|
|
|
5657
5915
|
}
|
|
5658
5916
|
});
|
|
5659
5917
|
|
|
5660
|
-
// node_modules/.bun/fastq@1.20.
|
|
5918
|
+
// node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
|
|
5661
5919
|
var require_queue = __commonJS({
|
|
5662
|
-
"node_modules/.bun/fastq@1.20.
|
|
5920
|
+
"node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
|
|
5663
5921
|
"use strict";
|
|
5664
5922
|
init_utils2();
|
|
5665
5923
|
var reusify = require_reusify();
|
|
@@ -5839,11 +6097,12 @@ var require_queue = __commonJS({
|
|
|
5839
6097
|
current.value = null;
|
|
5840
6098
|
current.callback = noop;
|
|
5841
6099
|
current.errorHandler = null;
|
|
6100
|
+
current.next = null;
|
|
5842
6101
|
if (errorHandler2) {
|
|
5843
6102
|
errorHandler2(new Error("abort"), val);
|
|
5844
6103
|
}
|
|
5845
6104
|
callback.call(context2, new Error("abort"));
|
|
5846
|
-
|
|
6105
|
+
cache.release(current);
|
|
5847
6106
|
current = next;
|
|
5848
6107
|
}
|
|
5849
6108
|
self.drain = noop;
|
|
@@ -5894,7 +6153,7 @@ var require_queue = __commonJS({
|
|
|
5894
6153
|
queue.drained = drained;
|
|
5895
6154
|
return queue;
|
|
5896
6155
|
function push(value) {
|
|
5897
|
-
var
|
|
6156
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5898
6157
|
pushCb(value, function(err, result) {
|
|
5899
6158
|
if (err) {
|
|
5900
6159
|
reject(err);
|
|
@@ -5903,11 +6162,11 @@ var require_queue = __commonJS({
|
|
|
5903
6162
|
resolve4(result);
|
|
5904
6163
|
});
|
|
5905
6164
|
});
|
|
5906
|
-
|
|
5907
|
-
return
|
|
6165
|
+
p.catch(noop);
|
|
6166
|
+
return p;
|
|
5908
6167
|
}
|
|
5909
6168
|
function unshift(value) {
|
|
5910
|
-
var
|
|
6169
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5911
6170
|
unshiftCb(value, function(err, result) {
|
|
5912
6171
|
if (err) {
|
|
5913
6172
|
reject(err);
|
|
@@ -5916,11 +6175,11 @@ var require_queue = __commonJS({
|
|
|
5916
6175
|
resolve4(result);
|
|
5917
6176
|
});
|
|
5918
6177
|
});
|
|
5919
|
-
|
|
5920
|
-
return
|
|
6178
|
+
p.catch(noop);
|
|
6179
|
+
return p;
|
|
5921
6180
|
}
|
|
5922
6181
|
function drained() {
|
|
5923
|
-
var
|
|
6182
|
+
var p = new Promise(function(resolve4) {
|
|
5924
6183
|
process.nextTick(function() {
|
|
5925
6184
|
if (queue.idle()) {
|
|
5926
6185
|
resolve4();
|
|
@@ -5934,7 +6193,7 @@ var require_queue = __commonJS({
|
|
|
5934
6193
|
}
|
|
5935
6194
|
});
|
|
5936
6195
|
});
|
|
5937
|
-
return
|
|
6196
|
+
return p;
|
|
5938
6197
|
}
|
|
5939
6198
|
}
|
|
5940
6199
|
module.exports = fastqueue;
|
|
@@ -5949,11 +6208,11 @@ var require_common2 = __commonJS({
|
|
|
5949
6208
|
init_utils2();
|
|
5950
6209
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5951
6210
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5952
|
-
function isFatalError(
|
|
5953
|
-
if (
|
|
6211
|
+
function isFatalError(settings2, error2) {
|
|
6212
|
+
if (settings2.errorFilter === null) {
|
|
5954
6213
|
return true;
|
|
5955
6214
|
}
|
|
5956
|
-
return !
|
|
6215
|
+
return !settings2.errorFilter(error2);
|
|
5957
6216
|
}
|
|
5958
6217
|
exports.isFatalError = isFatalError;
|
|
5959
6218
|
function isAppliedFilter(filter, value) {
|
|
@@ -5964,14 +6223,14 @@ var require_common2 = __commonJS({
|
|
|
5964
6223
|
return filepath.split(/[/\\]/).join(separator);
|
|
5965
6224
|
}
|
|
5966
6225
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5967
|
-
function joinPathSegments(
|
|
5968
|
-
if (
|
|
6226
|
+
function joinPathSegments(a2, b, separator) {
|
|
6227
|
+
if (a2 === "") {
|
|
5969
6228
|
return b;
|
|
5970
6229
|
}
|
|
5971
|
-
if (
|
|
5972
|
-
return
|
|
6230
|
+
if (a2.endsWith(separator)) {
|
|
6231
|
+
return a2 + b;
|
|
5973
6232
|
}
|
|
5974
|
-
return
|
|
6233
|
+
return a2 + separator + b;
|
|
5975
6234
|
}
|
|
5976
6235
|
exports.joinPathSegments = joinPathSegments;
|
|
5977
6236
|
}
|
|
@@ -6318,14 +6577,14 @@ var require_out3 = __commonJS({
|
|
|
6318
6577
|
}
|
|
6319
6578
|
exports.walk = walk;
|
|
6320
6579
|
function walkSync(directory, optionsOrSettings) {
|
|
6321
|
-
const
|
|
6322
|
-
const provider = new sync_1.default(directory,
|
|
6580
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6581
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6323
6582
|
return provider.read();
|
|
6324
6583
|
}
|
|
6325
6584
|
exports.walkSync = walkSync;
|
|
6326
6585
|
function walkStream(directory, optionsOrSettings) {
|
|
6327
|
-
const
|
|
6328
|
-
const provider = new stream_1.default(directory,
|
|
6586
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6587
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6329
6588
|
return provider.read();
|
|
6330
6589
|
}
|
|
6331
6590
|
exports.walkStream = walkStream;
|
|
@@ -6411,8 +6670,8 @@ var require_stream3 = __commonJS({
|
|
|
6411
6670
|
done();
|
|
6412
6671
|
}).catch(done);
|
|
6413
6672
|
};
|
|
6414
|
-
for (let
|
|
6415
|
-
stream.write(
|
|
6673
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6674
|
+
stream.write(i2);
|
|
6416
6675
|
}
|
|
6417
6676
|
return stream;
|
|
6418
6677
|
}
|
|
@@ -7073,14 +7332,14 @@ var require_out4 = __commonJS({
|
|
|
7073
7332
|
function generateTasks(source, options) {
|
|
7074
7333
|
assertPatternsInput(source);
|
|
7075
7334
|
const patterns = [].concat(source);
|
|
7076
|
-
const
|
|
7077
|
-
return taskManager.generate(patterns,
|
|
7335
|
+
const settings2 = new settings_1.default(options);
|
|
7336
|
+
return taskManager.generate(patterns, settings2);
|
|
7078
7337
|
}
|
|
7079
7338
|
FastGlob2.generateTasks = generateTasks;
|
|
7080
7339
|
function isDynamicPattern(source, options) {
|
|
7081
7340
|
assertPatternsInput(source);
|
|
7082
|
-
const
|
|
7083
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7341
|
+
const settings2 = new settings_1.default(options);
|
|
7342
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7084
7343
|
}
|
|
7085
7344
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7086
7345
|
function escapePath(source) {
|
|
@@ -7122,9 +7381,9 @@ var require_out4 = __commonJS({
|
|
|
7122
7381
|
})(FastGlob || (FastGlob = {}));
|
|
7123
7382
|
function getWorks(source, _Provider, options) {
|
|
7124
7383
|
const patterns = [].concat(source);
|
|
7125
|
-
const
|
|
7126
|
-
const tasks = taskManager.generate(patterns,
|
|
7127
|
-
const provider = new _Provider(
|
|
7384
|
+
const settings2 = new settings_1.default(options);
|
|
7385
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7386
|
+
const provider = new _Provider(settings2);
|
|
7128
7387
|
return tasks.map(provider.read, provider);
|
|
7129
7388
|
}
|
|
7130
7389
|
function assertPatternsInput(input) {
|
|
@@ -7302,14 +7561,14 @@ import "node:fs";
|
|
|
7302
7561
|
import { createRequire } from "node:module";
|
|
7303
7562
|
import {
|
|
7304
7563
|
resolve,
|
|
7305
|
-
join,
|
|
7306
|
-
dirname,
|
|
7564
|
+
join as join2,
|
|
7565
|
+
dirname as dirname2,
|
|
7307
7566
|
relative,
|
|
7308
7567
|
normalize,
|
|
7309
7568
|
sep,
|
|
7310
7569
|
extname
|
|
7311
7570
|
} from "node:path";
|
|
7312
|
-
import "node:url";
|
|
7571
|
+
import { fileURLToPath } from "node:url";
|
|
7313
7572
|
function safeExecuteAsync(fn, message) {
|
|
7314
7573
|
return fn().catch((error2) => {
|
|
7315
7574
|
throw new Error(
|
|
@@ -7317,7 +7576,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7317
7576
|
);
|
|
7318
7577
|
});
|
|
7319
7578
|
}
|
|
7320
|
-
var import_fast_glob, constants,
|
|
7579
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7321
7580
|
var init_PathResolver = __esm({
|
|
7322
7581
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7323
7582
|
"use strict";
|
|
@@ -7330,7 +7589,7 @@ var init_PathResolver = __esm({
|
|
|
7330
7589
|
getPatternsFor: getPatternsFor || void 0,
|
|
7331
7590
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7332
7591
|
};
|
|
7333
|
-
|
|
7592
|
+
log3 = {
|
|
7334
7593
|
error: (message, error2) => {
|
|
7335
7594
|
},
|
|
7336
7595
|
warn: (message, error2) => {
|
|
@@ -7366,6 +7625,7 @@ var init_PathResolver = __esm({
|
|
|
7366
7625
|
options;
|
|
7367
7626
|
_repoRoot;
|
|
7368
7627
|
_appRoot = null;
|
|
7628
|
+
_writtenPaths = null;
|
|
7369
7629
|
/**
|
|
7370
7630
|
* Get or create singleton instance
|
|
7371
7631
|
* @param options - Configuration options
|
|
@@ -7451,7 +7711,7 @@ var init_PathResolver = __esm({
|
|
|
7451
7711
|
*/
|
|
7452
7712
|
getDirname(path) {
|
|
7453
7713
|
if (!path) return "";
|
|
7454
|
-
return this.normalizePath(
|
|
7714
|
+
return this.normalizePath(dirname2(path));
|
|
7455
7715
|
}
|
|
7456
7716
|
/**
|
|
7457
7717
|
* Resolve package path using Node's module resolution
|
|
@@ -7463,7 +7723,7 @@ var init_PathResolver = __esm({
|
|
|
7463
7723
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7464
7724
|
try {
|
|
7465
7725
|
const basePath = fromPath || this.getAppRoot();
|
|
7466
|
-
const require3 = createRequire(
|
|
7726
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7467
7727
|
const resolved = require3.resolve(packageSpecifier);
|
|
7468
7728
|
return this.normalizePath(resolved);
|
|
7469
7729
|
} catch (error2) {
|
|
@@ -7615,7 +7875,7 @@ var init_PathResolver = __esm({
|
|
|
7615
7875
|
return cleanContent;
|
|
7616
7876
|
} catch (error2) {
|
|
7617
7877
|
if (this.options.debug) {
|
|
7618
|
-
|
|
7878
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7619
7879
|
}
|
|
7620
7880
|
return null;
|
|
7621
7881
|
}
|
|
@@ -7643,7 +7903,7 @@ var init_PathResolver = __esm({
|
|
|
7643
7903
|
return cleanContent;
|
|
7644
7904
|
} catch (error2) {
|
|
7645
7905
|
if (this.options.debug) {
|
|
7646
|
-
|
|
7906
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7647
7907
|
}
|
|
7648
7908
|
return null;
|
|
7649
7909
|
}
|
|
@@ -7665,16 +7925,16 @@ var init_PathResolver = __esm({
|
|
|
7665
7925
|
verbose = false
|
|
7666
7926
|
} = options;
|
|
7667
7927
|
const normalizedPath = this.normalizePath(filePath);
|
|
7668
|
-
const dir = this.normalizePath(
|
|
7928
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7669
7929
|
const fileExists = this.pathExists(normalizedPath);
|
|
7670
7930
|
if (fileExists && !overwrite) {
|
|
7671
7931
|
if (verbose) {
|
|
7672
|
-
|
|
7932
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7673
7933
|
}
|
|
7674
7934
|
return false;
|
|
7675
7935
|
}
|
|
7676
7936
|
if (dryRun) {
|
|
7677
|
-
|
|
7937
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7678
7938
|
return true;
|
|
7679
7939
|
}
|
|
7680
7940
|
try {
|
|
@@ -7684,22 +7944,23 @@ var init_PathResolver = __esm({
|
|
|
7684
7944
|
}
|
|
7685
7945
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7686
7946
|
let writeContent;
|
|
7687
|
-
if (
|
|
7947
|
+
if (Buffer2.isBuffer(content)) {
|
|
7688
7948
|
writeContent = content;
|
|
7689
7949
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7690
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
7950
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
7951
|
+
`;
|
|
7691
7952
|
} else {
|
|
7692
7953
|
writeContent = String(content);
|
|
7693
7954
|
}
|
|
7694
7955
|
try {
|
|
7695
7956
|
return await safeExecuteAsync(async () => {
|
|
7696
|
-
if (
|
|
7957
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7697
7958
|
await fs.promises.writeFile(normalizedPath, writeContent);
|
|
7698
7959
|
} else {
|
|
7699
7960
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7700
7961
|
}
|
|
7701
7962
|
if (verbose) {
|
|
7702
|
-
|
|
7963
|
+
log3.info(
|
|
7703
7964
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7704
7965
|
);
|
|
7705
7966
|
}
|
|
@@ -7726,16 +7987,16 @@ var init_PathResolver = __esm({
|
|
|
7726
7987
|
verbose = false
|
|
7727
7988
|
} = options;
|
|
7728
7989
|
const normalizedPath = this.normalizePath(filePath);
|
|
7729
|
-
const dir = this.normalizePath(
|
|
7990
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7730
7991
|
const fileExists = this.pathExists(normalizedPath);
|
|
7731
7992
|
if (fileExists && !overwrite) {
|
|
7732
7993
|
if (verbose) {
|
|
7733
|
-
|
|
7994
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7734
7995
|
}
|
|
7735
7996
|
return false;
|
|
7736
7997
|
}
|
|
7737
7998
|
if (dryRun) {
|
|
7738
|
-
|
|
7999
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7739
8000
|
return true;
|
|
7740
8001
|
}
|
|
7741
8002
|
try {
|
|
@@ -7745,21 +8006,23 @@ var init_PathResolver = __esm({
|
|
|
7745
8006
|
}
|
|
7746
8007
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7747
8008
|
let writeContent;
|
|
7748
|
-
if (
|
|
8009
|
+
if (Buffer2.isBuffer(content)) {
|
|
7749
8010
|
writeContent = content;
|
|
7750
8011
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7751
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8012
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8013
|
+
`;
|
|
7752
8014
|
} else {
|
|
7753
8015
|
writeContent = String(content);
|
|
7754
8016
|
}
|
|
7755
8017
|
try {
|
|
7756
|
-
if (
|
|
8018
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7757
8019
|
fs.writeFileSync(normalizedPath, writeContent);
|
|
7758
8020
|
} else {
|
|
7759
8021
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7760
8022
|
}
|
|
8023
|
+
this._writtenPaths?.add(normalizedPath);
|
|
7761
8024
|
if (verbose) {
|
|
7762
|
-
|
|
8025
|
+
log3.info(
|
|
7763
8026
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7764
8027
|
);
|
|
7765
8028
|
}
|
|
@@ -7784,15 +8047,15 @@ var init_PathResolver = __esm({
|
|
|
7784
8047
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7785
8048
|
if (fileExists && !overwrite) {
|
|
7786
8049
|
if (verbose) {
|
|
7787
|
-
|
|
8050
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7788
8051
|
}
|
|
7789
8052
|
return false;
|
|
7790
8053
|
}
|
|
7791
8054
|
if (dryRun) {
|
|
7792
|
-
|
|
8055
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7793
8056
|
return true;
|
|
7794
8057
|
}
|
|
7795
|
-
const dir = this.normalizePath(
|
|
8058
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7796
8059
|
try {
|
|
7797
8060
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7798
8061
|
} catch (error2) {
|
|
@@ -7802,7 +8065,7 @@ var init_PathResolver = __esm({
|
|
|
7802
8065
|
return await safeExecuteAsync(async () => {
|
|
7803
8066
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7804
8067
|
if (verbose) {
|
|
7805
|
-
|
|
8068
|
+
log3.info(
|
|
7806
8069
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7807
8070
|
);
|
|
7808
8071
|
}
|
|
@@ -7826,15 +8089,15 @@ var init_PathResolver = __esm({
|
|
|
7826
8089
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7827
8090
|
if (fileExists && !overwrite) {
|
|
7828
8091
|
if (verbose) {
|
|
7829
|
-
|
|
8092
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7830
8093
|
}
|
|
7831
8094
|
return false;
|
|
7832
8095
|
}
|
|
7833
8096
|
if (dryRun) {
|
|
7834
|
-
|
|
8097
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7835
8098
|
return true;
|
|
7836
8099
|
}
|
|
7837
|
-
const dir = this.normalizePath(
|
|
8100
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7838
8101
|
try {
|
|
7839
8102
|
fs.mkdirSync(dir, { recursive: true });
|
|
7840
8103
|
} catch (error2) {
|
|
@@ -7842,8 +8105,9 @@ var init_PathResolver = __esm({
|
|
|
7842
8105
|
}
|
|
7843
8106
|
try {
|
|
7844
8107
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
8108
|
+
this._writtenPaths?.add(normalizedDestPath);
|
|
7845
8109
|
if (verbose) {
|
|
7846
|
-
|
|
8110
|
+
log3.info(
|
|
7847
8111
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7848
8112
|
);
|
|
7849
8113
|
}
|
|
@@ -7860,7 +8124,7 @@ var init_PathResolver = __esm({
|
|
|
7860
8124
|
return fs.existsSync(filePath);
|
|
7861
8125
|
} catch (error2) {
|
|
7862
8126
|
if (!silent) {
|
|
7863
|
-
|
|
8127
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7864
8128
|
}
|
|
7865
8129
|
return false;
|
|
7866
8130
|
}
|
|
@@ -7886,7 +8150,7 @@ var init_PathResolver = __esm({
|
|
|
7886
8150
|
return fs.readdirSync(dirPath, options);
|
|
7887
8151
|
} catch (error2) {
|
|
7888
8152
|
if (this.options.debug) {
|
|
7889
|
-
|
|
8153
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7890
8154
|
}
|
|
7891
8155
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7892
8156
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7904,11 +8168,29 @@ var init_PathResolver = __esm({
|
|
|
7904
8168
|
return fs.statSync(filePath);
|
|
7905
8169
|
} catch (error2) {
|
|
7906
8170
|
if (this.options.debug) {
|
|
7907
|
-
|
|
8171
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7908
8172
|
}
|
|
7909
8173
|
return null;
|
|
7910
8174
|
}
|
|
7911
8175
|
}
|
|
8176
|
+
/**
|
|
8177
|
+
* Resolve the real path of a file, following symlinks
|
|
8178
|
+
* @param filePath - Path to resolve
|
|
8179
|
+
* @returns Resolved real path
|
|
8180
|
+
*/
|
|
8181
|
+
realpathSync(filePath) {
|
|
8182
|
+
return fs.realpathSync(filePath);
|
|
8183
|
+
}
|
|
8184
|
+
/**
|
|
8185
|
+
* Watch a directory for changes
|
|
8186
|
+
* @param dirPath - Directory to watch
|
|
8187
|
+
* @param options - fs.watch options
|
|
8188
|
+
* @param callback - Callback for change events
|
|
8189
|
+
* @returns FSWatcher instance
|
|
8190
|
+
*/
|
|
8191
|
+
watch(dirPath, options, callback) {
|
|
8192
|
+
return fs.watch(dirPath, options, callback);
|
|
8193
|
+
}
|
|
7912
8194
|
/**
|
|
7913
8195
|
* Get file stats synchronously (follows symlinks)
|
|
7914
8196
|
* Returns null if file doesn't exist (graceful degradation)
|
|
@@ -7921,7 +8203,7 @@ var init_PathResolver = __esm({
|
|
|
7921
8203
|
return fs.lstatSync(filePath);
|
|
7922
8204
|
} catch (error2) {
|
|
7923
8205
|
if (this.options.debug) {
|
|
7924
|
-
|
|
8206
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7925
8207
|
}
|
|
7926
8208
|
return null;
|
|
7927
8209
|
}
|
|
@@ -7988,6 +8270,28 @@ var init_PathResolver = __esm({
|
|
|
7988
8270
|
* Get app root (where vite.config.ts is, Vite's config.root)
|
|
7989
8271
|
* Falls back to repoRoot if not set
|
|
7990
8272
|
*/
|
|
8273
|
+
/**
|
|
8274
|
+
* Start recording every path written by writeSync/copySync.
|
|
8275
|
+
* Lets a generator know exactly which files the current run produced,
|
|
8276
|
+
* without comparing file timestamps to a clock.
|
|
8277
|
+
*/
|
|
8278
|
+
startWriteRecording() {
|
|
8279
|
+
this._writtenPaths = /* @__PURE__ */ new Set();
|
|
8280
|
+
}
|
|
8281
|
+
/**
|
|
8282
|
+
* Stop recording and return the normalized paths written since
|
|
8283
|
+
* startWriteRecording().
|
|
8284
|
+
*/
|
|
8285
|
+
stopWriteRecording() {
|
|
8286
|
+
if (!this._writtenPaths) {
|
|
8287
|
+
throw new Error(
|
|
8288
|
+
"stopWriteRecording() called without startWriteRecording()"
|
|
8289
|
+
);
|
|
8290
|
+
}
|
|
8291
|
+
const written = this._writtenPaths;
|
|
8292
|
+
this._writtenPaths = null;
|
|
8293
|
+
return written;
|
|
8294
|
+
}
|
|
7991
8295
|
getAppRoot() {
|
|
7992
8296
|
if (!this._appRoot) {
|
|
7993
8297
|
return this._repoRoot;
|
|
@@ -8010,7 +8314,7 @@ var init_PathResolver = __esm({
|
|
|
8010
8314
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
8011
8315
|
*/
|
|
8012
8316
|
isMonorepo() {
|
|
8013
|
-
const packagesDir =
|
|
8317
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
8014
8318
|
return this.pathExists(packagesDir);
|
|
8015
8319
|
}
|
|
8016
8320
|
/**
|
|
@@ -8027,7 +8331,7 @@ var init_PathResolver = __esm({
|
|
|
8027
8331
|
* Find files matching pattern within directory
|
|
8028
8332
|
*/
|
|
8029
8333
|
async findFiles(directory, pattern, options = {}) {
|
|
8030
|
-
const searchPattern = this.normalizePath(
|
|
8334
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
8031
8335
|
const appRoot = this.getAppRoot();
|
|
8032
8336
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
8033
8337
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8074,7 +8378,7 @@ var init_PathResolver = __esm({
|
|
|
8074
8378
|
return null;
|
|
8075
8379
|
}
|
|
8076
8380
|
const resolvedPath = this.normalizePath(
|
|
8077
|
-
|
|
8381
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8078
8382
|
);
|
|
8079
8383
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8080
8384
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8245,6 +8549,15 @@ var init_PathResolver = __esm({
|
|
|
8245
8549
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8246
8550
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8247
8551
|
}
|
|
8552
|
+
/**
|
|
8553
|
+
* Get absolute path to empty flag component module.
|
|
8554
|
+
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8555
|
+
* to replace unused flag files at build time.
|
|
8556
|
+
*/
|
|
8557
|
+
getEmptyFlagModulePath() {
|
|
8558
|
+
const __dirname2 = dirname2(fileURLToPath(import.meta.url));
|
|
8559
|
+
return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
|
|
8560
|
+
}
|
|
8248
8561
|
/**
|
|
8249
8562
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8250
8563
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8270,13 +8583,13 @@ var init_PathResolver = __esm({
|
|
|
8270
8583
|
const maxLevels = this.options.maxLevels;
|
|
8271
8584
|
while (levelsChecked < maxLevels) {
|
|
8272
8585
|
const toolingPath = this.normalizePath(
|
|
8273
|
-
|
|
8586
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8274
8587
|
);
|
|
8275
|
-
const corePath = this.normalizePath(
|
|
8588
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8276
8589
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8277
8590
|
return currentDir;
|
|
8278
8591
|
}
|
|
8279
|
-
const appsDir =
|
|
8592
|
+
const appsDir = join2(currentDir, "apps");
|
|
8280
8593
|
if (this.pathExists(appsDir)) {
|
|
8281
8594
|
const appsDirStat = this.statSync(appsDir);
|
|
8282
8595
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8284,15 +8597,15 @@ var init_PathResolver = __esm({
|
|
|
8284
8597
|
}
|
|
8285
8598
|
}
|
|
8286
8599
|
const packageJsonPath = this.normalizePath(
|
|
8287
|
-
|
|
8600
|
+
join2(currentDir, "package.json")
|
|
8288
8601
|
);
|
|
8289
8602
|
if (this.pathExists(packageJsonPath)) {
|
|
8290
|
-
const parentDir2 = this.normalizePath(
|
|
8603
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8291
8604
|
if (parentDir2 === currentDir) {
|
|
8292
8605
|
return currentDir;
|
|
8293
8606
|
}
|
|
8294
8607
|
}
|
|
8295
|
-
const parentDir = this.normalizePath(
|
|
8608
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8296
8609
|
if (parentDir === currentDir) {
|
|
8297
8610
|
break;
|
|
8298
8611
|
}
|
|
@@ -8308,8 +8621,8 @@ var init_PathResolver = __esm({
|
|
|
8308
8621
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8309
8622
|
import { createRequire as createRequire2 } from "node:module";
|
|
8310
8623
|
import {
|
|
8311
|
-
join as
|
|
8312
|
-
dirname as
|
|
8624
|
+
join as join3,
|
|
8625
|
+
dirname as dirname3,
|
|
8313
8626
|
basename as basename2,
|
|
8314
8627
|
extname as extname2,
|
|
8315
8628
|
relative as relative2,
|
|
@@ -8318,7 +8631,7 @@ import {
|
|
|
8318
8631
|
isAbsolute as pathIsAbsolute
|
|
8319
8632
|
} from "node:path";
|
|
8320
8633
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8321
|
-
function
|
|
8634
|
+
function readdirSync3(dirPath, options) {
|
|
8322
8635
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8323
8636
|
}
|
|
8324
8637
|
var pathResolverInstance, getRepoRoot, getAppRoot, normalizePath, pathExists, readSync, write, statSync2, ensureDir, joinPath;
|
|
@@ -8331,7 +8644,7 @@ var init_pathResolver = __esm({
|
|
|
8331
8644
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8332
8645
|
getAppRoot = () => pathResolverInstance.getAppRoot();
|
|
8333
8646
|
normalizePath = (...pathSegments) => {
|
|
8334
|
-
return pathResolverInstance.normalizePath(
|
|
8647
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8335
8648
|
};
|
|
8336
8649
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8337
8650
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
@@ -8387,10 +8700,10 @@ var init_typed_file_operations = __esm({
|
|
|
8387
8700
|
});
|
|
8388
8701
|
|
|
8389
8702
|
// packages/tooling/src/bundler/utils.ts
|
|
8390
|
-
import { Buffer } from "node:buffer";
|
|
8703
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8391
8704
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8392
8705
|
import { createRequire as createRequire3 } from "node:module";
|
|
8393
|
-
import { dirname as
|
|
8706
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8394
8707
|
import process from "node:process";
|
|
8395
8708
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8396
8709
|
var require2, __filename, __dirname;
|
|
@@ -8399,12 +8712,12 @@ var init_utils2 = __esm({
|
|
|
8399
8712
|
"use strict";
|
|
8400
8713
|
require2 = createRequire3(import.meta.url);
|
|
8401
8714
|
__filename = fileURLToPath3(import.meta.url);
|
|
8402
|
-
__dirname =
|
|
8715
|
+
__dirname = dirname4(__filename);
|
|
8403
8716
|
if (typeof globalThis !== "undefined") {
|
|
8404
8717
|
globalThis.require = require2;
|
|
8405
8718
|
globalThis.__filename = __filename;
|
|
8406
8719
|
globalThis.__dirname = __dirname;
|
|
8407
|
-
globalThis.Buffer =
|
|
8720
|
+
globalThis.Buffer = Buffer2;
|
|
8408
8721
|
globalThis.process = process;
|
|
8409
8722
|
if (typeof global === "undefined") {
|
|
8410
8723
|
globalThis.global = globalThis;
|
|
@@ -8581,12 +8894,12 @@ var init_app_detection = __esm({
|
|
|
8581
8894
|
|
|
8582
8895
|
// packages/tooling/src/utils/cli-input.ts
|
|
8583
8896
|
async function askForConfirmation(message, defaultValue = false) {
|
|
8584
|
-
const result = await
|
|
8897
|
+
const result = await confirm({
|
|
8585
8898
|
message,
|
|
8586
8899
|
initialValue: defaultValue
|
|
8587
8900
|
});
|
|
8588
|
-
if (
|
|
8589
|
-
|
|
8901
|
+
if (isCancel(result)) {
|
|
8902
|
+
cancel("Operation cancelled.");
|
|
8590
8903
|
process.exit(0);
|
|
8591
8904
|
}
|
|
8592
8905
|
return result;
|
|
@@ -8597,13 +8910,13 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8597
8910
|
label: choice.title,
|
|
8598
8911
|
hint: choice.hint
|
|
8599
8912
|
}));
|
|
8600
|
-
const result = await
|
|
8913
|
+
const result = await select({
|
|
8601
8914
|
message,
|
|
8602
8915
|
options,
|
|
8603
8916
|
initialValue: choices[defaultValue]?.value
|
|
8604
8917
|
});
|
|
8605
|
-
if (
|
|
8606
|
-
|
|
8918
|
+
if (isCancel(result)) {
|
|
8919
|
+
cancel("Operation cancelled.");
|
|
8607
8920
|
process.exit(0);
|
|
8608
8921
|
}
|
|
8609
8922
|
return result;
|
|
@@ -8688,7 +9001,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
8688
9001
|
if (value) {
|
|
8689
9002
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
8690
9003
|
warnedLegacy.add(name);
|
|
8691
|
-
|
|
9004
|
+
log2.warn(
|
|
8692
9005
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
8693
9006
|
);
|
|
8694
9007
|
}
|
|
@@ -8699,7 +9012,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
8699
9012
|
if (aliasValue) {
|
|
8700
9013
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
8701
9014
|
warnedLegacy.add(name);
|
|
8702
|
-
|
|
9015
|
+
log2.warn(
|
|
8703
9016
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
8704
9017
|
);
|
|
8705
9018
|
}
|
|
@@ -8787,13 +9100,13 @@ function detectGitHubRepo() {
|
|
|
8787
9100
|
}
|
|
8788
9101
|
function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
8789
9102
|
if (dryRun) {
|
|
8790
|
-
|
|
9103
|
+
log2.info(
|
|
8791
9104
|
`[DRY RUN] Would set GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`
|
|
8792
9105
|
);
|
|
8793
9106
|
return;
|
|
8794
9107
|
}
|
|
8795
9108
|
try {
|
|
8796
|
-
|
|
9109
|
+
log2.info(`Setting GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`);
|
|
8797
9110
|
const args = ["secret", "set", key];
|
|
8798
9111
|
if (repo) {
|
|
8799
9112
|
args.push("--repo", repo);
|
|
@@ -8808,8 +9121,8 @@ function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
|
8808
9121
|
}
|
|
8809
9122
|
if (result.status !== 0) {
|
|
8810
9123
|
const stderr = result.stderr?.toString() || "";
|
|
8811
|
-
const
|
|
8812
|
-
const errorOutput = stderr ||
|
|
9124
|
+
const stdout2 = result.stdout?.toString() || "";
|
|
9125
|
+
const errorOutput = stderr || stdout2;
|
|
8813
9126
|
if (errorOutput.includes("not logged in") || errorOutput.includes("authentication")) {
|
|
8814
9127
|
throw new DoNotDevError(
|
|
8815
9128
|
`GitHub CLI authentication required. Run 'gh auth login' to authenticate.`,
|
|
@@ -8822,10 +9135,10 @@ function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
|
8822
9135
|
${errorOutput}`
|
|
8823
9136
|
);
|
|
8824
9137
|
}
|
|
8825
|
-
|
|
9138
|
+
log2.success(`GitHub secret ${key} set successfully`);
|
|
8826
9139
|
} catch (err) {
|
|
8827
9140
|
if (err instanceof DoNotDevError) throw err;
|
|
8828
|
-
|
|
9141
|
+
log2.error(`Failed to set GitHub secret ${key}:`, err);
|
|
8829
9142
|
throw new DoNotDevError(
|
|
8830
9143
|
`Failed to set GitHub secret ${key}`,
|
|
8831
9144
|
"command-failed",
|
|
@@ -8844,13 +9157,13 @@ function uploadServiceAccountToGitHub(appDir, repo, dryRun = false, staging = fa
|
|
|
8844
9157
|
const secretName = staging ? "FIREBASE_SERVICE_ACCOUNT_STAGING" : "FIREBASE_SERVICE_ACCOUNT";
|
|
8845
9158
|
const filePath = joinPath(appDir, fileName);
|
|
8846
9159
|
if (!pathExists(filePath)) {
|
|
8847
|
-
|
|
9160
|
+
log2.debug(`No ${fileName} found in ${appDir}, skipping GitHub upload`);
|
|
8848
9161
|
return;
|
|
8849
9162
|
}
|
|
8850
9163
|
const contentRaw = readSync(filePath, { format: "text" });
|
|
8851
9164
|
const content = typeof contentRaw === "string" ? contentRaw : null;
|
|
8852
9165
|
if (!content) return;
|
|
8853
|
-
const encoded =
|
|
9166
|
+
const encoded = Buffer2.from(content).toString("base64");
|
|
8854
9167
|
setGitHubSecret(secretName, encoded, repo, dryRun);
|
|
8855
9168
|
}
|
|
8856
9169
|
var init_sync_secrets = __esm({
|
|
@@ -8883,7 +9196,7 @@ function detectAvailableApps() {
|
|
|
8883
9196
|
if (!pathExists(appsDir)) {
|
|
8884
9197
|
return [];
|
|
8885
9198
|
}
|
|
8886
|
-
return
|
|
9199
|
+
return readdirSync3(appsDir).filter((item) => {
|
|
8887
9200
|
const itemPath = joinPath(appsDir, item);
|
|
8888
9201
|
const stat = statSync2(itemPath);
|
|
8889
9202
|
return stat?.isDirectory() === true;
|
|
@@ -8897,7 +9210,7 @@ function detectAvailableApps() {
|
|
|
8897
9210
|
}
|
|
8898
9211
|
function readStagingProject(startDir) {
|
|
8899
9212
|
let current = startDir;
|
|
8900
|
-
for (let
|
|
9213
|
+
for (let i2 = 0; i2 < 10; i2++) {
|
|
8901
9214
|
const firebasercPath = joinPath(current, ".firebaserc");
|
|
8902
9215
|
if (pathExists(firebasercPath)) {
|
|
8903
9216
|
try {
|
|
@@ -8920,8 +9233,8 @@ init_utils2();
|
|
|
8920
9233
|
import { execSync } from "node:child_process";
|
|
8921
9234
|
init_sync_secrets();
|
|
8922
9235
|
init_vercel_token();
|
|
8923
|
-
init_pathResolver();
|
|
8924
9236
|
init_app_detection();
|
|
9237
|
+
init_pathResolver();
|
|
8925
9238
|
init_secrets_resolver();
|
|
8926
9239
|
function isGhCliAvailable() {
|
|
8927
9240
|
try {
|
|
@@ -9089,7 +9402,7 @@ jobs:
|
|
|
9089
9402
|
}
|
|
9090
9403
|
function generateDeployWorkflow(providers, envSecretNames) {
|
|
9091
9404
|
const appName = providers.name;
|
|
9092
|
-
const envBlock = envSecretNames.filter((
|
|
9405
|
+
const envBlock = envSecretNames.filter((n3) => n3.startsWith("VITE_") || n3.startsWith("NEXT_PUBLIC_")).map((n3) => ` ${n3}: \${{ secrets.${n3} }}`).join("\n");
|
|
9093
9406
|
let steps = ` - name: Checkout repository
|
|
9094
9407
|
uses: actions/checkout@v4
|
|
9095
9408
|
|
|
@@ -9191,7 +9504,7 @@ ${steps}
|
|
|
9191
9504
|
}
|
|
9192
9505
|
function generateStagingWorkflow(providers, envSecretNames) {
|
|
9193
9506
|
const appName = providers.name;
|
|
9194
|
-
const envBlock = envSecretNames.filter((
|
|
9507
|
+
const envBlock = envSecretNames.filter((n3) => n3.startsWith("VITE_") || n3.startsWith("NEXT_PUBLIC_")).map((n3) => ` ${n3}: \${{ secrets.${n3} }}`).join("\n");
|
|
9195
9508
|
let steps = ` - name: Checkout repository
|
|
9196
9509
|
uses: actions/checkout@v4
|
|
9197
9510
|
|
|
@@ -9278,50 +9591,50 @@ ${steps}
|
|
|
9278
9591
|
}
|
|
9279
9592
|
async function main(options = {}) {
|
|
9280
9593
|
const dryRun = options.dryRun ?? false;
|
|
9281
|
-
|
|
9594
|
+
intro("CI/CD Setup");
|
|
9282
9595
|
if (!isGhCliAvailable()) {
|
|
9283
|
-
|
|
9596
|
+
log2.error(
|
|
9284
9597
|
"GitHub CLI (gh) is required.\nInstall: https://cli.github.com/\nThen: gh auth login"
|
|
9285
9598
|
);
|
|
9286
9599
|
return 1;
|
|
9287
9600
|
}
|
|
9288
9601
|
if (!isGhAuthenticated()) {
|
|
9289
|
-
|
|
9602
|
+
log2.error("GitHub CLI not authenticated.\nRun: gh auth login");
|
|
9290
9603
|
return 1;
|
|
9291
9604
|
}
|
|
9292
9605
|
const repo = detectGitHubRepo();
|
|
9293
9606
|
if (!repo) {
|
|
9294
|
-
|
|
9607
|
+
log2.error(
|
|
9295
9608
|
"Could not detect GitHub repository from git remote.\nEnsure a GitHub remote is configured."
|
|
9296
9609
|
);
|
|
9297
9610
|
return 1;
|
|
9298
9611
|
}
|
|
9299
9612
|
if (dryRun) {
|
|
9300
|
-
|
|
9613
|
+
log2.info("DRY RUN MODE \u2014 no secrets will be uploaded, no files written");
|
|
9301
9614
|
}
|
|
9302
9615
|
const projectRoot = getAppRoot();
|
|
9303
9616
|
let appName = options.app;
|
|
9304
9617
|
if (!appName) {
|
|
9305
9618
|
const availableApps = detectAvailableApps();
|
|
9306
9619
|
if (availableApps.length === 0) {
|
|
9307
|
-
|
|
9620
|
+
log2.error(
|
|
9308
9621
|
"No apps found with firebase.json, supabase/, or vercel.json.\nRun from a DoNotDev project with at least one configured app."
|
|
9309
9622
|
);
|
|
9310
9623
|
return 1;
|
|
9311
9624
|
}
|
|
9312
9625
|
if (availableApps.length === 1) {
|
|
9313
9626
|
appName = availableApps[0];
|
|
9314
|
-
|
|
9627
|
+
note(`Using app: ${appName}`, "Auto-detected");
|
|
9315
9628
|
} else {
|
|
9316
9629
|
appName = await askForSelection(
|
|
9317
9630
|
"Which app to set up CI/CD for?",
|
|
9318
|
-
availableApps.map((
|
|
9631
|
+
availableApps.map((a2) => ({ title: a2, value: a2 }))
|
|
9319
9632
|
);
|
|
9320
9633
|
}
|
|
9321
9634
|
}
|
|
9322
9635
|
const appDir = joinPath(projectRoot, "apps", appName);
|
|
9323
9636
|
if (!pathExists(appDir)) {
|
|
9324
|
-
|
|
9637
|
+
log2.error(`App directory not found: ${appDir}`);
|
|
9325
9638
|
return 1;
|
|
9326
9639
|
}
|
|
9327
9640
|
const providers = detectProvider(appDir);
|
|
@@ -9354,16 +9667,16 @@ async function main(options = {}) {
|
|
|
9354
9667
|
`Staging: ${config.hasStaging ? "yes" : "no"}`,
|
|
9355
9668
|
"",
|
|
9356
9669
|
`Workflows to generate:`,
|
|
9357
|
-
...workflows.map((
|
|
9670
|
+
...workflows.map((w) => ` - ${w}`),
|
|
9358
9671
|
"",
|
|
9359
9672
|
`Secrets to upload (${secrets.length}):`,
|
|
9360
9673
|
...secrets.map(
|
|
9361
9674
|
(s2) => ` ${s2.source === "MISSING" ? "(!) " : ""}${s2.name} \u2014 ${s2.source}`
|
|
9362
9675
|
)
|
|
9363
9676
|
];
|
|
9364
|
-
|
|
9677
|
+
note(planLines.join("\n"), "CI/CD Plan");
|
|
9365
9678
|
if (missingSecrets.length > 0) {
|
|
9366
|
-
|
|
9679
|
+
log2.warn(
|
|
9367
9680
|
`Missing secrets: ${missingSecrets.map((s2) => s2.name).join(", ")}
|
|
9368
9681
|
These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
9369
9682
|
);
|
|
@@ -9371,11 +9684,11 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
9371
9684
|
if (!dryRun) {
|
|
9372
9685
|
const confirmed = await askForConfirmation("Proceed with CI/CD setup?");
|
|
9373
9686
|
if (!confirmed) {
|
|
9374
|
-
|
|
9687
|
+
outro("Setup cancelled");
|
|
9375
9688
|
return 0;
|
|
9376
9689
|
}
|
|
9377
9690
|
}
|
|
9378
|
-
const s =
|
|
9691
|
+
const s = spinner();
|
|
9379
9692
|
const uploadableSecrets = secrets.filter(
|
|
9380
9693
|
(sec) => sec.value !== "" && sec.source !== "MISSING" && !sec.value.startsWith("__SERVICE_ACCOUNT")
|
|
9381
9694
|
);
|
|
@@ -9389,7 +9702,7 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
9389
9702
|
successCount++;
|
|
9390
9703
|
} catch (err) {
|
|
9391
9704
|
failCount++;
|
|
9392
|
-
|
|
9705
|
+
log2.error(
|
|
9393
9706
|
`Failed: ${sec.name} \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
9394
9707
|
);
|
|
9395
9708
|
}
|
|
@@ -9423,23 +9736,23 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
9423
9736
|
stagingYaml = generateStagingWorkflow(providers, secretNames);
|
|
9424
9737
|
}
|
|
9425
9738
|
if (dryRun) {
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9739
|
+
log2.info("\n--- ci.yml ---");
|
|
9740
|
+
log2.info(ciYaml);
|
|
9741
|
+
log2.info("\n--- deploy.yml ---");
|
|
9742
|
+
log2.info(deployYaml);
|
|
9430
9743
|
if (stagingYaml) {
|
|
9431
|
-
|
|
9432
|
-
|
|
9744
|
+
log2.info("\n--- deploy-staging.yml ---");
|
|
9745
|
+
log2.info(stagingYaml);
|
|
9433
9746
|
}
|
|
9434
9747
|
} else {
|
|
9435
9748
|
ensureDir(workflowDir);
|
|
9436
9749
|
write(joinPath(workflowDir, "ci.yml"), ciYaml);
|
|
9437
|
-
|
|
9750
|
+
log2.success("Generated .github/workflows/ci.yml");
|
|
9438
9751
|
write(joinPath(workflowDir, "deploy.yml"), deployYaml);
|
|
9439
|
-
|
|
9752
|
+
log2.success("Generated .github/workflows/deploy.yml");
|
|
9440
9753
|
if (stagingYaml) {
|
|
9441
9754
|
write(joinPath(workflowDir, "deploy-staging.yml"), stagingYaml);
|
|
9442
|
-
|
|
9755
|
+
log2.success("Generated .github/workflows/deploy-staging.yml");
|
|
9443
9756
|
}
|
|
9444
9757
|
}
|
|
9445
9758
|
const nextSteps = [
|
|
@@ -9456,8 +9769,8 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
9456
9769
|
"Add GH_PAT to .dndev.secrets (needed for private dndev checkout in CI)"
|
|
9457
9770
|
);
|
|
9458
9771
|
}
|
|
9459
|
-
|
|
9460
|
-
|
|
9772
|
+
note(nextSteps.map((s2, i2) => `${i2 + 1}. ${s2}`).join("\n"), "Next Steps");
|
|
9773
|
+
outro(dryRun ? "CI/CD setup preview complete!" : "CI/CD setup complete!");
|
|
9461
9774
|
return 0;
|
|
9462
9775
|
}
|
|
9463
9776
|
export {
|