@donotdev/cli 0.1.45 → 0.1.46
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 +9 -8
- package/dist/bin/commands/agent-setup.js +553 -509
- package/dist/bin/commands/build.js +1144 -908
- package/dist/bin/commands/bump.js +1206 -931
- package/dist/bin/commands/cacheout.js +464 -390
- package/dist/bin/commands/coach.js +467 -393
- package/dist/bin/commands/create-app.js +1118 -846
- package/dist/bin/commands/create-project.js +1158 -886
- package/dist/bin/commands/db.js +16351 -33069
- package/dist/bin/commands/deploy.js +2171 -1870
- package/dist/bin/commands/dev.js +833 -647
- package/dist/bin/commands/doctor.js +555 -511
- package/dist/bin/commands/emu.js +1014 -770
- package/dist/bin/commands/format.js +509 -435
- package/dist/bin/commands/get-demo.js +964 -741
- package/dist/bin/commands/make-admin.js +10368 -27067
- package/dist/bin/commands/preview.js +834 -648
- package/dist/bin/commands/seed.js +16352 -33070
- package/dist/bin/commands/setup-cicd.js +1050 -801
- package/dist/bin/commands/setup.js +1216 -944
- package/dist/bin/commands/staging.js +2171 -1870
- package/dist/bin/commands/sync-secrets.js +916 -717
- package/dist/bin/commands/type-check.js +654 -583
- package/dist/bin/commands/wai.js +454 -380
- package/dist/bin/dndev.js +2 -6
- package/dist/index.js +2582 -2223
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ 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');
|
|
@@ -33,31 +33,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
37
|
-
var
|
|
36
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
37
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
38
38
|
var init_utils = __esm({
|
|
39
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
39
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
40
40
|
init_utils2();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
42
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
43
|
+
return (input) => {
|
|
44
|
+
let surrogatePairsNr = 0;
|
|
45
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
46
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
47
|
+
surrogatePairsNr += 1;
|
|
48
|
+
}
|
|
49
|
+
return input.length - surrogatePairsNr;
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
44
52
|
isFullWidth = (x) => {
|
|
45
53
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
46
54
|
};
|
|
47
|
-
|
|
48
|
-
return x
|
|
55
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
56
|
+
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
57
|
};
|
|
50
58
|
}
|
|
51
59
|
});
|
|
52
60
|
|
|
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;
|
|
61
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
62
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
55
63
|
var init_dist = __esm({
|
|
56
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
64
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
57
65
|
init_utils2();
|
|
58
66
|
init_utils();
|
|
59
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
67
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
60
68
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
69
|
+
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
70
|
TAB_RE = /\t{1,1000}/y;
|
|
62
71
|
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
72
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -67,14 +76,21 @@ var init_dist = __esm({
|
|
|
67
76
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
68
77
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
69
78
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
70
|
-
const ANSI_WIDTH =
|
|
79
|
+
const ANSI_WIDTH = 0;
|
|
71
80
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
72
81
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
73
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
74
82
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
75
|
-
const FULL_WIDTH_WIDTH =
|
|
83
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
76
84
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
77
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
85
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
86
|
+
const PARSE_BLOCKS = [
|
|
87
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
88
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
89
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
90
|
+
[TAB_RE, TAB_WIDTH],
|
|
91
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
92
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
93
|
+
];
|
|
78
94
|
let indexPrev = 0;
|
|
79
95
|
let index = 0;
|
|
80
96
|
let length = input.length;
|
|
@@ -94,10 +110,8 @@ var init_dist = __esm({
|
|
|
94
110
|
const codePoint = char.codePointAt(0) || 0;
|
|
95
111
|
if (isFullWidth(codePoint)) {
|
|
96
112
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
97
|
-
} else if (
|
|
113
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
98
114
|
widthExtra = WIDE_WIDTH;
|
|
99
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
100
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
101
115
|
} else {
|
|
102
116
|
widthExtra = REGULAR_WIDTH;
|
|
103
117
|
}
|
|
@@ -113,88 +127,28 @@ var init_dist = __esm({
|
|
|
113
127
|
}
|
|
114
128
|
unmatchedStart = unmatchedEnd = 0;
|
|
115
129
|
}
|
|
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;
|
|
130
|
+
if (index >= length) {
|
|
131
|
+
break outer;
|
|
149
132
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (TAB_RE.test(input)) {
|
|
169
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
170
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
171
|
-
if (width + widthExtra > truncationLimit) {
|
|
172
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
173
|
-
}
|
|
174
|
-
if (width + widthExtra > LIMIT) {
|
|
175
|
-
truncationEnabled = true;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
width += widthExtra;
|
|
179
|
-
unmatchedStart = indexPrev;
|
|
180
|
-
unmatchedEnd = index;
|
|
181
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
EMOJI_RE.lastIndex = index;
|
|
185
|
-
if (EMOJI_RE.test(input)) {
|
|
186
|
-
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
187
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
188
|
-
}
|
|
189
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
190
|
-
truncationEnabled = true;
|
|
191
|
-
break;
|
|
133
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
134
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
135
|
+
BLOCK_RE.lastIndex = index;
|
|
136
|
+
if (BLOCK_RE.test(input)) {
|
|
137
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
138
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
139
|
+
if (width + widthExtra > truncationLimit) {
|
|
140
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
141
|
+
}
|
|
142
|
+
if (width + widthExtra > LIMIT) {
|
|
143
|
+
truncationEnabled = true;
|
|
144
|
+
break outer;
|
|
145
|
+
}
|
|
146
|
+
width += widthExtra;
|
|
147
|
+
unmatchedStart = indexPrev;
|
|
148
|
+
unmatchedEnd = index;
|
|
149
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
150
|
+
continue outer;
|
|
192
151
|
}
|
|
193
|
-
width += EMOJI_WIDTH;
|
|
194
|
-
unmatchedStart = indexPrev;
|
|
195
|
-
unmatchedEnd = index;
|
|
196
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
197
|
-
continue;
|
|
198
152
|
}
|
|
199
153
|
index += 1;
|
|
200
154
|
}
|
|
@@ -209,10 +163,10 @@ var init_dist = __esm({
|
|
|
209
163
|
}
|
|
210
164
|
});
|
|
211
165
|
|
|
212
|
-
// node_modules/.bun/fast-string-width@
|
|
166
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
213
167
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
214
168
|
var init_dist2 = __esm({
|
|
215
|
-
"node_modules/.bun/fast-string-width@
|
|
169
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
216
170
|
init_utils2();
|
|
217
171
|
init_dist();
|
|
218
172
|
NO_TRUNCATION2 = {
|
|
@@ -227,13 +181,13 @@ var init_dist2 = __esm({
|
|
|
227
181
|
}
|
|
228
182
|
});
|
|
229
183
|
|
|
230
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
184
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
231
185
|
function wrapAnsi(string, columns, options) {
|
|
232
186
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
233
187
|
}
|
|
234
188
|
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
189
|
var init_main = __esm({
|
|
236
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
190
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
237
191
|
init_utils2();
|
|
238
192
|
init_dist2();
|
|
239
193
|
ESC = "\x1B";
|
|
@@ -397,16 +351,19 @@ var init_main = __esm({
|
|
|
397
351
|
}
|
|
398
352
|
const preString = rows.join("\n");
|
|
399
353
|
let inSurrogate = false;
|
|
400
|
-
for (let
|
|
401
|
-
const character = preString[
|
|
354
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
355
|
+
const character = preString[i2];
|
|
402
356
|
returnValue += character;
|
|
403
357
|
if (!inSurrogate) {
|
|
404
358
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
359
|
+
if (inSurrogate) {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
405
362
|
} else {
|
|
406
|
-
|
|
363
|
+
inSurrogate = false;
|
|
407
364
|
}
|
|
408
365
|
if (character === ESC || character === CSI) {
|
|
409
|
-
GROUP_REGEX.lastIndex =
|
|
366
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
410
367
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
411
368
|
const groups = groupsResult?.groups;
|
|
412
369
|
if (groups?.code !== void 0) {
|
|
@@ -416,7 +373,7 @@ var init_main = __esm({
|
|
|
416
373
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
417
374
|
}
|
|
418
375
|
}
|
|
419
|
-
if (preString[
|
|
376
|
+
if (preString[i2 + 1] === "\n") {
|
|
420
377
|
if (escapeUrl) {
|
|
421
378
|
returnValue += wrapAnsiHyperlink("");
|
|
422
379
|
}
|
|
@@ -447,7 +404,7 @@ var require_src = __commonJS({
|
|
|
447
404
|
var ESC2 = "\x1B";
|
|
448
405
|
var CSI2 = `${ESC2}[`;
|
|
449
406
|
var beep = "\x07";
|
|
450
|
-
var
|
|
407
|
+
var cursor3 = {
|
|
451
408
|
to(x, y2) {
|
|
452
409
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
453
410
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -476,7 +433,7 @@ var require_src = __commonJS({
|
|
|
476
433
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
477
434
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
478
435
|
};
|
|
479
|
-
var
|
|
436
|
+
var erase3 = {
|
|
480
437
|
screen: `${CSI2}2J`,
|
|
481
438
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
482
439
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -485,67 +442,137 @@ var require_src = __commonJS({
|
|
|
485
442
|
lineStart: `${CSI2}1K`,
|
|
486
443
|
lines(count) {
|
|
487
444
|
let clear = "";
|
|
488
|
-
for (let
|
|
489
|
-
clear += this.line + (
|
|
445
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
446
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
490
447
|
if (count)
|
|
491
|
-
clear +=
|
|
448
|
+
clear += cursor3.left;
|
|
492
449
|
return clear;
|
|
493
450
|
}
|
|
494
451
|
};
|
|
495
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
452
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
496
453
|
}
|
|
497
454
|
});
|
|
498
455
|
|
|
499
|
-
// node_modules/.bun/@clack+core@1.
|
|
500
|
-
import { styleText
|
|
501
|
-
import { stdout
|
|
502
|
-
import
|
|
503
|
-
import { ReadStream
|
|
504
|
-
function
|
|
505
|
-
if (!
|
|
506
|
-
|
|
507
|
-
|
|
456
|
+
// node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
|
|
457
|
+
import { styleText } from "node:util";
|
|
458
|
+
import { stdout, stdin } from "node:process";
|
|
459
|
+
import l__default from "node:readline";
|
|
460
|
+
import { ReadStream } from "node:tty";
|
|
461
|
+
function findCursor(s, o, l) {
|
|
462
|
+
if (!l.some((r2) => !r2.disabled))
|
|
463
|
+
return s;
|
|
464
|
+
const t2 = s + o, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
465
|
+
return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
|
|
508
466
|
}
|
|
509
|
-
function
|
|
510
|
-
if (
|
|
511
|
-
|
|
467
|
+
function isAccessible(n3) {
|
|
468
|
+
if (n3 !== void 0) return n3;
|
|
469
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
470
|
+
const e = process.env.ACCESSIBLE;
|
|
471
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
472
|
+
}
|
|
473
|
+
function isActionKey(n3, e) {
|
|
474
|
+
if (typeof n3 == "string")
|
|
475
|
+
return settings.aliases.get(n3) === e;
|
|
476
|
+
for (const s of n3)
|
|
477
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
478
|
+
return true;
|
|
512
479
|
return false;
|
|
513
480
|
}
|
|
514
|
-
function
|
|
515
|
-
if (
|
|
516
|
-
const e =
|
|
517
|
-
`),
|
|
518
|
-
`),
|
|
519
|
-
for (let
|
|
520
|
-
|
|
481
|
+
function diffLines(i2, s) {
|
|
482
|
+
if (i2 === s) return;
|
|
483
|
+
const e = i2.split(`
|
|
484
|
+
`), t2 = s.split(`
|
|
485
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
486
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
487
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
488
|
+
return {
|
|
489
|
+
lines: f,
|
|
490
|
+
numLinesBefore: e.length,
|
|
491
|
+
numLinesAfter: t2.length,
|
|
492
|
+
numLines: r2
|
|
493
|
+
};
|
|
521
494
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
495
|
+
function isCancel(e) {
|
|
496
|
+
return e === CANCEL_SYMBOL;
|
|
524
497
|
}
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
498
|
+
function setRawMode(e, r2) {
|
|
499
|
+
const o = e;
|
|
500
|
+
o.isTTY && o.setRawMode(r2);
|
|
528
501
|
}
|
|
529
|
-
function
|
|
530
|
-
const
|
|
531
|
-
return wrapAnsi(
|
|
532
|
-
|
|
502
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
503
|
+
const f = getColumns(e ?? stdout);
|
|
504
|
+
return wrapAnsi(r2, f - o.length, {
|
|
505
|
+
hard: true,
|
|
506
|
+
trim: false
|
|
507
|
+
}).split(`
|
|
508
|
+
`).map((c2, i2, m) => {
|
|
509
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
510
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
511
|
+
}).join(`
|
|
533
512
|
`);
|
|
534
513
|
}
|
|
535
|
-
|
|
514
|
+
function runValidation(e, a2) {
|
|
515
|
+
if ("~standard" in e) {
|
|
516
|
+
const n3 = e["~standard"].validate(a2);
|
|
517
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
518
|
+
}
|
|
519
|
+
return e(a2);
|
|
520
|
+
}
|
|
521
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, n$1;
|
|
536
522
|
var init_dist3 = __esm({
|
|
537
|
-
"node_modules/.bun/@clack+core@1.
|
|
523
|
+
"node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
538
524
|
init_utils2();
|
|
539
525
|
init_main();
|
|
540
526
|
import_sisteransi = __toESM(require_src(), 1);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
527
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
528
|
+
t = [
|
|
529
|
+
"January",
|
|
530
|
+
"February",
|
|
531
|
+
"March",
|
|
532
|
+
"April",
|
|
533
|
+
"May",
|
|
534
|
+
"June",
|
|
535
|
+
"July",
|
|
536
|
+
"August",
|
|
537
|
+
"September",
|
|
538
|
+
"October",
|
|
539
|
+
"November",
|
|
540
|
+
"December"
|
|
541
|
+
];
|
|
542
|
+
settings = {
|
|
543
|
+
actions: new Set(a$1),
|
|
544
|
+
aliases: /* @__PURE__ */ new Map([
|
|
545
|
+
// vim support
|
|
546
|
+
["k", "up"],
|
|
547
|
+
["j", "down"],
|
|
548
|
+
["h", "left"],
|
|
549
|
+
["l", "right"],
|
|
550
|
+
["", "cancel"],
|
|
551
|
+
// opinionated defaults!
|
|
552
|
+
["escape", "cancel"]
|
|
553
|
+
]),
|
|
554
|
+
messages: {
|
|
555
|
+
cancel: "Canceled",
|
|
556
|
+
error: "Something went wrong"
|
|
557
|
+
},
|
|
558
|
+
withGuide: true,
|
|
559
|
+
accessible: void 0,
|
|
560
|
+
date: {
|
|
561
|
+
monthNames: [...t],
|
|
562
|
+
messages: {
|
|
563
|
+
required: "Please enter a valid date",
|
|
564
|
+
invalidMonth: "There are only 12 months in a year",
|
|
565
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
566
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
567
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
R = globalThis.process.platform.startsWith("win");
|
|
572
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
573
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
574
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
575
|
+
y = class {
|
|
549
576
|
input;
|
|
550
577
|
output;
|
|
551
578
|
_abortSignal;
|
|
@@ -560,46 +587,92 @@ var init_dist3 = __esm({
|
|
|
560
587
|
error = "";
|
|
561
588
|
value;
|
|
562
589
|
userInput = "";
|
|
590
|
+
/**
|
|
591
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
592
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
593
|
+
* and the `ACCESSIBLE` env var.
|
|
594
|
+
*/
|
|
595
|
+
get accessible() {
|
|
596
|
+
return isAccessible(this.opts.accessible);
|
|
597
|
+
}
|
|
563
598
|
constructor(t2, e = true) {
|
|
564
|
-
const { input:
|
|
565
|
-
this.opts =
|
|
599
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
600
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
566
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Unsubscribe all listeners
|
|
604
|
+
*/
|
|
567
605
|
unsubscribe() {
|
|
568
606
|
this._subscribers.clear();
|
|
569
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Set a subscriber with opts
|
|
610
|
+
* @param event - The event name
|
|
611
|
+
*/
|
|
570
612
|
setSubscriber(t2, e) {
|
|
571
|
-
const
|
|
572
|
-
|
|
613
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
614
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
573
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Subscribe to an event
|
|
618
|
+
* @param event - The event name
|
|
619
|
+
* @param cb - The callback
|
|
620
|
+
*/
|
|
574
621
|
on(t2, e) {
|
|
575
622
|
this.setSubscriber(t2, { cb: e });
|
|
576
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Subscribe to an event once
|
|
626
|
+
* @param event - The event name
|
|
627
|
+
* @param cb - The callback
|
|
628
|
+
*/
|
|
577
629
|
once(t2, e) {
|
|
578
630
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
579
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Emit an event with data
|
|
634
|
+
* @param event - The event name
|
|
635
|
+
* @param data - The data to pass to the callback
|
|
636
|
+
*/
|
|
580
637
|
emit(t2, ...e) {
|
|
581
|
-
const
|
|
582
|
-
for (const
|
|
583
|
-
|
|
638
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
639
|
+
for (const r2 of i2)
|
|
640
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
641
|
+
for (const r2 of s)
|
|
642
|
+
r2();
|
|
584
643
|
}
|
|
585
644
|
prompt() {
|
|
586
645
|
return new Promise((t2) => {
|
|
587
646
|
if (this._abortSignal) {
|
|
588
|
-
if (this._abortSignal.aborted)
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
647
|
+
if (this._abortSignal.aborted)
|
|
648
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
649
|
+
this._abortSignal.addEventListener(
|
|
650
|
+
"abort",
|
|
651
|
+
() => {
|
|
652
|
+
this.state = "cancel", this.close();
|
|
653
|
+
},
|
|
654
|
+
{ once: true }
|
|
655
|
+
);
|
|
592
656
|
}
|
|
593
|
-
this.rl =
|
|
594
|
-
|
|
657
|
+
this.rl = l__default.createInterface({
|
|
658
|
+
input: this.input,
|
|
659
|
+
tabSize: 2,
|
|
660
|
+
prompt: "",
|
|
661
|
+
escapeCodeTimeout: 50,
|
|
662
|
+
terminal: true
|
|
663
|
+
}), 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", () => {
|
|
664
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
595
665
|
}), this.once("cancel", () => {
|
|
596
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
666
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
597
667
|
});
|
|
598
668
|
});
|
|
599
669
|
}
|
|
600
670
|
_isActionKey(t2, e) {
|
|
601
671
|
return t2 === " ";
|
|
602
672
|
}
|
|
673
|
+
_shouldSubmit(t2, e) {
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
603
676
|
_setValue(t2) {
|
|
604
677
|
this.value = t2, this.emit("value", this.value);
|
|
605
678
|
}
|
|
@@ -609,19 +682,22 @@ var init_dist3 = __esm({
|
|
|
609
682
|
_clearUserInput() {
|
|
610
683
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
611
684
|
}
|
|
612
|
-
onKeypress(t2, e) {
|
|
613
|
-
if (this.
|
|
614
|
-
if (this.
|
|
615
|
-
|
|
616
|
-
|
|
685
|
+
async onKeypress(t2, e) {
|
|
686
|
+
if (this.state !== "validating") {
|
|
687
|
+
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)) {
|
|
688
|
+
if (this.opts.validate) {
|
|
689
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
690
|
+
let s;
|
|
691
|
+
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));
|
|
692
|
+
}
|
|
693
|
+
this.state !== "error" && (this.state = "submit");
|
|
617
694
|
}
|
|
618
|
-
this.state
|
|
695
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
619
696
|
}
|
|
620
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
621
697
|
}
|
|
622
698
|
close() {
|
|
623
699
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
624
|
-
`),
|
|
700
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
625
701
|
}
|
|
626
702
|
restoreCursor() {
|
|
627
703
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -629,34 +705,39 @@ var init_dist3 = __esm({
|
|
|
629
705
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
630
706
|
}
|
|
631
707
|
render() {
|
|
632
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
708
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
709
|
+
hard: true,
|
|
710
|
+
trim: false
|
|
711
|
+
});
|
|
633
712
|
if (t2 !== this._prevFrame) {
|
|
634
|
-
if (this.state === "initial")
|
|
713
|
+
if (this.state === "initial")
|
|
714
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
635
715
|
else {
|
|
636
|
-
const e =
|
|
716
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
637
717
|
if (this.restoreCursor(), e) {
|
|
638
|
-
const
|
|
639
|
-
let
|
|
640
|
-
if (
|
|
718
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
719
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
720
|
+
if (n3 === void 0) {
|
|
641
721
|
this._prevFrame = t2;
|
|
642
722
|
return;
|
|
643
723
|
}
|
|
644
724
|
if (e.lines.length === 1) {
|
|
645
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
646
|
-
const
|
|
725
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
726
|
+
const o = t2.split(`
|
|
647
727
|
`);
|
|
648
|
-
this.output.write(
|
|
728
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
649
729
|
return;
|
|
650
730
|
} else if (e.lines.length > 1) {
|
|
651
|
-
if (
|
|
731
|
+
if (s < r2)
|
|
732
|
+
n3 = s;
|
|
652
733
|
else {
|
|
653
|
-
const
|
|
654
|
-
|
|
734
|
+
const h2 = n3 - r2;
|
|
735
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
655
736
|
}
|
|
656
737
|
this.output.write(import_sisteransi.erase.down());
|
|
657
|
-
const
|
|
658
|
-
`).slice(
|
|
659
|
-
this.output.write(
|
|
738
|
+
const f = t2.split(`
|
|
739
|
+
`).slice(n3);
|
|
740
|
+
this.output.write(f.join(`
|
|
660
741
|
`)), this._prevFrame = t2;
|
|
661
742
|
return;
|
|
662
743
|
}
|
|
@@ -667,27 +748,28 @@ var init_dist3 = __esm({
|
|
|
667
748
|
}
|
|
668
749
|
}
|
|
669
750
|
};
|
|
670
|
-
|
|
751
|
+
n$1 = class n extends y {
|
|
671
752
|
options;
|
|
672
753
|
cursor = 0;
|
|
673
754
|
get _selectedValue() {
|
|
674
755
|
return this.options[this.cursor];
|
|
675
756
|
}
|
|
676
757
|
changeValue() {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
758
|
+
const e = this._selectedValue;
|
|
759
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
760
|
+
}
|
|
761
|
+
constructor(e) {
|
|
762
|
+
super(e, false), this.options = e.options;
|
|
763
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
764
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
765
|
+
switch (s) {
|
|
684
766
|
case "left":
|
|
685
767
|
case "up":
|
|
686
|
-
this.cursor =
|
|
768
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
687
769
|
break;
|
|
688
770
|
case "down":
|
|
689
771
|
case "right":
|
|
690
|
-
this.cursor =
|
|
772
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
691
773
|
break;
|
|
692
774
|
}
|
|
693
775
|
this.changeValue();
|
|
@@ -697,206 +779,323 @@ var init_dist3 = __esm({
|
|
|
697
779
|
}
|
|
698
780
|
});
|
|
699
781
|
|
|
700
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
701
|
-
import { styleText as
|
|
702
|
-
import
|
|
703
|
-
import { existsSync
|
|
704
|
-
import { dirname
|
|
705
|
-
function
|
|
706
|
-
|
|
782
|
+
// node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
|
|
783
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
784
|
+
import process$1 from "node:process";
|
|
785
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
786
|
+
import { dirname, join } from "node:path";
|
|
787
|
+
function isUnicodeSupported() {
|
|
788
|
+
if (process$1.platform !== "win32") {
|
|
789
|
+
return process$1.env.TERM !== "linux";
|
|
790
|
+
}
|
|
791
|
+
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";
|
|
792
|
+
}
|
|
793
|
+
function formatInstructionFooter(o, e) {
|
|
794
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
795
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
707
796
|
}
|
|
708
|
-
var import_sisteransi2,
|
|
797
|
+
var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, MULTISELECT_INSTRUCTIONS, log, cancel, W$1, C, note, u2, SELECT_INSTRUCTIONS, c, select, i;
|
|
709
798
|
var init_dist4 = __esm({
|
|
710
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
799
|
+
"node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
711
800
|
init_utils2();
|
|
712
801
|
init_dist3();
|
|
713
802
|
init_dist3();
|
|
714
803
|
init_main();
|
|
715
804
|
init_dist2();
|
|
716
805
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
switch (
|
|
806
|
+
unicode = isUnicodeSupported();
|
|
807
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
808
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
809
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
810
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
811
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
812
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
813
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
814
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
815
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
816
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
817
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
818
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
819
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
820
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
821
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
822
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
823
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
824
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
825
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
826
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
827
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
828
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
829
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
830
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
831
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
832
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
833
|
+
symbol = (o) => {
|
|
834
|
+
switch (o) {
|
|
746
835
|
case "initial":
|
|
747
836
|
case "active":
|
|
748
|
-
return
|
|
837
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
749
838
|
case "cancel":
|
|
750
|
-
return
|
|
839
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
751
840
|
case "error":
|
|
752
|
-
return
|
|
841
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
753
842
|
case "submit":
|
|
754
|
-
return
|
|
843
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
844
|
+
case "validating":
|
|
845
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
755
846
|
}
|
|
756
847
|
};
|
|
757
|
-
|
|
758
|
-
switch (
|
|
848
|
+
symbolBar = (o) => {
|
|
849
|
+
switch (o) {
|
|
759
850
|
case "initial":
|
|
760
851
|
case "active":
|
|
761
|
-
return
|
|
852
|
+
return styleText2("cyan", S_BAR);
|
|
762
853
|
case "cancel":
|
|
763
|
-
return
|
|
854
|
+
return styleText2("red", S_BAR);
|
|
764
855
|
case "error":
|
|
765
|
-
return
|
|
856
|
+
return styleText2("yellow", S_BAR);
|
|
766
857
|
case "submit":
|
|
767
|
-
return
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
let
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
858
|
+
return styleText2("green", S_BAR);
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
I = (l, e, w, p, b, C2 = false) => {
|
|
862
|
+
let r2 = e, O = 0;
|
|
863
|
+
if (C2)
|
|
864
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
865
|
+
const m = l[i2];
|
|
866
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
867
|
+
}
|
|
868
|
+
else
|
|
869
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
870
|
+
const m = l[i2];
|
|
871
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
872
|
+
}
|
|
873
|
+
return { lineCount: r2, removals: O };
|
|
874
|
+
};
|
|
875
|
+
limitOptions = ({
|
|
876
|
+
cursor: l,
|
|
877
|
+
options: e,
|
|
878
|
+
style: w,
|
|
879
|
+
output: p = process.stdout,
|
|
880
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
881
|
+
columnPadding: C2 = 0,
|
|
882
|
+
rowPadding: r2 = 4
|
|
883
|
+
}) => {
|
|
884
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
784
885
|
let f = 0;
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
886
|
+
l >= a2 - 3 && (f = Math.max(
|
|
887
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
888
|
+
0
|
|
889
|
+
));
|
|
890
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
891
|
+
const W = Math.min(
|
|
892
|
+
f + a2,
|
|
893
|
+
e.length
|
|
894
|
+
), s = [];
|
|
895
|
+
let g = 0;
|
|
896
|
+
d && g++, c2 && g++;
|
|
897
|
+
const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
|
|
898
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
899
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
900
|
+
hard: true,
|
|
901
|
+
trim: false
|
|
902
|
+
}).split(`
|
|
789
903
|
`);
|
|
790
|
-
|
|
791
|
-
}
|
|
792
|
-
if (
|
|
793
|
-
let
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
904
|
+
s.push(h2), g += h2.length;
|
|
905
|
+
}
|
|
906
|
+
if (g > v) {
|
|
907
|
+
let t2 = 0, n3 = 0, o = g;
|
|
908
|
+
const h2 = l - T;
|
|
909
|
+
let u3 = v;
|
|
910
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
911
|
+
s,
|
|
912
|
+
o,
|
|
913
|
+
h2 + 1,
|
|
914
|
+
s.length,
|
|
915
|
+
u3,
|
|
916
|
+
true
|
|
917
|
+
);
|
|
918
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
|
|
919
|
+
}
|
|
920
|
+
const x = [];
|
|
921
|
+
d && x.push(M);
|
|
922
|
+
for (const t2 of s)
|
|
923
|
+
for (const n3 of t2)
|
|
924
|
+
x.push(n3);
|
|
925
|
+
return c2 && x.push(M), x;
|
|
926
|
+
};
|
|
927
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
928
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
929
|
+
`${styleText2("dim", "Space:")} select`,
|
|
930
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
931
|
+
];
|
|
932
|
+
log = {
|
|
933
|
+
message: (s = [], {
|
|
934
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
935
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
936
|
+
output: m = process.stdout,
|
|
937
|
+
spacing: l = 1,
|
|
938
|
+
withGuide: c2
|
|
939
|
+
} = {}) => {
|
|
940
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
941
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
942
|
+
t2.push(f);
|
|
943
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
806
944
|
`);
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
945
|
+
if (g.length > 0) {
|
|
946
|
+
const [i2, ...y2] = g;
|
|
947
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
948
|
+
for (const p of y2)
|
|
949
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
950
|
+
}
|
|
951
|
+
m.write(`${t2.join(`
|
|
813
952
|
`)}
|
|
814
953
|
`);
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
954
|
+
},
|
|
955
|
+
info: (s, e) => {
|
|
956
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
957
|
+
},
|
|
958
|
+
success: (s, e) => {
|
|
959
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
960
|
+
},
|
|
961
|
+
step: (s, e) => {
|
|
962
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
963
|
+
},
|
|
964
|
+
warn: (s, e) => {
|
|
965
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
966
|
+
},
|
|
967
|
+
/** alias for `log.warn()`. */
|
|
968
|
+
warning: (s, e) => {
|
|
969
|
+
log.warn(s, e);
|
|
970
|
+
},
|
|
971
|
+
error: (s, e) => {
|
|
972
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
cancel = (o = "", t2) => {
|
|
976
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
977
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
831
978
|
|
|
832
979
|
`);
|
|
833
980
|
};
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
981
|
+
W$1 = (o) => o;
|
|
982
|
+
C = (o, e, s) => {
|
|
983
|
+
const a2 = {
|
|
984
|
+
hard: true,
|
|
985
|
+
trim: false
|
|
986
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
987
|
+
`), c2 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c2);
|
|
988
|
+
return wrapAnsi(o, g, a2);
|
|
989
|
+
};
|
|
990
|
+
note = (o = "", e = "", s) => {
|
|
991
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
|
|
992
|
+
`).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
993
|
+
g.reduce((m, F) => {
|
|
994
|
+
const O = dist_default2(F);
|
|
995
|
+
return O > m ? O : m;
|
|
996
|
+
}, 0),
|
|
997
|
+
n3
|
|
998
|
+
) + 2, h2 = g.map(
|
|
999
|
+
(m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
|
|
1000
|
+
).join(`
|
|
1001
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1002
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1003
|
+
a2.write(
|
|
1004
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1005
|
+
"gray",
|
|
1006
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1007
|
+
)}
|
|
1008
|
+
${h2}
|
|
1009
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1010
|
+
`
|
|
1011
|
+
);
|
|
852
1012
|
};
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1013
|
+
u2 = {
|
|
1014
|
+
light: unicodeOr("\u2500", "-"),
|
|
1015
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1016
|
+
block: unicodeOr("\u2588", "#")
|
|
1017
|
+
};
|
|
1018
|
+
SELECT_INSTRUCTIONS = [
|
|
1019
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1020
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1021
|
+
];
|
|
1022
|
+
c = (t2, o) => t2.includes(`
|
|
1023
|
+
`) ? t2.split(`
|
|
1024
|
+
`).map((d) => o(d)).join(`
|
|
1025
|
+
`) : o(t2);
|
|
1026
|
+
select = (t2) => {
|
|
1027
|
+
const o = (n3, m) => {
|
|
1028
|
+
if (n3 === void 0)
|
|
1029
|
+
return "";
|
|
1030
|
+
const s = n3.label ?? String(n3.value);
|
|
1031
|
+
switch (m) {
|
|
862
1032
|
case "disabled":
|
|
863
|
-
return `${
|
|
1033
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
864
1034
|
case "selected":
|
|
865
|
-
return `${
|
|
1035
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
866
1036
|
case "active":
|
|
867
|
-
return `${
|
|
1037
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
868
1038
|
case "cancelled":
|
|
869
|
-
return `${
|
|
1039
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
870
1040
|
default:
|
|
871
|
-
return `${
|
|
872
|
-
}
|
|
873
|
-
};
|
|
874
|
-
return new
|
|
875
|
-
|
|
876
|
-
|
|
1041
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1042
|
+
}
|
|
1043
|
+
}, d = t2.showInstructions ?? true;
|
|
1044
|
+
return new n$1({
|
|
1045
|
+
options: t2.options,
|
|
1046
|
+
signal: t2.signal,
|
|
1047
|
+
input: t2.input,
|
|
1048
|
+
output: t2.output,
|
|
1049
|
+
initialValue: t2.initialValue,
|
|
1050
|
+
render() {
|
|
1051
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1052
|
+
t2.output,
|
|
1053
|
+
t2.message,
|
|
1054
|
+
s,
|
|
1055
|
+
m
|
|
1056
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1057
|
+
` : ""}${i2}
|
|
877
1058
|
`;
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
${
|
|
1059
|
+
switch (this.state) {
|
|
1060
|
+
case "submit": {
|
|
1061
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1062
|
+
t2.output,
|
|
1063
|
+
o(this.options[this.cursor], "selected"),
|
|
1064
|
+
r2
|
|
1065
|
+
);
|
|
1066
|
+
return `${u3}${a2}`;
|
|
1067
|
+
}
|
|
1068
|
+
case "cancel": {
|
|
1069
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1070
|
+
t2.output,
|
|
1071
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1072
|
+
r2
|
|
1073
|
+
);
|
|
1074
|
+
return `${u3}${a2}${n3 ? `
|
|
1075
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1076
|
+
}
|
|
1077
|
+
default: {
|
|
1078
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1079
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1080
|
+
`), f = p.length + 1;
|
|
1081
|
+
return `${u3}${r2}${limitOptions({
|
|
1082
|
+
output: t2.output,
|
|
1083
|
+
cursor: this.cursor,
|
|
1084
|
+
options: this.options,
|
|
1085
|
+
maxItems: t2.maxItems,
|
|
1086
|
+
columnPadding: r2.length,
|
|
1087
|
+
rowPadding: a2 + f,
|
|
1088
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1089
|
+
}).join(`
|
|
1090
|
+
${r2}`)}
|
|
1091
|
+
${b}
|
|
894
1092
|
`;
|
|
1093
|
+
}
|
|
895
1094
|
}
|
|
896
1095
|
}
|
|
897
|
-
}
|
|
1096
|
+
}).prompt();
|
|
898
1097
|
};
|
|
899
|
-
|
|
1098
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
900
1099
|
}
|
|
901
1100
|
});
|
|
902
1101
|
|
|
@@ -909,9 +1108,9 @@ function supportsColor() {
|
|
|
909
1108
|
}
|
|
910
1109
|
return process.stdout.isTTY === true;
|
|
911
1110
|
}
|
|
912
|
-
function colorize(
|
|
913
|
-
if (!supportsColor()) return
|
|
914
|
-
return `${color}${
|
|
1111
|
+
function colorize(text2, color) {
|
|
1112
|
+
if (!supportsColor()) return text2;
|
|
1113
|
+
return `${color}${text2}${colors.reset}`;
|
|
915
1114
|
}
|
|
916
1115
|
function stringify(value) {
|
|
917
1116
|
if (typeof value === "string") return value;
|
|
@@ -941,7 +1140,7 @@ function stringify(value) {
|
|
|
941
1140
|
function formatMessage(...args) {
|
|
942
1141
|
return args.map(stringify).join(" ");
|
|
943
1142
|
}
|
|
944
|
-
var colors, currentLogLevel,
|
|
1143
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
945
1144
|
var init_cli_output = __esm({
|
|
946
1145
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
947
1146
|
"use strict";
|
|
@@ -974,7 +1173,7 @@ var init_cli_output = __esm({
|
|
|
974
1173
|
currentLogLevel = envLevel;
|
|
975
1174
|
}
|
|
976
1175
|
}
|
|
977
|
-
|
|
1176
|
+
log2 = {
|
|
978
1177
|
/**
|
|
979
1178
|
* Logs an error message (always shows unless Quiet level)
|
|
980
1179
|
* Uses clack's log.error + explicit red color
|
|
@@ -982,7 +1181,7 @@ var init_cli_output = __esm({
|
|
|
982
1181
|
error(...args) {
|
|
983
1182
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
984
1183
|
const message = formatMessage(...args);
|
|
985
|
-
|
|
1184
|
+
log.error(colorize(message, colors.brightRed));
|
|
986
1185
|
},
|
|
987
1186
|
/**
|
|
988
1187
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -991,7 +1190,7 @@ var init_cli_output = __esm({
|
|
|
991
1190
|
warn(...args) {
|
|
992
1191
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
993
1192
|
const message = formatMessage(...args);
|
|
994
|
-
|
|
1193
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
995
1194
|
},
|
|
996
1195
|
/**
|
|
997
1196
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1000,7 +1199,7 @@ var init_cli_output = __esm({
|
|
|
1000
1199
|
info(...args) {
|
|
1001
1200
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1002
1201
|
const message = formatMessage(...args);
|
|
1003
|
-
|
|
1202
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1004
1203
|
},
|
|
1005
1204
|
/**
|
|
1006
1205
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1009,7 +1208,7 @@ var init_cli_output = __esm({
|
|
|
1009
1208
|
success(...args) {
|
|
1010
1209
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1011
1210
|
const message = formatMessage(...args);
|
|
1012
|
-
|
|
1211
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1013
1212
|
},
|
|
1014
1213
|
/**
|
|
1015
1214
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1018,7 +1217,7 @@ var init_cli_output = __esm({
|
|
|
1018
1217
|
debug(...args) {
|
|
1019
1218
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1020
1219
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1021
|
-
|
|
1220
|
+
log.message(
|
|
1022
1221
|
colorize(
|
|
1023
1222
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1024
1223
|
colors.gray
|
|
@@ -1032,7 +1231,7 @@ var init_cli_output = __esm({
|
|
|
1032
1231
|
trace(...args) {
|
|
1033
1232
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1034
1233
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1035
|
-
|
|
1234
|
+
log.message(
|
|
1036
1235
|
colorize(
|
|
1037
1236
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1038
1237
|
colors.gray
|
|
@@ -1040,10 +1239,10 @@ var init_cli_output = __esm({
|
|
|
1040
1239
|
);
|
|
1041
1240
|
}
|
|
1042
1241
|
};
|
|
1043
|
-
error =
|
|
1044
|
-
warn =
|
|
1045
|
-
info =
|
|
1046
|
-
success =
|
|
1242
|
+
error = log2.error.bind(log2);
|
|
1243
|
+
warn = log2.warn.bind(log2);
|
|
1244
|
+
info = log2.info.bind(log2);
|
|
1245
|
+
success = log2.success.bind(log2);
|
|
1047
1246
|
}
|
|
1048
1247
|
});
|
|
1049
1248
|
|
|
@@ -1403,9 +1602,9 @@ var require_is_glob = __commonJS({
|
|
|
1403
1602
|
index += 2;
|
|
1404
1603
|
var close = chars[open];
|
|
1405
1604
|
if (close) {
|
|
1406
|
-
var
|
|
1407
|
-
if (
|
|
1408
|
-
index =
|
|
1605
|
+
var n3 = str.indexOf(close, index);
|
|
1606
|
+
if (n3 !== -1) {
|
|
1607
|
+
index = n3 + 1;
|
|
1409
1608
|
}
|
|
1410
1609
|
}
|
|
1411
1610
|
if (str[index] === "!") {
|
|
@@ -1431,9 +1630,9 @@ var require_is_glob = __commonJS({
|
|
|
1431
1630
|
index += 2;
|
|
1432
1631
|
var close = chars[open];
|
|
1433
1632
|
if (close) {
|
|
1434
|
-
var
|
|
1435
|
-
if (
|
|
1436
|
-
index =
|
|
1633
|
+
var n3 = str.indexOf(close, index);
|
|
1634
|
+
if (n3 !== -1) {
|
|
1635
|
+
index = n3 + 1;
|
|
1437
1636
|
}
|
|
1438
1637
|
}
|
|
1439
1638
|
if (str[index] === "!") {
|
|
@@ -1511,8 +1710,8 @@ var require_utils = __commonJS({
|
|
|
1511
1710
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1512
1711
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1513
1712
|
};
|
|
1514
|
-
exports.escapeNode = (
|
|
1515
|
-
const node =
|
|
1713
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1714
|
+
const node = block2.nodes[n3];
|
|
1516
1715
|
if (!node) return;
|
|
1517
1716
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1518
1717
|
if (node.escaped !== true) {
|
|
@@ -1529,15 +1728,15 @@ var require_utils = __commonJS({
|
|
|
1529
1728
|
}
|
|
1530
1729
|
return false;
|
|
1531
1730
|
};
|
|
1532
|
-
exports.isInvalidBrace = (
|
|
1533
|
-
if (
|
|
1534
|
-
if (
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1731
|
+
exports.isInvalidBrace = (block2) => {
|
|
1732
|
+
if (block2.type !== "brace") return false;
|
|
1733
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1734
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1735
|
+
block2.invalid = true;
|
|
1537
1736
|
return true;
|
|
1538
1737
|
}
|
|
1539
|
-
if (
|
|
1540
|
-
|
|
1738
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1739
|
+
block2.invalid = true;
|
|
1541
1740
|
return true;
|
|
1542
1741
|
}
|
|
1543
1742
|
return false;
|
|
@@ -1556,8 +1755,8 @@ var require_utils = __commonJS({
|
|
|
1556
1755
|
exports.flatten = (...args) => {
|
|
1557
1756
|
const result = [];
|
|
1558
1757
|
const flat = (arr) => {
|
|
1559
|
-
for (let
|
|
1560
|
-
const ele = arr[
|
|
1758
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1759
|
+
const ele = arr[i2];
|
|
1561
1760
|
if (Array.isArray(ele)) {
|
|
1562
1761
|
flat(ele);
|
|
1563
1762
|
continue;
|
|
@@ -1651,9 +1850,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1651
1850
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1652
1851
|
return toRegexRange.cache[cacheKey].result;
|
|
1653
1852
|
}
|
|
1654
|
-
let
|
|
1853
|
+
let a2 = Math.min(min, max);
|
|
1655
1854
|
let b = Math.max(min, max);
|
|
1656
|
-
if (Math.abs(
|
|
1855
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1657
1856
|
let result = min + "|" + max;
|
|
1658
1857
|
if (opts.capture) {
|
|
1659
1858
|
return `(${result})`;
|
|
@@ -1664,20 +1863,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1664
1863
|
return `(?:${result})`;
|
|
1665
1864
|
}
|
|
1666
1865
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1667
|
-
let state = { min, max, a, b };
|
|
1866
|
+
let state = { min, max, a: a2, b };
|
|
1668
1867
|
let positives = [];
|
|
1669
1868
|
let negatives = [];
|
|
1670
1869
|
if (isPadded) {
|
|
1671
1870
|
state.isPadded = isPadded;
|
|
1672
1871
|
state.maxLen = String(state.max).length;
|
|
1673
1872
|
}
|
|
1674
|
-
if (
|
|
1873
|
+
if (a2 < 0) {
|
|
1675
1874
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1676
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1677
|
-
|
|
1875
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
1876
|
+
a2 = state.a = 0;
|
|
1678
1877
|
}
|
|
1679
1878
|
if (b >= 0) {
|
|
1680
|
-
positives = splitToPatterns(
|
|
1879
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1681
1880
|
}
|
|
1682
1881
|
state.negatives = negatives;
|
|
1683
1882
|
state.positives = positives;
|
|
@@ -1725,8 +1924,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1725
1924
|
let digits = zipped.length;
|
|
1726
1925
|
let pattern = "";
|
|
1727
1926
|
let count = 0;
|
|
1728
|
-
for (let
|
|
1729
|
-
let [startDigit, stopDigit] = zipped[
|
|
1927
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
1928
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1730
1929
|
if (startDigit === stopDigit) {
|
|
1731
1930
|
pattern += startDigit;
|
|
1732
1931
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1745,8 +1944,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1745
1944
|
let tokens = [];
|
|
1746
1945
|
let start = min;
|
|
1747
1946
|
let prev;
|
|
1748
|
-
for (let
|
|
1749
|
-
let max2 = ranges[
|
|
1947
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
1948
|
+
let max2 = ranges[i2];
|
|
1750
1949
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1751
1950
|
let zeros = "";
|
|
1752
1951
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1781,13 +1980,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1781
1980
|
}
|
|
1782
1981
|
return result;
|
|
1783
1982
|
}
|
|
1784
|
-
function zip(
|
|
1983
|
+
function zip(a2, b) {
|
|
1785
1984
|
let arr = [];
|
|
1786
|
-
for (let
|
|
1985
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1787
1986
|
return arr;
|
|
1788
1987
|
}
|
|
1789
|
-
function compare(
|
|
1790
|
-
return
|
|
1988
|
+
function compare(a2, b) {
|
|
1989
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1791
1990
|
}
|
|
1792
1991
|
function contains(arr, key, val) {
|
|
1793
1992
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1805,8 +2004,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1805
2004
|
}
|
|
1806
2005
|
return "";
|
|
1807
2006
|
}
|
|
1808
|
-
function toCharacterClass(
|
|
1809
|
-
return `[${
|
|
2007
|
+
function toCharacterClass(a2, b, options) {
|
|
2008
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1810
2009
|
}
|
|
1811
2010
|
function hasPadding(str) {
|
|
1812
2011
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1885,8 +2084,8 @@ var require_fill_range = __commonJS({
|
|
|
1885
2084
|
return negative ? "-" + input : input;
|
|
1886
2085
|
};
|
|
1887
2086
|
var toSequence = (parts, options, maxLen) => {
|
|
1888
|
-
parts.negatives.sort((
|
|
1889
|
-
parts.positives.sort((
|
|
2087
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2088
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
1890
2089
|
let prefix = options.capture ? "" : "?:";
|
|
1891
2090
|
let positives = "";
|
|
1892
2091
|
let negatives = "";
|
|
@@ -1907,12 +2106,12 @@ var require_fill_range = __commonJS({
|
|
|
1907
2106
|
}
|
|
1908
2107
|
return result;
|
|
1909
2108
|
};
|
|
1910
|
-
var toRange = (
|
|
2109
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
1911
2110
|
if (isNumbers) {
|
|
1912
|
-
return toRegexRange(
|
|
2111
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
1913
2112
|
}
|
|
1914
|
-
let start = String.fromCharCode(
|
|
1915
|
-
if (
|
|
2113
|
+
let start = String.fromCharCode(a2);
|
|
2114
|
+
if (a2 === b) return start;
|
|
1916
2115
|
let stop = String.fromCharCode(b);
|
|
1917
2116
|
return `[${start}-${stop}]`;
|
|
1918
2117
|
};
|
|
@@ -1938,15 +2137,15 @@ var require_fill_range = __commonJS({
|
|
|
1938
2137
|
return [];
|
|
1939
2138
|
};
|
|
1940
2139
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1941
|
-
let
|
|
2140
|
+
let a2 = Number(start);
|
|
1942
2141
|
let b = Number(end);
|
|
1943
|
-
if (!Number.isInteger(
|
|
2142
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
1944
2143
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1945
2144
|
return [];
|
|
1946
2145
|
}
|
|
1947
|
-
if (
|
|
2146
|
+
if (a2 === 0) a2 = 0;
|
|
1948
2147
|
if (b === 0) b = 0;
|
|
1949
|
-
let descending =
|
|
2148
|
+
let descending = a2 > b;
|
|
1950
2149
|
let startString = String(start);
|
|
1951
2150
|
let endString = String(end);
|
|
1952
2151
|
let stepString = String(step);
|
|
@@ -1962,13 +2161,13 @@ var require_fill_range = __commonJS({
|
|
|
1962
2161
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
1963
2162
|
let range = [];
|
|
1964
2163
|
let index = 0;
|
|
1965
|
-
while (descending ?
|
|
2164
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
1966
2165
|
if (options.toRegex === true && step > 1) {
|
|
1967
|
-
push(
|
|
2166
|
+
push(a2);
|
|
1968
2167
|
} else {
|
|
1969
|
-
range.push(pad(format(
|
|
2168
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
1970
2169
|
}
|
|
1971
|
-
|
|
2170
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
1972
2171
|
index++;
|
|
1973
2172
|
}
|
|
1974
2173
|
if (options.toRegex === true) {
|
|
@@ -1981,19 +2180,19 @@ var require_fill_range = __commonJS({
|
|
|
1981
2180
|
return invalidRange(start, end, options);
|
|
1982
2181
|
}
|
|
1983
2182
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
1984
|
-
let
|
|
2183
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
1985
2184
|
let b = `${end}`.charCodeAt(0);
|
|
1986
|
-
let descending =
|
|
1987
|
-
let min = Math.min(
|
|
1988
|
-
let max = Math.max(
|
|
2185
|
+
let descending = a2 > b;
|
|
2186
|
+
let min = Math.min(a2, b);
|
|
2187
|
+
let max = Math.max(a2, b);
|
|
1989
2188
|
if (options.toRegex && step === 1) {
|
|
1990
2189
|
return toRange(min, max, false, options);
|
|
1991
2190
|
}
|
|
1992
2191
|
let range = [];
|
|
1993
2192
|
let index = 0;
|
|
1994
|
-
while (descending ?
|
|
1995
|
-
range.push(format(
|
|
1996
|
-
|
|
2193
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2194
|
+
range.push(format(a2, index));
|
|
2195
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
1997
2196
|
index++;
|
|
1998
2197
|
}
|
|
1999
2198
|
if (options.toRegex === true) {
|
|
@@ -2116,18 +2315,18 @@ var require_expand = __commonJS({
|
|
|
2116
2315
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2117
2316
|
const walk = (node, parent = {}) => {
|
|
2118
2317
|
node.queue = [];
|
|
2119
|
-
let
|
|
2120
|
-
let
|
|
2121
|
-
while (
|
|
2122
|
-
|
|
2123
|
-
|
|
2318
|
+
let p = parent;
|
|
2319
|
+
let q = parent.queue;
|
|
2320
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2321
|
+
p = p.parent;
|
|
2322
|
+
q = p.queue;
|
|
2124
2323
|
}
|
|
2125
2324
|
if (node.invalid || node.dollar) {
|
|
2126
|
-
|
|
2325
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2127
2326
|
return;
|
|
2128
2327
|
}
|
|
2129
2328
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2130
|
-
|
|
2329
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2131
2330
|
return;
|
|
2132
2331
|
}
|
|
2133
2332
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2139,26 +2338,26 @@ var require_expand = __commonJS({
|
|
|
2139
2338
|
if (range.length === 0) {
|
|
2140
2339
|
range = stringify2(node, options);
|
|
2141
2340
|
}
|
|
2142
|
-
|
|
2341
|
+
q.push(append(q.pop(), range));
|
|
2143
2342
|
node.nodes = [];
|
|
2144
2343
|
return;
|
|
2145
2344
|
}
|
|
2146
2345
|
const enclose = utils.encloseBrace(node);
|
|
2147
2346
|
let queue = node.queue;
|
|
2148
|
-
let
|
|
2149
|
-
while (
|
|
2150
|
-
|
|
2151
|
-
queue =
|
|
2347
|
+
let block2 = node;
|
|
2348
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2349
|
+
block2 = block2.parent;
|
|
2350
|
+
queue = block2.queue;
|
|
2152
2351
|
}
|
|
2153
|
-
for (let
|
|
2154
|
-
const child = node.nodes[
|
|
2352
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2353
|
+
const child = node.nodes[i2];
|
|
2155
2354
|
if (child.type === "comma" && node.type === "brace") {
|
|
2156
|
-
if (
|
|
2355
|
+
if (i2 === 1) queue.push("");
|
|
2157
2356
|
queue.push("");
|
|
2158
2357
|
continue;
|
|
2159
2358
|
}
|
|
2160
2359
|
if (child.type === "close") {
|
|
2161
|
-
|
|
2360
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2162
2361
|
continue;
|
|
2163
2362
|
}
|
|
2164
2363
|
if (child.value && child.type !== "open") {
|
|
@@ -2325,7 +2524,7 @@ var require_parse = __commonJS({
|
|
|
2325
2524
|
}
|
|
2326
2525
|
const ast = { type: "root", input, nodes: [] };
|
|
2327
2526
|
const stack = [ast];
|
|
2328
|
-
let
|
|
2527
|
+
let block2 = ast;
|
|
2329
2528
|
let prev = ast;
|
|
2330
2529
|
let brackets = 0;
|
|
2331
2530
|
const length = input.length;
|
|
@@ -2341,15 +2540,15 @@ var require_parse = __commonJS({
|
|
|
2341
2540
|
prev.value += node.value;
|
|
2342
2541
|
return;
|
|
2343
2542
|
}
|
|
2344
|
-
|
|
2345
|
-
node.parent =
|
|
2543
|
+
block2.nodes.push(node);
|
|
2544
|
+
node.parent = block2;
|
|
2346
2545
|
node.prev = prev;
|
|
2347
2546
|
prev = node;
|
|
2348
2547
|
return node;
|
|
2349
2548
|
};
|
|
2350
2549
|
push({ type: "bos" });
|
|
2351
2550
|
while (index < length) {
|
|
2352
|
-
|
|
2551
|
+
block2 = stack[stack.length - 1];
|
|
2353
2552
|
value = advance();
|
|
2354
2553
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2355
2554
|
continue;
|
|
@@ -2386,19 +2585,19 @@ var require_parse = __commonJS({
|
|
|
2386
2585
|
continue;
|
|
2387
2586
|
}
|
|
2388
2587
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2389
|
-
|
|
2390
|
-
stack.push(
|
|
2588
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2589
|
+
stack.push(block2);
|
|
2391
2590
|
push({ type: "text", value });
|
|
2392
2591
|
continue;
|
|
2393
2592
|
}
|
|
2394
2593
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2395
|
-
if (
|
|
2594
|
+
if (block2.type !== "paren") {
|
|
2396
2595
|
push({ type: "text", value });
|
|
2397
2596
|
continue;
|
|
2398
2597
|
}
|
|
2399
|
-
|
|
2598
|
+
block2 = stack.pop();
|
|
2400
2599
|
push({ type: "text", value });
|
|
2401
|
-
|
|
2600
|
+
block2 = stack[stack.length - 1];
|
|
2402
2601
|
continue;
|
|
2403
2602
|
}
|
|
2404
2603
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2423,7 +2622,7 @@ var require_parse = __commonJS({
|
|
|
2423
2622
|
}
|
|
2424
2623
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2425
2624
|
depth++;
|
|
2426
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2625
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2427
2626
|
const brace = {
|
|
2428
2627
|
type: "brace",
|
|
2429
2628
|
open: true,
|
|
@@ -2434,52 +2633,52 @@ var require_parse = __commonJS({
|
|
|
2434
2633
|
ranges: 0,
|
|
2435
2634
|
nodes: []
|
|
2436
2635
|
};
|
|
2437
|
-
|
|
2438
|
-
stack.push(
|
|
2636
|
+
block2 = push(brace);
|
|
2637
|
+
stack.push(block2);
|
|
2439
2638
|
push({ type: "open", value });
|
|
2440
2639
|
continue;
|
|
2441
2640
|
}
|
|
2442
2641
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2443
|
-
if (
|
|
2642
|
+
if (block2.type !== "brace") {
|
|
2444
2643
|
push({ type: "text", value });
|
|
2445
2644
|
continue;
|
|
2446
2645
|
}
|
|
2447
2646
|
const type = "close";
|
|
2448
|
-
|
|
2449
|
-
|
|
2647
|
+
block2 = stack.pop();
|
|
2648
|
+
block2.close = true;
|
|
2450
2649
|
push({ type, value });
|
|
2451
2650
|
depth--;
|
|
2452
|
-
|
|
2651
|
+
block2 = stack[stack.length - 1];
|
|
2453
2652
|
continue;
|
|
2454
2653
|
}
|
|
2455
2654
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2458
|
-
const open =
|
|
2459
|
-
|
|
2655
|
+
if (block2.ranges > 0) {
|
|
2656
|
+
block2.ranges = 0;
|
|
2657
|
+
const open = block2.nodes.shift();
|
|
2658
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2460
2659
|
}
|
|
2461
2660
|
push({ type: "comma", value });
|
|
2462
|
-
|
|
2661
|
+
block2.commas++;
|
|
2463
2662
|
continue;
|
|
2464
2663
|
}
|
|
2465
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2466
|
-
const siblings =
|
|
2664
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2665
|
+
const siblings = block2.nodes;
|
|
2467
2666
|
if (depth === 0 || siblings.length === 0) {
|
|
2468
2667
|
push({ type: "text", value });
|
|
2469
2668
|
continue;
|
|
2470
2669
|
}
|
|
2471
2670
|
if (prev.type === "dot") {
|
|
2472
|
-
|
|
2671
|
+
block2.range = [];
|
|
2473
2672
|
prev.value += value;
|
|
2474
2673
|
prev.type = "range";
|
|
2475
|
-
if (
|
|
2476
|
-
|
|
2477
|
-
|
|
2674
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2675
|
+
block2.invalid = true;
|
|
2676
|
+
block2.ranges = 0;
|
|
2478
2677
|
prev.type = "text";
|
|
2479
2678
|
continue;
|
|
2480
2679
|
}
|
|
2481
|
-
|
|
2482
|
-
|
|
2680
|
+
block2.ranges++;
|
|
2681
|
+
block2.args = [];
|
|
2483
2682
|
continue;
|
|
2484
2683
|
}
|
|
2485
2684
|
if (prev.type === "range") {
|
|
@@ -2487,7 +2686,7 @@ var require_parse = __commonJS({
|
|
|
2487
2686
|
const before = siblings[siblings.length - 1];
|
|
2488
2687
|
before.value += prev.value + value;
|
|
2489
2688
|
prev = before;
|
|
2490
|
-
|
|
2689
|
+
block2.ranges--;
|
|
2491
2690
|
continue;
|
|
2492
2691
|
}
|
|
2493
2692
|
push({ type: "dot", value });
|
|
@@ -2496,9 +2695,9 @@ var require_parse = __commonJS({
|
|
|
2496
2695
|
push({ type: "text", value });
|
|
2497
2696
|
}
|
|
2498
2697
|
do {
|
|
2499
|
-
|
|
2500
|
-
if (
|
|
2501
|
-
|
|
2698
|
+
block2 = stack.pop();
|
|
2699
|
+
if (block2.type !== "root") {
|
|
2700
|
+
block2.nodes.forEach((node) => {
|
|
2502
2701
|
if (!node.nodes) {
|
|
2503
2702
|
if (node.type === "open") node.isOpen = true;
|
|
2504
2703
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2507,8 +2706,8 @@ var require_parse = __commonJS({
|
|
|
2507
2706
|
}
|
|
2508
2707
|
});
|
|
2509
2708
|
const parent = stack[stack.length - 1];
|
|
2510
|
-
const index2 = parent.nodes.indexOf(
|
|
2511
|
-
parent.nodes.splice(index2, 1, ...
|
|
2709
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2710
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2512
2711
|
}
|
|
2513
2712
|
} while (stack.length > 0);
|
|
2514
2713
|
push({ type: "eos" });
|
|
@@ -3141,9 +3340,9 @@ var require_scan = __commonJS({
|
|
|
3141
3340
|
if (opts.parts === true || opts.tokens === true) {
|
|
3142
3341
|
let prevIndex;
|
|
3143
3342
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3144
|
-
const
|
|
3145
|
-
const
|
|
3146
|
-
const value = input.slice(
|
|
3343
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3344
|
+
const i2 = slashes[idx];
|
|
3345
|
+
const value = input.slice(n3, i2);
|
|
3147
3346
|
if (opts.tokens) {
|
|
3148
3347
|
if (idx === 0 && start !== 0) {
|
|
3149
3348
|
tokens[idx].isPrefix = true;
|
|
@@ -3157,7 +3356,7 @@ var require_scan = __commonJS({
|
|
|
3157
3356
|
if (idx !== 0 || value !== "") {
|
|
3158
3357
|
parts.push(value);
|
|
3159
3358
|
}
|
|
3160
|
-
prevIndex =
|
|
3359
|
+
prevIndex = i2;
|
|
3161
3360
|
}
|
|
3162
3361
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3163
3362
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3286,15 +3485,15 @@ var require_parse2 = __commonJS({
|
|
|
3286
3485
|
};
|
|
3287
3486
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3288
3487
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3289
|
-
for (let
|
|
3290
|
-
for (let
|
|
3291
|
-
const
|
|
3292
|
-
const b = values[
|
|
3293
|
-
const char =
|
|
3294
|
-
if (!char ||
|
|
3488
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3489
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3490
|
+
const a2 = values[i2];
|
|
3491
|
+
const b = values[j];
|
|
3492
|
+
const char = a2[0];
|
|
3493
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3295
3494
|
continue;
|
|
3296
3495
|
}
|
|
3297
|
-
if (
|
|
3496
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3298
3497
|
return true;
|
|
3299
3498
|
}
|
|
3300
3499
|
}
|
|
@@ -3309,8 +3508,8 @@ var require_parse2 = __commonJS({
|
|
|
3309
3508
|
let paren = 0;
|
|
3310
3509
|
let quote = 0;
|
|
3311
3510
|
let escaped = false;
|
|
3312
|
-
for (let
|
|
3313
|
-
const ch = pattern[
|
|
3511
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3512
|
+
const ch = pattern[i2];
|
|
3314
3513
|
if (escaped === true) {
|
|
3315
3514
|
escaped = false;
|
|
3316
3515
|
continue;
|
|
@@ -3344,13 +3543,13 @@ var require_parse2 = __commonJS({
|
|
|
3344
3543
|
if (ch === ")") {
|
|
3345
3544
|
paren--;
|
|
3346
3545
|
if (paren === 0) {
|
|
3347
|
-
if (requireEnd === true &&
|
|
3546
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3348
3547
|
return;
|
|
3349
3548
|
}
|
|
3350
3549
|
return {
|
|
3351
3550
|
type: pattern[0],
|
|
3352
|
-
body: pattern.slice(2,
|
|
3353
|
-
end:
|
|
3551
|
+
body: pattern.slice(2, i2),
|
|
3552
|
+
end: i2
|
|
3354
3553
|
};
|
|
3355
3554
|
}
|
|
3356
3555
|
}
|
|
@@ -3482,7 +3681,7 @@ var require_parse2 = __commonJS({
|
|
|
3482
3681
|
let prev = bos;
|
|
3483
3682
|
let value;
|
|
3484
3683
|
const eos = () => state.index === len - 1;
|
|
3485
|
-
const peek = state.peek = (
|
|
3684
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3486
3685
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3487
3686
|
const remaining = () => input.slice(state.index + 1);
|
|
3488
3687
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3563,10 +3762,10 @@ var require_parse2 = __commonJS({
|
|
|
3563
3762
|
open.type = "text";
|
|
3564
3763
|
open.value = literal;
|
|
3565
3764
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3566
|
-
for (let
|
|
3567
|
-
tokens[
|
|
3568
|
-
tokens[
|
|
3569
|
-
delete tokens[
|
|
3765
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3766
|
+
tokens[i2].value = "";
|
|
3767
|
+
tokens[i2].output = "";
|
|
3768
|
+
delete tokens[i2].suffix;
|
|
3570
3769
|
}
|
|
3571
3770
|
state.output = token.output + open.output;
|
|
3572
3771
|
state.backtrack = true;
|
|
@@ -3809,13 +4008,13 @@ var require_parse2 = __commonJS({
|
|
|
3809
4008
|
if (brace.dots === true) {
|
|
3810
4009
|
const arr = tokens.slice();
|
|
3811
4010
|
const range = [];
|
|
3812
|
-
for (let
|
|
4011
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3813
4012
|
tokens.pop();
|
|
3814
|
-
if (arr[
|
|
4013
|
+
if (arr[i2].type === "brace") {
|
|
3815
4014
|
break;
|
|
3816
4015
|
}
|
|
3817
|
-
if (arr[
|
|
3818
|
-
range.unshift(arr[
|
|
4016
|
+
if (arr[i2].type !== "dots") {
|
|
4017
|
+
range.unshift(arr[i2].value);
|
|
3819
4018
|
}
|
|
3820
4019
|
}
|
|
3821
4020
|
output = expandRange(range, opts);
|
|
@@ -4274,7 +4473,7 @@ var require_picomatch = __commonJS({
|
|
|
4274
4473
|
};
|
|
4275
4474
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4276
4475
|
picomatch.parse = (pattern, options) => {
|
|
4277
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4476
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4278
4477
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4279
4478
|
};
|
|
4280
4479
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4358,8 +4557,8 @@ var require_micromatch = __commonJS({
|
|
|
4358
4557
|
options.onResult(state);
|
|
4359
4558
|
}
|
|
4360
4559
|
};
|
|
4361
|
-
for (let
|
|
4362
|
-
let isMatch = picomatch(String(patterns[
|
|
4560
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4561
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4363
4562
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4364
4563
|
if (negated) negatives++;
|
|
4365
4564
|
for (let item of list) {
|
|
@@ -4381,7 +4580,7 @@ var require_micromatch = __commonJS({
|
|
|
4381
4580
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4382
4581
|
}
|
|
4383
4582
|
if (options.nonull === true || options.nullglob === true) {
|
|
4384
|
-
return options.unescape ? patterns.map((
|
|
4583
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4385
4584
|
}
|
|
4386
4585
|
}
|
|
4387
4586
|
return matches;
|
|
@@ -4411,7 +4610,7 @@ var require_micromatch = __commonJS({
|
|
|
4411
4610
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4412
4611
|
}
|
|
4413
4612
|
if (Array.isArray(pattern)) {
|
|
4414
|
-
return pattern.some((
|
|
4613
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4415
4614
|
}
|
|
4416
4615
|
if (typeof pattern === "string") {
|
|
4417
4616
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4456,7 +4655,7 @@ var require_micromatch = __commonJS({
|
|
|
4456
4655
|
if (typeof str !== "string") {
|
|
4457
4656
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4458
4657
|
}
|
|
4459
|
-
return [].concat(patterns).every((
|
|
4658
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4460
4659
|
};
|
|
4461
4660
|
micromatch.capture = (glob, input, options) => {
|
|
4462
4661
|
let posix = utils.isWindows(options);
|
|
@@ -4607,7 +4806,7 @@ var require_pattern = __commonJS({
|
|
|
4607
4806
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4608
4807
|
function expandBraceExpansion(pattern) {
|
|
4609
4808
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4610
|
-
patterns.sort((
|
|
4809
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4611
4810
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4612
4811
|
}
|
|
4613
4812
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4688,8 +4887,8 @@ var require_merge2 = __commonJS({
|
|
|
4688
4887
|
}
|
|
4689
4888
|
const mergedStream = PassThrough(options);
|
|
4690
4889
|
function addStream() {
|
|
4691
|
-
for (let
|
|
4692
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
4890
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
4891
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4693
4892
|
}
|
|
4694
4893
|
mergeStream();
|
|
4695
4894
|
return this;
|
|
@@ -4738,8 +4937,8 @@ var require_merge2 = __commonJS({
|
|
|
4738
4937
|
stream.pipe(mergedStream, { end: false });
|
|
4739
4938
|
stream.resume();
|
|
4740
4939
|
}
|
|
4741
|
-
for (let
|
|
4742
|
-
pipe(streams[
|
|
4940
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
4941
|
+
pipe(streams[i2]);
|
|
4743
4942
|
}
|
|
4744
4943
|
next();
|
|
4745
4944
|
}
|
|
@@ -4770,8 +4969,8 @@ var require_merge2 = __commonJS({
|
|
|
4770
4969
|
}
|
|
4771
4970
|
streams.pause();
|
|
4772
4971
|
} else {
|
|
4773
|
-
for (let
|
|
4774
|
-
streams[
|
|
4972
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
4973
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4775
4974
|
}
|
|
4776
4975
|
}
|
|
4777
4976
|
return streams;
|
|
@@ -4853,13 +5052,13 @@ var require_tasks = __commonJS({
|
|
|
4853
5052
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4854
5053
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4855
5054
|
var utils = require_utils3();
|
|
4856
|
-
function generate(input,
|
|
4857
|
-
const patterns = processPatterns(input,
|
|
4858
|
-
const ignore = processPatterns(
|
|
5055
|
+
function generate(input, settings2) {
|
|
5056
|
+
const patterns = processPatterns(input, settings2);
|
|
5057
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4859
5058
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4860
5059
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4861
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4862
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5060
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5061
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4863
5062
|
const staticTasks = convertPatternsToTasks(
|
|
4864
5063
|
staticPatterns,
|
|
4865
5064
|
negativePatterns,
|
|
@@ -4875,12 +5074,12 @@ var require_tasks = __commonJS({
|
|
|
4875
5074
|
return staticTasks.concat(dynamicTasks);
|
|
4876
5075
|
}
|
|
4877
5076
|
exports.generate = generate;
|
|
4878
|
-
function processPatterns(input,
|
|
5077
|
+
function processPatterns(input, settings2) {
|
|
4879
5078
|
let patterns = input;
|
|
4880
|
-
if (
|
|
5079
|
+
if (settings2.braceExpansion) {
|
|
4881
5080
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
4882
5081
|
}
|
|
4883
|
-
if (
|
|
5082
|
+
if (settings2.baseNameMatch) {
|
|
4884
5083
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
4885
5084
|
}
|
|
4886
5085
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -4911,7 +5110,7 @@ var require_tasks = __commonJS({
|
|
|
4911
5110
|
}
|
|
4912
5111
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
4913
5112
|
function groupPatternsByBaseDirectory(patterns) {
|
|
4914
|
-
const
|
|
5113
|
+
const group2 = {};
|
|
4915
5114
|
return patterns.reduce((collection, pattern) => {
|
|
4916
5115
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
4917
5116
|
if (base in collection) {
|
|
@@ -4920,7 +5119,7 @@ var require_tasks = __commonJS({
|
|
|
4920
5119
|
collection[base] = [pattern];
|
|
4921
5120
|
}
|
|
4922
5121
|
return collection;
|
|
4923
|
-
},
|
|
5122
|
+
}, group2);
|
|
4924
5123
|
}
|
|
4925
5124
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
4926
5125
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -4949,26 +5148,26 @@ var require_async = __commonJS({
|
|
|
4949
5148
|
init_utils2();
|
|
4950
5149
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4951
5150
|
exports.read = void 0;
|
|
4952
|
-
function read(path,
|
|
4953
|
-
|
|
5151
|
+
function read(path, settings2, callback) {
|
|
5152
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
4954
5153
|
if (lstatError !== null) {
|
|
4955
5154
|
callFailureCallback(callback, lstatError);
|
|
4956
5155
|
return;
|
|
4957
5156
|
}
|
|
4958
|
-
if (!lstat.isSymbolicLink() || !
|
|
5157
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
4959
5158
|
callSuccessCallback(callback, lstat);
|
|
4960
5159
|
return;
|
|
4961
5160
|
}
|
|
4962
|
-
|
|
5161
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
4963
5162
|
if (statError !== null) {
|
|
4964
|
-
if (
|
|
5163
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
4965
5164
|
callFailureCallback(callback, statError);
|
|
4966
5165
|
return;
|
|
4967
5166
|
}
|
|
4968
5167
|
callSuccessCallback(callback, lstat);
|
|
4969
5168
|
return;
|
|
4970
5169
|
}
|
|
4971
|
-
if (
|
|
5170
|
+
if (settings2.markSymbolicLink) {
|
|
4972
5171
|
stat.isSymbolicLink = () => true;
|
|
4973
5172
|
}
|
|
4974
5173
|
callSuccessCallback(callback, stat);
|
|
@@ -4992,19 +5191,19 @@ var require_sync = __commonJS({
|
|
|
4992
5191
|
init_utils2();
|
|
4993
5192
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4994
5193
|
exports.read = void 0;
|
|
4995
|
-
function read(path,
|
|
4996
|
-
const lstat =
|
|
4997
|
-
if (!lstat.isSymbolicLink() || !
|
|
5194
|
+
function read(path, settings2) {
|
|
5195
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5196
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
4998
5197
|
return lstat;
|
|
4999
5198
|
}
|
|
5000
5199
|
try {
|
|
5001
|
-
const stat =
|
|
5002
|
-
if (
|
|
5200
|
+
const stat = settings2.fs.statSync(path);
|
|
5201
|
+
if (settings2.markSymbolicLink) {
|
|
5003
5202
|
stat.isSymbolicLink = () => true;
|
|
5004
5203
|
}
|
|
5005
5204
|
return stat;
|
|
5006
5205
|
} catch (error2) {
|
|
5007
|
-
if (!
|
|
5206
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5008
5207
|
return lstat;
|
|
5009
5208
|
}
|
|
5010
5209
|
throw error2;
|
|
@@ -5081,8 +5280,8 @@ var require_out = __commonJS({
|
|
|
5081
5280
|
}
|
|
5082
5281
|
exports.stat = stat;
|
|
5083
5282
|
function statSync3(path, optionsOrSettings) {
|
|
5084
|
-
const
|
|
5085
|
-
return sync.read(path,
|
|
5283
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5284
|
+
return sync.read(path, settings2);
|
|
5086
5285
|
}
|
|
5087
5286
|
exports.statSync = statSync3;
|
|
5088
5287
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5130,8 +5329,8 @@ var require_run_parallel = __commonJS({
|
|
|
5130
5329
|
if (isSync) queueMicrotask2(end);
|
|
5131
5330
|
else end();
|
|
5132
5331
|
}
|
|
5133
|
-
function each(
|
|
5134
|
-
results[
|
|
5332
|
+
function each(i2, err, result) {
|
|
5333
|
+
results[i2] = result;
|
|
5135
5334
|
if (--pending === 0 || err) {
|
|
5136
5335
|
done(err);
|
|
5137
5336
|
}
|
|
@@ -5145,9 +5344,9 @@ var require_run_parallel = __commonJS({
|
|
|
5145
5344
|
});
|
|
5146
5345
|
});
|
|
5147
5346
|
} else {
|
|
5148
|
-
tasks.forEach(function(task,
|
|
5347
|
+
tasks.forEach(function(task, i2) {
|
|
5149
5348
|
task(function(err, result) {
|
|
5150
|
-
each(
|
|
5349
|
+
each(i2, err, result);
|
|
5151
5350
|
});
|
|
5152
5351
|
});
|
|
5153
5352
|
}
|
|
@@ -5222,11 +5421,11 @@ var require_common = __commonJS({
|
|
|
5222
5421
|
init_utils2();
|
|
5223
5422
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5224
5423
|
exports.joinPathSegments = void 0;
|
|
5225
|
-
function joinPathSegments(
|
|
5226
|
-
if (
|
|
5227
|
-
return
|
|
5424
|
+
function joinPathSegments(a2, b, separator) {
|
|
5425
|
+
if (a2.endsWith(separator)) {
|
|
5426
|
+
return a2 + b;
|
|
5228
5427
|
}
|
|
5229
|
-
return
|
|
5428
|
+
return a2 + separator + b;
|
|
5230
5429
|
}
|
|
5231
5430
|
exports.joinPathSegments = joinPathSegments;
|
|
5232
5431
|
}
|
|
@@ -5244,16 +5443,16 @@ var require_async2 = __commonJS({
|
|
|
5244
5443
|
var constants_1 = require_constants3();
|
|
5245
5444
|
var utils = require_utils4();
|
|
5246
5445
|
var common = require_common();
|
|
5247
|
-
function read(directory,
|
|
5248
|
-
if (!
|
|
5249
|
-
readdirWithFileTypes(directory,
|
|
5446
|
+
function read(directory, settings2, callback) {
|
|
5447
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5448
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5250
5449
|
return;
|
|
5251
5450
|
}
|
|
5252
|
-
readdir(directory,
|
|
5451
|
+
readdir(directory, settings2, callback);
|
|
5253
5452
|
}
|
|
5254
5453
|
exports.read = read;
|
|
5255
|
-
function readdirWithFileTypes(directory,
|
|
5256
|
-
|
|
5454
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5455
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5257
5456
|
if (readdirError !== null) {
|
|
5258
5457
|
callFailureCallback(callback, readdirError);
|
|
5259
5458
|
return;
|
|
@@ -5261,13 +5460,13 @@ var require_async2 = __commonJS({
|
|
|
5261
5460
|
const entries = dirents.map((dirent) => ({
|
|
5262
5461
|
dirent,
|
|
5263
5462
|
name: dirent.name,
|
|
5264
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5463
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5265
5464
|
}));
|
|
5266
|
-
if (!
|
|
5465
|
+
if (!settings2.followSymbolicLinks) {
|
|
5267
5466
|
callSuccessCallback(callback, entries);
|
|
5268
5467
|
return;
|
|
5269
5468
|
}
|
|
5270
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5469
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5271
5470
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5272
5471
|
if (rplError !== null) {
|
|
5273
5472
|
callFailureCallback(callback, rplError);
|
|
@@ -5278,15 +5477,15 @@ var require_async2 = __commonJS({
|
|
|
5278
5477
|
});
|
|
5279
5478
|
}
|
|
5280
5479
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5281
|
-
function makeRplTaskEntry(entry,
|
|
5480
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5282
5481
|
return (done) => {
|
|
5283
5482
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5284
5483
|
done(null, entry);
|
|
5285
5484
|
return;
|
|
5286
5485
|
}
|
|
5287
|
-
|
|
5486
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5288
5487
|
if (statError !== null) {
|
|
5289
|
-
if (
|
|
5488
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5290
5489
|
done(statError);
|
|
5291
5490
|
return;
|
|
5292
5491
|
}
|
|
@@ -5298,16 +5497,16 @@ var require_async2 = __commonJS({
|
|
|
5298
5497
|
});
|
|
5299
5498
|
};
|
|
5300
5499
|
}
|
|
5301
|
-
function readdir(directory,
|
|
5302
|
-
|
|
5500
|
+
function readdir(directory, settings2, callback) {
|
|
5501
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5303
5502
|
if (readdirError !== null) {
|
|
5304
5503
|
callFailureCallback(callback, readdirError);
|
|
5305
5504
|
return;
|
|
5306
5505
|
}
|
|
5307
5506
|
const tasks = names.map((name) => {
|
|
5308
|
-
const path = common.joinPathSegments(directory, name,
|
|
5507
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5309
5508
|
return (done) => {
|
|
5310
|
-
fsStat.stat(path,
|
|
5509
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5311
5510
|
if (error2 !== null) {
|
|
5312
5511
|
done(error2);
|
|
5313
5512
|
return;
|
|
@@ -5317,7 +5516,7 @@ var require_async2 = __commonJS({
|
|
|
5317
5516
|
path,
|
|
5318
5517
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5319
5518
|
};
|
|
5320
|
-
if (
|
|
5519
|
+
if (settings2.stats) {
|
|
5321
5520
|
entry.stats = stats;
|
|
5322
5521
|
}
|
|
5323
5522
|
done(null, entry);
|
|
@@ -5354,27 +5553,27 @@ var require_sync2 = __commonJS({
|
|
|
5354
5553
|
var constants_1 = require_constants3();
|
|
5355
5554
|
var utils = require_utils4();
|
|
5356
5555
|
var common = require_common();
|
|
5357
|
-
function read(directory,
|
|
5358
|
-
if (!
|
|
5359
|
-
return readdirWithFileTypes(directory,
|
|
5556
|
+
function read(directory, settings2) {
|
|
5557
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5558
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5360
5559
|
}
|
|
5361
|
-
return readdir(directory,
|
|
5560
|
+
return readdir(directory, settings2);
|
|
5362
5561
|
}
|
|
5363
5562
|
exports.read = read;
|
|
5364
|
-
function readdirWithFileTypes(directory,
|
|
5365
|
-
const dirents =
|
|
5563
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5564
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5366
5565
|
return dirents.map((dirent) => {
|
|
5367
5566
|
const entry = {
|
|
5368
5567
|
dirent,
|
|
5369
5568
|
name: dirent.name,
|
|
5370
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5569
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5371
5570
|
};
|
|
5372
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5571
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5373
5572
|
try {
|
|
5374
|
-
const stats =
|
|
5573
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5375
5574
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5376
5575
|
} catch (error2) {
|
|
5377
|
-
if (
|
|
5576
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5378
5577
|
throw error2;
|
|
5379
5578
|
}
|
|
5380
5579
|
}
|
|
@@ -5383,17 +5582,17 @@ var require_sync2 = __commonJS({
|
|
|
5383
5582
|
});
|
|
5384
5583
|
}
|
|
5385
5584
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5386
|
-
function readdir(directory,
|
|
5387
|
-
const names =
|
|
5585
|
+
function readdir(directory, settings2) {
|
|
5586
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5388
5587
|
return names.map((name) => {
|
|
5389
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5390
|
-
const stats = fsStat.statSync(entryPath,
|
|
5588
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5589
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5391
5590
|
const entry = {
|
|
5392
5591
|
name,
|
|
5393
5592
|
path: entryPath,
|
|
5394
5593
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5395
5594
|
};
|
|
5396
|
-
if (
|
|
5595
|
+
if (settings2.stats) {
|
|
5397
5596
|
entry.stats = stats;
|
|
5398
5597
|
}
|
|
5399
5598
|
return entry;
|
|
@@ -5480,8 +5679,8 @@ var require_out2 = __commonJS({
|
|
|
5480
5679
|
}
|
|
5481
5680
|
exports.scandir = scandir;
|
|
5482
5681
|
function scandirSync(path, optionsOrSettings) {
|
|
5483
|
-
const
|
|
5484
|
-
return sync.read(path,
|
|
5682
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5683
|
+
return sync.read(path, settings2);
|
|
5485
5684
|
}
|
|
5486
5685
|
exports.scandirSync = scandirSync;
|
|
5487
5686
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5762,7 +5961,7 @@ var require_queue = __commonJS({
|
|
|
5762
5961
|
queue.drained = drained;
|
|
5763
5962
|
return queue;
|
|
5764
5963
|
function push(value) {
|
|
5765
|
-
var
|
|
5964
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5766
5965
|
pushCb(value, function(err, result) {
|
|
5767
5966
|
if (err) {
|
|
5768
5967
|
reject(err);
|
|
@@ -5771,11 +5970,11 @@ var require_queue = __commonJS({
|
|
|
5771
5970
|
resolve4(result);
|
|
5772
5971
|
});
|
|
5773
5972
|
});
|
|
5774
|
-
|
|
5775
|
-
return
|
|
5973
|
+
p.catch(noop);
|
|
5974
|
+
return p;
|
|
5776
5975
|
}
|
|
5777
5976
|
function unshift(value) {
|
|
5778
|
-
var
|
|
5977
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5779
5978
|
unshiftCb(value, function(err, result) {
|
|
5780
5979
|
if (err) {
|
|
5781
5980
|
reject(err);
|
|
@@ -5784,11 +5983,11 @@ var require_queue = __commonJS({
|
|
|
5784
5983
|
resolve4(result);
|
|
5785
5984
|
});
|
|
5786
5985
|
});
|
|
5787
|
-
|
|
5788
|
-
return
|
|
5986
|
+
p.catch(noop);
|
|
5987
|
+
return p;
|
|
5789
5988
|
}
|
|
5790
5989
|
function drained() {
|
|
5791
|
-
var
|
|
5990
|
+
var p = new Promise(function(resolve4) {
|
|
5792
5991
|
process.nextTick(function() {
|
|
5793
5992
|
if (queue.idle()) {
|
|
5794
5993
|
resolve4();
|
|
@@ -5802,7 +6001,7 @@ var require_queue = __commonJS({
|
|
|
5802
6001
|
}
|
|
5803
6002
|
});
|
|
5804
6003
|
});
|
|
5805
|
-
return
|
|
6004
|
+
return p;
|
|
5806
6005
|
}
|
|
5807
6006
|
}
|
|
5808
6007
|
module.exports = fastqueue;
|
|
@@ -5817,11 +6016,11 @@ var require_common2 = __commonJS({
|
|
|
5817
6016
|
init_utils2();
|
|
5818
6017
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5819
6018
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5820
|
-
function isFatalError(
|
|
5821
|
-
if (
|
|
6019
|
+
function isFatalError(settings2, error2) {
|
|
6020
|
+
if (settings2.errorFilter === null) {
|
|
5822
6021
|
return true;
|
|
5823
6022
|
}
|
|
5824
|
-
return !
|
|
6023
|
+
return !settings2.errorFilter(error2);
|
|
5825
6024
|
}
|
|
5826
6025
|
exports.isFatalError = isFatalError;
|
|
5827
6026
|
function isAppliedFilter(filter, value) {
|
|
@@ -5832,14 +6031,14 @@ var require_common2 = __commonJS({
|
|
|
5832
6031
|
return filepath.split(/[/\\]/).join(separator);
|
|
5833
6032
|
}
|
|
5834
6033
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5835
|
-
function joinPathSegments(
|
|
5836
|
-
if (
|
|
6034
|
+
function joinPathSegments(a2, b, separator) {
|
|
6035
|
+
if (a2 === "") {
|
|
5837
6036
|
return b;
|
|
5838
6037
|
}
|
|
5839
|
-
if (
|
|
5840
|
-
return
|
|
6038
|
+
if (a2.endsWith(separator)) {
|
|
6039
|
+
return a2 + b;
|
|
5841
6040
|
}
|
|
5842
|
-
return
|
|
6041
|
+
return a2 + separator + b;
|
|
5843
6042
|
}
|
|
5844
6043
|
exports.joinPathSegments = joinPathSegments;
|
|
5845
6044
|
}
|
|
@@ -6186,14 +6385,14 @@ var require_out3 = __commonJS({
|
|
|
6186
6385
|
}
|
|
6187
6386
|
exports.walk = walk;
|
|
6188
6387
|
function walkSync(directory, optionsOrSettings) {
|
|
6189
|
-
const
|
|
6190
|
-
const provider = new sync_1.default(directory,
|
|
6388
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6389
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6191
6390
|
return provider.read();
|
|
6192
6391
|
}
|
|
6193
6392
|
exports.walkSync = walkSync;
|
|
6194
6393
|
function walkStream(directory, optionsOrSettings) {
|
|
6195
|
-
const
|
|
6196
|
-
const provider = new stream_1.default(directory,
|
|
6394
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6395
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6197
6396
|
return provider.read();
|
|
6198
6397
|
}
|
|
6199
6398
|
exports.walkStream = walkStream;
|
|
@@ -6279,8 +6478,8 @@ var require_stream3 = __commonJS({
|
|
|
6279
6478
|
done();
|
|
6280
6479
|
}).catch(done);
|
|
6281
6480
|
};
|
|
6282
|
-
for (let
|
|
6283
|
-
stream.write(
|
|
6481
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6482
|
+
stream.write(i2);
|
|
6284
6483
|
}
|
|
6285
6484
|
return stream;
|
|
6286
6485
|
}
|
|
@@ -6941,14 +7140,14 @@ var require_out4 = __commonJS({
|
|
|
6941
7140
|
function generateTasks(source, options) {
|
|
6942
7141
|
assertPatternsInput(source);
|
|
6943
7142
|
const patterns = [].concat(source);
|
|
6944
|
-
const
|
|
6945
|
-
return taskManager.generate(patterns,
|
|
7143
|
+
const settings2 = new settings_1.default(options);
|
|
7144
|
+
return taskManager.generate(patterns, settings2);
|
|
6946
7145
|
}
|
|
6947
7146
|
FastGlob2.generateTasks = generateTasks;
|
|
6948
7147
|
function isDynamicPattern(source, options) {
|
|
6949
7148
|
assertPatternsInput(source);
|
|
6950
|
-
const
|
|
6951
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7149
|
+
const settings2 = new settings_1.default(options);
|
|
7150
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
6952
7151
|
}
|
|
6953
7152
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
6954
7153
|
function escapePath(source) {
|
|
@@ -6990,9 +7189,9 @@ var require_out4 = __commonJS({
|
|
|
6990
7189
|
})(FastGlob || (FastGlob = {}));
|
|
6991
7190
|
function getWorks(source, _Provider, options) {
|
|
6992
7191
|
const patterns = [].concat(source);
|
|
6993
|
-
const
|
|
6994
|
-
const tasks = taskManager.generate(patterns,
|
|
6995
|
-
const provider = new _Provider(
|
|
7192
|
+
const settings2 = new settings_1.default(options);
|
|
7193
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7194
|
+
const provider = new _Provider(settings2);
|
|
6996
7195
|
return tasks.map(provider.read, provider);
|
|
6997
7196
|
}
|
|
6998
7197
|
function assertPatternsInput(input) {
|
|
@@ -7170,8 +7369,8 @@ import "node:fs";
|
|
|
7170
7369
|
import { createRequire } from "node:module";
|
|
7171
7370
|
import {
|
|
7172
7371
|
resolve,
|
|
7173
|
-
join,
|
|
7174
|
-
dirname,
|
|
7372
|
+
join as join2,
|
|
7373
|
+
dirname as dirname2,
|
|
7175
7374
|
relative,
|
|
7176
7375
|
normalize,
|
|
7177
7376
|
sep,
|
|
@@ -7185,7 +7384,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7185
7384
|
);
|
|
7186
7385
|
});
|
|
7187
7386
|
}
|
|
7188
|
-
var import_fast_glob, constants,
|
|
7387
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7189
7388
|
var init_PathResolver = __esm({
|
|
7190
7389
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7191
7390
|
"use strict";
|
|
@@ -7198,7 +7397,7 @@ var init_PathResolver = __esm({
|
|
|
7198
7397
|
getPatternsFor: getPatternsFor || void 0,
|
|
7199
7398
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7200
7399
|
};
|
|
7201
|
-
|
|
7400
|
+
log3 = {
|
|
7202
7401
|
error: (message, error2) => {
|
|
7203
7402
|
},
|
|
7204
7403
|
warn: (message, error2) => {
|
|
@@ -7319,7 +7518,7 @@ var init_PathResolver = __esm({
|
|
|
7319
7518
|
*/
|
|
7320
7519
|
getDirname(path) {
|
|
7321
7520
|
if (!path) return "";
|
|
7322
|
-
return this.normalizePath(
|
|
7521
|
+
return this.normalizePath(dirname2(path));
|
|
7323
7522
|
}
|
|
7324
7523
|
/**
|
|
7325
7524
|
* Resolve package path using Node's module resolution
|
|
@@ -7331,7 +7530,7 @@ var init_PathResolver = __esm({
|
|
|
7331
7530
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7332
7531
|
try {
|
|
7333
7532
|
const basePath = fromPath || this.getAppRoot();
|
|
7334
|
-
const require3 = createRequire(
|
|
7533
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7335
7534
|
const resolved = require3.resolve(packageSpecifier);
|
|
7336
7535
|
return this.normalizePath(resolved);
|
|
7337
7536
|
} catch (error2) {
|
|
@@ -7483,7 +7682,7 @@ var init_PathResolver = __esm({
|
|
|
7483
7682
|
return cleanContent;
|
|
7484
7683
|
} catch (error2) {
|
|
7485
7684
|
if (this.options.debug) {
|
|
7486
|
-
|
|
7685
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7487
7686
|
}
|
|
7488
7687
|
return null;
|
|
7489
7688
|
}
|
|
@@ -7511,7 +7710,7 @@ var init_PathResolver = __esm({
|
|
|
7511
7710
|
return cleanContent;
|
|
7512
7711
|
} catch (error2) {
|
|
7513
7712
|
if (this.options.debug) {
|
|
7514
|
-
|
|
7713
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7515
7714
|
}
|
|
7516
7715
|
return null;
|
|
7517
7716
|
}
|
|
@@ -7533,16 +7732,16 @@ var init_PathResolver = __esm({
|
|
|
7533
7732
|
verbose = false
|
|
7534
7733
|
} = options;
|
|
7535
7734
|
const normalizedPath = this.normalizePath(filePath);
|
|
7536
|
-
const dir = this.normalizePath(
|
|
7735
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7537
7736
|
const fileExists = this.pathExists(normalizedPath);
|
|
7538
7737
|
if (fileExists && !overwrite) {
|
|
7539
7738
|
if (verbose) {
|
|
7540
|
-
|
|
7739
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7541
7740
|
}
|
|
7542
7741
|
return false;
|
|
7543
7742
|
}
|
|
7544
7743
|
if (dryRun) {
|
|
7545
|
-
|
|
7744
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7546
7745
|
return true;
|
|
7547
7746
|
}
|
|
7548
7747
|
try {
|
|
@@ -7567,7 +7766,7 @@ var init_PathResolver = __esm({
|
|
|
7567
7766
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7568
7767
|
}
|
|
7569
7768
|
if (verbose) {
|
|
7570
|
-
|
|
7769
|
+
log3.info(
|
|
7571
7770
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7572
7771
|
);
|
|
7573
7772
|
}
|
|
@@ -7594,16 +7793,16 @@ var init_PathResolver = __esm({
|
|
|
7594
7793
|
verbose = false
|
|
7595
7794
|
} = options;
|
|
7596
7795
|
const normalizedPath = this.normalizePath(filePath);
|
|
7597
|
-
const dir = this.normalizePath(
|
|
7796
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7598
7797
|
const fileExists = this.pathExists(normalizedPath);
|
|
7599
7798
|
if (fileExists && !overwrite) {
|
|
7600
7799
|
if (verbose) {
|
|
7601
|
-
|
|
7800
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7602
7801
|
}
|
|
7603
7802
|
return false;
|
|
7604
7803
|
}
|
|
7605
7804
|
if (dryRun) {
|
|
7606
|
-
|
|
7805
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7607
7806
|
return true;
|
|
7608
7807
|
}
|
|
7609
7808
|
try {
|
|
@@ -7627,7 +7826,7 @@ var init_PathResolver = __esm({
|
|
|
7627
7826
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7628
7827
|
}
|
|
7629
7828
|
if (verbose) {
|
|
7630
|
-
|
|
7829
|
+
log3.info(
|
|
7631
7830
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7632
7831
|
);
|
|
7633
7832
|
}
|
|
@@ -7652,15 +7851,15 @@ var init_PathResolver = __esm({
|
|
|
7652
7851
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7653
7852
|
if (fileExists && !overwrite) {
|
|
7654
7853
|
if (verbose) {
|
|
7655
|
-
|
|
7854
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7656
7855
|
}
|
|
7657
7856
|
return false;
|
|
7658
7857
|
}
|
|
7659
7858
|
if (dryRun) {
|
|
7660
|
-
|
|
7859
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7661
7860
|
return true;
|
|
7662
7861
|
}
|
|
7663
|
-
const dir = this.normalizePath(
|
|
7862
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7664
7863
|
try {
|
|
7665
7864
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7666
7865
|
} catch (error2) {
|
|
@@ -7670,7 +7869,7 @@ var init_PathResolver = __esm({
|
|
|
7670
7869
|
return await safeExecuteAsync(async () => {
|
|
7671
7870
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7672
7871
|
if (verbose) {
|
|
7673
|
-
|
|
7872
|
+
log3.info(
|
|
7674
7873
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7675
7874
|
);
|
|
7676
7875
|
}
|
|
@@ -7694,15 +7893,15 @@ var init_PathResolver = __esm({
|
|
|
7694
7893
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7695
7894
|
if (fileExists && !overwrite) {
|
|
7696
7895
|
if (verbose) {
|
|
7697
|
-
|
|
7896
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7698
7897
|
}
|
|
7699
7898
|
return false;
|
|
7700
7899
|
}
|
|
7701
7900
|
if (dryRun) {
|
|
7702
|
-
|
|
7901
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7703
7902
|
return true;
|
|
7704
7903
|
}
|
|
7705
|
-
const dir = this.normalizePath(
|
|
7904
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7706
7905
|
try {
|
|
7707
7906
|
fs.mkdirSync(dir, { recursive: true });
|
|
7708
7907
|
} catch (error2) {
|
|
@@ -7711,7 +7910,7 @@ var init_PathResolver = __esm({
|
|
|
7711
7910
|
try {
|
|
7712
7911
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
7713
7912
|
if (verbose) {
|
|
7714
|
-
|
|
7913
|
+
log3.info(
|
|
7715
7914
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7716
7915
|
);
|
|
7717
7916
|
}
|
|
@@ -7728,7 +7927,7 @@ var init_PathResolver = __esm({
|
|
|
7728
7927
|
return fs.existsSync(filePath);
|
|
7729
7928
|
} catch (error2) {
|
|
7730
7929
|
if (!silent) {
|
|
7731
|
-
|
|
7930
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7732
7931
|
}
|
|
7733
7932
|
return false;
|
|
7734
7933
|
}
|
|
@@ -7754,7 +7953,7 @@ var init_PathResolver = __esm({
|
|
|
7754
7953
|
return fs.readdirSync(dirPath, options);
|
|
7755
7954
|
} catch (error2) {
|
|
7756
7955
|
if (this.options.debug) {
|
|
7757
|
-
|
|
7956
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7758
7957
|
}
|
|
7759
7958
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7760
7959
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7772,7 +7971,7 @@ var init_PathResolver = __esm({
|
|
|
7772
7971
|
return fs.statSync(filePath);
|
|
7773
7972
|
} catch (error2) {
|
|
7774
7973
|
if (this.options.debug) {
|
|
7775
|
-
|
|
7974
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7776
7975
|
}
|
|
7777
7976
|
return null;
|
|
7778
7977
|
}
|
|
@@ -7789,7 +7988,7 @@ var init_PathResolver = __esm({
|
|
|
7789
7988
|
return fs.lstatSync(filePath);
|
|
7790
7989
|
} catch (error2) {
|
|
7791
7990
|
if (this.options.debug) {
|
|
7792
|
-
|
|
7991
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7793
7992
|
}
|
|
7794
7993
|
return null;
|
|
7795
7994
|
}
|
|
@@ -7878,7 +8077,7 @@ var init_PathResolver = __esm({
|
|
|
7878
8077
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
7879
8078
|
*/
|
|
7880
8079
|
isMonorepo() {
|
|
7881
|
-
const packagesDir =
|
|
8080
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
7882
8081
|
return this.pathExists(packagesDir);
|
|
7883
8082
|
}
|
|
7884
8083
|
/**
|
|
@@ -7895,7 +8094,7 @@ var init_PathResolver = __esm({
|
|
|
7895
8094
|
* Find files matching pattern within directory
|
|
7896
8095
|
*/
|
|
7897
8096
|
async findFiles(directory, pattern, options = {}) {
|
|
7898
|
-
const searchPattern = this.normalizePath(
|
|
8097
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
7899
8098
|
const appRoot = this.getAppRoot();
|
|
7900
8099
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
7901
8100
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -7942,7 +8141,7 @@ var init_PathResolver = __esm({
|
|
|
7942
8141
|
return null;
|
|
7943
8142
|
}
|
|
7944
8143
|
const resolvedPath = this.normalizePath(
|
|
7945
|
-
|
|
8144
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
7946
8145
|
);
|
|
7947
8146
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
7948
8147
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8138,13 +8337,13 @@ var init_PathResolver = __esm({
|
|
|
8138
8337
|
const maxLevels = this.options.maxLevels;
|
|
8139
8338
|
while (levelsChecked < maxLevels) {
|
|
8140
8339
|
const toolingPath = this.normalizePath(
|
|
8141
|
-
|
|
8340
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8142
8341
|
);
|
|
8143
|
-
const corePath = this.normalizePath(
|
|
8342
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8144
8343
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8145
8344
|
return currentDir;
|
|
8146
8345
|
}
|
|
8147
|
-
const appsDir =
|
|
8346
|
+
const appsDir = join2(currentDir, "apps");
|
|
8148
8347
|
if (this.pathExists(appsDir)) {
|
|
8149
8348
|
const appsDirStat = this.statSync(appsDir);
|
|
8150
8349
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8152,15 +8351,15 @@ var init_PathResolver = __esm({
|
|
|
8152
8351
|
}
|
|
8153
8352
|
}
|
|
8154
8353
|
const packageJsonPath = this.normalizePath(
|
|
8155
|
-
|
|
8354
|
+
join2(currentDir, "package.json")
|
|
8156
8355
|
);
|
|
8157
8356
|
if (this.pathExists(packageJsonPath)) {
|
|
8158
|
-
const parentDir2 = this.normalizePath(
|
|
8357
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8159
8358
|
if (parentDir2 === currentDir) {
|
|
8160
8359
|
return currentDir;
|
|
8161
8360
|
}
|
|
8162
8361
|
}
|
|
8163
|
-
const parentDir = this.normalizePath(
|
|
8362
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8164
8363
|
if (parentDir === currentDir) {
|
|
8165
8364
|
break;
|
|
8166
8365
|
}
|
|
@@ -8176,8 +8375,8 @@ var init_PathResolver = __esm({
|
|
|
8176
8375
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8177
8376
|
import { createRequire as createRequire2 } from "node:module";
|
|
8178
8377
|
import {
|
|
8179
|
-
join as
|
|
8180
|
-
dirname as
|
|
8378
|
+
join as join3,
|
|
8379
|
+
dirname as dirname3,
|
|
8181
8380
|
basename as basename2,
|
|
8182
8381
|
extname as extname2,
|
|
8183
8382
|
relative as relative2,
|
|
@@ -8186,7 +8385,7 @@ import {
|
|
|
8186
8385
|
isAbsolute as pathIsAbsolute
|
|
8187
8386
|
} from "node:path";
|
|
8188
8387
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8189
|
-
function
|
|
8388
|
+
function readdirSync3(dirPath, options) {
|
|
8190
8389
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8191
8390
|
}
|
|
8192
8391
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, statSync2, getRelativePathBetween, getDirname, joinPath;
|
|
@@ -8198,7 +8397,7 @@ var init_pathResolver = __esm({
|
|
|
8198
8397
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8199
8398
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8200
8399
|
normalizePath = (...pathSegments) => {
|
|
8201
|
-
return pathResolverInstance.normalizePath(
|
|
8400
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8202
8401
|
};
|
|
8203
8402
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8204
8403
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
@@ -8207,7 +8406,7 @@ var init_pathResolver = __esm({
|
|
|
8207
8406
|
return normalizePath(relative2(from, to));
|
|
8208
8407
|
};
|
|
8209
8408
|
getDirname = (filePath) => {
|
|
8210
|
-
return normalizePath(
|
|
8409
|
+
return normalizePath(dirname3(filePath));
|
|
8211
8410
|
};
|
|
8212
8411
|
joinPath = (...pathSegments) => {
|
|
8213
8412
|
return normalizePath(...pathSegments);
|
|
@@ -8219,7 +8418,7 @@ var init_pathResolver = __esm({
|
|
|
8219
8418
|
import { Buffer } from "node:buffer";
|
|
8220
8419
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8221
8420
|
import { createRequire as createRequire3 } from "node:module";
|
|
8222
|
-
import { dirname as
|
|
8421
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8223
8422
|
import process from "node:process";
|
|
8224
8423
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8225
8424
|
var require2, __filename, __dirname;
|
|
@@ -8228,7 +8427,7 @@ var init_utils2 = __esm({
|
|
|
8228
8427
|
"use strict";
|
|
8229
8428
|
require2 = createRequire3(import.meta.url);
|
|
8230
8429
|
__filename = fileURLToPath3(import.meta.url);
|
|
8231
|
-
__dirname =
|
|
8430
|
+
__dirname = dirname4(__filename);
|
|
8232
8431
|
if (typeof globalThis !== "undefined") {
|
|
8233
8432
|
globalThis.require = require2;
|
|
8234
8433
|
globalThis.__filename = __filename;
|
|
@@ -8249,13 +8448,13 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8249
8448
|
label: choice.title,
|
|
8250
8449
|
hint: choice.hint
|
|
8251
8450
|
}));
|
|
8252
|
-
const result = await
|
|
8451
|
+
const result = await select({
|
|
8253
8452
|
message,
|
|
8254
8453
|
options,
|
|
8255
8454
|
initialValue: choices[defaultValue]?.value
|
|
8256
8455
|
});
|
|
8257
|
-
if (
|
|
8258
|
-
|
|
8456
|
+
if (isCancel(result)) {
|
|
8457
|
+
cancel("Operation cancelled.");
|
|
8259
8458
|
process.exit(0);
|
|
8260
8459
|
}
|
|
8261
8460
|
return result;
|
|
@@ -8323,9 +8522,9 @@ async function validateToken(token) {
|
|
|
8323
8522
|
return { username: data.user.username, email: data.user.email };
|
|
8324
8523
|
}
|
|
8325
8524
|
async function fetchProjectDetails(token, projectId, orgId) {
|
|
8326
|
-
const
|
|
8525
|
+
const q = orgId ? `?teamId=${encodeURIComponent(orgId)}` : "";
|
|
8327
8526
|
const res = await fetch(
|
|
8328
|
-
`${VERCEL_API}/v9/projects/${encodeURIComponent(projectId)}${
|
|
8527
|
+
`${VERCEL_API}/v9/projects/${encodeURIComponent(projectId)}${q}`,
|
|
8329
8528
|
{
|
|
8330
8529
|
headers: { Authorization: `Bearer ${token}` }
|
|
8331
8530
|
}
|
|
@@ -8426,7 +8625,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
8426
8625
|
if (value) {
|
|
8427
8626
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
8428
8627
|
warnedLegacy.add(name);
|
|
8429
|
-
|
|
8628
|
+
log2.warn(
|
|
8430
8629
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
8431
8630
|
);
|
|
8432
8631
|
}
|
|
@@ -8437,7 +8636,7 @@ function resolveSecret(name, projectRoot, opts) {
|
|
|
8437
8636
|
if (aliasValue) {
|
|
8438
8637
|
if (!opts?.silent && !warnedLegacy.has(name)) {
|
|
8439
8638
|
warnedLegacy.add(name);
|
|
8440
|
-
|
|
8639
|
+
log2.warn(
|
|
8441
8640
|
`${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
|
|
8442
8641
|
);
|
|
8443
8642
|
}
|
|
@@ -8516,7 +8715,7 @@ function parseEnvFile2(filePath) {
|
|
|
8516
8715
|
}
|
|
8517
8716
|
const result = parseEnvFile(filePath);
|
|
8518
8717
|
if (Object.keys(result).length === 0) {
|
|
8519
|
-
|
|
8718
|
+
log2.debug(`No key-value pairs found in ${filePath}`);
|
|
8520
8719
|
}
|
|
8521
8720
|
return result;
|
|
8522
8721
|
}
|
|
@@ -8525,7 +8724,7 @@ function parseSecretsWithFallback(envFilePath, projectRoot) {
|
|
|
8525
8724
|
if (pathExists(dndevSecretsPath)) {
|
|
8526
8725
|
const secrets = parseEnvFile(dndevSecretsPath);
|
|
8527
8726
|
if (Object.keys(secrets).length > 0) {
|
|
8528
|
-
|
|
8727
|
+
log2.info(`Reading secrets from: ${dndevSecretsPath}`);
|
|
8529
8728
|
return secrets;
|
|
8530
8729
|
}
|
|
8531
8730
|
}
|
|
@@ -8539,7 +8738,7 @@ function detectPlatform() {
|
|
|
8539
8738
|
if (pathExists(joinPath(currentDir, "vercel.json")) || pathExists(joinPath(currentDir, ".vercel"))) {
|
|
8540
8739
|
return "vercel";
|
|
8541
8740
|
}
|
|
8542
|
-
|
|
8741
|
+
log2.warn("No platform detected, defaulting to Firebase");
|
|
8543
8742
|
return "firebase";
|
|
8544
8743
|
}
|
|
8545
8744
|
function findFirebaseProjectDir(envFilePath) {
|
|
@@ -8618,7 +8817,7 @@ function detectAppsWithFunctions() {
|
|
|
8618
8817
|
}
|
|
8619
8818
|
const apps = [];
|
|
8620
8819
|
try {
|
|
8621
|
-
const appsList =
|
|
8820
|
+
const appsList = readdirSync3(appsDir).filter((item) => {
|
|
8622
8821
|
const itemPath = joinPath(appsDir, item);
|
|
8623
8822
|
const stat = statSync2(itemPath);
|
|
8624
8823
|
return stat?.isDirectory() === true;
|
|
@@ -8635,7 +8834,7 @@ function detectAppsWithFunctions() {
|
|
|
8635
8834
|
}
|
|
8636
8835
|
} catch {
|
|
8637
8836
|
}
|
|
8638
|
-
return apps.sort((
|
|
8837
|
+
return apps.sort((a2, b) => a2.name.localeCompare(b.name));
|
|
8639
8838
|
}
|
|
8640
8839
|
async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
8641
8840
|
if (isFirebaseReservedKey(key)) {
|
|
@@ -8645,11 +8844,11 @@ async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
|
8645
8844
|
"FIREBASE_AUTH_DOMAIN"
|
|
8646
8845
|
];
|
|
8647
8846
|
if (configOnlyKeys.includes(key)) {
|
|
8648
|
-
|
|
8847
|
+
log2.debug(
|
|
8649
8848
|
`\u23ED\uFE0F Skipping ${key}: Configuration variable (stays in .env, not synced as secret)`
|
|
8650
8849
|
);
|
|
8651
8850
|
} else {
|
|
8652
|
-
|
|
8851
|
+
log2.warn(
|
|
8653
8852
|
`\u23ED\uFE0F Skipping ${key}: Reserved Firebase prefix (X_GOOGLE_, FIREBASE_, EXT_, GCLOUD_)`
|
|
8654
8853
|
);
|
|
8655
8854
|
}
|
|
@@ -8657,7 +8856,7 @@ async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
|
8657
8856
|
}
|
|
8658
8857
|
const finalProjectId = projectId || detectFirebaseProjectId(cwd);
|
|
8659
8858
|
if (dryRun) {
|
|
8660
|
-
|
|
8859
|
+
log2.info(
|
|
8661
8860
|
`[DRY RUN] Would set Firebase secret: ${key}${finalProjectId ? ` (project: ${finalProjectId})` : ""}`
|
|
8662
8861
|
);
|
|
8663
8862
|
return;
|
|
@@ -8677,7 +8876,7 @@ async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
|
8677
8876
|
);
|
|
8678
8877
|
}
|
|
8679
8878
|
try {
|
|
8680
|
-
|
|
8879
|
+
log2.info(`Setting Firebase secret: ${key} (project: ${finalProjectId})`);
|
|
8681
8880
|
const tempFile = "";
|
|
8682
8881
|
try {
|
|
8683
8882
|
const args = ["functions:secrets:set", key, "--project", finalProjectId];
|
|
@@ -8700,8 +8899,8 @@ async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
|
8700
8899
|
}
|
|
8701
8900
|
if (result.status !== 0) {
|
|
8702
8901
|
const stderr = result.stderr?.toString() || "";
|
|
8703
|
-
const
|
|
8704
|
-
const errorOutput = stderr ||
|
|
8902
|
+
const stdout2 = result.stdout?.toString() || "";
|
|
8903
|
+
const errorOutput = stderr || stdout2;
|
|
8705
8904
|
const errorLower = errorOutput.toLowerCase();
|
|
8706
8905
|
if (errorLower.includes("not logged in") || errorLower.includes("authentication required") || errorLower.includes("please login") || errorLower.includes("run firebase login") || errorLower.includes("unauthorized") || errorOutput.includes("401")) {
|
|
8707
8906
|
throw new DoNotDevError(
|
|
@@ -8751,12 +8950,12 @@ async function setFirebaseSecret(key, value, projectId, dryRun = false, cwd) {
|
|
|
8751
8950
|
${errorOutput}`
|
|
8752
8951
|
);
|
|
8753
8952
|
}
|
|
8754
|
-
|
|
8953
|
+
log2.success(`Firebase secret ${key} set successfully`);
|
|
8755
8954
|
} finally {
|
|
8756
8955
|
}
|
|
8757
8956
|
} catch (err) {
|
|
8758
8957
|
if (err instanceof DoNotDevError) throw err;
|
|
8759
|
-
|
|
8958
|
+
log2.error(`Failed to set Firebase secret ${key}:`, err);
|
|
8760
8959
|
throw new DoNotDevError(
|
|
8761
8960
|
`Failed to set Firebase secret ${key}`,
|
|
8762
8961
|
"command-failed",
|
|
@@ -8793,24 +8992,24 @@ async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun
|
|
|
8793
8992
|
projectId: projectIdOverride ?? credResult.credentials.projectId
|
|
8794
8993
|
};
|
|
8795
8994
|
if (!dryRun) {
|
|
8796
|
-
|
|
8995
|
+
log2.info("Validating Vercel credentials...");
|
|
8797
8996
|
const user = await validateToken(credentials.token);
|
|
8798
|
-
|
|
8997
|
+
log2.success(`Vercel token valid (${user.username})`);
|
|
8799
8998
|
const project = await validateProject(
|
|
8800
8999
|
credentials.token,
|
|
8801
9000
|
credentials.projectId,
|
|
8802
9001
|
credentials.orgId
|
|
8803
9002
|
);
|
|
8804
|
-
|
|
9003
|
+
log2.success(`Vercel project accessible (${project.projectName})`);
|
|
8805
9004
|
}
|
|
8806
9005
|
return credentials;
|
|
8807
9006
|
}
|
|
8808
9007
|
async function setVercelSecret(key, value, credentials, dryRun = false) {
|
|
8809
9008
|
if (dryRun) {
|
|
8810
|
-
|
|
9009
|
+
log2.info(`[DRY RUN] Would set Vercel environment variable: ${key}`);
|
|
8811
9010
|
return;
|
|
8812
9011
|
}
|
|
8813
|
-
|
|
9012
|
+
log2.info(`Setting Vercel environment variable: ${key}`);
|
|
8814
9013
|
try {
|
|
8815
9014
|
const { token, orgId, projectId } = credentials;
|
|
8816
9015
|
const params = ["upsert=true"];
|
|
@@ -8835,9 +9034,9 @@ async function setVercelSecret(key, value, credentials, dryRun = false) {
|
|
|
8835
9034
|
const body = await res.text();
|
|
8836
9035
|
throw formatVercelError(res.status, body, `set env var ${key}`);
|
|
8837
9036
|
}
|
|
8838
|
-
|
|
9037
|
+
log2.success(`Vercel environment variable ${key} set successfully`);
|
|
8839
9038
|
} catch (err) {
|
|
8840
|
-
|
|
9039
|
+
log2.error(`Failed to set Vercel environment variable ${key}:`, err);
|
|
8841
9040
|
if (err instanceof DoNotDevError) throw err;
|
|
8842
9041
|
throw new DoNotDevError(
|
|
8843
9042
|
`Failed to set Vercel environment variable ${key}`,
|
|
@@ -8871,13 +9070,13 @@ function detectGitHubRepo() {
|
|
|
8871
9070
|
}
|
|
8872
9071
|
function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
8873
9072
|
if (dryRun) {
|
|
8874
|
-
|
|
9073
|
+
log2.info(
|
|
8875
9074
|
`[DRY RUN] Would set GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`
|
|
8876
9075
|
);
|
|
8877
9076
|
return;
|
|
8878
9077
|
}
|
|
8879
9078
|
try {
|
|
8880
|
-
|
|
9079
|
+
log2.info(`Setting GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`);
|
|
8881
9080
|
const args = ["secret", "set", key];
|
|
8882
9081
|
if (repo) {
|
|
8883
9082
|
args.push("--repo", repo);
|
|
@@ -8892,8 +9091,8 @@ function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
|
8892
9091
|
}
|
|
8893
9092
|
if (result.status !== 0) {
|
|
8894
9093
|
const stderr = result.stderr?.toString() || "";
|
|
8895
|
-
const
|
|
8896
|
-
const errorOutput = stderr ||
|
|
9094
|
+
const stdout2 = result.stdout?.toString() || "";
|
|
9095
|
+
const errorOutput = stderr || stdout2;
|
|
8897
9096
|
if (errorOutput.includes("not logged in") || errorOutput.includes("authentication")) {
|
|
8898
9097
|
throw new DoNotDevError(
|
|
8899
9098
|
`GitHub CLI authentication required. Run 'gh auth login' to authenticate.`,
|
|
@@ -8906,10 +9105,10 @@ function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
|
8906
9105
|
${errorOutput}`
|
|
8907
9106
|
);
|
|
8908
9107
|
}
|
|
8909
|
-
|
|
9108
|
+
log2.success(`GitHub secret ${key} set successfully`);
|
|
8910
9109
|
} catch (err) {
|
|
8911
9110
|
if (err instanceof DoNotDevError) throw err;
|
|
8912
|
-
|
|
9111
|
+
log2.error(`Failed to set GitHub secret ${key}:`, err);
|
|
8913
9112
|
throw new DoNotDevError(
|
|
8914
9113
|
`Failed to set GitHub secret ${key}`,
|
|
8915
9114
|
"command-failed",
|
|
@@ -8928,7 +9127,7 @@ function uploadServiceAccountToGitHub(appDir, repo, dryRun = false, staging = fa
|
|
|
8928
9127
|
const secretName = staging ? "FIREBASE_SERVICE_ACCOUNT_STAGING" : "FIREBASE_SERVICE_ACCOUNT";
|
|
8929
9128
|
const filePath = joinPath(appDir, fileName);
|
|
8930
9129
|
if (!pathExists(filePath)) {
|
|
8931
|
-
|
|
9130
|
+
log2.debug(`No ${fileName} found in ${appDir}, skipping GitHub upload`);
|
|
8932
9131
|
return;
|
|
8933
9132
|
}
|
|
8934
9133
|
const contentRaw = readSync(filePath, { format: "text" });
|
|
@@ -8949,7 +9148,7 @@ async function main(options = {}) {
|
|
|
8949
9148
|
verbose: options.verbose ?? false
|
|
8950
9149
|
};
|
|
8951
9150
|
if (process.argv.includes("--help")) {
|
|
8952
|
-
|
|
9151
|
+
log2.info(`
|
|
8953
9152
|
Secrets Sync Tool
|
|
8954
9153
|
|
|
8955
9154
|
Usage: bun run sync-secrets [options]
|
|
@@ -8984,7 +9183,7 @@ Examples:
|
|
|
8984
9183
|
let selectedApp;
|
|
8985
9184
|
if (appsWithFunctions.length === 1) {
|
|
8986
9185
|
selectedApp = appsWithFunctions[0];
|
|
8987
|
-
|
|
9186
|
+
note(`Using app: ${selectedApp.name}`, "Auto-detected");
|
|
8988
9187
|
} else {
|
|
8989
9188
|
const appName = await askForSelection(
|
|
8990
9189
|
"Which app would you like to sync secrets for?",
|
|
@@ -8994,7 +9193,7 @@ Examples:
|
|
|
8994
9193
|
hint: `functions/.env in ${app.name}`
|
|
8995
9194
|
}))
|
|
8996
9195
|
);
|
|
8997
|
-
selectedApp = appsWithFunctions.find((
|
|
9196
|
+
selectedApp = appsWithFunctions.find((a2) => a2.name === appName);
|
|
8998
9197
|
}
|
|
8999
9198
|
if (selectedApp) {
|
|
9000
9199
|
const envFileAbsolute = normalizePath(selectedApp.envFile);
|
|
@@ -9015,19 +9214,19 @@ Examples:
|
|
|
9015
9214
|
if (syncTarget === "github") {
|
|
9016
9215
|
const repo = config.repo || detectGitHubRepo();
|
|
9017
9216
|
if (!repo) {
|
|
9018
|
-
|
|
9217
|
+
log2.error(
|
|
9019
9218
|
"Could not detect GitHub repository. Use --repo owner/repo or ensure a GitHub remote is configured."
|
|
9020
9219
|
);
|
|
9021
9220
|
return 1;
|
|
9022
9221
|
}
|
|
9023
|
-
|
|
9222
|
+
log2.info(`Syncing secrets to GitHub repository: ${repo}`);
|
|
9024
9223
|
const secrets2 = parseSecretsWithFallback(envFilePath, currentDir);
|
|
9025
9224
|
const secretKeys2 = Object.keys(secrets2);
|
|
9026
9225
|
if (secretKeys2.length === 0) {
|
|
9027
|
-
|
|
9226
|
+
log2.info("No secrets found in .env file");
|
|
9028
9227
|
} else {
|
|
9029
|
-
|
|
9030
|
-
secretKeys2.forEach((key) =>
|
|
9228
|
+
log2.info(`Found ${secretKeys2.length} secrets to sync to GitHub:`);
|
|
9229
|
+
secretKeys2.forEach((key) => log2.info(` ${key}`));
|
|
9031
9230
|
for (const [key, value] of Object.entries(secrets2)) {
|
|
9032
9231
|
setGitHubSecret(key, value, repo, config.dryRun);
|
|
9033
9232
|
}
|
|
@@ -9050,37 +9249,37 @@ Examples:
|
|
|
9050
9249
|
uploadServiceAccountToGitHub(currentDir, repo, config.dryRun, true);
|
|
9051
9250
|
}
|
|
9052
9251
|
if (config.dryRun) {
|
|
9053
|
-
|
|
9252
|
+
log2.success("\nDry run completed. No GitHub secrets were set.");
|
|
9054
9253
|
} else {
|
|
9055
|
-
|
|
9254
|
+
log2.success("\nAll secrets synced to GitHub successfully!");
|
|
9056
9255
|
}
|
|
9057
9256
|
return 0;
|
|
9058
9257
|
}
|
|
9059
9258
|
const platform = config.platform || detectPlatform();
|
|
9060
9259
|
if (config.verbose) {
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9260
|
+
log2.debug(`Working directory: ${currentDir}`);
|
|
9261
|
+
log2.debug(`Environment file: ${envFilePath}`);
|
|
9262
|
+
log2.debug(`Platform: ${platform}`);
|
|
9263
|
+
log2.debug(`Dry run mode: ${config.dryRun}`);
|
|
9065
9264
|
}
|
|
9066
9265
|
const secrets = parseSecretsWithFallback(envFilePath, currentDir);
|
|
9067
9266
|
const secretKeys = Object.keys(secrets);
|
|
9068
9267
|
if (secretKeys.length === 0) {
|
|
9069
|
-
|
|
9268
|
+
log2.info("No secrets found in .env file");
|
|
9070
9269
|
return 0;
|
|
9071
9270
|
}
|
|
9072
|
-
|
|
9271
|
+
log2.info(`Found ${secretKeys.length} secrets to sync to ${platform}:`);
|
|
9073
9272
|
secretKeys.forEach((key) => {
|
|
9074
9273
|
if (config.verbose) {
|
|
9075
9274
|
const value = secrets[key];
|
|
9076
|
-
|
|
9275
|
+
log2.debug(` ${key}: ${value ? "***" : "undefined"}`);
|
|
9077
9276
|
} else {
|
|
9078
|
-
|
|
9277
|
+
log2.info(` ${key}`);
|
|
9079
9278
|
}
|
|
9080
9279
|
});
|
|
9081
9280
|
const finalFirebaseProjectDir = platform === "firebase" ? firebaseProjectDir || findFirebaseProjectDir(config.envFile) : void 0;
|
|
9082
9281
|
if (config.verbose && finalFirebaseProjectDir) {
|
|
9083
|
-
|
|
9282
|
+
log2.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
|
|
9084
9283
|
}
|
|
9085
9284
|
const vercelCredentials = platform === "vercel" ? await resolveVercelCredentialsForSync(
|
|
9086
9285
|
currentDir,
|
|
@@ -9101,17 +9300,17 @@ Examples:
|
|
|
9101
9300
|
}
|
|
9102
9301
|
}
|
|
9103
9302
|
if (config.dryRun) {
|
|
9104
|
-
|
|
9303
|
+
log2.success(
|
|
9105
9304
|
`
|
|
9106
9305
|
Dry run completed. No secrets were actually set to ${platform}.`
|
|
9107
9306
|
);
|
|
9108
9307
|
} else {
|
|
9109
|
-
|
|
9308
|
+
log2.success(`
|
|
9110
9309
|
All secrets synced successfully to ${platform}!`);
|
|
9111
9310
|
}
|
|
9112
9311
|
return 0;
|
|
9113
9312
|
} catch (err) {
|
|
9114
|
-
|
|
9313
|
+
log2.error(
|
|
9115
9314
|
"Error syncing secrets:",
|
|
9116
9315
|
DoNotDevError.from(err, "Sync-secrets failed", "cli-execution-error")
|
|
9117
9316
|
);
|
|
@@ -9122,13 +9321,13 @@ var init_sync_secrets = __esm({
|
|
|
9122
9321
|
"packages/tooling/src/apps/sync-secrets.ts"() {
|
|
9123
9322
|
"use strict";
|
|
9124
9323
|
init_utils2();
|
|
9324
|
+
init_vercel_api();
|
|
9325
|
+
init_vercel_token();
|
|
9125
9326
|
init_cli_input();
|
|
9126
9327
|
init_cli_output();
|
|
9127
9328
|
init_errors();
|
|
9128
9329
|
init_pathResolver();
|
|
9129
9330
|
init_secrets_resolver();
|
|
9130
|
-
init_vercel_token();
|
|
9131
|
-
init_vercel_api();
|
|
9132
9331
|
}
|
|
9133
9332
|
});
|
|
9134
9333
|
|