@donotdev/cli 0.1.45 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dependencies-matrix.json +191 -150
- package/dist/bin/commands/agent-setup.js +632 -524
- package/dist/bin/commands/build.js +1239 -935
- package/dist/bin/commands/bump.js +1285 -946
- package/dist/bin/commands/cacheout.js +543 -405
- package/dist/bin/commands/coach.js +546 -408
- package/dist/bin/commands/create-app.js +1198 -862
- package/dist/bin/commands/create-project.js +1238 -902
- package/dist/bin/commands/db.js +139128 -93775
- package/dist/bin/commands/deploy.js +2308 -1936
- package/dist/bin/commands/dev.js +912 -662
- package/dist/bin/commands/doctor.js +634 -526
- package/dist/bin/commands/emu.js +1093 -785
- package/dist/bin/commands/format.js +588 -450
- package/dist/bin/commands/get-demo.js +1043 -756
- package/dist/bin/commands/make-admin.js +20974 -38424
- package/dist/bin/commands/preview.js +913 -663
- package/dist/bin/commands/seed.js +139129 -93776
- package/dist/bin/commands/setup-cicd.js +1130 -817
- package/dist/bin/commands/setup.js +1299 -960
- package/dist/bin/commands/staging.js +2308 -1936
- package/dist/bin/commands/sync-secrets.js +996 -733
- package/dist/bin/commands/type-check.js +733 -598
- package/dist/bin/commands/wai.js +533 -395
- package/dist/bin/dndev.js +9 -8
- package/dist/index.js +2720 -2290
- package/package.json +3 -3
- package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
- package/templates/app-next/src/app/layout.tsx.example +19 -1
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
- package/templates/functions-firebase/src/billing/index.ts.example +0 -1
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
- package/templates/functions-firebase/src/index.ts.example +0 -1
- package/templates/functions-supabase/supabase/config.toml.example +4 -0
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
- package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
- package/templates/functions-vercel/.env.example +9 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
- package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
- package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
- package/templates/root-consumer/.claude/settings.json.example +11 -1
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
- package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
|
@@ -5,16 +5,25 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (
|
|
8
|
+
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
18
27
|
};
|
|
19
28
|
var __copyProps = (to, from, except, desc) => {
|
|
20
29
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -33,31 +42,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
42
|
mod
|
|
34
43
|
));
|
|
35
44
|
|
|
36
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
37
|
-
var
|
|
45
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
46
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
38
47
|
var init_utils = __esm({
|
|
39
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
48
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
40
49
|
init_utils2();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
51
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
52
|
+
return (input) => {
|
|
53
|
+
let surrogatePairsNr = 0;
|
|
54
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
55
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
56
|
+
surrogatePairsNr += 1;
|
|
57
|
+
}
|
|
58
|
+
return input.length - surrogatePairsNr;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
44
61
|
isFullWidth = (x) => {
|
|
45
62
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
46
63
|
};
|
|
47
|
-
|
|
48
|
-
return x
|
|
64
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
65
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
49
66
|
};
|
|
50
67
|
}
|
|
51
68
|
});
|
|
52
69
|
|
|
53
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
54
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
70
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
71
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
55
72
|
var init_dist = __esm({
|
|
56
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
73
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
57
74
|
init_utils2();
|
|
58
75
|
init_utils();
|
|
59
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
76
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
60
77
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
78
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
61
79
|
TAB_RE = /\t{1,1000}/y;
|
|
62
80
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
63
81
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -67,14 +85,21 @@ var init_dist = __esm({
|
|
|
67
85
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
68
86
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
69
87
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
70
|
-
const ANSI_WIDTH =
|
|
88
|
+
const ANSI_WIDTH = 0;
|
|
71
89
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
72
90
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
73
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
74
91
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
75
|
-
const FULL_WIDTH_WIDTH =
|
|
92
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
76
93
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
77
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
94
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
95
|
+
const PARSE_BLOCKS = [
|
|
96
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
97
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
98
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
99
|
+
[TAB_RE, TAB_WIDTH],
|
|
100
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
101
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
102
|
+
];
|
|
78
103
|
let indexPrev = 0;
|
|
79
104
|
let index = 0;
|
|
80
105
|
let length = input.length;
|
|
@@ -94,10 +119,8 @@ var init_dist = __esm({
|
|
|
94
119
|
const codePoint = char.codePointAt(0) || 0;
|
|
95
120
|
if (isFullWidth(codePoint)) {
|
|
96
121
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
97
|
-
} else if (
|
|
122
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
98
123
|
widthExtra = WIDE_WIDTH;
|
|
99
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
100
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
101
124
|
} else {
|
|
102
125
|
widthExtra = REGULAR_WIDTH;
|
|
103
126
|
}
|
|
@@ -113,88 +136,28 @@ var init_dist = __esm({
|
|
|
113
136
|
}
|
|
114
137
|
unmatchedStart = unmatchedEnd = 0;
|
|
115
138
|
}
|
|
116
|
-
if (index >= length)
|
|
117
|
-
break;
|
|
118
|
-
LATIN_RE.lastIndex = index;
|
|
119
|
-
if (LATIN_RE.test(input)) {
|
|
120
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
121
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
122
|
-
if (width + widthExtra > truncationLimit) {
|
|
123
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
124
|
-
}
|
|
125
|
-
if (width + widthExtra > LIMIT) {
|
|
126
|
-
truncationEnabled = true;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
width += widthExtra;
|
|
130
|
-
unmatchedStart = indexPrev;
|
|
131
|
-
unmatchedEnd = index;
|
|
132
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
ANSI_RE.lastIndex = index;
|
|
136
|
-
if (ANSI_RE.test(input)) {
|
|
137
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
138
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
139
|
-
}
|
|
140
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
141
|
-
truncationEnabled = true;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
width += ANSI_WIDTH;
|
|
145
|
-
unmatchedStart = indexPrev;
|
|
146
|
-
unmatchedEnd = index;
|
|
147
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
CONTROL_RE.lastIndex = index;
|
|
151
|
-
if (CONTROL_RE.test(input)) {
|
|
152
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
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;
|
|
139
|
+
if (index >= length) {
|
|
140
|
+
break outer;
|
|
183
141
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
142
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
143
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
144
|
+
BLOCK_RE.lastIndex = index;
|
|
145
|
+
if (BLOCK_RE.test(input)) {
|
|
146
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
147
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
148
|
+
if (width + widthExtra > truncationLimit) {
|
|
149
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
150
|
+
}
|
|
151
|
+
if (width + widthExtra > LIMIT) {
|
|
152
|
+
truncationEnabled = true;
|
|
153
|
+
break outer;
|
|
154
|
+
}
|
|
155
|
+
width += widthExtra;
|
|
156
|
+
unmatchedStart = indexPrev;
|
|
157
|
+
unmatchedEnd = index;
|
|
158
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
159
|
+
continue outer;
|
|
192
160
|
}
|
|
193
|
-
width += EMOJI_WIDTH;
|
|
194
|
-
unmatchedStart = indexPrev;
|
|
195
|
-
unmatchedEnd = index;
|
|
196
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
197
|
-
continue;
|
|
198
161
|
}
|
|
199
162
|
index += 1;
|
|
200
163
|
}
|
|
@@ -209,10 +172,10 @@ var init_dist = __esm({
|
|
|
209
172
|
}
|
|
210
173
|
});
|
|
211
174
|
|
|
212
|
-
// node_modules/.bun/fast-string-width@
|
|
175
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
213
176
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
214
177
|
var init_dist2 = __esm({
|
|
215
|
-
"node_modules/.bun/fast-string-width@
|
|
178
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
216
179
|
init_utils2();
|
|
217
180
|
init_dist();
|
|
218
181
|
NO_TRUNCATION2 = {
|
|
@@ -227,13 +190,13 @@ var init_dist2 = __esm({
|
|
|
227
190
|
}
|
|
228
191
|
});
|
|
229
192
|
|
|
230
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
193
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
231
194
|
function wrapAnsi(string, columns, options) {
|
|
232
195
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
233
196
|
}
|
|
234
197
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
235
198
|
var init_main = __esm({
|
|
236
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
199
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
237
200
|
init_utils2();
|
|
238
201
|
init_dist2();
|
|
239
202
|
ESC = "\x1B";
|
|
@@ -397,16 +360,19 @@ var init_main = __esm({
|
|
|
397
360
|
}
|
|
398
361
|
const preString = rows.join("\n");
|
|
399
362
|
let inSurrogate = false;
|
|
400
|
-
for (let
|
|
401
|
-
const character = preString[
|
|
363
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
364
|
+
const character = preString[i2];
|
|
402
365
|
returnValue += character;
|
|
403
366
|
if (!inSurrogate) {
|
|
404
367
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
368
|
+
if (inSurrogate) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
405
371
|
} else {
|
|
406
|
-
|
|
372
|
+
inSurrogate = false;
|
|
407
373
|
}
|
|
408
374
|
if (character === ESC || character === CSI) {
|
|
409
|
-
GROUP_REGEX.lastIndex =
|
|
375
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
410
376
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
411
377
|
const groups = groupsResult?.groups;
|
|
412
378
|
if (groups?.code !== void 0) {
|
|
@@ -416,7 +382,7 @@ var init_main = __esm({
|
|
|
416
382
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
417
383
|
}
|
|
418
384
|
}
|
|
419
|
-
if (preString[
|
|
385
|
+
if (preString[i2 + 1] === "\n") {
|
|
420
386
|
if (escapeUrl) {
|
|
421
387
|
returnValue += wrapAnsiHyperlink("");
|
|
422
388
|
}
|
|
@@ -447,7 +413,7 @@ var require_src = __commonJS({
|
|
|
447
413
|
var ESC2 = "\x1B";
|
|
448
414
|
var CSI2 = `${ESC2}[`;
|
|
449
415
|
var beep = "\x07";
|
|
450
|
-
var
|
|
416
|
+
var cursor3 = {
|
|
451
417
|
to(x, y2) {
|
|
452
418
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
453
419
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -476,7 +442,7 @@ var require_src = __commonJS({
|
|
|
476
442
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
477
443
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
478
444
|
};
|
|
479
|
-
var
|
|
445
|
+
var erase3 = {
|
|
480
446
|
screen: `${CSI2}2J`,
|
|
481
447
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
482
448
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -485,89 +451,169 @@ var require_src = __commonJS({
|
|
|
485
451
|
lineStart: `${CSI2}1K`,
|
|
486
452
|
lines(count) {
|
|
487
453
|
let clear = "";
|
|
488
|
-
for (let
|
|
489
|
-
clear += this.line + (
|
|
454
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
455
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
490
456
|
if (count)
|
|
491
|
-
clear +=
|
|
457
|
+
clear += cursor3.left;
|
|
492
458
|
return clear;
|
|
493
459
|
}
|
|
494
460
|
};
|
|
495
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
461
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
496
462
|
}
|
|
497
463
|
});
|
|
498
464
|
|
|
499
|
-
// node_modules/.bun/@clack+core@1.
|
|
500
|
-
import { styleText
|
|
501
|
-
import { stdout
|
|
502
|
-
import * as
|
|
503
|
-
import
|
|
504
|
-
import { ReadStream
|
|
505
|
-
function
|
|
506
|
-
if (!
|
|
507
|
-
|
|
508
|
-
|
|
465
|
+
// node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
|
|
466
|
+
import { styleText } from "node:util";
|
|
467
|
+
import { stdout, stdin } from "node:process";
|
|
468
|
+
import * as l from "node:readline";
|
|
469
|
+
import l__default from "node:readline";
|
|
470
|
+
import { ReadStream } from "node:tty";
|
|
471
|
+
function findCursor(s, o, l2) {
|
|
472
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
473
|
+
return s;
|
|
474
|
+
const t2 = s + o, n2 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n2 : t2 > n2 ? 0 : t2;
|
|
475
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
476
|
+
}
|
|
477
|
+
function isAccessible(n2) {
|
|
478
|
+
if (n2 !== void 0) return n2;
|
|
479
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
480
|
+
const e = process.env.ACCESSIBLE;
|
|
481
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
509
482
|
}
|
|
510
|
-
function
|
|
511
|
-
if (typeof
|
|
512
|
-
|
|
483
|
+
function isActionKey(n2, e) {
|
|
484
|
+
if (typeof n2 == "string")
|
|
485
|
+
return settings.aliases.get(n2) === e;
|
|
486
|
+
for (const s of n2)
|
|
487
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
488
|
+
return true;
|
|
513
489
|
return false;
|
|
514
490
|
}
|
|
515
|
-
function
|
|
516
|
-
if (
|
|
517
|
-
const e =
|
|
518
|
-
`),
|
|
519
|
-
`),
|
|
520
|
-
for (let
|
|
521
|
-
|
|
491
|
+
function diffLines(i2, s) {
|
|
492
|
+
if (i2 === s) return;
|
|
493
|
+
const e = i2.split(`
|
|
494
|
+
`), t2 = s.split(`
|
|
495
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
496
|
+
for (let n2 = 0; n2 < r2; n2++)
|
|
497
|
+
e[n2] !== t2[n2] && f.push(n2);
|
|
498
|
+
return {
|
|
499
|
+
lines: f,
|
|
500
|
+
numLinesBefore: e.length,
|
|
501
|
+
numLinesAfter: t2.length,
|
|
502
|
+
numLines: r2
|
|
503
|
+
};
|
|
522
504
|
}
|
|
523
|
-
function
|
|
524
|
-
return
|
|
505
|
+
function isCancel(e) {
|
|
506
|
+
return e === CANCEL_SYMBOL;
|
|
525
507
|
}
|
|
526
|
-
function
|
|
527
|
-
const
|
|
528
|
-
|
|
508
|
+
function setRawMode(e, r2) {
|
|
509
|
+
const o = e;
|
|
510
|
+
o.isTTY && o.setRawMode(r2);
|
|
529
511
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
512
|
+
function block({
|
|
513
|
+
input: e = stdin,
|
|
514
|
+
output: r2 = stdout,
|
|
515
|
+
overwrite: o = true,
|
|
516
|
+
hideCursor: n2 = true
|
|
517
|
+
} = {}) {
|
|
518
|
+
const s = l.createInterface({
|
|
519
|
+
input: e,
|
|
520
|
+
output: r2,
|
|
521
|
+
prompt: "",
|
|
522
|
+
tabSize: 1
|
|
523
|
+
});
|
|
524
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
525
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
526
|
+
const c = String(f);
|
|
527
|
+
if (isActionKey([c, a2, w], "cancel")) {
|
|
528
|
+
n2 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
537
529
|
return;
|
|
538
530
|
}
|
|
539
|
-
if (!
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
531
|
+
if (!o) return;
|
|
532
|
+
const i2 = a2 === "return" ? 0 : -1, m2 = a2 === "return" ? -1 : 0;
|
|
533
|
+
l.moveCursor(r2, i2, m2, () => {
|
|
534
|
+
l.clearLine(r2, 1, () => {
|
|
535
|
+
e.once("keypress", t2);
|
|
544
536
|
});
|
|
545
537
|
});
|
|
546
538
|
};
|
|
547
|
-
return
|
|
548
|
-
|
|
539
|
+
return n2 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
540
|
+
e.off("keypress", t2), n2 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
549
541
|
};
|
|
550
542
|
}
|
|
551
|
-
function
|
|
552
|
-
const
|
|
553
|
-
return wrapAnsi(
|
|
554
|
-
|
|
543
|
+
function wrapTextWithPrefix(e, r2, o, n2 = o, s = o, t2) {
|
|
544
|
+
const f = getColumns(e ?? stdout);
|
|
545
|
+
return wrapAnsi(r2, f - o.length, {
|
|
546
|
+
hard: true,
|
|
547
|
+
trim: false
|
|
548
|
+
}).split(`
|
|
549
|
+
`).map((c, i2, m2) => {
|
|
550
|
+
const d = t2 ? t2(c, i2) : c;
|
|
551
|
+
return i2 === 0 ? `${n2}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
552
|
+
}).join(`
|
|
555
553
|
`);
|
|
556
554
|
}
|
|
557
|
-
|
|
555
|
+
function runValidation(e, a2) {
|
|
556
|
+
if ("~standard" in e) {
|
|
557
|
+
const n2 = e["~standard"].validate(a2);
|
|
558
|
+
return n2 instanceof Promise ? n2.then((r2) => r2.issues?.at(0)?.message) : n2.issues?.at(0)?.message;
|
|
559
|
+
}
|
|
560
|
+
return e(a2);
|
|
561
|
+
}
|
|
562
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, a;
|
|
558
563
|
var init_dist3 = __esm({
|
|
559
|
-
"node_modules/.bun/@clack+core@1.
|
|
564
|
+
"node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
|
|
560
565
|
init_utils2();
|
|
561
566
|
init_main();
|
|
562
567
|
import_sisteransi = __toESM(require_src(), 1);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
568
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
569
|
+
t = [
|
|
570
|
+
"January",
|
|
571
|
+
"February",
|
|
572
|
+
"March",
|
|
573
|
+
"April",
|
|
574
|
+
"May",
|
|
575
|
+
"June",
|
|
576
|
+
"July",
|
|
577
|
+
"August",
|
|
578
|
+
"September",
|
|
579
|
+
"October",
|
|
580
|
+
"November",
|
|
581
|
+
"December"
|
|
582
|
+
];
|
|
583
|
+
settings = {
|
|
584
|
+
actions: new Set(a$1),
|
|
585
|
+
aliases: /* @__PURE__ */ new Map([
|
|
586
|
+
// vim support
|
|
587
|
+
["k", "up"],
|
|
588
|
+
["j", "down"],
|
|
589
|
+
["h", "left"],
|
|
590
|
+
["l", "right"],
|
|
591
|
+
["", "cancel"],
|
|
592
|
+
// opinionated defaults!
|
|
593
|
+
["escape", "cancel"]
|
|
594
|
+
]),
|
|
595
|
+
messages: {
|
|
596
|
+
cancel: "Canceled",
|
|
597
|
+
error: "Something went wrong"
|
|
598
|
+
},
|
|
599
|
+
withGuide: true,
|
|
600
|
+
accessible: void 0,
|
|
601
|
+
date: {
|
|
602
|
+
monthNames: [...t],
|
|
603
|
+
messages: {
|
|
604
|
+
required: "Please enter a valid date",
|
|
605
|
+
invalidMonth: "There are only 12 months in a year",
|
|
606
|
+
invalidDay: (n2, e) => `There are only ${n2} days in ${e}`,
|
|
607
|
+
afterMin: (n2) => `Date must be on or after ${n2.toISOString().slice(0, 10)}`,
|
|
608
|
+
beforeMax: (n2) => `Date must be on or before ${n2.toISOString().slice(0, 10)}`
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
R = globalThis.process.platform.startsWith("win");
|
|
613
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
614
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
615
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
616
|
+
y = class {
|
|
571
617
|
input;
|
|
572
618
|
output;
|
|
573
619
|
_abortSignal;
|
|
@@ -582,46 +628,92 @@ var init_dist3 = __esm({
|
|
|
582
628
|
error = "";
|
|
583
629
|
value;
|
|
584
630
|
userInput = "";
|
|
631
|
+
/**
|
|
632
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
633
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
634
|
+
* and the `ACCESSIBLE` env var.
|
|
635
|
+
*/
|
|
636
|
+
get accessible() {
|
|
637
|
+
return isAccessible(this.opts.accessible);
|
|
638
|
+
}
|
|
585
639
|
constructor(t2, e = true) {
|
|
586
|
-
const { input:
|
|
587
|
-
this.opts =
|
|
640
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n2, ...o } = t2;
|
|
641
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n2, this.input = i2, this.output = s;
|
|
588
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Unsubscribe all listeners
|
|
645
|
+
*/
|
|
589
646
|
unsubscribe() {
|
|
590
647
|
this._subscribers.clear();
|
|
591
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Set a subscriber with opts
|
|
651
|
+
* @param event - The event name
|
|
652
|
+
*/
|
|
592
653
|
setSubscriber(t2, e) {
|
|
593
|
-
const
|
|
594
|
-
|
|
654
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
655
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
595
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Subscribe to an event
|
|
659
|
+
* @param event - The event name
|
|
660
|
+
* @param cb - The callback
|
|
661
|
+
*/
|
|
596
662
|
on(t2, e) {
|
|
597
663
|
this.setSubscriber(t2, { cb: e });
|
|
598
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* Subscribe to an event once
|
|
667
|
+
* @param event - The event name
|
|
668
|
+
* @param cb - The callback
|
|
669
|
+
*/
|
|
599
670
|
once(t2, e) {
|
|
600
671
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
601
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Emit an event with data
|
|
675
|
+
* @param event - The event name
|
|
676
|
+
* @param data - The data to pass to the callback
|
|
677
|
+
*/
|
|
602
678
|
emit(t2, ...e) {
|
|
603
|
-
const
|
|
604
|
-
for (const
|
|
605
|
-
|
|
679
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
680
|
+
for (const r2 of i2)
|
|
681
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
682
|
+
for (const r2 of s)
|
|
683
|
+
r2();
|
|
606
684
|
}
|
|
607
685
|
prompt() {
|
|
608
686
|
return new Promise((t2) => {
|
|
609
687
|
if (this._abortSignal) {
|
|
610
|
-
if (this._abortSignal.aborted)
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
688
|
+
if (this._abortSignal.aborted)
|
|
689
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
690
|
+
this._abortSignal.addEventListener(
|
|
691
|
+
"abort",
|
|
692
|
+
() => {
|
|
693
|
+
this.state = "cancel", this.close();
|
|
694
|
+
},
|
|
695
|
+
{ once: true }
|
|
696
|
+
);
|
|
614
697
|
}
|
|
615
|
-
this.rl =
|
|
616
|
-
|
|
698
|
+
this.rl = l__default.createInterface({
|
|
699
|
+
input: this.input,
|
|
700
|
+
tabSize: 2,
|
|
701
|
+
prompt: "",
|
|
702
|
+
escapeCodeTimeout: 50,
|
|
703
|
+
terminal: true
|
|
704
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
705
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
617
706
|
}), this.once("cancel", () => {
|
|
618
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
707
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
619
708
|
});
|
|
620
709
|
});
|
|
621
710
|
}
|
|
622
711
|
_isActionKey(t2, e) {
|
|
623
712
|
return t2 === " ";
|
|
624
713
|
}
|
|
714
|
+
_shouldSubmit(t2, e) {
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
625
717
|
_setValue(t2) {
|
|
626
718
|
this.value = t2, this.emit("value", this.value);
|
|
627
719
|
}
|
|
@@ -631,19 +723,22 @@ var init_dist3 = __esm({
|
|
|
631
723
|
_clearUserInput() {
|
|
632
724
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
633
725
|
}
|
|
634
|
-
onKeypress(t2, e) {
|
|
635
|
-
if (this.
|
|
636
|
-
if (this.
|
|
637
|
-
|
|
638
|
-
|
|
726
|
+
async onKeypress(t2, e) {
|
|
727
|
+
if (this.state !== "validating") {
|
|
728
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
729
|
+
if (this.opts.validate) {
|
|
730
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
731
|
+
let s;
|
|
732
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
733
|
+
}
|
|
734
|
+
this.state !== "error" && (this.state = "submit");
|
|
639
735
|
}
|
|
640
|
-
this.state
|
|
736
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
641
737
|
}
|
|
642
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
643
738
|
}
|
|
644
739
|
close() {
|
|
645
740
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
646
|
-
`),
|
|
741
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
647
742
|
}
|
|
648
743
|
restoreCursor() {
|
|
649
744
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -651,34 +746,39 @@ var init_dist3 = __esm({
|
|
|
651
746
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
652
747
|
}
|
|
653
748
|
render() {
|
|
654
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
749
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
750
|
+
hard: true,
|
|
751
|
+
trim: false
|
|
752
|
+
});
|
|
655
753
|
if (t2 !== this._prevFrame) {
|
|
656
|
-
if (this.state === "initial")
|
|
754
|
+
if (this.state === "initial")
|
|
755
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
657
756
|
else {
|
|
658
|
-
const e =
|
|
757
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
659
758
|
if (this.restoreCursor(), e) {
|
|
660
|
-
const
|
|
661
|
-
let
|
|
662
|
-
if (
|
|
759
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
760
|
+
let n2 = e.lines.find((o) => o >= s);
|
|
761
|
+
if (n2 === void 0) {
|
|
663
762
|
this._prevFrame = t2;
|
|
664
763
|
return;
|
|
665
764
|
}
|
|
666
765
|
if (e.lines.length === 1) {
|
|
667
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
668
|
-
const
|
|
766
|
+
this.output.write(import_sisteransi.cursor.move(0, n2 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
767
|
+
const o = t2.split(`
|
|
669
768
|
`);
|
|
670
|
-
this.output.write(
|
|
769
|
+
this.output.write(o[n2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n2 - 1));
|
|
671
770
|
return;
|
|
672
771
|
} else if (e.lines.length > 1) {
|
|
673
|
-
if (
|
|
772
|
+
if (s < r2)
|
|
773
|
+
n2 = s;
|
|
674
774
|
else {
|
|
675
|
-
const
|
|
676
|
-
|
|
775
|
+
const h2 = n2 - r2;
|
|
776
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
677
777
|
}
|
|
678
778
|
this.output.write(import_sisteransi.erase.down());
|
|
679
|
-
const
|
|
680
|
-
`).slice(
|
|
681
|
-
this.output.write(
|
|
779
|
+
const f = t2.split(`
|
|
780
|
+
`).slice(n2);
|
|
781
|
+
this.output.write(f.join(`
|
|
682
782
|
`)), this._prevFrame = t2;
|
|
683
783
|
return;
|
|
684
784
|
}
|
|
@@ -689,7 +789,7 @@ var init_dist3 = __esm({
|
|
|
689
789
|
}
|
|
690
790
|
}
|
|
691
791
|
};
|
|
692
|
-
|
|
792
|
+
r = class extends y {
|
|
693
793
|
get cursor() {
|
|
694
794
|
return this.value ? 0 : 1;
|
|
695
795
|
}
|
|
@@ -699,51 +799,55 @@ var init_dist3 = __esm({
|
|
|
699
799
|
constructor(t2) {
|
|
700
800
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
701
801
|
this.value = this._value;
|
|
702
|
-
}), this.on("confirm", (
|
|
703
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
802
|
+
}), this.on("confirm", (i2) => {
|
|
803
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
704
804
|
}), this.on("cursor", () => {
|
|
705
805
|
this.value = !this.value;
|
|
706
806
|
});
|
|
707
807
|
}
|
|
708
808
|
};
|
|
709
|
-
|
|
809
|
+
a = class extends y {
|
|
710
810
|
options;
|
|
711
811
|
cursor = 0;
|
|
712
812
|
get _value() {
|
|
713
|
-
return this.options[this.cursor]
|
|
813
|
+
return this.options[this.cursor]?.value;
|
|
714
814
|
}
|
|
715
815
|
get _enabledOptions() {
|
|
716
|
-
return this.options.filter((
|
|
816
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
717
817
|
}
|
|
718
818
|
toggleAll() {
|
|
719
|
-
const
|
|
720
|
-
this.value =
|
|
819
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
820
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
721
821
|
}
|
|
722
822
|
toggleInvert() {
|
|
723
|
-
const
|
|
724
|
-
if (!
|
|
725
|
-
|
|
726
|
-
|
|
823
|
+
const e = this.value;
|
|
824
|
+
if (!e)
|
|
825
|
+
return;
|
|
826
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
827
|
+
this.value = i2.map((t2) => t2.value);
|
|
727
828
|
}
|
|
728
829
|
toggleValue() {
|
|
729
830
|
this.value === void 0 && (this.value = []);
|
|
730
|
-
const
|
|
731
|
-
this.value =
|
|
732
|
-
}
|
|
733
|
-
constructor(
|
|
734
|
-
super(
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
831
|
+
const e = this.value.includes(this._value);
|
|
832
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
833
|
+
}
|
|
834
|
+
constructor(e) {
|
|
835
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
836
|
+
const i2 = Math.max(
|
|
837
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
838
|
+
0
|
|
839
|
+
);
|
|
840
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l2) => {
|
|
841
|
+
l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
|
|
842
|
+
}), this.on("cursor", (t2) => {
|
|
843
|
+
switch (t2) {
|
|
740
844
|
case "left":
|
|
741
845
|
case "up":
|
|
742
|
-
this.cursor =
|
|
846
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
743
847
|
break;
|
|
744
848
|
case "down":
|
|
745
849
|
case "right":
|
|
746
|
-
this.cursor =
|
|
850
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
747
851
|
break;
|
|
748
852
|
case "space":
|
|
749
853
|
this.toggleValue();
|
|
@@ -755,307 +859,487 @@ var init_dist3 = __esm({
|
|
|
755
859
|
}
|
|
756
860
|
});
|
|
757
861
|
|
|
758
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
759
|
-
import { styleText as
|
|
760
|
-
import
|
|
761
|
-
import { existsSync
|
|
762
|
-
import { dirname
|
|
763
|
-
function
|
|
764
|
-
|
|
862
|
+
// node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
|
|
863
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
864
|
+
import process$1 from "node:process";
|
|
865
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
866
|
+
import { dirname, join } from "node:path";
|
|
867
|
+
function isUnicodeSupported() {
|
|
868
|
+
if (process$1.platform !== "win32") {
|
|
869
|
+
return process$1.env.TERM !== "linux";
|
|
870
|
+
}
|
|
871
|
+
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";
|
|
872
|
+
}
|
|
873
|
+
function formatInstructionFooter(o, e) {
|
|
874
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
875
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
765
876
|
}
|
|
766
|
-
var import_sisteransi2,
|
|
877
|
+
var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, i;
|
|
767
878
|
var init_dist4 = __esm({
|
|
768
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
879
|
+
"node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
769
880
|
init_utils2();
|
|
770
881
|
init_dist3();
|
|
771
882
|
init_dist3();
|
|
772
883
|
init_main();
|
|
773
884
|
init_dist2();
|
|
774
885
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
switch (
|
|
886
|
+
unicode = isUnicodeSupported();
|
|
887
|
+
isCI = () => process.env.CI === "true";
|
|
888
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
889
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
890
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
891
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
892
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
893
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
894
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
895
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
896
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
897
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
898
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
899
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
900
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
901
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
902
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
903
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
904
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
905
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
906
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
907
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
908
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
909
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
910
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
911
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
912
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
913
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
914
|
+
symbol = (o) => {
|
|
915
|
+
switch (o) {
|
|
805
916
|
case "initial":
|
|
806
917
|
case "active":
|
|
807
|
-
return
|
|
918
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
808
919
|
case "cancel":
|
|
809
|
-
return
|
|
920
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
810
921
|
case "error":
|
|
811
|
-
return
|
|
922
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
812
923
|
case "submit":
|
|
813
|
-
return
|
|
924
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
925
|
+
case "validating":
|
|
926
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
814
927
|
}
|
|
815
928
|
};
|
|
816
|
-
|
|
817
|
-
switch (
|
|
929
|
+
symbolBar = (o) => {
|
|
930
|
+
switch (o) {
|
|
818
931
|
case "initial":
|
|
819
932
|
case "active":
|
|
820
|
-
return
|
|
933
|
+
return styleText2("cyan", S_BAR);
|
|
821
934
|
case "cancel":
|
|
822
|
-
return
|
|
935
|
+
return styleText2("red", S_BAR);
|
|
823
936
|
case "error":
|
|
824
|
-
return
|
|
937
|
+
return styleText2("yellow", S_BAR);
|
|
825
938
|
case "submit":
|
|
826
|
-
return
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
let
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
939
|
+
return styleText2("green", S_BAR);
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
I = (l2, e, w, p, b, C2 = false) => {
|
|
943
|
+
let r2 = e, O = 0;
|
|
944
|
+
if (C2)
|
|
945
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
946
|
+
const m2 = l2[i2];
|
|
947
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
948
|
+
}
|
|
949
|
+
else
|
|
950
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
951
|
+
const m2 = l2[i2];
|
|
952
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
953
|
+
}
|
|
954
|
+
return { lineCount: r2, removals: O };
|
|
955
|
+
};
|
|
956
|
+
limitOptions = ({
|
|
957
|
+
cursor: l2,
|
|
958
|
+
options: e,
|
|
959
|
+
style: w,
|
|
960
|
+
output: p = process.stdout,
|
|
961
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
962
|
+
columnPadding: C2 = 0,
|
|
963
|
+
rowPadding: r2 = 4
|
|
964
|
+
}) => {
|
|
965
|
+
const i2 = getColumns(p) - C2, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
843
966
|
let f = 0;
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
967
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
968
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
969
|
+
0
|
|
970
|
+
));
|
|
971
|
+
let d = a2 < e.length && f > 0, c = a2 < e.length && f + a2 < e.length;
|
|
972
|
+
const W2 = Math.min(
|
|
973
|
+
f + a2,
|
|
974
|
+
e.length
|
|
975
|
+
), s = [];
|
|
976
|
+
let g = 0;
|
|
977
|
+
d && g++, c && g++;
|
|
978
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c ? 1 : 0);
|
|
979
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
980
|
+
const n2 = e[t2], o = n2 ? w(n2, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
981
|
+
hard: true,
|
|
982
|
+
trim: false
|
|
983
|
+
}).split(`
|
|
848
984
|
`);
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
if (
|
|
852
|
-
let
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
985
|
+
s.push(h2), g += h2.length;
|
|
986
|
+
}
|
|
987
|
+
if (g > v) {
|
|
988
|
+
let t2 = 0, n2 = 0, o = g;
|
|
989
|
+
const h2 = l2 - T;
|
|
990
|
+
let u3 = v;
|
|
991
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
992
|
+
s,
|
|
993
|
+
o,
|
|
994
|
+
h2 + 1,
|
|
995
|
+
s.length,
|
|
996
|
+
u3,
|
|
997
|
+
true
|
|
998
|
+
);
|
|
999
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c || (u3 -= 1), { lineCount: o, removals: n2 } = E())) : (c || (u3 -= 1), { lineCount: o, removals: n2 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n2 > 0 && (c = true, s.splice(s.length - n2, n2));
|
|
1000
|
+
}
|
|
1001
|
+
const x = [];
|
|
1002
|
+
d && x.push(M);
|
|
1003
|
+
for (const t2 of s)
|
|
1004
|
+
for (const n2 of t2)
|
|
1005
|
+
x.push(n2);
|
|
1006
|
+
return c && x.push(M), x;
|
|
1007
|
+
};
|
|
1008
|
+
confirm = (e) => {
|
|
1009
|
+
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
1010
|
+
return new r({
|
|
1011
|
+
active: a2,
|
|
1012
|
+
inactive: o,
|
|
1013
|
+
signal: e.signal,
|
|
1014
|
+
input: e.input,
|
|
1015
|
+
output: e.output,
|
|
1016
|
+
initialValue: e.initialValue ?? true,
|
|
1017
|
+
render() {
|
|
1018
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1019
|
+
e.output,
|
|
1020
|
+
e.message,
|
|
1021
|
+
l2,
|
|
1022
|
+
u3
|
|
1023
|
+
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1024
|
+
` : ""}${f}
|
|
1025
|
+
`, c = this.value ? a2 : o;
|
|
1026
|
+
switch (this.state) {
|
|
1027
|
+
case "submit": {
|
|
1028
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1029
|
+
return `${s}${r2}${styleText2("dim", c)}`;
|
|
1030
|
+
}
|
|
1031
|
+
case "cancel": {
|
|
1032
|
+
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1033
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c)}${i2 ? `
|
|
1034
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1035
|
+
}
|
|
1036
|
+
default: {
|
|
1037
|
+
const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1038
|
+
return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
|
|
1039
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1040
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
|
|
1041
|
+
${g}
|
|
1042
|
+
`;
|
|
1043
|
+
}
|
|
876
1044
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1045
|
+
}
|
|
1046
|
+
}).prompt();
|
|
1047
|
+
};
|
|
1048
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
1049
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1050
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1051
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1052
|
+
];
|
|
1053
|
+
m = (i2, u3) => i2.split(`
|
|
1054
|
+
`).map((d) => u3(d)).join(`
|
|
1055
|
+
`);
|
|
1056
|
+
multiselect = (i2) => {
|
|
1057
|
+
const u3 = (t2, a2) => {
|
|
1058
|
+
const r2 = t2.label ?? String(t2.value);
|
|
1059
|
+
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))}`;
|
|
1060
|
+
}, d = i2.required ?? true, x = i2.showInstructions ?? true;
|
|
1061
|
+
return new a({
|
|
1062
|
+
options: i2.options,
|
|
1063
|
+
signal: i2.signal,
|
|
1064
|
+
input: i2.input,
|
|
1065
|
+
output: i2.output,
|
|
1066
|
+
initialValues: i2.initialValues,
|
|
1067
|
+
required: d,
|
|
1068
|
+
cursorAt: i2.cursorAt,
|
|
1069
|
+
validate(t2) {
|
|
1070
|
+
if (d && (t2 === void 0 || t2.length === 0))
|
|
1071
|
+
return `Please select at least one option.
|
|
1072
|
+
${styleText2(
|
|
1073
|
+
"reset",
|
|
1074
|
+
styleText2(
|
|
1075
|
+
"dim",
|
|
1076
|
+
`Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
|
|
1077
|
+
"gray",
|
|
1078
|
+
styleText2("bgWhite", styleText2("inverse", " enter "))
|
|
1079
|
+
)} to submit`
|
|
1080
|
+
)
|
|
1081
|
+
)}`;
|
|
1082
|
+
},
|
|
1083
|
+
render() {
|
|
1084
|
+
const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1085
|
+
i2.output,
|
|
1086
|
+
i2.message,
|
|
1087
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1088
|
+
`${symbol(this.state)} `
|
|
1089
|
+
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1090
|
+
` : ""}${a2}
|
|
1091
|
+
`, o = this.value ?? [], g = (n2, l2) => {
|
|
1092
|
+
if (n2.disabled)
|
|
1093
|
+
return u3(n2, "disabled");
|
|
1094
|
+
const s = o.includes(n2.value);
|
|
1095
|
+
return l2 && s ? u3(n2, "active-selected") : s ? u3(n2, "selected") : u3(n2, l2 ? "active" : "inactive");
|
|
1096
|
+
};
|
|
1097
|
+
switch (this.state) {
|
|
1098
|
+
case "submit": {
|
|
1099
|
+
const n2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l2 = wrapTextWithPrefix(
|
|
1100
|
+
i2.output,
|
|
1101
|
+
n2,
|
|
1102
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1103
|
+
);
|
|
1104
|
+
return `${r2}${l2}`;
|
|
1105
|
+
}
|
|
1106
|
+
case "cancel": {
|
|
1107
|
+
const n2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1108
|
+
if (n2.trim() === "")
|
|
1109
|
+
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1110
|
+
const l2 = wrapTextWithPrefix(
|
|
1111
|
+
i2.output,
|
|
1112
|
+
n2,
|
|
1113
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1114
|
+
);
|
|
1115
|
+
return `${r2}${l2}${t2 ? `
|
|
1116
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1117
|
+
}
|
|
1118
|
+
case "error": {
|
|
1119
|
+
const n2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
|
|
1120
|
+
`).map(
|
|
1121
|
+
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1122
|
+
).join(`
|
|
1123
|
+
`), s = r2.split(`
|
|
1124
|
+
`).length, h2 = l2.split(`
|
|
1125
|
+
`).length + 1;
|
|
1126
|
+
return `${r2}${n2}${limitOptions({
|
|
1127
|
+
output: i2.output,
|
|
1128
|
+
options: this.options,
|
|
1129
|
+
cursor: this.cursor,
|
|
1130
|
+
maxItems: i2.maxItems,
|
|
1131
|
+
columnPadding: n2.length,
|
|
1132
|
+
rowPadding: s + h2,
|
|
1133
|
+
style: g
|
|
1134
|
+
}).join(`
|
|
1135
|
+
${n2}`)}
|
|
1136
|
+
${l2}
|
|
883
1137
|
`;
|
|
1138
|
+
}
|
|
1139
|
+
default: {
|
|
1140
|
+
const n2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
|
|
1141
|
+
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1142
|
+
`), $ = s.length + 1;
|
|
1143
|
+
return `${r2}${n2}${limitOptions({
|
|
1144
|
+
output: i2.output,
|
|
1145
|
+
options: this.options,
|
|
1146
|
+
cursor: this.cursor,
|
|
1147
|
+
maxItems: i2.maxItems,
|
|
1148
|
+
columnPadding: n2.length,
|
|
1149
|
+
rowPadding: l2 + $,
|
|
1150
|
+
style: g
|
|
1151
|
+
}).join(`
|
|
1152
|
+
${n2}`)}
|
|
1153
|
+
${h2}
|
|
1154
|
+
`;
|
|
1155
|
+
}
|
|
884
1156
|
}
|
|
885
1157
|
}
|
|
886
|
-
}
|
|
1158
|
+
}).prompt();
|
|
887
1159
|
};
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1160
|
+
log = {
|
|
1161
|
+
message: (s = [], {
|
|
1162
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1163
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1164
|
+
output: m2 = process.stdout,
|
|
1165
|
+
spacing: l2 = 1,
|
|
1166
|
+
withGuide: c
|
|
1167
|
+
} = {}) => {
|
|
1168
|
+
const t2 = [], o = c ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1169
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1170
|
+
t2.push(f);
|
|
1171
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
892
1172
|
`);
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1173
|
+
if (g.length > 0) {
|
|
1174
|
+
const [i2, ...y2] = g;
|
|
1175
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1176
|
+
for (const p of y2)
|
|
1177
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1178
|
+
}
|
|
1179
|
+
m2.write(`${t2.join(`
|
|
899
1180
|
`)}
|
|
900
1181
|
`);
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1182
|
+
},
|
|
1183
|
+
info: (s, e) => {
|
|
1184
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1185
|
+
},
|
|
1186
|
+
success: (s, e) => {
|
|
1187
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1188
|
+
},
|
|
1189
|
+
step: (s, e) => {
|
|
1190
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1191
|
+
},
|
|
1192
|
+
warn: (s, e) => {
|
|
1193
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1194
|
+
},
|
|
1195
|
+
/** alias for `log.warn()`. */
|
|
1196
|
+
warning: (s, e) => {
|
|
1197
|
+
log.warn(s, e);
|
|
1198
|
+
},
|
|
1199
|
+
error: (s, e) => {
|
|
1200
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
cancel = (o = "", t2) => {
|
|
1204
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1205
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
917
1206
|
|
|
918
1207
|
`);
|
|
919
1208
|
};
|
|
920
|
-
|
|
921
|
-
const
|
|
922
|
-
|
|
1209
|
+
intro = (o = "", t2) => {
|
|
1210
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1211
|
+
i2.write(`${e}${o}
|
|
923
1212
|
`);
|
|
924
1213
|
};
|
|
925
|
-
|
|
926
|
-
const
|
|
927
|
-
${
|
|
928
|
-
|
|
1214
|
+
outro = (o = "", t2) => {
|
|
1215
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1216
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1217
|
+
i2.write(`${e}${o}
|
|
929
1218
|
|
|
930
1219
|
`);
|
|
931
1220
|
};
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
case "error": {
|
|
964
|
-
const a = r ? `${t("yellow", d2)} ` : "", l = this.error.split(`
|
|
965
|
-
`).map((p2, m) => m === 0 ? `${r ? `${t("yellow", E2)} ` : ""}${t("yellow", p2)}` : ` ${p2}`).join(`
|
|
966
|
-
`), $2 = n.split(`
|
|
967
|
-
`).length, y2 = l.split(`
|
|
968
|
-
`).length + 1;
|
|
969
|
-
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: $2 + y2, style: c2 }).join(`
|
|
970
|
-
${a}`)}
|
|
971
|
-
${l}
|
|
972
|
-
`;
|
|
973
|
-
}
|
|
974
|
-
default: {
|
|
975
|
-
const a = r ? `${t("cyan", d2)} ` : "", l = n.split(`
|
|
976
|
-
`).length, $2 = r ? 2 : 1;
|
|
977
|
-
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: l + $2, style: c2 }).join(`
|
|
978
|
-
${a}`)}
|
|
979
|
-
${r ? t("cyan", E2) : ""}
|
|
980
|
-
`;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
} }).prompt();
|
|
984
|
-
};
|
|
985
|
-
ft = (e) => t("dim", e);
|
|
986
|
-
vt = (e, i, s) => {
|
|
987
|
-
const r = { hard: true, trim: false }, u2 = wrapAnsi(e, i, r).split(`
|
|
988
|
-
`), n = u2.reduce((a, l) => Math.max(dist_default2(l), a), 0), o = u2.map(s).reduce((a, l) => Math.max(dist_default2(l), a), 0), c2 = i - (o - n);
|
|
989
|
-
return wrapAnsi(e, c2, r);
|
|
990
|
-
};
|
|
991
|
-
wt = (e = "", i = "", s) => {
|
|
992
|
-
const r = s?.output ?? P2.stdout, u2 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = ["", ...vt(e, O(r) - 6, n).split(`
|
|
993
|
-
`).map(n), ""], c2 = dist_default2(i), a = Math.max(o.reduce((p2, m) => {
|
|
994
|
-
const g = dist_default2(m);
|
|
995
|
-
return g > p2 ? g : p2;
|
|
996
|
-
}, 0), c2) + 2, l = o.map((p2) => `${t("gray", d2)} ${p2}${" ".repeat(a - dist_default2(p2))}${t("gray", d2)}`).join(`
|
|
997
|
-
`), $2 = u2 ? `${t("gray", d2)}
|
|
998
|
-
` : "", y2 = u2 ? Ge : de;
|
|
999
|
-
r.write(`${$2}${t("green", F)} ${t("reset", i)} ${t("gray", se.repeat(Math.max(a - c2 - 1, 1)) + ce)}
|
|
1000
|
-
${l}
|
|
1001
|
-
${t("gray", y2 + se.repeat(a + 2) + $e)}
|
|
1002
|
-
`);
|
|
1221
|
+
W$1 = (o) => o;
|
|
1222
|
+
C = (o, e, s) => {
|
|
1223
|
+
const a2 = {
|
|
1224
|
+
hard: true,
|
|
1225
|
+
trim: false
|
|
1226
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1227
|
+
`), c = i2.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i2.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g = e - (u3 - c);
|
|
1228
|
+
return wrapAnsi(o, g, a2);
|
|
1229
|
+
};
|
|
1230
|
+
note = (o = "", e = "", s) => {
|
|
1231
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c).split(`
|
|
1232
|
+
`).map(c), ""], n2 = dist_default2(e), t2 = Math.max(
|
|
1233
|
+
g.reduce((m2, F) => {
|
|
1234
|
+
const O = dist_default2(F);
|
|
1235
|
+
return O > m2 ? O : m2;
|
|
1236
|
+
}, 0),
|
|
1237
|
+
n2
|
|
1238
|
+
) + 2, h2 = g.map(
|
|
1239
|
+
(m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
|
|
1240
|
+
).join(`
|
|
1241
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1242
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1243
|
+
a2.write(
|
|
1244
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1245
|
+
"gray",
|
|
1246
|
+
S_BAR_H.repeat(Math.max(t2 - n2 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1247
|
+
)}
|
|
1248
|
+
${h2}
|
|
1249
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1250
|
+
`
|
|
1251
|
+
);
|
|
1003
1252
|
};
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1253
|
+
W = (l2) => styleText2("magenta", l2);
|
|
1254
|
+
spinner = ({
|
|
1255
|
+
indicator: l2 = "dots",
|
|
1256
|
+
onCancel: h2,
|
|
1257
|
+
output: n2 = process.stdout,
|
|
1258
|
+
cancelMessage: G,
|
|
1259
|
+
errorMessage: O,
|
|
1260
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1261
|
+
delay: F = unicode ? 80 : 120,
|
|
1262
|
+
signal: m2,
|
|
1263
|
+
...I2
|
|
1264
|
+
} = {}) => {
|
|
1265
|
+
const u3 = isCI();
|
|
1266
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1267
|
+
const x = getColumns(n2), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1268
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1269
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1270
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1271
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m2 && m2.addEventListener("abort", i2);
|
|
1272
|
+
}, H = () => {
|
|
1273
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m2 && m2.removeEventListener("abort", i2);
|
|
1274
|
+
}, y2 = () => {
|
|
1275
|
+
if (p === void 0) return;
|
|
1276
|
+
u3 && n2.write(`
|
|
1018
1277
|
`);
|
|
1019
|
-
const
|
|
1278
|
+
const r2 = wrapAnsi(p, x, {
|
|
1279
|
+
hard: true,
|
|
1280
|
+
trim: false
|
|
1281
|
+
}).split(`
|
|
1020
1282
|
`);
|
|
1021
|
-
|
|
1022
|
-
},
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1025
|
-
},
|
|
1026
|
-
|
|
1283
|
+
r2.length > 1 && n2.write(import_sisteransi2.cursor.up(r2.length - 1)), n2.write(import_sisteransi2.cursor.to(0)), n2.write(import_sisteransi2.erase.down());
|
|
1284
|
+
}, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1285
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1286
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1287
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1288
|
+
d = true, M = block({ output: n2 }), s = C2(e), w = performance.now(), N && n2.write(`${styleText2("gray", S_BAR)}
|
|
1027
1289
|
`);
|
|
1028
|
-
let
|
|
1029
|
-
|
|
1030
|
-
if (
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1290
|
+
let r2 = 0, t2 = 0;
|
|
1291
|
+
A(), T = setInterval(() => {
|
|
1292
|
+
if (u3 && s === p)
|
|
1293
|
+
return;
|
|
1294
|
+
y2(), p = s;
|
|
1295
|
+
const o = k(E[r2]);
|
|
1296
|
+
let v;
|
|
1297
|
+
if (u3)
|
|
1298
|
+
v = `${o} ${s}...`;
|
|
1299
|
+
else if (l2 === "timer")
|
|
1300
|
+
v = `${o} ${s} ${_(w)}`;
|
|
1036
1301
|
else {
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
}
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1302
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1303
|
+
v = `${o} ${s}${B}`;
|
|
1304
|
+
}
|
|
1305
|
+
const j = wrapAnsi(v, x, {
|
|
1306
|
+
hard: true,
|
|
1307
|
+
trim: false
|
|
1308
|
+
});
|
|
1309
|
+
n2.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1310
|
+
}, F);
|
|
1311
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1312
|
+
if (!d) return;
|
|
1313
|
+
d = false, clearInterval(T), y2();
|
|
1314
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1315
|
+
s = e ?? s, t2 || (l2 === "timer" ? n2.write(`${o} ${s} ${_(w)}
|
|
1316
|
+
`) : n2.write(`${o} ${s}
|
|
1317
|
+
`)), H(), M();
|
|
1050
1318
|
};
|
|
1051
|
-
return {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1319
|
+
return {
|
|
1320
|
+
start: P,
|
|
1321
|
+
stop: (e = "") => a2(e, 0),
|
|
1322
|
+
message: (e = "") => {
|
|
1323
|
+
s = C2(e ?? s);
|
|
1324
|
+
},
|
|
1325
|
+
cancel: (e = "") => a2(e, 1),
|
|
1326
|
+
error: (e = "") => a2(e, 2),
|
|
1327
|
+
clear: () => a2("", 0, true),
|
|
1328
|
+
get isCancelled() {
|
|
1329
|
+
return S;
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1333
|
+
u2 = {
|
|
1334
|
+
light: unicodeOr("\u2500", "-"),
|
|
1335
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1336
|
+
block: unicodeOr("\u2588", "#")
|
|
1056
1337
|
};
|
|
1057
|
-
|
|
1058
|
-
|
|
1338
|
+
SELECT_INSTRUCTIONS = [
|
|
1339
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1340
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1341
|
+
];
|
|
1342
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
1059
1343
|
}
|
|
1060
1344
|
});
|
|
1061
1345
|
|
|
@@ -1068,9 +1352,9 @@ function supportsColor() {
|
|
|
1068
1352
|
}
|
|
1069
1353
|
return process.stdout.isTTY === true;
|
|
1070
1354
|
}
|
|
1071
|
-
function colorize(
|
|
1072
|
-
if (!supportsColor()) return
|
|
1073
|
-
return `${color}${
|
|
1355
|
+
function colorize(text2, color) {
|
|
1356
|
+
if (!supportsColor()) return text2;
|
|
1357
|
+
return `${color}${text2}${colors.reset}`;
|
|
1074
1358
|
}
|
|
1075
1359
|
function stringify(value) {
|
|
1076
1360
|
if (typeof value === "string") return value;
|
|
@@ -1100,7 +1384,7 @@ function stringify(value) {
|
|
|
1100
1384
|
function formatMessage(...args) {
|
|
1101
1385
|
return args.map(stringify).join(" ");
|
|
1102
1386
|
}
|
|
1103
|
-
var colors, currentLogLevel,
|
|
1387
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
1104
1388
|
var init_cli_output = __esm({
|
|
1105
1389
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1106
1390
|
"use strict";
|
|
@@ -1133,7 +1417,7 @@ var init_cli_output = __esm({
|
|
|
1133
1417
|
currentLogLevel = envLevel;
|
|
1134
1418
|
}
|
|
1135
1419
|
}
|
|
1136
|
-
|
|
1420
|
+
log2 = {
|
|
1137
1421
|
/**
|
|
1138
1422
|
* Logs an error message (always shows unless Quiet level)
|
|
1139
1423
|
* Uses clack's log.error + explicit red color
|
|
@@ -1141,7 +1425,7 @@ var init_cli_output = __esm({
|
|
|
1141
1425
|
error(...args) {
|
|
1142
1426
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1143
1427
|
const message = formatMessage(...args);
|
|
1144
|
-
|
|
1428
|
+
log.error(colorize(message, colors.brightRed));
|
|
1145
1429
|
},
|
|
1146
1430
|
/**
|
|
1147
1431
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1150,7 +1434,7 @@ var init_cli_output = __esm({
|
|
|
1150
1434
|
warn(...args) {
|
|
1151
1435
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1152
1436
|
const message = formatMessage(...args);
|
|
1153
|
-
|
|
1437
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1154
1438
|
},
|
|
1155
1439
|
/**
|
|
1156
1440
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1159,7 +1443,7 @@ var init_cli_output = __esm({
|
|
|
1159
1443
|
info(...args) {
|
|
1160
1444
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1161
1445
|
const message = formatMessage(...args);
|
|
1162
|
-
|
|
1446
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1163
1447
|
},
|
|
1164
1448
|
/**
|
|
1165
1449
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1168,7 +1452,7 @@ var init_cli_output = __esm({
|
|
|
1168
1452
|
success(...args) {
|
|
1169
1453
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1170
1454
|
const message = formatMessage(...args);
|
|
1171
|
-
|
|
1455
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1172
1456
|
},
|
|
1173
1457
|
/**
|
|
1174
1458
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1177,7 +1461,7 @@ var init_cli_output = __esm({
|
|
|
1177
1461
|
debug(...args) {
|
|
1178
1462
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1179
1463
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1180
|
-
|
|
1464
|
+
log.message(
|
|
1181
1465
|
colorize(
|
|
1182
1466
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1183
1467
|
colors.gray
|
|
@@ -1191,7 +1475,7 @@ var init_cli_output = __esm({
|
|
|
1191
1475
|
trace(...args) {
|
|
1192
1476
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1193
1477
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1194
|
-
|
|
1478
|
+
log.message(
|
|
1195
1479
|
colorize(
|
|
1196
1480
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1197
1481
|
colors.gray
|
|
@@ -1199,10 +1483,10 @@ var init_cli_output = __esm({
|
|
|
1199
1483
|
);
|
|
1200
1484
|
}
|
|
1201
1485
|
};
|
|
1202
|
-
error =
|
|
1203
|
-
warn =
|
|
1204
|
-
info =
|
|
1205
|
-
success =
|
|
1486
|
+
error = log2.error.bind(log2);
|
|
1487
|
+
warn = log2.warn.bind(log2);
|
|
1488
|
+
info = log2.info.bind(log2);
|
|
1489
|
+
success = log2.success.bind(log2);
|
|
1206
1490
|
}
|
|
1207
1491
|
});
|
|
1208
1492
|
|
|
@@ -1562,9 +1846,9 @@ var require_is_glob = __commonJS({
|
|
|
1562
1846
|
index += 2;
|
|
1563
1847
|
var close = chars[open];
|
|
1564
1848
|
if (close) {
|
|
1565
|
-
var
|
|
1566
|
-
if (
|
|
1567
|
-
index =
|
|
1849
|
+
var n2 = str.indexOf(close, index);
|
|
1850
|
+
if (n2 !== -1) {
|
|
1851
|
+
index = n2 + 1;
|
|
1568
1852
|
}
|
|
1569
1853
|
}
|
|
1570
1854
|
if (str[index] === "!") {
|
|
@@ -1590,9 +1874,9 @@ var require_is_glob = __commonJS({
|
|
|
1590
1874
|
index += 2;
|
|
1591
1875
|
var close = chars[open];
|
|
1592
1876
|
if (close) {
|
|
1593
|
-
var
|
|
1594
|
-
if (
|
|
1595
|
-
index =
|
|
1877
|
+
var n2 = str.indexOf(close, index);
|
|
1878
|
+
if (n2 !== -1) {
|
|
1879
|
+
index = n2 + 1;
|
|
1596
1880
|
}
|
|
1597
1881
|
}
|
|
1598
1882
|
if (str[index] === "!") {
|
|
@@ -1670,8 +1954,8 @@ var require_utils = __commonJS({
|
|
|
1670
1954
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1671
1955
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1672
1956
|
};
|
|
1673
|
-
exports.escapeNode = (
|
|
1674
|
-
const node =
|
|
1957
|
+
exports.escapeNode = (block2, n2 = 0, type) => {
|
|
1958
|
+
const node = block2.nodes[n2];
|
|
1675
1959
|
if (!node) return;
|
|
1676
1960
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1677
1961
|
if (node.escaped !== true) {
|
|
@@ -1688,15 +1972,15 @@ var require_utils = __commonJS({
|
|
|
1688
1972
|
}
|
|
1689
1973
|
return false;
|
|
1690
1974
|
};
|
|
1691
|
-
exports.isInvalidBrace = (
|
|
1692
|
-
if (
|
|
1693
|
-
if (
|
|
1694
|
-
if (
|
|
1695
|
-
|
|
1975
|
+
exports.isInvalidBrace = (block2) => {
|
|
1976
|
+
if (block2.type !== "brace") return false;
|
|
1977
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1978
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1979
|
+
block2.invalid = true;
|
|
1696
1980
|
return true;
|
|
1697
1981
|
}
|
|
1698
|
-
if (
|
|
1699
|
-
|
|
1982
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1983
|
+
block2.invalid = true;
|
|
1700
1984
|
return true;
|
|
1701
1985
|
}
|
|
1702
1986
|
return false;
|
|
@@ -1715,8 +1999,8 @@ var require_utils = __commonJS({
|
|
|
1715
1999
|
exports.flatten = (...args) => {
|
|
1716
2000
|
const result = [];
|
|
1717
2001
|
const flat = (arr) => {
|
|
1718
|
-
for (let
|
|
1719
|
-
const ele = arr[
|
|
2002
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
2003
|
+
const ele = arr[i2];
|
|
1720
2004
|
if (Array.isArray(ele)) {
|
|
1721
2005
|
flat(ele);
|
|
1722
2006
|
continue;
|
|
@@ -1810,9 +2094,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1810
2094
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1811
2095
|
return toRegexRange.cache[cacheKey].result;
|
|
1812
2096
|
}
|
|
1813
|
-
let
|
|
2097
|
+
let a2 = Math.min(min, max);
|
|
1814
2098
|
let b = Math.max(min, max);
|
|
1815
|
-
if (Math.abs(
|
|
2099
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1816
2100
|
let result = min + "|" + max;
|
|
1817
2101
|
if (opts.capture) {
|
|
1818
2102
|
return `(${result})`;
|
|
@@ -1823,20 +2107,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1823
2107
|
return `(?:${result})`;
|
|
1824
2108
|
}
|
|
1825
2109
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1826
|
-
let state = { min, max, a, b };
|
|
2110
|
+
let state = { min, max, a: a2, b };
|
|
1827
2111
|
let positives = [];
|
|
1828
2112
|
let negatives = [];
|
|
1829
2113
|
if (isPadded) {
|
|
1830
2114
|
state.isPadded = isPadded;
|
|
1831
2115
|
state.maxLen = String(state.max).length;
|
|
1832
2116
|
}
|
|
1833
|
-
if (
|
|
2117
|
+
if (a2 < 0) {
|
|
1834
2118
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1835
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1836
|
-
|
|
2119
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2120
|
+
a2 = state.a = 0;
|
|
1837
2121
|
}
|
|
1838
2122
|
if (b >= 0) {
|
|
1839
|
-
positives = splitToPatterns(
|
|
2123
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1840
2124
|
}
|
|
1841
2125
|
state.negatives = negatives;
|
|
1842
2126
|
state.positives = positives;
|
|
@@ -1884,8 +2168,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1884
2168
|
let digits = zipped.length;
|
|
1885
2169
|
let pattern = "";
|
|
1886
2170
|
let count = 0;
|
|
1887
|
-
for (let
|
|
1888
|
-
let [startDigit, stopDigit] = zipped[
|
|
2171
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2172
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1889
2173
|
if (startDigit === stopDigit) {
|
|
1890
2174
|
pattern += startDigit;
|
|
1891
2175
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1904,8 +2188,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1904
2188
|
let tokens = [];
|
|
1905
2189
|
let start = min;
|
|
1906
2190
|
let prev;
|
|
1907
|
-
for (let
|
|
1908
|
-
let max2 = ranges[
|
|
2191
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2192
|
+
let max2 = ranges[i2];
|
|
1909
2193
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1910
2194
|
let zeros = "";
|
|
1911
2195
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1940,13 +2224,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1940
2224
|
}
|
|
1941
2225
|
return result;
|
|
1942
2226
|
}
|
|
1943
|
-
function zip(
|
|
2227
|
+
function zip(a2, b) {
|
|
1944
2228
|
let arr = [];
|
|
1945
|
-
for (let
|
|
2229
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1946
2230
|
return arr;
|
|
1947
2231
|
}
|
|
1948
|
-
function compare(
|
|
1949
|
-
return
|
|
2232
|
+
function compare(a2, b) {
|
|
2233
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1950
2234
|
}
|
|
1951
2235
|
function contains(arr, key, val) {
|
|
1952
2236
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1964,8 +2248,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1964
2248
|
}
|
|
1965
2249
|
return "";
|
|
1966
2250
|
}
|
|
1967
|
-
function toCharacterClass(
|
|
1968
|
-
return `[${
|
|
2251
|
+
function toCharacterClass(a2, b, options) {
|
|
2252
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1969
2253
|
}
|
|
1970
2254
|
function hasPadding(str) {
|
|
1971
2255
|
return /^-?(0+)\d/.test(str);
|
|
@@ -2044,8 +2328,8 @@ var require_fill_range = __commonJS({
|
|
|
2044
2328
|
return negative ? "-" + input : input;
|
|
2045
2329
|
};
|
|
2046
2330
|
var toSequence = (parts, options, maxLen) => {
|
|
2047
|
-
parts.negatives.sort((
|
|
2048
|
-
parts.positives.sort((
|
|
2331
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2332
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2049
2333
|
let prefix = options.capture ? "" : "?:";
|
|
2050
2334
|
let positives = "";
|
|
2051
2335
|
let negatives = "";
|
|
@@ -2066,12 +2350,12 @@ var require_fill_range = __commonJS({
|
|
|
2066
2350
|
}
|
|
2067
2351
|
return result;
|
|
2068
2352
|
};
|
|
2069
|
-
var toRange = (
|
|
2353
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
2070
2354
|
if (isNumbers) {
|
|
2071
|
-
return toRegexRange(
|
|
2355
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
2072
2356
|
}
|
|
2073
|
-
let start = String.fromCharCode(
|
|
2074
|
-
if (
|
|
2357
|
+
let start = String.fromCharCode(a2);
|
|
2358
|
+
if (a2 === b) return start;
|
|
2075
2359
|
let stop = String.fromCharCode(b);
|
|
2076
2360
|
return `[${start}-${stop}]`;
|
|
2077
2361
|
};
|
|
@@ -2097,15 +2381,15 @@ var require_fill_range = __commonJS({
|
|
|
2097
2381
|
return [];
|
|
2098
2382
|
};
|
|
2099
2383
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2100
|
-
let
|
|
2384
|
+
let a2 = Number(start);
|
|
2101
2385
|
let b = Number(end);
|
|
2102
|
-
if (!Number.isInteger(
|
|
2386
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2103
2387
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2104
2388
|
return [];
|
|
2105
2389
|
}
|
|
2106
|
-
if (
|
|
2390
|
+
if (a2 === 0) a2 = 0;
|
|
2107
2391
|
if (b === 0) b = 0;
|
|
2108
|
-
let descending =
|
|
2392
|
+
let descending = a2 > b;
|
|
2109
2393
|
let startString = String(start);
|
|
2110
2394
|
let endString = String(end);
|
|
2111
2395
|
let stepString = String(step);
|
|
@@ -2121,13 +2405,13 @@ var require_fill_range = __commonJS({
|
|
|
2121
2405
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2122
2406
|
let range = [];
|
|
2123
2407
|
let index = 0;
|
|
2124
|
-
while (descending ?
|
|
2408
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2125
2409
|
if (options.toRegex === true && step > 1) {
|
|
2126
|
-
push(
|
|
2410
|
+
push(a2);
|
|
2127
2411
|
} else {
|
|
2128
|
-
range.push(pad(format(
|
|
2412
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2129
2413
|
}
|
|
2130
|
-
|
|
2414
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2131
2415
|
index++;
|
|
2132
2416
|
}
|
|
2133
2417
|
if (options.toRegex === true) {
|
|
@@ -2140,19 +2424,19 @@ var require_fill_range = __commonJS({
|
|
|
2140
2424
|
return invalidRange(start, end, options);
|
|
2141
2425
|
}
|
|
2142
2426
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2143
|
-
let
|
|
2427
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2144
2428
|
let b = `${end}`.charCodeAt(0);
|
|
2145
|
-
let descending =
|
|
2146
|
-
let min = Math.min(
|
|
2147
|
-
let max = Math.max(
|
|
2429
|
+
let descending = a2 > b;
|
|
2430
|
+
let min = Math.min(a2, b);
|
|
2431
|
+
let max = Math.max(a2, b);
|
|
2148
2432
|
if (options.toRegex && step === 1) {
|
|
2149
2433
|
return toRange(min, max, false, options);
|
|
2150
2434
|
}
|
|
2151
2435
|
let range = [];
|
|
2152
2436
|
let index = 0;
|
|
2153
|
-
while (descending ?
|
|
2154
|
-
range.push(format(
|
|
2155
|
-
|
|
2437
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2438
|
+
range.push(format(a2, index));
|
|
2439
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2156
2440
|
index++;
|
|
2157
2441
|
}
|
|
2158
2442
|
if (options.toRegex === true) {
|
|
@@ -2275,18 +2559,18 @@ var require_expand = __commonJS({
|
|
|
2275
2559
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2276
2560
|
const walk = (node, parent = {}) => {
|
|
2277
2561
|
node.queue = [];
|
|
2278
|
-
let
|
|
2279
|
-
let
|
|
2280
|
-
while (
|
|
2281
|
-
|
|
2282
|
-
|
|
2562
|
+
let p = parent;
|
|
2563
|
+
let q = parent.queue;
|
|
2564
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2565
|
+
p = p.parent;
|
|
2566
|
+
q = p.queue;
|
|
2283
2567
|
}
|
|
2284
2568
|
if (node.invalid || node.dollar) {
|
|
2285
|
-
|
|
2569
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2286
2570
|
return;
|
|
2287
2571
|
}
|
|
2288
2572
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2289
|
-
|
|
2573
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2290
2574
|
return;
|
|
2291
2575
|
}
|
|
2292
2576
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2298,26 +2582,26 @@ var require_expand = __commonJS({
|
|
|
2298
2582
|
if (range.length === 0) {
|
|
2299
2583
|
range = stringify2(node, options);
|
|
2300
2584
|
}
|
|
2301
|
-
|
|
2585
|
+
q.push(append(q.pop(), range));
|
|
2302
2586
|
node.nodes = [];
|
|
2303
2587
|
return;
|
|
2304
2588
|
}
|
|
2305
2589
|
const enclose = utils.encloseBrace(node);
|
|
2306
2590
|
let queue = node.queue;
|
|
2307
|
-
let
|
|
2308
|
-
while (
|
|
2309
|
-
|
|
2310
|
-
queue =
|
|
2591
|
+
let block2 = node;
|
|
2592
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2593
|
+
block2 = block2.parent;
|
|
2594
|
+
queue = block2.queue;
|
|
2311
2595
|
}
|
|
2312
|
-
for (let
|
|
2313
|
-
const child = node.nodes[
|
|
2596
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2597
|
+
const child = node.nodes[i2];
|
|
2314
2598
|
if (child.type === "comma" && node.type === "brace") {
|
|
2315
|
-
if (
|
|
2599
|
+
if (i2 === 1) queue.push("");
|
|
2316
2600
|
queue.push("");
|
|
2317
2601
|
continue;
|
|
2318
2602
|
}
|
|
2319
2603
|
if (child.type === "close") {
|
|
2320
|
-
|
|
2604
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2321
2605
|
continue;
|
|
2322
2606
|
}
|
|
2323
2607
|
if (child.value && child.type !== "open") {
|
|
@@ -2484,7 +2768,7 @@ var require_parse = __commonJS({
|
|
|
2484
2768
|
}
|
|
2485
2769
|
const ast = { type: "root", input, nodes: [] };
|
|
2486
2770
|
const stack = [ast];
|
|
2487
|
-
let
|
|
2771
|
+
let block2 = ast;
|
|
2488
2772
|
let prev = ast;
|
|
2489
2773
|
let brackets = 0;
|
|
2490
2774
|
const length = input.length;
|
|
@@ -2500,15 +2784,15 @@ var require_parse = __commonJS({
|
|
|
2500
2784
|
prev.value += node.value;
|
|
2501
2785
|
return;
|
|
2502
2786
|
}
|
|
2503
|
-
|
|
2504
|
-
node.parent =
|
|
2787
|
+
block2.nodes.push(node);
|
|
2788
|
+
node.parent = block2;
|
|
2505
2789
|
node.prev = prev;
|
|
2506
2790
|
prev = node;
|
|
2507
2791
|
return node;
|
|
2508
2792
|
};
|
|
2509
2793
|
push({ type: "bos" });
|
|
2510
2794
|
while (index < length) {
|
|
2511
|
-
|
|
2795
|
+
block2 = stack[stack.length - 1];
|
|
2512
2796
|
value = advance();
|
|
2513
2797
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2514
2798
|
continue;
|
|
@@ -2545,19 +2829,19 @@ var require_parse = __commonJS({
|
|
|
2545
2829
|
continue;
|
|
2546
2830
|
}
|
|
2547
2831
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2548
|
-
|
|
2549
|
-
stack.push(
|
|
2832
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2833
|
+
stack.push(block2);
|
|
2550
2834
|
push({ type: "text", value });
|
|
2551
2835
|
continue;
|
|
2552
2836
|
}
|
|
2553
2837
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2554
|
-
if (
|
|
2838
|
+
if (block2.type !== "paren") {
|
|
2555
2839
|
push({ type: "text", value });
|
|
2556
2840
|
continue;
|
|
2557
2841
|
}
|
|
2558
|
-
|
|
2842
|
+
block2 = stack.pop();
|
|
2559
2843
|
push({ type: "text", value });
|
|
2560
|
-
|
|
2844
|
+
block2 = stack[stack.length - 1];
|
|
2561
2845
|
continue;
|
|
2562
2846
|
}
|
|
2563
2847
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2582,7 +2866,7 @@ var require_parse = __commonJS({
|
|
|
2582
2866
|
}
|
|
2583
2867
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2584
2868
|
depth++;
|
|
2585
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2869
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2586
2870
|
const brace = {
|
|
2587
2871
|
type: "brace",
|
|
2588
2872
|
open: true,
|
|
@@ -2593,52 +2877,52 @@ var require_parse = __commonJS({
|
|
|
2593
2877
|
ranges: 0,
|
|
2594
2878
|
nodes: []
|
|
2595
2879
|
};
|
|
2596
|
-
|
|
2597
|
-
stack.push(
|
|
2880
|
+
block2 = push(brace);
|
|
2881
|
+
stack.push(block2);
|
|
2598
2882
|
push({ type: "open", value });
|
|
2599
2883
|
continue;
|
|
2600
2884
|
}
|
|
2601
2885
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2602
|
-
if (
|
|
2886
|
+
if (block2.type !== "brace") {
|
|
2603
2887
|
push({ type: "text", value });
|
|
2604
2888
|
continue;
|
|
2605
2889
|
}
|
|
2606
2890
|
const type = "close";
|
|
2607
|
-
|
|
2608
|
-
|
|
2891
|
+
block2 = stack.pop();
|
|
2892
|
+
block2.close = true;
|
|
2609
2893
|
push({ type, value });
|
|
2610
2894
|
depth--;
|
|
2611
|
-
|
|
2895
|
+
block2 = stack[stack.length - 1];
|
|
2612
2896
|
continue;
|
|
2613
2897
|
}
|
|
2614
2898
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2615
|
-
if (
|
|
2616
|
-
|
|
2617
|
-
const open =
|
|
2618
|
-
|
|
2899
|
+
if (block2.ranges > 0) {
|
|
2900
|
+
block2.ranges = 0;
|
|
2901
|
+
const open = block2.nodes.shift();
|
|
2902
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2619
2903
|
}
|
|
2620
2904
|
push({ type: "comma", value });
|
|
2621
|
-
|
|
2905
|
+
block2.commas++;
|
|
2622
2906
|
continue;
|
|
2623
2907
|
}
|
|
2624
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2625
|
-
const siblings =
|
|
2908
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2909
|
+
const siblings = block2.nodes;
|
|
2626
2910
|
if (depth === 0 || siblings.length === 0) {
|
|
2627
2911
|
push({ type: "text", value });
|
|
2628
2912
|
continue;
|
|
2629
2913
|
}
|
|
2630
2914
|
if (prev.type === "dot") {
|
|
2631
|
-
|
|
2915
|
+
block2.range = [];
|
|
2632
2916
|
prev.value += value;
|
|
2633
2917
|
prev.type = "range";
|
|
2634
|
-
if (
|
|
2635
|
-
|
|
2636
|
-
|
|
2918
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2919
|
+
block2.invalid = true;
|
|
2920
|
+
block2.ranges = 0;
|
|
2637
2921
|
prev.type = "text";
|
|
2638
2922
|
continue;
|
|
2639
2923
|
}
|
|
2640
|
-
|
|
2641
|
-
|
|
2924
|
+
block2.ranges++;
|
|
2925
|
+
block2.args = [];
|
|
2642
2926
|
continue;
|
|
2643
2927
|
}
|
|
2644
2928
|
if (prev.type === "range") {
|
|
@@ -2646,7 +2930,7 @@ var require_parse = __commonJS({
|
|
|
2646
2930
|
const before = siblings[siblings.length - 1];
|
|
2647
2931
|
before.value += prev.value + value;
|
|
2648
2932
|
prev = before;
|
|
2649
|
-
|
|
2933
|
+
block2.ranges--;
|
|
2650
2934
|
continue;
|
|
2651
2935
|
}
|
|
2652
2936
|
push({ type: "dot", value });
|
|
@@ -2655,9 +2939,9 @@ var require_parse = __commonJS({
|
|
|
2655
2939
|
push({ type: "text", value });
|
|
2656
2940
|
}
|
|
2657
2941
|
do {
|
|
2658
|
-
|
|
2659
|
-
if (
|
|
2660
|
-
|
|
2942
|
+
block2 = stack.pop();
|
|
2943
|
+
if (block2.type !== "root") {
|
|
2944
|
+
block2.nodes.forEach((node) => {
|
|
2661
2945
|
if (!node.nodes) {
|
|
2662
2946
|
if (node.type === "open") node.isOpen = true;
|
|
2663
2947
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2666,8 +2950,8 @@ var require_parse = __commonJS({
|
|
|
2666
2950
|
}
|
|
2667
2951
|
});
|
|
2668
2952
|
const parent = stack[stack.length - 1];
|
|
2669
|
-
const index2 = parent.nodes.indexOf(
|
|
2670
|
-
parent.nodes.splice(index2, 1, ...
|
|
2953
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2954
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2671
2955
|
}
|
|
2672
2956
|
} while (stack.length > 0);
|
|
2673
2957
|
push({ type: "eos" });
|
|
@@ -3300,9 +3584,9 @@ var require_scan = __commonJS({
|
|
|
3300
3584
|
if (opts.parts === true || opts.tokens === true) {
|
|
3301
3585
|
let prevIndex;
|
|
3302
3586
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3303
|
-
const
|
|
3304
|
-
const
|
|
3305
|
-
const value = input.slice(
|
|
3587
|
+
const n2 = prevIndex ? prevIndex + 1 : start;
|
|
3588
|
+
const i2 = slashes[idx];
|
|
3589
|
+
const value = input.slice(n2, i2);
|
|
3306
3590
|
if (opts.tokens) {
|
|
3307
3591
|
if (idx === 0 && start !== 0) {
|
|
3308
3592
|
tokens[idx].isPrefix = true;
|
|
@@ -3316,7 +3600,7 @@ var require_scan = __commonJS({
|
|
|
3316
3600
|
if (idx !== 0 || value !== "") {
|
|
3317
3601
|
parts.push(value);
|
|
3318
3602
|
}
|
|
3319
|
-
prevIndex =
|
|
3603
|
+
prevIndex = i2;
|
|
3320
3604
|
}
|
|
3321
3605
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3322
3606
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3445,15 +3729,15 @@ var require_parse2 = __commonJS({
|
|
|
3445
3729
|
};
|
|
3446
3730
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3447
3731
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3448
|
-
for (let
|
|
3449
|
-
for (let
|
|
3450
|
-
const
|
|
3451
|
-
const b = values[
|
|
3452
|
-
const char =
|
|
3453
|
-
if (!char ||
|
|
3732
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3733
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3734
|
+
const a2 = values[i2];
|
|
3735
|
+
const b = values[j];
|
|
3736
|
+
const char = a2[0];
|
|
3737
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3454
3738
|
continue;
|
|
3455
3739
|
}
|
|
3456
|
-
if (
|
|
3740
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3457
3741
|
return true;
|
|
3458
3742
|
}
|
|
3459
3743
|
}
|
|
@@ -3468,8 +3752,8 @@ var require_parse2 = __commonJS({
|
|
|
3468
3752
|
let paren = 0;
|
|
3469
3753
|
let quote = 0;
|
|
3470
3754
|
let escaped = false;
|
|
3471
|
-
for (let
|
|
3472
|
-
const ch = pattern[
|
|
3755
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3756
|
+
const ch = pattern[i2];
|
|
3473
3757
|
if (escaped === true) {
|
|
3474
3758
|
escaped = false;
|
|
3475
3759
|
continue;
|
|
@@ -3503,13 +3787,13 @@ var require_parse2 = __commonJS({
|
|
|
3503
3787
|
if (ch === ")") {
|
|
3504
3788
|
paren--;
|
|
3505
3789
|
if (paren === 0) {
|
|
3506
|
-
if (requireEnd === true &&
|
|
3790
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3507
3791
|
return;
|
|
3508
3792
|
}
|
|
3509
3793
|
return {
|
|
3510
3794
|
type: pattern[0],
|
|
3511
|
-
body: pattern.slice(2,
|
|
3512
|
-
end:
|
|
3795
|
+
body: pattern.slice(2, i2),
|
|
3796
|
+
end: i2
|
|
3513
3797
|
};
|
|
3514
3798
|
}
|
|
3515
3799
|
}
|
|
@@ -3641,7 +3925,7 @@ var require_parse2 = __commonJS({
|
|
|
3641
3925
|
let prev = bos;
|
|
3642
3926
|
let value;
|
|
3643
3927
|
const eos = () => state.index === len - 1;
|
|
3644
|
-
const peek = state.peek = (
|
|
3928
|
+
const peek = state.peek = (n2 = 1) => input[state.index + n2];
|
|
3645
3929
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3646
3930
|
const remaining = () => input.slice(state.index + 1);
|
|
3647
3931
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3722,10 +4006,10 @@ var require_parse2 = __commonJS({
|
|
|
3722
4006
|
open.type = "text";
|
|
3723
4007
|
open.value = literal;
|
|
3724
4008
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3725
|
-
for (let
|
|
3726
|
-
tokens[
|
|
3727
|
-
tokens[
|
|
3728
|
-
delete tokens[
|
|
4009
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
4010
|
+
tokens[i2].value = "";
|
|
4011
|
+
tokens[i2].output = "";
|
|
4012
|
+
delete tokens[i2].suffix;
|
|
3729
4013
|
}
|
|
3730
4014
|
state.output = token.output + open.output;
|
|
3731
4015
|
state.backtrack = true;
|
|
@@ -3756,10 +4040,10 @@ var require_parse2 = __commonJS({
|
|
|
3756
4040
|
};
|
|
3757
4041
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
3758
4042
|
let backslashes = false;
|
|
3759
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
4043
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
|
|
3760
4044
|
if (first === "\\") {
|
|
3761
4045
|
backslashes = true;
|
|
3762
|
-
return
|
|
4046
|
+
return m2;
|
|
3763
4047
|
}
|
|
3764
4048
|
if (first === "?") {
|
|
3765
4049
|
if (esc) {
|
|
@@ -3779,14 +4063,14 @@ var require_parse2 = __commonJS({
|
|
|
3779
4063
|
}
|
|
3780
4064
|
return star;
|
|
3781
4065
|
}
|
|
3782
|
-
return esc ?
|
|
4066
|
+
return esc ? m2 : `\\${m2}`;
|
|
3783
4067
|
});
|
|
3784
4068
|
if (backslashes === true) {
|
|
3785
4069
|
if (opts.unescape === true) {
|
|
3786
4070
|
output = output.replace(/\\/g, "");
|
|
3787
4071
|
} else {
|
|
3788
|
-
output = output.replace(/\\+/g, (
|
|
3789
|
-
return
|
|
4072
|
+
output = output.replace(/\\+/g, (m2) => {
|
|
4073
|
+
return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
|
|
3790
4074
|
});
|
|
3791
4075
|
}
|
|
3792
4076
|
}
|
|
@@ -3968,13 +4252,13 @@ var require_parse2 = __commonJS({
|
|
|
3968
4252
|
if (brace.dots === true) {
|
|
3969
4253
|
const arr = tokens.slice();
|
|
3970
4254
|
const range = [];
|
|
3971
|
-
for (let
|
|
4255
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3972
4256
|
tokens.pop();
|
|
3973
|
-
if (arr[
|
|
4257
|
+
if (arr[i2].type === "brace") {
|
|
3974
4258
|
break;
|
|
3975
4259
|
}
|
|
3976
|
-
if (arr[
|
|
3977
|
-
range.unshift(arr[
|
|
4260
|
+
if (arr[i2].type !== "dots") {
|
|
4261
|
+
range.unshift(arr[i2].value);
|
|
3978
4262
|
}
|
|
3979
4263
|
}
|
|
3980
4264
|
output = expandRange(range, opts);
|
|
@@ -4433,7 +4717,7 @@ var require_picomatch = __commonJS({
|
|
|
4433
4717
|
};
|
|
4434
4718
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4435
4719
|
picomatch.parse = (pattern, options) => {
|
|
4436
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4720
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4437
4721
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4438
4722
|
};
|
|
4439
4723
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4517,8 +4801,8 @@ var require_micromatch = __commonJS({
|
|
|
4517
4801
|
options.onResult(state);
|
|
4518
4802
|
}
|
|
4519
4803
|
};
|
|
4520
|
-
for (let
|
|
4521
|
-
let isMatch = picomatch(String(patterns[
|
|
4804
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4805
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4522
4806
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4523
4807
|
if (negated) negatives++;
|
|
4524
4808
|
for (let item of list) {
|
|
@@ -4540,7 +4824,7 @@ var require_micromatch = __commonJS({
|
|
|
4540
4824
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4541
4825
|
}
|
|
4542
4826
|
if (options.nonull === true || options.nullglob === true) {
|
|
4543
|
-
return options.unescape ? patterns.map((
|
|
4827
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4544
4828
|
}
|
|
4545
4829
|
}
|
|
4546
4830
|
return matches;
|
|
@@ -4570,7 +4854,7 @@ var require_micromatch = __commonJS({
|
|
|
4570
4854
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4571
4855
|
}
|
|
4572
4856
|
if (Array.isArray(pattern)) {
|
|
4573
|
-
return pattern.some((
|
|
4857
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4574
4858
|
}
|
|
4575
4859
|
if (typeof pattern === "string") {
|
|
4576
4860
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4615,7 +4899,7 @@ var require_micromatch = __commonJS({
|
|
|
4615
4899
|
if (typeof str !== "string") {
|
|
4616
4900
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4617
4901
|
}
|
|
4618
|
-
return [].concat(patterns).every((
|
|
4902
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4619
4903
|
};
|
|
4620
4904
|
micromatch.capture = (glob2, input, options) => {
|
|
4621
4905
|
let posix = utils.isWindows(options);
|
|
@@ -4766,7 +5050,7 @@ var require_pattern = __commonJS({
|
|
|
4766
5050
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4767
5051
|
function expandBraceExpansion(pattern) {
|
|
4768
5052
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4769
|
-
patterns.sort((
|
|
5053
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4770
5054
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4771
5055
|
}
|
|
4772
5056
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4847,8 +5131,8 @@ var require_merge2 = __commonJS({
|
|
|
4847
5131
|
}
|
|
4848
5132
|
const mergedStream = PassThrough(options);
|
|
4849
5133
|
function addStream() {
|
|
4850
|
-
for (let
|
|
4851
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5134
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5135
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4852
5136
|
}
|
|
4853
5137
|
mergeStream();
|
|
4854
5138
|
return this;
|
|
@@ -4897,8 +5181,8 @@ var require_merge2 = __commonJS({
|
|
|
4897
5181
|
stream.pipe(mergedStream, { end: false });
|
|
4898
5182
|
stream.resume();
|
|
4899
5183
|
}
|
|
4900
|
-
for (let
|
|
4901
|
-
pipe(streams[
|
|
5184
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5185
|
+
pipe(streams[i2]);
|
|
4902
5186
|
}
|
|
4903
5187
|
next();
|
|
4904
5188
|
}
|
|
@@ -4929,8 +5213,8 @@ var require_merge2 = __commonJS({
|
|
|
4929
5213
|
}
|
|
4930
5214
|
streams.pause();
|
|
4931
5215
|
} else {
|
|
4932
|
-
for (let
|
|
4933
|
-
streams[
|
|
5216
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5217
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4934
5218
|
}
|
|
4935
5219
|
}
|
|
4936
5220
|
return streams;
|
|
@@ -5012,13 +5296,13 @@ var require_tasks = __commonJS({
|
|
|
5012
5296
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5013
5297
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
5014
5298
|
var utils = require_utils3();
|
|
5015
|
-
function generate(input,
|
|
5016
|
-
const patterns = processPatterns(input,
|
|
5017
|
-
const ignore = processPatterns(
|
|
5299
|
+
function generate(input, settings2) {
|
|
5300
|
+
const patterns = processPatterns(input, settings2);
|
|
5301
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
5018
5302
|
const positivePatterns = getPositivePatterns(patterns);
|
|
5019
5303
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
5020
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
5021
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5304
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5305
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
5022
5306
|
const staticTasks = convertPatternsToTasks(
|
|
5023
5307
|
staticPatterns,
|
|
5024
5308
|
negativePatterns,
|
|
@@ -5034,12 +5318,12 @@ var require_tasks = __commonJS({
|
|
|
5034
5318
|
return staticTasks.concat(dynamicTasks);
|
|
5035
5319
|
}
|
|
5036
5320
|
exports.generate = generate;
|
|
5037
|
-
function processPatterns(input,
|
|
5321
|
+
function processPatterns(input, settings2) {
|
|
5038
5322
|
let patterns = input;
|
|
5039
|
-
if (
|
|
5323
|
+
if (settings2.braceExpansion) {
|
|
5040
5324
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
5041
5325
|
}
|
|
5042
|
-
if (
|
|
5326
|
+
if (settings2.baseNameMatch) {
|
|
5043
5327
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
5044
5328
|
}
|
|
5045
5329
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -5070,7 +5354,7 @@ var require_tasks = __commonJS({
|
|
|
5070
5354
|
}
|
|
5071
5355
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
5072
5356
|
function groupPatternsByBaseDirectory(patterns) {
|
|
5073
|
-
const
|
|
5357
|
+
const group2 = {};
|
|
5074
5358
|
return patterns.reduce((collection, pattern) => {
|
|
5075
5359
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
5076
5360
|
if (base in collection) {
|
|
@@ -5079,7 +5363,7 @@ var require_tasks = __commonJS({
|
|
|
5079
5363
|
collection[base] = [pattern];
|
|
5080
5364
|
}
|
|
5081
5365
|
return collection;
|
|
5082
|
-
},
|
|
5366
|
+
}, group2);
|
|
5083
5367
|
}
|
|
5084
5368
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5085
5369
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5108,26 +5392,26 @@ var require_async = __commonJS({
|
|
|
5108
5392
|
init_utils2();
|
|
5109
5393
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5110
5394
|
exports.read = void 0;
|
|
5111
|
-
function read2(path,
|
|
5112
|
-
|
|
5395
|
+
function read2(path, settings2, callback) {
|
|
5396
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5113
5397
|
if (lstatError !== null) {
|
|
5114
5398
|
callFailureCallback(callback, lstatError);
|
|
5115
5399
|
return;
|
|
5116
5400
|
}
|
|
5117
|
-
if (!lstat.isSymbolicLink() || !
|
|
5401
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5118
5402
|
callSuccessCallback(callback, lstat);
|
|
5119
5403
|
return;
|
|
5120
5404
|
}
|
|
5121
|
-
|
|
5405
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5122
5406
|
if (statError !== null) {
|
|
5123
|
-
if (
|
|
5407
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5124
5408
|
callFailureCallback(callback, statError);
|
|
5125
5409
|
return;
|
|
5126
5410
|
}
|
|
5127
5411
|
callSuccessCallback(callback, lstat);
|
|
5128
5412
|
return;
|
|
5129
5413
|
}
|
|
5130
|
-
if (
|
|
5414
|
+
if (settings2.markSymbolicLink) {
|
|
5131
5415
|
stat.isSymbolicLink = () => true;
|
|
5132
5416
|
}
|
|
5133
5417
|
callSuccessCallback(callback, stat);
|
|
@@ -5151,19 +5435,19 @@ var require_sync = __commonJS({
|
|
|
5151
5435
|
init_utils2();
|
|
5152
5436
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5153
5437
|
exports.read = void 0;
|
|
5154
|
-
function read2(path,
|
|
5155
|
-
const lstat =
|
|
5156
|
-
if (!lstat.isSymbolicLink() || !
|
|
5438
|
+
function read2(path, settings2) {
|
|
5439
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5440
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5157
5441
|
return lstat;
|
|
5158
5442
|
}
|
|
5159
5443
|
try {
|
|
5160
|
-
const stat =
|
|
5161
|
-
if (
|
|
5444
|
+
const stat = settings2.fs.statSync(path);
|
|
5445
|
+
if (settings2.markSymbolicLink) {
|
|
5162
5446
|
stat.isSymbolicLink = () => true;
|
|
5163
5447
|
}
|
|
5164
5448
|
return stat;
|
|
5165
5449
|
} catch (error2) {
|
|
5166
|
-
if (!
|
|
5450
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5167
5451
|
return lstat;
|
|
5168
5452
|
}
|
|
5169
5453
|
throw error2;
|
|
@@ -5240,8 +5524,8 @@ var require_out = __commonJS({
|
|
|
5240
5524
|
}
|
|
5241
5525
|
exports.stat = stat;
|
|
5242
5526
|
function statSync2(path, optionsOrSettings) {
|
|
5243
|
-
const
|
|
5244
|
-
return sync.read(path,
|
|
5527
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5528
|
+
return sync.read(path, settings2);
|
|
5245
5529
|
}
|
|
5246
5530
|
exports.statSync = statSync2;
|
|
5247
5531
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5289,8 +5573,8 @@ var require_run_parallel = __commonJS({
|
|
|
5289
5573
|
if (isSync) queueMicrotask2(end);
|
|
5290
5574
|
else end();
|
|
5291
5575
|
}
|
|
5292
|
-
function each(
|
|
5293
|
-
results[
|
|
5576
|
+
function each(i2, err, result) {
|
|
5577
|
+
results[i2] = result;
|
|
5294
5578
|
if (--pending === 0 || err) {
|
|
5295
5579
|
done(err);
|
|
5296
5580
|
}
|
|
@@ -5304,9 +5588,9 @@ var require_run_parallel = __commonJS({
|
|
|
5304
5588
|
});
|
|
5305
5589
|
});
|
|
5306
5590
|
} else {
|
|
5307
|
-
tasks.forEach(function(task,
|
|
5591
|
+
tasks.forEach(function(task, i2) {
|
|
5308
5592
|
task(function(err, result) {
|
|
5309
|
-
each(
|
|
5593
|
+
each(i2, err, result);
|
|
5310
5594
|
});
|
|
5311
5595
|
});
|
|
5312
5596
|
}
|
|
@@ -5381,11 +5665,11 @@ var require_common = __commonJS({
|
|
|
5381
5665
|
init_utils2();
|
|
5382
5666
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5383
5667
|
exports.joinPathSegments = void 0;
|
|
5384
|
-
function joinPathSegments(
|
|
5385
|
-
if (
|
|
5386
|
-
return
|
|
5668
|
+
function joinPathSegments(a2, b, separator) {
|
|
5669
|
+
if (a2.endsWith(separator)) {
|
|
5670
|
+
return a2 + b;
|
|
5387
5671
|
}
|
|
5388
|
-
return
|
|
5672
|
+
return a2 + separator + b;
|
|
5389
5673
|
}
|
|
5390
5674
|
exports.joinPathSegments = joinPathSegments;
|
|
5391
5675
|
}
|
|
@@ -5403,16 +5687,16 @@ var require_async2 = __commonJS({
|
|
|
5403
5687
|
var constants_1 = require_constants3();
|
|
5404
5688
|
var utils = require_utils4();
|
|
5405
5689
|
var common = require_common();
|
|
5406
|
-
function read2(directory,
|
|
5407
|
-
if (!
|
|
5408
|
-
readdirWithFileTypes(directory,
|
|
5690
|
+
function read2(directory, settings2, callback) {
|
|
5691
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5692
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5409
5693
|
return;
|
|
5410
5694
|
}
|
|
5411
|
-
readdir(directory,
|
|
5695
|
+
readdir(directory, settings2, callback);
|
|
5412
5696
|
}
|
|
5413
5697
|
exports.read = read2;
|
|
5414
|
-
function readdirWithFileTypes(directory,
|
|
5415
|
-
|
|
5698
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5699
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5416
5700
|
if (readdirError !== null) {
|
|
5417
5701
|
callFailureCallback(callback, readdirError);
|
|
5418
5702
|
return;
|
|
@@ -5420,13 +5704,13 @@ var require_async2 = __commonJS({
|
|
|
5420
5704
|
const entries = dirents.map((dirent) => ({
|
|
5421
5705
|
dirent,
|
|
5422
5706
|
name: dirent.name,
|
|
5423
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5707
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5424
5708
|
}));
|
|
5425
|
-
if (!
|
|
5709
|
+
if (!settings2.followSymbolicLinks) {
|
|
5426
5710
|
callSuccessCallback(callback, entries);
|
|
5427
5711
|
return;
|
|
5428
5712
|
}
|
|
5429
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5713
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5430
5714
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5431
5715
|
if (rplError !== null) {
|
|
5432
5716
|
callFailureCallback(callback, rplError);
|
|
@@ -5437,15 +5721,15 @@ var require_async2 = __commonJS({
|
|
|
5437
5721
|
});
|
|
5438
5722
|
}
|
|
5439
5723
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5440
|
-
function makeRplTaskEntry(entry,
|
|
5724
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5441
5725
|
return (done) => {
|
|
5442
5726
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5443
5727
|
done(null, entry);
|
|
5444
5728
|
return;
|
|
5445
5729
|
}
|
|
5446
|
-
|
|
5730
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5447
5731
|
if (statError !== null) {
|
|
5448
|
-
if (
|
|
5732
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5449
5733
|
done(statError);
|
|
5450
5734
|
return;
|
|
5451
5735
|
}
|
|
@@ -5457,16 +5741,16 @@ var require_async2 = __commonJS({
|
|
|
5457
5741
|
});
|
|
5458
5742
|
};
|
|
5459
5743
|
}
|
|
5460
|
-
function readdir(directory,
|
|
5461
|
-
|
|
5744
|
+
function readdir(directory, settings2, callback) {
|
|
5745
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5462
5746
|
if (readdirError !== null) {
|
|
5463
5747
|
callFailureCallback(callback, readdirError);
|
|
5464
5748
|
return;
|
|
5465
5749
|
}
|
|
5466
5750
|
const tasks = names.map((name) => {
|
|
5467
|
-
const path = common.joinPathSegments(directory, name,
|
|
5751
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5468
5752
|
return (done) => {
|
|
5469
|
-
fsStat.stat(path,
|
|
5753
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5470
5754
|
if (error2 !== null) {
|
|
5471
5755
|
done(error2);
|
|
5472
5756
|
return;
|
|
@@ -5476,7 +5760,7 @@ var require_async2 = __commonJS({
|
|
|
5476
5760
|
path,
|
|
5477
5761
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5478
5762
|
};
|
|
5479
|
-
if (
|
|
5763
|
+
if (settings2.stats) {
|
|
5480
5764
|
entry.stats = stats;
|
|
5481
5765
|
}
|
|
5482
5766
|
done(null, entry);
|
|
@@ -5513,27 +5797,27 @@ var require_sync2 = __commonJS({
|
|
|
5513
5797
|
var constants_1 = require_constants3();
|
|
5514
5798
|
var utils = require_utils4();
|
|
5515
5799
|
var common = require_common();
|
|
5516
|
-
function read2(directory,
|
|
5517
|
-
if (!
|
|
5518
|
-
return readdirWithFileTypes(directory,
|
|
5800
|
+
function read2(directory, settings2) {
|
|
5801
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5802
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5519
5803
|
}
|
|
5520
|
-
return readdir(directory,
|
|
5804
|
+
return readdir(directory, settings2);
|
|
5521
5805
|
}
|
|
5522
5806
|
exports.read = read2;
|
|
5523
|
-
function readdirWithFileTypes(directory,
|
|
5524
|
-
const dirents =
|
|
5807
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5808
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5525
5809
|
return dirents.map((dirent) => {
|
|
5526
5810
|
const entry = {
|
|
5527
5811
|
dirent,
|
|
5528
5812
|
name: dirent.name,
|
|
5529
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5813
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5530
5814
|
};
|
|
5531
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5815
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5532
5816
|
try {
|
|
5533
|
-
const stats =
|
|
5817
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5534
5818
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5535
5819
|
} catch (error2) {
|
|
5536
|
-
if (
|
|
5820
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5537
5821
|
throw error2;
|
|
5538
5822
|
}
|
|
5539
5823
|
}
|
|
@@ -5542,17 +5826,17 @@ var require_sync2 = __commonJS({
|
|
|
5542
5826
|
});
|
|
5543
5827
|
}
|
|
5544
5828
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5545
|
-
function readdir(directory,
|
|
5546
|
-
const names =
|
|
5829
|
+
function readdir(directory, settings2) {
|
|
5830
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5547
5831
|
return names.map((name) => {
|
|
5548
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5549
|
-
const stats = fsStat.statSync(entryPath,
|
|
5832
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5833
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5550
5834
|
const entry = {
|
|
5551
5835
|
name,
|
|
5552
5836
|
path: entryPath,
|
|
5553
5837
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5554
5838
|
};
|
|
5555
|
-
if (
|
|
5839
|
+
if (settings2.stats) {
|
|
5556
5840
|
entry.stats = stats;
|
|
5557
5841
|
}
|
|
5558
5842
|
return entry;
|
|
@@ -5639,8 +5923,8 @@ var require_out2 = __commonJS({
|
|
|
5639
5923
|
}
|
|
5640
5924
|
exports.scandir = scandir;
|
|
5641
5925
|
function scandirSync(path, optionsOrSettings) {
|
|
5642
|
-
const
|
|
5643
|
-
return sync.read(path,
|
|
5926
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5927
|
+
return sync.read(path, settings2);
|
|
5644
5928
|
}
|
|
5645
5929
|
exports.scandirSync = scandirSync;
|
|
5646
5930
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5684,9 +5968,9 @@ var require_reusify = __commonJS({
|
|
|
5684
5968
|
}
|
|
5685
5969
|
});
|
|
5686
5970
|
|
|
5687
|
-
// node_modules/.bun/fastq@1.20.
|
|
5971
|
+
// node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
|
|
5688
5972
|
var require_queue = __commonJS({
|
|
5689
|
-
"node_modules/.bun/fastq@1.20.
|
|
5973
|
+
"node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
|
|
5690
5974
|
"use strict";
|
|
5691
5975
|
init_utils2();
|
|
5692
5976
|
var reusify = require_reusify();
|
|
@@ -5866,11 +6150,12 @@ var require_queue = __commonJS({
|
|
|
5866
6150
|
current.value = null;
|
|
5867
6151
|
current.callback = noop;
|
|
5868
6152
|
current.errorHandler = null;
|
|
6153
|
+
current.next = null;
|
|
5869
6154
|
if (errorHandler2) {
|
|
5870
6155
|
errorHandler2(new Error("abort"), val);
|
|
5871
6156
|
}
|
|
5872
6157
|
callback.call(context2, new Error("abort"));
|
|
5873
|
-
|
|
6158
|
+
cache.release(current);
|
|
5874
6159
|
current = next;
|
|
5875
6160
|
}
|
|
5876
6161
|
self.drain = noop;
|
|
@@ -5921,7 +6206,7 @@ var require_queue = __commonJS({
|
|
|
5921
6206
|
queue.drained = drained;
|
|
5922
6207
|
return queue;
|
|
5923
6208
|
function push(value) {
|
|
5924
|
-
var
|
|
6209
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5925
6210
|
pushCb(value, function(err, result) {
|
|
5926
6211
|
if (err) {
|
|
5927
6212
|
reject(err);
|
|
@@ -5930,11 +6215,11 @@ var require_queue = __commonJS({
|
|
|
5930
6215
|
resolve4(result);
|
|
5931
6216
|
});
|
|
5932
6217
|
});
|
|
5933
|
-
|
|
5934
|
-
return
|
|
6218
|
+
p.catch(noop);
|
|
6219
|
+
return p;
|
|
5935
6220
|
}
|
|
5936
6221
|
function unshift(value) {
|
|
5937
|
-
var
|
|
6222
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5938
6223
|
unshiftCb(value, function(err, result) {
|
|
5939
6224
|
if (err) {
|
|
5940
6225
|
reject(err);
|
|
@@ -5943,11 +6228,11 @@ var require_queue = __commonJS({
|
|
|
5943
6228
|
resolve4(result);
|
|
5944
6229
|
});
|
|
5945
6230
|
});
|
|
5946
|
-
|
|
5947
|
-
return
|
|
6231
|
+
p.catch(noop);
|
|
6232
|
+
return p;
|
|
5948
6233
|
}
|
|
5949
6234
|
function drained() {
|
|
5950
|
-
var
|
|
6235
|
+
var p = new Promise(function(resolve4) {
|
|
5951
6236
|
process.nextTick(function() {
|
|
5952
6237
|
if (queue.idle()) {
|
|
5953
6238
|
resolve4();
|
|
@@ -5961,7 +6246,7 @@ var require_queue = __commonJS({
|
|
|
5961
6246
|
}
|
|
5962
6247
|
});
|
|
5963
6248
|
});
|
|
5964
|
-
return
|
|
6249
|
+
return p;
|
|
5965
6250
|
}
|
|
5966
6251
|
}
|
|
5967
6252
|
module.exports = fastqueue;
|
|
@@ -5976,11 +6261,11 @@ var require_common2 = __commonJS({
|
|
|
5976
6261
|
init_utils2();
|
|
5977
6262
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5978
6263
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5979
|
-
function isFatalError(
|
|
5980
|
-
if (
|
|
6264
|
+
function isFatalError(settings2, error2) {
|
|
6265
|
+
if (settings2.errorFilter === null) {
|
|
5981
6266
|
return true;
|
|
5982
6267
|
}
|
|
5983
|
-
return !
|
|
6268
|
+
return !settings2.errorFilter(error2);
|
|
5984
6269
|
}
|
|
5985
6270
|
exports.isFatalError = isFatalError;
|
|
5986
6271
|
function isAppliedFilter(filter, value) {
|
|
@@ -5991,14 +6276,14 @@ var require_common2 = __commonJS({
|
|
|
5991
6276
|
return filepath.split(/[/\\]/).join(separator);
|
|
5992
6277
|
}
|
|
5993
6278
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5994
|
-
function joinPathSegments(
|
|
5995
|
-
if (
|
|
6279
|
+
function joinPathSegments(a2, b, separator) {
|
|
6280
|
+
if (a2 === "") {
|
|
5996
6281
|
return b;
|
|
5997
6282
|
}
|
|
5998
|
-
if (
|
|
5999
|
-
return
|
|
6283
|
+
if (a2.endsWith(separator)) {
|
|
6284
|
+
return a2 + b;
|
|
6000
6285
|
}
|
|
6001
|
-
return
|
|
6286
|
+
return a2 + separator + b;
|
|
6002
6287
|
}
|
|
6003
6288
|
exports.joinPathSegments = joinPathSegments;
|
|
6004
6289
|
}
|
|
@@ -6345,14 +6630,14 @@ var require_out3 = __commonJS({
|
|
|
6345
6630
|
}
|
|
6346
6631
|
exports.walk = walk;
|
|
6347
6632
|
function walkSync(directory, optionsOrSettings) {
|
|
6348
|
-
const
|
|
6349
|
-
const provider = new sync_1.default(directory,
|
|
6633
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6634
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6350
6635
|
return provider.read();
|
|
6351
6636
|
}
|
|
6352
6637
|
exports.walkSync = walkSync;
|
|
6353
6638
|
function walkStream(directory, optionsOrSettings) {
|
|
6354
|
-
const
|
|
6355
|
-
const provider = new stream_1.default(directory,
|
|
6639
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6640
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6356
6641
|
return provider.read();
|
|
6357
6642
|
}
|
|
6358
6643
|
exports.walkStream = walkStream;
|
|
@@ -6438,8 +6723,8 @@ var require_stream3 = __commonJS({
|
|
|
6438
6723
|
done();
|
|
6439
6724
|
}).catch(done);
|
|
6440
6725
|
};
|
|
6441
|
-
for (let
|
|
6442
|
-
stream.write(
|
|
6726
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6727
|
+
stream.write(i2);
|
|
6443
6728
|
}
|
|
6444
6729
|
return stream;
|
|
6445
6730
|
}
|
|
@@ -7100,14 +7385,14 @@ var require_out4 = __commonJS({
|
|
|
7100
7385
|
function generateTasks(source, options) {
|
|
7101
7386
|
assertPatternsInput(source);
|
|
7102
7387
|
const patterns = [].concat(source);
|
|
7103
|
-
const
|
|
7104
|
-
return taskManager.generate(patterns,
|
|
7388
|
+
const settings2 = new settings_1.default(options);
|
|
7389
|
+
return taskManager.generate(patterns, settings2);
|
|
7105
7390
|
}
|
|
7106
7391
|
FastGlob2.generateTasks = generateTasks;
|
|
7107
7392
|
function isDynamicPattern(source, options) {
|
|
7108
7393
|
assertPatternsInput(source);
|
|
7109
|
-
const
|
|
7110
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7394
|
+
const settings2 = new settings_1.default(options);
|
|
7395
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7111
7396
|
}
|
|
7112
7397
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7113
7398
|
function escapePath(source) {
|
|
@@ -7149,9 +7434,9 @@ var require_out4 = __commonJS({
|
|
|
7149
7434
|
})(FastGlob || (FastGlob = {}));
|
|
7150
7435
|
function getWorks(source, _Provider, options) {
|
|
7151
7436
|
const patterns = [].concat(source);
|
|
7152
|
-
const
|
|
7153
|
-
const tasks = taskManager.generate(patterns,
|
|
7154
|
-
const provider = new _Provider(
|
|
7437
|
+
const settings2 = new settings_1.default(options);
|
|
7438
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7439
|
+
const provider = new _Provider(settings2);
|
|
7155
7440
|
return tasks.map(provider.read, provider);
|
|
7156
7441
|
}
|
|
7157
7442
|
function assertPatternsInput(input) {
|
|
@@ -7329,14 +7614,14 @@ import "node:fs";
|
|
|
7329
7614
|
import { createRequire } from "node:module";
|
|
7330
7615
|
import {
|
|
7331
7616
|
resolve,
|
|
7332
|
-
join,
|
|
7333
|
-
dirname,
|
|
7617
|
+
join as join2,
|
|
7618
|
+
dirname as dirname2,
|
|
7334
7619
|
relative,
|
|
7335
7620
|
normalize,
|
|
7336
7621
|
sep,
|
|
7337
7622
|
extname
|
|
7338
7623
|
} from "node:path";
|
|
7339
|
-
import "node:url";
|
|
7624
|
+
import { fileURLToPath } from "node:url";
|
|
7340
7625
|
function safeExecuteAsync(fn, message) {
|
|
7341
7626
|
return fn().catch((error2) => {
|
|
7342
7627
|
throw new Error(
|
|
@@ -7344,7 +7629,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7344
7629
|
);
|
|
7345
7630
|
});
|
|
7346
7631
|
}
|
|
7347
|
-
var import_fast_glob, constants,
|
|
7632
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7348
7633
|
var init_PathResolver = __esm({
|
|
7349
7634
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7350
7635
|
"use strict";
|
|
@@ -7357,7 +7642,7 @@ var init_PathResolver = __esm({
|
|
|
7357
7642
|
getPatternsFor: getPatternsFor || void 0,
|
|
7358
7643
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7359
7644
|
};
|
|
7360
|
-
|
|
7645
|
+
log3 = {
|
|
7361
7646
|
error: (message, error2) => {
|
|
7362
7647
|
},
|
|
7363
7648
|
warn: (message, error2) => {
|
|
@@ -7393,6 +7678,7 @@ var init_PathResolver = __esm({
|
|
|
7393
7678
|
options;
|
|
7394
7679
|
_repoRoot;
|
|
7395
7680
|
_appRoot = null;
|
|
7681
|
+
_writtenPaths = null;
|
|
7396
7682
|
/**
|
|
7397
7683
|
* Get or create singleton instance
|
|
7398
7684
|
* @param options - Configuration options
|
|
@@ -7478,7 +7764,7 @@ var init_PathResolver = __esm({
|
|
|
7478
7764
|
*/
|
|
7479
7765
|
getDirname(path) {
|
|
7480
7766
|
if (!path) return "";
|
|
7481
|
-
return this.normalizePath(
|
|
7767
|
+
return this.normalizePath(dirname2(path));
|
|
7482
7768
|
}
|
|
7483
7769
|
/**
|
|
7484
7770
|
* Resolve package path using Node's module resolution
|
|
@@ -7490,7 +7776,7 @@ var init_PathResolver = __esm({
|
|
|
7490
7776
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7491
7777
|
try {
|
|
7492
7778
|
const basePath = fromPath || this.getAppRoot();
|
|
7493
|
-
const require3 = createRequire(
|
|
7779
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7494
7780
|
const resolved = require3.resolve(packageSpecifier);
|
|
7495
7781
|
return this.normalizePath(resolved);
|
|
7496
7782
|
} catch (error2) {
|
|
@@ -7642,7 +7928,7 @@ var init_PathResolver = __esm({
|
|
|
7642
7928
|
return cleanContent;
|
|
7643
7929
|
} catch (error2) {
|
|
7644
7930
|
if (this.options.debug) {
|
|
7645
|
-
|
|
7931
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7646
7932
|
}
|
|
7647
7933
|
return null;
|
|
7648
7934
|
}
|
|
@@ -7670,7 +7956,7 @@ var init_PathResolver = __esm({
|
|
|
7670
7956
|
return cleanContent;
|
|
7671
7957
|
} catch (error2) {
|
|
7672
7958
|
if (this.options.debug) {
|
|
7673
|
-
|
|
7959
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7674
7960
|
}
|
|
7675
7961
|
return null;
|
|
7676
7962
|
}
|
|
@@ -7692,16 +7978,16 @@ var init_PathResolver = __esm({
|
|
|
7692
7978
|
verbose = false
|
|
7693
7979
|
} = options;
|
|
7694
7980
|
const normalizedPath = this.normalizePath(filePath);
|
|
7695
|
-
const dir = this.normalizePath(
|
|
7981
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7696
7982
|
const fileExists = this.pathExists(normalizedPath);
|
|
7697
7983
|
if (fileExists && !overwrite) {
|
|
7698
7984
|
if (verbose) {
|
|
7699
|
-
|
|
7985
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7700
7986
|
}
|
|
7701
7987
|
return false;
|
|
7702
7988
|
}
|
|
7703
7989
|
if (dryRun) {
|
|
7704
|
-
|
|
7990
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7705
7991
|
return true;
|
|
7706
7992
|
}
|
|
7707
7993
|
try {
|
|
@@ -7711,22 +7997,23 @@ var init_PathResolver = __esm({
|
|
|
7711
7997
|
}
|
|
7712
7998
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7713
7999
|
let writeContent;
|
|
7714
|
-
if (
|
|
8000
|
+
if (Buffer2.isBuffer(content)) {
|
|
7715
8001
|
writeContent = content;
|
|
7716
8002
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7717
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8003
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8004
|
+
`;
|
|
7718
8005
|
} else {
|
|
7719
8006
|
writeContent = String(content);
|
|
7720
8007
|
}
|
|
7721
8008
|
try {
|
|
7722
8009
|
return await safeExecuteAsync(async () => {
|
|
7723
|
-
if (
|
|
8010
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7724
8011
|
await fs.promises.writeFile(normalizedPath, writeContent);
|
|
7725
8012
|
} else {
|
|
7726
8013
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7727
8014
|
}
|
|
7728
8015
|
if (verbose) {
|
|
7729
|
-
|
|
8016
|
+
log3.info(
|
|
7730
8017
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7731
8018
|
);
|
|
7732
8019
|
}
|
|
@@ -7753,16 +8040,16 @@ var init_PathResolver = __esm({
|
|
|
7753
8040
|
verbose = false
|
|
7754
8041
|
} = options;
|
|
7755
8042
|
const normalizedPath = this.normalizePath(filePath);
|
|
7756
|
-
const dir = this.normalizePath(
|
|
8043
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7757
8044
|
const fileExists = this.pathExists(normalizedPath);
|
|
7758
8045
|
if (fileExists && !overwrite) {
|
|
7759
8046
|
if (verbose) {
|
|
7760
|
-
|
|
8047
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7761
8048
|
}
|
|
7762
8049
|
return false;
|
|
7763
8050
|
}
|
|
7764
8051
|
if (dryRun) {
|
|
7765
|
-
|
|
8052
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7766
8053
|
return true;
|
|
7767
8054
|
}
|
|
7768
8055
|
try {
|
|
@@ -7772,21 +8059,23 @@ var init_PathResolver = __esm({
|
|
|
7772
8059
|
}
|
|
7773
8060
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7774
8061
|
let writeContent;
|
|
7775
|
-
if (
|
|
8062
|
+
if (Buffer2.isBuffer(content)) {
|
|
7776
8063
|
writeContent = content;
|
|
7777
8064
|
} else if (detectedFormat === "json" && typeof content === "object") {
|
|
7778
|
-
writeContent = JSON.stringify(content, null, 2)
|
|
8065
|
+
writeContent = `${JSON.stringify(content, null, 2)}
|
|
8066
|
+
`;
|
|
7779
8067
|
} else {
|
|
7780
8068
|
writeContent = String(content);
|
|
7781
8069
|
}
|
|
7782
8070
|
try {
|
|
7783
|
-
if (
|
|
8071
|
+
if (Buffer2.isBuffer(writeContent)) {
|
|
7784
8072
|
fs.writeFileSync(normalizedPath, writeContent);
|
|
7785
8073
|
} else {
|
|
7786
8074
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7787
8075
|
}
|
|
8076
|
+
this._writtenPaths?.add(normalizedPath);
|
|
7788
8077
|
if (verbose) {
|
|
7789
|
-
|
|
8078
|
+
log3.info(
|
|
7790
8079
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7791
8080
|
);
|
|
7792
8081
|
}
|
|
@@ -7811,15 +8100,15 @@ var init_PathResolver = __esm({
|
|
|
7811
8100
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7812
8101
|
if (fileExists && !overwrite) {
|
|
7813
8102
|
if (verbose) {
|
|
7814
|
-
|
|
8103
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7815
8104
|
}
|
|
7816
8105
|
return false;
|
|
7817
8106
|
}
|
|
7818
8107
|
if (dryRun) {
|
|
7819
|
-
|
|
8108
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7820
8109
|
return true;
|
|
7821
8110
|
}
|
|
7822
|
-
const dir = this.normalizePath(
|
|
8111
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7823
8112
|
try {
|
|
7824
8113
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7825
8114
|
} catch (error2) {
|
|
@@ -7829,7 +8118,7 @@ var init_PathResolver = __esm({
|
|
|
7829
8118
|
return await safeExecuteAsync(async () => {
|
|
7830
8119
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7831
8120
|
if (verbose) {
|
|
7832
|
-
|
|
8121
|
+
log3.info(
|
|
7833
8122
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7834
8123
|
);
|
|
7835
8124
|
}
|
|
@@ -7853,15 +8142,15 @@ var init_PathResolver = __esm({
|
|
|
7853
8142
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7854
8143
|
if (fileExists && !overwrite) {
|
|
7855
8144
|
if (verbose) {
|
|
7856
|
-
|
|
8145
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7857
8146
|
}
|
|
7858
8147
|
return false;
|
|
7859
8148
|
}
|
|
7860
8149
|
if (dryRun) {
|
|
7861
|
-
|
|
8150
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7862
8151
|
return true;
|
|
7863
8152
|
}
|
|
7864
|
-
const dir = this.normalizePath(
|
|
8153
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7865
8154
|
try {
|
|
7866
8155
|
fs.mkdirSync(dir, { recursive: true });
|
|
7867
8156
|
} catch (error2) {
|
|
@@ -7869,8 +8158,9 @@ var init_PathResolver = __esm({
|
|
|
7869
8158
|
}
|
|
7870
8159
|
try {
|
|
7871
8160
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
8161
|
+
this._writtenPaths?.add(normalizedDestPath);
|
|
7872
8162
|
if (verbose) {
|
|
7873
|
-
|
|
8163
|
+
log3.info(
|
|
7874
8164
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7875
8165
|
);
|
|
7876
8166
|
}
|
|
@@ -7887,7 +8177,7 @@ var init_PathResolver = __esm({
|
|
|
7887
8177
|
return fs.existsSync(filePath);
|
|
7888
8178
|
} catch (error2) {
|
|
7889
8179
|
if (!silent) {
|
|
7890
|
-
|
|
8180
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7891
8181
|
}
|
|
7892
8182
|
return false;
|
|
7893
8183
|
}
|
|
@@ -7913,7 +8203,7 @@ var init_PathResolver = __esm({
|
|
|
7913
8203
|
return fs.readdirSync(dirPath, options);
|
|
7914
8204
|
} catch (error2) {
|
|
7915
8205
|
if (this.options.debug) {
|
|
7916
|
-
|
|
8206
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7917
8207
|
}
|
|
7918
8208
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7919
8209
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7931,11 +8221,29 @@ var init_PathResolver = __esm({
|
|
|
7931
8221
|
return fs.statSync(filePath);
|
|
7932
8222
|
} catch (error2) {
|
|
7933
8223
|
if (this.options.debug) {
|
|
7934
|
-
|
|
8224
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7935
8225
|
}
|
|
7936
8226
|
return null;
|
|
7937
8227
|
}
|
|
7938
8228
|
}
|
|
8229
|
+
/**
|
|
8230
|
+
* Resolve the real path of a file, following symlinks
|
|
8231
|
+
* @param filePath - Path to resolve
|
|
8232
|
+
* @returns Resolved real path
|
|
8233
|
+
*/
|
|
8234
|
+
realpathSync(filePath) {
|
|
8235
|
+
return fs.realpathSync(filePath);
|
|
8236
|
+
}
|
|
8237
|
+
/**
|
|
8238
|
+
* Watch a directory for changes
|
|
8239
|
+
* @param dirPath - Directory to watch
|
|
8240
|
+
* @param options - fs.watch options
|
|
8241
|
+
* @param callback - Callback for change events
|
|
8242
|
+
* @returns FSWatcher instance
|
|
8243
|
+
*/
|
|
8244
|
+
watch(dirPath, options, callback) {
|
|
8245
|
+
return fs.watch(dirPath, options, callback);
|
|
8246
|
+
}
|
|
7939
8247
|
/**
|
|
7940
8248
|
* Get file stats synchronously (follows symlinks)
|
|
7941
8249
|
* Returns null if file doesn't exist (graceful degradation)
|
|
@@ -7948,7 +8256,7 @@ var init_PathResolver = __esm({
|
|
|
7948
8256
|
return fs.lstatSync(filePath);
|
|
7949
8257
|
} catch (error2) {
|
|
7950
8258
|
if (this.options.debug) {
|
|
7951
|
-
|
|
8259
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7952
8260
|
}
|
|
7953
8261
|
return null;
|
|
7954
8262
|
}
|
|
@@ -8015,6 +8323,28 @@ var init_PathResolver = __esm({
|
|
|
8015
8323
|
* Get app root (where vite.config.ts is, Vite's config.root)
|
|
8016
8324
|
* Falls back to repoRoot if not set
|
|
8017
8325
|
*/
|
|
8326
|
+
/**
|
|
8327
|
+
* Start recording every path written by writeSync/copySync.
|
|
8328
|
+
* Lets a generator know exactly which files the current run produced,
|
|
8329
|
+
* without comparing file timestamps to a clock.
|
|
8330
|
+
*/
|
|
8331
|
+
startWriteRecording() {
|
|
8332
|
+
this._writtenPaths = /* @__PURE__ */ new Set();
|
|
8333
|
+
}
|
|
8334
|
+
/**
|
|
8335
|
+
* Stop recording and return the normalized paths written since
|
|
8336
|
+
* startWriteRecording().
|
|
8337
|
+
*/
|
|
8338
|
+
stopWriteRecording() {
|
|
8339
|
+
if (!this._writtenPaths) {
|
|
8340
|
+
throw new Error(
|
|
8341
|
+
"stopWriteRecording() called without startWriteRecording()"
|
|
8342
|
+
);
|
|
8343
|
+
}
|
|
8344
|
+
const written = this._writtenPaths;
|
|
8345
|
+
this._writtenPaths = null;
|
|
8346
|
+
return written;
|
|
8347
|
+
}
|
|
8018
8348
|
getAppRoot() {
|
|
8019
8349
|
if (!this._appRoot) {
|
|
8020
8350
|
return this._repoRoot;
|
|
@@ -8037,7 +8367,7 @@ var init_PathResolver = __esm({
|
|
|
8037
8367
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
8038
8368
|
*/
|
|
8039
8369
|
isMonorepo() {
|
|
8040
|
-
const packagesDir =
|
|
8370
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
8041
8371
|
return this.pathExists(packagesDir);
|
|
8042
8372
|
}
|
|
8043
8373
|
/**
|
|
@@ -8054,7 +8384,7 @@ var init_PathResolver = __esm({
|
|
|
8054
8384
|
* Find files matching pattern within directory
|
|
8055
8385
|
*/
|
|
8056
8386
|
async findFiles(directory, pattern, options = {}) {
|
|
8057
|
-
const searchPattern = this.normalizePath(
|
|
8387
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
8058
8388
|
const appRoot = this.getAppRoot();
|
|
8059
8389
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
8060
8390
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8101,7 +8431,7 @@ var init_PathResolver = __esm({
|
|
|
8101
8431
|
return null;
|
|
8102
8432
|
}
|
|
8103
8433
|
const resolvedPath = this.normalizePath(
|
|
8104
|
-
|
|
8434
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8105
8435
|
);
|
|
8106
8436
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8107
8437
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8272,6 +8602,15 @@ var init_PathResolver = __esm({
|
|
|
8272
8602
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8273
8603
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8274
8604
|
}
|
|
8605
|
+
/**
|
|
8606
|
+
* Get absolute path to empty flag component module.
|
|
8607
|
+
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8608
|
+
* to replace unused flag files at build time.
|
|
8609
|
+
*/
|
|
8610
|
+
getEmptyFlagModulePath() {
|
|
8611
|
+
const __dirname2 = dirname2(fileURLToPath(import.meta.url));
|
|
8612
|
+
return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
|
|
8613
|
+
}
|
|
8275
8614
|
/**
|
|
8276
8615
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8277
8616
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8297,13 +8636,13 @@ var init_PathResolver = __esm({
|
|
|
8297
8636
|
const maxLevels = this.options.maxLevels;
|
|
8298
8637
|
while (levelsChecked < maxLevels) {
|
|
8299
8638
|
const toolingPath = this.normalizePath(
|
|
8300
|
-
|
|
8639
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8301
8640
|
);
|
|
8302
|
-
const corePath = this.normalizePath(
|
|
8641
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8303
8642
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8304
8643
|
return currentDir;
|
|
8305
8644
|
}
|
|
8306
|
-
const appsDir =
|
|
8645
|
+
const appsDir = join2(currentDir, "apps");
|
|
8307
8646
|
if (this.pathExists(appsDir)) {
|
|
8308
8647
|
const appsDirStat = this.statSync(appsDir);
|
|
8309
8648
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8311,15 +8650,15 @@ var init_PathResolver = __esm({
|
|
|
8311
8650
|
}
|
|
8312
8651
|
}
|
|
8313
8652
|
const packageJsonPath = this.normalizePath(
|
|
8314
|
-
|
|
8653
|
+
join2(currentDir, "package.json")
|
|
8315
8654
|
);
|
|
8316
8655
|
if (this.pathExists(packageJsonPath)) {
|
|
8317
|
-
const parentDir2 = this.normalizePath(
|
|
8656
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8318
8657
|
if (parentDir2 === currentDir) {
|
|
8319
8658
|
return currentDir;
|
|
8320
8659
|
}
|
|
8321
8660
|
}
|
|
8322
|
-
const parentDir = this.normalizePath(
|
|
8661
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8323
8662
|
if (parentDir === currentDir) {
|
|
8324
8663
|
break;
|
|
8325
8664
|
}
|
|
@@ -8335,8 +8674,8 @@ var init_PathResolver = __esm({
|
|
|
8335
8674
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8336
8675
|
import { createRequire as createRequire2 } from "node:module";
|
|
8337
8676
|
import {
|
|
8338
|
-
join as
|
|
8339
|
-
dirname as
|
|
8677
|
+
join as join3,
|
|
8678
|
+
dirname as dirname3,
|
|
8340
8679
|
basename as basename2,
|
|
8341
8680
|
extname as extname2,
|
|
8342
8681
|
relative as relative2,
|
|
@@ -8346,7 +8685,7 @@ import {
|
|
|
8346
8685
|
} from "node:path";
|
|
8347
8686
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8348
8687
|
function getDirnameFromUrl(importMetaUrl) {
|
|
8349
|
-
return
|
|
8688
|
+
return dirname3(fileURLToPath2(importMetaUrl));
|
|
8350
8689
|
}
|
|
8351
8690
|
function detectExecutionMode() {
|
|
8352
8691
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
@@ -8362,7 +8701,7 @@ function getTemplatesRoot() {
|
|
|
8362
8701
|
const mode = detectExecutionMode();
|
|
8363
8702
|
if (mode === "development") {
|
|
8364
8703
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
8365
|
-
const frameworkRoot = normalizePath(
|
|
8704
|
+
const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
|
|
8366
8705
|
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8367
8706
|
} else {
|
|
8368
8707
|
try {
|
|
@@ -8378,7 +8717,7 @@ function getTemplatesRoot() {
|
|
|
8378
8717
|
try {
|
|
8379
8718
|
const req = createRequire2(import.meta.url);
|
|
8380
8719
|
const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
|
|
8381
|
-
const cliRoot2 = normalizePath(
|
|
8720
|
+
const cliRoot2 = normalizePath(dirname3(cliPackageJsonPath));
|
|
8382
8721
|
const templatesPath = normalizePath(cliRoot2, "templates");
|
|
8383
8722
|
if (pathExists(templatesPath)) {
|
|
8384
8723
|
return templatesPath;
|
|
@@ -8430,8 +8769,8 @@ async function glob(pattern, options = {}) {
|
|
|
8430
8769
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8431
8770
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8432
8771
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8433
|
-
const relativePatterns = patterns.map((
|
|
8434
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
8772
|
+
const relativePatterns = patterns.map((p) => {
|
|
8773
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8435
8774
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8436
8775
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8437
8776
|
}
|
|
@@ -8457,8 +8796,8 @@ function globSync(pattern, options = {}) {
|
|
|
8457
8796
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8458
8797
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8459
8798
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8460
|
-
const relativePatterns = patterns.map((
|
|
8461
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
8799
|
+
const relativePatterns = patterns.map((p) => {
|
|
8800
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8462
8801
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8463
8802
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8464
8803
|
}
|
|
@@ -8482,7 +8821,7 @@ function globSync(pattern, options = {}) {
|
|
|
8482
8821
|
globstar: true,
|
|
8483
8822
|
throwErrorOnBrokenSymbolicLink: options.throwErrorOnBrokenSymbolicLink
|
|
8484
8823
|
});
|
|
8485
|
-
return results.map((
|
|
8824
|
+
return results.map((p) => pathResolverInstance.normalizePath(p));
|
|
8486
8825
|
}
|
|
8487
8826
|
var pathResolverInstance, getRepoRoot, getAppRoot, resolveFrameworkPackage, normalizePath, pathExists, read, readSync, write, writeSync, removeSync, ensureDir, getRelativePathBetween, getDirname, joinPath;
|
|
8488
8827
|
var init_pathResolver = __esm({
|
|
@@ -8495,7 +8834,7 @@ var init_pathResolver = __esm({
|
|
|
8495
8834
|
getAppRoot = () => pathResolverInstance.getAppRoot();
|
|
8496
8835
|
resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
|
|
8497
8836
|
normalizePath = (...pathSegments) => {
|
|
8498
|
-
return pathResolverInstance.normalizePath(
|
|
8837
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8499
8838
|
};
|
|
8500
8839
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8501
8840
|
read = async (filePath, options) => pathResolverInstance.read(filePath, options);
|
|
@@ -8508,7 +8847,7 @@ var init_pathResolver = __esm({
|
|
|
8508
8847
|
return normalizePath(relative2(from, to));
|
|
8509
8848
|
};
|
|
8510
8849
|
getDirname = (filePath) => {
|
|
8511
|
-
return normalizePath(
|
|
8850
|
+
return normalizePath(dirname3(filePath));
|
|
8512
8851
|
};
|
|
8513
8852
|
joinPath = (...pathSegments) => {
|
|
8514
8853
|
return normalizePath(...pathSegments);
|
|
@@ -8517,10 +8856,10 @@ var init_pathResolver = __esm({
|
|
|
8517
8856
|
});
|
|
8518
8857
|
|
|
8519
8858
|
// packages/tooling/src/bundler/utils.ts
|
|
8520
|
-
import { Buffer } from "node:buffer";
|
|
8859
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8521
8860
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8522
8861
|
import { createRequire as createRequire3 } from "node:module";
|
|
8523
|
-
import { dirname as
|
|
8862
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8524
8863
|
import process from "node:process";
|
|
8525
8864
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8526
8865
|
var require2, __filename, __dirname;
|
|
@@ -8529,12 +8868,12 @@ var init_utils2 = __esm({
|
|
|
8529
8868
|
"use strict";
|
|
8530
8869
|
require2 = createRequire3(import.meta.url);
|
|
8531
8870
|
__filename = fileURLToPath3(import.meta.url);
|
|
8532
|
-
__dirname =
|
|
8871
|
+
__dirname = dirname4(__filename);
|
|
8533
8872
|
if (typeof globalThis !== "undefined") {
|
|
8534
8873
|
globalThis.require = require2;
|
|
8535
8874
|
globalThis.__filename = __filename;
|
|
8536
8875
|
globalThis.__dirname = __dirname;
|
|
8537
|
-
globalThis.Buffer =
|
|
8876
|
+
globalThis.Buffer = Buffer2;
|
|
8538
8877
|
globalThis.process = process;
|
|
8539
8878
|
if (typeof global === "undefined") {
|
|
8540
8879
|
globalThis.global = globalThis;
|
|
@@ -8545,12 +8884,12 @@ var init_utils2 = __esm({
|
|
|
8545
8884
|
|
|
8546
8885
|
// packages/tooling/src/utils/cli-input.ts
|
|
8547
8886
|
async function askForConfirmation(message, defaultValue = false) {
|
|
8548
|
-
const result = await
|
|
8887
|
+
const result = await confirm({
|
|
8549
8888
|
message,
|
|
8550
8889
|
initialValue: defaultValue
|
|
8551
8890
|
});
|
|
8552
|
-
if (
|
|
8553
|
-
|
|
8891
|
+
if (isCancel(result)) {
|
|
8892
|
+
cancel("Operation cancelled.");
|
|
8554
8893
|
process.exit(0);
|
|
8555
8894
|
}
|
|
8556
8895
|
return result;
|
|
@@ -8561,14 +8900,14 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
|
8561
8900
|
label: choice.title,
|
|
8562
8901
|
hint: choice.hint
|
|
8563
8902
|
}));
|
|
8564
|
-
const initialValues = defaultIndices.map((
|
|
8565
|
-
const result = await
|
|
8903
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
|
|
8904
|
+
const result = await multiselect({
|
|
8566
8905
|
message,
|
|
8567
8906
|
options,
|
|
8568
8907
|
initialValues: initialValues.length > 0 ? initialValues : void 0
|
|
8569
8908
|
});
|
|
8570
|
-
if (
|
|
8571
|
-
|
|
8909
|
+
if (isCancel(result)) {
|
|
8910
|
+
cancel("Operation cancelled.");
|
|
8572
8911
|
process.exit(0);
|
|
8573
8912
|
}
|
|
8574
8913
|
return result;
|
|
@@ -8658,25 +8997,25 @@ function clearMatrixCache() {
|
|
|
8658
8997
|
}
|
|
8659
8998
|
function flattenGroups(groups, options) {
|
|
8660
8999
|
const flat = {};
|
|
8661
|
-
for (const
|
|
8662
|
-
if (options?.skipRootExclude &&
|
|
8663
|
-
for (const [name, version] of Object.entries(
|
|
9000
|
+
for (const group2 of Object.values(groups)) {
|
|
9001
|
+
if (options?.skipRootExclude && group2.rootExclude) continue;
|
|
9002
|
+
for (const [name, version] of Object.entries(group2.packages ?? {})) {
|
|
8664
9003
|
flat[name] = version;
|
|
8665
9004
|
}
|
|
8666
9005
|
}
|
|
8667
9006
|
return flat;
|
|
8668
9007
|
}
|
|
8669
9008
|
function resolveGroup(groupName, matrix) {
|
|
8670
|
-
const
|
|
8671
|
-
if (!
|
|
9009
|
+
const group2 = matrix.groups[groupName];
|
|
9010
|
+
if (!group2) return {};
|
|
8672
9011
|
const result = {};
|
|
8673
|
-
if (
|
|
8674
|
-
for (const included of
|
|
9012
|
+
if (group2.includes) {
|
|
9013
|
+
for (const included of group2.includes) {
|
|
8675
9014
|
Object.assign(result, resolveGroup(included, matrix));
|
|
8676
9015
|
}
|
|
8677
9016
|
}
|
|
8678
|
-
if (
|
|
8679
|
-
Object.assign(result,
|
|
9017
|
+
if (group2.packages) {
|
|
9018
|
+
Object.assign(result, group2.packages);
|
|
8680
9019
|
}
|
|
8681
9020
|
return result;
|
|
8682
9021
|
}
|
|
@@ -8751,24 +9090,24 @@ function ensureCaretPrefix(version) {
|
|
|
8751
9090
|
return `^${version}`;
|
|
8752
9091
|
}
|
|
8753
9092
|
function compareVersions(current, expected) {
|
|
8754
|
-
const
|
|
9093
|
+
const c = normalizeVersion(current).split(".").map(Number);
|
|
8755
9094
|
const e = normalizeVersion(expected).split(".").map(Number);
|
|
8756
|
-
for (let
|
|
8757
|
-
const cv =
|
|
8758
|
-
const ev = e[
|
|
9095
|
+
for (let i2 = 0; i2 < Math.max(c.length, e.length); i2++) {
|
|
9096
|
+
const cv = c[i2] || 0;
|
|
9097
|
+
const ev = e[i2] || 0;
|
|
8759
9098
|
if (cv < ev)
|
|
8760
9099
|
return {
|
|
8761
9100
|
behind: true,
|
|
8762
9101
|
ahead: false,
|
|
8763
9102
|
equal: false,
|
|
8764
|
-
isMajor: (
|
|
9103
|
+
isMajor: (c[0] || 0) !== (e[0] || 0)
|
|
8765
9104
|
};
|
|
8766
9105
|
if (cv > ev)
|
|
8767
9106
|
return {
|
|
8768
9107
|
behind: false,
|
|
8769
9108
|
ahead: true,
|
|
8770
9109
|
equal: false,
|
|
8771
|
-
isMajor: (
|
|
9110
|
+
isMajor: (c[0] || 0) !== (e[0] || 0)
|
|
8772
9111
|
};
|
|
8773
9112
|
}
|
|
8774
9113
|
return { behind: false, ahead: false, equal: true, isMajor: false };
|
|
@@ -8794,8 +9133,8 @@ function syncDonotdevToMatrix(matrix, donotdevVersions, dryRun) {
|
|
|
8794
9133
|
for (const [pkgName, actualVersion] of Object.entries(donotdevVersions)) {
|
|
8795
9134
|
if (!pkgName.startsWith("@donotdev/")) continue;
|
|
8796
9135
|
if (INTERNAL_BUNDLED_PACKAGES.has(pkgName)) continue;
|
|
8797
|
-
const
|
|
8798
|
-
if (!
|
|
9136
|
+
const group2 = matrix.groups[pkgName];
|
|
9137
|
+
if (!group2) {
|
|
8799
9138
|
matrix.groups[pkgName] = {
|
|
8800
9139
|
description: `${pkgName.replace("@donotdev/", "").charAt(0).toUpperCase() + pkgName.replace("@donotdev/", "").slice(1)} package`,
|
|
8801
9140
|
packages: { [pkgName]: `^${actualVersion}` }
|
|
@@ -8803,7 +9142,7 @@ function syncDonotdevToMatrix(matrix, donotdevVersions, dryRun) {
|
|
|
8803
9142
|
changes.push({ pkg: pkgName, from: "N/A", to: `^${actualVersion}` });
|
|
8804
9143
|
continue;
|
|
8805
9144
|
}
|
|
8806
|
-
const packages =
|
|
9145
|
+
const packages = group2.packages ??= {};
|
|
8807
9146
|
const matrixVersion = packages[pkgName];
|
|
8808
9147
|
if (!matrixVersion) {
|
|
8809
9148
|
packages[pkgName] = `^${actualVersion}`;
|
|
@@ -9012,9 +9351,9 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9012
9351
|
}
|
|
9013
9352
|
if (mode === "published") {
|
|
9014
9353
|
const overrides = {};
|
|
9015
|
-
for (const [groupName,
|
|
9354
|
+
for (const [groupName, group2] of Object.entries(matrix.groups || {})) {
|
|
9016
9355
|
if (groupName.startsWith("@donotdev/")) {
|
|
9017
|
-
const version =
|
|
9356
|
+
const version = group2.packages?.[groupName];
|
|
9018
9357
|
if (version) {
|
|
9019
9358
|
overrides[groupName] = version.replace(/^\^/, "");
|
|
9020
9359
|
}
|
|
@@ -9081,11 +9420,11 @@ function syncPackageJson(appName, destRoot, dryRun) {
|
|
|
9081
9420
|
const existing = parsePackageJson(packageJsonPath);
|
|
9082
9421
|
if (!existing) {
|
|
9083
9422
|
if (dryRun) {
|
|
9084
|
-
|
|
9423
|
+
log2.info(`[DRY RUN] Would regenerate: apps/${appName}/package.json`);
|
|
9085
9424
|
return true;
|
|
9086
9425
|
}
|
|
9087
9426
|
writePackageJson(packageJsonPath, newPkg);
|
|
9088
|
-
|
|
9427
|
+
log2.info(`Regenerated: apps/${appName}/package.json`);
|
|
9089
9428
|
return true;
|
|
9090
9429
|
}
|
|
9091
9430
|
let changed = false;
|
|
@@ -9104,22 +9443,22 @@ function syncPackageJson(appName, destRoot, dryRun) {
|
|
|
9104
9443
|
}
|
|
9105
9444
|
if (changed) {
|
|
9106
9445
|
if (dryRun) {
|
|
9107
|
-
|
|
9446
|
+
log2.info(
|
|
9108
9447
|
`[DRY RUN] Would update deps in: apps/${appName}/package.json`
|
|
9109
9448
|
);
|
|
9110
9449
|
} else {
|
|
9111
9450
|
writePackageJson(packageJsonPath, existing);
|
|
9112
|
-
|
|
9451
|
+
log2.info(`Updated deps: apps/${appName}/package.json`);
|
|
9113
9452
|
}
|
|
9114
9453
|
}
|
|
9115
9454
|
return changed;
|
|
9116
9455
|
}
|
|
9117
9456
|
if (dryRun) {
|
|
9118
|
-
|
|
9457
|
+
log2.info(`[DRY RUN] Would create: apps/${appName}/package.json`);
|
|
9119
9458
|
return true;
|
|
9120
9459
|
}
|
|
9121
9460
|
writePackageJson(packageJsonPath, newPkg);
|
|
9122
|
-
|
|
9461
|
+
log2.info(`Created: apps/${appName}/package.json`);
|
|
9123
9462
|
return true;
|
|
9124
9463
|
}
|
|
9125
9464
|
async function syncApp(appName, options = {}) {
|
|
@@ -9129,19 +9468,19 @@ async function syncApp(appName, options = {}) {
|
|
|
9129
9468
|
let errors = 0;
|
|
9130
9469
|
const appRoot = getAppRoot();
|
|
9131
9470
|
if (!appRoot) {
|
|
9132
|
-
|
|
9471
|
+
log2.error("Could not determine project root");
|
|
9133
9472
|
return { synced, preserved, errors: 1 };
|
|
9134
9473
|
}
|
|
9135
9474
|
const sourceRoot = getAppTemplateSource(appName);
|
|
9136
9475
|
if (!sourceRoot) {
|
|
9137
|
-
|
|
9476
|
+
log2.warn(
|
|
9138
9477
|
`Template for app-${appName} not found. Is @donotdev/cli installed?`
|
|
9139
9478
|
);
|
|
9140
9479
|
return { synced, preserved, errors: 1 };
|
|
9141
9480
|
}
|
|
9142
9481
|
const destRoot = normalizePath(joinPath(appRoot, "apps", appName));
|
|
9143
9482
|
if (!pathExists(destRoot)) {
|
|
9144
|
-
|
|
9483
|
+
log2.info(`apps/${appName}/ does not exist \u2014 creating from template`);
|
|
9145
9484
|
if (!dryRun) {
|
|
9146
9485
|
await ensureDir(destRoot);
|
|
9147
9486
|
}
|
|
@@ -9152,7 +9491,7 @@ async function syncApp(appName, options = {}) {
|
|
|
9152
9491
|
}
|
|
9153
9492
|
} catch (error2) {
|
|
9154
9493
|
errors++;
|
|
9155
|
-
|
|
9494
|
+
log2.error(
|
|
9156
9495
|
`Error generating package.json for apps/${appName}:`,
|
|
9157
9496
|
DoNotDevError.from(
|
|
9158
9497
|
error2,
|
|
@@ -9173,7 +9512,7 @@ async function syncApp(appName, options = {}) {
|
|
|
9173
9512
|
sourceRoot + "/",
|
|
9174
9513
|
""
|
|
9175
9514
|
);
|
|
9176
|
-
if (SKIP_PATTERNS.some((
|
|
9515
|
+
if (SKIP_PATTERNS.some((p) => relativePath.includes(p))) {
|
|
9177
9516
|
continue;
|
|
9178
9517
|
}
|
|
9179
9518
|
const destRelative = relativePath.endsWith(".example") ? relativePath.slice(0, -8) : relativePath;
|
|
@@ -9183,9 +9522,9 @@ async function syncApp(appName, options = {}) {
|
|
|
9183
9522
|
);
|
|
9184
9523
|
if (shouldPreserve && pathExists(destFile)) {
|
|
9185
9524
|
if (dryRun) {
|
|
9186
|
-
|
|
9525
|
+
log2.info(`[DRY RUN] Would preserve: apps/${appName}/${destRelative}`);
|
|
9187
9526
|
} else {
|
|
9188
|
-
|
|
9527
|
+
log2.info(`Preserving: apps/${appName}/${destRelative}`);
|
|
9189
9528
|
}
|
|
9190
9529
|
preserved++;
|
|
9191
9530
|
continue;
|
|
@@ -9198,17 +9537,17 @@ async function syncApp(appName, options = {}) {
|
|
|
9198
9537
|
if (existing === content) continue;
|
|
9199
9538
|
}
|
|
9200
9539
|
if (dryRun) {
|
|
9201
|
-
|
|
9540
|
+
log2.info(`[DRY RUN] Would sync: apps/${appName}/${destRelative}`);
|
|
9202
9541
|
} else {
|
|
9203
9542
|
await ensureDir(getDirname(destFile));
|
|
9204
9543
|
await write(destFile, content, { format: "text", overwrite: true });
|
|
9205
|
-
|
|
9544
|
+
log2.info(`Synced: apps/${appName}/${destRelative}`);
|
|
9206
9545
|
}
|
|
9207
9546
|
synced++;
|
|
9208
9547
|
}
|
|
9209
9548
|
} catch (error2) {
|
|
9210
9549
|
errors++;
|
|
9211
|
-
|
|
9550
|
+
log2.error(
|
|
9212
9551
|
`Error syncing app-${appName}:`,
|
|
9213
9552
|
DoNotDevError.from(
|
|
9214
9553
|
error2,
|
|
@@ -9276,11 +9615,11 @@ function getSourceTemplatesPath() {
|
|
|
9276
9615
|
"root-consumer"
|
|
9277
9616
|
);
|
|
9278
9617
|
if (pathExists(directPath)) {
|
|
9279
|
-
|
|
9618
|
+
log2.info("Found templates via node_modules lookup");
|
|
9280
9619
|
return normalizePath(directPath);
|
|
9281
9620
|
}
|
|
9282
9621
|
}
|
|
9283
|
-
|
|
9622
|
+
log2.warn(
|
|
9284
9623
|
"Could not find @donotdev/cli templates. Is @donotdev/cli installed?"
|
|
9285
9624
|
);
|
|
9286
9625
|
return null;
|
|
@@ -9292,16 +9631,16 @@ async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
|
|
|
9292
9631
|
appRoot,
|
|
9293
9632
|
destPathWithoutExample
|
|
9294
9633
|
);
|
|
9295
|
-
|
|
9634
|
+
log2.info(`Preserving user-customized file: ${relativePath}`);
|
|
9296
9635
|
return false;
|
|
9297
9636
|
}
|
|
9298
9637
|
if (!pathExists(sourcePath)) {
|
|
9299
|
-
|
|
9638
|
+
log2.warn(`Source file not found: ${sourcePath}`);
|
|
9300
9639
|
return false;
|
|
9301
9640
|
}
|
|
9302
9641
|
const content = await read(sourcePath, { format: "text" });
|
|
9303
9642
|
if (!content) {
|
|
9304
|
-
|
|
9643
|
+
log2.warn(`Source file is empty: ${sourcePath}`);
|
|
9305
9644
|
return false;
|
|
9306
9645
|
}
|
|
9307
9646
|
if (pathExists(destPathWithoutExample)) {
|
|
@@ -9348,14 +9687,14 @@ async function syncTemplates(sourceRoot, destRoot, dryRun) {
|
|
|
9348
9687
|
normalizedDestRoot,
|
|
9349
9688
|
destWithoutExample
|
|
9350
9689
|
);
|
|
9351
|
-
|
|
9690
|
+
log2.info(`[DRY RUN] Would preserve: ${relativeDest}`);
|
|
9352
9691
|
preserved++;
|
|
9353
9692
|
} else {
|
|
9354
9693
|
const relativeDest = getRelativePathBetween(
|
|
9355
9694
|
normalizedDestRoot,
|
|
9356
9695
|
destWithoutExample
|
|
9357
9696
|
);
|
|
9358
|
-
|
|
9697
|
+
log2.info(`[DRY RUN] Would sync: ${relativeDest}`);
|
|
9359
9698
|
synced++;
|
|
9360
9699
|
}
|
|
9361
9700
|
} else {
|
|
@@ -9371,7 +9710,7 @@ async function syncTemplates(sourceRoot, destRoot, dryRun) {
|
|
|
9371
9710
|
normalizedDestRoot,
|
|
9372
9711
|
destWithoutExample
|
|
9373
9712
|
);
|
|
9374
|
-
|
|
9713
|
+
log2.info(`Synced: ${relativeDest}`);
|
|
9375
9714
|
} else if (shouldPreserve && pathExists(destWithoutExample)) {
|
|
9376
9715
|
preserved++;
|
|
9377
9716
|
}
|
|
@@ -9379,7 +9718,7 @@ async function syncTemplates(sourceRoot, destRoot, dryRun) {
|
|
|
9379
9718
|
}
|
|
9380
9719
|
} catch (error2) {
|
|
9381
9720
|
errors++;
|
|
9382
|
-
|
|
9721
|
+
log2.error(
|
|
9383
9722
|
`Error syncing pattern ${pattern}:`,
|
|
9384
9723
|
DoNotDevError.from(
|
|
9385
9724
|
error2,
|
|
@@ -9394,50 +9733,50 @@ async function syncTemplates(sourceRoot, destRoot, dryRun) {
|
|
|
9394
9733
|
async function syncDocumentation(options = {}) {
|
|
9395
9734
|
const { dryRun } = options;
|
|
9396
9735
|
if (dryRun) {
|
|
9397
|
-
|
|
9736
|
+
log2.info("\u{1F50D} DRY RUN MODE - No files will be modified");
|
|
9398
9737
|
}
|
|
9399
9738
|
const appRoot = getAppRoot();
|
|
9400
9739
|
if (!appRoot) {
|
|
9401
|
-
|
|
9740
|
+
log2.error("Could not determine project root");
|
|
9402
9741
|
return 1;
|
|
9403
9742
|
}
|
|
9404
9743
|
const sourceRoot = getSourceTemplatesPath();
|
|
9405
9744
|
if (!sourceRoot) {
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9745
|
+
log2.error("Could not find framework templates. Documentation sync failed.");
|
|
9746
|
+
log2.info("");
|
|
9747
|
+
log2.info(" Templates are looked up the same way as create-project:");
|
|
9748
|
+
log2.info(" \u2022 Published mode: node_modules/@donotdev/cli/templates");
|
|
9749
|
+
log2.info(" \u2022 Dev mode: packages/cli/templates (from monorepo)");
|
|
9750
|
+
log2.info("");
|
|
9751
|
+
log2.info(" To enable docs sync:");
|
|
9752
|
+
log2.info(" \u2022 Install @donotdev/cli: bun add -D @donotdev/cli");
|
|
9753
|
+
log2.info(" \u2022 Or run from framework monorepo (dev mode)");
|
|
9415
9754
|
return 1;
|
|
9416
9755
|
}
|
|
9417
|
-
|
|
9418
|
-
|
|
9756
|
+
log2.info(`Source templates: ${sourceRoot}`);
|
|
9757
|
+
log2.info(`Destination: ${appRoot}`);
|
|
9419
9758
|
const result = await syncTemplates(sourceRoot, appRoot, dryRun || false);
|
|
9420
9759
|
if (dryRun) {
|
|
9421
|
-
|
|
9760
|
+
log2.info(`
|
|
9422
9761
|
[DRY RUN] Would sync ${result.synced} file(s)`);
|
|
9423
9762
|
if (result.preserved > 0) {
|
|
9424
|
-
|
|
9763
|
+
log2.info(
|
|
9425
9764
|
`[DRY RUN] Would preserve ${result.preserved} user-customized file(s)`
|
|
9426
9765
|
);
|
|
9427
9766
|
}
|
|
9428
|
-
|
|
9767
|
+
log2.info("[DRY RUN] No files modified");
|
|
9429
9768
|
} else {
|
|
9430
9769
|
if (result.synced > 0) {
|
|
9431
|
-
|
|
9770
|
+
log2.success(`
|
|
9432
9771
|
\u2705 Synced ${result.synced} file(s) from framework`);
|
|
9433
9772
|
} else {
|
|
9434
|
-
|
|
9773
|
+
log2.info("\n\u2705 All documentation up to date");
|
|
9435
9774
|
}
|
|
9436
9775
|
if (result.preserved > 0) {
|
|
9437
|
-
|
|
9776
|
+
log2.info(`\u2139\uFE0F Preserved ${result.preserved} user-customized file(s)`);
|
|
9438
9777
|
}
|
|
9439
9778
|
if (result.errors > 0) {
|
|
9440
|
-
|
|
9779
|
+
log2.warn(`\u26A0\uFE0F ${result.errors} error(s) occurred during sync`);
|
|
9441
9780
|
return 1;
|
|
9442
9781
|
}
|
|
9443
9782
|
}
|
|
@@ -9505,22 +9844,22 @@ function padEnd(str, len) {
|
|
|
9505
9844
|
}
|
|
9506
9845
|
function formatUpdateTable(updates, appRoot) {
|
|
9507
9846
|
const seen = /* @__PURE__ */ new Map();
|
|
9508
|
-
for (const
|
|
9509
|
-
if (!seen.has(
|
|
9847
|
+
for (const u3 of updates) {
|
|
9848
|
+
if (!seen.has(u3.pkg) || u3.isMajor) seen.set(u3.pkg, u3);
|
|
9510
9849
|
}
|
|
9511
9850
|
const unique = Array.from(seen.values());
|
|
9512
|
-
const maxName = Math.max(...unique.map((
|
|
9513
|
-
const maxCurrent = Math.max(...unique.map((
|
|
9514
|
-
const lines = unique.map((
|
|
9515
|
-
const normalizedLatest = normalizeVersion(
|
|
9851
|
+
const maxName = Math.max(...unique.map((u3) => u3.pkg.length));
|
|
9852
|
+
const maxCurrent = Math.max(...unique.map((u3) => u3.current.length));
|
|
9853
|
+
const lines = unique.map((u3) => {
|
|
9854
|
+
const normalizedLatest = normalizeVersion(u3.latest);
|
|
9516
9855
|
const displayLatest = ensureCaretPrefix(normalizedLatest);
|
|
9517
|
-
const major =
|
|
9518
|
-
return ` ${padEnd(
|
|
9856
|
+
const major = u3.isMajor ? " MAJOR" : "";
|
|
9857
|
+
return ` ${padEnd(u3.pkg, maxName)} ${padEnd(u3.current, maxCurrent)} -> ${displayLatest}${major}`;
|
|
9519
9858
|
});
|
|
9520
9859
|
const affectedFiles = /* @__PURE__ */ new Set();
|
|
9521
|
-
for (const
|
|
9860
|
+
for (const u3 of updates) {
|
|
9522
9861
|
affectedFiles.add(
|
|
9523
|
-
appRoot ? getRelativePathBetween(appRoot,
|
|
9862
|
+
appRoot ? getRelativePathBetween(appRoot, u3.file) : u3.file
|
|
9524
9863
|
);
|
|
9525
9864
|
}
|
|
9526
9865
|
lines.push(` Affects: ${Array.from(affectedFiles).join(", ")}`);
|
|
@@ -9528,11 +9867,11 @@ function formatUpdateTable(updates, appRoot) {
|
|
|
9528
9867
|
}
|
|
9529
9868
|
function formatDeprecatedList(deprecated, appRoot) {
|
|
9530
9869
|
const lines = [];
|
|
9531
|
-
for (const
|
|
9532
|
-
lines.push(` ${
|
|
9533
|
-
const locs =
|
|
9534
|
-
const rel = appRoot ? getRelativePathBetween(appRoot,
|
|
9535
|
-
return `${rel} (${
|
|
9870
|
+
for (const d of deprecated) {
|
|
9871
|
+
lines.push(` ${d.name} \u2014 ${d.message}`);
|
|
9872
|
+
const locs = d.locations.map((l2) => {
|
|
9873
|
+
const rel = appRoot ? getRelativePathBetween(appRoot, l2.file) : l2.file;
|
|
9874
|
+
return `${rel} (${l2.field})`;
|
|
9536
9875
|
});
|
|
9537
9876
|
lines.push(` Found in: ${locs.join(", ")}`);
|
|
9538
9877
|
}
|
|
@@ -9541,23 +9880,23 @@ function formatDeprecatedList(deprecated, appRoot) {
|
|
|
9541
9880
|
function applyUpdates(updates, appRoot) {
|
|
9542
9881
|
const updatedFiles = /* @__PURE__ */ new Map();
|
|
9543
9882
|
let syncedPins = 0;
|
|
9544
|
-
for (const
|
|
9545
|
-
if (!updatedFiles.has(
|
|
9546
|
-
updatedFiles.set(
|
|
9883
|
+
for (const u3 of updates) {
|
|
9884
|
+
if (!updatedFiles.has(u3.file)) {
|
|
9885
|
+
updatedFiles.set(u3.file, /* @__PURE__ */ new Set());
|
|
9547
9886
|
}
|
|
9548
|
-
updatedFiles.get(
|
|
9887
|
+
updatedFiles.get(u3.file).add(`${u3.pkg}:${u3.field}`);
|
|
9549
9888
|
}
|
|
9550
9889
|
for (const [file, packageKeys] of updatedFiles) {
|
|
9551
9890
|
const pkg = parsePackageJson(file);
|
|
9552
9891
|
if (!pkg) {
|
|
9553
|
-
|
|
9892
|
+
log2.warn(`Could not parse ${file} \u2014 skipping`);
|
|
9554
9893
|
continue;
|
|
9555
9894
|
}
|
|
9556
9895
|
let changed = false;
|
|
9557
9896
|
for (const packageKey of packageKeys) {
|
|
9558
9897
|
const [pkgName, field] = packageKey.split(":");
|
|
9559
9898
|
const update = updates.find(
|
|
9560
|
-
(
|
|
9899
|
+
(u3) => u3.file === file && u3.pkg === pkgName && u3.field === field
|
|
9561
9900
|
);
|
|
9562
9901
|
if (!update) continue;
|
|
9563
9902
|
const deps = pkg[field];
|
|
@@ -9570,10 +9909,10 @@ function applyUpdates(updates, appRoot) {
|
|
|
9570
9909
|
for (const pinField of ["overrides", "resolutions"]) {
|
|
9571
9910
|
const pinDeps = pkg[pinField];
|
|
9572
9911
|
if (!pinDeps) continue;
|
|
9573
|
-
for (const
|
|
9574
|
-
if (
|
|
9575
|
-
const normalizedLatest = normalizeVersion(
|
|
9576
|
-
pinDeps[
|
|
9912
|
+
for (const u3 of updates) {
|
|
9913
|
+
if (u3.file === file && u3.pkg.startsWith("@donotdev/") && u3.field !== pinField && pinDeps[u3.pkg]) {
|
|
9914
|
+
const normalizedLatest = normalizeVersion(u3.latest);
|
|
9915
|
+
pinDeps[u3.pkg] = normalizedLatest;
|
|
9577
9916
|
changed = true;
|
|
9578
9917
|
syncedPins++;
|
|
9579
9918
|
}
|
|
@@ -9587,10 +9926,10 @@ function applyUpdates(updates, appRoot) {
|
|
|
9587
9926
|
}
|
|
9588
9927
|
function removeDeprecated(deprecated) {
|
|
9589
9928
|
const byFile = /* @__PURE__ */ new Map();
|
|
9590
|
-
for (const
|
|
9591
|
-
for (const loc of
|
|
9929
|
+
for (const d of deprecated) {
|
|
9930
|
+
for (const loc of d.locations) {
|
|
9592
9931
|
if (!byFile.has(loc.file)) byFile.set(loc.file, []);
|
|
9593
|
-
byFile.get(loc.file).push({ name:
|
|
9932
|
+
byFile.get(loc.file).push({ name: d.name, field: loc.field });
|
|
9594
9933
|
}
|
|
9595
9934
|
}
|
|
9596
9935
|
let removed = 0;
|
|
@@ -9634,11 +9973,11 @@ function runBunInstall(appRoot) {
|
|
|
9634
9973
|
}
|
|
9635
9974
|
async function main(options = {}) {
|
|
9636
9975
|
const { dryRun } = options;
|
|
9637
|
-
|
|
9638
|
-
if (dryRun)
|
|
9976
|
+
intro("Bump \u2014 Update packages and sync project");
|
|
9977
|
+
if (dryRun) log2.info("DRY RUN MODE \u2014 no files will be modified");
|
|
9639
9978
|
const appRoot = getAppRoot();
|
|
9640
9979
|
if (!appRoot) {
|
|
9641
|
-
|
|
9980
|
+
log2.error("Could not determine project root");
|
|
9642
9981
|
return 1;
|
|
9643
9982
|
}
|
|
9644
9983
|
let updatePackages = false;
|
|
@@ -9689,9 +10028,9 @@ async function main(options = {}) {
|
|
|
9689
10028
|
absolute: true
|
|
9690
10029
|
});
|
|
9691
10030
|
if (files.length === 0) {
|
|
9692
|
-
|
|
10031
|
+
log2.warn("No package.json files found");
|
|
9693
10032
|
} else {
|
|
9694
|
-
const s =
|
|
10033
|
+
const s = spinner();
|
|
9695
10034
|
s.start(`Scanning ${files.length} package.json file(s)...`);
|
|
9696
10035
|
const { frameworkPkgs, externalDeps, packageOccurrences } = detectProjectDeps(files);
|
|
9697
10036
|
s.message("Querying npm registry...");
|
|
@@ -9702,7 +10041,7 @@ async function main(options = {}) {
|
|
|
9702
10041
|
`Found ${frameworkPkgs.size} framework + ${externalDeps.size} external package(s)`
|
|
9703
10042
|
);
|
|
9704
10043
|
if (!matrixResult && externalDeps.size > 0) {
|
|
9705
|
-
|
|
10044
|
+
log2.info(
|
|
9706
10045
|
"Matrix not found \u2014 only @donotdev/* packages will be checked"
|
|
9707
10046
|
);
|
|
9708
10047
|
}
|
|
@@ -9766,34 +10105,34 @@ async function main(options = {}) {
|
|
|
9766
10105
|
}
|
|
9767
10106
|
const hasAnything = frameworkUpdates.length > 0 || externalMinorUpdates.length > 0 || majorUpdates.length > 0 || deprecatedPkgs.length > 0;
|
|
9768
10107
|
if (!hasAnything) {
|
|
9769
|
-
|
|
10108
|
+
log2.success("All packages up to date!");
|
|
9770
10109
|
} else {
|
|
9771
10110
|
if (frameworkUpdates.length > 0) {
|
|
9772
|
-
|
|
10111
|
+
note(
|
|
9773
10112
|
formatUpdateTable(frameworkUpdates, appRoot),
|
|
9774
|
-
`@donotdev/* updates (${new Set(frameworkUpdates.map((
|
|
10113
|
+
`@donotdev/* updates (${new Set(frameworkUpdates.map((u3) => u3.pkg)).size})`
|
|
9775
10114
|
);
|
|
9776
10115
|
}
|
|
9777
10116
|
if (deprecatedPkgs.length > 0) {
|
|
9778
|
-
|
|
10117
|
+
note(
|
|
9779
10118
|
formatDeprecatedList(deprecatedPkgs, appRoot),
|
|
9780
10119
|
`Deprecated packages (${deprecatedPkgs.length})`
|
|
9781
10120
|
);
|
|
9782
10121
|
}
|
|
9783
10122
|
if (externalMinorUpdates.length > 0) {
|
|
9784
|
-
|
|
10123
|
+
note(
|
|
9785
10124
|
formatUpdateTable(externalMinorUpdates, appRoot),
|
|
9786
|
-
`External dep updates (${new Set(externalMinorUpdates.map((
|
|
10125
|
+
`External dep updates (${new Set(externalMinorUpdates.map((u3) => u3.pkg)).size})`
|
|
9787
10126
|
);
|
|
9788
10127
|
}
|
|
9789
10128
|
if (majorUpdates.length > 0) {
|
|
9790
|
-
|
|
10129
|
+
note(
|
|
9791
10130
|
formatUpdateTable(majorUpdates, appRoot),
|
|
9792
|
-
`MAJOR updates (${new Set(majorUpdates.map((
|
|
10131
|
+
`MAJOR updates (${new Set(majorUpdates.map((u3) => u3.pkg)).size})`
|
|
9793
10132
|
);
|
|
9794
10133
|
}
|
|
9795
10134
|
if (dryRun) {
|
|
9796
|
-
|
|
10135
|
+
log2.info("[DRY RUN] No files modified");
|
|
9797
10136
|
} else {
|
|
9798
10137
|
const allUpdates = [];
|
|
9799
10138
|
const summary = [];
|
|
@@ -9819,13 +10158,13 @@ async function main(options = {}) {
|
|
|
9819
10158
|
if (apply) allUpdates.push(...externalMinorUpdates);
|
|
9820
10159
|
}
|
|
9821
10160
|
if (majorUpdates.length > 0) {
|
|
9822
|
-
for (const
|
|
9823
|
-
if (
|
|
9824
|
-
|
|
10161
|
+
for (const u3 of majorUpdates) {
|
|
10162
|
+
if (u3.migrationPath) {
|
|
10163
|
+
log2.info(`Migration guide for ${u3.pkg}: ${u3.migrationPath}`);
|
|
9825
10164
|
}
|
|
9826
|
-
if (
|
|
9827
|
-
for (const bc of
|
|
9828
|
-
|
|
10165
|
+
if (u3.breakingChanges?.length) {
|
|
10166
|
+
for (const bc of u3.breakingChanges) {
|
|
10167
|
+
log2.warn(`Breaking: ${bc}`);
|
|
9829
10168
|
}
|
|
9830
10169
|
}
|
|
9831
10170
|
}
|
|
@@ -9874,63 +10213,63 @@ async function main(options = {}) {
|
|
|
9874
10213
|
}
|
|
9875
10214
|
}
|
|
9876
10215
|
}
|
|
9877
|
-
|
|
10216
|
+
note(summary.map((s2) => ` ${s2}`).join("\n"), "Done");
|
|
9878
10217
|
const shouldInstall = await askForConfirmation(
|
|
9879
10218
|
"Run bun install now?",
|
|
9880
10219
|
true
|
|
9881
10220
|
);
|
|
9882
10221
|
if (shouldInstall) {
|
|
9883
|
-
const installSpinner =
|
|
10222
|
+
const installSpinner = spinner();
|
|
9884
10223
|
installSpinner.start("Running bun install...");
|
|
9885
10224
|
const ok = runBunInstall(appRoot);
|
|
9886
10225
|
if (ok) {
|
|
9887
10226
|
installSpinner.stop("bun install completed");
|
|
9888
10227
|
} else {
|
|
9889
10228
|
installSpinner.stop("bun install failed");
|
|
9890
|
-
|
|
10229
|
+
log2.warn(
|
|
9891
10230
|
"bun install failed \u2014 run it manually to see the error"
|
|
9892
10231
|
);
|
|
9893
10232
|
}
|
|
9894
10233
|
}
|
|
9895
10234
|
} else {
|
|
9896
|
-
|
|
10235
|
+
log2.info("No changes applied");
|
|
9897
10236
|
}
|
|
9898
10237
|
}
|
|
9899
10238
|
}
|
|
9900
10239
|
}
|
|
9901
10240
|
}
|
|
9902
10241
|
if (updateDocs) {
|
|
9903
|
-
|
|
10242
|
+
log2.info("Syncing framework documentation...");
|
|
9904
10243
|
const syncResult = await syncDocumentation({ dryRun });
|
|
9905
10244
|
if (syncResult !== 0 && !dryRun) {
|
|
9906
|
-
|
|
10245
|
+
log2.warn("Some documentation files could not be synced");
|
|
9907
10246
|
}
|
|
9908
10247
|
}
|
|
9909
10248
|
if (updateDemoApp) {
|
|
9910
|
-
|
|
10249
|
+
log2.info("Syncing demo app...");
|
|
9911
10250
|
const result = await syncApp("demo", { dryRun });
|
|
9912
10251
|
if (result.synced > 0) {
|
|
9913
|
-
|
|
10252
|
+
log2.success(`Synced ${result.synced} file(s) in apps/demo`);
|
|
9914
10253
|
} else if (result.errors === 0) {
|
|
9915
|
-
|
|
10254
|
+
log2.info("Demo app up to date");
|
|
9916
10255
|
}
|
|
9917
10256
|
if (result.preserved > 0) {
|
|
9918
|
-
|
|
10257
|
+
log2.info(`Preserved ${result.preserved} customized file(s)`);
|
|
9919
10258
|
}
|
|
9920
10259
|
}
|
|
9921
10260
|
if (updateCockpitApp) {
|
|
9922
|
-
|
|
10261
|
+
log2.info("Syncing cockpit app...");
|
|
9923
10262
|
const result = await syncApp("dndev", { dryRun });
|
|
9924
10263
|
if (result.synced > 0) {
|
|
9925
|
-
|
|
10264
|
+
log2.success(`Synced ${result.synced} file(s) in apps/dndev`);
|
|
9926
10265
|
} else if (result.errors === 0) {
|
|
9927
|
-
|
|
10266
|
+
log2.info("Cockpit app up to date");
|
|
9928
10267
|
}
|
|
9929
10268
|
if (result.preserved > 0) {
|
|
9930
|
-
|
|
10269
|
+
log2.info(`Preserved ${result.preserved} customized file(s)`);
|
|
9931
10270
|
}
|
|
9932
10271
|
}
|
|
9933
|
-
|
|
10272
|
+
outro("");
|
|
9934
10273
|
return 0;
|
|
9935
10274
|
}
|
|
9936
10275
|
export {
|