@donotdev/cli 0.1.45 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dependencies-matrix.json +191 -150
- package/dist/bin/commands/agent-setup.js +632 -524
- package/dist/bin/commands/build.js +1239 -935
- package/dist/bin/commands/bump.js +1285 -946
- package/dist/bin/commands/cacheout.js +543 -405
- package/dist/bin/commands/coach.js +546 -408
- package/dist/bin/commands/create-app.js +1198 -862
- package/dist/bin/commands/create-project.js +1238 -902
- package/dist/bin/commands/db.js +139128 -93775
- package/dist/bin/commands/deploy.js +2308 -1936
- package/dist/bin/commands/dev.js +912 -662
- package/dist/bin/commands/doctor.js +634 -526
- package/dist/bin/commands/emu.js +1093 -785
- package/dist/bin/commands/format.js +588 -450
- package/dist/bin/commands/get-demo.js +1043 -756
- package/dist/bin/commands/make-admin.js +20974 -38424
- package/dist/bin/commands/preview.js +913 -663
- package/dist/bin/commands/seed.js +139129 -93776
- package/dist/bin/commands/setup-cicd.js +1130 -817
- package/dist/bin/commands/setup.js +1299 -960
- package/dist/bin/commands/staging.js +2308 -1936
- package/dist/bin/commands/sync-secrets.js +996 -733
- package/dist/bin/commands/type-check.js +733 -598
- package/dist/bin/commands/wai.js +533 -395
- package/dist/bin/dndev.js +9 -8
- package/dist/index.js +2720 -2290
- package/package.json +3 -3
- package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
- package/templates/app-next/src/app/layout.tsx.example +19 -1
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
- package/templates/functions-firebase/src/billing/index.ts.example +0 -1
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
- package/templates/functions-firebase/src/index.ts.example +0 -1
- package/templates/functions-supabase/supabase/config.toml.example +4 -0
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
- package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
- package/templates/functions-vercel/.env.example +9 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
- package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
- package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
- package/templates/root-consumer/.claude/settings.json.example +11 -1
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
- package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
|
@@ -5,16 +5,25 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (
|
|
8
|
+
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
18
27
|
};
|
|
19
28
|
var __export = (target, all) => {
|
|
20
29
|
for (var name in all)
|
|
@@ -37,31 +46,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
46
|
mod
|
|
38
47
|
));
|
|
39
48
|
|
|
40
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
41
|
-
var
|
|
49
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
50
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
42
51
|
var init_utils = __esm({
|
|
43
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
52
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
44
53
|
init_utils2();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
55
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
56
|
+
return (input) => {
|
|
57
|
+
let surrogatePairsNr = 0;
|
|
58
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
59
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
60
|
+
surrogatePairsNr += 1;
|
|
61
|
+
}
|
|
62
|
+
return input.length - surrogatePairsNr;
|
|
63
|
+
};
|
|
64
|
+
})();
|
|
48
65
|
isFullWidth = (x) => {
|
|
49
66
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
50
67
|
};
|
|
51
|
-
|
|
52
|
-
return x
|
|
68
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
69
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
53
70
|
};
|
|
54
71
|
}
|
|
55
72
|
});
|
|
56
73
|
|
|
57
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
58
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
74
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
75
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
59
76
|
var init_dist = __esm({
|
|
60
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
77
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
61
78
|
init_utils2();
|
|
62
79
|
init_utils();
|
|
63
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
80
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
64
81
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
82
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
65
83
|
TAB_RE = /\t{1,1000}/y;
|
|
66
84
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
67
85
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -71,14 +89,21 @@ var init_dist = __esm({
|
|
|
71
89
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
72
90
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
73
91
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
74
|
-
const ANSI_WIDTH =
|
|
92
|
+
const ANSI_WIDTH = 0;
|
|
75
93
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
76
94
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
77
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
78
95
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
79
|
-
const FULL_WIDTH_WIDTH =
|
|
96
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
80
97
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
81
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
98
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
99
|
+
const PARSE_BLOCKS = [
|
|
100
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
101
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
102
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
103
|
+
[TAB_RE, TAB_WIDTH],
|
|
104
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
105
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
106
|
+
];
|
|
82
107
|
let indexPrev = 0;
|
|
83
108
|
let index = 0;
|
|
84
109
|
let length = input.length;
|
|
@@ -98,10 +123,8 @@ var init_dist = __esm({
|
|
|
98
123
|
const codePoint = char.codePointAt(0) || 0;
|
|
99
124
|
if (isFullWidth(codePoint)) {
|
|
100
125
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
101
|
-
} else if (
|
|
126
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
102
127
|
widthExtra = WIDE_WIDTH;
|
|
103
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
104
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
105
128
|
} else {
|
|
106
129
|
widthExtra = REGULAR_WIDTH;
|
|
107
130
|
}
|
|
@@ -117,88 +140,28 @@ var init_dist = __esm({
|
|
|
117
140
|
}
|
|
118
141
|
unmatchedStart = unmatchedEnd = 0;
|
|
119
142
|
}
|
|
120
|
-
if (index >= length)
|
|
121
|
-
break;
|
|
122
|
-
LATIN_RE.lastIndex = index;
|
|
123
|
-
if (LATIN_RE.test(input)) {
|
|
124
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
125
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
126
|
-
if (width + widthExtra > truncationLimit) {
|
|
127
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
128
|
-
}
|
|
129
|
-
if (width + widthExtra > LIMIT) {
|
|
130
|
-
truncationEnabled = true;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
width += widthExtra;
|
|
134
|
-
unmatchedStart = indexPrev;
|
|
135
|
-
unmatchedEnd = index;
|
|
136
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
ANSI_RE.lastIndex = index;
|
|
140
|
-
if (ANSI_RE.test(input)) {
|
|
141
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
142
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
143
|
-
}
|
|
144
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
145
|
-
truncationEnabled = true;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
width += ANSI_WIDTH;
|
|
149
|
-
unmatchedStart = indexPrev;
|
|
150
|
-
unmatchedEnd = index;
|
|
151
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
152
|
-
continue;
|
|
143
|
+
if (index >= length) {
|
|
144
|
+
break outer;
|
|
153
145
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (TAB_RE.test(input)) {
|
|
173
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
174
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
175
|
-
if (width + widthExtra > truncationLimit) {
|
|
176
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
177
|
-
}
|
|
178
|
-
if (width + widthExtra > LIMIT) {
|
|
179
|
-
truncationEnabled = true;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
width += widthExtra;
|
|
183
|
-
unmatchedStart = indexPrev;
|
|
184
|
-
unmatchedEnd = index;
|
|
185
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
EMOJI_RE.lastIndex = index;
|
|
189
|
-
if (EMOJI_RE.test(input)) {
|
|
190
|
-
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
191
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
192
|
-
}
|
|
193
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
194
|
-
truncationEnabled = true;
|
|
195
|
-
break;
|
|
146
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
147
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
148
|
+
BLOCK_RE.lastIndex = index;
|
|
149
|
+
if (BLOCK_RE.test(input)) {
|
|
150
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
151
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
152
|
+
if (width + widthExtra > truncationLimit) {
|
|
153
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
154
|
+
}
|
|
155
|
+
if (width + widthExtra > LIMIT) {
|
|
156
|
+
truncationEnabled = true;
|
|
157
|
+
break outer;
|
|
158
|
+
}
|
|
159
|
+
width += widthExtra;
|
|
160
|
+
unmatchedStart = indexPrev;
|
|
161
|
+
unmatchedEnd = index;
|
|
162
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
163
|
+
continue outer;
|
|
196
164
|
}
|
|
197
|
-
width += EMOJI_WIDTH;
|
|
198
|
-
unmatchedStart = indexPrev;
|
|
199
|
-
unmatchedEnd = index;
|
|
200
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
201
|
-
continue;
|
|
202
165
|
}
|
|
203
166
|
index += 1;
|
|
204
167
|
}
|
|
@@ -213,10 +176,10 @@ var init_dist = __esm({
|
|
|
213
176
|
}
|
|
214
177
|
});
|
|
215
178
|
|
|
216
|
-
// node_modules/.bun/fast-string-width@
|
|
179
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
217
180
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
218
181
|
var init_dist2 = __esm({
|
|
219
|
-
"node_modules/.bun/fast-string-width@
|
|
182
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
220
183
|
init_utils2();
|
|
221
184
|
init_dist();
|
|
222
185
|
NO_TRUNCATION2 = {
|
|
@@ -231,13 +194,13 @@ var init_dist2 = __esm({
|
|
|
231
194
|
}
|
|
232
195
|
});
|
|
233
196
|
|
|
234
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
197
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
235
198
|
function wrapAnsi(string, columns, options) {
|
|
236
199
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
237
200
|
}
|
|
238
201
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
239
202
|
var init_main = __esm({
|
|
240
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
203
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
241
204
|
init_utils2();
|
|
242
205
|
init_dist2();
|
|
243
206
|
ESC = "\x1B";
|
|
@@ -401,16 +364,19 @@ var init_main = __esm({
|
|
|
401
364
|
}
|
|
402
365
|
const preString = rows.join("\n");
|
|
403
366
|
let inSurrogate = false;
|
|
404
|
-
for (let
|
|
405
|
-
const character = preString[
|
|
367
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
368
|
+
const character = preString[i2];
|
|
406
369
|
returnValue += character;
|
|
407
370
|
if (!inSurrogate) {
|
|
408
371
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
372
|
+
if (inSurrogate) {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
409
375
|
} else {
|
|
410
|
-
|
|
376
|
+
inSurrogate = false;
|
|
411
377
|
}
|
|
412
378
|
if (character === ESC || character === CSI) {
|
|
413
|
-
GROUP_REGEX.lastIndex =
|
|
379
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
414
380
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
415
381
|
const groups = groupsResult?.groups;
|
|
416
382
|
if (groups?.code !== void 0) {
|
|
@@ -420,7 +386,7 @@ var init_main = __esm({
|
|
|
420
386
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
421
387
|
}
|
|
422
388
|
}
|
|
423
|
-
if (preString[
|
|
389
|
+
if (preString[i2 + 1] === "\n") {
|
|
424
390
|
if (escapeUrl) {
|
|
425
391
|
returnValue += wrapAnsiHyperlink("");
|
|
426
392
|
}
|
|
@@ -451,7 +417,7 @@ var require_src = __commonJS({
|
|
|
451
417
|
var ESC2 = "\x1B";
|
|
452
418
|
var CSI2 = `${ESC2}[`;
|
|
453
419
|
var beep = "\x07";
|
|
454
|
-
var
|
|
420
|
+
var cursor3 = {
|
|
455
421
|
to(x, y2) {
|
|
456
422
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
457
423
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -480,7 +446,7 @@ var require_src = __commonJS({
|
|
|
480
446
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
481
447
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
482
448
|
};
|
|
483
|
-
var
|
|
449
|
+
var erase3 = {
|
|
484
450
|
screen: `${CSI2}2J`,
|
|
485
451
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
486
452
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -489,89 +455,169 @@ var require_src = __commonJS({
|
|
|
489
455
|
lineStart: `${CSI2}1K`,
|
|
490
456
|
lines(count) {
|
|
491
457
|
let clear = "";
|
|
492
|
-
for (let
|
|
493
|
-
clear += this.line + (
|
|
458
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
459
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
494
460
|
if (count)
|
|
495
|
-
clear +=
|
|
461
|
+
clear += cursor3.left;
|
|
496
462
|
return clear;
|
|
497
463
|
}
|
|
498
464
|
};
|
|
499
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
465
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
500
466
|
}
|
|
501
467
|
});
|
|
502
468
|
|
|
503
|
-
// node_modules/.bun/@clack+core@1.
|
|
504
|
-
import { styleText
|
|
505
|
-
import { stdout
|
|
506
|
-
import * as
|
|
507
|
-
import
|
|
508
|
-
import { ReadStream
|
|
509
|
-
function
|
|
510
|
-
if (!
|
|
511
|
-
|
|
512
|
-
|
|
469
|
+
// node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
470
|
+
import { styleText } from "node:util";
|
|
471
|
+
import { stdout, stdin } from "node:process";
|
|
472
|
+
import * as l from "node:readline";
|
|
473
|
+
import l__default from "node:readline";
|
|
474
|
+
import { ReadStream } from "node:tty";
|
|
475
|
+
function findCursor(s, o, l2) {
|
|
476
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
477
|
+
return s;
|
|
478
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
479
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
513
480
|
}
|
|
514
|
-
function
|
|
515
|
-
if (
|
|
516
|
-
|
|
481
|
+
function isAccessible(n3) {
|
|
482
|
+
if (n3 !== void 0) return n3;
|
|
483
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
484
|
+
const e = process.env.ACCESSIBLE;
|
|
485
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
486
|
+
}
|
|
487
|
+
function isActionKey(n3, e) {
|
|
488
|
+
if (typeof n3 == "string")
|
|
489
|
+
return settings.aliases.get(n3) === e;
|
|
490
|
+
for (const s of n3)
|
|
491
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
492
|
+
return true;
|
|
517
493
|
return false;
|
|
518
494
|
}
|
|
519
|
-
function
|
|
520
|
-
if (
|
|
521
|
-
const e =
|
|
522
|
-
`),
|
|
523
|
-
`),
|
|
524
|
-
for (let
|
|
525
|
-
|
|
495
|
+
function diffLines(i2, s) {
|
|
496
|
+
if (i2 === s) return;
|
|
497
|
+
const e = i2.split(`
|
|
498
|
+
`), t2 = s.split(`
|
|
499
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
500
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
501
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
502
|
+
return {
|
|
503
|
+
lines: f,
|
|
504
|
+
numLinesBefore: e.length,
|
|
505
|
+
numLinesAfter: t2.length,
|
|
506
|
+
numLines: r2
|
|
507
|
+
};
|
|
526
508
|
}
|
|
527
|
-
function
|
|
528
|
-
return
|
|
509
|
+
function isCancel(e) {
|
|
510
|
+
return e === CANCEL_SYMBOL;
|
|
529
511
|
}
|
|
530
|
-
function
|
|
531
|
-
const
|
|
532
|
-
|
|
512
|
+
function setRawMode(e, r2) {
|
|
513
|
+
const o = e;
|
|
514
|
+
o.isTTY && o.setRawMode(r2);
|
|
533
515
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
516
|
+
function block({
|
|
517
|
+
input: e = stdin,
|
|
518
|
+
output: r2 = stdout,
|
|
519
|
+
overwrite: o = true,
|
|
520
|
+
hideCursor: n3 = true
|
|
521
|
+
} = {}) {
|
|
522
|
+
const s = l.createInterface({
|
|
523
|
+
input: e,
|
|
524
|
+
output: r2,
|
|
525
|
+
prompt: "",
|
|
526
|
+
tabSize: 1
|
|
527
|
+
});
|
|
528
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
529
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
530
|
+
const c2 = String(f);
|
|
531
|
+
if (isActionKey([c2, a2, w], "cancel")) {
|
|
532
|
+
n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
541
533
|
return;
|
|
542
534
|
}
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
535
|
+
if (!o) return;
|
|
536
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
537
|
+
l.moveCursor(r2, i2, m, () => {
|
|
538
|
+
l.clearLine(r2, 1, () => {
|
|
539
|
+
e.once("keypress", t2);
|
|
548
540
|
});
|
|
549
541
|
});
|
|
550
542
|
};
|
|
551
|
-
return
|
|
552
|
-
|
|
543
|
+
return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
544
|
+
e.off("keypress", t2), n3 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
553
545
|
};
|
|
554
546
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
return wrapAnsi(
|
|
558
|
-
|
|
547
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
548
|
+
const f = getColumns(e ?? stdout);
|
|
549
|
+
return wrapAnsi(r2, f - o.length, {
|
|
550
|
+
hard: true,
|
|
551
|
+
trim: false
|
|
552
|
+
}).split(`
|
|
553
|
+
`).map((c2, i2, m) => {
|
|
554
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
555
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
556
|
+
}).join(`
|
|
559
557
|
`);
|
|
560
558
|
}
|
|
561
|
-
|
|
559
|
+
function runValidation(e, a2) {
|
|
560
|
+
if ("~standard" in e) {
|
|
561
|
+
const n3 = e["~standard"].validate(a2);
|
|
562
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
563
|
+
}
|
|
564
|
+
return e(a2);
|
|
565
|
+
}
|
|
566
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1, n2;
|
|
562
567
|
var init_dist3 = __esm({
|
|
563
|
-
"node_modules/.bun/@clack+core@1.
|
|
568
|
+
"node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
|
|
564
569
|
init_utils2();
|
|
565
570
|
init_main();
|
|
566
571
|
import_sisteransi = __toESM(require_src(), 1);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
572
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
573
|
+
t = [
|
|
574
|
+
"January",
|
|
575
|
+
"February",
|
|
576
|
+
"March",
|
|
577
|
+
"April",
|
|
578
|
+
"May",
|
|
579
|
+
"June",
|
|
580
|
+
"July",
|
|
581
|
+
"August",
|
|
582
|
+
"September",
|
|
583
|
+
"October",
|
|
584
|
+
"November",
|
|
585
|
+
"December"
|
|
586
|
+
];
|
|
587
|
+
settings = {
|
|
588
|
+
actions: new Set(a$1),
|
|
589
|
+
aliases: /* @__PURE__ */ new Map([
|
|
590
|
+
// vim support
|
|
591
|
+
["k", "up"],
|
|
592
|
+
["j", "down"],
|
|
593
|
+
["h", "left"],
|
|
594
|
+
["l", "right"],
|
|
595
|
+
["", "cancel"],
|
|
596
|
+
// opinionated defaults!
|
|
597
|
+
["escape", "cancel"]
|
|
598
|
+
]),
|
|
599
|
+
messages: {
|
|
600
|
+
cancel: "Canceled",
|
|
601
|
+
error: "Something went wrong"
|
|
602
|
+
},
|
|
603
|
+
withGuide: true,
|
|
604
|
+
accessible: void 0,
|
|
605
|
+
date: {
|
|
606
|
+
monthNames: [...t],
|
|
607
|
+
messages: {
|
|
608
|
+
required: "Please enter a valid date",
|
|
609
|
+
invalidMonth: "There are only 12 months in a year",
|
|
610
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
611
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
612
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
R = globalThis.process.platform.startsWith("win");
|
|
617
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
618
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
619
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
620
|
+
y = class {
|
|
575
621
|
input;
|
|
576
622
|
output;
|
|
577
623
|
_abortSignal;
|
|
@@ -586,46 +632,92 @@ var init_dist3 = __esm({
|
|
|
586
632
|
error = "";
|
|
587
633
|
value;
|
|
588
634
|
userInput = "";
|
|
635
|
+
/**
|
|
636
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
637
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
638
|
+
* and the `ACCESSIBLE` env var.
|
|
639
|
+
*/
|
|
640
|
+
get accessible() {
|
|
641
|
+
return isAccessible(this.opts.accessible);
|
|
642
|
+
}
|
|
589
643
|
constructor(t2, e = true) {
|
|
590
|
-
const { input:
|
|
591
|
-
this.opts =
|
|
644
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
645
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
592
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Unsubscribe all listeners
|
|
649
|
+
*/
|
|
593
650
|
unsubscribe() {
|
|
594
651
|
this._subscribers.clear();
|
|
595
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* Set a subscriber with opts
|
|
655
|
+
* @param event - The event name
|
|
656
|
+
*/
|
|
596
657
|
setSubscriber(t2, e) {
|
|
597
|
-
const
|
|
598
|
-
|
|
658
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
659
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
599
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Subscribe to an event
|
|
663
|
+
* @param event - The event name
|
|
664
|
+
* @param cb - The callback
|
|
665
|
+
*/
|
|
600
666
|
on(t2, e) {
|
|
601
667
|
this.setSubscriber(t2, { cb: e });
|
|
602
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* Subscribe to an event once
|
|
671
|
+
* @param event - The event name
|
|
672
|
+
* @param cb - The callback
|
|
673
|
+
*/
|
|
603
674
|
once(t2, e) {
|
|
604
675
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
605
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Emit an event with data
|
|
679
|
+
* @param event - The event name
|
|
680
|
+
* @param data - The data to pass to the callback
|
|
681
|
+
*/
|
|
606
682
|
emit(t2, ...e) {
|
|
607
|
-
const
|
|
608
|
-
for (const
|
|
609
|
-
|
|
683
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
684
|
+
for (const r2 of i2)
|
|
685
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
686
|
+
for (const r2 of s)
|
|
687
|
+
r2();
|
|
610
688
|
}
|
|
611
689
|
prompt() {
|
|
612
690
|
return new Promise((t2) => {
|
|
613
691
|
if (this._abortSignal) {
|
|
614
|
-
if (this._abortSignal.aborted)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
692
|
+
if (this._abortSignal.aborted)
|
|
693
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
694
|
+
this._abortSignal.addEventListener(
|
|
695
|
+
"abort",
|
|
696
|
+
() => {
|
|
697
|
+
this.state = "cancel", this.close();
|
|
698
|
+
},
|
|
699
|
+
{ once: true }
|
|
700
|
+
);
|
|
618
701
|
}
|
|
619
|
-
this.rl =
|
|
620
|
-
|
|
702
|
+
this.rl = l__default.createInterface({
|
|
703
|
+
input: this.input,
|
|
704
|
+
tabSize: 2,
|
|
705
|
+
prompt: "",
|
|
706
|
+
escapeCodeTimeout: 50,
|
|
707
|
+
terminal: true
|
|
708
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
709
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
621
710
|
}), this.once("cancel", () => {
|
|
622
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
711
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
623
712
|
});
|
|
624
713
|
});
|
|
625
714
|
}
|
|
626
715
|
_isActionKey(t2, e) {
|
|
627
716
|
return t2 === " ";
|
|
628
717
|
}
|
|
718
|
+
_shouldSubmit(t2, e) {
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
629
721
|
_setValue(t2) {
|
|
630
722
|
this.value = t2, this.emit("value", this.value);
|
|
631
723
|
}
|
|
@@ -635,19 +727,22 @@ var init_dist3 = __esm({
|
|
|
635
727
|
_clearUserInput() {
|
|
636
728
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
637
729
|
}
|
|
638
|
-
onKeypress(t2, e) {
|
|
639
|
-
if (this.
|
|
640
|
-
if (this.
|
|
641
|
-
|
|
642
|
-
|
|
730
|
+
async onKeypress(t2, e) {
|
|
731
|
+
if (this.state !== "validating") {
|
|
732
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
733
|
+
if (this.opts.validate) {
|
|
734
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
735
|
+
let s;
|
|
736
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
737
|
+
}
|
|
738
|
+
this.state !== "error" && (this.state = "submit");
|
|
643
739
|
}
|
|
644
|
-
this.state
|
|
740
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
645
741
|
}
|
|
646
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
647
742
|
}
|
|
648
743
|
close() {
|
|
649
744
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
650
|
-
`),
|
|
745
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
651
746
|
}
|
|
652
747
|
restoreCursor() {
|
|
653
748
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -655,34 +750,39 @@ var init_dist3 = __esm({
|
|
|
655
750
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
656
751
|
}
|
|
657
752
|
render() {
|
|
658
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
753
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
754
|
+
hard: true,
|
|
755
|
+
trim: false
|
|
756
|
+
});
|
|
659
757
|
if (t2 !== this._prevFrame) {
|
|
660
|
-
if (this.state === "initial")
|
|
758
|
+
if (this.state === "initial")
|
|
759
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
661
760
|
else {
|
|
662
|
-
const e =
|
|
761
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
663
762
|
if (this.restoreCursor(), e) {
|
|
664
|
-
const
|
|
665
|
-
let
|
|
666
|
-
if (
|
|
763
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
764
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
765
|
+
if (n3 === void 0) {
|
|
667
766
|
this._prevFrame = t2;
|
|
668
767
|
return;
|
|
669
768
|
}
|
|
670
769
|
if (e.lines.length === 1) {
|
|
671
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
672
|
-
const
|
|
770
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
771
|
+
const o = t2.split(`
|
|
673
772
|
`);
|
|
674
|
-
this.output.write(
|
|
773
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
675
774
|
return;
|
|
676
775
|
} else if (e.lines.length > 1) {
|
|
677
|
-
if (
|
|
776
|
+
if (s < r2)
|
|
777
|
+
n3 = s;
|
|
678
778
|
else {
|
|
679
|
-
const
|
|
680
|
-
|
|
779
|
+
const h2 = n3 - r2;
|
|
780
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
681
781
|
}
|
|
682
782
|
this.output.write(import_sisteransi.erase.down());
|
|
683
|
-
const
|
|
684
|
-
`).slice(
|
|
685
|
-
this.output.write(
|
|
783
|
+
const f = t2.split(`
|
|
784
|
+
`).slice(n3);
|
|
785
|
+
this.output.write(f.join(`
|
|
686
786
|
`)), this._prevFrame = t2;
|
|
687
787
|
return;
|
|
688
788
|
}
|
|
@@ -693,7 +793,7 @@ var init_dist3 = __esm({
|
|
|
693
793
|
}
|
|
694
794
|
}
|
|
695
795
|
};
|
|
696
|
-
|
|
796
|
+
r = class extends y {
|
|
697
797
|
get cursor() {
|
|
698
798
|
return this.value ? 0 : 1;
|
|
699
799
|
}
|
|
@@ -703,54 +803,60 @@ var init_dist3 = __esm({
|
|
|
703
803
|
constructor(t2) {
|
|
704
804
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
705
805
|
this.value = this._value;
|
|
706
|
-
}), this.on("confirm", (
|
|
707
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
806
|
+
}), this.on("confirm", (i2) => {
|
|
807
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
708
808
|
}), this.on("cursor", () => {
|
|
709
809
|
this.value = !this.value;
|
|
710
810
|
});
|
|
711
811
|
}
|
|
712
812
|
};
|
|
713
|
-
|
|
813
|
+
n$1 = class n extends y {
|
|
714
814
|
options;
|
|
715
815
|
cursor = 0;
|
|
716
816
|
get _selectedValue() {
|
|
717
817
|
return this.options[this.cursor];
|
|
718
818
|
}
|
|
719
819
|
changeValue() {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
820
|
+
const e = this._selectedValue;
|
|
821
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
822
|
+
}
|
|
823
|
+
constructor(e) {
|
|
824
|
+
super(e, false), this.options = e.options;
|
|
825
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
826
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
827
|
+
switch (s) {
|
|
727
828
|
case "left":
|
|
728
829
|
case "up":
|
|
729
|
-
this.cursor =
|
|
830
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
730
831
|
break;
|
|
731
832
|
case "down":
|
|
732
833
|
case "right":
|
|
733
|
-
this.cursor =
|
|
834
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
734
835
|
break;
|
|
735
836
|
}
|
|
736
837
|
this.changeValue();
|
|
737
838
|
});
|
|
738
839
|
}
|
|
739
840
|
};
|
|
740
|
-
|
|
841
|
+
n2 = class extends y {
|
|
741
842
|
get userInputWithCursor() {
|
|
742
|
-
if (this.state === "submit")
|
|
843
|
+
if (this.state === "submit")
|
|
844
|
+
return this.userInput;
|
|
743
845
|
const t2 = this.userInput;
|
|
744
|
-
if (this.cursor >= t2.length)
|
|
745
|
-
|
|
746
|
-
|
|
846
|
+
if (this.cursor >= t2.length)
|
|
847
|
+
return `${this.userInput}\u2588`;
|
|
848
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
849
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
747
850
|
}
|
|
748
851
|
get cursor() {
|
|
749
852
|
return this._cursor;
|
|
750
853
|
}
|
|
751
854
|
constructor(t2) {
|
|
752
|
-
super({
|
|
753
|
-
|
|
855
|
+
super({
|
|
856
|
+
...t2,
|
|
857
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
858
|
+
}), this.on("userInput", (r2) => {
|
|
859
|
+
this._setValue(r2);
|
|
754
860
|
}), this.on("finalize", () => {
|
|
755
861
|
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
756
862
|
});
|
|
@@ -759,328 +865,503 @@ var init_dist3 = __esm({
|
|
|
759
865
|
}
|
|
760
866
|
});
|
|
761
867
|
|
|
762
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
763
|
-
import { styleText as
|
|
764
|
-
import
|
|
765
|
-
import { existsSync
|
|
766
|
-
import { dirname
|
|
767
|
-
function
|
|
768
|
-
|
|
868
|
+
// node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
869
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
870
|
+
import process$1 from "node:process";
|
|
871
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
872
|
+
import { dirname, join } from "node:path";
|
|
873
|
+
function isUnicodeSupported() {
|
|
874
|
+
if (process$1.platform !== "win32") {
|
|
875
|
+
return process$1.env.TERM !== "linux";
|
|
876
|
+
}
|
|
877
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
769
878
|
}
|
|
770
|
-
|
|
879
|
+
function formatInstructionFooter(o, e) {
|
|
880
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
881
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
882
|
+
}
|
|
883
|
+
var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
|
|
771
884
|
var init_dist4 = __esm({
|
|
772
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
885
|
+
"node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
773
886
|
init_utils2();
|
|
774
887
|
init_dist3();
|
|
775
888
|
init_dist3();
|
|
776
889
|
init_main();
|
|
777
890
|
init_dist2();
|
|
778
891
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
switch (
|
|
892
|
+
unicode = isUnicodeSupported();
|
|
893
|
+
isCI = () => process.env.CI === "true";
|
|
894
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
895
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
896
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
897
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
898
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
899
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
900
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
901
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
902
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
903
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
904
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
905
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
906
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
907
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
908
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
909
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
910
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
911
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
912
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
913
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
914
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
915
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
916
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
917
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
918
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
919
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
920
|
+
symbol = (o) => {
|
|
921
|
+
switch (o) {
|
|
809
922
|
case "initial":
|
|
810
923
|
case "active":
|
|
811
|
-
return
|
|
924
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
812
925
|
case "cancel":
|
|
813
|
-
return
|
|
926
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
814
927
|
case "error":
|
|
815
|
-
return
|
|
928
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
816
929
|
case "submit":
|
|
817
|
-
return
|
|
930
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
931
|
+
case "validating":
|
|
932
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
818
933
|
}
|
|
819
934
|
};
|
|
820
|
-
|
|
821
|
-
switch (
|
|
935
|
+
symbolBar = (o) => {
|
|
936
|
+
switch (o) {
|
|
822
937
|
case "initial":
|
|
823
938
|
case "active":
|
|
824
|
-
return
|
|
939
|
+
return styleText2("cyan", S_BAR);
|
|
825
940
|
case "cancel":
|
|
826
|
-
return
|
|
941
|
+
return styleText2("red", S_BAR);
|
|
827
942
|
case "error":
|
|
828
|
-
return
|
|
943
|
+
return styleText2("yellow", S_BAR);
|
|
829
944
|
case "submit":
|
|
830
|
-
return
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
let
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
945
|
+
return styleText2("green", S_BAR);
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
I = (l2, e, w, p, b, C2 = false) => {
|
|
949
|
+
let r2 = e, O = 0;
|
|
950
|
+
if (C2)
|
|
951
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
952
|
+
const m = l2[i2];
|
|
953
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
954
|
+
}
|
|
955
|
+
else
|
|
956
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
957
|
+
const m = l2[i2];
|
|
958
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
959
|
+
}
|
|
960
|
+
return { lineCount: r2, removals: O };
|
|
961
|
+
};
|
|
962
|
+
limitOptions = ({
|
|
963
|
+
cursor: l2,
|
|
964
|
+
options: e,
|
|
965
|
+
style: w,
|
|
966
|
+
output: p = process.stdout,
|
|
967
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
968
|
+
columnPadding: C2 = 0,
|
|
969
|
+
rowPadding: r2 = 4
|
|
970
|
+
}) => {
|
|
971
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
847
972
|
let f = 0;
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
973
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
974
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
975
|
+
0
|
|
976
|
+
));
|
|
977
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
978
|
+
const W2 = Math.min(
|
|
979
|
+
f + a2,
|
|
980
|
+
e.length
|
|
981
|
+
), s = [];
|
|
982
|
+
let g = 0;
|
|
983
|
+
d && g++, c2 && g++;
|
|
984
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
|
|
985
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
986
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
987
|
+
hard: true,
|
|
988
|
+
trim: false
|
|
989
|
+
}).split(`
|
|
852
990
|
`);
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
if (
|
|
856
|
-
let
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
991
|
+
s.push(h2), g += h2.length;
|
|
992
|
+
}
|
|
993
|
+
if (g > v) {
|
|
994
|
+
let t2 = 0, n3 = 0, o = g;
|
|
995
|
+
const h2 = l2 - T;
|
|
996
|
+
let u3 = v;
|
|
997
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
998
|
+
s,
|
|
999
|
+
o,
|
|
1000
|
+
h2 + 1,
|
|
1001
|
+
s.length,
|
|
1002
|
+
u3,
|
|
1003
|
+
true
|
|
1004
|
+
);
|
|
1005
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
1006
|
+
}
|
|
1007
|
+
const x = [];
|
|
1008
|
+
d && x.push(M);
|
|
1009
|
+
for (const t2 of s)
|
|
1010
|
+
for (const n3 of t2)
|
|
1011
|
+
x.push(n3);
|
|
1012
|
+
return c2 && x.push(M), x;
|
|
1013
|
+
};
|
|
1014
|
+
confirm = (e) => {
|
|
1015
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
1016
|
+
return new r({
|
|
1017
|
+
active: a2,
|
|
1018
|
+
inactive: o,
|
|
1019
|
+
signal: e.signal,
|
|
1020
|
+
input: e.input,
|
|
1021
|
+
output: e.output,
|
|
1022
|
+
initialValue: e.initialValue ?? true,
|
|
1023
|
+
render() {
|
|
1024
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1025
|
+
e.output,
|
|
1026
|
+
e.message,
|
|
1027
|
+
l2,
|
|
1028
|
+
u3
|
|
1029
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1030
|
+
` : ""}${f}
|
|
1031
|
+
`, c2 = this.value ? a2 : o;
|
|
1032
|
+
switch (this.state) {
|
|
1033
|
+
case "submit": {
|
|
1034
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1035
|
+
return `${s}${r2}${styleText2("dim", c2)}`;
|
|
1036
|
+
}
|
|
1037
|
+
case "cancel": {
|
|
1038
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1039
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
|
|
1040
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1041
|
+
}
|
|
1042
|
+
default: {
|
|
1043
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1044
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1045
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1046
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1047
|
+
${g}
|
|
887
1048
|
`;
|
|
1049
|
+
}
|
|
888
1050
|
}
|
|
889
1051
|
}
|
|
890
|
-
}
|
|
1052
|
+
}).prompt();
|
|
891
1053
|
};
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1054
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
1055
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1056
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1057
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1058
|
+
];
|
|
1059
|
+
log = {
|
|
1060
|
+
message: (s = [], {
|
|
1061
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1062
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1063
|
+
output: m = process.stdout,
|
|
1064
|
+
spacing: l2 = 1,
|
|
1065
|
+
withGuide: c2
|
|
1066
|
+
} = {}) => {
|
|
1067
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1068
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1069
|
+
t2.push(f);
|
|
1070
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
896
1071
|
`);
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1072
|
+
if (g.length > 0) {
|
|
1073
|
+
const [i2, ...y2] = g;
|
|
1074
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1075
|
+
for (const p of y2)
|
|
1076
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1077
|
+
}
|
|
1078
|
+
m.write(`${t2.join(`
|
|
903
1079
|
`)}
|
|
904
1080
|
`);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1081
|
+
},
|
|
1082
|
+
info: (s, e) => {
|
|
1083
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1084
|
+
},
|
|
1085
|
+
success: (s, e) => {
|
|
1086
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1087
|
+
},
|
|
1088
|
+
step: (s, e) => {
|
|
1089
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1090
|
+
},
|
|
1091
|
+
warn: (s, e) => {
|
|
1092
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1093
|
+
},
|
|
1094
|
+
/** alias for `log.warn()`. */
|
|
1095
|
+
warning: (s, e) => {
|
|
1096
|
+
log.warn(s, e);
|
|
1097
|
+
},
|
|
1098
|
+
error: (s, e) => {
|
|
1099
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
cancel = (o = "", t2) => {
|
|
1103
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1104
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
921
1105
|
|
|
922
1106
|
`);
|
|
923
1107
|
};
|
|
924
|
-
|
|
925
|
-
const
|
|
926
|
-
|
|
1108
|
+
intro = (o = "", t2) => {
|
|
1109
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1110
|
+
i2.write(`${e}${o}
|
|
927
1111
|
`);
|
|
928
1112
|
};
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
${
|
|
932
|
-
|
|
1113
|
+
outro = (o = "", t2) => {
|
|
1114
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1115
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1116
|
+
i2.write(`${e}${o}
|
|
933
1117
|
|
|
934
1118
|
`);
|
|
935
1119
|
};
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1120
|
+
W$1 = (o) => o;
|
|
1121
|
+
C = (o, e, s) => {
|
|
1122
|
+
const a2 = {
|
|
1123
|
+
hard: true,
|
|
1124
|
+
trim: false
|
|
1125
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1126
|
+
`), c2 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c2);
|
|
1127
|
+
return wrapAnsi(o, g, a2);
|
|
1128
|
+
};
|
|
1129
|
+
note = (o = "", e = "", s) => {
|
|
1130
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
|
|
1131
|
+
`).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1132
|
+
g.reduce((m, F) => {
|
|
1133
|
+
const O = dist_default2(F);
|
|
1134
|
+
return O > m ? O : m;
|
|
1135
|
+
}, 0),
|
|
1136
|
+
n3
|
|
1137
|
+
) + 2, h2 = g.map(
|
|
1138
|
+
(m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
|
|
1139
|
+
).join(`
|
|
1140
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1141
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1142
|
+
a2.write(
|
|
1143
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1144
|
+
"gray",
|
|
1145
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1146
|
+
)}
|
|
1147
|
+
${h2}
|
|
1148
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1149
|
+
`
|
|
1150
|
+
);
|
|
954
1151
|
};
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1152
|
+
W = (l2) => styleText2("magenta", l2);
|
|
1153
|
+
spinner = ({
|
|
1154
|
+
indicator: l2 = "dots",
|
|
1155
|
+
onCancel: h2,
|
|
1156
|
+
output: n3 = process.stdout,
|
|
1157
|
+
cancelMessage: G,
|
|
1158
|
+
errorMessage: O,
|
|
1159
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1160
|
+
delay: F = unicode ? 80 : 120,
|
|
1161
|
+
signal: m,
|
|
1162
|
+
...I2
|
|
1163
|
+
} = {}) => {
|
|
1164
|
+
const u3 = isCI();
|
|
1165
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1166
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1167
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1168
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1169
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1170
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
|
|
1171
|
+
}, H = () => {
|
|
1172
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
|
|
1173
|
+
}, y2 = () => {
|
|
1174
|
+
if (p === void 0) return;
|
|
1175
|
+
u3 && n3.write(`
|
|
969
1176
|
`);
|
|
970
|
-
const
|
|
1177
|
+
const r2 = wrapAnsi(p, x, {
|
|
1178
|
+
hard: true,
|
|
1179
|
+
trim: false
|
|
1180
|
+
}).split(`
|
|
971
1181
|
`);
|
|
972
|
-
|
|
973
|
-
},
|
|
974
|
-
const
|
|
975
|
-
return
|
|
976
|
-
},
|
|
977
|
-
|
|
1182
|
+
r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
|
|
1183
|
+
}, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1184
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1185
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1186
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1187
|
+
d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
978
1188
|
`);
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
if (
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1189
|
+
let r2 = 0, t2 = 0;
|
|
1190
|
+
A(), T = setInterval(() => {
|
|
1191
|
+
if (u3 && s === p)
|
|
1192
|
+
return;
|
|
1193
|
+
y2(), p = s;
|
|
1194
|
+
const o = k(E[r2]);
|
|
1195
|
+
let v;
|
|
1196
|
+
if (u3)
|
|
1197
|
+
v = `${o} ${s}...`;
|
|
1198
|
+
else if (l2 === "timer")
|
|
1199
|
+
v = `${o} ${s} ${_(w)}`;
|
|
987
1200
|
else {
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1201
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1202
|
+
v = `${o} ${s}${B}`;
|
|
1203
|
+
}
|
|
1204
|
+
const j = wrapAnsi(v, x, {
|
|
1205
|
+
hard: true,
|
|
1206
|
+
trim: false
|
|
1207
|
+
});
|
|
1208
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1209
|
+
}, F);
|
|
1210
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1211
|
+
if (!d) return;
|
|
1212
|
+
d = false, clearInterval(T), y2();
|
|
1213
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1214
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1215
|
+
`) : n3.write(`${o} ${s}
|
|
1216
|
+
`)), H(), M();
|
|
1001
1217
|
};
|
|
1002
|
-
return {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1218
|
+
return {
|
|
1219
|
+
start: P,
|
|
1220
|
+
stop: (e = "") => a2(e, 0),
|
|
1221
|
+
message: (e = "") => {
|
|
1222
|
+
s = C2(e ?? s);
|
|
1223
|
+
},
|
|
1224
|
+
cancel: (e = "") => a2(e, 1),
|
|
1225
|
+
error: (e = "") => a2(e, 2),
|
|
1226
|
+
clear: () => a2("", 0, true),
|
|
1227
|
+
get isCancelled() {
|
|
1228
|
+
return S;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
u2 = {
|
|
1233
|
+
light: unicodeOr("\u2500", "-"),
|
|
1234
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1235
|
+
block: unicodeOr("\u2588", "#")
|
|
1236
|
+
};
|
|
1237
|
+
SELECT_INSTRUCTIONS = [
|
|
1238
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1239
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1240
|
+
];
|
|
1241
|
+
c = (t2, o) => t2.includes(`
|
|
1242
|
+
`) ? t2.split(`
|
|
1243
|
+
`).map((d) => o(d)).join(`
|
|
1244
|
+
`) : o(t2);
|
|
1245
|
+
select = (t2) => {
|
|
1246
|
+
const o = (n3, m) => {
|
|
1247
|
+
if (n3 === void 0)
|
|
1248
|
+
return "";
|
|
1249
|
+
const s = n3.label ?? String(n3.value);
|
|
1250
|
+
switch (m) {
|
|
1017
1251
|
case "disabled":
|
|
1018
|
-
return `${
|
|
1252
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1019
1253
|
case "selected":
|
|
1020
|
-
return `${
|
|
1254
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1021
1255
|
case "active":
|
|
1022
|
-
return `${
|
|
1256
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1023
1257
|
case "cancelled":
|
|
1024
|
-
return `${
|
|
1258
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1025
1259
|
default:
|
|
1026
|
-
return `${
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
return new
|
|
1030
|
-
|
|
1031
|
-
|
|
1260
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1261
|
+
}
|
|
1262
|
+
}, d = t2.showInstructions ?? true;
|
|
1263
|
+
return new n$1({
|
|
1264
|
+
options: t2.options,
|
|
1265
|
+
signal: t2.signal,
|
|
1266
|
+
input: t2.input,
|
|
1267
|
+
output: t2.output,
|
|
1268
|
+
initialValue: t2.initialValue,
|
|
1269
|
+
render() {
|
|
1270
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1271
|
+
t2.output,
|
|
1272
|
+
t2.message,
|
|
1273
|
+
s,
|
|
1274
|
+
m
|
|
1275
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1276
|
+
` : ""}${i2}
|
|
1032
1277
|
`;
|
|
1278
|
+
switch (this.state) {
|
|
1279
|
+
case "submit": {
|
|
1280
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1281
|
+
t2.output,
|
|
1282
|
+
o(this.options[this.cursor], "selected"),
|
|
1283
|
+
r2
|
|
1284
|
+
);
|
|
1285
|
+
return `${u3}${a2}`;
|
|
1286
|
+
}
|
|
1287
|
+
case "cancel": {
|
|
1288
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1289
|
+
t2.output,
|
|
1290
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1291
|
+
r2
|
|
1292
|
+
);
|
|
1293
|
+
return `${u3}${a2}${n3 ? `
|
|
1294
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1295
|
+
}
|
|
1296
|
+
default: {
|
|
1297
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1298
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1299
|
+
`), b = p.length + 1;
|
|
1300
|
+
return `${u3}${r2}${limitOptions({
|
|
1301
|
+
output: t2.output,
|
|
1302
|
+
cursor: this.cursor,
|
|
1303
|
+
options: this.options,
|
|
1304
|
+
maxItems: t2.maxItems,
|
|
1305
|
+
columnPadding: r2.length,
|
|
1306
|
+
rowPadding: a2 + b,
|
|
1307
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1308
|
+
}).join(`
|
|
1309
|
+
${r2}`)}
|
|
1310
|
+
${f}
|
|
1311
|
+
`;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}).prompt();
|
|
1316
|
+
};
|
|
1317
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
1318
|
+
text = (t2) => new n2({
|
|
1319
|
+
validate: t2.validate,
|
|
1320
|
+
placeholder: t2.placeholder,
|
|
1321
|
+
defaultValue: t2.defaultValue,
|
|
1322
|
+
initialValue: t2.initialValue,
|
|
1323
|
+
output: t2.output,
|
|
1324
|
+
signal: t2.signal,
|
|
1325
|
+
input: t2.input,
|
|
1326
|
+
render() {
|
|
1327
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1328
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1329
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1330
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1331
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
1332
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1033
1333
|
switch (this.state) {
|
|
1334
|
+
case "validating": {
|
|
1335
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1336
|
+
return `${l2}${n3}${c2}
|
|
1337
|
+
${i2} ${$}
|
|
1338
|
+
`;
|
|
1339
|
+
}
|
|
1340
|
+
case "error": {
|
|
1341
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1342
|
+
return `${l2.trim()}
|
|
1343
|
+
${i2}${o}
|
|
1344
|
+
${c2}${n3}
|
|
1345
|
+
`;
|
|
1346
|
+
}
|
|
1034
1347
|
case "submit": {
|
|
1035
|
-
const
|
|
1036
|
-
return `${
|
|
1348
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1349
|
+
return `${l2}${i2}${n3}`;
|
|
1037
1350
|
}
|
|
1038
1351
|
case "cancel": {
|
|
1039
|
-
const
|
|
1040
|
-
return `${
|
|
1041
|
-
${
|
|
1352
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1353
|
+
return `${l2}${i2}${n3}${s.trim() ? `
|
|
1354
|
+
${i2}` : ""}`;
|
|
1042
1355
|
}
|
|
1043
1356
|
default: {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
${c2}`)}
|
|
1048
|
-
${a}
|
|
1357
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1358
|
+
return `${l2}${n3}${o}
|
|
1359
|
+
${i2}
|
|
1049
1360
|
`;
|
|
1050
1361
|
}
|
|
1051
1362
|
}
|
|
1052
|
-
} }).prompt();
|
|
1053
|
-
};
|
|
1054
|
-
je = `${t("gray", d2)} `;
|
|
1055
|
-
Ot = (e) => new at({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
|
|
1056
|
-
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${t("gray", d2)}
|
|
1057
|
-
` : ""}${V2(this.state)} `}${e.message}
|
|
1058
|
-
`, r = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1059
|
-
switch (this.state) {
|
|
1060
|
-
case "error": {
|
|
1061
|
-
const o = this.error ? ` ${t("yellow", this.error)}` : "", c2 = i ? `${t("yellow", d2)} ` : "", a = i ? t("yellow", E2) : "";
|
|
1062
|
-
return `${s.trim()}
|
|
1063
|
-
${c2}${u2}
|
|
1064
|
-
${a}${o}
|
|
1065
|
-
`;
|
|
1066
|
-
}
|
|
1067
|
-
case "submit": {
|
|
1068
|
-
const o = n ? ` ${t("dim", n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1069
|
-
return `${s}${c2}${o}`;
|
|
1070
|
-
}
|
|
1071
|
-
case "cancel": {
|
|
1072
|
-
const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1073
|
-
return `${s}${c2}${o}${n.trim() ? `
|
|
1074
|
-
${c2}` : ""}`;
|
|
1075
|
-
}
|
|
1076
|
-
default: {
|
|
1077
|
-
const o = i ? `${t("cyan", d2)} ` : "", c2 = i ? t("cyan", E2) : "";
|
|
1078
|
-
return `${s}${o}${u2}
|
|
1079
|
-
${c2}
|
|
1080
|
-
`;
|
|
1081
|
-
}
|
|
1082
1363
|
}
|
|
1083
|
-
}
|
|
1364
|
+
}).prompt();
|
|
1084
1365
|
}
|
|
1085
1366
|
});
|
|
1086
1367
|
|
|
@@ -1093,9 +1374,9 @@ function supportsColor() {
|
|
|
1093
1374
|
}
|
|
1094
1375
|
return process.stdout.isTTY === true;
|
|
1095
1376
|
}
|
|
1096
|
-
function colorize(
|
|
1097
|
-
if (!supportsColor()) return
|
|
1098
|
-
return `${color}${
|
|
1377
|
+
function colorize(text2, color) {
|
|
1378
|
+
if (!supportsColor()) return text2;
|
|
1379
|
+
return `${color}${text2}${colors.reset}`;
|
|
1099
1380
|
}
|
|
1100
1381
|
function stringify(value) {
|
|
1101
1382
|
if (typeof value === "string") return value;
|
|
@@ -1125,7 +1406,7 @@ function stringify(value) {
|
|
|
1125
1406
|
function formatMessage(...args) {
|
|
1126
1407
|
return args.map(stringify).join(" ");
|
|
1127
1408
|
}
|
|
1128
|
-
var colors, currentLogLevel,
|
|
1409
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
1129
1410
|
var init_cli_output = __esm({
|
|
1130
1411
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1131
1412
|
"use strict";
|
|
@@ -1158,7 +1439,7 @@ var init_cli_output = __esm({
|
|
|
1158
1439
|
currentLogLevel = envLevel;
|
|
1159
1440
|
}
|
|
1160
1441
|
}
|
|
1161
|
-
|
|
1442
|
+
log2 = {
|
|
1162
1443
|
/**
|
|
1163
1444
|
* Logs an error message (always shows unless Quiet level)
|
|
1164
1445
|
* Uses clack's log.error + explicit red color
|
|
@@ -1166,7 +1447,7 @@ var init_cli_output = __esm({
|
|
|
1166
1447
|
error(...args) {
|
|
1167
1448
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1168
1449
|
const message = formatMessage(...args);
|
|
1169
|
-
|
|
1450
|
+
log.error(colorize(message, colors.brightRed));
|
|
1170
1451
|
},
|
|
1171
1452
|
/**
|
|
1172
1453
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1175,7 +1456,7 @@ var init_cli_output = __esm({
|
|
|
1175
1456
|
warn(...args) {
|
|
1176
1457
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1177
1458
|
const message = formatMessage(...args);
|
|
1178
|
-
|
|
1459
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1179
1460
|
},
|
|
1180
1461
|
/**
|
|
1181
1462
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1184,7 +1465,7 @@ var init_cli_output = __esm({
|
|
|
1184
1465
|
info(...args) {
|
|
1185
1466
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1186
1467
|
const message = formatMessage(...args);
|
|
1187
|
-
|
|
1468
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1188
1469
|
},
|
|
1189
1470
|
/**
|
|
1190
1471
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1193,7 +1474,7 @@ var init_cli_output = __esm({
|
|
|
1193
1474
|
success(...args) {
|
|
1194
1475
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1195
1476
|
const message = formatMessage(...args);
|
|
1196
|
-
|
|
1477
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1197
1478
|
},
|
|
1198
1479
|
/**
|
|
1199
1480
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1202,7 +1483,7 @@ var init_cli_output = __esm({
|
|
|
1202
1483
|
debug(...args) {
|
|
1203
1484
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1204
1485
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1205
|
-
|
|
1486
|
+
log.message(
|
|
1206
1487
|
colorize(
|
|
1207
1488
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1208
1489
|
colors.gray
|
|
@@ -1216,7 +1497,7 @@ var init_cli_output = __esm({
|
|
|
1216
1497
|
trace(...args) {
|
|
1217
1498
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1218
1499
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1219
|
-
|
|
1500
|
+
log.message(
|
|
1220
1501
|
colorize(
|
|
1221
1502
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1222
1503
|
colors.gray
|
|
@@ -1224,10 +1505,10 @@ var init_cli_output = __esm({
|
|
|
1224
1505
|
);
|
|
1225
1506
|
}
|
|
1226
1507
|
};
|
|
1227
|
-
error =
|
|
1228
|
-
warn =
|
|
1229
|
-
info =
|
|
1230
|
-
success =
|
|
1508
|
+
error = log2.error.bind(log2);
|
|
1509
|
+
warn = log2.warn.bind(log2);
|
|
1510
|
+
info = log2.info.bind(log2);
|
|
1511
|
+
success = log2.success.bind(log2);
|
|
1231
1512
|
}
|
|
1232
1513
|
});
|
|
1233
1514
|
|
|
@@ -1594,9 +1875,9 @@ var require_is_glob = __commonJS({
|
|
|
1594
1875
|
index += 2;
|
|
1595
1876
|
var close = chars[open];
|
|
1596
1877
|
if (close) {
|
|
1597
|
-
var
|
|
1598
|
-
if (
|
|
1599
|
-
index =
|
|
1878
|
+
var n3 = str.indexOf(close, index);
|
|
1879
|
+
if (n3 !== -1) {
|
|
1880
|
+
index = n3 + 1;
|
|
1600
1881
|
}
|
|
1601
1882
|
}
|
|
1602
1883
|
if (str[index] === "!") {
|
|
@@ -1622,9 +1903,9 @@ var require_is_glob = __commonJS({
|
|
|
1622
1903
|
index += 2;
|
|
1623
1904
|
var close = chars[open];
|
|
1624
1905
|
if (close) {
|
|
1625
|
-
var
|
|
1626
|
-
if (
|
|
1627
|
-
index =
|
|
1906
|
+
var n3 = str.indexOf(close, index);
|
|
1907
|
+
if (n3 !== -1) {
|
|
1908
|
+
index = n3 + 1;
|
|
1628
1909
|
}
|
|
1629
1910
|
}
|
|
1630
1911
|
if (str[index] === "!") {
|
|
@@ -1702,8 +1983,8 @@ var require_utils = __commonJS({
|
|
|
1702
1983
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1703
1984
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1704
1985
|
};
|
|
1705
|
-
exports.escapeNode = (
|
|
1706
|
-
const node =
|
|
1986
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1987
|
+
const node = block2.nodes[n3];
|
|
1707
1988
|
if (!node) return;
|
|
1708
1989
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1709
1990
|
if (node.escaped !== true) {
|
|
@@ -1720,15 +2001,15 @@ var require_utils = __commonJS({
|
|
|
1720
2001
|
}
|
|
1721
2002
|
return false;
|
|
1722
2003
|
};
|
|
1723
|
-
exports.isInvalidBrace = (
|
|
1724
|
-
if (
|
|
1725
|
-
if (
|
|
1726
|
-
if (
|
|
1727
|
-
|
|
2004
|
+
exports.isInvalidBrace = (block2) => {
|
|
2005
|
+
if (block2.type !== "brace") return false;
|
|
2006
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
2007
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
2008
|
+
block2.invalid = true;
|
|
1728
2009
|
return true;
|
|
1729
2010
|
}
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
2011
|
+
if (block2.open !== true || block2.close !== true) {
|
|
2012
|
+
block2.invalid = true;
|
|
1732
2013
|
return true;
|
|
1733
2014
|
}
|
|
1734
2015
|
return false;
|
|
@@ -1747,8 +2028,8 @@ var require_utils = __commonJS({
|
|
|
1747
2028
|
exports.flatten = (...args) => {
|
|
1748
2029
|
const result = [];
|
|
1749
2030
|
const flat = (arr) => {
|
|
1750
|
-
for (let
|
|
1751
|
-
const ele = arr[
|
|
2031
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
2032
|
+
const ele = arr[i2];
|
|
1752
2033
|
if (Array.isArray(ele)) {
|
|
1753
2034
|
flat(ele);
|
|
1754
2035
|
continue;
|
|
@@ -1842,9 +2123,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1842
2123
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1843
2124
|
return toRegexRange.cache[cacheKey].result;
|
|
1844
2125
|
}
|
|
1845
|
-
let
|
|
2126
|
+
let a2 = Math.min(min, max);
|
|
1846
2127
|
let b = Math.max(min, max);
|
|
1847
|
-
if (Math.abs(
|
|
2128
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1848
2129
|
let result = min + "|" + max;
|
|
1849
2130
|
if (opts.capture) {
|
|
1850
2131
|
return `(${result})`;
|
|
@@ -1855,20 +2136,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1855
2136
|
return `(?:${result})`;
|
|
1856
2137
|
}
|
|
1857
2138
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1858
|
-
let state = { min, max, a, b };
|
|
2139
|
+
let state = { min, max, a: a2, b };
|
|
1859
2140
|
let positives = [];
|
|
1860
2141
|
let negatives = [];
|
|
1861
2142
|
if (isPadded) {
|
|
1862
2143
|
state.isPadded = isPadded;
|
|
1863
2144
|
state.maxLen = String(state.max).length;
|
|
1864
2145
|
}
|
|
1865
|
-
if (
|
|
2146
|
+
if (a2 < 0) {
|
|
1866
2147
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1867
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1868
|
-
|
|
2148
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2149
|
+
a2 = state.a = 0;
|
|
1869
2150
|
}
|
|
1870
2151
|
if (b >= 0) {
|
|
1871
|
-
positives = splitToPatterns(
|
|
2152
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1872
2153
|
}
|
|
1873
2154
|
state.negatives = negatives;
|
|
1874
2155
|
state.positives = positives;
|
|
@@ -1916,8 +2197,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1916
2197
|
let digits = zipped.length;
|
|
1917
2198
|
let pattern = "";
|
|
1918
2199
|
let count = 0;
|
|
1919
|
-
for (let
|
|
1920
|
-
let [startDigit, stopDigit] = zipped[
|
|
2200
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2201
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1921
2202
|
if (startDigit === stopDigit) {
|
|
1922
2203
|
pattern += startDigit;
|
|
1923
2204
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1936,8 +2217,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1936
2217
|
let tokens = [];
|
|
1937
2218
|
let start = min;
|
|
1938
2219
|
let prev;
|
|
1939
|
-
for (let
|
|
1940
|
-
let max2 = ranges[
|
|
2220
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2221
|
+
let max2 = ranges[i2];
|
|
1941
2222
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1942
2223
|
let zeros = "";
|
|
1943
2224
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1972,13 +2253,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1972
2253
|
}
|
|
1973
2254
|
return result;
|
|
1974
2255
|
}
|
|
1975
|
-
function zip(
|
|
2256
|
+
function zip(a2, b) {
|
|
1976
2257
|
let arr = [];
|
|
1977
|
-
for (let
|
|
2258
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1978
2259
|
return arr;
|
|
1979
2260
|
}
|
|
1980
|
-
function compare(
|
|
1981
|
-
return
|
|
2261
|
+
function compare(a2, b) {
|
|
2262
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1982
2263
|
}
|
|
1983
2264
|
function contains(arr, key, val) {
|
|
1984
2265
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1996,8 +2277,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1996
2277
|
}
|
|
1997
2278
|
return "";
|
|
1998
2279
|
}
|
|
1999
|
-
function toCharacterClass(
|
|
2000
|
-
return `[${
|
|
2280
|
+
function toCharacterClass(a2, b, options) {
|
|
2281
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
2001
2282
|
}
|
|
2002
2283
|
function hasPadding(str) {
|
|
2003
2284
|
return /^-?(0+)\d/.test(str);
|
|
@@ -2076,8 +2357,8 @@ var require_fill_range = __commonJS({
|
|
|
2076
2357
|
return negative ? "-" + input : input;
|
|
2077
2358
|
};
|
|
2078
2359
|
var toSequence = (parts, options, maxLen) => {
|
|
2079
|
-
parts.negatives.sort((
|
|
2080
|
-
parts.positives.sort((
|
|
2360
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2361
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2081
2362
|
let prefix = options.capture ? "" : "?:";
|
|
2082
2363
|
let positives = "";
|
|
2083
2364
|
let negatives = "";
|
|
@@ -2098,12 +2379,12 @@ var require_fill_range = __commonJS({
|
|
|
2098
2379
|
}
|
|
2099
2380
|
return result;
|
|
2100
2381
|
};
|
|
2101
|
-
var toRange = (
|
|
2382
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
2102
2383
|
if (isNumbers) {
|
|
2103
|
-
return toRegexRange(
|
|
2384
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
2104
2385
|
}
|
|
2105
|
-
let start = String.fromCharCode(
|
|
2106
|
-
if (
|
|
2386
|
+
let start = String.fromCharCode(a2);
|
|
2387
|
+
if (a2 === b) return start;
|
|
2107
2388
|
let stop = String.fromCharCode(b);
|
|
2108
2389
|
return `[${start}-${stop}]`;
|
|
2109
2390
|
};
|
|
@@ -2129,15 +2410,15 @@ var require_fill_range = __commonJS({
|
|
|
2129
2410
|
return [];
|
|
2130
2411
|
};
|
|
2131
2412
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2132
|
-
let
|
|
2413
|
+
let a2 = Number(start);
|
|
2133
2414
|
let b = Number(end);
|
|
2134
|
-
if (!Number.isInteger(
|
|
2415
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2135
2416
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2136
2417
|
return [];
|
|
2137
2418
|
}
|
|
2138
|
-
if (
|
|
2419
|
+
if (a2 === 0) a2 = 0;
|
|
2139
2420
|
if (b === 0) b = 0;
|
|
2140
|
-
let descending =
|
|
2421
|
+
let descending = a2 > b;
|
|
2141
2422
|
let startString = String(start);
|
|
2142
2423
|
let endString = String(end);
|
|
2143
2424
|
let stepString = String(step);
|
|
@@ -2153,13 +2434,13 @@ var require_fill_range = __commonJS({
|
|
|
2153
2434
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2154
2435
|
let range = [];
|
|
2155
2436
|
let index = 0;
|
|
2156
|
-
while (descending ?
|
|
2437
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2157
2438
|
if (options.toRegex === true && step > 1) {
|
|
2158
|
-
push(
|
|
2439
|
+
push(a2);
|
|
2159
2440
|
} else {
|
|
2160
|
-
range.push(pad(format(
|
|
2441
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2161
2442
|
}
|
|
2162
|
-
|
|
2443
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2163
2444
|
index++;
|
|
2164
2445
|
}
|
|
2165
2446
|
if (options.toRegex === true) {
|
|
@@ -2172,19 +2453,19 @@ var require_fill_range = __commonJS({
|
|
|
2172
2453
|
return invalidRange(start, end, options);
|
|
2173
2454
|
}
|
|
2174
2455
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2175
|
-
let
|
|
2456
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2176
2457
|
let b = `${end}`.charCodeAt(0);
|
|
2177
|
-
let descending =
|
|
2178
|
-
let min = Math.min(
|
|
2179
|
-
let max = Math.max(
|
|
2458
|
+
let descending = a2 > b;
|
|
2459
|
+
let min = Math.min(a2, b);
|
|
2460
|
+
let max = Math.max(a2, b);
|
|
2180
2461
|
if (options.toRegex && step === 1) {
|
|
2181
2462
|
return toRange(min, max, false, options);
|
|
2182
2463
|
}
|
|
2183
2464
|
let range = [];
|
|
2184
2465
|
let index = 0;
|
|
2185
|
-
while (descending ?
|
|
2186
|
-
range.push(format(
|
|
2187
|
-
|
|
2466
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2467
|
+
range.push(format(a2, index));
|
|
2468
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2188
2469
|
index++;
|
|
2189
2470
|
}
|
|
2190
2471
|
if (options.toRegex === true) {
|
|
@@ -2307,18 +2588,18 @@ var require_expand = __commonJS({
|
|
|
2307
2588
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2308
2589
|
const walk = (node, parent = {}) => {
|
|
2309
2590
|
node.queue = [];
|
|
2310
|
-
let
|
|
2311
|
-
let
|
|
2312
|
-
while (
|
|
2313
|
-
|
|
2314
|
-
|
|
2591
|
+
let p = parent;
|
|
2592
|
+
let q = parent.queue;
|
|
2593
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2594
|
+
p = p.parent;
|
|
2595
|
+
q = p.queue;
|
|
2315
2596
|
}
|
|
2316
2597
|
if (node.invalid || node.dollar) {
|
|
2317
|
-
|
|
2598
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2318
2599
|
return;
|
|
2319
2600
|
}
|
|
2320
2601
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2321
|
-
|
|
2602
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2322
2603
|
return;
|
|
2323
2604
|
}
|
|
2324
2605
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2330,26 +2611,26 @@ var require_expand = __commonJS({
|
|
|
2330
2611
|
if (range.length === 0) {
|
|
2331
2612
|
range = stringify2(node, options);
|
|
2332
2613
|
}
|
|
2333
|
-
|
|
2614
|
+
q.push(append(q.pop(), range));
|
|
2334
2615
|
node.nodes = [];
|
|
2335
2616
|
return;
|
|
2336
2617
|
}
|
|
2337
2618
|
const enclose = utils.encloseBrace(node);
|
|
2338
2619
|
let queue = node.queue;
|
|
2339
|
-
let
|
|
2340
|
-
while (
|
|
2341
|
-
|
|
2342
|
-
queue =
|
|
2620
|
+
let block2 = node;
|
|
2621
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2622
|
+
block2 = block2.parent;
|
|
2623
|
+
queue = block2.queue;
|
|
2343
2624
|
}
|
|
2344
|
-
for (let
|
|
2345
|
-
const child = node.nodes[
|
|
2625
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2626
|
+
const child = node.nodes[i2];
|
|
2346
2627
|
if (child.type === "comma" && node.type === "brace") {
|
|
2347
|
-
if (
|
|
2628
|
+
if (i2 === 1) queue.push("");
|
|
2348
2629
|
queue.push("");
|
|
2349
2630
|
continue;
|
|
2350
2631
|
}
|
|
2351
2632
|
if (child.type === "close") {
|
|
2352
|
-
|
|
2633
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2353
2634
|
continue;
|
|
2354
2635
|
}
|
|
2355
2636
|
if (child.value && child.type !== "open") {
|
|
@@ -2516,7 +2797,7 @@ var require_parse = __commonJS({
|
|
|
2516
2797
|
}
|
|
2517
2798
|
const ast = { type: "root", input, nodes: [] };
|
|
2518
2799
|
const stack = [ast];
|
|
2519
|
-
let
|
|
2800
|
+
let block2 = ast;
|
|
2520
2801
|
let prev = ast;
|
|
2521
2802
|
let brackets = 0;
|
|
2522
2803
|
const length = input.length;
|
|
@@ -2532,15 +2813,15 @@ var require_parse = __commonJS({
|
|
|
2532
2813
|
prev.value += node.value;
|
|
2533
2814
|
return;
|
|
2534
2815
|
}
|
|
2535
|
-
|
|
2536
|
-
node.parent =
|
|
2816
|
+
block2.nodes.push(node);
|
|
2817
|
+
node.parent = block2;
|
|
2537
2818
|
node.prev = prev;
|
|
2538
2819
|
prev = node;
|
|
2539
2820
|
return node;
|
|
2540
2821
|
};
|
|
2541
2822
|
push({ type: "bos" });
|
|
2542
2823
|
while (index < length) {
|
|
2543
|
-
|
|
2824
|
+
block2 = stack[stack.length - 1];
|
|
2544
2825
|
value = advance();
|
|
2545
2826
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2546
2827
|
continue;
|
|
@@ -2577,19 +2858,19 @@ var require_parse = __commonJS({
|
|
|
2577
2858
|
continue;
|
|
2578
2859
|
}
|
|
2579
2860
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2580
|
-
|
|
2581
|
-
stack.push(
|
|
2861
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2862
|
+
stack.push(block2);
|
|
2582
2863
|
push({ type: "text", value });
|
|
2583
2864
|
continue;
|
|
2584
2865
|
}
|
|
2585
2866
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2586
|
-
if (
|
|
2867
|
+
if (block2.type !== "paren") {
|
|
2587
2868
|
push({ type: "text", value });
|
|
2588
2869
|
continue;
|
|
2589
2870
|
}
|
|
2590
|
-
|
|
2871
|
+
block2 = stack.pop();
|
|
2591
2872
|
push({ type: "text", value });
|
|
2592
|
-
|
|
2873
|
+
block2 = stack[stack.length - 1];
|
|
2593
2874
|
continue;
|
|
2594
2875
|
}
|
|
2595
2876
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2614,7 +2895,7 @@ var require_parse = __commonJS({
|
|
|
2614
2895
|
}
|
|
2615
2896
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2616
2897
|
depth++;
|
|
2617
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2898
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2618
2899
|
const brace = {
|
|
2619
2900
|
type: "brace",
|
|
2620
2901
|
open: true,
|
|
@@ -2625,52 +2906,52 @@ var require_parse = __commonJS({
|
|
|
2625
2906
|
ranges: 0,
|
|
2626
2907
|
nodes: []
|
|
2627
2908
|
};
|
|
2628
|
-
|
|
2629
|
-
stack.push(
|
|
2909
|
+
block2 = push(brace);
|
|
2910
|
+
stack.push(block2);
|
|
2630
2911
|
push({ type: "open", value });
|
|
2631
2912
|
continue;
|
|
2632
2913
|
}
|
|
2633
2914
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2634
|
-
if (
|
|
2915
|
+
if (block2.type !== "brace") {
|
|
2635
2916
|
push({ type: "text", value });
|
|
2636
2917
|
continue;
|
|
2637
2918
|
}
|
|
2638
2919
|
const type = "close";
|
|
2639
|
-
|
|
2640
|
-
|
|
2920
|
+
block2 = stack.pop();
|
|
2921
|
+
block2.close = true;
|
|
2641
2922
|
push({ type, value });
|
|
2642
2923
|
depth--;
|
|
2643
|
-
|
|
2924
|
+
block2 = stack[stack.length - 1];
|
|
2644
2925
|
continue;
|
|
2645
2926
|
}
|
|
2646
2927
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2647
|
-
if (
|
|
2648
|
-
|
|
2649
|
-
const open =
|
|
2650
|
-
|
|
2928
|
+
if (block2.ranges > 0) {
|
|
2929
|
+
block2.ranges = 0;
|
|
2930
|
+
const open = block2.nodes.shift();
|
|
2931
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2651
2932
|
}
|
|
2652
2933
|
push({ type: "comma", value });
|
|
2653
|
-
|
|
2934
|
+
block2.commas++;
|
|
2654
2935
|
continue;
|
|
2655
2936
|
}
|
|
2656
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2657
|
-
const siblings =
|
|
2937
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2938
|
+
const siblings = block2.nodes;
|
|
2658
2939
|
if (depth === 0 || siblings.length === 0) {
|
|
2659
2940
|
push({ type: "text", value });
|
|
2660
2941
|
continue;
|
|
2661
2942
|
}
|
|
2662
2943
|
if (prev.type === "dot") {
|
|
2663
|
-
|
|
2944
|
+
block2.range = [];
|
|
2664
2945
|
prev.value += value;
|
|
2665
2946
|
prev.type = "range";
|
|
2666
|
-
if (
|
|
2667
|
-
|
|
2668
|
-
|
|
2947
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2948
|
+
block2.invalid = true;
|
|
2949
|
+
block2.ranges = 0;
|
|
2669
2950
|
prev.type = "text";
|
|
2670
2951
|
continue;
|
|
2671
2952
|
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2953
|
+
block2.ranges++;
|
|
2954
|
+
block2.args = [];
|
|
2674
2955
|
continue;
|
|
2675
2956
|
}
|
|
2676
2957
|
if (prev.type === "range") {
|
|
@@ -2678,7 +2959,7 @@ var require_parse = __commonJS({
|
|
|
2678
2959
|
const before = siblings[siblings.length - 1];
|
|
2679
2960
|
before.value += prev.value + value;
|
|
2680
2961
|
prev = before;
|
|
2681
|
-
|
|
2962
|
+
block2.ranges--;
|
|
2682
2963
|
continue;
|
|
2683
2964
|
}
|
|
2684
2965
|
push({ type: "dot", value });
|
|
@@ -2687,9 +2968,9 @@ var require_parse = __commonJS({
|
|
|
2687
2968
|
push({ type: "text", value });
|
|
2688
2969
|
}
|
|
2689
2970
|
do {
|
|
2690
|
-
|
|
2691
|
-
if (
|
|
2692
|
-
|
|
2971
|
+
block2 = stack.pop();
|
|
2972
|
+
if (block2.type !== "root") {
|
|
2973
|
+
block2.nodes.forEach((node) => {
|
|
2693
2974
|
if (!node.nodes) {
|
|
2694
2975
|
if (node.type === "open") node.isOpen = true;
|
|
2695
2976
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2698,8 +2979,8 @@ var require_parse = __commonJS({
|
|
|
2698
2979
|
}
|
|
2699
2980
|
});
|
|
2700
2981
|
const parent = stack[stack.length - 1];
|
|
2701
|
-
const index2 = parent.nodes.indexOf(
|
|
2702
|
-
parent.nodes.splice(index2, 1, ...
|
|
2982
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2983
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2703
2984
|
}
|
|
2704
2985
|
} while (stack.length > 0);
|
|
2705
2986
|
push({ type: "eos" });
|
|
@@ -3332,9 +3613,9 @@ var require_scan = __commonJS({
|
|
|
3332
3613
|
if (opts.parts === true || opts.tokens === true) {
|
|
3333
3614
|
let prevIndex;
|
|
3334
3615
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3335
|
-
const
|
|
3336
|
-
const
|
|
3337
|
-
const value = input.slice(
|
|
3616
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3617
|
+
const i2 = slashes[idx];
|
|
3618
|
+
const value = input.slice(n3, i2);
|
|
3338
3619
|
if (opts.tokens) {
|
|
3339
3620
|
if (idx === 0 && start !== 0) {
|
|
3340
3621
|
tokens[idx].isPrefix = true;
|
|
@@ -3348,7 +3629,7 @@ var require_scan = __commonJS({
|
|
|
3348
3629
|
if (idx !== 0 || value !== "") {
|
|
3349
3630
|
parts.push(value);
|
|
3350
3631
|
}
|
|
3351
|
-
prevIndex =
|
|
3632
|
+
prevIndex = i2;
|
|
3352
3633
|
}
|
|
3353
3634
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3354
3635
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3477,15 +3758,15 @@ var require_parse2 = __commonJS({
|
|
|
3477
3758
|
};
|
|
3478
3759
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3479
3760
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3480
|
-
for (let
|
|
3481
|
-
for (let
|
|
3482
|
-
const
|
|
3483
|
-
const b = values[
|
|
3484
|
-
const char =
|
|
3485
|
-
if (!char ||
|
|
3761
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3762
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3763
|
+
const a2 = values[i2];
|
|
3764
|
+
const b = values[j];
|
|
3765
|
+
const char = a2[0];
|
|
3766
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3486
3767
|
continue;
|
|
3487
3768
|
}
|
|
3488
|
-
if (
|
|
3769
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3489
3770
|
return true;
|
|
3490
3771
|
}
|
|
3491
3772
|
}
|
|
@@ -3500,8 +3781,8 @@ var require_parse2 = __commonJS({
|
|
|
3500
3781
|
let paren = 0;
|
|
3501
3782
|
let quote = 0;
|
|
3502
3783
|
let escaped = false;
|
|
3503
|
-
for (let
|
|
3504
|
-
const ch = pattern[
|
|
3784
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3785
|
+
const ch = pattern[i2];
|
|
3505
3786
|
if (escaped === true) {
|
|
3506
3787
|
escaped = false;
|
|
3507
3788
|
continue;
|
|
@@ -3535,13 +3816,13 @@ var require_parse2 = __commonJS({
|
|
|
3535
3816
|
if (ch === ")") {
|
|
3536
3817
|
paren--;
|
|
3537
3818
|
if (paren === 0) {
|
|
3538
|
-
if (requireEnd === true &&
|
|
3819
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3539
3820
|
return;
|
|
3540
3821
|
}
|
|
3541
3822
|
return {
|
|
3542
3823
|
type: pattern[0],
|
|
3543
|
-
body: pattern.slice(2,
|
|
3544
|
-
end:
|
|
3824
|
+
body: pattern.slice(2, i2),
|
|
3825
|
+
end: i2
|
|
3545
3826
|
};
|
|
3546
3827
|
}
|
|
3547
3828
|
}
|
|
@@ -3673,7 +3954,7 @@ var require_parse2 = __commonJS({
|
|
|
3673
3954
|
let prev = bos;
|
|
3674
3955
|
let value;
|
|
3675
3956
|
const eos = () => state.index === len - 1;
|
|
3676
|
-
const peek = state.peek = (
|
|
3957
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3677
3958
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3678
3959
|
const remaining = () => input.slice(state.index + 1);
|
|
3679
3960
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3754,10 +4035,10 @@ var require_parse2 = __commonJS({
|
|
|
3754
4035
|
open.type = "text";
|
|
3755
4036
|
open.value = literal;
|
|
3756
4037
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3757
|
-
for (let
|
|
3758
|
-
tokens[
|
|
3759
|
-
tokens[
|
|
3760
|
-
delete tokens[
|
|
4038
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
4039
|
+
tokens[i2].value = "";
|
|
4040
|
+
tokens[i2].output = "";
|
|
4041
|
+
delete tokens[i2].suffix;
|
|
3761
4042
|
}
|
|
3762
4043
|
state.output = token.output + open.output;
|
|
3763
4044
|
state.backtrack = true;
|
|
@@ -4000,13 +4281,13 @@ var require_parse2 = __commonJS({
|
|
|
4000
4281
|
if (brace.dots === true) {
|
|
4001
4282
|
const arr = tokens.slice();
|
|
4002
4283
|
const range = [];
|
|
4003
|
-
for (let
|
|
4284
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
4004
4285
|
tokens.pop();
|
|
4005
|
-
if (arr[
|
|
4286
|
+
if (arr[i2].type === "brace") {
|
|
4006
4287
|
break;
|
|
4007
4288
|
}
|
|
4008
|
-
if (arr[
|
|
4009
|
-
range.unshift(arr[
|
|
4289
|
+
if (arr[i2].type !== "dots") {
|
|
4290
|
+
range.unshift(arr[i2].value);
|
|
4010
4291
|
}
|
|
4011
4292
|
}
|
|
4012
4293
|
output = expandRange(range, opts);
|
|
@@ -4465,7 +4746,7 @@ var require_picomatch = __commonJS({
|
|
|
4465
4746
|
};
|
|
4466
4747
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4467
4748
|
picomatch.parse = (pattern, options) => {
|
|
4468
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4749
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4469
4750
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4470
4751
|
};
|
|
4471
4752
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4549,8 +4830,8 @@ var require_micromatch = __commonJS({
|
|
|
4549
4830
|
options.onResult(state);
|
|
4550
4831
|
}
|
|
4551
4832
|
};
|
|
4552
|
-
for (let
|
|
4553
|
-
let isMatch = picomatch(String(patterns[
|
|
4833
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4834
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4554
4835
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4555
4836
|
if (negated) negatives++;
|
|
4556
4837
|
for (let item of list) {
|
|
@@ -4572,7 +4853,7 @@ var require_micromatch = __commonJS({
|
|
|
4572
4853
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4573
4854
|
}
|
|
4574
4855
|
if (options.nonull === true || options.nullglob === true) {
|
|
4575
|
-
return options.unescape ? patterns.map((
|
|
4856
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4576
4857
|
}
|
|
4577
4858
|
}
|
|
4578
4859
|
return matches;
|
|
@@ -4602,7 +4883,7 @@ var require_micromatch = __commonJS({
|
|
|
4602
4883
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4603
4884
|
}
|
|
4604
4885
|
if (Array.isArray(pattern)) {
|
|
4605
|
-
return pattern.some((
|
|
4886
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4606
4887
|
}
|
|
4607
4888
|
if (typeof pattern === "string") {
|
|
4608
4889
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4647,7 +4928,7 @@ var require_micromatch = __commonJS({
|
|
|
4647
4928
|
if (typeof str !== "string") {
|
|
4648
4929
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4649
4930
|
}
|
|
4650
|
-
return [].concat(patterns).every((
|
|
4931
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4651
4932
|
};
|
|
4652
4933
|
micromatch.capture = (glob2, input, options) => {
|
|
4653
4934
|
let posix = utils.isWindows(options);
|
|
@@ -4798,7 +5079,7 @@ var require_pattern = __commonJS({
|
|
|
4798
5079
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4799
5080
|
function expandBraceExpansion(pattern) {
|
|
4800
5081
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4801
|
-
patterns.sort((
|
|
5082
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4802
5083
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4803
5084
|
}
|
|
4804
5085
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4879,8 +5160,8 @@ var require_merge2 = __commonJS({
|
|
|
4879
5160
|
}
|
|
4880
5161
|
const mergedStream = PassThrough(options);
|
|
4881
5162
|
function addStream() {
|
|
4882
|
-
for (let
|
|
4883
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5163
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5164
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4884
5165
|
}
|
|
4885
5166
|
mergeStream();
|
|
4886
5167
|
return this;
|
|
@@ -4929,8 +5210,8 @@ var require_merge2 = __commonJS({
|
|
|
4929
5210
|
stream.pipe(mergedStream, { end: false });
|
|
4930
5211
|
stream.resume();
|
|
4931
5212
|
}
|
|
4932
|
-
for (let
|
|
4933
|
-
pipe(streams[
|
|
5213
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5214
|
+
pipe(streams[i2]);
|
|
4934
5215
|
}
|
|
4935
5216
|
next();
|
|
4936
5217
|
}
|
|
@@ -4961,8 +5242,8 @@ var require_merge2 = __commonJS({
|
|
|
4961
5242
|
}
|
|
4962
5243
|
streams.pause();
|
|
4963
5244
|
} else {
|
|
4964
|
-
for (let
|
|
4965
|
-
streams[
|
|
5245
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5246
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4966
5247
|
}
|
|
4967
5248
|
}
|
|
4968
5249
|
return streams;
|
|
@@ -5044,13 +5325,13 @@ var require_tasks = __commonJS({
|
|
|
5044
5325
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5045
5326
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
5046
5327
|
var utils = require_utils3();
|
|
5047
|
-
function generate(input,
|
|
5048
|
-
const patterns = processPatterns(input,
|
|
5049
|
-
const ignore = processPatterns(
|
|
5328
|
+
function generate(input, settings2) {
|
|
5329
|
+
const patterns = processPatterns(input, settings2);
|
|
5330
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
5050
5331
|
const positivePatterns = getPositivePatterns(patterns);
|
|
5051
5332
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
5052
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
5053
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5333
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5334
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
5054
5335
|
const staticTasks = convertPatternsToTasks(
|
|
5055
5336
|
staticPatterns,
|
|
5056
5337
|
negativePatterns,
|
|
@@ -5066,12 +5347,12 @@ var require_tasks = __commonJS({
|
|
|
5066
5347
|
return staticTasks.concat(dynamicTasks);
|
|
5067
5348
|
}
|
|
5068
5349
|
exports.generate = generate;
|
|
5069
|
-
function processPatterns(input,
|
|
5350
|
+
function processPatterns(input, settings2) {
|
|
5070
5351
|
let patterns = input;
|
|
5071
|
-
if (
|
|
5352
|
+
if (settings2.braceExpansion) {
|
|
5072
5353
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
5073
5354
|
}
|
|
5074
|
-
if (
|
|
5355
|
+
if (settings2.baseNameMatch) {
|
|
5075
5356
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
5076
5357
|
}
|
|
5077
5358
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -5102,7 +5383,7 @@ var require_tasks = __commonJS({
|
|
|
5102
5383
|
}
|
|
5103
5384
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
5104
5385
|
function groupPatternsByBaseDirectory(patterns) {
|
|
5105
|
-
const
|
|
5386
|
+
const group2 = {};
|
|
5106
5387
|
return patterns.reduce((collection, pattern) => {
|
|
5107
5388
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
5108
5389
|
if (base in collection) {
|
|
@@ -5111,7 +5392,7 @@ var require_tasks = __commonJS({
|
|
|
5111
5392
|
collection[base] = [pattern];
|
|
5112
5393
|
}
|
|
5113
5394
|
return collection;
|
|
5114
|
-
},
|
|
5395
|
+
}, group2);
|
|
5115
5396
|
}
|
|
5116
5397
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5117
5398
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5140,26 +5421,26 @@ var require_async = __commonJS({
|
|
|
5140
5421
|
init_utils2();
|
|
5141
5422
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5142
5423
|
exports.read = void 0;
|
|
5143
|
-
function read2(path,
|
|
5144
|
-
|
|
5424
|
+
function read2(path, settings2, callback) {
|
|
5425
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5145
5426
|
if (lstatError !== null) {
|
|
5146
5427
|
callFailureCallback(callback, lstatError);
|
|
5147
5428
|
return;
|
|
5148
5429
|
}
|
|
5149
|
-
if (!lstat.isSymbolicLink() || !
|
|
5430
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5150
5431
|
callSuccessCallback(callback, lstat);
|
|
5151
5432
|
return;
|
|
5152
5433
|
}
|
|
5153
|
-
|
|
5434
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5154
5435
|
if (statError !== null) {
|
|
5155
|
-
if (
|
|
5436
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5156
5437
|
callFailureCallback(callback, statError);
|
|
5157
5438
|
return;
|
|
5158
5439
|
}
|
|
5159
5440
|
callSuccessCallback(callback, lstat);
|
|
5160
5441
|
return;
|
|
5161
5442
|
}
|
|
5162
|
-
if (
|
|
5443
|
+
if (settings2.markSymbolicLink) {
|
|
5163
5444
|
stat.isSymbolicLink = () => true;
|
|
5164
5445
|
}
|
|
5165
5446
|
callSuccessCallback(callback, stat);
|
|
@@ -5183,19 +5464,19 @@ var require_sync = __commonJS({
|
|
|
5183
5464
|
init_utils2();
|
|
5184
5465
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5185
5466
|
exports.read = void 0;
|
|
5186
|
-
function read2(path,
|
|
5187
|
-
const lstat =
|
|
5188
|
-
if (!lstat.isSymbolicLink() || !
|
|
5467
|
+
function read2(path, settings2) {
|
|
5468
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5469
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5189
5470
|
return lstat;
|
|
5190
5471
|
}
|
|
5191
5472
|
try {
|
|
5192
|
-
const stat =
|
|
5193
|
-
if (
|
|
5473
|
+
const stat = settings2.fs.statSync(path);
|
|
5474
|
+
if (settings2.markSymbolicLink) {
|
|
5194
5475
|
stat.isSymbolicLink = () => true;
|
|
5195
5476
|
}
|
|
5196
5477
|
return stat;
|
|
5197
5478
|
} catch (error2) {
|
|
5198
|
-
if (!
|
|
5479
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5199
5480
|
return lstat;
|
|
5200
5481
|
}
|
|
5201
5482
|
throw error2;
|
|
@@ -5272,8 +5553,8 @@ var require_out = __commonJS({
|
|
|
5272
5553
|
}
|
|
5273
5554
|
exports.stat = stat;
|
|
5274
5555
|
function statSync3(path, optionsOrSettings) {
|
|
5275
|
-
const
|
|
5276
|
-
return sync.read(path,
|
|
5556
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5557
|
+
return sync.read(path, settings2);
|
|
5277
5558
|
}
|
|
5278
5559
|
exports.statSync = statSync3;
|
|
5279
5560
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5321,8 +5602,8 @@ var require_run_parallel = __commonJS({
|
|
|
5321
5602
|
if (isSync) queueMicrotask2(end);
|
|
5322
5603
|
else end();
|
|
5323
5604
|
}
|
|
5324
|
-
function each(
|
|
5325
|
-
results[
|
|
5605
|
+
function each(i2, err, result) {
|
|
5606
|
+
results[i2] = result;
|
|
5326
5607
|
if (--pending === 0 || err) {
|
|
5327
5608
|
done(err);
|
|
5328
5609
|
}
|
|
@@ -5336,9 +5617,9 @@ var require_run_parallel = __commonJS({
|
|
|
5336
5617
|
});
|
|
5337
5618
|
});
|
|
5338
5619
|
} else {
|
|
5339
|
-
tasks.forEach(function(task,
|
|
5620
|
+
tasks.forEach(function(task, i2) {
|
|
5340
5621
|
task(function(err, result) {
|
|
5341
|
-
each(
|
|
5622
|
+
each(i2, err, result);
|
|
5342
5623
|
});
|
|
5343
5624
|
});
|
|
5344
5625
|
}
|
|
@@ -5413,11 +5694,11 @@ var require_common = __commonJS({
|
|
|
5413
5694
|
init_utils2();
|
|
5414
5695
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5415
5696
|
exports.joinPathSegments = void 0;
|
|
5416
|
-
function joinPathSegments(
|
|
5417
|
-
if (
|
|
5418
|
-
return
|
|
5697
|
+
function joinPathSegments(a2, b, separator) {
|
|
5698
|
+
if (a2.endsWith(separator)) {
|
|
5699
|
+
return a2 + b;
|
|
5419
5700
|
}
|
|
5420
|
-
return
|
|
5701
|
+
return a2 + separator + b;
|
|
5421
5702
|
}
|
|
5422
5703
|
exports.joinPathSegments = joinPathSegments;
|
|
5423
5704
|
}
|
|
@@ -5435,16 +5716,16 @@ var require_async2 = __commonJS({
|
|
|
5435
5716
|
var constants_1 = require_constants3();
|
|
5436
5717
|
var utils = require_utils4();
|
|
5437
5718
|
var common = require_common();
|
|
5438
|
-
function read2(directory,
|
|
5439
|
-
if (!
|
|
5440
|
-
readdirWithFileTypes(directory,
|
|
5719
|
+
function read2(directory, settings2, callback) {
|
|
5720
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5721
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5441
5722
|
return;
|
|
5442
5723
|
}
|
|
5443
|
-
readdir(directory,
|
|
5724
|
+
readdir(directory, settings2, callback);
|
|
5444
5725
|
}
|
|
5445
5726
|
exports.read = read2;
|
|
5446
|
-
function readdirWithFileTypes(directory,
|
|
5447
|
-
|
|
5727
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5728
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5448
5729
|
if (readdirError !== null) {
|
|
5449
5730
|
callFailureCallback(callback, readdirError);
|
|
5450
5731
|
return;
|
|
@@ -5452,13 +5733,13 @@ var require_async2 = __commonJS({
|
|
|
5452
5733
|
const entries = dirents.map((dirent) => ({
|
|
5453
5734
|
dirent,
|
|
5454
5735
|
name: dirent.name,
|
|
5455
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5736
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5456
5737
|
}));
|
|
5457
|
-
if (!
|
|
5738
|
+
if (!settings2.followSymbolicLinks) {
|
|
5458
5739
|
callSuccessCallback(callback, entries);
|
|
5459
5740
|
return;
|
|
5460
5741
|
}
|
|
5461
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5742
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5462
5743
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5463
5744
|
if (rplError !== null) {
|
|
5464
5745
|
callFailureCallback(callback, rplError);
|
|
@@ -5469,15 +5750,15 @@ var require_async2 = __commonJS({
|
|
|
5469
5750
|
});
|
|
5470
5751
|
}
|
|
5471
5752
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5472
|
-
function makeRplTaskEntry(entry,
|
|
5753
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5473
5754
|
return (done) => {
|
|
5474
5755
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5475
5756
|
done(null, entry);
|
|
5476
5757
|
return;
|
|
5477
5758
|
}
|
|
5478
|
-
|
|
5759
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5479
5760
|
if (statError !== null) {
|
|
5480
|
-
if (
|
|
5761
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5481
5762
|
done(statError);
|
|
5482
5763
|
return;
|
|
5483
5764
|
}
|
|
@@ -5489,16 +5770,16 @@ var require_async2 = __commonJS({
|
|
|
5489
5770
|
});
|
|
5490
5771
|
};
|
|
5491
5772
|
}
|
|
5492
|
-
function readdir(directory,
|
|
5493
|
-
|
|
5773
|
+
function readdir(directory, settings2, callback) {
|
|
5774
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5494
5775
|
if (readdirError !== null) {
|
|
5495
5776
|
callFailureCallback(callback, readdirError);
|
|
5496
5777
|
return;
|
|
5497
5778
|
}
|
|
5498
5779
|
const tasks = names.map((name) => {
|
|
5499
|
-
const path = common.joinPathSegments(directory, name,
|
|
5780
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5500
5781
|
return (done) => {
|
|
5501
|
-
fsStat.stat(path,
|
|
5782
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5502
5783
|
if (error2 !== null) {
|
|
5503
5784
|
done(error2);
|
|
5504
5785
|
return;
|
|
@@ -5508,7 +5789,7 @@ var require_async2 = __commonJS({
|
|
|
5508
5789
|
path,
|
|
5509
5790
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5510
5791
|
};
|
|
5511
|
-
if (
|
|
5792
|
+
if (settings2.stats) {
|
|
5512
5793
|
entry.stats = stats;
|
|
5513
5794
|
}
|
|
5514
5795
|
done(null, entry);
|
|
@@ -5545,27 +5826,27 @@ var require_sync2 = __commonJS({
|
|
|
5545
5826
|
var constants_1 = require_constants3();
|
|
5546
5827
|
var utils = require_utils4();
|
|
5547
5828
|
var common = require_common();
|
|
5548
|
-
function read2(directory,
|
|
5549
|
-
if (!
|
|
5550
|
-
return readdirWithFileTypes(directory,
|
|
5829
|
+
function read2(directory, settings2) {
|
|
5830
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5831
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5551
5832
|
}
|
|
5552
|
-
return readdir(directory,
|
|
5833
|
+
return readdir(directory, settings2);
|
|
5553
5834
|
}
|
|
5554
5835
|
exports.read = read2;
|
|
5555
|
-
function readdirWithFileTypes(directory,
|
|
5556
|
-
const dirents =
|
|
5836
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5837
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5557
5838
|
return dirents.map((dirent) => {
|
|
5558
5839
|
const entry = {
|
|
5559
5840
|
dirent,
|
|
5560
5841
|
name: dirent.name,
|
|
5561
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5842
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5562
5843
|
};
|
|
5563
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5844
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5564
5845
|
try {
|
|
5565
|
-
const stats =
|
|
5846
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5566
5847
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5567
5848
|
} catch (error2) {
|
|
5568
|
-
if (
|
|
5849
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5569
5850
|
throw error2;
|
|
5570
5851
|
}
|
|
5571
5852
|
}
|
|
@@ -5574,17 +5855,17 @@ var require_sync2 = __commonJS({
|
|
|
5574
5855
|
});
|
|
5575
5856
|
}
|
|
5576
5857
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5577
|
-
function readdir(directory,
|
|
5578
|
-
const names =
|
|
5858
|
+
function readdir(directory, settings2) {
|
|
5859
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5579
5860
|
return names.map((name) => {
|
|
5580
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5581
|
-
const stats = fsStat.statSync(entryPath,
|
|
5861
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5862
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5582
5863
|
const entry = {
|
|
5583
5864
|
name,
|
|
5584
5865
|
path: entryPath,
|
|
5585
5866
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5586
5867
|
};
|
|
5587
|
-
if (
|
|
5868
|
+
if (settings2.stats) {
|
|
5588
5869
|
entry.stats = stats;
|
|
5589
5870
|
}
|
|
5590
5871
|
return entry;
|
|
@@ -5671,8 +5952,8 @@ var require_out2 = __commonJS({
|
|
|
5671
5952
|
}
|
|
5672
5953
|
exports.scandir = scandir;
|
|
5673
5954
|
function scandirSync(path, optionsOrSettings) {
|
|
5674
|
-
const
|
|
5675
|
-
return sync.read(path,
|
|
5955
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5956
|
+
return sync.read(path, settings2);
|
|
5676
5957
|
}
|
|
5677
5958
|
exports.scandirSync = scandirSync;
|
|
5678
5959
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5716,9 +5997,9 @@ var require_reusify = __commonJS({
|
|
|
5716
5997
|
}
|
|
5717
5998
|
});
|
|
5718
5999
|
|
|
5719
|
-
// node_modules/.bun/fastq@1.20.
|
|
6000
|
+
// node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
|
|
5720
6001
|
var require_queue = __commonJS({
|
|
5721
|
-
"node_modules/.bun/fastq@1.20.
|
|
6002
|
+
"node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
|
|
5722
6003
|
"use strict";
|
|
5723
6004
|
init_utils2();
|
|
5724
6005
|
var reusify = require_reusify();
|
|
@@ -5898,11 +6179,12 @@ var require_queue = __commonJS({
|
|
|
5898
6179
|
current.value = null;
|
|
5899
6180
|
current.callback = noop;
|
|
5900
6181
|
current.errorHandler = null;
|
|
6182
|
+
current.next = null;
|
|
5901
6183
|
if (errorHandler2) {
|
|
5902
6184
|
errorHandler2(new Error("abort"), val);
|
|
5903
6185
|
}
|
|
5904
6186
|
callback.call(context2, new Error("abort"));
|
|
5905
|
-
|
|
6187
|
+
cache.release(current);
|
|
5906
6188
|
current = next;
|
|
5907
6189
|
}
|
|
5908
6190
|
self.drain = noop;
|
|
@@ -5953,7 +6235,7 @@ var require_queue = __commonJS({
|
|
|
5953
6235
|
queue.drained = drained;
|
|
5954
6236
|
return queue;
|
|
5955
6237
|
function push(value) {
|
|
5956
|
-
var
|
|
6238
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5957
6239
|
pushCb(value, function(err, result) {
|
|
5958
6240
|
if (err) {
|
|
5959
6241
|
reject(err);
|
|
@@ -5962,11 +6244,11 @@ var require_queue = __commonJS({
|
|
|
5962
6244
|
resolve4(result);
|
|
5963
6245
|
});
|
|
5964
6246
|
});
|
|
5965
|
-
|
|
5966
|
-
return
|
|
6247
|
+
p.catch(noop);
|
|
6248
|
+
return p;
|
|
5967
6249
|
}
|
|
5968
6250
|
function unshift(value) {
|
|
5969
|
-
var
|
|
6251
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5970
6252
|
unshiftCb(value, function(err, result) {
|
|
5971
6253
|
if (err) {
|
|
5972
6254
|
reject(err);
|
|
@@ -5975,11 +6257,11 @@ var require_queue = __commonJS({
|
|
|
5975
6257
|
resolve4(result);
|
|
5976
6258
|
});
|
|
5977
6259
|
});
|
|
5978
|
-
|
|
5979
|
-
return
|
|
6260
|
+
p.catch(noop);
|
|
6261
|
+
return p;
|
|
5980
6262
|
}
|
|
5981
6263
|
function drained() {
|
|
5982
|
-
var
|
|
6264
|
+
var p = new Promise(function(resolve4) {
|
|
5983
6265
|
process.nextTick(function() {
|
|
5984
6266
|
if (queue.idle()) {
|
|
5985
6267
|
resolve4();
|
|
@@ -5993,7 +6275,7 @@ var require_queue = __commonJS({
|
|
|
5993
6275
|
}
|
|
5994
6276
|
});
|
|
5995
6277
|
});
|
|
5996
|
-
return
|
|
6278
|
+
return p;
|
|
5997
6279
|
}
|
|
5998
6280
|
}
|
|
5999
6281
|
module.exports = fastqueue;
|
|
@@ -6008,11 +6290,11 @@ var require_common2 = __commonJS({
|
|
|
6008
6290
|
init_utils2();
|
|
6009
6291
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6010
6292
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
6011
|
-
function isFatalError(
|
|
6012
|
-
if (
|
|
6293
|
+
function isFatalError(settings2, error2) {
|
|
6294
|
+
if (settings2.errorFilter === null) {
|
|
6013
6295
|
return true;
|
|
6014
6296
|
}
|
|
6015
|
-
return !
|
|
6297
|
+
return !settings2.errorFilter(error2);
|
|
6016
6298
|
}
|
|
6017
6299
|
exports.isFatalError = isFatalError;
|
|
6018
6300
|
function isAppliedFilter(filter, value) {
|
|
@@ -6023,14 +6305,14 @@ var require_common2 = __commonJS({
|
|
|
6023
6305
|
return filepath.split(/[/\\]/).join(separator);
|
|
6024
6306
|
}
|
|
6025
6307
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
6026
|
-
function joinPathSegments(
|
|
6027
|
-
if (
|
|
6308
|
+
function joinPathSegments(a2, b, separator) {
|
|
6309
|
+
if (a2 === "") {
|
|
6028
6310
|
return b;
|
|
6029
6311
|
}
|
|
6030
|
-
if (
|
|
6031
|
-
return
|
|
6312
|
+
if (a2.endsWith(separator)) {
|
|
6313
|
+
return a2 + b;
|
|
6032
6314
|
}
|
|
6033
|
-
return
|
|
6315
|
+
return a2 + separator + b;
|
|
6034
6316
|
}
|
|
6035
6317
|
exports.joinPathSegments = joinPathSegments;
|
|
6036
6318
|
}
|
|
@@ -6377,14 +6659,14 @@ var require_out3 = __commonJS({
|
|
|
6377
6659
|
}
|
|
6378
6660
|
exports.walk = walk;
|
|
6379
6661
|
function walkSync(directory, optionsOrSettings) {
|
|
6380
|
-
const
|
|
6381
|
-
const provider = new sync_1.default(directory,
|
|
6662
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6663
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6382
6664
|
return provider.read();
|
|
6383
6665
|
}
|
|
6384
6666
|
exports.walkSync = walkSync;
|
|
6385
6667
|
function walkStream(directory, optionsOrSettings) {
|
|
6386
|
-
const
|
|
6387
|
-
const provider = new stream_1.default(directory,
|
|
6668
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6669
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6388
6670
|
return provider.read();
|
|
6389
6671
|
}
|
|
6390
6672
|
exports.walkStream = walkStream;
|
|
@@ -6470,8 +6752,8 @@ var require_stream3 = __commonJS({
|
|
|
6470
6752
|
done();
|
|
6471
6753
|
}).catch(done);
|
|
6472
6754
|
};
|
|
6473
|
-
for (let
|
|
6474
|
-
stream.write(
|
|
6755
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6756
|
+
stream.write(i2);
|
|
6475
6757
|
}
|
|
6476
6758
|
return stream;
|
|
6477
6759
|
}
|
|
@@ -7132,14 +7414,14 @@ var require_out4 = __commonJS({
|
|
|
7132
7414
|
function generateTasks(source, options) {
|
|
7133
7415
|
assertPatternsInput(source);
|
|
7134
7416
|
const patterns = [].concat(source);
|
|
7135
|
-
const
|
|
7136
|
-
return taskManager.generate(patterns,
|
|
7417
|
+
const settings2 = new settings_1.default(options);
|
|
7418
|
+
return taskManager.generate(patterns, settings2);
|
|
7137
7419
|
}
|
|
7138
7420
|
FastGlob2.generateTasks = generateTasks;
|
|
7139
7421
|
function isDynamicPattern(source, options) {
|
|
7140
7422
|
assertPatternsInput(source);
|
|
7141
|
-
const
|
|
7142
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7423
|
+
const settings2 = new settings_1.default(options);
|
|
7424
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7143
7425
|
}
|
|
7144
7426
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7145
7427
|
function escapePath(source) {
|
|
@@ -7181,9 +7463,9 @@ var require_out4 = __commonJS({
|
|
|
7181
7463
|
})(FastGlob || (FastGlob = {}));
|
|
7182
7464
|
function getWorks(source, _Provider, options) {
|
|
7183
7465
|
const patterns = [].concat(source);
|
|
7184
|
-
const
|
|
7185
|
-
const tasks = taskManager.generate(patterns,
|
|
7186
|
-
const provider = new _Provider(
|
|
7466
|
+
const settings2 = new settings_1.default(options);
|
|
7467
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7468
|
+
const provider = new _Provider(settings2);
|
|
7187
7469
|
return tasks.map(provider.read, provider);
|
|
7188
7470
|
}
|
|
7189
7471
|
function assertPatternsInput(input) {
|
|
@@ -7361,14 +7643,14 @@ import "node:fs";
|
|
|
7361
7643
|
import { createRequire } from "node:module";
|
|
7362
7644
|
import {
|
|
7363
7645
|
resolve,
|
|
7364
|
-
join,
|
|
7365
|
-
dirname,
|
|
7646
|
+
join as join2,
|
|
7647
|
+
dirname as dirname2,
|
|
7366
7648
|
relative,
|
|
7367
7649
|
normalize,
|
|
7368
7650
|
sep,
|
|
7369
7651
|
extname
|
|
7370
7652
|
} from "node:path";
|
|
7371
|
-
import "node:url";
|
|
7653
|
+
import { fileURLToPath } from "node:url";
|
|
7372
7654
|
function safeExecuteAsync2(fn, message) {
|
|
7373
7655
|
return fn().catch((error2) => {
|
|
7374
7656
|
throw new Error(
|
|
@@ -7376,7 +7658,7 @@ function safeExecuteAsync2(fn, message) {
|
|
|
7376
7658
|
);
|
|
7377
7659
|
});
|
|
7378
7660
|
}
|
|
7379
|
-
var import_fast_glob, constants,
|
|
7661
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7380
7662
|
var init_PathResolver = __esm({
|
|
7381
7663
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7382
7664
|
"use strict";
|
|
@@ -7389,7 +7671,7 @@ var init_PathResolver = __esm({
|
|
|
7389
7671
|
getPatternsFor: getPatternsFor || void 0,
|
|
7390
7672
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7391
7673
|
};
|
|
7392
|
-
|
|
7674
|
+
log3 = {
|
|
7393
7675
|
error: (message, error2) => {
|
|
7394
7676
|
},
|
|
7395
7677
|
warn: (message, error2) => {
|
|
@@ -7425,6 +7707,7 @@ var init_PathResolver = __esm({
|
|
|
7425
7707
|
options;
|
|
7426
7708
|
_repoRoot;
|
|
7427
7709
|
_appRoot = null;
|
|
7710
|
+
_writtenPaths = null;
|
|
7428
7711
|
/**
|
|
7429
7712
|
* Get or create singleton instance
|
|
7430
7713
|
* @param options - Configuration options
|
|
@@ -7510,7 +7793,7 @@ var init_PathResolver = __esm({
|
|
|
7510
7793
|
*/
|
|
7511
7794
|
getDirname(path) {
|
|
7512
7795
|
if (!path) return "";
|
|
7513
|
-
return this.normalizePath(
|
|
7796
|
+
return this.normalizePath(dirname2(path));
|
|
7514
7797
|
}
|
|
7515
7798
|
/**
|
|
7516
7799
|
* Resolve package path using Node's module resolution
|
|
@@ -7522,7 +7805,7 @@ var init_PathResolver = __esm({
|
|
|
7522
7805
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7523
7806
|
try {
|
|
7524
7807
|
const basePath = fromPath || this.getAppRoot();
|
|
7525
|
-
const require3 = createRequire(
|
|
7808
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7526
7809
|
const resolved = require3.resolve(packageSpecifier);
|
|
7527
7810
|
return this.normalizePath(resolved);
|
|
7528
7811
|
} catch (error2) {
|
|
@@ -7674,7 +7957,7 @@ var init_PathResolver = __esm({
|
|
|
7674
7957
|
return cleanContent;
|
|
7675
7958
|
} catch (error2) {
|
|
7676
7959
|
if (this.options.debug) {
|
|
7677
|
-
|
|
7960
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7678
7961
|
}
|
|
7679
7962
|
return null;
|
|
7680
7963
|
}
|
|
@@ -7702,7 +7985,7 @@ var init_PathResolver = __esm({
|
|
|
7702
7985
|
return cleanContent;
|
|
7703
7986
|
} catch (error2) {
|
|
7704
7987
|
if (this.options.debug) {
|
|
7705
|
-
|
|
7988
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7706
7989
|
}
|
|
7707
7990
|
return null;
|
|
7708
7991
|
}
|
|
@@ -7724,16 +8007,16 @@ var init_PathResolver = __esm({
|
|
|
7724
8007
|
verbose = false
|
|
7725
8008
|
} = options;
|
|
7726
8009
|
const normalizedPath = this.normalizePath(filePath);
|
|
7727
|
-
const dir = this.normalizePath(
|
|
8010
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7728
8011
|
const fileExists = this.pathExists(normalizedPath);
|
|
7729
8012
|
if (fileExists && !overwrite) {
|
|
7730
8013
|
if (verbose) {
|
|
7731
|
-
|
|
8014
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7732
8015
|
}
|
|
7733
8016
|
return false;
|
|
7734
8017
|
}
|
|
7735
8018
|
if (dryRun) {
|
|
7736
|
-
|
|
8019
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7737
8020
|
return true;
|
|
7738
8021
|
}
|
|
7739
8022
|
try {
|
|
@@ -7743,22 +8026,23 @@ var init_PathResolver = __esm({
|
|
|
7743
8026
|
}
|
|
7744
8027
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7745
8028
|
let writeContent;
|
|
7746
|
-
if (
|
|
8029
|
+
if (Buffer2.isBuffer(content)) {
|
|
7747
8030
|
writeContent = content;
|
|
7748
8031
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7749
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8032
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8033
|
+
`;
|
|
7750
8034
|
} else {
|
|
7751
8035
|
writeContent = String(content);
|
|
7752
8036
|
}
|
|
7753
8037
|
try {
|
|
7754
8038
|
return await safeExecuteAsync2(async () => {
|
|
7755
|
-
if (
|
|
8039
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7756
8040
|
await fs.promises.writeFile(normalizedPath, writeContent);
|
|
7757
8041
|
} else {
|
|
7758
8042
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7759
8043
|
}
|
|
7760
8044
|
if (verbose) {
|
|
7761
|
-
|
|
8045
|
+
log3.info(
|
|
7762
8046
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7763
8047
|
);
|
|
7764
8048
|
}
|
|
@@ -7785,16 +8069,16 @@ var init_PathResolver = __esm({
|
|
|
7785
8069
|
verbose = false
|
|
7786
8070
|
} = options;
|
|
7787
8071
|
const normalizedPath = this.normalizePath(filePath);
|
|
7788
|
-
const dir = this.normalizePath(
|
|
8072
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7789
8073
|
const fileExists = this.pathExists(normalizedPath);
|
|
7790
8074
|
if (fileExists && !overwrite) {
|
|
7791
8075
|
if (verbose) {
|
|
7792
|
-
|
|
8076
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7793
8077
|
}
|
|
7794
8078
|
return false;
|
|
7795
8079
|
}
|
|
7796
8080
|
if (dryRun) {
|
|
7797
|
-
|
|
8081
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7798
8082
|
return true;
|
|
7799
8083
|
}
|
|
7800
8084
|
try {
|
|
@@ -7804,21 +8088,23 @@ var init_PathResolver = __esm({
|
|
|
7804
8088
|
}
|
|
7805
8089
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7806
8090
|
let writeContent;
|
|
7807
|
-
if (
|
|
8091
|
+
if (Buffer2.isBuffer(content)) {
|
|
7808
8092
|
writeContent = content;
|
|
7809
8093
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7810
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8094
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8095
|
+
`;
|
|
7811
8096
|
} else {
|
|
7812
8097
|
writeContent = String(content);
|
|
7813
8098
|
}
|
|
7814
8099
|
try {
|
|
7815
|
-
if (
|
|
8100
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7816
8101
|
fs.writeFileSync(normalizedPath, writeContent);
|
|
7817
8102
|
} else {
|
|
7818
8103
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7819
8104
|
}
|
|
8105
|
+
this._writtenPaths?.add(normalizedPath);
|
|
7820
8106
|
if (verbose) {
|
|
7821
|
-
|
|
8107
|
+
log3.info(
|
|
7822
8108
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7823
8109
|
);
|
|
7824
8110
|
}
|
|
@@ -7843,15 +8129,15 @@ var init_PathResolver = __esm({
|
|
|
7843
8129
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7844
8130
|
if (fileExists && !overwrite) {
|
|
7845
8131
|
if (verbose) {
|
|
7846
|
-
|
|
8132
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7847
8133
|
}
|
|
7848
8134
|
return false;
|
|
7849
8135
|
}
|
|
7850
8136
|
if (dryRun) {
|
|
7851
|
-
|
|
8137
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7852
8138
|
return true;
|
|
7853
8139
|
}
|
|
7854
|
-
const dir = this.normalizePath(
|
|
8140
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7855
8141
|
try {
|
|
7856
8142
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7857
8143
|
} catch (error2) {
|
|
@@ -7861,7 +8147,7 @@ var init_PathResolver = __esm({
|
|
|
7861
8147
|
return await safeExecuteAsync2(async () => {
|
|
7862
8148
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7863
8149
|
if (verbose) {
|
|
7864
|
-
|
|
8150
|
+
log3.info(
|
|
7865
8151
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7866
8152
|
);
|
|
7867
8153
|
}
|
|
@@ -7885,15 +8171,15 @@ var init_PathResolver = __esm({
|
|
|
7885
8171
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7886
8172
|
if (fileExists && !overwrite) {
|
|
7887
8173
|
if (verbose) {
|
|
7888
|
-
|
|
8174
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7889
8175
|
}
|
|
7890
8176
|
return false;
|
|
7891
8177
|
}
|
|
7892
8178
|
if (dryRun) {
|
|
7893
|
-
|
|
8179
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7894
8180
|
return true;
|
|
7895
8181
|
}
|
|
7896
|
-
const dir = this.normalizePath(
|
|
8182
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7897
8183
|
try {
|
|
7898
8184
|
fs.mkdirSync(dir, { recursive: true });
|
|
7899
8185
|
} catch (error2) {
|
|
@@ -7901,8 +8187,9 @@ var init_PathResolver = __esm({
|
|
|
7901
8187
|
}
|
|
7902
8188
|
try {
|
|
7903
8189
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
8190
|
+
this._writtenPaths?.add(normalizedDestPath);
|
|
7904
8191
|
if (verbose) {
|
|
7905
|
-
|
|
8192
|
+
log3.info(
|
|
7906
8193
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7907
8194
|
);
|
|
7908
8195
|
}
|
|
@@ -7919,7 +8206,7 @@ var init_PathResolver = __esm({
|
|
|
7919
8206
|
return fs.existsSync(filePath);
|
|
7920
8207
|
} catch (error2) {
|
|
7921
8208
|
if (!silent) {
|
|
7922
|
-
|
|
8209
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7923
8210
|
}
|
|
7924
8211
|
return false;
|
|
7925
8212
|
}
|
|
@@ -7945,7 +8232,7 @@ var init_PathResolver = __esm({
|
|
|
7945
8232
|
return fs.readdirSync(dirPath, options);
|
|
7946
8233
|
} catch (error2) {
|
|
7947
8234
|
if (this.options.debug) {
|
|
7948
|
-
|
|
8235
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7949
8236
|
}
|
|
7950
8237
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7951
8238
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7963,11 +8250,29 @@ var init_PathResolver = __esm({
|
|
|
7963
8250
|
return fs.statSync(filePath);
|
|
7964
8251
|
} catch (error2) {
|
|
7965
8252
|
if (this.options.debug) {
|
|
7966
|
-
|
|
8253
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7967
8254
|
}
|
|
7968
8255
|
return null;
|
|
7969
8256
|
}
|
|
7970
8257
|
}
|
|
8258
|
+
/**
|
|
8259
|
+
* Resolve the real path of a file, following symlinks
|
|
8260
|
+
* @param filePath - Path to resolve
|
|
8261
|
+
* @returns Resolved real path
|
|
8262
|
+
*/
|
|
8263
|
+
realpathSync(filePath) {
|
|
8264
|
+
return fs.realpathSync(filePath);
|
|
8265
|
+
}
|
|
8266
|
+
/**
|
|
8267
|
+
* Watch a directory for changes
|
|
8268
|
+
* @param dirPath - Directory to watch
|
|
8269
|
+
* @param options - fs.watch options
|
|
8270
|
+
* @param callback - Callback for change events
|
|
8271
|
+
* @returns FSWatcher instance
|
|
8272
|
+
*/
|
|
8273
|
+
watch(dirPath, options, callback) {
|
|
8274
|
+
return fs.watch(dirPath, options, callback);
|
|
8275
|
+
}
|
|
7971
8276
|
/**
|
|
7972
8277
|
* Get file stats synchronously (follows symlinks)
|
|
7973
8278
|
* Returns null if file doesn't exist (graceful degradation)
|
|
@@ -7980,7 +8285,7 @@ var init_PathResolver = __esm({
|
|
|
7980
8285
|
return fs.lstatSync(filePath);
|
|
7981
8286
|
} catch (error2) {
|
|
7982
8287
|
if (this.options.debug) {
|
|
7983
|
-
|
|
8288
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7984
8289
|
}
|
|
7985
8290
|
return null;
|
|
7986
8291
|
}
|
|
@@ -8047,6 +8352,28 @@ var init_PathResolver = __esm({
|
|
|
8047
8352
|
* Get app root (where vite.config.ts is, Vite's config.root)
|
|
8048
8353
|
* Falls back to repoRoot if not set
|
|
8049
8354
|
*/
|
|
8355
|
+
/**
|
|
8356
|
+
* Start recording every path written by writeSync/copySync.
|
|
8357
|
+
* Lets a generator know exactly which files the current run produced,
|
|
8358
|
+
* without comparing file timestamps to a clock.
|
|
8359
|
+
*/
|
|
8360
|
+
startWriteRecording() {
|
|
8361
|
+
this._writtenPaths = /* @__PURE__ */ new Set();
|
|
8362
|
+
}
|
|
8363
|
+
/**
|
|
8364
|
+
* Stop recording and return the normalized paths written since
|
|
8365
|
+
* startWriteRecording().
|
|
8366
|
+
*/
|
|
8367
|
+
stopWriteRecording() {
|
|
8368
|
+
if (!this._writtenPaths) {
|
|
8369
|
+
throw new Error(
|
|
8370
|
+
"stopWriteRecording() called without startWriteRecording()"
|
|
8371
|
+
);
|
|
8372
|
+
}
|
|
8373
|
+
const written = this._writtenPaths;
|
|
8374
|
+
this._writtenPaths = null;
|
|
8375
|
+
return written;
|
|
8376
|
+
}
|
|
8050
8377
|
getAppRoot() {
|
|
8051
8378
|
if (!this._appRoot) {
|
|
8052
8379
|
return this._repoRoot;
|
|
@@ -8069,7 +8396,7 @@ var init_PathResolver = __esm({
|
|
|
8069
8396
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
8070
8397
|
*/
|
|
8071
8398
|
isMonorepo() {
|
|
8072
|
-
const packagesDir =
|
|
8399
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
8073
8400
|
return this.pathExists(packagesDir);
|
|
8074
8401
|
}
|
|
8075
8402
|
/**
|
|
@@ -8086,7 +8413,7 @@ var init_PathResolver = __esm({
|
|
|
8086
8413
|
* Find files matching pattern within directory
|
|
8087
8414
|
*/
|
|
8088
8415
|
async findFiles(directory, pattern, options = {}) {
|
|
8089
|
-
const searchPattern = this.normalizePath(
|
|
8416
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
8090
8417
|
const appRoot = this.getAppRoot();
|
|
8091
8418
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
8092
8419
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8133,7 +8460,7 @@ var init_PathResolver = __esm({
|
|
|
8133
8460
|
return null;
|
|
8134
8461
|
}
|
|
8135
8462
|
const resolvedPath = this.normalizePath(
|
|
8136
|
-
|
|
8463
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8137
8464
|
);
|
|
8138
8465
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8139
8466
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8304,6 +8631,15 @@ var init_PathResolver = __esm({
|
|
|
8304
8631
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8305
8632
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8306
8633
|
}
|
|
8634
|
+
/**
|
|
8635
|
+
* Get absolute path to empty flag component module.
|
|
8636
|
+
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8637
|
+
* to replace unused flag files at build time.
|
|
8638
|
+
*/
|
|
8639
|
+
getEmptyFlagModulePath() {
|
|
8640
|
+
const __dirname3 = dirname2(fileURLToPath(import.meta.url));
|
|
8641
|
+
return this.normalizePath(resolve(__dirname3, "emptyFlag.js"));
|
|
8642
|
+
}
|
|
8307
8643
|
/**
|
|
8308
8644
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8309
8645
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8329,13 +8665,13 @@ var init_PathResolver = __esm({
|
|
|
8329
8665
|
const maxLevels = this.options.maxLevels;
|
|
8330
8666
|
while (levelsChecked < maxLevels) {
|
|
8331
8667
|
const toolingPath = this.normalizePath(
|
|
8332
|
-
|
|
8668
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8333
8669
|
);
|
|
8334
|
-
const corePath = this.normalizePath(
|
|
8670
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8335
8671
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8336
8672
|
return currentDir;
|
|
8337
8673
|
}
|
|
8338
|
-
const appsDir =
|
|
8674
|
+
const appsDir = join2(currentDir, "apps");
|
|
8339
8675
|
if (this.pathExists(appsDir)) {
|
|
8340
8676
|
const appsDirStat = this.statSync(appsDir);
|
|
8341
8677
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8343,15 +8679,15 @@ var init_PathResolver = __esm({
|
|
|
8343
8679
|
}
|
|
8344
8680
|
}
|
|
8345
8681
|
const packageJsonPath = this.normalizePath(
|
|
8346
|
-
|
|
8682
|
+
join2(currentDir, "package.json")
|
|
8347
8683
|
);
|
|
8348
8684
|
if (this.pathExists(packageJsonPath)) {
|
|
8349
|
-
const parentDir2 = this.normalizePath(
|
|
8685
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8350
8686
|
if (parentDir2 === currentDir) {
|
|
8351
8687
|
return currentDir;
|
|
8352
8688
|
}
|
|
8353
8689
|
}
|
|
8354
|
-
const parentDir = this.normalizePath(
|
|
8690
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8355
8691
|
if (parentDir === currentDir) {
|
|
8356
8692
|
break;
|
|
8357
8693
|
}
|
|
@@ -8367,8 +8703,8 @@ var init_PathResolver = __esm({
|
|
|
8367
8703
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8368
8704
|
import { createRequire as createRequire2 } from "node:module";
|
|
8369
8705
|
import {
|
|
8370
|
-
join as
|
|
8371
|
-
dirname as
|
|
8706
|
+
join as join3,
|
|
8707
|
+
dirname as dirname3,
|
|
8372
8708
|
basename as basename2,
|
|
8373
8709
|
extname as extname2,
|
|
8374
8710
|
relative as relative2,
|
|
@@ -8377,11 +8713,11 @@ import {
|
|
|
8377
8713
|
isAbsolute as pathIsAbsolute
|
|
8378
8714
|
} from "node:path";
|
|
8379
8715
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8380
|
-
function
|
|
8716
|
+
function readdirSync3(dirPath, options) {
|
|
8381
8717
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8382
8718
|
}
|
|
8383
8719
|
function getDirnameFromUrl(importMetaUrl) {
|
|
8384
|
-
return
|
|
8720
|
+
return dirname3(fileURLToPath2(importMetaUrl));
|
|
8385
8721
|
}
|
|
8386
8722
|
function detectExecutionMode() {
|
|
8387
8723
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
@@ -8397,7 +8733,7 @@ function getTemplatesRoot() {
|
|
|
8397
8733
|
const mode = detectExecutionMode();
|
|
8398
8734
|
if (mode === "development") {
|
|
8399
8735
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
8400
|
-
const frameworkRoot = normalizePath(
|
|
8736
|
+
const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
|
|
8401
8737
|
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8402
8738
|
} else {
|
|
8403
8739
|
try {
|
|
@@ -8413,7 +8749,7 @@ function getTemplatesRoot() {
|
|
|
8413
8749
|
try {
|
|
8414
8750
|
const req = createRequire2(import.meta.url);
|
|
8415
8751
|
const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
|
|
8416
|
-
const cliRoot2 = normalizePath(
|
|
8752
|
+
const cliRoot2 = normalizePath(dirname3(cliPackageJsonPath));
|
|
8417
8753
|
const templatesPath = normalizePath(cliRoot2, "templates");
|
|
8418
8754
|
if (pathExists(templatesPath)) {
|
|
8419
8755
|
return templatesPath;
|
|
@@ -8465,8 +8801,8 @@ async function glob(pattern, options = {}) {
|
|
|
8465
8801
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8466
8802
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8467
8803
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8468
|
-
const relativePatterns = patterns.map((
|
|
8469
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
8804
|
+
const relativePatterns = patterns.map((p) => {
|
|
8805
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8470
8806
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8471
8807
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8472
8808
|
}
|
|
@@ -8502,7 +8838,7 @@ var init_pathResolver = __esm({
|
|
|
8502
8838
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8503
8839
|
resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
|
|
8504
8840
|
normalizePath = (...pathSegments) => {
|
|
8505
|
-
return pathResolverInstance.normalizePath(
|
|
8841
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8506
8842
|
};
|
|
8507
8843
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8508
8844
|
read = async (filePath, options) => pathResolverInstance.read(filePath, options);
|
|
@@ -8515,13 +8851,13 @@ var init_pathResolver = __esm({
|
|
|
8515
8851
|
ensureDir = async (dirPath) => pathResolverInstance.ensureDir(dirPath);
|
|
8516
8852
|
findFiles = async (directory, pattern, options = {}) => pathResolverInstance.findFiles(directory, pattern, options);
|
|
8517
8853
|
fromAppRoot = (...pathSegments) => {
|
|
8518
|
-
return pathResolverInstance.resolveAppPath(
|
|
8854
|
+
return pathResolverInstance.resolveAppPath(join3(...pathSegments));
|
|
8519
8855
|
};
|
|
8520
8856
|
getRelativePathBetween = (from, to) => {
|
|
8521
8857
|
return normalizePath(relative2(from, to));
|
|
8522
8858
|
};
|
|
8523
8859
|
getDirname = (filePath) => {
|
|
8524
|
-
return normalizePath(
|
|
8860
|
+
return normalizePath(dirname3(filePath));
|
|
8525
8861
|
};
|
|
8526
8862
|
getBasename = (filePath, ext) => {
|
|
8527
8863
|
return basename2(filePath, ext);
|
|
@@ -8561,10 +8897,10 @@ var init_typed_file_operations = __esm({
|
|
|
8561
8897
|
});
|
|
8562
8898
|
|
|
8563
8899
|
// packages/tooling/src/bundler/utils.ts
|
|
8564
|
-
import { Buffer } from "node:buffer";
|
|
8900
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8565
8901
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8566
8902
|
import { createRequire as createRequire3 } from "node:module";
|
|
8567
|
-
import { dirname as
|
|
8903
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8568
8904
|
import process from "node:process";
|
|
8569
8905
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8570
8906
|
var require2, __filename, __dirname;
|
|
@@ -8573,12 +8909,12 @@ var init_utils2 = __esm({
|
|
|
8573
8909
|
"use strict";
|
|
8574
8910
|
require2 = createRequire3(import.meta.url);
|
|
8575
8911
|
__filename = fileURLToPath3(import.meta.url);
|
|
8576
|
-
__dirname =
|
|
8912
|
+
__dirname = dirname4(__filename);
|
|
8577
8913
|
if (typeof globalThis !== "undefined") {
|
|
8578
8914
|
globalThis.require = require2;
|
|
8579
8915
|
globalThis.__filename = __filename;
|
|
8580
8916
|
globalThis.__dirname = __dirname;
|
|
8581
|
-
globalThis.Buffer =
|
|
8917
|
+
globalThis.Buffer = Buffer2;
|
|
8582
8918
|
globalThis.process = process;
|
|
8583
8919
|
if (typeof global === "undefined") {
|
|
8584
8920
|
globalThis.global = globalThis;
|
|
@@ -8601,7 +8937,7 @@ function detectApps(projectRoot) {
|
|
|
8601
8937
|
const appsDir = joinPath(projectRoot, "apps");
|
|
8602
8938
|
const appsDirStat = statSync2(appsDir);
|
|
8603
8939
|
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
8604
|
-
const appDirs =
|
|
8940
|
+
const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
8605
8941
|
for (const appDir of appDirs) {
|
|
8606
8942
|
const appPath = joinPath(appsDir, appDir);
|
|
8607
8943
|
const packageJsonPath = joinPath(appPath, "package.json");
|
|
@@ -8827,17 +9163,17 @@ var init_app_detection = __esm({
|
|
|
8827
9163
|
async function selectApp(projectRoot, appName) {
|
|
8828
9164
|
const apps = detectApps(projectRoot);
|
|
8829
9165
|
if (apps.length === 0) {
|
|
8830
|
-
|
|
8831
|
-
|
|
9166
|
+
log2.error("No apps found in this project.");
|
|
9167
|
+
log2.info('Run "dndev init" to create a new project.');
|
|
8832
9168
|
return null;
|
|
8833
9169
|
}
|
|
8834
9170
|
if (appName) {
|
|
8835
|
-
const app = apps.find((
|
|
9171
|
+
const app = apps.find((a2) => a2.name === appName);
|
|
8836
9172
|
if (!app) {
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
apps.forEach((
|
|
8840
|
-
|
|
9173
|
+
log2.warn(`App "${appName}" not found.`);
|
|
9174
|
+
log2.info("Available apps:");
|
|
9175
|
+
apps.forEach((a2) => log2.info(` - ${a2.name}`));
|
|
9176
|
+
log2.info("Please select from the list:");
|
|
8841
9177
|
} else {
|
|
8842
9178
|
return app;
|
|
8843
9179
|
}
|
|
@@ -8845,7 +9181,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8845
9181
|
if (apps.length === 1) {
|
|
8846
9182
|
return apps[0] || null;
|
|
8847
9183
|
}
|
|
8848
|
-
const selected = await
|
|
9184
|
+
const selected = await select({
|
|
8849
9185
|
message: "Select app:",
|
|
8850
9186
|
options: apps.map((app) => ({
|
|
8851
9187
|
value: app.name,
|
|
@@ -8855,7 +9191,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8855
9191
|
if (typeof selected !== "string") {
|
|
8856
9192
|
return null;
|
|
8857
9193
|
}
|
|
8858
|
-
return apps.find((
|
|
9194
|
+
return apps.find((a2) => a2.name === selected) || null;
|
|
8859
9195
|
}
|
|
8860
9196
|
var init_app_selector = __esm({
|
|
8861
9197
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
@@ -8869,24 +9205,24 @@ var init_app_selector = __esm({
|
|
|
8869
9205
|
|
|
8870
9206
|
// packages/tooling/src/utils/cli-input.ts
|
|
8871
9207
|
async function askForInput(message, defaultValue = "") {
|
|
8872
|
-
const result = await
|
|
9208
|
+
const result = await text({
|
|
8873
9209
|
message,
|
|
8874
9210
|
placeholder: defaultValue || void 0,
|
|
8875
9211
|
defaultValue: defaultValue || void 0
|
|
8876
9212
|
});
|
|
8877
|
-
if (
|
|
8878
|
-
|
|
9213
|
+
if (isCancel(result)) {
|
|
9214
|
+
cancel("Operation cancelled.");
|
|
8879
9215
|
process.exit(0);
|
|
8880
9216
|
}
|
|
8881
9217
|
return result;
|
|
8882
9218
|
}
|
|
8883
9219
|
async function askForConfirmation(message, defaultValue = false) {
|
|
8884
|
-
const result = await
|
|
9220
|
+
const result = await confirm({
|
|
8885
9221
|
message,
|
|
8886
9222
|
initialValue: defaultValue
|
|
8887
9223
|
});
|
|
8888
|
-
if (
|
|
8889
|
-
|
|
9224
|
+
if (isCancel(result)) {
|
|
9225
|
+
cancel("Operation cancelled.");
|
|
8890
9226
|
process.exit(0);
|
|
8891
9227
|
}
|
|
8892
9228
|
return result;
|
|
@@ -8897,13 +9233,13 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8897
9233
|
label: choice.title,
|
|
8898
9234
|
hint: choice.hint
|
|
8899
9235
|
}));
|
|
8900
|
-
const result = await
|
|
9236
|
+
const result = await select({
|
|
8901
9237
|
message,
|
|
8902
9238
|
options,
|
|
8903
9239
|
initialValue: choices[defaultValue]?.value
|
|
8904
9240
|
});
|
|
8905
|
-
if (
|
|
8906
|
-
|
|
9241
|
+
if (isCancel(result)) {
|
|
9242
|
+
cancel("Operation cancelled.");
|
|
8907
9243
|
process.exit(0);
|
|
8908
9244
|
}
|
|
8909
9245
|
return result;
|
|
@@ -8994,9 +9330,9 @@ async function validateToken(token) {
|
|
|
8994
9330
|
return { username: data.user.username, email: data.user.email };
|
|
8995
9331
|
}
|
|
8996
9332
|
async function fetchProjectDetails(token, projectId, orgId) {
|
|
8997
|
-
const
|
|
9333
|
+
const q = orgId ? `?teamId=${encodeURIComponent(orgId)}` : "";
|
|
8998
9334
|
const res = await fetch(
|
|
8999
|
-
`${VERCEL_API}/v9/projects/${encodeURIComponent(projectId)}${
|
|
9335
|
+
`${VERCEL_API}/v9/projects/${encodeURIComponent(projectId)}${q}`,
|
|
9000
9336
|
{
|
|
9001
9337
|
headers: { Authorization: `Bearer ${token}` }
|
|
9002
9338
|
}
|
|
@@ -9113,7 +9449,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
9113
9449
|
if (value) {
|
|
9114
9450
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
9115
9451
|
warnedLegacy.add(name);
|
|
9116
|
-
|
|
9452
|
+
log2.warn(
|
|
9117
9453
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
9118
9454
|
);
|
|
9119
9455
|
}
|
|
@@ -9124,7 +9460,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
9124
9460
|
if (aliasValue) {
|
|
9125
9461
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
9126
9462
|
warnedLegacy.add(name);
|
|
9127
|
-
|
|
9463
|
+
log2.warn(
|
|
9128
9464
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
9129
9465
|
);
|
|
9130
9466
|
}
|
|
@@ -9267,24 +9603,24 @@ function isFirebaseInstalled() {
|
|
|
9267
9603
|
}
|
|
9268
9604
|
async function checkPrerequisites() {
|
|
9269
9605
|
if (!isFirebaseInstalled()) {
|
|
9270
|
-
|
|
9271
|
-
|
|
9606
|
+
log2.error("Firebase CLI is not installed.");
|
|
9607
|
+
log2.info("Install it with: bun install -g firebase-tools");
|
|
9272
9608
|
process.exit(1);
|
|
9273
9609
|
}
|
|
9274
9610
|
if (!isFirebaseLoggedIn()) {
|
|
9275
|
-
|
|
9611
|
+
log2.warn("Not logged into Firebase. Running firebase login...");
|
|
9276
9612
|
const result = spawnSync("firebase login", {
|
|
9277
9613
|
stdio: "inherit",
|
|
9278
9614
|
shell: true
|
|
9279
9615
|
});
|
|
9280
9616
|
if (result.status !== 0) {
|
|
9281
|
-
|
|
9617
|
+
log2.error("Firebase login failed.");
|
|
9282
9618
|
process.exit(1);
|
|
9283
9619
|
}
|
|
9284
9620
|
}
|
|
9285
9621
|
}
|
|
9286
9622
|
async function selectOrCreateProject() {
|
|
9287
|
-
const s =
|
|
9623
|
+
const s = spinner();
|
|
9288
9624
|
s.start("Fetching Firebase projects...");
|
|
9289
9625
|
const data = firebaseJson(["projects:list"]);
|
|
9290
9626
|
if (data.status !== "success" || !Array.isArray(data.result) || !data.result.length) {
|
|
@@ -9296,9 +9632,9 @@ async function selectOrCreateProject() {
|
|
|
9296
9632
|
if (!createNew) process.exit(0);
|
|
9297
9633
|
return await createProject();
|
|
9298
9634
|
}
|
|
9299
|
-
const projects = (Array.isArray(data.result) ? data.result : []).map((
|
|
9300
|
-
if (
|
|
9301
|
-
const project =
|
|
9635
|
+
const projects = (Array.isArray(data.result) ? data.result : []).map((p) => {
|
|
9636
|
+
if (p && typeof p === "object" && "projectId" in p) {
|
|
9637
|
+
const project = p;
|
|
9302
9638
|
return {
|
|
9303
9639
|
projectId: project.projectId,
|
|
9304
9640
|
displayName: project.displayName || project.projectId
|
|
@@ -9308,9 +9644,9 @@ async function selectOrCreateProject() {
|
|
|
9308
9644
|
});
|
|
9309
9645
|
s.stop(`Found ${projects.length} project(s).`);
|
|
9310
9646
|
const choices = [
|
|
9311
|
-
...projects.map((
|
|
9312
|
-
title: `${
|
|
9313
|
-
value:
|
|
9647
|
+
...projects.map((p) => ({
|
|
9648
|
+
title: `${p.displayName} (${p.projectId})`,
|
|
9649
|
+
value: p.projectId
|
|
9314
9650
|
})),
|
|
9315
9651
|
{ title: "+ Create new project", value: "__create__" }
|
|
9316
9652
|
];
|
|
@@ -9318,7 +9654,7 @@ async function selectOrCreateProject() {
|
|
|
9318
9654
|
if (selected === "__create__") {
|
|
9319
9655
|
return await createProject();
|
|
9320
9656
|
}
|
|
9321
|
-
return projects.find((
|
|
9657
|
+
return projects.find((p) => p.projectId === selected);
|
|
9322
9658
|
}
|
|
9323
9659
|
async function createProject() {
|
|
9324
9660
|
const projectId = await askForInput(
|
|
@@ -9326,7 +9662,7 @@ async function createProject() {
|
|
|
9326
9662
|
""
|
|
9327
9663
|
);
|
|
9328
9664
|
const displayName = await askForInput("Display name", projectId);
|
|
9329
|
-
const s =
|
|
9665
|
+
const s = spinner();
|
|
9330
9666
|
s.start(`Creating Firebase project "${projectId}"...`);
|
|
9331
9667
|
try {
|
|
9332
9668
|
const data = firebaseJson([
|
|
@@ -9337,19 +9673,19 @@ async function createProject() {
|
|
|
9337
9673
|
]);
|
|
9338
9674
|
if (data.status !== "success") {
|
|
9339
9675
|
s.stop("Failed to create project.");
|
|
9340
|
-
|
|
9676
|
+
log2.error(data.error || "Unknown error");
|
|
9341
9677
|
process.exit(1);
|
|
9342
9678
|
}
|
|
9343
9679
|
s.stop(`Project "${projectId}" created.`);
|
|
9344
9680
|
} catch (err) {
|
|
9345
9681
|
s.stop("Failed to create project.");
|
|
9346
|
-
|
|
9682
|
+
log2.error(getErrorMessage(err));
|
|
9347
9683
|
process.exit(1);
|
|
9348
9684
|
}
|
|
9349
9685
|
return { projectId, displayName };
|
|
9350
9686
|
}
|
|
9351
9687
|
async function ensureWebApp(projectId) {
|
|
9352
|
-
const s =
|
|
9688
|
+
const s = spinner();
|
|
9353
9689
|
s.start("Getting web app config...");
|
|
9354
9690
|
try {
|
|
9355
9691
|
const data = firebaseJson([
|
|
@@ -9373,12 +9709,12 @@ async function ensureWebApp(projectId) {
|
|
|
9373
9709
|
projectId
|
|
9374
9710
|
]);
|
|
9375
9711
|
if (createResult.status !== "success") {
|
|
9376
|
-
|
|
9712
|
+
log2.error(
|
|
9377
9713
|
"Failed to create web app: " + (createResult.error || "Unknown error")
|
|
9378
9714
|
);
|
|
9379
9715
|
process.exit(1);
|
|
9380
9716
|
}
|
|
9381
|
-
const s2 =
|
|
9717
|
+
const s2 = spinner();
|
|
9382
9718
|
s2.start("Retrieving SDK config...");
|
|
9383
9719
|
await new Promise((resolve4) => setTimeout(resolve4, 2e3));
|
|
9384
9720
|
const configData = firebaseJson([
|
|
@@ -9389,7 +9725,7 @@ async function ensureWebApp(projectId) {
|
|
|
9389
9725
|
]);
|
|
9390
9726
|
if (configData.status !== "success" || !configData.result || typeof configData.result !== "object" || !("sdkConfig" in configData.result)) {
|
|
9391
9727
|
s2.stop("Failed to retrieve SDK config.");
|
|
9392
|
-
|
|
9728
|
+
log2.error(
|
|
9393
9729
|
"Could not get SDK config. Try running this command again in a minute."
|
|
9394
9730
|
);
|
|
9395
9731
|
process.exit(1);
|
|
@@ -9441,13 +9777,13 @@ function writeEnvFile(appDir, config, framework) {
|
|
|
9441
9777
|
`${prefix}FIREBASE_FUNCTIONS_REGION=europe-west1`
|
|
9442
9778
|
];
|
|
9443
9779
|
const content = [
|
|
9444
|
-
...preserved.filter((
|
|
9780
|
+
...preserved.filter((l2) => l2.trim() !== ""),
|
|
9445
9781
|
"",
|
|
9446
9782
|
...firebaseBlock,
|
|
9447
9783
|
""
|
|
9448
9784
|
].join("\n");
|
|
9449
9785
|
write(envPath, content);
|
|
9450
|
-
|
|
9786
|
+
log2.success(`Written Firebase config to ${envPath}`);
|
|
9451
9787
|
}
|
|
9452
9788
|
function updateFirebaserc(projectRoot, projectId) {
|
|
9453
9789
|
const rcPath = joinPath(projectRoot, ".firebaserc");
|
|
@@ -9467,7 +9803,7 @@ function updateFirebaserc(projectRoot, projectId) {
|
|
|
9467
9803
|
if (!rc.projects) rc.projects = {};
|
|
9468
9804
|
rc.projects.default = projectId;
|
|
9469
9805
|
write(rcPath, JSON.stringify(rc, null, 2) + "\n");
|
|
9470
|
-
|
|
9806
|
+
log2.success(`Updated .firebaserc with project "${projectId}"`);
|
|
9471
9807
|
}
|
|
9472
9808
|
function updateFirebaseJson(projectRoot, projectId) {
|
|
9473
9809
|
const fjPath = joinPath(projectRoot, "firebase.json");
|
|
@@ -9477,11 +9813,11 @@ function updateFirebaseJson(projectRoot, projectId) {
|
|
|
9477
9813
|
content = content.replace(/\{\{YOUR_FIREBASE_PROJECT_ID\}\}/g, projectId);
|
|
9478
9814
|
content = content.replace(/\{\{firebaseProjectId\}\}/g, projectId);
|
|
9479
9815
|
write(fjPath, content);
|
|
9480
|
-
|
|
9816
|
+
log2.success("Updated firebase.json with project ID");
|
|
9481
9817
|
}
|
|
9482
9818
|
}
|
|
9483
9819
|
async function main(options = {}) {
|
|
9484
|
-
|
|
9820
|
+
intro("Firebase Setup");
|
|
9485
9821
|
await checkPrerequisites();
|
|
9486
9822
|
const projectRoot = process.cwd();
|
|
9487
9823
|
let appDir = projectRoot;
|
|
@@ -9498,12 +9834,12 @@ async function main(options = {}) {
|
|
|
9498
9834
|
}
|
|
9499
9835
|
}
|
|
9500
9836
|
const project = await selectOrCreateProject();
|
|
9501
|
-
|
|
9837
|
+
log2.info(`Using Firebase project: ${project.projectId}`);
|
|
9502
9838
|
const sdkConfig = await ensureWebApp(project.projectId);
|
|
9503
9839
|
writeEnvFile(appDir, sdkConfig, framework);
|
|
9504
9840
|
updateFirebaserc(projectRoot, project.projectId);
|
|
9505
9841
|
updateFirebaseJson(projectRoot, project.projectId);
|
|
9506
|
-
|
|
9842
|
+
note(
|
|
9507
9843
|
[
|
|
9508
9844
|
`Go to the Firebase Console:`,
|
|
9509
9845
|
`https://console.firebase.google.com/project/${project.projectId}/settings/serviceaccounts/adminsdk`,
|
|
@@ -9516,7 +9852,7 @@ async function main(options = {}) {
|
|
|
9516
9852
|
].join("\n"),
|
|
9517
9853
|
"Download Service Account Key"
|
|
9518
9854
|
);
|
|
9519
|
-
|
|
9855
|
+
note(
|
|
9520
9856
|
[
|
|
9521
9857
|
`Enable these services in the Firebase Console:`,
|
|
9522
9858
|
``,
|
|
@@ -9534,7 +9870,7 @@ async function main(options = {}) {
|
|
|
9534
9870
|
].join("\n"),
|
|
9535
9871
|
"Enable Firebase Services"
|
|
9536
9872
|
);
|
|
9537
|
-
|
|
9873
|
+
note(
|
|
9538
9874
|
[
|
|
9539
9875
|
`Project: ${project.projectId}`,
|
|
9540
9876
|
`App .env: ${appDir}/.env (Firebase config written)`,
|
|
@@ -9550,7 +9886,7 @@ async function main(options = {}) {
|
|
|
9550
9886
|
].join("\n"),
|
|
9551
9887
|
"Setup Complete"
|
|
9552
9888
|
);
|
|
9553
|
-
|
|
9889
|
+
outro(
|
|
9554
9890
|
"Firebase setup done. Complete the manual steps above, then run dndev emu start."
|
|
9555
9891
|
);
|
|
9556
9892
|
}
|
|
@@ -9595,7 +9931,7 @@ var init_firebase = __esm({
|
|
|
9595
9931
|
try {
|
|
9596
9932
|
const project = await selectOrCreateProject();
|
|
9597
9933
|
projectId = project.projectId;
|
|
9598
|
-
|
|
9934
|
+
log2.info(`Using Firebase project: ${projectId}`);
|
|
9599
9935
|
steps.push({
|
|
9600
9936
|
name: "Project selection",
|
|
9601
9937
|
status: "success",
|
|
@@ -9669,7 +10005,7 @@ var init_firebase = __esm({
|
|
|
9669
10005
|
message: getErrorMessage(err)
|
|
9670
10006
|
});
|
|
9671
10007
|
}
|
|
9672
|
-
|
|
10008
|
+
note(
|
|
9673
10009
|
[
|
|
9674
10010
|
`Go to the Firebase Console:`,
|
|
9675
10011
|
`https://console.firebase.google.com/project/${projectId}/settings/serviceaccounts/adminsdk`,
|
|
@@ -9688,7 +10024,7 @@ var init_firebase = __esm({
|
|
|
9688
10024
|
message: "Download from Firebase Console",
|
|
9689
10025
|
coachingTopic: "firebase-service-account"
|
|
9690
10026
|
});
|
|
9691
|
-
|
|
10027
|
+
note(
|
|
9692
10028
|
[
|
|
9693
10029
|
`Enable these services in the Firebase Console:`,
|
|
9694
10030
|
``,
|
|
@@ -9746,7 +10082,7 @@ async function cleanupOldEntityMigrations(supabaseDir, latestFile) {
|
|
|
9746
10082
|
} catch {
|
|
9747
10083
|
}
|
|
9748
10084
|
}
|
|
9749
|
-
|
|
10085
|
+
log2.info(`Cleaned up ${toRemove.length} old entity migration file(s)`);
|
|
9750
10086
|
}
|
|
9751
10087
|
async function executeMigration(options) {
|
|
9752
10088
|
const { supabaseDir, supabaseUrl, accessToken } = options;
|
|
@@ -9757,7 +10093,7 @@ async function executeMigration(options) {
|
|
|
9757
10093
|
if (!pathExists(migrationsDir)) {
|
|
9758
10094
|
throw new Error(`Migrations directory not found: ${migrationsDir}`);
|
|
9759
10095
|
}
|
|
9760
|
-
const sqlFiles =
|
|
10096
|
+
const sqlFiles = readdirSync3(migrationsDir).filter((f) => f.endsWith(".sql")).sort().map((f) => joinPath(migrationsDir, f));
|
|
9761
10097
|
if (sqlFiles.length === 0) {
|
|
9762
10098
|
throw new Error(`No .sql files found in ${migrationsDir}`);
|
|
9763
10099
|
}
|
|
@@ -9780,7 +10116,7 @@ async function executeMigration(options) {
|
|
|
9780
10116
|
Ensure SUPABASE_ACCESS_TOKEN is valid. Get one from: https://supabase.com/dashboard/account/tokens`
|
|
9781
10117
|
);
|
|
9782
10118
|
}
|
|
9783
|
-
|
|
10119
|
+
log2.info("Migrations executed via Supabase Management API");
|
|
9784
10120
|
}
|
|
9785
10121
|
var init_supabase_management = __esm({
|
|
9786
10122
|
"packages/tooling/src/utils/supabase-management.ts"() {
|
|
@@ -9848,7 +10184,7 @@ var init_base_generator = __esm({
|
|
|
9848
10184
|
* @author AMBROISE PARK Consulting
|
|
9849
10185
|
*/
|
|
9850
10186
|
async run() {
|
|
9851
|
-
|
|
10187
|
+
note(`Running ${this.name} Generator`);
|
|
9852
10188
|
const result = {
|
|
9853
10189
|
filesGenerated: 0,
|
|
9854
10190
|
filesSkipped: 0,
|
|
@@ -9860,20 +10196,20 @@ var init_base_generator = __esm({
|
|
|
9860
10196
|
try {
|
|
9861
10197
|
await this.setup(result);
|
|
9862
10198
|
const entityFiles = await this.findEntityFiles();
|
|
9863
|
-
|
|
10199
|
+
log2.info("Parsing entities...");
|
|
9864
10200
|
const foundEntities = [];
|
|
9865
10201
|
for (const entityFile of entityFiles) {
|
|
9866
10202
|
try {
|
|
9867
10203
|
const entityName = await this.processEntityFile(entityFile, result);
|
|
9868
10204
|
if (entityName) foundEntities.push(entityName);
|
|
9869
10205
|
} catch (err) {
|
|
9870
|
-
|
|
10206
|
+
log2.error(`Error processing entity file ${entityFile}:`, err);
|
|
9871
10207
|
result.messages?.push(
|
|
9872
10208
|
`Error processing entity file ${entityFile}: ${err instanceof Error ? err.message : String(err)}`
|
|
9873
10209
|
);
|
|
9874
10210
|
}
|
|
9875
10211
|
}
|
|
9876
|
-
|
|
10212
|
+
log2.info(
|
|
9877
10213
|
`Found ${foundEntities.length} entities: ${foundEntities.join(", ")}`
|
|
9878
10214
|
);
|
|
9879
10215
|
await this.generateAdditionalFiles(result);
|
|
@@ -9882,7 +10218,7 @@ var init_base_generator = __esm({
|
|
|
9882
10218
|
result.success = true;
|
|
9883
10219
|
return result;
|
|
9884
10220
|
} catch (err) {
|
|
9885
|
-
|
|
10221
|
+
log2.error(`Failed to run ${this.name} generator:`, err);
|
|
9886
10222
|
result.messages?.push(
|
|
9887
10223
|
`Failed to run generator: ${err instanceof Error ? err.message : String(err)}`
|
|
9888
10224
|
);
|
|
@@ -9926,7 +10262,7 @@ var init_base_generator = __esm({
|
|
|
9926
10262
|
const allFiles = [];
|
|
9927
10263
|
for (const dir of this.entityDirs) {
|
|
9928
10264
|
if (!pathExists(dir)) {
|
|
9929
|
-
|
|
10265
|
+
log2.warn(`Entity directory does not exist: ${dir}`);
|
|
9930
10266
|
continue;
|
|
9931
10267
|
}
|
|
9932
10268
|
try {
|
|
@@ -9937,7 +10273,7 @@ var init_base_generator = __esm({
|
|
|
9937
10273
|
});
|
|
9938
10274
|
allFiles.push(...filteredFiles);
|
|
9939
10275
|
} catch (err) {
|
|
9940
|
-
|
|
10276
|
+
log2.warn(`Could not find files in ${dir}:`, err);
|
|
9941
10277
|
}
|
|
9942
10278
|
}
|
|
9943
10279
|
return allFiles;
|
|
@@ -9971,14 +10307,14 @@ var init_base_generator = __esm({
|
|
|
9971
10307
|
const fileExists = pathExists(normalizedPath);
|
|
9972
10308
|
if (fileExists && !this.overwrite) {
|
|
9973
10309
|
if (this.verbose) {
|
|
9974
|
-
|
|
10310
|
+
log2.info(`Skipping existing file: ${normalizedPath}`);
|
|
9975
10311
|
}
|
|
9976
10312
|
result.filesSkipped++;
|
|
9977
10313
|
result.skippedFiles.push(normalizedPath);
|
|
9978
10314
|
return false;
|
|
9979
10315
|
}
|
|
9980
10316
|
if (this.dryRun) {
|
|
9981
|
-
|
|
10317
|
+
log2.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
9982
10318
|
result.filesGenerated++;
|
|
9983
10319
|
result.generatedFiles.push(normalizedPath);
|
|
9984
10320
|
return true;
|
|
@@ -9994,7 +10330,7 @@ var init_base_generator = __esm({
|
|
|
9994
10330
|
);
|
|
9995
10331
|
if (writeResult) {
|
|
9996
10332
|
if (this.verbose) {
|
|
9997
|
-
|
|
10333
|
+
log2.info(
|
|
9998
10334
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
9999
10335
|
);
|
|
10000
10336
|
}
|
|
@@ -10053,7 +10389,7 @@ var init_base_generator = __esm({
|
|
|
10053
10389
|
);
|
|
10054
10390
|
}
|
|
10055
10391
|
try {
|
|
10056
|
-
return templateContent.replace(/\$\{([^}]+)\}/g, (
|
|
10392
|
+
return templateContent.replace(/\$\{([^}]+)\}/g, (_, key) => {
|
|
10057
10393
|
try {
|
|
10058
10394
|
const value = new Function(
|
|
10059
10395
|
...Object.keys(mergedContext),
|
|
@@ -10109,14 +10445,14 @@ var init_base_generator = __esm({
|
|
|
10109
10445
|
const fileExists = pathExists(normalizedOutputPath);
|
|
10110
10446
|
if (fileExists && !this.overwrite) {
|
|
10111
10447
|
if (this.verbose) {
|
|
10112
|
-
|
|
10448
|
+
log2.info(`Skipping existing file: ${normalizedOutputPath}`);
|
|
10113
10449
|
}
|
|
10114
10450
|
result.filesSkipped++;
|
|
10115
10451
|
result.skippedFiles.push(normalizedOutputPath);
|
|
10116
10452
|
return false;
|
|
10117
10453
|
}
|
|
10118
10454
|
if (this.dryRun) {
|
|
10119
|
-
|
|
10455
|
+
log2.info(`[DRY RUN] Would copy file: ${normalizedOutputPath}`);
|
|
10120
10456
|
result.filesGenerated++;
|
|
10121
10457
|
result.generatedFiles.push(normalizedOutputPath);
|
|
10122
10458
|
return true;
|
|
@@ -10132,7 +10468,7 @@ var init_base_generator = __esm({
|
|
|
10132
10468
|
);
|
|
10133
10469
|
if (copyResult) {
|
|
10134
10470
|
if (this.verbose) {
|
|
10135
|
-
|
|
10471
|
+
log2.info(
|
|
10136
10472
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedOutputPath}`
|
|
10137
10473
|
);
|
|
10138
10474
|
}
|
|
@@ -10182,7 +10518,7 @@ var init_base_generator = __esm({
|
|
|
10182
10518
|
dot: true
|
|
10183
10519
|
});
|
|
10184
10520
|
if (files.length === 0) {
|
|
10185
|
-
|
|
10521
|
+
log2.warn(`No files found in template directory: ${templateDirPath}`);
|
|
10186
10522
|
return false;
|
|
10187
10523
|
}
|
|
10188
10524
|
let anyFilesCopied = false;
|
|
@@ -10210,7 +10546,7 @@ var init_base_generator = __esm({
|
|
|
10210
10546
|
const written = await this.writeFile(outputFilePath, content, result);
|
|
10211
10547
|
anyFilesCopied = anyFilesCopied || written;
|
|
10212
10548
|
} catch (err) {
|
|
10213
|
-
|
|
10549
|
+
log2.warn(`Error rendering template file ${file}:`, err);
|
|
10214
10550
|
const copied = await this.copyTemplateFile(
|
|
10215
10551
|
joinPath(templateDirPath, file),
|
|
10216
10552
|
outputFilePath,
|
|
@@ -10235,16 +10571,16 @@ var init_base_generator = __esm({
|
|
|
10235
10571
|
async isBinaryFile(filePath) {
|
|
10236
10572
|
try {
|
|
10237
10573
|
const fd = await openFile(filePath, "r");
|
|
10238
|
-
const buffer =
|
|
10574
|
+
const buffer = Buffer2.alloc(4096);
|
|
10239
10575
|
await fd.read(buffer, 0, 4096, 0);
|
|
10240
10576
|
await fd.close();
|
|
10241
|
-
for (let
|
|
10242
|
-
if (buffer[
|
|
10577
|
+
for (let i2 = 0; i2 < buffer.length; i2++) {
|
|
10578
|
+
if (buffer[i2] === 0) {
|
|
10243
10579
|
return true;
|
|
10244
10580
|
}
|
|
10245
10581
|
}
|
|
10246
|
-
for (let
|
|
10247
|
-
const byte = buffer[
|
|
10582
|
+
for (let i2 = 0; i2 < buffer.length; i2++) {
|
|
10583
|
+
const byte = buffer[i2];
|
|
10248
10584
|
if (byte !== void 0 && (byte < 9 || byte > 13 && byte < 32 && byte !== 27)) {
|
|
10249
10585
|
return true;
|
|
10250
10586
|
}
|
|
@@ -10348,28 +10684,28 @@ var init_base_generator = __esm({
|
|
|
10348
10684
|
* @author AMBROISE PARK Consulting
|
|
10349
10685
|
*/
|
|
10350
10686
|
logSummary(result) {
|
|
10351
|
-
|
|
10687
|
+
note(`${this.name} Generator Summary`);
|
|
10352
10688
|
if (this.dryRun) {
|
|
10353
|
-
|
|
10689
|
+
log2.info("DRY RUN - No files were actually written");
|
|
10354
10690
|
}
|
|
10355
|
-
|
|
10356
|
-
|
|
10691
|
+
log2.info(`Generated ${result.filesGenerated} files`);
|
|
10692
|
+
log2.info(`Skipped ${result.filesSkipped} files`);
|
|
10357
10693
|
if (this.verbose && result.generatedFiles.length > 0) {
|
|
10358
|
-
|
|
10694
|
+
log2.info("Generated files:");
|
|
10359
10695
|
result.generatedFiles.forEach((file) => {
|
|
10360
|
-
|
|
10696
|
+
log2.info(` - ${file}`);
|
|
10361
10697
|
});
|
|
10362
10698
|
}
|
|
10363
10699
|
if (this.verbose && result.skippedFiles.length > 0) {
|
|
10364
|
-
|
|
10700
|
+
log2.info("Skipped files:");
|
|
10365
10701
|
result.skippedFiles.forEach((file) => {
|
|
10366
|
-
|
|
10702
|
+
log2.info(` - ${file}`);
|
|
10367
10703
|
});
|
|
10368
10704
|
}
|
|
10369
10705
|
if (result.messages && result.messages.length > 0) {
|
|
10370
|
-
|
|
10706
|
+
log2.info("Messages:");
|
|
10371
10707
|
result.messages.forEach((message) => {
|
|
10372
|
-
|
|
10708
|
+
log2.info(` - ${message}`);
|
|
10373
10709
|
});
|
|
10374
10710
|
}
|
|
10375
10711
|
}
|
|
@@ -10394,7 +10730,7 @@ function roleToSqlCondition(role) {
|
|
|
10394
10730
|
case "super":
|
|
10395
10731
|
return "(auth.jwt()->'app_metadata'->>'role') = 'super'";
|
|
10396
10732
|
default:
|
|
10397
|
-
|
|
10733
|
+
log2.warn(
|
|
10398
10734
|
`Unknown access role "${role}" \u2014 defaulting to deny (false). Use guest|user|admin|super.`
|
|
10399
10735
|
);
|
|
10400
10736
|
return "false";
|
|
@@ -10453,7 +10789,7 @@ async function main2() {
|
|
|
10453
10789
|
const result = await generator.run();
|
|
10454
10790
|
if (!result.success) process.exit(1);
|
|
10455
10791
|
} catch (err) {
|
|
10456
|
-
|
|
10792
|
+
log2.error("SQL generator failed:", err);
|
|
10457
10793
|
process.exit(1);
|
|
10458
10794
|
}
|
|
10459
10795
|
}
|
|
@@ -10548,7 +10884,7 @@ var init_sql_generator = __esm({
|
|
|
10548
10884
|
try {
|
|
10549
10885
|
entityModule = await this.importModule(entityFilePath);
|
|
10550
10886
|
} catch (err) {
|
|
10551
|
-
|
|
10887
|
+
log2.error(`Failed to import entity from ${entityFilePath}:`, err);
|
|
10552
10888
|
return null;
|
|
10553
10889
|
}
|
|
10554
10890
|
const entity = this.extractEntityFromModule(entityModule, entityFileName);
|
|
@@ -10564,7 +10900,7 @@ var init_sql_generator = __esm({
|
|
|
10564
10900
|
extractEntityFromModule(entityModule, fileName) {
|
|
10565
10901
|
const expectedName = fileName + "Entity";
|
|
10566
10902
|
if (entityModule[expectedName]) return entityModule[expectedName];
|
|
10567
|
-
const entityName = fileName.replace(/[-_](\w)/g, (
|
|
10903
|
+
const entityName = fileName.replace(/[-_](\w)/g, (_, c2) => c2.toUpperCase()).replace(/^\w/, (c2) => c2.toUpperCase());
|
|
10568
10904
|
if (entityModule[entityName]) return entityModule[entityName];
|
|
10569
10905
|
for (const key of Object.keys(entityModule)) {
|
|
10570
10906
|
const potential = entityModule[key];
|
|
@@ -10611,6 +10947,7 @@ var init_sql_generator = __esm({
|
|
|
10611
10947
|
const createSql = `CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
10612
10948
|
${columnList}
|
|
10613
10949
|
);`;
|
|
10950
|
+
const addColumns = columns.slice(1).map((column) => `ALTER TABLE ${tableName} ADD COLUMN IF NOT EXISTS ${column};`).join("\n");
|
|
10614
10951
|
const alterDefaults = [
|
|
10615
10952
|
`ALTER TABLE ${tableName} ALTER COLUMN id SET DEFAULT gen_random_uuid();`,
|
|
10616
10953
|
`ALTER TABLE ${tableName} ALTER COLUMN created_at SET DEFAULT now();`,
|
|
@@ -10619,6 +10956,8 @@ var init_sql_generator = __esm({
|
|
|
10619
10956
|
].join("\n");
|
|
10620
10957
|
return `${createSql}
|
|
10621
10958
|
|
|
10959
|
+
${addColumns}
|
|
10960
|
+
|
|
10622
10961
|
${alterDefaults}`;
|
|
10623
10962
|
}
|
|
10624
10963
|
buildRlsSql(tableName, access) {
|
|
@@ -10789,17 +11128,17 @@ ${triggerSql}
|
|
|
10789
11128
|
parts.push(auditFunc);
|
|
10790
11129
|
for (const { entity } of entities) {
|
|
10791
11130
|
const tn = entity.collection;
|
|
10792
|
-
const
|
|
11131
|
+
const q = this.safeTableName(tn);
|
|
10793
11132
|
parts.push(`
|
|
10794
|
-
DROP TRIGGER IF EXISTS ${tn}_updated_at ON ${
|
|
11133
|
+
DROP TRIGGER IF EXISTS ${tn}_updated_at ON ${q};
|
|
10795
11134
|
CREATE TRIGGER ${tn}_updated_at
|
|
10796
|
-
BEFORE UPDATE ON ${
|
|
11135
|
+
BEFORE UPDATE ON ${q}
|
|
10797
11136
|
FOR EACH ROW
|
|
10798
11137
|
EXECUTE PROCEDURE set_updated_at();
|
|
10799
11138
|
|
|
10800
|
-
DROP TRIGGER IF EXISTS ${tn}_audit ON ${
|
|
11139
|
+
DROP TRIGGER IF EXISTS ${tn}_audit ON ${q};
|
|
10801
11140
|
CREATE TRIGGER ${tn}_audit
|
|
10802
|
-
BEFORE INSERT OR UPDATE ON ${
|
|
11141
|
+
BEFORE INSERT OR UPDATE ON ${q}
|
|
10803
11142
|
FOR EACH ROW
|
|
10804
11143
|
EXECUTE PROCEDURE set_audit_fields();
|
|
10805
11144
|
`);
|
|
@@ -10816,7 +11155,7 @@ CREATE TRIGGER ${tn}_audit
|
|
|
10816
11155
|
};
|
|
10817
11156
|
if (import.meta.url === `file://${normalizePath(process.argv[1] || "")}`) {
|
|
10818
11157
|
main2().catch((err) => {
|
|
10819
|
-
|
|
11158
|
+
log2.error("Unhandled error:", err);
|
|
10820
11159
|
process.exit(1);
|
|
10821
11160
|
});
|
|
10822
11161
|
}
|
|
@@ -10872,13 +11211,13 @@ function writeEnvFile2(appDir, supabaseUrl, supabasePublicKey, framework) {
|
|
|
10872
11211
|
`${prefix}${keyVar}=${supabasePublicKey}`
|
|
10873
11212
|
];
|
|
10874
11213
|
const content = [
|
|
10875
|
-
...preserved.filter((
|
|
11214
|
+
...preserved.filter((l2) => l2.trim() !== ""),
|
|
10876
11215
|
"",
|
|
10877
11216
|
...supabaseBlock,
|
|
10878
11217
|
""
|
|
10879
11218
|
].join("\n");
|
|
10880
11219
|
writeSync(envPath, content);
|
|
10881
|
-
|
|
11220
|
+
log2.success(`Written Supabase config to ${envPath}`);
|
|
10882
11221
|
}
|
|
10883
11222
|
function isValidSupabaseUrl(url) {
|
|
10884
11223
|
try {
|
|
@@ -10970,16 +11309,16 @@ async function generateCrudFunction(supabaseDir, projectRoot) {
|
|
|
10970
11309
|
`import * as entities from '${relativePath}';`
|
|
10971
11310
|
);
|
|
10972
11311
|
} else {
|
|
10973
|
-
|
|
11312
|
+
log2.warn(
|
|
10974
11313
|
"Entities directory not found. CRUD function will need manual entity import."
|
|
10975
11314
|
);
|
|
10976
11315
|
}
|
|
10977
11316
|
const crudFunctionPath = joinPath(crudDir, "index.ts");
|
|
10978
11317
|
write(crudFunctionPath, templateContent);
|
|
10979
|
-
|
|
11318
|
+
log2.success(`Generated CRUD Edge Function: ${crudFunctionPath}`);
|
|
10980
11319
|
}
|
|
10981
11320
|
async function main3(options = {}) {
|
|
10982
|
-
|
|
11321
|
+
intro("Supabase Setup");
|
|
10983
11322
|
const projectRoot = process.cwd();
|
|
10984
11323
|
let appDir = projectRoot;
|
|
10985
11324
|
let framework = "vite";
|
|
@@ -10999,8 +11338,8 @@ async function main3(options = {}) {
|
|
|
10999
11338
|
if (!existingConfig) {
|
|
11000
11339
|
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
11001
11340
|
const envPath = joinPath(appDir, ".env");
|
|
11002
|
-
|
|
11003
|
-
|
|
11341
|
+
log2.error("Missing Supabase credentials.");
|
|
11342
|
+
note(
|
|
11004
11343
|
[
|
|
11005
11344
|
`Fill in ${envPath}:`,
|
|
11006
11345
|
` ${prefix}SUPABASE_URL=https://your-project.supabase.co`,
|
|
@@ -11012,17 +11351,17 @@ async function main3(options = {}) {
|
|
|
11012
11351
|
].join("\n"),
|
|
11013
11352
|
"Missing Public Credentials"
|
|
11014
11353
|
);
|
|
11015
|
-
|
|
11354
|
+
outro("Setup aborted.");
|
|
11016
11355
|
return;
|
|
11017
11356
|
}
|
|
11018
11357
|
const supabaseUrl = existingConfig.url;
|
|
11019
|
-
|
|
11358
|
+
log2.success(`Supabase URL: ${supabaseUrl}`);
|
|
11020
11359
|
const secretKey = detectSecretKey(appDir);
|
|
11021
11360
|
const accessToken = resolveSecret("SUPABASE_ACCESS_TOKEN", projectRoot, { appDir })?.value ?? null;
|
|
11022
|
-
if (secretKey)
|
|
11023
|
-
else
|
|
11024
|
-
if (accessToken)
|
|
11025
|
-
else
|
|
11361
|
+
if (secretKey) log2.success("Secret key detected");
|
|
11362
|
+
else log2.error("Missing SUPABASE_SECRET_KEY");
|
|
11363
|
+
if (accessToken) log2.success("Access token detected");
|
|
11364
|
+
else log2.error("Missing SUPABASE_ACCESS_TOKEN");
|
|
11026
11365
|
if (!secretKey || !accessToken) {
|
|
11027
11366
|
const missing = [];
|
|
11028
11367
|
if (!secretKey) missing.push(" SUPABASE_SECRET_KEY=your-service-role-key");
|
|
@@ -11030,7 +11369,7 @@ async function main3(options = {}) {
|
|
|
11030
11369
|
missing.push(
|
|
11031
11370
|
" SUPABASE_ACCESS_TOKEN=sbp_... (from https://supabase.com/dashboard/account/tokens)"
|
|
11032
11371
|
);
|
|
11033
|
-
|
|
11372
|
+
note(
|
|
11034
11373
|
[
|
|
11035
11374
|
"Fill in .dndev.secrets at project root:",
|
|
11036
11375
|
...missing,
|
|
@@ -11039,7 +11378,7 @@ async function main3(options = {}) {
|
|
|
11039
11378
|
].join("\n"),
|
|
11040
11379
|
"Missing Credentials"
|
|
11041
11380
|
);
|
|
11042
|
-
|
|
11381
|
+
outro("Setup aborted.");
|
|
11043
11382
|
return;
|
|
11044
11383
|
}
|
|
11045
11384
|
const entitiesDir = joinPath(projectRoot, "entities");
|
|
@@ -11060,34 +11399,34 @@ async function main3(options = {}) {
|
|
|
11060
11399
|
outputDir: joinPath(supabaseDir, "migrations"),
|
|
11061
11400
|
singleFile: true
|
|
11062
11401
|
});
|
|
11063
|
-
const s =
|
|
11402
|
+
const s = spinner();
|
|
11064
11403
|
s.start("Generating SQL migrations from entities...");
|
|
11065
11404
|
const result = await generator.run();
|
|
11066
11405
|
if (result.success) {
|
|
11067
11406
|
s.stop("SQL migrations generated successfully");
|
|
11068
|
-
|
|
11407
|
+
log2.success(`Generated ${result.filesGenerated} migration file(s)`);
|
|
11069
11408
|
sqlGenerated = true;
|
|
11070
11409
|
generatedEntityFile = result.generatedFiles[0] ?? null;
|
|
11071
11410
|
for (const f of result.generatedFiles) {
|
|
11072
|
-
|
|
11411
|
+
log2.info(` \u2192 ${f}`);
|
|
11073
11412
|
}
|
|
11074
11413
|
} else {
|
|
11075
11414
|
s.stop("Failed to generate SQL migrations");
|
|
11076
11415
|
}
|
|
11077
11416
|
} catch (error2) {
|
|
11078
|
-
|
|
11417
|
+
log2.error(
|
|
11079
11418
|
`SQL generation failed: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
11080
11419
|
);
|
|
11081
11420
|
}
|
|
11082
11421
|
}
|
|
11083
11422
|
} else {
|
|
11084
|
-
|
|
11423
|
+
log2.info("No entities directory found. Skipping SQL generation.");
|
|
11085
11424
|
}
|
|
11086
11425
|
if (sqlGenerated && generatedEntityFile) {
|
|
11087
11426
|
try {
|
|
11088
11427
|
await cleanupOldEntityMigrations(supabaseDir, generatedEntityFile);
|
|
11089
11428
|
} catch (error2) {
|
|
11090
|
-
|
|
11429
|
+
log2.warn(
|
|
11091
11430
|
`Could not clean old entity migrations: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
11092
11431
|
);
|
|
11093
11432
|
}
|
|
@@ -11098,7 +11437,7 @@ async function main3(options = {}) {
|
|
|
11098
11437
|
true
|
|
11099
11438
|
);
|
|
11100
11439
|
if (shouldPush) {
|
|
11101
|
-
const s =
|
|
11440
|
+
const s = spinner();
|
|
11102
11441
|
s.start("Pushing migrations...");
|
|
11103
11442
|
try {
|
|
11104
11443
|
await executeMigration({ supabaseDir, supabaseUrl, accessToken });
|
|
@@ -11106,14 +11445,14 @@ async function main3(options = {}) {
|
|
|
11106
11445
|
migrationsPushed = true;
|
|
11107
11446
|
} catch (error2) {
|
|
11108
11447
|
s.stop("Failed to push migrations");
|
|
11109
|
-
|
|
11110
|
-
|
|
11448
|
+
log2.error(`${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
11449
|
+
log2.info("Apply manually via the Supabase Dashboard SQL Editor.");
|
|
11111
11450
|
}
|
|
11112
11451
|
}
|
|
11113
11452
|
try {
|
|
11114
11453
|
await generateCrudFunction(supabaseDir, projectRoot);
|
|
11115
11454
|
} catch (error2) {
|
|
11116
|
-
|
|
11455
|
+
log2.warn(
|
|
11117
11456
|
`Could not patch CRUD function: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
11118
11457
|
);
|
|
11119
11458
|
}
|
|
@@ -11129,7 +11468,7 @@ async function main3(options = {}) {
|
|
|
11129
11468
|
steps.push("\u274C Migration push failed (see error above)");
|
|
11130
11469
|
const hasErrors = steps.some((s) => s.startsWith("\u274C"));
|
|
11131
11470
|
const title = hasErrors ? "Setup Incomplete" : "Setup Complete";
|
|
11132
|
-
|
|
11471
|
+
note(
|
|
11133
11472
|
[
|
|
11134
11473
|
`Project URL: ${supabaseUrl}`,
|
|
11135
11474
|
"",
|
|
@@ -11143,7 +11482,7 @@ async function main3(options = {}) {
|
|
|
11143
11482
|
].join("\n"),
|
|
11144
11483
|
title
|
|
11145
11484
|
);
|
|
11146
|
-
|
|
11485
|
+
outro(
|
|
11147
11486
|
hasErrors ? "Setup incomplete \u2014 see errors above." : "Supabase setup done."
|
|
11148
11487
|
);
|
|
11149
11488
|
}
|
|
@@ -11211,7 +11550,7 @@ var init_supabase = __esm({
|
|
|
11211
11550
|
outputDir: joinPath(supabaseDir, "migrations"),
|
|
11212
11551
|
singleFile: true
|
|
11213
11552
|
});
|
|
11214
|
-
const s =
|
|
11553
|
+
const s = spinner();
|
|
11215
11554
|
s.start("Generating SQL from entities...");
|
|
11216
11555
|
const result = await generator.run();
|
|
11217
11556
|
if (result.success) {
|
|
@@ -11252,7 +11591,7 @@ var init_supabase = __esm({
|
|
|
11252
11591
|
}
|
|
11253
11592
|
const migrationsDir = joinPath(supabaseDir, "migrations");
|
|
11254
11593
|
if (pathExists(migrationsDir)) {
|
|
11255
|
-
const s =
|
|
11594
|
+
const s = spinner();
|
|
11256
11595
|
s.start("Pushing migrations...");
|
|
11257
11596
|
try {
|
|
11258
11597
|
await executeMigration({
|
|
@@ -11330,8 +11669,8 @@ var init_vercel = __esm({
|
|
|
11330
11669
|
for (const varName of result.missing) {
|
|
11331
11670
|
const target = varName === "VERCEL_TOKEN" ? ".dndev.secrets" : `apps/<app>/.env`;
|
|
11332
11671
|
const where = varName === "VERCEL_TOKEN" ? "https://vercel.com/account/tokens" : "Vercel Dashboard > Project > Settings > General";
|
|
11333
|
-
|
|
11334
|
-
|
|
11672
|
+
log2.error(`Missing ${varName} \u2014 add to ${target}`);
|
|
11673
|
+
log2.info(` Find it at: ${where}`);
|
|
11335
11674
|
steps.push({
|
|
11336
11675
|
name: varName,
|
|
11337
11676
|
status: "failed",
|
|
@@ -11352,7 +11691,7 @@ var init_vercel = __esm({
|
|
|
11352
11691
|
});
|
|
11353
11692
|
try {
|
|
11354
11693
|
const user = await validateToken(token);
|
|
11355
|
-
|
|
11694
|
+
log2.success(
|
|
11356
11695
|
`Token valid \u2014 logged in as ${user.username} (${user.email})`
|
|
11357
11696
|
);
|
|
11358
11697
|
steps.push({
|
|
@@ -11362,7 +11701,7 @@ var init_vercel = __esm({
|
|
|
11362
11701
|
});
|
|
11363
11702
|
} catch (err) {
|
|
11364
11703
|
const msg = err instanceof DoNotDevError ? err.message : "Token validation failed";
|
|
11365
|
-
|
|
11704
|
+
log2.error(msg);
|
|
11366
11705
|
steps.push({
|
|
11367
11706
|
name: "Token validation",
|
|
11368
11707
|
status: "failed",
|
|
@@ -11378,9 +11717,9 @@ var init_vercel = __esm({
|
|
|
11378
11717
|
const account = await detectAccountType(token);
|
|
11379
11718
|
if (account.hasTeams) {
|
|
11380
11719
|
const teamNames = account.teams.map((t2) => t2.name).join(", ");
|
|
11381
|
-
|
|
11720
|
+
log2.info(`Account type: Team/Pro (teams: ${teamNames})`);
|
|
11382
11721
|
if (!orgId) {
|
|
11383
|
-
|
|
11722
|
+
log2.warn(
|
|
11384
11723
|
"Team account detected but VERCEL_ORG_ID is not set. Add your Team ID to apps/<app>/.env as VERCEL_ORG_ID."
|
|
11385
11724
|
);
|
|
11386
11725
|
steps.push({
|
|
@@ -11396,9 +11735,9 @@ var init_vercel = __esm({
|
|
|
11396
11735
|
});
|
|
11397
11736
|
}
|
|
11398
11737
|
} else {
|
|
11399
|
-
|
|
11738
|
+
log2.info("Account type: Hobby/Free (no teams)");
|
|
11400
11739
|
if (orgId) {
|
|
11401
|
-
|
|
11740
|
+
log2.warn(
|
|
11402
11741
|
"Hobby account detected but VERCEL_ORG_ID is set. This causes 403 errors. Remove VERCEL_ORG_ID from apps/<app>/.env."
|
|
11403
11742
|
);
|
|
11404
11743
|
steps.push({
|
|
@@ -11416,7 +11755,7 @@ var init_vercel = __esm({
|
|
|
11416
11755
|
}
|
|
11417
11756
|
} catch (err) {
|
|
11418
11757
|
const msg = err instanceof DoNotDevError ? err.message : "Account type detection failed";
|
|
11419
|
-
|
|
11758
|
+
log2.warn(msg);
|
|
11420
11759
|
steps.push({
|
|
11421
11760
|
name: "Account type",
|
|
11422
11761
|
status: "needs-manual",
|
|
@@ -11425,7 +11764,7 @@ var init_vercel = __esm({
|
|
|
11425
11764
|
}
|
|
11426
11765
|
try {
|
|
11427
11766
|
const project = await validateProject(token, projectId, orgId);
|
|
11428
|
-
|
|
11767
|
+
log2.success(`Project accessible: ${project.projectName}`);
|
|
11429
11768
|
steps.push({
|
|
11430
11769
|
name: "Project access",
|
|
11431
11770
|
status: "success",
|
|
@@ -11433,7 +11772,7 @@ var init_vercel = __esm({
|
|
|
11433
11772
|
});
|
|
11434
11773
|
} catch (err) {
|
|
11435
11774
|
const msg = err instanceof DoNotDevError ? err.message : "Project validation failed";
|
|
11436
|
-
|
|
11775
|
+
log2.error(msg);
|
|
11437
11776
|
steps.push({
|
|
11438
11777
|
name: "Project access",
|
|
11439
11778
|
status: "failed",
|
|
@@ -11636,22 +11975,22 @@ function printAllValidationResults(results, multiApp) {
|
|
|
11636
11975
|
}
|
|
11637
11976
|
}
|
|
11638
11977
|
if (allMissing.length === 0) {
|
|
11639
|
-
|
|
11978
|
+
log2.success("Credentials OK");
|
|
11640
11979
|
return true;
|
|
11641
11980
|
}
|
|
11642
11981
|
for (const { appName, m } of allMissing) {
|
|
11643
11982
|
const prefix = multiApp ? `${appName}: ` : "";
|
|
11644
11983
|
const detail = m.status === "empty" ? `empty in ${m.envFile}` : m.status === "no_env_file" ? `env file not found: ${m.envFile}` : `missing \u2014 ${m.envFile}`;
|
|
11645
|
-
|
|
11984
|
+
log2.error(` ${prefix}${m.varName} (${detail})`);
|
|
11646
11985
|
}
|
|
11647
|
-
|
|
11986
|
+
log2.warn(`Run 'dndev coach' to see where to get them.`);
|
|
11648
11987
|
return false;
|
|
11649
11988
|
}
|
|
11650
11989
|
|
|
11651
11990
|
// packages/tooling/src/cli/setup/setup.ts
|
|
11652
|
-
init_cli_output();
|
|
11653
11991
|
init_app_detection();
|
|
11654
11992
|
init_app_detection();
|
|
11993
|
+
init_cli_output();
|
|
11655
11994
|
var WIZARD_REGISTRY = {
|
|
11656
11995
|
firebase: async () => (await Promise.resolve().then(() => (init_firebase(), firebase_exports))).firebaseWizard,
|
|
11657
11996
|
supabase: async () => (await Promise.resolve().then(() => (init_supabase(), supabase_exports))).supabaseWizard,
|
|
@@ -11667,12 +12006,12 @@ var STATUS_ICONS = {
|
|
|
11667
12006
|
function renderResults(results, multiApp) {
|
|
11668
12007
|
for (const { appName, result } of results) {
|
|
11669
12008
|
if (multiApp) {
|
|
11670
|
-
|
|
12009
|
+
log2.info(`
|
|
11671
12010
|
${appName} \u2014 ${result.provider}:`);
|
|
11672
12011
|
}
|
|
11673
12012
|
for (const step of result.steps) {
|
|
11674
12013
|
const icon = STATUS_ICONS[step.status];
|
|
11675
|
-
|
|
12014
|
+
log2.info(` ${icon} ${step.name}: ${step.message}`);
|
|
11676
12015
|
}
|
|
11677
12016
|
}
|
|
11678
12017
|
}
|
|
@@ -11690,7 +12029,7 @@ function buildSetupContext(app, projectRoot, topology, options) {
|
|
|
11690
12029
|
}
|
|
11691
12030
|
async function main4(options = {}) {
|
|
11692
12031
|
const projectRoot = process.cwd();
|
|
11693
|
-
|
|
12032
|
+
intro("DoNotDev Setup");
|
|
11694
12033
|
const topology = analyzeProjectTopology(projectRoot);
|
|
11695
12034
|
let apps = topology.apps;
|
|
11696
12035
|
if (apps.length === 0) {
|
|
@@ -11700,7 +12039,7 @@ async function main4(options = {}) {
|
|
|
11700
12039
|
const validationResults = validateAllApps(apps, topology, projectRoot);
|
|
11701
12040
|
const allValid = printAllValidationResults(validationResults, multiApp);
|
|
11702
12041
|
if (!allValid) {
|
|
11703
|
-
|
|
12042
|
+
outro("Fix missing values, then re-run.");
|
|
11704
12043
|
return 1;
|
|
11705
12044
|
}
|
|
11706
12045
|
const allResults = [];
|
|
@@ -11710,8 +12049,8 @@ async function main4(options = {}) {
|
|
|
11710
12049
|
if (options.provider) {
|
|
11711
12050
|
const id = options.provider.toLowerCase();
|
|
11712
12051
|
if (!WIZARD_REGISTRY[id]) {
|
|
11713
|
-
|
|
11714
|
-
|
|
12052
|
+
log2.error(`Unknown provider: ${options.provider}`);
|
|
12053
|
+
outro("Setup aborted.");
|
|
11715
12054
|
return 1;
|
|
11716
12055
|
}
|
|
11717
12056
|
const wizard = await WIZARD_REGISTRY[id]();
|
|
@@ -11736,15 +12075,15 @@ async function main4(options = {}) {
|
|
|
11736
12075
|
}
|
|
11737
12076
|
}
|
|
11738
12077
|
if (allResults.length === 0) {
|
|
11739
|
-
|
|
11740
|
-
|
|
12078
|
+
log2.warn("No providers detected. Run: dndev setup <provider>");
|
|
12079
|
+
outro("Nothing to set up.");
|
|
11741
12080
|
return 0;
|
|
11742
12081
|
}
|
|
11743
12082
|
renderResults(allResults, multiApp);
|
|
11744
12083
|
const hasFailures = allResults.some(
|
|
11745
|
-
(
|
|
12084
|
+
(r2) => r2.result.overallStatus === "failed"
|
|
11746
12085
|
);
|
|
11747
|
-
|
|
12086
|
+
outro(
|
|
11748
12087
|
hasFailures ? "Setup incomplete \u2014 see errors above." : "Setup complete."
|
|
11749
12088
|
);
|
|
11750
12089
|
return hasFailures ? 1 : 0;
|