@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
package/dist/bin/commands/emu.js
CHANGED
|
@@ -5,16 +5,25 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (
|
|
8
|
+
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
18
27
|
};
|
|
19
28
|
var __copyProps = (to, from, except, desc) => {
|
|
20
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -33,31 +42,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
42
|
mod
|
|
34
43
|
));
|
|
35
44
|
|
|
36
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
37
|
-
var
|
|
45
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
46
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
38
47
|
var init_utils = __esm({
|
|
39
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
48
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
40
49
|
init_utils2();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
51
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
52
|
+
return (input) => {
|
|
53
|
+
let surrogatePairsNr = 0;
|
|
54
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
55
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
56
|
+
surrogatePairsNr += 1;
|
|
57
|
+
}
|
|
58
|
+
return input.length - surrogatePairsNr;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
44
61
|
isFullWidth = (x) => {
|
|
45
62
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
46
63
|
};
|
|
47
|
-
|
|
48
|
-
return x
|
|
64
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
65
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
49
66
|
};
|
|
50
67
|
}
|
|
51
68
|
});
|
|
52
69
|
|
|
53
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
54
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
70
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
71
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
55
72
|
var init_dist = __esm({
|
|
56
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
73
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
57
74
|
init_utils2();
|
|
58
75
|
init_utils();
|
|
59
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
76
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
60
77
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
78
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
61
79
|
TAB_RE = /\t{1,1000}/y;
|
|
62
80
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
63
81
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -67,14 +85,21 @@ var init_dist = __esm({
|
|
|
67
85
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
68
86
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
69
87
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
70
|
-
const ANSI_WIDTH =
|
|
88
|
+
const ANSI_WIDTH = 0;
|
|
71
89
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
72
90
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
73
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
74
91
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
75
|
-
const FULL_WIDTH_WIDTH =
|
|
92
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
76
93
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
77
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
94
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
95
|
+
const PARSE_BLOCKS = [
|
|
96
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
97
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
98
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
99
|
+
[TAB_RE, TAB_WIDTH],
|
|
100
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
101
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
102
|
+
];
|
|
78
103
|
let indexPrev = 0;
|
|
79
104
|
let index = 0;
|
|
80
105
|
let length = input.length;
|
|
@@ -94,10 +119,8 @@ var init_dist = __esm({
|
|
|
94
119
|
const codePoint = char.codePointAt(0) || 0;
|
|
95
120
|
if (isFullWidth(codePoint)) {
|
|
96
121
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
97
|
-
} else if (
|
|
122
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
98
123
|
widthExtra = WIDE_WIDTH;
|
|
99
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
100
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
101
124
|
} else {
|
|
102
125
|
widthExtra = REGULAR_WIDTH;
|
|
103
126
|
}
|
|
@@ -113,88 +136,28 @@ var init_dist = __esm({
|
|
|
113
136
|
}
|
|
114
137
|
unmatchedStart = unmatchedEnd = 0;
|
|
115
138
|
}
|
|
116
|
-
if (index >= length)
|
|
117
|
-
break;
|
|
118
|
-
LATIN_RE.lastIndex = index;
|
|
119
|
-
if (LATIN_RE.test(input)) {
|
|
120
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
121
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
122
|
-
if (width + widthExtra > truncationLimit) {
|
|
123
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
124
|
-
}
|
|
125
|
-
if (width + widthExtra > LIMIT) {
|
|
126
|
-
truncationEnabled = true;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
width += widthExtra;
|
|
130
|
-
unmatchedStart = indexPrev;
|
|
131
|
-
unmatchedEnd = index;
|
|
132
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
133
|
-
continue;
|
|
139
|
+
if (index >= length) {
|
|
140
|
+
break outer;
|
|
134
141
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
154
|
-
if (width + widthExtra > truncationLimit) {
|
|
155
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
156
|
-
}
|
|
157
|
-
if (width + widthExtra > LIMIT) {
|
|
158
|
-
truncationEnabled = true;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
width += widthExtra;
|
|
162
|
-
unmatchedStart = indexPrev;
|
|
163
|
-
unmatchedEnd = index;
|
|
164
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
TAB_RE.lastIndex = index;
|
|
168
|
-
if (TAB_RE.test(input)) {
|
|
169
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
170
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
171
|
-
if (width + widthExtra > truncationLimit) {
|
|
172
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
173
|
-
}
|
|
174
|
-
if (width + widthExtra > LIMIT) {
|
|
175
|
-
truncationEnabled = true;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
width += widthExtra;
|
|
179
|
-
unmatchedStart = indexPrev;
|
|
180
|
-
unmatchedEnd = index;
|
|
181
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
EMOJI_RE.lastIndex = index;
|
|
185
|
-
if (EMOJI_RE.test(input)) {
|
|
186
|
-
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
187
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
188
|
-
}
|
|
189
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
190
|
-
truncationEnabled = true;
|
|
191
|
-
break;
|
|
142
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
143
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
144
|
+
BLOCK_RE.lastIndex = index;
|
|
145
|
+
if (BLOCK_RE.test(input)) {
|
|
146
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
147
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
148
|
+
if (width + widthExtra > truncationLimit) {
|
|
149
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
150
|
+
}
|
|
151
|
+
if (width + widthExtra > LIMIT) {
|
|
152
|
+
truncationEnabled = true;
|
|
153
|
+
break outer;
|
|
154
|
+
}
|
|
155
|
+
width += widthExtra;
|
|
156
|
+
unmatchedStart = indexPrev;
|
|
157
|
+
unmatchedEnd = index;
|
|
158
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
159
|
+
continue outer;
|
|
192
160
|
}
|
|
193
|
-
width += EMOJI_WIDTH;
|
|
194
|
-
unmatchedStart = indexPrev;
|
|
195
|
-
unmatchedEnd = index;
|
|
196
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
197
|
-
continue;
|
|
198
161
|
}
|
|
199
162
|
index += 1;
|
|
200
163
|
}
|
|
@@ -209,10 +172,10 @@ var init_dist = __esm({
|
|
|
209
172
|
}
|
|
210
173
|
});
|
|
211
174
|
|
|
212
|
-
// node_modules/.bun/fast-string-width@
|
|
175
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
213
176
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
214
177
|
var init_dist2 = __esm({
|
|
215
|
-
"node_modules/.bun/fast-string-width@
|
|
178
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
216
179
|
init_utils2();
|
|
217
180
|
init_dist();
|
|
218
181
|
NO_TRUNCATION2 = {
|
|
@@ -227,13 +190,13 @@ var init_dist2 = __esm({
|
|
|
227
190
|
}
|
|
228
191
|
});
|
|
229
192
|
|
|
230
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
193
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
231
194
|
function wrapAnsi(string, columns, options) {
|
|
232
195
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
233
196
|
}
|
|
234
197
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
235
198
|
var init_main = __esm({
|
|
236
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
199
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
237
200
|
init_utils2();
|
|
238
201
|
init_dist2();
|
|
239
202
|
ESC = "\x1B";
|
|
@@ -397,16 +360,19 @@ var init_main = __esm({
|
|
|
397
360
|
}
|
|
398
361
|
const preString = rows.join("\n");
|
|
399
362
|
let inSurrogate = false;
|
|
400
|
-
for (let
|
|
401
|
-
const character = preString[
|
|
363
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
364
|
+
const character = preString[i2];
|
|
402
365
|
returnValue += character;
|
|
403
366
|
if (!inSurrogate) {
|
|
404
367
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
368
|
+
if (inSurrogate) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
405
371
|
} else {
|
|
406
|
-
|
|
372
|
+
inSurrogate = false;
|
|
407
373
|
}
|
|
408
374
|
if (character === ESC || character === CSI) {
|
|
409
|
-
GROUP_REGEX.lastIndex =
|
|
375
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
410
376
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
411
377
|
const groups = groupsResult?.groups;
|
|
412
378
|
if (groups?.code !== void 0) {
|
|
@@ -416,7 +382,7 @@ var init_main = __esm({
|
|
|
416
382
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
417
383
|
}
|
|
418
384
|
}
|
|
419
|
-
if (preString[
|
|
385
|
+
if (preString[i2 + 1] === "\n") {
|
|
420
386
|
if (escapeUrl) {
|
|
421
387
|
returnValue += wrapAnsiHyperlink("");
|
|
422
388
|
}
|
|
@@ -447,7 +413,7 @@ var require_src = __commonJS({
|
|
|
447
413
|
var ESC2 = "\x1B";
|
|
448
414
|
var CSI2 = `${ESC2}[`;
|
|
449
415
|
var beep = "\x07";
|
|
450
|
-
var
|
|
416
|
+
var cursor3 = {
|
|
451
417
|
to(x, y2) {
|
|
452
418
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
453
419
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -476,7 +442,7 @@ var require_src = __commonJS({
|
|
|
476
442
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
477
443
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
478
444
|
};
|
|
479
|
-
var
|
|
445
|
+
var erase3 = {
|
|
480
446
|
screen: `${CSI2}2J`,
|
|
481
447
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
482
448
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -485,67 +451,137 @@ var require_src = __commonJS({
|
|
|
485
451
|
lineStart: `${CSI2}1K`,
|
|
486
452
|
lines(count) {
|
|
487
453
|
let clear = "";
|
|
488
|
-
for (let
|
|
489
|
-
clear += this.line + (
|
|
454
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
455
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
490
456
|
if (count)
|
|
491
|
-
clear +=
|
|
457
|
+
clear += cursor3.left;
|
|
492
458
|
return clear;
|
|
493
459
|
}
|
|
494
460
|
};
|
|
495
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
461
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
496
462
|
}
|
|
497
463
|
});
|
|
498
464
|
|
|
499
|
-
// node_modules/.bun/@clack+core@1.
|
|
500
|
-
import { styleText
|
|
501
|
-
import { stdout
|
|
502
|
-
import
|
|
503
|
-
import { ReadStream
|
|
504
|
-
function
|
|
505
|
-
if (!
|
|
506
|
-
|
|
507
|
-
|
|
465
|
+
// node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
466
|
+
import { styleText } from "node:util";
|
|
467
|
+
import { stdout, stdin } from "node:process";
|
|
468
|
+
import l__default from "node:readline";
|
|
469
|
+
import { ReadStream } from "node:tty";
|
|
470
|
+
function findCursor(s, o, l) {
|
|
471
|
+
if (!l.some((r2) => !r2.disabled))
|
|
472
|
+
return s;
|
|
473
|
+
const t2 = s + o, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
474
|
+
return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
|
|
475
|
+
}
|
|
476
|
+
function isAccessible(n3) {
|
|
477
|
+
if (n3 !== void 0) return n3;
|
|
478
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
479
|
+
const e = process.env.ACCESSIBLE;
|
|
480
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
508
481
|
}
|
|
509
|
-
function
|
|
510
|
-
if (typeof
|
|
511
|
-
|
|
482
|
+
function isActionKey(n3, e) {
|
|
483
|
+
if (typeof n3 == "string")
|
|
484
|
+
return settings.aliases.get(n3) === e;
|
|
485
|
+
for (const s of n3)
|
|
486
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
487
|
+
return true;
|
|
512
488
|
return false;
|
|
513
489
|
}
|
|
514
|
-
function
|
|
515
|
-
if (
|
|
516
|
-
const e =
|
|
517
|
-
`),
|
|
518
|
-
`),
|
|
519
|
-
for (let
|
|
520
|
-
|
|
490
|
+
function diffLines(i2, s) {
|
|
491
|
+
if (i2 === s) return;
|
|
492
|
+
const e = i2.split(`
|
|
493
|
+
`), t2 = s.split(`
|
|
494
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
495
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
496
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
497
|
+
return {
|
|
498
|
+
lines: f,
|
|
499
|
+
numLinesBefore: e.length,
|
|
500
|
+
numLinesAfter: t2.length,
|
|
501
|
+
numLines: r2
|
|
502
|
+
};
|
|
521
503
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
504
|
+
function isCancel(e) {
|
|
505
|
+
return e === CANCEL_SYMBOL;
|
|
524
506
|
}
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
507
|
+
function setRawMode(e, r2) {
|
|
508
|
+
const o = e;
|
|
509
|
+
o.isTTY && o.setRawMode(r2);
|
|
528
510
|
}
|
|
529
|
-
function
|
|
530
|
-
const
|
|
531
|
-
return wrapAnsi(
|
|
532
|
-
|
|
511
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
512
|
+
const f = getColumns(e ?? stdout);
|
|
513
|
+
return wrapAnsi(r2, f - o.length, {
|
|
514
|
+
hard: true,
|
|
515
|
+
trim: false
|
|
516
|
+
}).split(`
|
|
517
|
+
`).map((c2, i2, m2) => {
|
|
518
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
519
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
520
|
+
}).join(`
|
|
533
521
|
`);
|
|
534
522
|
}
|
|
535
|
-
|
|
523
|
+
function runValidation(e, a2) {
|
|
524
|
+
if ("~standard" in e) {
|
|
525
|
+
const n3 = e["~standard"].validate(a2);
|
|
526
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
527
|
+
}
|
|
528
|
+
return e(a2);
|
|
529
|
+
}
|
|
530
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, a, n$1;
|
|
536
531
|
var init_dist3 = __esm({
|
|
537
|
-
"node_modules/.bun/@clack+core@1.
|
|
532
|
+
"node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
|
|
538
533
|
init_utils2();
|
|
539
534
|
init_main();
|
|
540
535
|
import_sisteransi = __toESM(require_src(), 1);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
536
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
537
|
+
t = [
|
|
538
|
+
"January",
|
|
539
|
+
"February",
|
|
540
|
+
"March",
|
|
541
|
+
"April",
|
|
542
|
+
"May",
|
|
543
|
+
"June",
|
|
544
|
+
"July",
|
|
545
|
+
"August",
|
|
546
|
+
"September",
|
|
547
|
+
"October",
|
|
548
|
+
"November",
|
|
549
|
+
"December"
|
|
550
|
+
];
|
|
551
|
+
settings = {
|
|
552
|
+
actions: new Set(a$1),
|
|
553
|
+
aliases: /* @__PURE__ */ new Map([
|
|
554
|
+
// vim support
|
|
555
|
+
["k", "up"],
|
|
556
|
+
["j", "down"],
|
|
557
|
+
["h", "left"],
|
|
558
|
+
["l", "right"],
|
|
559
|
+
["", "cancel"],
|
|
560
|
+
// opinionated defaults!
|
|
561
|
+
["escape", "cancel"]
|
|
562
|
+
]),
|
|
563
|
+
messages: {
|
|
564
|
+
cancel: "Canceled",
|
|
565
|
+
error: "Something went wrong"
|
|
566
|
+
},
|
|
567
|
+
withGuide: true,
|
|
568
|
+
accessible: void 0,
|
|
569
|
+
date: {
|
|
570
|
+
monthNames: [...t],
|
|
571
|
+
messages: {
|
|
572
|
+
required: "Please enter a valid date",
|
|
573
|
+
invalidMonth: "There are only 12 months in a year",
|
|
574
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
575
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
576
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
R = globalThis.process.platform.startsWith("win");
|
|
581
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
582
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
583
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
584
|
+
y = class {
|
|
549
585
|
input;
|
|
550
586
|
output;
|
|
551
587
|
_abortSignal;
|
|
@@ -560,46 +596,92 @@ var init_dist3 = __esm({
|
|
|
560
596
|
error = "";
|
|
561
597
|
value;
|
|
562
598
|
userInput = "";
|
|
599
|
+
/**
|
|
600
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
601
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
602
|
+
* and the `ACCESSIBLE` env var.
|
|
603
|
+
*/
|
|
604
|
+
get accessible() {
|
|
605
|
+
return isAccessible(this.opts.accessible);
|
|
606
|
+
}
|
|
563
607
|
constructor(t2, e = true) {
|
|
564
|
-
const { input:
|
|
565
|
-
this.opts =
|
|
608
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
609
|
+
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;
|
|
566
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* Unsubscribe all listeners
|
|
613
|
+
*/
|
|
567
614
|
unsubscribe() {
|
|
568
615
|
this._subscribers.clear();
|
|
569
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* Set a subscriber with opts
|
|
619
|
+
* @param event - The event name
|
|
620
|
+
*/
|
|
570
621
|
setSubscriber(t2, e) {
|
|
571
|
-
const
|
|
572
|
-
|
|
622
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
623
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
573
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* Subscribe to an event
|
|
627
|
+
* @param event - The event name
|
|
628
|
+
* @param cb - The callback
|
|
629
|
+
*/
|
|
574
630
|
on(t2, e) {
|
|
575
631
|
this.setSubscriber(t2, { cb: e });
|
|
576
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Subscribe to an event once
|
|
635
|
+
* @param event - The event name
|
|
636
|
+
* @param cb - The callback
|
|
637
|
+
*/
|
|
577
638
|
once(t2, e) {
|
|
578
639
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
579
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Emit an event with data
|
|
643
|
+
* @param event - The event name
|
|
644
|
+
* @param data - The data to pass to the callback
|
|
645
|
+
*/
|
|
580
646
|
emit(t2, ...e) {
|
|
581
|
-
const
|
|
582
|
-
for (const
|
|
583
|
-
|
|
647
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
648
|
+
for (const r2 of i2)
|
|
649
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
650
|
+
for (const r2 of s)
|
|
651
|
+
r2();
|
|
584
652
|
}
|
|
585
653
|
prompt() {
|
|
586
654
|
return new Promise((t2) => {
|
|
587
655
|
if (this._abortSignal) {
|
|
588
|
-
if (this._abortSignal.aborted)
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
656
|
+
if (this._abortSignal.aborted)
|
|
657
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
658
|
+
this._abortSignal.addEventListener(
|
|
659
|
+
"abort",
|
|
660
|
+
() => {
|
|
661
|
+
this.state = "cancel", this.close();
|
|
662
|
+
},
|
|
663
|
+
{ once: true }
|
|
664
|
+
);
|
|
592
665
|
}
|
|
593
|
-
this.rl =
|
|
594
|
-
|
|
666
|
+
this.rl = l__default.createInterface({
|
|
667
|
+
input: this.input,
|
|
668
|
+
tabSize: 2,
|
|
669
|
+
prompt: "",
|
|
670
|
+
escapeCodeTimeout: 50,
|
|
671
|
+
terminal: true
|
|
672
|
+
}), 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", () => {
|
|
673
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
595
674
|
}), this.once("cancel", () => {
|
|
596
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
675
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
597
676
|
});
|
|
598
677
|
});
|
|
599
678
|
}
|
|
600
679
|
_isActionKey(t2, e) {
|
|
601
680
|
return t2 === " ";
|
|
602
681
|
}
|
|
682
|
+
_shouldSubmit(t2, e) {
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
603
685
|
_setValue(t2) {
|
|
604
686
|
this.value = t2, this.emit("value", this.value);
|
|
605
687
|
}
|
|
@@ -609,19 +691,22 @@ var init_dist3 = __esm({
|
|
|
609
691
|
_clearUserInput() {
|
|
610
692
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
611
693
|
}
|
|
612
|
-
onKeypress(t2, e) {
|
|
613
|
-
if (this.
|
|
614
|
-
if (this.
|
|
615
|
-
|
|
616
|
-
|
|
694
|
+
async onKeypress(t2, e) {
|
|
695
|
+
if (this.state !== "validating") {
|
|
696
|
+
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)) {
|
|
697
|
+
if (this.opts.validate) {
|
|
698
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
699
|
+
let s;
|
|
700
|
+
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));
|
|
701
|
+
}
|
|
702
|
+
this.state !== "error" && (this.state = "submit");
|
|
617
703
|
}
|
|
618
|
-
this.state
|
|
704
|
+
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();
|
|
619
705
|
}
|
|
620
|
-
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();
|
|
621
706
|
}
|
|
622
707
|
close() {
|
|
623
708
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
624
|
-
`),
|
|
709
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
625
710
|
}
|
|
626
711
|
restoreCursor() {
|
|
627
712
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -629,34 +714,39 @@ var init_dist3 = __esm({
|
|
|
629
714
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
630
715
|
}
|
|
631
716
|
render() {
|
|
632
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
717
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
718
|
+
hard: true,
|
|
719
|
+
trim: false
|
|
720
|
+
});
|
|
633
721
|
if (t2 !== this._prevFrame) {
|
|
634
|
-
if (this.state === "initial")
|
|
722
|
+
if (this.state === "initial")
|
|
723
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
635
724
|
else {
|
|
636
|
-
const e =
|
|
725
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
637
726
|
if (this.restoreCursor(), e) {
|
|
638
|
-
const
|
|
639
|
-
let
|
|
640
|
-
if (
|
|
727
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
728
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
729
|
+
if (n3 === void 0) {
|
|
641
730
|
this._prevFrame = t2;
|
|
642
731
|
return;
|
|
643
732
|
}
|
|
644
733
|
if (e.lines.length === 1) {
|
|
645
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
646
|
-
const
|
|
734
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
735
|
+
const o = t2.split(`
|
|
647
736
|
`);
|
|
648
|
-
this.output.write(
|
|
737
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
649
738
|
return;
|
|
650
739
|
} else if (e.lines.length > 1) {
|
|
651
|
-
if (
|
|
740
|
+
if (s < r2)
|
|
741
|
+
n3 = s;
|
|
652
742
|
else {
|
|
653
|
-
const
|
|
654
|
-
|
|
743
|
+
const h2 = n3 - r2;
|
|
744
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
655
745
|
}
|
|
656
746
|
this.output.write(import_sisteransi.erase.down());
|
|
657
|
-
const
|
|
658
|
-
`).slice(
|
|
659
|
-
this.output.write(
|
|
747
|
+
const f = t2.split(`
|
|
748
|
+
`).slice(n3);
|
|
749
|
+
this.output.write(f.join(`
|
|
660
750
|
`)), this._prevFrame = t2;
|
|
661
751
|
return;
|
|
662
752
|
}
|
|
@@ -667,44 +757,48 @@ var init_dist3 = __esm({
|
|
|
667
757
|
}
|
|
668
758
|
}
|
|
669
759
|
};
|
|
670
|
-
|
|
760
|
+
a = class extends y {
|
|
671
761
|
options;
|
|
672
762
|
cursor = 0;
|
|
673
763
|
get _value() {
|
|
674
|
-
return this.options[this.cursor]
|
|
764
|
+
return this.options[this.cursor]?.value;
|
|
675
765
|
}
|
|
676
766
|
get _enabledOptions() {
|
|
677
|
-
return this.options.filter((
|
|
767
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
678
768
|
}
|
|
679
769
|
toggleAll() {
|
|
680
|
-
const
|
|
681
|
-
this.value =
|
|
770
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
771
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
682
772
|
}
|
|
683
773
|
toggleInvert() {
|
|
684
|
-
const
|
|
685
|
-
if (!
|
|
686
|
-
|
|
687
|
-
|
|
774
|
+
const e = this.value;
|
|
775
|
+
if (!e)
|
|
776
|
+
return;
|
|
777
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
778
|
+
this.value = i2.map((t2) => t2.value);
|
|
688
779
|
}
|
|
689
780
|
toggleValue() {
|
|
690
781
|
this.value === void 0 && (this.value = []);
|
|
691
|
-
const
|
|
692
|
-
this.value =
|
|
693
|
-
}
|
|
694
|
-
constructor(
|
|
695
|
-
super(
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
782
|
+
const e = this.value.includes(this._value);
|
|
783
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
784
|
+
}
|
|
785
|
+
constructor(e) {
|
|
786
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
787
|
+
const i2 = Math.max(
|
|
788
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
789
|
+
0
|
|
790
|
+
);
|
|
791
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l) => {
|
|
792
|
+
l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
|
|
793
|
+
}), this.on("cursor", (t2) => {
|
|
794
|
+
switch (t2) {
|
|
701
795
|
case "left":
|
|
702
796
|
case "up":
|
|
703
|
-
this.cursor =
|
|
797
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
704
798
|
break;
|
|
705
799
|
case "down":
|
|
706
800
|
case "right":
|
|
707
|
-
this.cursor =
|
|
801
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
708
802
|
break;
|
|
709
803
|
case "space":
|
|
710
804
|
this.toggleValue();
|
|
@@ -713,27 +807,28 @@ var init_dist3 = __esm({
|
|
|
713
807
|
});
|
|
714
808
|
}
|
|
715
809
|
};
|
|
716
|
-
|
|
810
|
+
n$1 = class n extends y {
|
|
717
811
|
options;
|
|
718
812
|
cursor = 0;
|
|
719
813
|
get _selectedValue() {
|
|
720
814
|
return this.options[this.cursor];
|
|
721
815
|
}
|
|
722
816
|
changeValue() {
|
|
723
|
-
|
|
817
|
+
const e = this._selectedValue;
|
|
818
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
724
819
|
}
|
|
725
|
-
constructor(
|
|
726
|
-
super(
|
|
727
|
-
const
|
|
728
|
-
this.cursor = this.options[
|
|
729
|
-
switch (
|
|
820
|
+
constructor(e) {
|
|
821
|
+
super(e, false), this.options = e.options;
|
|
822
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
823
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
824
|
+
switch (s) {
|
|
730
825
|
case "left":
|
|
731
826
|
case "up":
|
|
732
|
-
this.cursor =
|
|
827
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
733
828
|
break;
|
|
734
829
|
case "down":
|
|
735
830
|
case "right":
|
|
736
|
-
this.cursor =
|
|
831
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
737
832
|
break;
|
|
738
833
|
}
|
|
739
834
|
this.changeValue();
|
|
@@ -743,240 +838,398 @@ var init_dist3 = __esm({
|
|
|
743
838
|
}
|
|
744
839
|
});
|
|
745
840
|
|
|
746
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
747
|
-
import { styleText as
|
|
748
|
-
import
|
|
749
|
-
import { existsSync
|
|
750
|
-
import { dirname
|
|
751
|
-
function
|
|
752
|
-
|
|
841
|
+
// node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
842
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
843
|
+
import process$1 from "node:process";
|
|
844
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
845
|
+
import { dirname, join } from "node:path";
|
|
846
|
+
function isUnicodeSupported() {
|
|
847
|
+
if (process$1.platform !== "win32") {
|
|
848
|
+
return process$1.env.TERM !== "linux";
|
|
849
|
+
}
|
|
850
|
+
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";
|
|
851
|
+
}
|
|
852
|
+
function formatInstructionFooter(o, e) {
|
|
853
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
854
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
753
855
|
}
|
|
754
|
-
var import_sisteransi2,
|
|
856
|
+
var import_sisteransi2, unicode, 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, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, u2, SELECT_INSTRUCTIONS, c, select, i;
|
|
755
857
|
var init_dist4 = __esm({
|
|
756
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
858
|
+
"node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
757
859
|
init_utils2();
|
|
758
860
|
init_dist3();
|
|
759
861
|
init_dist3();
|
|
760
862
|
init_main();
|
|
761
863
|
init_dist2();
|
|
762
864
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
switch (
|
|
865
|
+
unicode = isUnicodeSupported();
|
|
866
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
867
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
868
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
869
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
870
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
871
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
872
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
873
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
874
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
875
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
876
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
877
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
878
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
879
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
880
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
881
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
882
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
883
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
884
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
885
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
886
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
887
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
888
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
889
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
890
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
891
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
892
|
+
symbol = (o) => {
|
|
893
|
+
switch (o) {
|
|
792
894
|
case "initial":
|
|
793
895
|
case "active":
|
|
794
|
-
return
|
|
896
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
795
897
|
case "cancel":
|
|
796
|
-
return
|
|
898
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
797
899
|
case "error":
|
|
798
|
-
return
|
|
900
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
799
901
|
case "submit":
|
|
800
|
-
return
|
|
902
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
903
|
+
case "validating":
|
|
904
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
801
905
|
}
|
|
802
906
|
};
|
|
803
|
-
|
|
804
|
-
switch (
|
|
907
|
+
symbolBar = (o) => {
|
|
908
|
+
switch (o) {
|
|
805
909
|
case "initial":
|
|
806
910
|
case "active":
|
|
807
|
-
return
|
|
911
|
+
return styleText2("cyan", S_BAR);
|
|
808
912
|
case "cancel":
|
|
809
|
-
return
|
|
913
|
+
return styleText2("red", S_BAR);
|
|
810
914
|
case "error":
|
|
811
|
-
return
|
|
915
|
+
return styleText2("yellow", S_BAR);
|
|
812
916
|
case "submit":
|
|
813
|
-
return
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
let
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
917
|
+
return styleText2("green", S_BAR);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
I = (l, e, w, p, b, C = false) => {
|
|
921
|
+
let r2 = e, O = 0;
|
|
922
|
+
if (C)
|
|
923
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
924
|
+
const m2 = l[i2];
|
|
925
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
926
|
+
}
|
|
927
|
+
else
|
|
928
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
929
|
+
const m2 = l[i2];
|
|
930
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
931
|
+
}
|
|
932
|
+
return { lineCount: r2, removals: O };
|
|
933
|
+
};
|
|
934
|
+
limitOptions = ({
|
|
935
|
+
cursor: l,
|
|
936
|
+
options: e,
|
|
937
|
+
style: w,
|
|
938
|
+
output: p = process.stdout,
|
|
939
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
940
|
+
columnPadding: C = 0,
|
|
941
|
+
rowPadding: r2 = 4
|
|
942
|
+
}) => {
|
|
943
|
+
const i2 = getColumns(p) - C, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
830
944
|
let f = 0;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
945
|
+
l >= a2 - 3 && (f = Math.max(
|
|
946
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
947
|
+
0
|
|
948
|
+
));
|
|
949
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
950
|
+
const W = Math.min(
|
|
951
|
+
f + a2,
|
|
952
|
+
e.length
|
|
953
|
+
), s = [];
|
|
954
|
+
let g = 0;
|
|
955
|
+
d && g++, c2 && g++;
|
|
956
|
+
const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
|
|
957
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
958
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
959
|
+
hard: true,
|
|
960
|
+
trim: false
|
|
961
|
+
}).split(`
|
|
835
962
|
`);
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
if (
|
|
839
|
-
let
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
O2.message(e, { ...i, symbol: t("green", F) });
|
|
867
|
-
}, warn: (e, i) => {
|
|
868
|
-
O2.message(e, { ...i, symbol: t("yellow", me) });
|
|
869
|
-
}, warning: (e, i) => {
|
|
870
|
-
O2.warn(e, i);
|
|
871
|
-
}, error: (e, i) => {
|
|
872
|
-
O2.message(e, { ...i, symbol: t("red", ge) });
|
|
873
|
-
} };
|
|
874
|
-
pt = (e = "", i) => {
|
|
875
|
-
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", E2)} ` : "";
|
|
876
|
-
s.write(`${r}${t("red", e)}
|
|
877
|
-
|
|
878
|
-
`);
|
|
879
|
-
};
|
|
880
|
-
Q2 = (e, i) => e.split(`
|
|
881
|
-
`).map((s) => i(s)).join(`
|
|
963
|
+
s.push(h2), g += h2.length;
|
|
964
|
+
}
|
|
965
|
+
if (g > v) {
|
|
966
|
+
let t2 = 0, n3 = 0, o = g;
|
|
967
|
+
const h2 = l - T;
|
|
968
|
+
let u3 = v;
|
|
969
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
970
|
+
s,
|
|
971
|
+
o,
|
|
972
|
+
h2 + 1,
|
|
973
|
+
s.length,
|
|
974
|
+
u3,
|
|
975
|
+
true
|
|
976
|
+
);
|
|
977
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
978
|
+
}
|
|
979
|
+
const x = [];
|
|
980
|
+
d && x.push(M);
|
|
981
|
+
for (const t2 of s)
|
|
982
|
+
for (const n3 of t2)
|
|
983
|
+
x.push(n3);
|
|
984
|
+
return c2 && x.push(M), x;
|
|
985
|
+
};
|
|
986
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
987
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
988
|
+
`${styleText2("dim", "Space:")} select`,
|
|
989
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
990
|
+
];
|
|
991
|
+
m = (i2, u3) => i2.split(`
|
|
992
|
+
`).map((d) => u3(d)).join(`
|
|
882
993
|
`);
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
const
|
|
886
|
-
return
|
|
887
|
-
},
|
|
888
|
-
return new
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
994
|
+
multiselect = (i2) => {
|
|
995
|
+
const u3 = (t2, a2) => {
|
|
996
|
+
const r2 = t2.label ?? String(t2.value);
|
|
997
|
+
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
998
|
+
}, d = i2.required ?? true, x = i2.showInstructions ?? true;
|
|
999
|
+
return new a({
|
|
1000
|
+
options: i2.options,
|
|
1001
|
+
signal: i2.signal,
|
|
1002
|
+
input: i2.input,
|
|
1003
|
+
output: i2.output,
|
|
1004
|
+
initialValues: i2.initialValues,
|
|
1005
|
+
required: d,
|
|
1006
|
+
cursorAt: i2.cursorAt,
|
|
1007
|
+
validate(t2) {
|
|
1008
|
+
if (d && (t2 === void 0 || t2.length === 0))
|
|
1009
|
+
return `Please select at least one option.
|
|
1010
|
+
${styleText2(
|
|
1011
|
+
"reset",
|
|
1012
|
+
styleText2(
|
|
1013
|
+
"dim",
|
|
1014
|
+
`Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
|
|
1015
|
+
"gray",
|
|
1016
|
+
styleText2("bgWhite", styleText2("inverse", " enter "))
|
|
1017
|
+
)} to submit`
|
|
1018
|
+
)
|
|
1019
|
+
)}`;
|
|
1020
|
+
},
|
|
1021
|
+
render() {
|
|
1022
|
+
const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1023
|
+
i2.output,
|
|
1024
|
+
i2.message,
|
|
1025
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1026
|
+
`${symbol(this.state)} `
|
|
1027
|
+
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1028
|
+
` : ""}${a2}
|
|
1029
|
+
`, o = this.value ?? [], g = (n3, l) => {
|
|
1030
|
+
if (n3.disabled)
|
|
1031
|
+
return u3(n3, "disabled");
|
|
1032
|
+
const s = o.includes(n3.value);
|
|
1033
|
+
return l && s ? u3(n3, "active-selected") : s ? u3(n3, "selected") : u3(n3, l ? "active" : "inactive");
|
|
1034
|
+
};
|
|
1035
|
+
switch (this.state) {
|
|
1036
|
+
case "submit": {
|
|
1037
|
+
const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1038
|
+
i2.output,
|
|
1039
|
+
n3,
|
|
1040
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1041
|
+
);
|
|
1042
|
+
return `${r2}${l}`;
|
|
1043
|
+
}
|
|
1044
|
+
case "cancel": {
|
|
1045
|
+
const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1046
|
+
if (n3.trim() === "")
|
|
1047
|
+
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1048
|
+
const l = wrapTextWithPrefix(
|
|
1049
|
+
i2.output,
|
|
1050
|
+
n3,
|
|
1051
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1052
|
+
);
|
|
1053
|
+
return `${r2}${l}${t2 ? `
|
|
1054
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1055
|
+
}
|
|
1056
|
+
case "error": {
|
|
1057
|
+
const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1058
|
+
`).map(
|
|
1059
|
+
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1060
|
+
).join(`
|
|
1061
|
+
`), s = r2.split(`
|
|
1062
|
+
`).length, h2 = l.split(`
|
|
916
1063
|
`).length + 1;
|
|
917
|
-
|
|
918
|
-
|
|
1064
|
+
return `${r2}${n3}${limitOptions({
|
|
1065
|
+
output: i2.output,
|
|
1066
|
+
options: this.options,
|
|
1067
|
+
cursor: this.cursor,
|
|
1068
|
+
maxItems: i2.maxItems,
|
|
1069
|
+
columnPadding: n3.length,
|
|
1070
|
+
rowPadding: s + h2,
|
|
1071
|
+
style: g
|
|
1072
|
+
}).join(`
|
|
1073
|
+
${n3}`)}
|
|
919
1074
|
${l}
|
|
920
1075
|
`;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
`).length,
|
|
925
|
-
|
|
926
|
-
${
|
|
927
|
-
|
|
1076
|
+
}
|
|
1077
|
+
default: {
|
|
1078
|
+
const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1079
|
+
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1080
|
+
`), $ = s.length + 1;
|
|
1081
|
+
return `${r2}${n3}${limitOptions({
|
|
1082
|
+
output: i2.output,
|
|
1083
|
+
options: this.options,
|
|
1084
|
+
cursor: this.cursor,
|
|
1085
|
+
maxItems: i2.maxItems,
|
|
1086
|
+
columnPadding: n3.length,
|
|
1087
|
+
rowPadding: l + $,
|
|
1088
|
+
style: g
|
|
1089
|
+
}).join(`
|
|
1090
|
+
${n3}`)}
|
|
1091
|
+
${h2}
|
|
928
1092
|
`;
|
|
1093
|
+
}
|
|
929
1094
|
}
|
|
930
1095
|
}
|
|
931
|
-
}
|
|
1096
|
+
}).prompt();
|
|
932
1097
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1098
|
+
log = {
|
|
1099
|
+
message: (s = [], {
|
|
1100
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1101
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1102
|
+
output: m2 = process.stdout,
|
|
1103
|
+
spacing: l = 1,
|
|
1104
|
+
withGuide: c2
|
|
1105
|
+
} = {}) => {
|
|
1106
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1107
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
1108
|
+
t2.push(f);
|
|
1109
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
1110
|
+
`);
|
|
1111
|
+
if (g.length > 0) {
|
|
1112
|
+
const [i2, ...y2] = g;
|
|
1113
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1114
|
+
for (const p of y2)
|
|
1115
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1116
|
+
}
|
|
1117
|
+
m2.write(`${t2.join(`
|
|
1118
|
+
`)}
|
|
1119
|
+
`);
|
|
1120
|
+
},
|
|
1121
|
+
info: (s, e) => {
|
|
1122
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1123
|
+
},
|
|
1124
|
+
success: (s, e) => {
|
|
1125
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1126
|
+
},
|
|
1127
|
+
step: (s, e) => {
|
|
1128
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1129
|
+
},
|
|
1130
|
+
warn: (s, e) => {
|
|
1131
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1132
|
+
},
|
|
1133
|
+
/** alias for `log.warn()`. */
|
|
1134
|
+
warning: (s, e) => {
|
|
1135
|
+
log.warn(s, e);
|
|
1136
|
+
},
|
|
1137
|
+
error: (s, e) => {
|
|
1138
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
cancel = (o = "", t2) => {
|
|
1142
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1143
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
1144
|
+
|
|
1145
|
+
`);
|
|
1146
|
+
};
|
|
1147
|
+
u2 = {
|
|
1148
|
+
light: unicodeOr("\u2500", "-"),
|
|
1149
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1150
|
+
block: unicodeOr("\u2588", "#")
|
|
1151
|
+
};
|
|
1152
|
+
SELECT_INSTRUCTIONS = [
|
|
1153
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1154
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1155
|
+
];
|
|
1156
|
+
c = (t2, o) => t2.includes(`
|
|
1157
|
+
`) ? t2.split(`
|
|
1158
|
+
`).map((d) => o(d)).join(`
|
|
1159
|
+
`) : o(t2);
|
|
1160
|
+
select = (t2) => {
|
|
1161
|
+
const o = (n3, m2) => {
|
|
1162
|
+
if (n3 === void 0)
|
|
1163
|
+
return "";
|
|
1164
|
+
const s = n3.label ?? String(n3.value);
|
|
1165
|
+
switch (m2) {
|
|
942
1166
|
case "disabled":
|
|
943
|
-
return `${
|
|
1167
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
944
1168
|
case "selected":
|
|
945
|
-
return `${
|
|
1169
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
946
1170
|
case "active":
|
|
947
|
-
return `${
|
|
1171
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
948
1172
|
case "cancelled":
|
|
949
|
-
return `${
|
|
1173
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
950
1174
|
default:
|
|
951
|
-
return `${
|
|
952
|
-
}
|
|
953
|
-
};
|
|
954
|
-
return new
|
|
955
|
-
|
|
956
|
-
|
|
1175
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1176
|
+
}
|
|
1177
|
+
}, d = t2.showInstructions ?? true;
|
|
1178
|
+
return new n$1({
|
|
1179
|
+
options: t2.options,
|
|
1180
|
+
signal: t2.signal,
|
|
1181
|
+
input: t2.input,
|
|
1182
|
+
output: t2.output,
|
|
1183
|
+
initialValue: t2.initialValue,
|
|
1184
|
+
render() {
|
|
1185
|
+
const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1186
|
+
t2.output,
|
|
1187
|
+
t2.message,
|
|
1188
|
+
s,
|
|
1189
|
+
m2
|
|
1190
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1191
|
+
` : ""}${i2}
|
|
957
1192
|
`;
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
${
|
|
1193
|
+
switch (this.state) {
|
|
1194
|
+
case "submit": {
|
|
1195
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1196
|
+
t2.output,
|
|
1197
|
+
o(this.options[this.cursor], "selected"),
|
|
1198
|
+
r2
|
|
1199
|
+
);
|
|
1200
|
+
return `${u3}${a2}`;
|
|
1201
|
+
}
|
|
1202
|
+
case "cancel": {
|
|
1203
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1204
|
+
t2.output,
|
|
1205
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1206
|
+
r2
|
|
1207
|
+
);
|
|
1208
|
+
return `${u3}${a2}${n3 ? `
|
|
1209
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1210
|
+
}
|
|
1211
|
+
default: {
|
|
1212
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1213
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1214
|
+
`), b = p.length + 1;
|
|
1215
|
+
return `${u3}${r2}${limitOptions({
|
|
1216
|
+
output: t2.output,
|
|
1217
|
+
cursor: this.cursor,
|
|
1218
|
+
options: this.options,
|
|
1219
|
+
maxItems: t2.maxItems,
|
|
1220
|
+
columnPadding: r2.length,
|
|
1221
|
+
rowPadding: a2 + b,
|
|
1222
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1223
|
+
}).join(`
|
|
1224
|
+
${r2}`)}
|
|
1225
|
+
${f}
|
|
974
1226
|
`;
|
|
1227
|
+
}
|
|
975
1228
|
}
|
|
976
1229
|
}
|
|
977
|
-
}
|
|
1230
|
+
}).prompt();
|
|
978
1231
|
};
|
|
979
|
-
|
|
1232
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
980
1233
|
}
|
|
981
1234
|
});
|
|
982
1235
|
|
|
@@ -989,9 +1242,9 @@ function supportsColor() {
|
|
|
989
1242
|
}
|
|
990
1243
|
return process.stdout.isTTY === true;
|
|
991
1244
|
}
|
|
992
|
-
function colorize(
|
|
993
|
-
if (!supportsColor()) return
|
|
994
|
-
return `${color}${
|
|
1245
|
+
function colorize(text2, color) {
|
|
1246
|
+
if (!supportsColor()) return text2;
|
|
1247
|
+
return `${color}${text2}${colors.reset}`;
|
|
995
1248
|
}
|
|
996
1249
|
function stringify(value) {
|
|
997
1250
|
if (typeof value === "string") return value;
|
|
@@ -1021,7 +1274,7 @@ function stringify(value) {
|
|
|
1021
1274
|
function formatMessage(...args) {
|
|
1022
1275
|
return args.map(stringify).join(" ");
|
|
1023
1276
|
}
|
|
1024
|
-
var colors, currentLogLevel,
|
|
1277
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
1025
1278
|
var init_cli_output = __esm({
|
|
1026
1279
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1027
1280
|
"use strict";
|
|
@@ -1054,7 +1307,7 @@ var init_cli_output = __esm({
|
|
|
1054
1307
|
currentLogLevel = envLevel;
|
|
1055
1308
|
}
|
|
1056
1309
|
}
|
|
1057
|
-
|
|
1310
|
+
log2 = {
|
|
1058
1311
|
/**
|
|
1059
1312
|
* Logs an error message (always shows unless Quiet level)
|
|
1060
1313
|
* Uses clack's log.error + explicit red color
|
|
@@ -1062,7 +1315,7 @@ var init_cli_output = __esm({
|
|
|
1062
1315
|
error(...args) {
|
|
1063
1316
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1064
1317
|
const message = formatMessage(...args);
|
|
1065
|
-
|
|
1318
|
+
log.error(colorize(message, colors.brightRed));
|
|
1066
1319
|
},
|
|
1067
1320
|
/**
|
|
1068
1321
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1071,7 +1324,7 @@ var init_cli_output = __esm({
|
|
|
1071
1324
|
warn(...args) {
|
|
1072
1325
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1073
1326
|
const message = formatMessage(...args);
|
|
1074
|
-
|
|
1327
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1075
1328
|
},
|
|
1076
1329
|
/**
|
|
1077
1330
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1080,7 +1333,7 @@ var init_cli_output = __esm({
|
|
|
1080
1333
|
info(...args) {
|
|
1081
1334
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1082
1335
|
const message = formatMessage(...args);
|
|
1083
|
-
|
|
1336
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1084
1337
|
},
|
|
1085
1338
|
/**
|
|
1086
1339
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1089,7 +1342,7 @@ var init_cli_output = __esm({
|
|
|
1089
1342
|
success(...args) {
|
|
1090
1343
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1091
1344
|
const message = formatMessage(...args);
|
|
1092
|
-
|
|
1345
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1093
1346
|
},
|
|
1094
1347
|
/**
|
|
1095
1348
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1098,7 +1351,7 @@ var init_cli_output = __esm({
|
|
|
1098
1351
|
debug(...args) {
|
|
1099
1352
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1100
1353
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1101
|
-
|
|
1354
|
+
log.message(
|
|
1102
1355
|
colorize(
|
|
1103
1356
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1104
1357
|
colors.gray
|
|
@@ -1112,7 +1365,7 @@ var init_cli_output = __esm({
|
|
|
1112
1365
|
trace(...args) {
|
|
1113
1366
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1114
1367
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1115
|
-
|
|
1368
|
+
log.message(
|
|
1116
1369
|
colorize(
|
|
1117
1370
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1118
1371
|
colors.gray
|
|
@@ -1120,10 +1373,10 @@ var init_cli_output = __esm({
|
|
|
1120
1373
|
);
|
|
1121
1374
|
}
|
|
1122
1375
|
};
|
|
1123
|
-
error =
|
|
1124
|
-
warn =
|
|
1125
|
-
info =
|
|
1126
|
-
success =
|
|
1376
|
+
error = log2.error.bind(log2);
|
|
1377
|
+
warn = log2.warn.bind(log2);
|
|
1378
|
+
info = log2.info.bind(log2);
|
|
1379
|
+
success = log2.success.bind(log2);
|
|
1127
1380
|
}
|
|
1128
1381
|
});
|
|
1129
1382
|
|
|
@@ -1483,9 +1736,9 @@ var require_is_glob = __commonJS({
|
|
|
1483
1736
|
index += 2;
|
|
1484
1737
|
var close = chars[open];
|
|
1485
1738
|
if (close) {
|
|
1486
|
-
var
|
|
1487
|
-
if (
|
|
1488
|
-
index =
|
|
1739
|
+
var n3 = str.indexOf(close, index);
|
|
1740
|
+
if (n3 !== -1) {
|
|
1741
|
+
index = n3 + 1;
|
|
1489
1742
|
}
|
|
1490
1743
|
}
|
|
1491
1744
|
if (str[index] === "!") {
|
|
@@ -1511,9 +1764,9 @@ var require_is_glob = __commonJS({
|
|
|
1511
1764
|
index += 2;
|
|
1512
1765
|
var close = chars[open];
|
|
1513
1766
|
if (close) {
|
|
1514
|
-
var
|
|
1515
|
-
if (
|
|
1516
|
-
index =
|
|
1767
|
+
var n3 = str.indexOf(close, index);
|
|
1768
|
+
if (n3 !== -1) {
|
|
1769
|
+
index = n3 + 1;
|
|
1517
1770
|
}
|
|
1518
1771
|
}
|
|
1519
1772
|
if (str[index] === "!") {
|
|
@@ -1591,8 +1844,8 @@ var require_utils = __commonJS({
|
|
|
1591
1844
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1592
1845
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1593
1846
|
};
|
|
1594
|
-
exports.escapeNode = (
|
|
1595
|
-
const node =
|
|
1847
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1848
|
+
const node = block2.nodes[n3];
|
|
1596
1849
|
if (!node) return;
|
|
1597
1850
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1598
1851
|
if (node.escaped !== true) {
|
|
@@ -1609,15 +1862,15 @@ var require_utils = __commonJS({
|
|
|
1609
1862
|
}
|
|
1610
1863
|
return false;
|
|
1611
1864
|
};
|
|
1612
|
-
exports.isInvalidBrace = (
|
|
1613
|
-
if (
|
|
1614
|
-
if (
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1865
|
+
exports.isInvalidBrace = (block2) => {
|
|
1866
|
+
if (block2.type !== "brace") return false;
|
|
1867
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1868
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1869
|
+
block2.invalid = true;
|
|
1617
1870
|
return true;
|
|
1618
1871
|
}
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1872
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1873
|
+
block2.invalid = true;
|
|
1621
1874
|
return true;
|
|
1622
1875
|
}
|
|
1623
1876
|
return false;
|
|
@@ -1636,8 +1889,8 @@ var require_utils = __commonJS({
|
|
|
1636
1889
|
exports.flatten = (...args) => {
|
|
1637
1890
|
const result = [];
|
|
1638
1891
|
const flat = (arr) => {
|
|
1639
|
-
for (let
|
|
1640
|
-
const ele = arr[
|
|
1892
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1893
|
+
const ele = arr[i2];
|
|
1641
1894
|
if (Array.isArray(ele)) {
|
|
1642
1895
|
flat(ele);
|
|
1643
1896
|
continue;
|
|
@@ -1731,9 +1984,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1731
1984
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1732
1985
|
return toRegexRange.cache[cacheKey].result;
|
|
1733
1986
|
}
|
|
1734
|
-
let
|
|
1987
|
+
let a2 = Math.min(min, max);
|
|
1735
1988
|
let b = Math.max(min, max);
|
|
1736
|
-
if (Math.abs(
|
|
1989
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1737
1990
|
let result = min + "|" + max;
|
|
1738
1991
|
if (opts.capture) {
|
|
1739
1992
|
return `(${result})`;
|
|
@@ -1744,20 +1997,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1744
1997
|
return `(?:${result})`;
|
|
1745
1998
|
}
|
|
1746
1999
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1747
|
-
let state = { min, max, a, b };
|
|
2000
|
+
let state = { min, max, a: a2, b };
|
|
1748
2001
|
let positives = [];
|
|
1749
2002
|
let negatives = [];
|
|
1750
2003
|
if (isPadded) {
|
|
1751
2004
|
state.isPadded = isPadded;
|
|
1752
2005
|
state.maxLen = String(state.max).length;
|
|
1753
2006
|
}
|
|
1754
|
-
if (
|
|
2007
|
+
if (a2 < 0) {
|
|
1755
2008
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1756
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1757
|
-
|
|
2009
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2010
|
+
a2 = state.a = 0;
|
|
1758
2011
|
}
|
|
1759
2012
|
if (b >= 0) {
|
|
1760
|
-
positives = splitToPatterns(
|
|
2013
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1761
2014
|
}
|
|
1762
2015
|
state.negatives = negatives;
|
|
1763
2016
|
state.positives = positives;
|
|
@@ -1805,8 +2058,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1805
2058
|
let digits = zipped.length;
|
|
1806
2059
|
let pattern = "";
|
|
1807
2060
|
let count = 0;
|
|
1808
|
-
for (let
|
|
1809
|
-
let [startDigit, stopDigit] = zipped[
|
|
2061
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2062
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1810
2063
|
if (startDigit === stopDigit) {
|
|
1811
2064
|
pattern += startDigit;
|
|
1812
2065
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1825,8 +2078,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1825
2078
|
let tokens = [];
|
|
1826
2079
|
let start = min;
|
|
1827
2080
|
let prev;
|
|
1828
|
-
for (let
|
|
1829
|
-
let max2 = ranges[
|
|
2081
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2082
|
+
let max2 = ranges[i2];
|
|
1830
2083
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1831
2084
|
let zeros = "";
|
|
1832
2085
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1861,13 +2114,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1861
2114
|
}
|
|
1862
2115
|
return result;
|
|
1863
2116
|
}
|
|
1864
|
-
function zip(
|
|
2117
|
+
function zip(a2, b) {
|
|
1865
2118
|
let arr = [];
|
|
1866
|
-
for (let
|
|
2119
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1867
2120
|
return arr;
|
|
1868
2121
|
}
|
|
1869
|
-
function compare(
|
|
1870
|
-
return
|
|
2122
|
+
function compare(a2, b) {
|
|
2123
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1871
2124
|
}
|
|
1872
2125
|
function contains(arr, key, val) {
|
|
1873
2126
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1885,8 +2138,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1885
2138
|
}
|
|
1886
2139
|
return "";
|
|
1887
2140
|
}
|
|
1888
|
-
function toCharacterClass(
|
|
1889
|
-
return `[${
|
|
2141
|
+
function toCharacterClass(a2, b, options) {
|
|
2142
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1890
2143
|
}
|
|
1891
2144
|
function hasPadding(str) {
|
|
1892
2145
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1965,8 +2218,8 @@ var require_fill_range = __commonJS({
|
|
|
1965
2218
|
return negative ? "-" + input : input;
|
|
1966
2219
|
};
|
|
1967
2220
|
var toSequence = (parts, options, maxLen) => {
|
|
1968
|
-
parts.negatives.sort((
|
|
1969
|
-
parts.positives.sort((
|
|
2221
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2222
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
1970
2223
|
let prefix = options.capture ? "" : "?:";
|
|
1971
2224
|
let positives = "";
|
|
1972
2225
|
let negatives = "";
|
|
@@ -1987,12 +2240,12 @@ var require_fill_range = __commonJS({
|
|
|
1987
2240
|
}
|
|
1988
2241
|
return result;
|
|
1989
2242
|
};
|
|
1990
|
-
var toRange = (
|
|
2243
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
1991
2244
|
if (isNumbers) {
|
|
1992
|
-
return toRegexRange(
|
|
2245
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
1993
2246
|
}
|
|
1994
|
-
let start = String.fromCharCode(
|
|
1995
|
-
if (
|
|
2247
|
+
let start = String.fromCharCode(a2);
|
|
2248
|
+
if (a2 === b) return start;
|
|
1996
2249
|
let stop = String.fromCharCode(b);
|
|
1997
2250
|
return `[${start}-${stop}]`;
|
|
1998
2251
|
};
|
|
@@ -2018,15 +2271,15 @@ var require_fill_range = __commonJS({
|
|
|
2018
2271
|
return [];
|
|
2019
2272
|
};
|
|
2020
2273
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2021
|
-
let
|
|
2274
|
+
let a2 = Number(start);
|
|
2022
2275
|
let b = Number(end);
|
|
2023
|
-
if (!Number.isInteger(
|
|
2276
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2024
2277
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2025
2278
|
return [];
|
|
2026
2279
|
}
|
|
2027
|
-
if (
|
|
2280
|
+
if (a2 === 0) a2 = 0;
|
|
2028
2281
|
if (b === 0) b = 0;
|
|
2029
|
-
let descending =
|
|
2282
|
+
let descending = a2 > b;
|
|
2030
2283
|
let startString = String(start);
|
|
2031
2284
|
let endString = String(end);
|
|
2032
2285
|
let stepString = String(step);
|
|
@@ -2042,13 +2295,13 @@ var require_fill_range = __commonJS({
|
|
|
2042
2295
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2043
2296
|
let range = [];
|
|
2044
2297
|
let index = 0;
|
|
2045
|
-
while (descending ?
|
|
2298
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2046
2299
|
if (options.toRegex === true && step > 1) {
|
|
2047
|
-
push(
|
|
2300
|
+
push(a2);
|
|
2048
2301
|
} else {
|
|
2049
|
-
range.push(pad(format(
|
|
2302
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2050
2303
|
}
|
|
2051
|
-
|
|
2304
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2052
2305
|
index++;
|
|
2053
2306
|
}
|
|
2054
2307
|
if (options.toRegex === true) {
|
|
@@ -2061,19 +2314,19 @@ var require_fill_range = __commonJS({
|
|
|
2061
2314
|
return invalidRange(start, end, options);
|
|
2062
2315
|
}
|
|
2063
2316
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2064
|
-
let
|
|
2317
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2065
2318
|
let b = `${end}`.charCodeAt(0);
|
|
2066
|
-
let descending =
|
|
2067
|
-
let min = Math.min(
|
|
2068
|
-
let max = Math.max(
|
|
2319
|
+
let descending = a2 > b;
|
|
2320
|
+
let min = Math.min(a2, b);
|
|
2321
|
+
let max = Math.max(a2, b);
|
|
2069
2322
|
if (options.toRegex && step === 1) {
|
|
2070
2323
|
return toRange(min, max, false, options);
|
|
2071
2324
|
}
|
|
2072
2325
|
let range = [];
|
|
2073
2326
|
let index = 0;
|
|
2074
|
-
while (descending ?
|
|
2075
|
-
range.push(format(
|
|
2076
|
-
|
|
2327
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2328
|
+
range.push(format(a2, index));
|
|
2329
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2077
2330
|
index++;
|
|
2078
2331
|
}
|
|
2079
2332
|
if (options.toRegex === true) {
|
|
@@ -2196,18 +2449,18 @@ var require_expand = __commonJS({
|
|
|
2196
2449
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2197
2450
|
const walk = (node, parent = {}) => {
|
|
2198
2451
|
node.queue = [];
|
|
2199
|
-
let
|
|
2200
|
-
let
|
|
2201
|
-
while (
|
|
2202
|
-
|
|
2203
|
-
|
|
2452
|
+
let p = parent;
|
|
2453
|
+
let q = parent.queue;
|
|
2454
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2455
|
+
p = p.parent;
|
|
2456
|
+
q = p.queue;
|
|
2204
2457
|
}
|
|
2205
2458
|
if (node.invalid || node.dollar) {
|
|
2206
|
-
|
|
2459
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2207
2460
|
return;
|
|
2208
2461
|
}
|
|
2209
2462
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2210
|
-
|
|
2463
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2211
2464
|
return;
|
|
2212
2465
|
}
|
|
2213
2466
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2219,26 +2472,26 @@ var require_expand = __commonJS({
|
|
|
2219
2472
|
if (range.length === 0) {
|
|
2220
2473
|
range = stringify2(node, options);
|
|
2221
2474
|
}
|
|
2222
|
-
|
|
2475
|
+
q.push(append(q.pop(), range));
|
|
2223
2476
|
node.nodes = [];
|
|
2224
2477
|
return;
|
|
2225
2478
|
}
|
|
2226
2479
|
const enclose = utils.encloseBrace(node);
|
|
2227
2480
|
let queue = node.queue;
|
|
2228
|
-
let
|
|
2229
|
-
while (
|
|
2230
|
-
|
|
2231
|
-
queue =
|
|
2481
|
+
let block2 = node;
|
|
2482
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2483
|
+
block2 = block2.parent;
|
|
2484
|
+
queue = block2.queue;
|
|
2232
2485
|
}
|
|
2233
|
-
for (let
|
|
2234
|
-
const child = node.nodes[
|
|
2486
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2487
|
+
const child = node.nodes[i2];
|
|
2235
2488
|
if (child.type === "comma" && node.type === "brace") {
|
|
2236
|
-
if (
|
|
2489
|
+
if (i2 === 1) queue.push("");
|
|
2237
2490
|
queue.push("");
|
|
2238
2491
|
continue;
|
|
2239
2492
|
}
|
|
2240
2493
|
if (child.type === "close") {
|
|
2241
|
-
|
|
2494
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2242
2495
|
continue;
|
|
2243
2496
|
}
|
|
2244
2497
|
if (child.value && child.type !== "open") {
|
|
@@ -2405,7 +2658,7 @@ var require_parse = __commonJS({
|
|
|
2405
2658
|
}
|
|
2406
2659
|
const ast = { type: "root", input, nodes: [] };
|
|
2407
2660
|
const stack = [ast];
|
|
2408
|
-
let
|
|
2661
|
+
let block2 = ast;
|
|
2409
2662
|
let prev = ast;
|
|
2410
2663
|
let brackets = 0;
|
|
2411
2664
|
const length = input.length;
|
|
@@ -2421,15 +2674,15 @@ var require_parse = __commonJS({
|
|
|
2421
2674
|
prev.value += node.value;
|
|
2422
2675
|
return;
|
|
2423
2676
|
}
|
|
2424
|
-
|
|
2425
|
-
node.parent =
|
|
2677
|
+
block2.nodes.push(node);
|
|
2678
|
+
node.parent = block2;
|
|
2426
2679
|
node.prev = prev;
|
|
2427
2680
|
prev = node;
|
|
2428
2681
|
return node;
|
|
2429
2682
|
};
|
|
2430
2683
|
push({ type: "bos" });
|
|
2431
2684
|
while (index < length) {
|
|
2432
|
-
|
|
2685
|
+
block2 = stack[stack.length - 1];
|
|
2433
2686
|
value = advance();
|
|
2434
2687
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2435
2688
|
continue;
|
|
@@ -2466,19 +2719,19 @@ var require_parse = __commonJS({
|
|
|
2466
2719
|
continue;
|
|
2467
2720
|
}
|
|
2468
2721
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2469
|
-
|
|
2470
|
-
stack.push(
|
|
2722
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2723
|
+
stack.push(block2);
|
|
2471
2724
|
push({ type: "text", value });
|
|
2472
2725
|
continue;
|
|
2473
2726
|
}
|
|
2474
2727
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2475
|
-
if (
|
|
2728
|
+
if (block2.type !== "paren") {
|
|
2476
2729
|
push({ type: "text", value });
|
|
2477
2730
|
continue;
|
|
2478
2731
|
}
|
|
2479
|
-
|
|
2732
|
+
block2 = stack.pop();
|
|
2480
2733
|
push({ type: "text", value });
|
|
2481
|
-
|
|
2734
|
+
block2 = stack[stack.length - 1];
|
|
2482
2735
|
continue;
|
|
2483
2736
|
}
|
|
2484
2737
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2503,7 +2756,7 @@ var require_parse = __commonJS({
|
|
|
2503
2756
|
}
|
|
2504
2757
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2505
2758
|
depth++;
|
|
2506
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2759
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2507
2760
|
const brace = {
|
|
2508
2761
|
type: "brace",
|
|
2509
2762
|
open: true,
|
|
@@ -2514,52 +2767,52 @@ var require_parse = __commonJS({
|
|
|
2514
2767
|
ranges: 0,
|
|
2515
2768
|
nodes: []
|
|
2516
2769
|
};
|
|
2517
|
-
|
|
2518
|
-
stack.push(
|
|
2770
|
+
block2 = push(brace);
|
|
2771
|
+
stack.push(block2);
|
|
2519
2772
|
push({ type: "open", value });
|
|
2520
2773
|
continue;
|
|
2521
2774
|
}
|
|
2522
2775
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2523
|
-
if (
|
|
2776
|
+
if (block2.type !== "brace") {
|
|
2524
2777
|
push({ type: "text", value });
|
|
2525
2778
|
continue;
|
|
2526
2779
|
}
|
|
2527
2780
|
const type = "close";
|
|
2528
|
-
|
|
2529
|
-
|
|
2781
|
+
block2 = stack.pop();
|
|
2782
|
+
block2.close = true;
|
|
2530
2783
|
push({ type, value });
|
|
2531
2784
|
depth--;
|
|
2532
|
-
|
|
2785
|
+
block2 = stack[stack.length - 1];
|
|
2533
2786
|
continue;
|
|
2534
2787
|
}
|
|
2535
2788
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2536
|
-
if (
|
|
2537
|
-
|
|
2538
|
-
const open =
|
|
2539
|
-
|
|
2789
|
+
if (block2.ranges > 0) {
|
|
2790
|
+
block2.ranges = 0;
|
|
2791
|
+
const open = block2.nodes.shift();
|
|
2792
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2540
2793
|
}
|
|
2541
2794
|
push({ type: "comma", value });
|
|
2542
|
-
|
|
2795
|
+
block2.commas++;
|
|
2543
2796
|
continue;
|
|
2544
2797
|
}
|
|
2545
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2546
|
-
const siblings =
|
|
2798
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2799
|
+
const siblings = block2.nodes;
|
|
2547
2800
|
if (depth === 0 || siblings.length === 0) {
|
|
2548
2801
|
push({ type: "text", value });
|
|
2549
2802
|
continue;
|
|
2550
2803
|
}
|
|
2551
2804
|
if (prev.type === "dot") {
|
|
2552
|
-
|
|
2805
|
+
block2.range = [];
|
|
2553
2806
|
prev.value += value;
|
|
2554
2807
|
prev.type = "range";
|
|
2555
|
-
if (
|
|
2556
|
-
|
|
2557
|
-
|
|
2808
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2809
|
+
block2.invalid = true;
|
|
2810
|
+
block2.ranges = 0;
|
|
2558
2811
|
prev.type = "text";
|
|
2559
2812
|
continue;
|
|
2560
2813
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2814
|
+
block2.ranges++;
|
|
2815
|
+
block2.args = [];
|
|
2563
2816
|
continue;
|
|
2564
2817
|
}
|
|
2565
2818
|
if (prev.type === "range") {
|
|
@@ -2567,7 +2820,7 @@ var require_parse = __commonJS({
|
|
|
2567
2820
|
const before = siblings[siblings.length - 1];
|
|
2568
2821
|
before.value += prev.value + value;
|
|
2569
2822
|
prev = before;
|
|
2570
|
-
|
|
2823
|
+
block2.ranges--;
|
|
2571
2824
|
continue;
|
|
2572
2825
|
}
|
|
2573
2826
|
push({ type: "dot", value });
|
|
@@ -2576,9 +2829,9 @@ var require_parse = __commonJS({
|
|
|
2576
2829
|
push({ type: "text", value });
|
|
2577
2830
|
}
|
|
2578
2831
|
do {
|
|
2579
|
-
|
|
2580
|
-
if (
|
|
2581
|
-
|
|
2832
|
+
block2 = stack.pop();
|
|
2833
|
+
if (block2.type !== "root") {
|
|
2834
|
+
block2.nodes.forEach((node) => {
|
|
2582
2835
|
if (!node.nodes) {
|
|
2583
2836
|
if (node.type === "open") node.isOpen = true;
|
|
2584
2837
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2587,8 +2840,8 @@ var require_parse = __commonJS({
|
|
|
2587
2840
|
}
|
|
2588
2841
|
});
|
|
2589
2842
|
const parent = stack[stack.length - 1];
|
|
2590
|
-
const index2 = parent.nodes.indexOf(
|
|
2591
|
-
parent.nodes.splice(index2, 1, ...
|
|
2843
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2844
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2592
2845
|
}
|
|
2593
2846
|
} while (stack.length > 0);
|
|
2594
2847
|
push({ type: "eos" });
|
|
@@ -3221,9 +3474,9 @@ var require_scan = __commonJS({
|
|
|
3221
3474
|
if (opts.parts === true || opts.tokens === true) {
|
|
3222
3475
|
let prevIndex;
|
|
3223
3476
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3224
|
-
const
|
|
3225
|
-
const
|
|
3226
|
-
const value = input.slice(
|
|
3477
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3478
|
+
const i2 = slashes[idx];
|
|
3479
|
+
const value = input.slice(n3, i2);
|
|
3227
3480
|
if (opts.tokens) {
|
|
3228
3481
|
if (idx === 0 && start !== 0) {
|
|
3229
3482
|
tokens[idx].isPrefix = true;
|
|
@@ -3237,7 +3490,7 @@ var require_scan = __commonJS({
|
|
|
3237
3490
|
if (idx !== 0 || value !== "") {
|
|
3238
3491
|
parts.push(value);
|
|
3239
3492
|
}
|
|
3240
|
-
prevIndex =
|
|
3493
|
+
prevIndex = i2;
|
|
3241
3494
|
}
|
|
3242
3495
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3243
3496
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3366,15 +3619,15 @@ var require_parse2 = __commonJS({
|
|
|
3366
3619
|
};
|
|
3367
3620
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3368
3621
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3369
|
-
for (let
|
|
3370
|
-
for (let
|
|
3371
|
-
const
|
|
3372
|
-
const b = values[
|
|
3373
|
-
const char =
|
|
3374
|
-
if (!char ||
|
|
3622
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3623
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3624
|
+
const a2 = values[i2];
|
|
3625
|
+
const b = values[j];
|
|
3626
|
+
const char = a2[0];
|
|
3627
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3375
3628
|
continue;
|
|
3376
3629
|
}
|
|
3377
|
-
if (
|
|
3630
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3378
3631
|
return true;
|
|
3379
3632
|
}
|
|
3380
3633
|
}
|
|
@@ -3389,8 +3642,8 @@ var require_parse2 = __commonJS({
|
|
|
3389
3642
|
let paren = 0;
|
|
3390
3643
|
let quote = 0;
|
|
3391
3644
|
let escaped = false;
|
|
3392
|
-
for (let
|
|
3393
|
-
const ch = pattern[
|
|
3645
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3646
|
+
const ch = pattern[i2];
|
|
3394
3647
|
if (escaped === true) {
|
|
3395
3648
|
escaped = false;
|
|
3396
3649
|
continue;
|
|
@@ -3424,13 +3677,13 @@ var require_parse2 = __commonJS({
|
|
|
3424
3677
|
if (ch === ")") {
|
|
3425
3678
|
paren--;
|
|
3426
3679
|
if (paren === 0) {
|
|
3427
|
-
if (requireEnd === true &&
|
|
3680
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3428
3681
|
return;
|
|
3429
3682
|
}
|
|
3430
3683
|
return {
|
|
3431
3684
|
type: pattern[0],
|
|
3432
|
-
body: pattern.slice(2,
|
|
3433
|
-
end:
|
|
3685
|
+
body: pattern.slice(2, i2),
|
|
3686
|
+
end: i2
|
|
3434
3687
|
};
|
|
3435
3688
|
}
|
|
3436
3689
|
}
|
|
@@ -3562,7 +3815,7 @@ var require_parse2 = __commonJS({
|
|
|
3562
3815
|
let prev = bos;
|
|
3563
3816
|
let value;
|
|
3564
3817
|
const eos = () => state.index === len - 1;
|
|
3565
|
-
const peek = state.peek = (
|
|
3818
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3566
3819
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3567
3820
|
const remaining = () => input.slice(state.index + 1);
|
|
3568
3821
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3643,10 +3896,10 @@ var require_parse2 = __commonJS({
|
|
|
3643
3896
|
open.type = "text";
|
|
3644
3897
|
open.value = literal;
|
|
3645
3898
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3646
|
-
for (let
|
|
3647
|
-
tokens[
|
|
3648
|
-
tokens[
|
|
3649
|
-
delete tokens[
|
|
3899
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3900
|
+
tokens[i2].value = "";
|
|
3901
|
+
tokens[i2].output = "";
|
|
3902
|
+
delete tokens[i2].suffix;
|
|
3650
3903
|
}
|
|
3651
3904
|
state.output = token.output + open.output;
|
|
3652
3905
|
state.backtrack = true;
|
|
@@ -3677,10 +3930,10 @@ var require_parse2 = __commonJS({
|
|
|
3677
3930
|
};
|
|
3678
3931
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
3679
3932
|
let backslashes = false;
|
|
3680
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
3933
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
|
|
3681
3934
|
if (first === "\\") {
|
|
3682
3935
|
backslashes = true;
|
|
3683
|
-
return
|
|
3936
|
+
return m2;
|
|
3684
3937
|
}
|
|
3685
3938
|
if (first === "?") {
|
|
3686
3939
|
if (esc) {
|
|
@@ -3700,14 +3953,14 @@ var require_parse2 = __commonJS({
|
|
|
3700
3953
|
}
|
|
3701
3954
|
return star;
|
|
3702
3955
|
}
|
|
3703
|
-
return esc ?
|
|
3956
|
+
return esc ? m2 : `\\${m2}`;
|
|
3704
3957
|
});
|
|
3705
3958
|
if (backslashes === true) {
|
|
3706
3959
|
if (opts.unescape === true) {
|
|
3707
3960
|
output = output.replace(/\\/g, "");
|
|
3708
3961
|
} else {
|
|
3709
|
-
output = output.replace(/\\+/g, (
|
|
3710
|
-
return
|
|
3962
|
+
output = output.replace(/\\+/g, (m2) => {
|
|
3963
|
+
return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
|
|
3711
3964
|
});
|
|
3712
3965
|
}
|
|
3713
3966
|
}
|
|
@@ -3889,13 +4142,13 @@ var require_parse2 = __commonJS({
|
|
|
3889
4142
|
if (brace.dots === true) {
|
|
3890
4143
|
const arr = tokens.slice();
|
|
3891
4144
|
const range = [];
|
|
3892
|
-
for (let
|
|
4145
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3893
4146
|
tokens.pop();
|
|
3894
|
-
if (arr[
|
|
4147
|
+
if (arr[i2].type === "brace") {
|
|
3895
4148
|
break;
|
|
3896
4149
|
}
|
|
3897
|
-
if (arr[
|
|
3898
|
-
range.unshift(arr[
|
|
4150
|
+
if (arr[i2].type !== "dots") {
|
|
4151
|
+
range.unshift(arr[i2].value);
|
|
3899
4152
|
}
|
|
3900
4153
|
}
|
|
3901
4154
|
output = expandRange(range, opts);
|
|
@@ -4354,7 +4607,7 @@ var require_picomatch = __commonJS({
|
|
|
4354
4607
|
};
|
|
4355
4608
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4356
4609
|
picomatch.parse = (pattern, options) => {
|
|
4357
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4610
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4358
4611
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4359
4612
|
};
|
|
4360
4613
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4438,8 +4691,8 @@ var require_micromatch = __commonJS({
|
|
|
4438
4691
|
options.onResult(state);
|
|
4439
4692
|
}
|
|
4440
4693
|
};
|
|
4441
|
-
for (let
|
|
4442
|
-
let isMatch = picomatch(String(patterns[
|
|
4694
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4695
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4443
4696
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4444
4697
|
if (negated) negatives++;
|
|
4445
4698
|
for (let item of list) {
|
|
@@ -4461,7 +4714,7 @@ var require_micromatch = __commonJS({
|
|
|
4461
4714
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4462
4715
|
}
|
|
4463
4716
|
if (options.nonull === true || options.nullglob === true) {
|
|
4464
|
-
return options.unescape ? patterns.map((
|
|
4717
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4465
4718
|
}
|
|
4466
4719
|
}
|
|
4467
4720
|
return matches;
|
|
@@ -4491,7 +4744,7 @@ var require_micromatch = __commonJS({
|
|
|
4491
4744
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4492
4745
|
}
|
|
4493
4746
|
if (Array.isArray(pattern)) {
|
|
4494
|
-
return pattern.some((
|
|
4747
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4495
4748
|
}
|
|
4496
4749
|
if (typeof pattern === "string") {
|
|
4497
4750
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4536,7 +4789,7 @@ var require_micromatch = __commonJS({
|
|
|
4536
4789
|
if (typeof str !== "string") {
|
|
4537
4790
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4538
4791
|
}
|
|
4539
|
-
return [].concat(patterns).every((
|
|
4792
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4540
4793
|
};
|
|
4541
4794
|
micromatch.capture = (glob, input, options) => {
|
|
4542
4795
|
let posix = utils.isWindows(options);
|
|
@@ -4687,7 +4940,7 @@ var require_pattern = __commonJS({
|
|
|
4687
4940
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4688
4941
|
function expandBraceExpansion(pattern) {
|
|
4689
4942
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4690
|
-
patterns.sort((
|
|
4943
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4691
4944
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4692
4945
|
}
|
|
4693
4946
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4768,8 +5021,8 @@ var require_merge2 = __commonJS({
|
|
|
4768
5021
|
}
|
|
4769
5022
|
const mergedStream = PassThrough(options);
|
|
4770
5023
|
function addStream() {
|
|
4771
|
-
for (let
|
|
4772
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5024
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5025
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4773
5026
|
}
|
|
4774
5027
|
mergeStream();
|
|
4775
5028
|
return this;
|
|
@@ -4818,8 +5071,8 @@ var require_merge2 = __commonJS({
|
|
|
4818
5071
|
stream.pipe(mergedStream, { end: false });
|
|
4819
5072
|
stream.resume();
|
|
4820
5073
|
}
|
|
4821
|
-
for (let
|
|
4822
|
-
pipe(streams[
|
|
5074
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5075
|
+
pipe(streams[i2]);
|
|
4823
5076
|
}
|
|
4824
5077
|
next();
|
|
4825
5078
|
}
|
|
@@ -4850,8 +5103,8 @@ var require_merge2 = __commonJS({
|
|
|
4850
5103
|
}
|
|
4851
5104
|
streams.pause();
|
|
4852
5105
|
} else {
|
|
4853
|
-
for (let
|
|
4854
|
-
streams[
|
|
5106
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5107
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4855
5108
|
}
|
|
4856
5109
|
}
|
|
4857
5110
|
return streams;
|
|
@@ -4933,13 +5186,13 @@ var require_tasks = __commonJS({
|
|
|
4933
5186
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4934
5187
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4935
5188
|
var utils = require_utils3();
|
|
4936
|
-
function generate(input,
|
|
4937
|
-
const patterns = processPatterns(input,
|
|
4938
|
-
const ignore = processPatterns(
|
|
5189
|
+
function generate(input, settings2) {
|
|
5190
|
+
const patterns = processPatterns(input, settings2);
|
|
5191
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4939
5192
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4940
5193
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4941
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4942
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5194
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5195
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4943
5196
|
const staticTasks = convertPatternsToTasks(
|
|
4944
5197
|
staticPatterns,
|
|
4945
5198
|
negativePatterns,
|
|
@@ -4955,12 +5208,12 @@ var require_tasks = __commonJS({
|
|
|
4955
5208
|
return staticTasks.concat(dynamicTasks);
|
|
4956
5209
|
}
|
|
4957
5210
|
exports.generate = generate;
|
|
4958
|
-
function processPatterns(input,
|
|
5211
|
+
function processPatterns(input, settings2) {
|
|
4959
5212
|
let patterns = input;
|
|
4960
|
-
if (
|
|
5213
|
+
if (settings2.braceExpansion) {
|
|
4961
5214
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
4962
5215
|
}
|
|
4963
|
-
if (
|
|
5216
|
+
if (settings2.baseNameMatch) {
|
|
4964
5217
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
4965
5218
|
}
|
|
4966
5219
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -4991,7 +5244,7 @@ var require_tasks = __commonJS({
|
|
|
4991
5244
|
}
|
|
4992
5245
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
4993
5246
|
function groupPatternsByBaseDirectory(patterns) {
|
|
4994
|
-
const
|
|
5247
|
+
const group2 = {};
|
|
4995
5248
|
return patterns.reduce((collection, pattern) => {
|
|
4996
5249
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
4997
5250
|
if (base in collection) {
|
|
@@ -5000,7 +5253,7 @@ var require_tasks = __commonJS({
|
|
|
5000
5253
|
collection[base] = [pattern];
|
|
5001
5254
|
}
|
|
5002
5255
|
return collection;
|
|
5003
|
-
},
|
|
5256
|
+
}, group2);
|
|
5004
5257
|
}
|
|
5005
5258
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5006
5259
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5029,26 +5282,26 @@ var require_async = __commonJS({
|
|
|
5029
5282
|
init_utils2();
|
|
5030
5283
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5031
5284
|
exports.read = void 0;
|
|
5032
|
-
function read(path,
|
|
5033
|
-
|
|
5285
|
+
function read(path, settings2, callback) {
|
|
5286
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5034
5287
|
if (lstatError !== null) {
|
|
5035
5288
|
callFailureCallback(callback, lstatError);
|
|
5036
5289
|
return;
|
|
5037
5290
|
}
|
|
5038
|
-
if (!lstat.isSymbolicLink() || !
|
|
5291
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5039
5292
|
callSuccessCallback(callback, lstat);
|
|
5040
5293
|
return;
|
|
5041
5294
|
}
|
|
5042
|
-
|
|
5295
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5043
5296
|
if (statError !== null) {
|
|
5044
|
-
if (
|
|
5297
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5045
5298
|
callFailureCallback(callback, statError);
|
|
5046
5299
|
return;
|
|
5047
5300
|
}
|
|
5048
5301
|
callSuccessCallback(callback, lstat);
|
|
5049
5302
|
return;
|
|
5050
5303
|
}
|
|
5051
|
-
if (
|
|
5304
|
+
if (settings2.markSymbolicLink) {
|
|
5052
5305
|
stat.isSymbolicLink = () => true;
|
|
5053
5306
|
}
|
|
5054
5307
|
callSuccessCallback(callback, stat);
|
|
@@ -5072,19 +5325,19 @@ var require_sync = __commonJS({
|
|
|
5072
5325
|
init_utils2();
|
|
5073
5326
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5074
5327
|
exports.read = void 0;
|
|
5075
|
-
function read(path,
|
|
5076
|
-
const lstat =
|
|
5077
|
-
if (!lstat.isSymbolicLink() || !
|
|
5328
|
+
function read(path, settings2) {
|
|
5329
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5330
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5078
5331
|
return lstat;
|
|
5079
5332
|
}
|
|
5080
5333
|
try {
|
|
5081
|
-
const stat =
|
|
5082
|
-
if (
|
|
5334
|
+
const stat = settings2.fs.statSync(path);
|
|
5335
|
+
if (settings2.markSymbolicLink) {
|
|
5083
5336
|
stat.isSymbolicLink = () => true;
|
|
5084
5337
|
}
|
|
5085
5338
|
return stat;
|
|
5086
5339
|
} catch (error2) {
|
|
5087
|
-
if (!
|
|
5340
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5088
5341
|
return lstat;
|
|
5089
5342
|
}
|
|
5090
5343
|
throw error2;
|
|
@@ -5161,8 +5414,8 @@ var require_out = __commonJS({
|
|
|
5161
5414
|
}
|
|
5162
5415
|
exports.stat = stat;
|
|
5163
5416
|
function statSync3(path, optionsOrSettings) {
|
|
5164
|
-
const
|
|
5165
|
-
return sync.read(path,
|
|
5417
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5418
|
+
return sync.read(path, settings2);
|
|
5166
5419
|
}
|
|
5167
5420
|
exports.statSync = statSync3;
|
|
5168
5421
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5210,8 +5463,8 @@ var require_run_parallel = __commonJS({
|
|
|
5210
5463
|
if (isSync) queueMicrotask2(end);
|
|
5211
5464
|
else end();
|
|
5212
5465
|
}
|
|
5213
|
-
function each(
|
|
5214
|
-
results[
|
|
5466
|
+
function each(i2, err, result) {
|
|
5467
|
+
results[i2] = result;
|
|
5215
5468
|
if (--pending === 0 || err) {
|
|
5216
5469
|
done(err);
|
|
5217
5470
|
}
|
|
@@ -5225,9 +5478,9 @@ var require_run_parallel = __commonJS({
|
|
|
5225
5478
|
});
|
|
5226
5479
|
});
|
|
5227
5480
|
} else {
|
|
5228
|
-
tasks.forEach(function(task,
|
|
5481
|
+
tasks.forEach(function(task, i2) {
|
|
5229
5482
|
task(function(err, result) {
|
|
5230
|
-
each(
|
|
5483
|
+
each(i2, err, result);
|
|
5231
5484
|
});
|
|
5232
5485
|
});
|
|
5233
5486
|
}
|
|
@@ -5302,11 +5555,11 @@ var require_common = __commonJS({
|
|
|
5302
5555
|
init_utils2();
|
|
5303
5556
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5304
5557
|
exports.joinPathSegments = void 0;
|
|
5305
|
-
function joinPathSegments(
|
|
5306
|
-
if (
|
|
5307
|
-
return
|
|
5558
|
+
function joinPathSegments(a2, b, separator) {
|
|
5559
|
+
if (a2.endsWith(separator)) {
|
|
5560
|
+
return a2 + b;
|
|
5308
5561
|
}
|
|
5309
|
-
return
|
|
5562
|
+
return a2 + separator + b;
|
|
5310
5563
|
}
|
|
5311
5564
|
exports.joinPathSegments = joinPathSegments;
|
|
5312
5565
|
}
|
|
@@ -5324,16 +5577,16 @@ var require_async2 = __commonJS({
|
|
|
5324
5577
|
var constants_1 = require_constants3();
|
|
5325
5578
|
var utils = require_utils4();
|
|
5326
5579
|
var common = require_common();
|
|
5327
|
-
function read(directory,
|
|
5328
|
-
if (!
|
|
5329
|
-
readdirWithFileTypes(directory,
|
|
5580
|
+
function read(directory, settings2, callback) {
|
|
5581
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5582
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5330
5583
|
return;
|
|
5331
5584
|
}
|
|
5332
|
-
readdir(directory,
|
|
5585
|
+
readdir(directory, settings2, callback);
|
|
5333
5586
|
}
|
|
5334
5587
|
exports.read = read;
|
|
5335
|
-
function readdirWithFileTypes(directory,
|
|
5336
|
-
|
|
5588
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5589
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5337
5590
|
if (readdirError !== null) {
|
|
5338
5591
|
callFailureCallback(callback, readdirError);
|
|
5339
5592
|
return;
|
|
@@ -5341,13 +5594,13 @@ var require_async2 = __commonJS({
|
|
|
5341
5594
|
const entries = dirents.map((dirent) => ({
|
|
5342
5595
|
dirent,
|
|
5343
5596
|
name: dirent.name,
|
|
5344
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5597
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5345
5598
|
}));
|
|
5346
|
-
if (!
|
|
5599
|
+
if (!settings2.followSymbolicLinks) {
|
|
5347
5600
|
callSuccessCallback(callback, entries);
|
|
5348
5601
|
return;
|
|
5349
5602
|
}
|
|
5350
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5603
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5351
5604
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5352
5605
|
if (rplError !== null) {
|
|
5353
5606
|
callFailureCallback(callback, rplError);
|
|
@@ -5358,15 +5611,15 @@ var require_async2 = __commonJS({
|
|
|
5358
5611
|
});
|
|
5359
5612
|
}
|
|
5360
5613
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5361
|
-
function makeRplTaskEntry(entry,
|
|
5614
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5362
5615
|
return (done) => {
|
|
5363
5616
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5364
5617
|
done(null, entry);
|
|
5365
5618
|
return;
|
|
5366
5619
|
}
|
|
5367
|
-
|
|
5620
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5368
5621
|
if (statError !== null) {
|
|
5369
|
-
if (
|
|
5622
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5370
5623
|
done(statError);
|
|
5371
5624
|
return;
|
|
5372
5625
|
}
|
|
@@ -5378,16 +5631,16 @@ var require_async2 = __commonJS({
|
|
|
5378
5631
|
});
|
|
5379
5632
|
};
|
|
5380
5633
|
}
|
|
5381
|
-
function readdir(directory,
|
|
5382
|
-
|
|
5634
|
+
function readdir(directory, settings2, callback) {
|
|
5635
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5383
5636
|
if (readdirError !== null) {
|
|
5384
5637
|
callFailureCallback(callback, readdirError);
|
|
5385
5638
|
return;
|
|
5386
5639
|
}
|
|
5387
5640
|
const tasks = names.map((name) => {
|
|
5388
|
-
const path = common.joinPathSegments(directory, name,
|
|
5641
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5389
5642
|
return (done) => {
|
|
5390
|
-
fsStat.stat(path,
|
|
5643
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5391
5644
|
if (error2 !== null) {
|
|
5392
5645
|
done(error2);
|
|
5393
5646
|
return;
|
|
@@ -5397,7 +5650,7 @@ var require_async2 = __commonJS({
|
|
|
5397
5650
|
path,
|
|
5398
5651
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5399
5652
|
};
|
|
5400
|
-
if (
|
|
5653
|
+
if (settings2.stats) {
|
|
5401
5654
|
entry.stats = stats;
|
|
5402
5655
|
}
|
|
5403
5656
|
done(null, entry);
|
|
@@ -5434,27 +5687,27 @@ var require_sync2 = __commonJS({
|
|
|
5434
5687
|
var constants_1 = require_constants3();
|
|
5435
5688
|
var utils = require_utils4();
|
|
5436
5689
|
var common = require_common();
|
|
5437
|
-
function read(directory,
|
|
5438
|
-
if (!
|
|
5439
|
-
return readdirWithFileTypes(directory,
|
|
5690
|
+
function read(directory, settings2) {
|
|
5691
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5692
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5440
5693
|
}
|
|
5441
|
-
return readdir(directory,
|
|
5694
|
+
return readdir(directory, settings2);
|
|
5442
5695
|
}
|
|
5443
5696
|
exports.read = read;
|
|
5444
|
-
function readdirWithFileTypes(directory,
|
|
5445
|
-
const dirents =
|
|
5697
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5698
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5446
5699
|
return dirents.map((dirent) => {
|
|
5447
5700
|
const entry = {
|
|
5448
5701
|
dirent,
|
|
5449
5702
|
name: dirent.name,
|
|
5450
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5703
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5451
5704
|
};
|
|
5452
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5705
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5453
5706
|
try {
|
|
5454
|
-
const stats =
|
|
5707
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5455
5708
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5456
5709
|
} catch (error2) {
|
|
5457
|
-
if (
|
|
5710
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5458
5711
|
throw error2;
|
|
5459
5712
|
}
|
|
5460
5713
|
}
|
|
@@ -5463,17 +5716,17 @@ var require_sync2 = __commonJS({
|
|
|
5463
5716
|
});
|
|
5464
5717
|
}
|
|
5465
5718
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5466
|
-
function readdir(directory,
|
|
5467
|
-
const names =
|
|
5719
|
+
function readdir(directory, settings2) {
|
|
5720
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5468
5721
|
return names.map((name) => {
|
|
5469
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5470
|
-
const stats = fsStat.statSync(entryPath,
|
|
5722
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5723
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5471
5724
|
const entry = {
|
|
5472
5725
|
name,
|
|
5473
5726
|
path: entryPath,
|
|
5474
5727
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5475
5728
|
};
|
|
5476
|
-
if (
|
|
5729
|
+
if (settings2.stats) {
|
|
5477
5730
|
entry.stats = stats;
|
|
5478
5731
|
}
|
|
5479
5732
|
return entry;
|
|
@@ -5560,8 +5813,8 @@ var require_out2 = __commonJS({
|
|
|
5560
5813
|
}
|
|
5561
5814
|
exports.scandir = scandir;
|
|
5562
5815
|
function scandirSync(path, optionsOrSettings) {
|
|
5563
|
-
const
|
|
5564
|
-
return sync.read(path,
|
|
5816
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5817
|
+
return sync.read(path, settings2);
|
|
5565
5818
|
}
|
|
5566
5819
|
exports.scandirSync = scandirSync;
|
|
5567
5820
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5605,9 +5858,9 @@ var require_reusify = __commonJS({
|
|
|
5605
5858
|
}
|
|
5606
5859
|
});
|
|
5607
5860
|
|
|
5608
|
-
// node_modules/.bun/fastq@1.20.
|
|
5861
|
+
// node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
|
|
5609
5862
|
var require_queue = __commonJS({
|
|
5610
|
-
"node_modules/.bun/fastq@1.20.
|
|
5863
|
+
"node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
|
|
5611
5864
|
"use strict";
|
|
5612
5865
|
init_utils2();
|
|
5613
5866
|
var reusify = require_reusify();
|
|
@@ -5787,11 +6040,12 @@ var require_queue = __commonJS({
|
|
|
5787
6040
|
current.value = null;
|
|
5788
6041
|
current.callback = noop;
|
|
5789
6042
|
current.errorHandler = null;
|
|
6043
|
+
current.next = null;
|
|
5790
6044
|
if (errorHandler2) {
|
|
5791
6045
|
errorHandler2(new Error("abort"), val);
|
|
5792
6046
|
}
|
|
5793
6047
|
callback.call(context2, new Error("abort"));
|
|
5794
|
-
|
|
6048
|
+
cache.release(current);
|
|
5795
6049
|
current = next;
|
|
5796
6050
|
}
|
|
5797
6051
|
self.drain = noop;
|
|
@@ -5842,7 +6096,7 @@ var require_queue = __commonJS({
|
|
|
5842
6096
|
queue.drained = drained;
|
|
5843
6097
|
return queue;
|
|
5844
6098
|
function push(value) {
|
|
5845
|
-
var
|
|
6099
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5846
6100
|
pushCb(value, function(err, result) {
|
|
5847
6101
|
if (err) {
|
|
5848
6102
|
reject(err);
|
|
@@ -5851,11 +6105,11 @@ var require_queue = __commonJS({
|
|
|
5851
6105
|
resolve4(result);
|
|
5852
6106
|
});
|
|
5853
6107
|
});
|
|
5854
|
-
|
|
5855
|
-
return
|
|
6108
|
+
p.catch(noop);
|
|
6109
|
+
return p;
|
|
5856
6110
|
}
|
|
5857
6111
|
function unshift(value) {
|
|
5858
|
-
var
|
|
6112
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5859
6113
|
unshiftCb(value, function(err, result) {
|
|
5860
6114
|
if (err) {
|
|
5861
6115
|
reject(err);
|
|
@@ -5864,11 +6118,11 @@ var require_queue = __commonJS({
|
|
|
5864
6118
|
resolve4(result);
|
|
5865
6119
|
});
|
|
5866
6120
|
});
|
|
5867
|
-
|
|
5868
|
-
return
|
|
6121
|
+
p.catch(noop);
|
|
6122
|
+
return p;
|
|
5869
6123
|
}
|
|
5870
6124
|
function drained() {
|
|
5871
|
-
var
|
|
6125
|
+
var p = new Promise(function(resolve4) {
|
|
5872
6126
|
process.nextTick(function() {
|
|
5873
6127
|
if (queue.idle()) {
|
|
5874
6128
|
resolve4();
|
|
@@ -5882,7 +6136,7 @@ var require_queue = __commonJS({
|
|
|
5882
6136
|
}
|
|
5883
6137
|
});
|
|
5884
6138
|
});
|
|
5885
|
-
return
|
|
6139
|
+
return p;
|
|
5886
6140
|
}
|
|
5887
6141
|
}
|
|
5888
6142
|
module.exports = fastqueue;
|
|
@@ -5897,11 +6151,11 @@ var require_common2 = __commonJS({
|
|
|
5897
6151
|
init_utils2();
|
|
5898
6152
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5899
6153
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5900
|
-
function isFatalError(
|
|
5901
|
-
if (
|
|
6154
|
+
function isFatalError(settings2, error2) {
|
|
6155
|
+
if (settings2.errorFilter === null) {
|
|
5902
6156
|
return true;
|
|
5903
6157
|
}
|
|
5904
|
-
return !
|
|
6158
|
+
return !settings2.errorFilter(error2);
|
|
5905
6159
|
}
|
|
5906
6160
|
exports.isFatalError = isFatalError;
|
|
5907
6161
|
function isAppliedFilter(filter, value) {
|
|
@@ -5912,14 +6166,14 @@ var require_common2 = __commonJS({
|
|
|
5912
6166
|
return filepath.split(/[/\\]/).join(separator);
|
|
5913
6167
|
}
|
|
5914
6168
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5915
|
-
function joinPathSegments(
|
|
5916
|
-
if (
|
|
6169
|
+
function joinPathSegments(a2, b, separator) {
|
|
6170
|
+
if (a2 === "") {
|
|
5917
6171
|
return b;
|
|
5918
6172
|
}
|
|
5919
|
-
if (
|
|
5920
|
-
return
|
|
6173
|
+
if (a2.endsWith(separator)) {
|
|
6174
|
+
return a2 + b;
|
|
5921
6175
|
}
|
|
5922
|
-
return
|
|
6176
|
+
return a2 + separator + b;
|
|
5923
6177
|
}
|
|
5924
6178
|
exports.joinPathSegments = joinPathSegments;
|
|
5925
6179
|
}
|
|
@@ -6266,14 +6520,14 @@ var require_out3 = __commonJS({
|
|
|
6266
6520
|
}
|
|
6267
6521
|
exports.walk = walk;
|
|
6268
6522
|
function walkSync(directory, optionsOrSettings) {
|
|
6269
|
-
const
|
|
6270
|
-
const provider = new sync_1.default(directory,
|
|
6523
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6524
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6271
6525
|
return provider.read();
|
|
6272
6526
|
}
|
|
6273
6527
|
exports.walkSync = walkSync;
|
|
6274
6528
|
function walkStream(directory, optionsOrSettings) {
|
|
6275
|
-
const
|
|
6276
|
-
const provider = new stream_1.default(directory,
|
|
6529
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6530
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6277
6531
|
return provider.read();
|
|
6278
6532
|
}
|
|
6279
6533
|
exports.walkStream = walkStream;
|
|
@@ -6359,8 +6613,8 @@ var require_stream3 = __commonJS({
|
|
|
6359
6613
|
done();
|
|
6360
6614
|
}).catch(done);
|
|
6361
6615
|
};
|
|
6362
|
-
for (let
|
|
6363
|
-
stream.write(
|
|
6616
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6617
|
+
stream.write(i2);
|
|
6364
6618
|
}
|
|
6365
6619
|
return stream;
|
|
6366
6620
|
}
|
|
@@ -7021,14 +7275,14 @@ var require_out4 = __commonJS({
|
|
|
7021
7275
|
function generateTasks(source, options) {
|
|
7022
7276
|
assertPatternsInput(source);
|
|
7023
7277
|
const patterns = [].concat(source);
|
|
7024
|
-
const
|
|
7025
|
-
return taskManager.generate(patterns,
|
|
7278
|
+
const settings2 = new settings_1.default(options);
|
|
7279
|
+
return taskManager.generate(patterns, settings2);
|
|
7026
7280
|
}
|
|
7027
7281
|
FastGlob2.generateTasks = generateTasks;
|
|
7028
7282
|
function isDynamicPattern(source, options) {
|
|
7029
7283
|
assertPatternsInput(source);
|
|
7030
|
-
const
|
|
7031
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7284
|
+
const settings2 = new settings_1.default(options);
|
|
7285
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7032
7286
|
}
|
|
7033
7287
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7034
7288
|
function escapePath(source) {
|
|
@@ -7070,9 +7324,9 @@ var require_out4 = __commonJS({
|
|
|
7070
7324
|
})(FastGlob || (FastGlob = {}));
|
|
7071
7325
|
function getWorks(source, _Provider, options) {
|
|
7072
7326
|
const patterns = [].concat(source);
|
|
7073
|
-
const
|
|
7074
|
-
const tasks = taskManager.generate(patterns,
|
|
7075
|
-
const provider = new _Provider(
|
|
7327
|
+
const settings2 = new settings_1.default(options);
|
|
7328
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7329
|
+
const provider = new _Provider(settings2);
|
|
7076
7330
|
return tasks.map(provider.read, provider);
|
|
7077
7331
|
}
|
|
7078
7332
|
function assertPatternsInput(input) {
|
|
@@ -7250,14 +7504,14 @@ import "node:fs";
|
|
|
7250
7504
|
import { createRequire } from "node:module";
|
|
7251
7505
|
import {
|
|
7252
7506
|
resolve,
|
|
7253
|
-
join,
|
|
7254
|
-
dirname,
|
|
7507
|
+
join as join2,
|
|
7508
|
+
dirname as dirname2,
|
|
7255
7509
|
relative,
|
|
7256
7510
|
normalize,
|
|
7257
7511
|
sep,
|
|
7258
7512
|
extname
|
|
7259
7513
|
} from "node:path";
|
|
7260
|
-
import "node:url";
|
|
7514
|
+
import { fileURLToPath } from "node:url";
|
|
7261
7515
|
function safeExecuteAsync(fn, message) {
|
|
7262
7516
|
return fn().catch((error2) => {
|
|
7263
7517
|
throw new Error(
|
|
@@ -7265,7 +7519,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7265
7519
|
);
|
|
7266
7520
|
});
|
|
7267
7521
|
}
|
|
7268
|
-
var import_fast_glob, constants,
|
|
7522
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7269
7523
|
var init_PathResolver = __esm({
|
|
7270
7524
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7271
7525
|
"use strict";
|
|
@@ -7278,7 +7532,7 @@ var init_PathResolver = __esm({
|
|
|
7278
7532
|
getPatternsFor: getPatternsFor || void 0,
|
|
7279
7533
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7280
7534
|
};
|
|
7281
|
-
|
|
7535
|
+
log3 = {
|
|
7282
7536
|
error: (message, error2) => {
|
|
7283
7537
|
},
|
|
7284
7538
|
warn: (message, error2) => {
|
|
@@ -7314,6 +7568,7 @@ var init_PathResolver = __esm({
|
|
|
7314
7568
|
options;
|
|
7315
7569
|
_repoRoot;
|
|
7316
7570
|
_appRoot = null;
|
|
7571
|
+
_writtenPaths = null;
|
|
7317
7572
|
/**
|
|
7318
7573
|
* Get or create singleton instance
|
|
7319
7574
|
* @param options - Configuration options
|
|
@@ -7399,7 +7654,7 @@ var init_PathResolver = __esm({
|
|
|
7399
7654
|
*/
|
|
7400
7655
|
getDirname(path) {
|
|
7401
7656
|
if (!path) return "";
|
|
7402
|
-
return this.normalizePath(
|
|
7657
|
+
return this.normalizePath(dirname2(path));
|
|
7403
7658
|
}
|
|
7404
7659
|
/**
|
|
7405
7660
|
* Resolve package path using Node's module resolution
|
|
@@ -7411,7 +7666,7 @@ var init_PathResolver = __esm({
|
|
|
7411
7666
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7412
7667
|
try {
|
|
7413
7668
|
const basePath = fromPath || this.getAppRoot();
|
|
7414
|
-
const require3 = createRequire(
|
|
7669
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7415
7670
|
const resolved = require3.resolve(packageSpecifier);
|
|
7416
7671
|
return this.normalizePath(resolved);
|
|
7417
7672
|
} catch (error2) {
|
|
@@ -7563,7 +7818,7 @@ var init_PathResolver = __esm({
|
|
|
7563
7818
|
return cleanContent;
|
|
7564
7819
|
} catch (error2) {
|
|
7565
7820
|
if (this.options.debug) {
|
|
7566
|
-
|
|
7821
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7567
7822
|
}
|
|
7568
7823
|
return null;
|
|
7569
7824
|
}
|
|
@@ -7591,7 +7846,7 @@ var init_PathResolver = __esm({
|
|
|
7591
7846
|
return cleanContent;
|
|
7592
7847
|
} catch (error2) {
|
|
7593
7848
|
if (this.options.debug) {
|
|
7594
|
-
|
|
7849
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7595
7850
|
}
|
|
7596
7851
|
return null;
|
|
7597
7852
|
}
|
|
@@ -7613,16 +7868,16 @@ var init_PathResolver = __esm({
|
|
|
7613
7868
|
verbose = false
|
|
7614
7869
|
} = options;
|
|
7615
7870
|
const normalizedPath = this.normalizePath(filePath);
|
|
7616
|
-
const dir = this.normalizePath(
|
|
7871
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7617
7872
|
const fileExists = this.pathExists(normalizedPath);
|
|
7618
7873
|
if (fileExists && !overwrite) {
|
|
7619
7874
|
if (verbose) {
|
|
7620
|
-
|
|
7875
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7621
7876
|
}
|
|
7622
7877
|
return false;
|
|
7623
7878
|
}
|
|
7624
7879
|
if (dryRun) {
|
|
7625
|
-
|
|
7880
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7626
7881
|
return true;
|
|
7627
7882
|
}
|
|
7628
7883
|
try {
|
|
@@ -7632,22 +7887,23 @@ var init_PathResolver = __esm({
|
|
|
7632
7887
|
}
|
|
7633
7888
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7634
7889
|
let writeContent;
|
|
7635
|
-
if (
|
|
7890
|
+
if (Buffer2.isBuffer(content)) {
|
|
7636
7891
|
writeContent = content;
|
|
7637
7892
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7638
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
7893
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
7894
|
+
`;
|
|
7639
7895
|
} else {
|
|
7640
7896
|
writeContent = String(content);
|
|
7641
7897
|
}
|
|
7642
7898
|
try {
|
|
7643
7899
|
return await safeExecuteAsync(async () => {
|
|
7644
|
-
if (
|
|
7900
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7645
7901
|
await fs.promises.writeFile(normalizedPath, writeContent);
|
|
7646
7902
|
} else {
|
|
7647
7903
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7648
7904
|
}
|
|
7649
7905
|
if (verbose) {
|
|
7650
|
-
|
|
7906
|
+
log3.info(
|
|
7651
7907
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7652
7908
|
);
|
|
7653
7909
|
}
|
|
@@ -7674,16 +7930,16 @@ var init_PathResolver = __esm({
|
|
|
7674
7930
|
verbose = false
|
|
7675
7931
|
} = options;
|
|
7676
7932
|
const normalizedPath = this.normalizePath(filePath);
|
|
7677
|
-
const dir = this.normalizePath(
|
|
7933
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7678
7934
|
const fileExists = this.pathExists(normalizedPath);
|
|
7679
7935
|
if (fileExists && !overwrite) {
|
|
7680
7936
|
if (verbose) {
|
|
7681
|
-
|
|
7937
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7682
7938
|
}
|
|
7683
7939
|
return false;
|
|
7684
7940
|
}
|
|
7685
7941
|
if (dryRun) {
|
|
7686
|
-
|
|
7942
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7687
7943
|
return true;
|
|
7688
7944
|
}
|
|
7689
7945
|
try {
|
|
@@ -7693,21 +7949,23 @@ var init_PathResolver = __esm({
|
|
|
7693
7949
|
}
|
|
7694
7950
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7695
7951
|
let writeContent;
|
|
7696
|
-
if (
|
|
7952
|
+
if (Buffer2.isBuffer(content)) {
|
|
7697
7953
|
writeContent = content;
|
|
7698
7954
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7699
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
7955
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
7956
|
+
`;
|
|
7700
7957
|
} else {
|
|
7701
7958
|
writeContent = String(content);
|
|
7702
7959
|
}
|
|
7703
7960
|
try {
|
|
7704
|
-
if (
|
|
7961
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7705
7962
|
fs.writeFileSync(normalizedPath, writeContent);
|
|
7706
7963
|
} else {
|
|
7707
7964
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7708
7965
|
}
|
|
7966
|
+
this._writtenPaths?.add(normalizedPath);
|
|
7709
7967
|
if (verbose) {
|
|
7710
|
-
|
|
7968
|
+
log3.info(
|
|
7711
7969
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7712
7970
|
);
|
|
7713
7971
|
}
|
|
@@ -7732,15 +7990,15 @@ var init_PathResolver = __esm({
|
|
|
7732
7990
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7733
7991
|
if (fileExists && !overwrite) {
|
|
7734
7992
|
if (verbose) {
|
|
7735
|
-
|
|
7993
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7736
7994
|
}
|
|
7737
7995
|
return false;
|
|
7738
7996
|
}
|
|
7739
7997
|
if (dryRun) {
|
|
7740
|
-
|
|
7998
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7741
7999
|
return true;
|
|
7742
8000
|
}
|
|
7743
|
-
const dir = this.normalizePath(
|
|
8001
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7744
8002
|
try {
|
|
7745
8003
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7746
8004
|
} catch (error2) {
|
|
@@ -7750,7 +8008,7 @@ var init_PathResolver = __esm({
|
|
|
7750
8008
|
return await safeExecuteAsync(async () => {
|
|
7751
8009
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7752
8010
|
if (verbose) {
|
|
7753
|
-
|
|
8011
|
+
log3.info(
|
|
7754
8012
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7755
8013
|
);
|
|
7756
8014
|
}
|
|
@@ -7774,15 +8032,15 @@ var init_PathResolver = __esm({
|
|
|
7774
8032
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7775
8033
|
if (fileExists && !overwrite) {
|
|
7776
8034
|
if (verbose) {
|
|
7777
|
-
|
|
8035
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7778
8036
|
}
|
|
7779
8037
|
return false;
|
|
7780
8038
|
}
|
|
7781
8039
|
if (dryRun) {
|
|
7782
|
-
|
|
8040
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7783
8041
|
return true;
|
|
7784
8042
|
}
|
|
7785
|
-
const dir = this.normalizePath(
|
|
8043
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7786
8044
|
try {
|
|
7787
8045
|
fs.mkdirSync(dir, { recursive: true });
|
|
7788
8046
|
} catch (error2) {
|
|
@@ -7790,8 +8048,9 @@ var init_PathResolver = __esm({
|
|
|
7790
8048
|
}
|
|
7791
8049
|
try {
|
|
7792
8050
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
8051
|
+
this._writtenPaths?.add(normalizedDestPath);
|
|
7793
8052
|
if (verbose) {
|
|
7794
|
-
|
|
8053
|
+
log3.info(
|
|
7795
8054
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7796
8055
|
);
|
|
7797
8056
|
}
|
|
@@ -7808,7 +8067,7 @@ var init_PathResolver = __esm({
|
|
|
7808
8067
|
return fs.existsSync(filePath);
|
|
7809
8068
|
} catch (error2) {
|
|
7810
8069
|
if (!silent) {
|
|
7811
|
-
|
|
8070
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7812
8071
|
}
|
|
7813
8072
|
return false;
|
|
7814
8073
|
}
|
|
@@ -7834,7 +8093,7 @@ var init_PathResolver = __esm({
|
|
|
7834
8093
|
return fs.readdirSync(dirPath, options);
|
|
7835
8094
|
} catch (error2) {
|
|
7836
8095
|
if (this.options.debug) {
|
|
7837
|
-
|
|
8096
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7838
8097
|
}
|
|
7839
8098
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7840
8099
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7852,11 +8111,29 @@ var init_PathResolver = __esm({
|
|
|
7852
8111
|
return fs.statSync(filePath);
|
|
7853
8112
|
} catch (error2) {
|
|
7854
8113
|
if (this.options.debug) {
|
|
7855
|
-
|
|
8114
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7856
8115
|
}
|
|
7857
8116
|
return null;
|
|
7858
8117
|
}
|
|
7859
8118
|
}
|
|
8119
|
+
/**
|
|
8120
|
+
* Resolve the real path of a file, following symlinks
|
|
8121
|
+
* @param filePath - Path to resolve
|
|
8122
|
+
* @returns Resolved real path
|
|
8123
|
+
*/
|
|
8124
|
+
realpathSync(filePath) {
|
|
8125
|
+
return fs.realpathSync(filePath);
|
|
8126
|
+
}
|
|
8127
|
+
/**
|
|
8128
|
+
* Watch a directory for changes
|
|
8129
|
+
* @param dirPath - Directory to watch
|
|
8130
|
+
* @param options - fs.watch options
|
|
8131
|
+
* @param callback - Callback for change events
|
|
8132
|
+
* @returns FSWatcher instance
|
|
8133
|
+
*/
|
|
8134
|
+
watch(dirPath, options, callback) {
|
|
8135
|
+
return fs.watch(dirPath, options, callback);
|
|
8136
|
+
}
|
|
7860
8137
|
/**
|
|
7861
8138
|
* Get file stats synchronously (follows symlinks)
|
|
7862
8139
|
* Returns null if file doesn't exist (graceful degradation)
|
|
@@ -7869,7 +8146,7 @@ var init_PathResolver = __esm({
|
|
|
7869
8146
|
return fs.lstatSync(filePath);
|
|
7870
8147
|
} catch (error2) {
|
|
7871
8148
|
if (this.options.debug) {
|
|
7872
|
-
|
|
8149
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7873
8150
|
}
|
|
7874
8151
|
return null;
|
|
7875
8152
|
}
|
|
@@ -7936,6 +8213,28 @@ var init_PathResolver = __esm({
|
|
|
7936
8213
|
* Get app root (where vite.config.ts is, Vite's config.root)
|
|
7937
8214
|
* Falls back to repoRoot if not set
|
|
7938
8215
|
*/
|
|
8216
|
+
/**
|
|
8217
|
+
* Start recording every path written by writeSync/copySync.
|
|
8218
|
+
* Lets a generator know exactly which files the current run produced,
|
|
8219
|
+
* without comparing file timestamps to a clock.
|
|
8220
|
+
*/
|
|
8221
|
+
startWriteRecording() {
|
|
8222
|
+
this._writtenPaths = /* @__PURE__ */ new Set();
|
|
8223
|
+
}
|
|
8224
|
+
/**
|
|
8225
|
+
* Stop recording and return the normalized paths written since
|
|
8226
|
+
* startWriteRecording().
|
|
8227
|
+
*/
|
|
8228
|
+
stopWriteRecording() {
|
|
8229
|
+
if (!this._writtenPaths) {
|
|
8230
|
+
throw new Error(
|
|
8231
|
+
"stopWriteRecording() called without startWriteRecording()"
|
|
8232
|
+
);
|
|
8233
|
+
}
|
|
8234
|
+
const written = this._writtenPaths;
|
|
8235
|
+
this._writtenPaths = null;
|
|
8236
|
+
return written;
|
|
8237
|
+
}
|
|
7939
8238
|
getAppRoot() {
|
|
7940
8239
|
if (!this._appRoot) {
|
|
7941
8240
|
return this._repoRoot;
|
|
@@ -7958,7 +8257,7 @@ var init_PathResolver = __esm({
|
|
|
7958
8257
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
7959
8258
|
*/
|
|
7960
8259
|
isMonorepo() {
|
|
7961
|
-
const packagesDir =
|
|
8260
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
7962
8261
|
return this.pathExists(packagesDir);
|
|
7963
8262
|
}
|
|
7964
8263
|
/**
|
|
@@ -7975,7 +8274,7 @@ var init_PathResolver = __esm({
|
|
|
7975
8274
|
* Find files matching pattern within directory
|
|
7976
8275
|
*/
|
|
7977
8276
|
async findFiles(directory, pattern, options = {}) {
|
|
7978
|
-
const searchPattern = this.normalizePath(
|
|
8277
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
7979
8278
|
const appRoot = this.getAppRoot();
|
|
7980
8279
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
7981
8280
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8022,7 +8321,7 @@ var init_PathResolver = __esm({
|
|
|
8022
8321
|
return null;
|
|
8023
8322
|
}
|
|
8024
8323
|
const resolvedPath = this.normalizePath(
|
|
8025
|
-
|
|
8324
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8026
8325
|
);
|
|
8027
8326
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8028
8327
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8193,6 +8492,15 @@ var init_PathResolver = __esm({
|
|
|
8193
8492
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8194
8493
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8195
8494
|
}
|
|
8495
|
+
/**
|
|
8496
|
+
* Get absolute path to empty flag component module.
|
|
8497
|
+
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8498
|
+
* to replace unused flag files at build time.
|
|
8499
|
+
*/
|
|
8500
|
+
getEmptyFlagModulePath() {
|
|
8501
|
+
const __dirname2 = dirname2(fileURLToPath(import.meta.url));
|
|
8502
|
+
return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
|
|
8503
|
+
}
|
|
8196
8504
|
/**
|
|
8197
8505
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8198
8506
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8218,13 +8526,13 @@ var init_PathResolver = __esm({
|
|
|
8218
8526
|
const maxLevels = this.options.maxLevels;
|
|
8219
8527
|
while (levelsChecked < maxLevels) {
|
|
8220
8528
|
const toolingPath = this.normalizePath(
|
|
8221
|
-
|
|
8529
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8222
8530
|
);
|
|
8223
|
-
const corePath = this.normalizePath(
|
|
8531
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8224
8532
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8225
8533
|
return currentDir;
|
|
8226
8534
|
}
|
|
8227
|
-
const appsDir =
|
|
8535
|
+
const appsDir = join2(currentDir, "apps");
|
|
8228
8536
|
if (this.pathExists(appsDir)) {
|
|
8229
8537
|
const appsDirStat = this.statSync(appsDir);
|
|
8230
8538
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8232,15 +8540,15 @@ var init_PathResolver = __esm({
|
|
|
8232
8540
|
}
|
|
8233
8541
|
}
|
|
8234
8542
|
const packageJsonPath = this.normalizePath(
|
|
8235
|
-
|
|
8543
|
+
join2(currentDir, "package.json")
|
|
8236
8544
|
);
|
|
8237
8545
|
if (this.pathExists(packageJsonPath)) {
|
|
8238
|
-
const parentDir2 = this.normalizePath(
|
|
8546
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8239
8547
|
if (parentDir2 === currentDir) {
|
|
8240
8548
|
return currentDir;
|
|
8241
8549
|
}
|
|
8242
8550
|
}
|
|
8243
|
-
const parentDir = this.normalizePath(
|
|
8551
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8244
8552
|
if (parentDir === currentDir) {
|
|
8245
8553
|
break;
|
|
8246
8554
|
}
|
|
@@ -8256,8 +8564,8 @@ var init_PathResolver = __esm({
|
|
|
8256
8564
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8257
8565
|
import { createRequire as createRequire2 } from "node:module";
|
|
8258
8566
|
import {
|
|
8259
|
-
join as
|
|
8260
|
-
dirname as
|
|
8567
|
+
join as join3,
|
|
8568
|
+
dirname as dirname3,
|
|
8261
8569
|
basename as basename2,
|
|
8262
8570
|
extname as extname2,
|
|
8263
8571
|
relative as relative2,
|
|
@@ -8266,7 +8574,7 @@ import {
|
|
|
8266
8574
|
isAbsolute as pathIsAbsolute
|
|
8267
8575
|
} from "node:path";
|
|
8268
8576
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8269
|
-
function
|
|
8577
|
+
function readdirSync3(dirPath, options) {
|
|
8270
8578
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8271
8579
|
}
|
|
8272
8580
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, writeSync, statSync2, joinPath;
|
|
@@ -8278,7 +8586,7 @@ var init_pathResolver = __esm({
|
|
|
8278
8586
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8279
8587
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8280
8588
|
normalizePath = (...pathSegments) => {
|
|
8281
|
-
return pathResolverInstance.normalizePath(
|
|
8589
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8282
8590
|
};
|
|
8283
8591
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8284
8592
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
@@ -8337,10 +8645,10 @@ var init_typed_file_operations = __esm({
|
|
|
8337
8645
|
});
|
|
8338
8646
|
|
|
8339
8647
|
// packages/tooling/src/bundler/utils.ts
|
|
8340
|
-
import { Buffer } from "node:buffer";
|
|
8648
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8341
8649
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8342
8650
|
import { createRequire as createRequire3 } from "node:module";
|
|
8343
|
-
import { dirname as
|
|
8651
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8344
8652
|
import process from "node:process";
|
|
8345
8653
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8346
8654
|
var require2, __filename, __dirname;
|
|
@@ -8349,12 +8657,12 @@ var init_utils2 = __esm({
|
|
|
8349
8657
|
"use strict";
|
|
8350
8658
|
require2 = createRequire3(import.meta.url);
|
|
8351
8659
|
__filename = fileURLToPath3(import.meta.url);
|
|
8352
|
-
__dirname =
|
|
8660
|
+
__dirname = dirname4(__filename);
|
|
8353
8661
|
if (typeof globalThis !== "undefined") {
|
|
8354
8662
|
globalThis.require = require2;
|
|
8355
8663
|
globalThis.__filename = __filename;
|
|
8356
8664
|
globalThis.__dirname = __dirname;
|
|
8357
|
-
globalThis.Buffer =
|
|
8665
|
+
globalThis.Buffer = Buffer2;
|
|
8358
8666
|
globalThis.process = process;
|
|
8359
8667
|
if (typeof global === "undefined") {
|
|
8360
8668
|
globalThis.global = globalThis;
|
|
@@ -8381,7 +8689,7 @@ function detectApps(projectRoot) {
|
|
|
8381
8689
|
const appsDir = joinPath(projectRoot, "apps");
|
|
8382
8690
|
const appsDirStat = statSync2(appsDir);
|
|
8383
8691
|
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
8384
|
-
const appDirs =
|
|
8692
|
+
const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
8385
8693
|
for (const appDir of appDirs) {
|
|
8386
8694
|
const appPath = joinPath(appsDir, appDir);
|
|
8387
8695
|
const packageJsonPath = joinPath(appPath, "package.json");
|
|
@@ -8558,17 +8866,17 @@ var init_app_detection = __esm({
|
|
|
8558
8866
|
async function selectApp(projectRoot, appName) {
|
|
8559
8867
|
const apps = detectApps(projectRoot);
|
|
8560
8868
|
if (apps.length === 0) {
|
|
8561
|
-
|
|
8562
|
-
|
|
8869
|
+
log2.error("No apps found in this project.");
|
|
8870
|
+
log2.info('Run "dndev init" to create a new project.');
|
|
8563
8871
|
return null;
|
|
8564
8872
|
}
|
|
8565
8873
|
if (appName) {
|
|
8566
|
-
const app = apps.find((
|
|
8874
|
+
const app = apps.find((a2) => a2.name === appName);
|
|
8567
8875
|
if (!app) {
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
apps.forEach((
|
|
8571
|
-
|
|
8876
|
+
log2.warn(`App "${appName}" not found.`);
|
|
8877
|
+
log2.info("Available apps:");
|
|
8878
|
+
apps.forEach((a2) => log2.info(` - ${a2.name}`));
|
|
8879
|
+
log2.info("Please select from the list:");
|
|
8572
8880
|
} else {
|
|
8573
8881
|
return app;
|
|
8574
8882
|
}
|
|
@@ -8576,7 +8884,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8576
8884
|
if (apps.length === 1) {
|
|
8577
8885
|
return apps[0] || null;
|
|
8578
8886
|
}
|
|
8579
|
-
const selected = await
|
|
8887
|
+
const selected = await select({
|
|
8580
8888
|
message: "Select app:",
|
|
8581
8889
|
options: apps.map((app) => ({
|
|
8582
8890
|
value: app.name,
|
|
@@ -8586,7 +8894,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8586
8894
|
if (typeof selected !== "string") {
|
|
8587
8895
|
return null;
|
|
8588
8896
|
}
|
|
8589
|
-
return apps.find((
|
|
8897
|
+
return apps.find((a2) => a2.name === selected) || null;
|
|
8590
8898
|
}
|
|
8591
8899
|
var init_app_selector = __esm({
|
|
8592
8900
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
@@ -8605,14 +8913,14 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
|
8605
8913
|
label: choice.title,
|
|
8606
8914
|
hint: choice.hint
|
|
8607
8915
|
}));
|
|
8608
|
-
const initialValues = defaultIndices.map((
|
|
8609
|
-
const result = await
|
|
8916
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
|
|
8917
|
+
const result = await multiselect({
|
|
8610
8918
|
message,
|
|
8611
8919
|
options,
|
|
8612
8920
|
initialValues: initialValues.length > 0 ? initialValues : void 0
|
|
8613
8921
|
});
|
|
8614
|
-
if (
|
|
8615
|
-
|
|
8922
|
+
if (isCancel(result)) {
|
|
8923
|
+
cancel("Operation cancelled.");
|
|
8616
8924
|
process.exit(0);
|
|
8617
8925
|
}
|
|
8618
8926
|
return result;
|
|
@@ -8695,13 +9003,13 @@ init_utils2();
|
|
|
8695
9003
|
|
|
8696
9004
|
// packages/tooling/src/apps/emu-firebase.ts
|
|
8697
9005
|
init_utils2();
|
|
9006
|
+
init_app_detection();
|
|
8698
9007
|
init_cli_input();
|
|
8699
9008
|
init_cli_output();
|
|
8700
9009
|
init_pathResolver();
|
|
8701
9010
|
import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
|
|
8702
9011
|
import { platform as platform2 } from "node:os";
|
|
8703
9012
|
init_typed_file_operations();
|
|
8704
|
-
init_app_detection();
|
|
8705
9013
|
function discoverFirebaseProjectId(appPath) {
|
|
8706
9014
|
const firebasercPath = joinPath(appPath, ".firebaserc");
|
|
8707
9015
|
if (pathExists(firebasercPath)) {
|
|
@@ -8742,7 +9050,7 @@ function killPorts(ports) {
|
|
|
8742
9050
|
for (const pid of Array.from(pids)) {
|
|
8743
9051
|
try {
|
|
8744
9052
|
execFileSync("taskkill", ["/F", "/PID", pid], { stdio: "ignore" });
|
|
8745
|
-
|
|
9053
|
+
log2.debug(`Killed process ${pid} on port ${port}`);
|
|
8746
9054
|
} catch {
|
|
8747
9055
|
}
|
|
8748
9056
|
}
|
|
@@ -8756,7 +9064,7 @@ function killPorts(ports) {
|
|
|
8756
9064
|
for (const pid of pids) {
|
|
8757
9065
|
try {
|
|
8758
9066
|
process.kill(Number(pid), "SIGKILL");
|
|
8759
|
-
|
|
9067
|
+
log2.debug(`Killed process ${pid} on port ${port}`);
|
|
8760
9068
|
} catch {
|
|
8761
9069
|
}
|
|
8762
9070
|
}
|
|
@@ -8826,7 +9134,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8826
9134
|
hint: "Stripe webhook forwarding (for payment testing)"
|
|
8827
9135
|
}
|
|
8828
9136
|
];
|
|
8829
|
-
|
|
9137
|
+
log2.info(`Starting Firebase emulators + dev server for ${app.name}...
|
|
8830
9138
|
`);
|
|
8831
9139
|
if (selectedServices.length === 0) {
|
|
8832
9140
|
selectedServices = await askForMultiSelection(
|
|
@@ -8836,7 +9144,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8836
9144
|
// Default: Functions and Firestore
|
|
8837
9145
|
);
|
|
8838
9146
|
} else {
|
|
8839
|
-
|
|
9147
|
+
log2.info(`Selected services: ${selectedServices.join(", ")}
|
|
8840
9148
|
`);
|
|
8841
9149
|
}
|
|
8842
9150
|
const useAuth = selectedServices.includes("auth");
|
|
@@ -8844,16 +9152,16 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8844
9152
|
const useFirestore = selectedServices.includes("firestore");
|
|
8845
9153
|
const useStripe = selectedServices.includes("stripe");
|
|
8846
9154
|
if (!useFunctions) {
|
|
8847
|
-
|
|
9155
|
+
log2.error("Functions emulator is required for Firebase apps.");
|
|
8848
9156
|
return 1;
|
|
8849
9157
|
}
|
|
8850
9158
|
const functionsDir = getFunctionsPath(app);
|
|
8851
9159
|
const envLocalPath = joinPath(functionsDir, ".env.local");
|
|
8852
9160
|
if (pathExists(envLocalPath)) {
|
|
8853
9161
|
loadEnvFile(envLocalPath);
|
|
8854
|
-
|
|
9162
|
+
log2.debug("Loaded functions/.env.local for emulator context");
|
|
8855
9163
|
} else {
|
|
8856
|
-
|
|
9164
|
+
log2.warn(
|
|
8857
9165
|
"No .env.local found in functions directory. Emulator may lack required secrets."
|
|
8858
9166
|
);
|
|
8859
9167
|
}
|
|
@@ -8869,7 +9177,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8869
9177
|
` : `FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
8870
9178
|
`;
|
|
8871
9179
|
writeSync(envLocalPath, newContent);
|
|
8872
|
-
|
|
9180
|
+
log2.debug("Set FIREBASE_AUTH_EMULATOR_HOST in functions/.env.local");
|
|
8873
9181
|
} else if (!useAuth && hasAuthEmulatorHost) {
|
|
8874
9182
|
const lines = existingContent.split("\n");
|
|
8875
9183
|
const filteredLines = lines.filter(
|
|
@@ -8877,12 +9185,12 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8877
9185
|
);
|
|
8878
9186
|
const newContent = filteredLines.join("\n");
|
|
8879
9187
|
writeSync(envLocalPath, newContent);
|
|
8880
|
-
|
|
9188
|
+
log2.debug(
|
|
8881
9189
|
"Removed FIREBASE_AUTH_EMULATOR_HOST from functions/.env.local"
|
|
8882
9190
|
);
|
|
8883
9191
|
}
|
|
8884
9192
|
}
|
|
8885
|
-
|
|
9193
|
+
log2.info("Building functions...");
|
|
8886
9194
|
const buildResult = spawnSync2("bun", ["run", "build"], {
|
|
8887
9195
|
cwd: functionsDir,
|
|
8888
9196
|
stdio: "pipe",
|
|
@@ -8898,7 +9206,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8898
9206
|
if (buildResult.stderr) {
|
|
8899
9207
|
process.stderr.write(buildResult.stderr);
|
|
8900
9208
|
}
|
|
8901
|
-
|
|
9209
|
+
log2.error("Functions build failed. Fix errors and try again.");
|
|
8902
9210
|
return 1;
|
|
8903
9211
|
}
|
|
8904
9212
|
const appFirebaseJson = joinPath(app.path, "firebase.json");
|
|
@@ -8914,7 +9222,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8914
9222
|
}
|
|
8915
9223
|
const ports = getEmulatorPorts(emulatorConfig);
|
|
8916
9224
|
if (ports.length > 0) {
|
|
8917
|
-
|
|
9225
|
+
log2.info("Clearing ports...");
|
|
8918
9226
|
killPorts(ports);
|
|
8919
9227
|
}
|
|
8920
9228
|
const emulatorsToStart = [];
|
|
@@ -8956,12 +9264,12 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8956
9264
|
if (useStripe && projectId) {
|
|
8957
9265
|
const stripeWebhookUrl = `http://localhost:5001/${projectId}/${region}/stripeWebhook`;
|
|
8958
9266
|
concurrentlyArgs.push(`stripe listen --forward-to ${stripeWebhookUrl}`);
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
9267
|
+
log2.info("");
|
|
9268
|
+
log2.info("Stripe webhook forwarding will start automatically");
|
|
9269
|
+
log2.info(` Webhook URL: ${stripeWebhookUrl}`);
|
|
9270
|
+
log2.info(" To trigger test events, run in another terminal:");
|
|
9271
|
+
log2.info(" stripe trigger checkout.session.completed");
|
|
9272
|
+
log2.info("");
|
|
8965
9273
|
}
|
|
8966
9274
|
const isWindows = platform2() === "win32";
|
|
8967
9275
|
const childProcess = spawnCrossPlatform(
|
|
@@ -8982,7 +9290,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8982
9290
|
};
|
|
8983
9291
|
const cleanup = (signal) => {
|
|
8984
9292
|
if (!childProcess.pid) return;
|
|
8985
|
-
|
|
9293
|
+
log2.debug(`Received ${signal}, cleaning up processes...`);
|
|
8986
9294
|
if (isWindows) {
|
|
8987
9295
|
try {
|
|
8988
9296
|
execFileSync(
|
|
@@ -9014,7 +9322,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
9014
9322
|
for (const signal of signals) {
|
|
9015
9323
|
const handler = () => {
|
|
9016
9324
|
cleanup(signal);
|
|
9017
|
-
handlers.forEach((
|
|
9325
|
+
handlers.forEach((h2) => h2());
|
|
9018
9326
|
process.exit(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
9019
9327
|
};
|
|
9020
9328
|
process.on(signal, handler);
|
|
@@ -9022,17 +9330,17 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
9022
9330
|
}
|
|
9023
9331
|
return new Promise((resolve4) => {
|
|
9024
9332
|
childProcess.on("exit", (code, signal) => {
|
|
9025
|
-
handlers.forEach((
|
|
9333
|
+
handlers.forEach((h2) => h2());
|
|
9026
9334
|
if (signal) {
|
|
9027
|
-
|
|
9335
|
+
log2.debug(`Process killed by signal: ${signal}`);
|
|
9028
9336
|
resolve4(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
9029
9337
|
} else {
|
|
9030
9338
|
resolve4(code ?? 0);
|
|
9031
9339
|
}
|
|
9032
9340
|
});
|
|
9033
9341
|
childProcess.on("error", (error2) => {
|
|
9034
|
-
handlers.forEach((
|
|
9035
|
-
|
|
9342
|
+
handlers.forEach((h2) => h2());
|
|
9343
|
+
log2.error(`Failed to start Firebase emulators: ${error2.message}`);
|
|
9036
9344
|
resolve4(1);
|
|
9037
9345
|
});
|
|
9038
9346
|
});
|
|
@@ -9052,18 +9360,18 @@ function isDockerRunning() {
|
|
|
9052
9360
|
}
|
|
9053
9361
|
}
|
|
9054
9362
|
async function startSupabase(app, _projectRoot) {
|
|
9055
|
-
|
|
9363
|
+
log2.info(`Starting Supabase local stack + dev server for ${app.name}...
|
|
9056
9364
|
`);
|
|
9057
9365
|
if (!isDockerRunning()) {
|
|
9058
|
-
|
|
9059
|
-
|
|
9366
|
+
log2.error("Docker is not running. Supabase local dev requires Docker.");
|
|
9367
|
+
log2.error("Start Docker Desktop and try again.\n");
|
|
9060
9368
|
return 1;
|
|
9061
9369
|
}
|
|
9062
9370
|
try {
|
|
9063
9371
|
execSync2("supabase --version", { stdio: "pipe" });
|
|
9064
9372
|
} catch {
|
|
9065
|
-
|
|
9066
|
-
|
|
9373
|
+
log2.error("Supabase CLI not found. Install it:");
|
|
9374
|
+
log2.error(" bun install -g supabase\n");
|
|
9067
9375
|
return 1;
|
|
9068
9376
|
}
|
|
9069
9377
|
const isWindows = platform3() === "win32";
|
|
@@ -9118,7 +9426,7 @@ async function startSupabase(app, _projectRoot) {
|
|
|
9118
9426
|
return new Promise((resolve4) => {
|
|
9119
9427
|
childProcess.on("exit", (code) => resolve4(code ?? 0));
|
|
9120
9428
|
childProcess.on("error", (error2) => {
|
|
9121
|
-
|
|
9429
|
+
log2.error(`Failed to start Supabase local dev: ${error2.message}`);
|
|
9122
9430
|
resolve4(1);
|
|
9123
9431
|
});
|
|
9124
9432
|
});
|
|
@@ -9130,13 +9438,13 @@ init_cli_output();
|
|
|
9130
9438
|
import { execFileSync as execFileSync3, execSync as execSync3 } from "node:child_process";
|
|
9131
9439
|
import { platform as platform4 } from "node:os";
|
|
9132
9440
|
async function startVercel(app, _projectRoot) {
|
|
9133
|
-
|
|
9441
|
+
log2.info(`Starting Vercel dev server for ${app.name}...
|
|
9134
9442
|
`);
|
|
9135
9443
|
try {
|
|
9136
9444
|
execSync3("vercel --version", { stdio: "pipe" });
|
|
9137
9445
|
} catch {
|
|
9138
|
-
|
|
9139
|
-
|
|
9446
|
+
log2.error("Vercel CLI not found. Install it:");
|
|
9447
|
+
log2.error(" bun install -g vercel\n");
|
|
9140
9448
|
return 1;
|
|
9141
9449
|
}
|
|
9142
9450
|
const isWindows = platform4() === "win32";
|
|
@@ -9176,7 +9484,7 @@ async function startVercel(app, _projectRoot) {
|
|
|
9176
9484
|
return new Promise((resolve4) => {
|
|
9177
9485
|
childProcess.on("exit", (code) => resolve4(code ?? 0));
|
|
9178
9486
|
childProcess.on("error", (error2) => {
|
|
9179
|
-
|
|
9487
|
+
log2.error(`Failed to start Vercel dev: ${error2.message}`);
|
|
9180
9488
|
resolve4(1);
|
|
9181
9489
|
});
|
|
9182
9490
|
});
|
|
@@ -9207,10 +9515,10 @@ async function main(options) {
|
|
|
9207
9515
|
switch (emuTarget) {
|
|
9208
9516
|
case "firebase": {
|
|
9209
9517
|
if (!app.functions) {
|
|
9210
|
-
|
|
9518
|
+
log2.error(
|
|
9211
9519
|
`App "${app.name}" has Firebase config but no functions directory.`
|
|
9212
9520
|
);
|
|
9213
|
-
|
|
9521
|
+
log2.error('Use "dndev dev" for apps without backend functions.\n');
|
|
9214
9522
|
return 1;
|
|
9215
9523
|
}
|
|
9216
9524
|
const selectedServices = parseFirebaseServices(args, options);
|
|
@@ -9224,11 +9532,11 @@ async function main(options) {
|
|
|
9224
9532
|
case "vercel":
|
|
9225
9533
|
return startVercel(app, projectRoot);
|
|
9226
9534
|
default:
|
|
9227
|
-
|
|
9228
|
-
|
|
9535
|
+
log2.error(`App "${app.name}" does not have a detected backend.`);
|
|
9536
|
+
log2.error(
|
|
9229
9537
|
"Expected: firebase.json (Firebase), supabase/config.toml or @donotdev/supabase (Supabase), or vercel.json (Vercel)."
|
|
9230
9538
|
);
|
|
9231
|
-
|
|
9539
|
+
log2.error('Use "dndev dev" for apps without a backend.\n');
|
|
9232
9540
|
return 1;
|
|
9233
9541
|
}
|
|
9234
9542
|
}
|