@donotdev/cli 0.1.44 → 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 +34 -22
- 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
- package/templates/app-next/src/app/layout.tsx.example +8 -0
- package/templates/app-next/src/app/not-found.tsx.example +6 -0
|
@@ -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');
|
|
@@ -37,31 +37,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
37
|
mod
|
|
38
38
|
));
|
|
39
39
|
|
|
40
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
41
|
-
var
|
|
40
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
41
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
42
42
|
var init_utils = __esm({
|
|
43
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
43
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
44
44
|
init_utils2();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
46
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
47
|
+
return (input) => {
|
|
48
|
+
let surrogatePairsNr = 0;
|
|
49
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
50
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
51
|
+
surrogatePairsNr += 1;
|
|
52
|
+
}
|
|
53
|
+
return input.length - surrogatePairsNr;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
48
56
|
isFullWidth = (x) => {
|
|
49
57
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
50
58
|
};
|
|
51
|
-
|
|
52
|
-
return x
|
|
59
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
60
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
53
61
|
};
|
|
54
62
|
}
|
|
55
63
|
});
|
|
56
64
|
|
|
57
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
58
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
65
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
66
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
59
67
|
var init_dist = __esm({
|
|
60
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
68
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
61
69
|
init_utils2();
|
|
62
70
|
init_utils();
|
|
63
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
71
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
64
72
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
73
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
65
74
|
TAB_RE = /\t{1,1000}/y;
|
|
66
75
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
67
76
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -71,14 +80,21 @@ var init_dist = __esm({
|
|
|
71
80
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
72
81
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
73
82
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
74
|
-
const ANSI_WIDTH =
|
|
83
|
+
const ANSI_WIDTH = 0;
|
|
75
84
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
76
85
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
77
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
78
86
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
79
|
-
const FULL_WIDTH_WIDTH =
|
|
87
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
80
88
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
81
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
89
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
90
|
+
const PARSE_BLOCKS = [
|
|
91
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
92
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
93
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
94
|
+
[TAB_RE, TAB_WIDTH],
|
|
95
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
96
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
97
|
+
];
|
|
82
98
|
let indexPrev = 0;
|
|
83
99
|
let index = 0;
|
|
84
100
|
let length = input.length;
|
|
@@ -98,10 +114,8 @@ var init_dist = __esm({
|
|
|
98
114
|
const codePoint = char.codePointAt(0) || 0;
|
|
99
115
|
if (isFullWidth(codePoint)) {
|
|
100
116
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
101
|
-
} else if (
|
|
117
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
102
118
|
widthExtra = WIDE_WIDTH;
|
|
103
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
104
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
105
119
|
} else {
|
|
106
120
|
widthExtra = REGULAR_WIDTH;
|
|
107
121
|
}
|
|
@@ -117,88 +131,28 @@ var init_dist = __esm({
|
|
|
117
131
|
}
|
|
118
132
|
unmatchedStart = unmatchedEnd = 0;
|
|
119
133
|
}
|
|
120
|
-
if (index >= length)
|
|
121
|
-
break;
|
|
122
|
-
LATIN_RE.lastIndex = index;
|
|
123
|
-
if (LATIN_RE.test(input)) {
|
|
124
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
125
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
126
|
-
if (width + widthExtra > truncationLimit) {
|
|
127
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
128
|
-
}
|
|
129
|
-
if (width + widthExtra > LIMIT) {
|
|
130
|
-
truncationEnabled = true;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
width += widthExtra;
|
|
134
|
-
unmatchedStart = indexPrev;
|
|
135
|
-
unmatchedEnd = index;
|
|
136
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
ANSI_RE.lastIndex = index;
|
|
140
|
-
if (ANSI_RE.test(input)) {
|
|
141
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
142
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
143
|
-
}
|
|
144
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
145
|
-
truncationEnabled = true;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
width += ANSI_WIDTH;
|
|
149
|
-
unmatchedStart = indexPrev;
|
|
150
|
-
unmatchedEnd = index;
|
|
151
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
CONTROL_RE.lastIndex = index;
|
|
155
|
-
if (CONTROL_RE.test(input)) {
|
|
156
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
157
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
158
|
-
if (width + widthExtra > truncationLimit) {
|
|
159
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
160
|
-
}
|
|
161
|
-
if (width + widthExtra > LIMIT) {
|
|
162
|
-
truncationEnabled = true;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
width += widthExtra;
|
|
166
|
-
unmatchedStart = indexPrev;
|
|
167
|
-
unmatchedEnd = index;
|
|
168
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
TAB_RE.lastIndex = index;
|
|
172
|
-
if (TAB_RE.test(input)) {
|
|
173
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
174
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
175
|
-
if (width + widthExtra > truncationLimit) {
|
|
176
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
177
|
-
}
|
|
178
|
-
if (width + widthExtra > LIMIT) {
|
|
179
|
-
truncationEnabled = true;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
width += widthExtra;
|
|
183
|
-
unmatchedStart = indexPrev;
|
|
184
|
-
unmatchedEnd = index;
|
|
185
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
186
|
-
continue;
|
|
134
|
+
if (index >= length) {
|
|
135
|
+
break outer;
|
|
187
136
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
137
|
+
for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
|
|
138
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
139
|
+
BLOCK_RE.lastIndex = index;
|
|
140
|
+
if (BLOCK_RE.test(input)) {
|
|
141
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
142
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
143
|
+
if (width + widthExtra > truncationLimit) {
|
|
144
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
145
|
+
}
|
|
146
|
+
if (width + widthExtra > LIMIT) {
|
|
147
|
+
truncationEnabled = true;
|
|
148
|
+
break outer;
|
|
149
|
+
}
|
|
150
|
+
width += widthExtra;
|
|
151
|
+
unmatchedStart = indexPrev;
|
|
152
|
+
unmatchedEnd = index;
|
|
153
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
154
|
+
continue outer;
|
|
196
155
|
}
|
|
197
|
-
width += EMOJI_WIDTH;
|
|
198
|
-
unmatchedStart = indexPrev;
|
|
199
|
-
unmatchedEnd = index;
|
|
200
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
201
|
-
continue;
|
|
202
156
|
}
|
|
203
157
|
index += 1;
|
|
204
158
|
}
|
|
@@ -213,10 +167,10 @@ var init_dist = __esm({
|
|
|
213
167
|
}
|
|
214
168
|
});
|
|
215
169
|
|
|
216
|
-
// node_modules/.bun/fast-string-width@
|
|
170
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
217
171
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
218
172
|
var init_dist2 = __esm({
|
|
219
|
-
"node_modules/.bun/fast-string-width@
|
|
173
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
220
174
|
init_utils2();
|
|
221
175
|
init_dist();
|
|
222
176
|
NO_TRUNCATION2 = {
|
|
@@ -231,13 +185,13 @@ var init_dist2 = __esm({
|
|
|
231
185
|
}
|
|
232
186
|
});
|
|
233
187
|
|
|
234
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
188
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
235
189
|
function wrapAnsi(string, columns, options) {
|
|
236
190
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
237
191
|
}
|
|
238
192
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
239
193
|
var init_main = __esm({
|
|
240
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
194
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
241
195
|
init_utils2();
|
|
242
196
|
init_dist2();
|
|
243
197
|
ESC = "\x1B";
|
|
@@ -401,16 +355,19 @@ var init_main = __esm({
|
|
|
401
355
|
}
|
|
402
356
|
const preString = rows.join("\n");
|
|
403
357
|
let inSurrogate = false;
|
|
404
|
-
for (let
|
|
405
|
-
const character = preString[
|
|
358
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
359
|
+
const character = preString[i2];
|
|
406
360
|
returnValue += character;
|
|
407
361
|
if (!inSurrogate) {
|
|
408
362
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
363
|
+
if (inSurrogate) {
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
409
366
|
} else {
|
|
410
|
-
|
|
367
|
+
inSurrogate = false;
|
|
411
368
|
}
|
|
412
369
|
if (character === ESC || character === CSI) {
|
|
413
|
-
GROUP_REGEX.lastIndex =
|
|
370
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
414
371
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
415
372
|
const groups = groupsResult?.groups;
|
|
416
373
|
if (groups?.code !== void 0) {
|
|
@@ -420,7 +377,7 @@ var init_main = __esm({
|
|
|
420
377
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
421
378
|
}
|
|
422
379
|
}
|
|
423
|
-
if (preString[
|
|
380
|
+
if (preString[i2 + 1] === "\n") {
|
|
424
381
|
if (escapeUrl) {
|
|
425
382
|
returnValue += wrapAnsiHyperlink("");
|
|
426
383
|
}
|
|
@@ -451,7 +408,7 @@ var require_src = __commonJS({
|
|
|
451
408
|
var ESC2 = "\x1B";
|
|
452
409
|
var CSI2 = `${ESC2}[`;
|
|
453
410
|
var beep = "\x07";
|
|
454
|
-
var
|
|
411
|
+
var cursor3 = {
|
|
455
412
|
to(x, y2) {
|
|
456
413
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
457
414
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -480,7 +437,7 @@ var require_src = __commonJS({
|
|
|
480
437
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
481
438
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
482
439
|
};
|
|
483
|
-
var
|
|
440
|
+
var erase3 = {
|
|
484
441
|
screen: `${CSI2}2J`,
|
|
485
442
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
486
443
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -489,89 +446,169 @@ var require_src = __commonJS({
|
|
|
489
446
|
lineStart: `${CSI2}1K`,
|
|
490
447
|
lines(count) {
|
|
491
448
|
let clear = "";
|
|
492
|
-
for (let
|
|
493
|
-
clear += this.line + (
|
|
449
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
450
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
494
451
|
if (count)
|
|
495
|
-
clear +=
|
|
452
|
+
clear += cursor3.left;
|
|
496
453
|
return clear;
|
|
497
454
|
}
|
|
498
455
|
};
|
|
499
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
456
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
500
457
|
}
|
|
501
458
|
});
|
|
502
459
|
|
|
503
|
-
// node_modules/.bun/@clack+core@1.
|
|
504
|
-
import { styleText
|
|
505
|
-
import { stdout
|
|
506
|
-
import * as
|
|
507
|
-
import
|
|
508
|
-
import { ReadStream
|
|
509
|
-
function
|
|
510
|
-
if (!
|
|
511
|
-
|
|
512
|
-
|
|
460
|
+
// node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
|
|
461
|
+
import { styleText } from "node:util";
|
|
462
|
+
import { stdout, stdin } from "node:process";
|
|
463
|
+
import * as l from "node:readline";
|
|
464
|
+
import l__default from "node:readline";
|
|
465
|
+
import { ReadStream } from "node:tty";
|
|
466
|
+
function findCursor(s, o, l2) {
|
|
467
|
+
if (!l2.some((r2) => !r2.disabled))
|
|
468
|
+
return s;
|
|
469
|
+
const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
470
|
+
return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
|
|
471
|
+
}
|
|
472
|
+
function isAccessible(n3) {
|
|
473
|
+
if (n3 !== void 0) return n3;
|
|
474
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
475
|
+
const e = process.env.ACCESSIBLE;
|
|
476
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
513
477
|
}
|
|
514
|
-
function
|
|
515
|
-
if (typeof
|
|
516
|
-
|
|
478
|
+
function isActionKey(n3, e) {
|
|
479
|
+
if (typeof n3 == "string")
|
|
480
|
+
return settings.aliases.get(n3) === e;
|
|
481
|
+
for (const s of n3)
|
|
482
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
483
|
+
return true;
|
|
517
484
|
return false;
|
|
518
485
|
}
|
|
519
|
-
function
|
|
520
|
-
if (
|
|
521
|
-
const e =
|
|
522
|
-
`),
|
|
523
|
-
`),
|
|
524
|
-
for (let
|
|
525
|
-
|
|
486
|
+
function diffLines(i2, s) {
|
|
487
|
+
if (i2 === s) return;
|
|
488
|
+
const e = i2.split(`
|
|
489
|
+
`), t2 = s.split(`
|
|
490
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
491
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
492
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
493
|
+
return {
|
|
494
|
+
lines: f,
|
|
495
|
+
numLinesBefore: e.length,
|
|
496
|
+
numLinesAfter: t2.length,
|
|
497
|
+
numLines: r2
|
|
498
|
+
};
|
|
526
499
|
}
|
|
527
|
-
function
|
|
528
|
-
return
|
|
500
|
+
function isCancel(e) {
|
|
501
|
+
return e === CANCEL_SYMBOL;
|
|
529
502
|
}
|
|
530
|
-
function
|
|
531
|
-
const
|
|
532
|
-
|
|
503
|
+
function setRawMode(e, r2) {
|
|
504
|
+
const o = e;
|
|
505
|
+
o.isTTY && o.setRawMode(r2);
|
|
533
506
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
507
|
+
function block({
|
|
508
|
+
input: e = stdin,
|
|
509
|
+
output: r2 = stdout,
|
|
510
|
+
overwrite: o = true,
|
|
511
|
+
hideCursor: n3 = true
|
|
512
|
+
} = {}) {
|
|
513
|
+
const s = l.createInterface({
|
|
514
|
+
input: e,
|
|
515
|
+
output: r2,
|
|
516
|
+
prompt: "",
|
|
517
|
+
tabSize: 1
|
|
518
|
+
});
|
|
519
|
+
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
520
|
+
const t2 = (f, { name: a2, sequence: w }) => {
|
|
521
|
+
const c2 = String(f);
|
|
522
|
+
if (isActionKey([c2, a2, w], "cancel")) {
|
|
523
|
+
n3 && r2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
541
524
|
return;
|
|
542
525
|
}
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
526
|
+
if (!o) return;
|
|
527
|
+
const i2 = a2 === "return" ? 0 : -1, m = a2 === "return" ? -1 : 0;
|
|
528
|
+
l.moveCursor(r2, i2, m, () => {
|
|
529
|
+
l.clearLine(r2, 1, () => {
|
|
530
|
+
e.once("keypress", t2);
|
|
548
531
|
});
|
|
549
532
|
});
|
|
550
533
|
};
|
|
551
|
-
return
|
|
552
|
-
|
|
534
|
+
return n3 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", t2), () => {
|
|
535
|
+
e.off("keypress", t2), n3 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
553
536
|
};
|
|
554
537
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
return wrapAnsi(
|
|
558
|
-
|
|
538
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
539
|
+
const f = getColumns(e ?? stdout);
|
|
540
|
+
return wrapAnsi(r2, f - o.length, {
|
|
541
|
+
hard: true,
|
|
542
|
+
trim: false
|
|
543
|
+
}).split(`
|
|
544
|
+
`).map((c2, i2, m) => {
|
|
545
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
546
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
547
|
+
}).join(`
|
|
559
548
|
`);
|
|
560
549
|
}
|
|
561
|
-
|
|
550
|
+
function runValidation(e, a2) {
|
|
551
|
+
if ("~standard" in e) {
|
|
552
|
+
const n3 = e["~standard"].validate(a2);
|
|
553
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
554
|
+
}
|
|
555
|
+
return e(a2);
|
|
556
|
+
}
|
|
557
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, r, n$1, n2;
|
|
562
558
|
var init_dist3 = __esm({
|
|
563
|
-
"node_modules/.bun/@clack+core@1.
|
|
559
|
+
"node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
564
560
|
init_utils2();
|
|
565
561
|
init_main();
|
|
566
562
|
import_sisteransi = __toESM(require_src(), 1);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
563
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
564
|
+
t = [
|
|
565
|
+
"January",
|
|
566
|
+
"February",
|
|
567
|
+
"March",
|
|
568
|
+
"April",
|
|
569
|
+
"May",
|
|
570
|
+
"June",
|
|
571
|
+
"July",
|
|
572
|
+
"August",
|
|
573
|
+
"September",
|
|
574
|
+
"October",
|
|
575
|
+
"November",
|
|
576
|
+
"December"
|
|
577
|
+
];
|
|
578
|
+
settings = {
|
|
579
|
+
actions: new Set(a$1),
|
|
580
|
+
aliases: /* @__PURE__ */ new Map([
|
|
581
|
+
// vim support
|
|
582
|
+
["k", "up"],
|
|
583
|
+
["j", "down"],
|
|
584
|
+
["h", "left"],
|
|
585
|
+
["l", "right"],
|
|
586
|
+
["", "cancel"],
|
|
587
|
+
// opinionated defaults!
|
|
588
|
+
["escape", "cancel"]
|
|
589
|
+
]),
|
|
590
|
+
messages: {
|
|
591
|
+
cancel: "Canceled",
|
|
592
|
+
error: "Something went wrong"
|
|
593
|
+
},
|
|
594
|
+
withGuide: true,
|
|
595
|
+
accessible: void 0,
|
|
596
|
+
date: {
|
|
597
|
+
monthNames: [...t],
|
|
598
|
+
messages: {
|
|
599
|
+
required: "Please enter a valid date",
|
|
600
|
+
invalidMonth: "There are only 12 months in a year",
|
|
601
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
602
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
603
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
R = globalThis.process.platform.startsWith("win");
|
|
608
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
609
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
610
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
611
|
+
y = class {
|
|
575
612
|
input;
|
|
576
613
|
output;
|
|
577
614
|
_abortSignal;
|
|
@@ -586,46 +623,92 @@ var init_dist3 = __esm({
|
|
|
586
623
|
error = "";
|
|
587
624
|
value;
|
|
588
625
|
userInput = "";
|
|
626
|
+
/**
|
|
627
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
628
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
629
|
+
* and the `ACCESSIBLE` env var.
|
|
630
|
+
*/
|
|
631
|
+
get accessible() {
|
|
632
|
+
return isAccessible(this.opts.accessible);
|
|
633
|
+
}
|
|
589
634
|
constructor(t2, e = true) {
|
|
590
|
-
const { input:
|
|
591
|
-
this.opts =
|
|
635
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
636
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
592
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* Unsubscribe all listeners
|
|
640
|
+
*/
|
|
593
641
|
unsubscribe() {
|
|
594
642
|
this._subscribers.clear();
|
|
595
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Set a subscriber with opts
|
|
646
|
+
* @param event - The event name
|
|
647
|
+
*/
|
|
596
648
|
setSubscriber(t2, e) {
|
|
597
|
-
const
|
|
598
|
-
|
|
649
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
650
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
599
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Subscribe to an event
|
|
654
|
+
* @param event - The event name
|
|
655
|
+
* @param cb - The callback
|
|
656
|
+
*/
|
|
600
657
|
on(t2, e) {
|
|
601
658
|
this.setSubscriber(t2, { cb: e });
|
|
602
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* Subscribe to an event once
|
|
662
|
+
* @param event - The event name
|
|
663
|
+
* @param cb - The callback
|
|
664
|
+
*/
|
|
603
665
|
once(t2, e) {
|
|
604
666
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
605
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Emit an event with data
|
|
670
|
+
* @param event - The event name
|
|
671
|
+
* @param data - The data to pass to the callback
|
|
672
|
+
*/
|
|
606
673
|
emit(t2, ...e) {
|
|
607
|
-
const
|
|
608
|
-
for (const
|
|
609
|
-
|
|
674
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
675
|
+
for (const r2 of i2)
|
|
676
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
677
|
+
for (const r2 of s)
|
|
678
|
+
r2();
|
|
610
679
|
}
|
|
611
680
|
prompt() {
|
|
612
681
|
return new Promise((t2) => {
|
|
613
682
|
if (this._abortSignal) {
|
|
614
|
-
if (this._abortSignal.aborted)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
683
|
+
if (this._abortSignal.aborted)
|
|
684
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
685
|
+
this._abortSignal.addEventListener(
|
|
686
|
+
"abort",
|
|
687
|
+
() => {
|
|
688
|
+
this.state = "cancel", this.close();
|
|
689
|
+
},
|
|
690
|
+
{ once: true }
|
|
691
|
+
);
|
|
618
692
|
}
|
|
619
|
-
this.rl =
|
|
620
|
-
|
|
693
|
+
this.rl = l__default.createInterface({
|
|
694
|
+
input: this.input,
|
|
695
|
+
tabSize: 2,
|
|
696
|
+
prompt: "",
|
|
697
|
+
escapeCodeTimeout: 50,
|
|
698
|
+
terminal: true
|
|
699
|
+
}), 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", () => {
|
|
700
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
621
701
|
}), this.once("cancel", () => {
|
|
622
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
702
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
623
703
|
});
|
|
624
704
|
});
|
|
625
705
|
}
|
|
626
706
|
_isActionKey(t2, e) {
|
|
627
707
|
return t2 === " ";
|
|
628
708
|
}
|
|
709
|
+
_shouldSubmit(t2, e) {
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
629
712
|
_setValue(t2) {
|
|
630
713
|
this.value = t2, this.emit("value", this.value);
|
|
631
714
|
}
|
|
@@ -635,19 +718,22 @@ var init_dist3 = __esm({
|
|
|
635
718
|
_clearUserInput() {
|
|
636
719
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
637
720
|
}
|
|
638
|
-
onKeypress(t2, e) {
|
|
639
|
-
if (this.
|
|
640
|
-
if (this.
|
|
641
|
-
|
|
642
|
-
|
|
721
|
+
async onKeypress(t2, e) {
|
|
722
|
+
if (this.state !== "validating") {
|
|
723
|
+
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)) {
|
|
724
|
+
if (this.opts.validate) {
|
|
725
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
726
|
+
let s;
|
|
727
|
+
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));
|
|
728
|
+
}
|
|
729
|
+
this.state !== "error" && (this.state = "submit");
|
|
643
730
|
}
|
|
644
|
-
this.state
|
|
731
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
645
732
|
}
|
|
646
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
647
733
|
}
|
|
648
734
|
close() {
|
|
649
735
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
650
|
-
`),
|
|
736
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
651
737
|
}
|
|
652
738
|
restoreCursor() {
|
|
653
739
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -655,34 +741,39 @@ var init_dist3 = __esm({
|
|
|
655
741
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
656
742
|
}
|
|
657
743
|
render() {
|
|
658
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
744
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
745
|
+
hard: true,
|
|
746
|
+
trim: false
|
|
747
|
+
});
|
|
659
748
|
if (t2 !== this._prevFrame) {
|
|
660
|
-
if (this.state === "initial")
|
|
749
|
+
if (this.state === "initial")
|
|
750
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
661
751
|
else {
|
|
662
|
-
const e =
|
|
752
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
663
753
|
if (this.restoreCursor(), e) {
|
|
664
|
-
const
|
|
665
|
-
let
|
|
666
|
-
if (
|
|
754
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
755
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
756
|
+
if (n3 === void 0) {
|
|
667
757
|
this._prevFrame = t2;
|
|
668
758
|
return;
|
|
669
759
|
}
|
|
670
760
|
if (e.lines.length === 1) {
|
|
671
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
672
|
-
const
|
|
761
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
762
|
+
const o = t2.split(`
|
|
673
763
|
`);
|
|
674
|
-
this.output.write(
|
|
764
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
675
765
|
return;
|
|
676
766
|
} else if (e.lines.length > 1) {
|
|
677
|
-
if (
|
|
767
|
+
if (s < r2)
|
|
768
|
+
n3 = s;
|
|
678
769
|
else {
|
|
679
|
-
const
|
|
680
|
-
|
|
770
|
+
const h2 = n3 - r2;
|
|
771
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
681
772
|
}
|
|
682
773
|
this.output.write(import_sisteransi.erase.down());
|
|
683
|
-
const
|
|
684
|
-
`).slice(
|
|
685
|
-
this.output.write(
|
|
774
|
+
const f = t2.split(`
|
|
775
|
+
`).slice(n3);
|
|
776
|
+
this.output.write(f.join(`
|
|
686
777
|
`)), this._prevFrame = t2;
|
|
687
778
|
return;
|
|
688
779
|
}
|
|
@@ -693,7 +784,7 @@ var init_dist3 = __esm({
|
|
|
693
784
|
}
|
|
694
785
|
}
|
|
695
786
|
};
|
|
696
|
-
|
|
787
|
+
r = class extends y {
|
|
697
788
|
get cursor() {
|
|
698
789
|
return this.value ? 0 : 1;
|
|
699
790
|
}
|
|
@@ -703,54 +794,60 @@ var init_dist3 = __esm({
|
|
|
703
794
|
constructor(t2) {
|
|
704
795
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
705
796
|
this.value = this._value;
|
|
706
|
-
}), this.on("confirm", (
|
|
707
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value =
|
|
797
|
+
}), this.on("confirm", (i2) => {
|
|
798
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
708
799
|
}), this.on("cursor", () => {
|
|
709
800
|
this.value = !this.value;
|
|
710
801
|
});
|
|
711
802
|
}
|
|
712
803
|
};
|
|
713
|
-
|
|
804
|
+
n$1 = class n extends y {
|
|
714
805
|
options;
|
|
715
806
|
cursor = 0;
|
|
716
807
|
get _selectedValue() {
|
|
717
808
|
return this.options[this.cursor];
|
|
718
809
|
}
|
|
719
810
|
changeValue() {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
811
|
+
const e = this._selectedValue;
|
|
812
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
813
|
+
}
|
|
814
|
+
constructor(e) {
|
|
815
|
+
super(e, false), this.options = e.options;
|
|
816
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
817
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
818
|
+
switch (s) {
|
|
727
819
|
case "left":
|
|
728
820
|
case "up":
|
|
729
|
-
this.cursor =
|
|
821
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
730
822
|
break;
|
|
731
823
|
case "down":
|
|
732
824
|
case "right":
|
|
733
|
-
this.cursor =
|
|
825
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
734
826
|
break;
|
|
735
827
|
}
|
|
736
828
|
this.changeValue();
|
|
737
829
|
});
|
|
738
830
|
}
|
|
739
831
|
};
|
|
740
|
-
|
|
832
|
+
n2 = class extends y {
|
|
741
833
|
get userInputWithCursor() {
|
|
742
|
-
if (this.state === "submit")
|
|
834
|
+
if (this.state === "submit")
|
|
835
|
+
return this.userInput;
|
|
743
836
|
const t2 = this.userInput;
|
|
744
|
-
if (this.cursor >= t2.length)
|
|
745
|
-
|
|
746
|
-
|
|
837
|
+
if (this.cursor >= t2.length)
|
|
838
|
+
return `${this.userInput}\u2588`;
|
|
839
|
+
const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
|
|
840
|
+
return `${r2}${styleText("inverse", s)}${e}`;
|
|
747
841
|
}
|
|
748
842
|
get cursor() {
|
|
749
843
|
return this._cursor;
|
|
750
844
|
}
|
|
751
845
|
constructor(t2) {
|
|
752
|
-
super({
|
|
753
|
-
|
|
846
|
+
super({
|
|
847
|
+
...t2,
|
|
848
|
+
initialUserInput: t2.initialUserInput ?? t2.initialValue
|
|
849
|
+
}), this.on("userInput", (r2) => {
|
|
850
|
+
this._setValue(r2);
|
|
754
851
|
}), this.on("finalize", () => {
|
|
755
852
|
this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
|
|
756
853
|
});
|
|
@@ -759,328 +856,503 @@ var init_dist3 = __esm({
|
|
|
759
856
|
}
|
|
760
857
|
});
|
|
761
858
|
|
|
762
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
763
|
-
import { styleText as
|
|
764
|
-
import
|
|
765
|
-
import { existsSync
|
|
766
|
-
import { dirname
|
|
767
|
-
function
|
|
768
|
-
|
|
859
|
+
// node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
|
|
860
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
861
|
+
import process$1 from "node:process";
|
|
862
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
863
|
+
import { dirname, join } from "node:path";
|
|
864
|
+
function isUnicodeSupported() {
|
|
865
|
+
if (process$1.platform !== "win32") {
|
|
866
|
+
return process$1.env.TERM !== "linux";
|
|
867
|
+
}
|
|
868
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
769
869
|
}
|
|
770
|
-
|
|
870
|
+
function formatInstructionFooter(o, e) {
|
|
871
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
872
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
873
|
+
}
|
|
874
|
+
var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i, text;
|
|
771
875
|
var init_dist4 = __esm({
|
|
772
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
876
|
+
"node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
773
877
|
init_utils2();
|
|
774
878
|
init_dist3();
|
|
775
879
|
init_dist3();
|
|
776
880
|
init_main();
|
|
777
881
|
init_dist2();
|
|
778
882
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
switch (
|
|
883
|
+
unicode = isUnicodeSupported();
|
|
884
|
+
isCI = () => process.env.CI === "true";
|
|
885
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
886
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
887
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
888
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
889
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
890
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
891
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
892
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
893
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
894
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
895
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
896
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
897
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
898
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
899
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
900
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
901
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
902
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
903
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
904
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
905
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
906
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
907
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
908
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
909
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
910
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
911
|
+
symbol = (o) => {
|
|
912
|
+
switch (o) {
|
|
809
913
|
case "initial":
|
|
810
914
|
case "active":
|
|
811
|
-
return
|
|
915
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
812
916
|
case "cancel":
|
|
813
|
-
return
|
|
917
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
814
918
|
case "error":
|
|
815
|
-
return
|
|
919
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
816
920
|
case "submit":
|
|
817
|
-
return
|
|
921
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
922
|
+
case "validating":
|
|
923
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
818
924
|
}
|
|
819
925
|
};
|
|
820
|
-
|
|
821
|
-
switch (
|
|
926
|
+
symbolBar = (o) => {
|
|
927
|
+
switch (o) {
|
|
822
928
|
case "initial":
|
|
823
929
|
case "active":
|
|
824
|
-
return
|
|
930
|
+
return styleText2("cyan", S_BAR);
|
|
825
931
|
case "cancel":
|
|
826
|
-
return
|
|
932
|
+
return styleText2("red", S_BAR);
|
|
827
933
|
case "error":
|
|
828
|
-
return
|
|
934
|
+
return styleText2("yellow", S_BAR);
|
|
829
935
|
case "submit":
|
|
830
|
-
return
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
let
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
936
|
+
return styleText2("green", S_BAR);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
I = (l2, e, w, p, b, C2 = false) => {
|
|
940
|
+
let r2 = e, O = 0;
|
|
941
|
+
if (C2)
|
|
942
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
943
|
+
const m = l2[i2];
|
|
944
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
945
|
+
}
|
|
946
|
+
else
|
|
947
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
948
|
+
const m = l2[i2];
|
|
949
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
950
|
+
}
|
|
951
|
+
return { lineCount: r2, removals: O };
|
|
952
|
+
};
|
|
953
|
+
limitOptions = ({
|
|
954
|
+
cursor: l2,
|
|
955
|
+
options: e,
|
|
956
|
+
style: w,
|
|
957
|
+
output: p = process.stdout,
|
|
958
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
959
|
+
columnPadding: C2 = 0,
|
|
960
|
+
rowPadding: r2 = 4
|
|
961
|
+
}) => {
|
|
962
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
847
963
|
let f = 0;
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
964
|
+
l2 >= a2 - 3 && (f = Math.max(
|
|
965
|
+
Math.min(l2 - a2 + 3, e.length - a2),
|
|
966
|
+
0
|
|
967
|
+
));
|
|
968
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
969
|
+
const W2 = Math.min(
|
|
970
|
+
f + a2,
|
|
971
|
+
e.length
|
|
972
|
+
), s = [];
|
|
973
|
+
let g = 0;
|
|
974
|
+
d && g++, c2 && g++;
|
|
975
|
+
const T = f + (d ? 1 : 0), y2 = W2 - (c2 ? 1 : 0);
|
|
976
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
977
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
|
|
978
|
+
hard: true,
|
|
979
|
+
trim: false
|
|
980
|
+
}).split(`
|
|
852
981
|
`);
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
if (
|
|
856
|
-
let
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
982
|
+
s.push(h2), g += h2.length;
|
|
983
|
+
}
|
|
984
|
+
if (g > v) {
|
|
985
|
+
let t2 = 0, n3 = 0, o = g;
|
|
986
|
+
const h2 = l2 - T;
|
|
987
|
+
let u3 = v;
|
|
988
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
989
|
+
s,
|
|
990
|
+
o,
|
|
991
|
+
h2 + 1,
|
|
992
|
+
s.length,
|
|
993
|
+
u3,
|
|
994
|
+
true
|
|
995
|
+
);
|
|
996
|
+
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));
|
|
997
|
+
}
|
|
998
|
+
const x = [];
|
|
999
|
+
d && x.push(M);
|
|
1000
|
+
for (const t2 of s)
|
|
1001
|
+
for (const n3 of t2)
|
|
1002
|
+
x.push(n3);
|
|
1003
|
+
return c2 && x.push(M), x;
|
|
1004
|
+
};
|
|
1005
|
+
confirm = (i2) => {
|
|
1006
|
+
const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
|
|
1007
|
+
return new r({
|
|
1008
|
+
active: a2,
|
|
1009
|
+
inactive: s,
|
|
1010
|
+
signal: i2.signal,
|
|
1011
|
+
input: i2.input,
|
|
1012
|
+
output: i2.output,
|
|
1013
|
+
initialValue: i2.initialValue ?? true,
|
|
1014
|
+
render() {
|
|
1015
|
+
const e = i2.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1016
|
+
i2.output,
|
|
1017
|
+
i2.message,
|
|
1018
|
+
l2,
|
|
1019
|
+
u3
|
|
1020
|
+
), o = `${e ? `${styleText2("gray", S_BAR)}
|
|
1021
|
+
` : ""}${f}
|
|
1022
|
+
`, c2 = this.value ? a2 : s;
|
|
1023
|
+
switch (this.state) {
|
|
1024
|
+
case "submit": {
|
|
1025
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1026
|
+
return `${o}${r2}${styleText2("dim", c2)}`;
|
|
1027
|
+
}
|
|
1028
|
+
case "cancel": {
|
|
1029
|
+
const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1030
|
+
return `${o}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
|
|
1031
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1032
|
+
}
|
|
1033
|
+
default: {
|
|
1034
|
+
const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g = e ? styleText2("cyan", S_BAR_END) : "";
|
|
1035
|
+
return `${o}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
|
|
1036
|
+
${styleText2("cyan", S_BAR)} ` : `
|
|
1037
|
+
` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
|
|
1038
|
+
${g}
|
|
887
1039
|
`;
|
|
1040
|
+
}
|
|
888
1041
|
}
|
|
889
1042
|
}
|
|
890
|
-
}
|
|
1043
|
+
}).prompt();
|
|
891
1044
|
};
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1045
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
1046
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1047
|
+
`${styleText2("dim", "Space:")} select`,
|
|
1048
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1049
|
+
];
|
|
1050
|
+
log = {
|
|
1051
|
+
message: (s = [], {
|
|
1052
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1053
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1054
|
+
output: m = process.stdout,
|
|
1055
|
+
spacing: l2 = 1,
|
|
1056
|
+
withGuide: c2
|
|
1057
|
+
} = {}) => {
|
|
1058
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1059
|
+
for (let i2 = 0; i2 < l2; i2++)
|
|
1060
|
+
t2.push(f);
|
|
1061
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
896
1062
|
`);
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1063
|
+
if (g.length > 0) {
|
|
1064
|
+
const [i2, ...y2] = g;
|
|
1065
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1066
|
+
for (const p of y2)
|
|
1067
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1068
|
+
}
|
|
1069
|
+
m.write(`${t2.join(`
|
|
903
1070
|
`)}
|
|
904
1071
|
`);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1072
|
+
},
|
|
1073
|
+
info: (s, e) => {
|
|
1074
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1075
|
+
},
|
|
1076
|
+
success: (s, e) => {
|
|
1077
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1078
|
+
},
|
|
1079
|
+
step: (s, e) => {
|
|
1080
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1081
|
+
},
|
|
1082
|
+
warn: (s, e) => {
|
|
1083
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1084
|
+
},
|
|
1085
|
+
/** alias for `log.warn()`. */
|
|
1086
|
+
warning: (s, e) => {
|
|
1087
|
+
log.warn(s, e);
|
|
1088
|
+
},
|
|
1089
|
+
error: (s, e) => {
|
|
1090
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
cancel = (o = "", t2) => {
|
|
1094
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1095
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
921
1096
|
|
|
922
1097
|
`);
|
|
923
1098
|
};
|
|
924
|
-
|
|
925
|
-
const
|
|
926
|
-
|
|
1099
|
+
intro = (o = "", t2) => {
|
|
1100
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
|
|
1101
|
+
i2.write(`${e}${o}
|
|
927
1102
|
`);
|
|
928
1103
|
};
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
${
|
|
932
|
-
|
|
1104
|
+
outro = (o = "", t2) => {
|
|
1105
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
|
|
1106
|
+
${styleText2("gray", S_BAR_END)} ` : "";
|
|
1107
|
+
i2.write(`${e}${o}
|
|
933
1108
|
|
|
934
1109
|
`);
|
|
935
1110
|
};
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1111
|
+
W$1 = (o) => o;
|
|
1112
|
+
C = (o, e, s) => {
|
|
1113
|
+
const a2 = {
|
|
1114
|
+
hard: true,
|
|
1115
|
+
trim: false
|
|
1116
|
+
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1117
|
+
`), 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);
|
|
1118
|
+
return wrapAnsi(o, g, a2);
|
|
1119
|
+
};
|
|
1120
|
+
note = (o = "", e = "", s) => {
|
|
1121
|
+
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(`
|
|
1122
|
+
`).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1123
|
+
g.reduce((m, F) => {
|
|
1124
|
+
const O = dist_default2(F);
|
|
1125
|
+
return O > m ? O : m;
|
|
1126
|
+
}, 0),
|
|
1127
|
+
n3
|
|
1128
|
+
) + 2, h2 = g.map(
|
|
1129
|
+
(m) => `${styleText2("gray", S_BAR)} ${m}${" ".repeat(t2 - dist_default2(m))}${styleText2("gray", S_BAR)}`
|
|
1130
|
+
).join(`
|
|
1131
|
+
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1132
|
+
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1133
|
+
a2.write(
|
|
1134
|
+
`${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
|
|
1135
|
+
"gray",
|
|
1136
|
+
S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
|
|
1137
|
+
)}
|
|
1138
|
+
${h2}
|
|
1139
|
+
${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
1140
|
+
`
|
|
1141
|
+
);
|
|
954
1142
|
};
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1143
|
+
W = (l2) => styleText2("magenta", l2);
|
|
1144
|
+
spinner = ({
|
|
1145
|
+
indicator: l2 = "dots",
|
|
1146
|
+
onCancel: h2,
|
|
1147
|
+
output: n3 = process.stdout,
|
|
1148
|
+
cancelMessage: G,
|
|
1149
|
+
errorMessage: O,
|
|
1150
|
+
frames: E = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1151
|
+
delay: F = unicode ? 80 : 120,
|
|
1152
|
+
signal: m,
|
|
1153
|
+
...I2
|
|
1154
|
+
} = {}) => {
|
|
1155
|
+
const u3 = isCI();
|
|
1156
|
+
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
1157
|
+
const x = getColumns(n3), k = I2?.styleFrame ?? W, g = (e) => {
|
|
1158
|
+
const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
|
|
1159
|
+
S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
|
|
1160
|
+
}, f = () => g(2), i2 = () => g(1), A = () => {
|
|
1161
|
+
process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g), m && m.addEventListener("abort", i2);
|
|
1162
|
+
}, H = () => {
|
|
1163
|
+
process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g), m && m.removeEventListener("abort", i2);
|
|
1164
|
+
}, y2 = () => {
|
|
1165
|
+
if (p === void 0) return;
|
|
1166
|
+
u3 && n3.write(`
|
|
969
1167
|
`);
|
|
970
|
-
const
|
|
1168
|
+
const r2 = wrapAnsi(p, x, {
|
|
1169
|
+
hard: true,
|
|
1170
|
+
trim: false
|
|
1171
|
+
}).split(`
|
|
971
1172
|
`);
|
|
972
|
-
|
|
973
|
-
},
|
|
974
|
-
const
|
|
975
|
-
return
|
|
976
|
-
},
|
|
977
|
-
|
|
1173
|
+
r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
|
|
1174
|
+
}, C2 = (e) => e.replace(/\.+$/, ""), _ = (e) => {
|
|
1175
|
+
const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o = Math.floor(r2 % 60);
|
|
1176
|
+
return t2 > 0 ? `[${t2}m ${o}s]` : `[${o}s]`;
|
|
1177
|
+
}, N = I2.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1178
|
+
d = true, M = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
978
1179
|
`);
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
if (
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1180
|
+
let r2 = 0, t2 = 0;
|
|
1181
|
+
A(), T = setInterval(() => {
|
|
1182
|
+
if (u3 && s === p)
|
|
1183
|
+
return;
|
|
1184
|
+
y2(), p = s;
|
|
1185
|
+
const o = k(E[r2]);
|
|
1186
|
+
let v;
|
|
1187
|
+
if (u3)
|
|
1188
|
+
v = `${o} ${s}...`;
|
|
1189
|
+
else if (l2 === "timer")
|
|
1190
|
+
v = `${o} ${s} ${_(w)}`;
|
|
987
1191
|
else {
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1192
|
+
const B = ".".repeat(Math.floor(t2)).slice(0, 3);
|
|
1193
|
+
v = `${o} ${s}${B}`;
|
|
1194
|
+
}
|
|
1195
|
+
const j = wrapAnsi(v, x, {
|
|
1196
|
+
hard: true,
|
|
1197
|
+
trim: false
|
|
1198
|
+
});
|
|
1199
|
+
n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
|
|
1200
|
+
}, F);
|
|
1201
|
+
}, a2 = (e = "", r2 = 0, t2 = false) => {
|
|
1202
|
+
if (!d) return;
|
|
1203
|
+
d = false, clearInterval(T), y2();
|
|
1204
|
+
const o = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1205
|
+
s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o} ${s} ${_(w)}
|
|
1206
|
+
`) : n3.write(`${o} ${s}
|
|
1207
|
+
`)), H(), M();
|
|
1208
|
+
};
|
|
1209
|
+
return {
|
|
1210
|
+
start: P,
|
|
1211
|
+
stop: (e = "") => a2(e, 0),
|
|
1212
|
+
message: (e = "") => {
|
|
1213
|
+
s = C2(e ?? s);
|
|
1214
|
+
},
|
|
1215
|
+
cancel: (e = "") => a2(e, 1),
|
|
1216
|
+
error: (e = "") => a2(e, 2),
|
|
1217
|
+
clear: () => a2("", 0, true),
|
|
1218
|
+
get isCancelled() {
|
|
1219
|
+
return S;
|
|
1220
|
+
}
|
|
1001
1221
|
};
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1222
|
+
};
|
|
1223
|
+
u2 = {
|
|
1224
|
+
light: unicodeOr("\u2500", "-"),
|
|
1225
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1226
|
+
block: unicodeOr("\u2588", "#")
|
|
1227
|
+
};
|
|
1228
|
+
SELECT_INSTRUCTIONS = [
|
|
1229
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1230
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1231
|
+
];
|
|
1232
|
+
c = (t2, o) => t2.includes(`
|
|
1233
|
+
`) ? t2.split(`
|
|
1234
|
+
`).map((d) => o(d)).join(`
|
|
1235
|
+
`) : o(t2);
|
|
1236
|
+
select = (t2) => {
|
|
1237
|
+
const o = (n3, m) => {
|
|
1238
|
+
if (n3 === void 0)
|
|
1239
|
+
return "";
|
|
1240
|
+
const s = n3.label ?? String(n3.value);
|
|
1241
|
+
switch (m) {
|
|
1017
1242
|
case "disabled":
|
|
1018
|
-
return `${
|
|
1243
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1019
1244
|
case "selected":
|
|
1020
|
-
return `${
|
|
1245
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1021
1246
|
case "active":
|
|
1022
|
-
return `${
|
|
1247
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1023
1248
|
case "cancelled":
|
|
1024
|
-
return `${
|
|
1249
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1025
1250
|
default:
|
|
1026
|
-
return `${
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
return new
|
|
1030
|
-
|
|
1031
|
-
|
|
1251
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1252
|
+
}
|
|
1253
|
+
}, d = t2.showInstructions ?? true;
|
|
1254
|
+
return new n$1({
|
|
1255
|
+
options: t2.options,
|
|
1256
|
+
signal: t2.signal,
|
|
1257
|
+
input: t2.input,
|
|
1258
|
+
output: t2.output,
|
|
1259
|
+
initialValue: t2.initialValue,
|
|
1260
|
+
render() {
|
|
1261
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1262
|
+
t2.output,
|
|
1263
|
+
t2.message,
|
|
1264
|
+
s,
|
|
1265
|
+
m
|
|
1266
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1267
|
+
` : ""}${i2}
|
|
1268
|
+
`;
|
|
1269
|
+
switch (this.state) {
|
|
1270
|
+
case "submit": {
|
|
1271
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1272
|
+
t2.output,
|
|
1273
|
+
o(this.options[this.cursor], "selected"),
|
|
1274
|
+
r2
|
|
1275
|
+
);
|
|
1276
|
+
return `${u3}${a2}`;
|
|
1277
|
+
}
|
|
1278
|
+
case "cancel": {
|
|
1279
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1280
|
+
t2.output,
|
|
1281
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1282
|
+
r2
|
|
1283
|
+
);
|
|
1284
|
+
return `${u3}${a2}${n3 ? `
|
|
1285
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1286
|
+
}
|
|
1287
|
+
default: {
|
|
1288
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1289
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1290
|
+
`), f = p.length + 1;
|
|
1291
|
+
return `${u3}${r2}${limitOptions({
|
|
1292
|
+
output: t2.output,
|
|
1293
|
+
cursor: this.cursor,
|
|
1294
|
+
options: this.options,
|
|
1295
|
+
maxItems: t2.maxItems,
|
|
1296
|
+
columnPadding: r2.length,
|
|
1297
|
+
rowPadding: a2 + f,
|
|
1298
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1299
|
+
}).join(`
|
|
1300
|
+
${r2}`)}
|
|
1301
|
+
${b}
|
|
1032
1302
|
`;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}).prompt();
|
|
1307
|
+
};
|
|
1308
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
1309
|
+
text = (t2) => new n2({
|
|
1310
|
+
validate: t2.validate,
|
|
1311
|
+
placeholder: t2.placeholder,
|
|
1312
|
+
defaultValue: t2.defaultValue,
|
|
1313
|
+
initialValue: t2.initialValue,
|
|
1314
|
+
output: t2.output,
|
|
1315
|
+
signal: t2.signal,
|
|
1316
|
+
input: t2.input,
|
|
1317
|
+
render() {
|
|
1318
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l2 = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1319
|
+
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1320
|
+
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1321
|
+
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
1322
|
+
styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
|
|
1323
|
+
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1033
1324
|
switch (this.state) {
|
|
1325
|
+
case "validating": {
|
|
1326
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c2 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1327
|
+
return `${l2}${n3}${c2}
|
|
1328
|
+
${i2} ${$}
|
|
1329
|
+
`;
|
|
1330
|
+
}
|
|
1331
|
+
case "error": {
|
|
1332
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c2 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1333
|
+
return `${l2.trim()}
|
|
1334
|
+
${i2}${o}
|
|
1335
|
+
${c2}${n3}
|
|
1336
|
+
`;
|
|
1337
|
+
}
|
|
1034
1338
|
case "submit": {
|
|
1035
|
-
const
|
|
1036
|
-
return `${
|
|
1339
|
+
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1340
|
+
return `${l2}${i2}${n3}`;
|
|
1037
1341
|
}
|
|
1038
1342
|
case "cancel": {
|
|
1039
|
-
const
|
|
1040
|
-
return `${
|
|
1041
|
-
${
|
|
1343
|
+
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1344
|
+
return `${l2}${i2}${n3}${s.trim() ? `
|
|
1345
|
+
${i2}` : ""}`;
|
|
1042
1346
|
}
|
|
1043
1347
|
default: {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
${c2}`)}
|
|
1048
|
-
${a}
|
|
1348
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1349
|
+
return `${l2}${n3}${o}
|
|
1350
|
+
${i2}
|
|
1049
1351
|
`;
|
|
1050
1352
|
}
|
|
1051
1353
|
}
|
|
1052
|
-
} }).prompt();
|
|
1053
|
-
};
|
|
1054
|
-
je = `${t("gray", d2)} `;
|
|
1055
|
-
Ot = (e) => new at({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
|
|
1056
|
-
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${t("gray", d2)}
|
|
1057
|
-
` : ""}${V2(this.state)} `}${e.message}
|
|
1058
|
-
`, r = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1059
|
-
switch (this.state) {
|
|
1060
|
-
case "error": {
|
|
1061
|
-
const o = this.error ? ` ${t("yellow", this.error)}` : "", c2 = i ? `${t("yellow", d2)} ` : "", a = i ? t("yellow", E2) : "";
|
|
1062
|
-
return `${s.trim()}
|
|
1063
|
-
${c2}${u2}
|
|
1064
|
-
${a}${o}
|
|
1065
|
-
`;
|
|
1066
|
-
}
|
|
1067
|
-
case "submit": {
|
|
1068
|
-
const o = n ? ` ${t("dim", n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1069
|
-
return `${s}${c2}${o}`;
|
|
1070
|
-
}
|
|
1071
|
-
case "cancel": {
|
|
1072
|
-
const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "", c2 = i ? t("gray", d2) : "";
|
|
1073
|
-
return `${s}${c2}${o}${n.trim() ? `
|
|
1074
|
-
${c2}` : ""}`;
|
|
1075
|
-
}
|
|
1076
|
-
default: {
|
|
1077
|
-
const o = i ? `${t("cyan", d2)} ` : "", c2 = i ? t("cyan", E2) : "";
|
|
1078
|
-
return `${s}${o}${u2}
|
|
1079
|
-
${c2}
|
|
1080
|
-
`;
|
|
1081
|
-
}
|
|
1082
1354
|
}
|
|
1083
|
-
}
|
|
1355
|
+
}).prompt();
|
|
1084
1356
|
}
|
|
1085
1357
|
});
|
|
1086
1358
|
|
|
@@ -1088,21 +1360,21 @@ ${c2}
|
|
|
1088
1360
|
var cli_output_exports = {};
|
|
1089
1361
|
__export(cli_output_exports, {
|
|
1090
1362
|
LogLevel: () => LogLevel,
|
|
1091
|
-
cancel: () =>
|
|
1363
|
+
cancel: () => cancel,
|
|
1092
1364
|
colorUtils: () => colorUtils,
|
|
1093
1365
|
displayDoNotDevError: () => displayDoNotDevError,
|
|
1094
1366
|
error: () => error,
|
|
1095
1367
|
getLogLevel: () => getLogLevel,
|
|
1096
1368
|
info: () => info,
|
|
1097
|
-
intro: () =>
|
|
1098
|
-
isCancel: () =>
|
|
1369
|
+
intro: () => intro,
|
|
1370
|
+
isCancel: () => isCancel,
|
|
1099
1371
|
isDebug: () => isDebug,
|
|
1100
1372
|
isVerbose: () => isVerbose,
|
|
1101
|
-
log: () =>
|
|
1102
|
-
note: () =>
|
|
1103
|
-
outro: () =>
|
|
1373
|
+
log: () => log2,
|
|
1374
|
+
note: () => note,
|
|
1375
|
+
outro: () => outro,
|
|
1104
1376
|
setLogLevel: () => setLogLevel,
|
|
1105
|
-
spinner: () =>
|
|
1377
|
+
spinner: () => spinner,
|
|
1106
1378
|
success: () => success,
|
|
1107
1379
|
warn: () => warn
|
|
1108
1380
|
});
|
|
@@ -1114,9 +1386,9 @@ function supportsColor() {
|
|
|
1114
1386
|
}
|
|
1115
1387
|
return process.stdout.isTTY === true;
|
|
1116
1388
|
}
|
|
1117
|
-
function colorize(
|
|
1118
|
-
if (!supportsColor()) return
|
|
1119
|
-
return `${color}${
|
|
1389
|
+
function colorize(text2, color) {
|
|
1390
|
+
if (!supportsColor()) return text2;
|
|
1391
|
+
return `${color}${text2}${colors.reset}`;
|
|
1120
1392
|
}
|
|
1121
1393
|
function setLogLevel(level) {
|
|
1122
1394
|
currentLogLevel = level;
|
|
@@ -1178,9 +1450,9 @@ ${contextStr}`;
|
|
|
1178
1450
|
|
|
1179
1451
|
Original error: ${originalMsg}`;
|
|
1180
1452
|
}
|
|
1181
|
-
|
|
1453
|
+
log.error(message);
|
|
1182
1454
|
}
|
|
1183
|
-
var colors, colorUtils, LogLevel, currentLogLevel,
|
|
1455
|
+
var colors, colorUtils, LogLevel, currentLogLevel, log2, error, warn, info, success;
|
|
1184
1456
|
var init_cli_output = __esm({
|
|
1185
1457
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1186
1458
|
"use strict";
|
|
@@ -1225,7 +1497,7 @@ var init_cli_output = __esm({
|
|
|
1225
1497
|
currentLogLevel = envLevel;
|
|
1226
1498
|
}
|
|
1227
1499
|
}
|
|
1228
|
-
|
|
1500
|
+
log2 = {
|
|
1229
1501
|
/**
|
|
1230
1502
|
* Logs an error message (always shows unless Quiet level)
|
|
1231
1503
|
* Uses clack's log.error + explicit red color
|
|
@@ -1233,7 +1505,7 @@ var init_cli_output = __esm({
|
|
|
1233
1505
|
error(...args) {
|
|
1234
1506
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1235
1507
|
const message = formatMessage(...args);
|
|
1236
|
-
|
|
1508
|
+
log.error(colorize(message, colors.brightRed));
|
|
1237
1509
|
},
|
|
1238
1510
|
/**
|
|
1239
1511
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1242,7 +1514,7 @@ var init_cli_output = __esm({
|
|
|
1242
1514
|
warn(...args) {
|
|
1243
1515
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1244
1516
|
const message = formatMessage(...args);
|
|
1245
|
-
|
|
1517
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1246
1518
|
},
|
|
1247
1519
|
/**
|
|
1248
1520
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1251,7 +1523,7 @@ var init_cli_output = __esm({
|
|
|
1251
1523
|
info(...args) {
|
|
1252
1524
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1253
1525
|
const message = formatMessage(...args);
|
|
1254
|
-
|
|
1526
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1255
1527
|
},
|
|
1256
1528
|
/**
|
|
1257
1529
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1260,7 +1532,7 @@ var init_cli_output = __esm({
|
|
|
1260
1532
|
success(...args) {
|
|
1261
1533
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1262
1534
|
const message = formatMessage(...args);
|
|
1263
|
-
|
|
1535
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1264
1536
|
},
|
|
1265
1537
|
/**
|
|
1266
1538
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1269,7 +1541,7 @@ var init_cli_output = __esm({
|
|
|
1269
1541
|
debug(...args) {
|
|
1270
1542
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1271
1543
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1272
|
-
|
|
1544
|
+
log.message(
|
|
1273
1545
|
colorize(
|
|
1274
1546
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1275
1547
|
colors.gray
|
|
@@ -1283,7 +1555,7 @@ var init_cli_output = __esm({
|
|
|
1283
1555
|
trace(...args) {
|
|
1284
1556
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1285
1557
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1286
|
-
|
|
1558
|
+
log.message(
|
|
1287
1559
|
colorize(
|
|
1288
1560
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1289
1561
|
colors.gray
|
|
@@ -1291,10 +1563,10 @@ var init_cli_output = __esm({
|
|
|
1291
1563
|
);
|
|
1292
1564
|
}
|
|
1293
1565
|
};
|
|
1294
|
-
error =
|
|
1295
|
-
warn =
|
|
1296
|
-
info =
|
|
1297
|
-
success =
|
|
1566
|
+
error = log2.error.bind(log2);
|
|
1567
|
+
warn = log2.warn.bind(log2);
|
|
1568
|
+
info = log2.info.bind(log2);
|
|
1569
|
+
success = log2.success.bind(log2);
|
|
1298
1570
|
}
|
|
1299
1571
|
});
|
|
1300
1572
|
|
|
@@ -1512,9 +1784,9 @@ var require_is_glob = __commonJS({
|
|
|
1512
1784
|
index += 2;
|
|
1513
1785
|
var close = chars[open];
|
|
1514
1786
|
if (close) {
|
|
1515
|
-
var
|
|
1516
|
-
if (
|
|
1517
|
-
index =
|
|
1787
|
+
var n3 = str.indexOf(close, index);
|
|
1788
|
+
if (n3 !== -1) {
|
|
1789
|
+
index = n3 + 1;
|
|
1518
1790
|
}
|
|
1519
1791
|
}
|
|
1520
1792
|
if (str[index] === "!") {
|
|
@@ -1540,9 +1812,9 @@ var require_is_glob = __commonJS({
|
|
|
1540
1812
|
index += 2;
|
|
1541
1813
|
var close = chars[open];
|
|
1542
1814
|
if (close) {
|
|
1543
|
-
var
|
|
1544
|
-
if (
|
|
1545
|
-
index =
|
|
1815
|
+
var n3 = str.indexOf(close, index);
|
|
1816
|
+
if (n3 !== -1) {
|
|
1817
|
+
index = n3 + 1;
|
|
1546
1818
|
}
|
|
1547
1819
|
}
|
|
1548
1820
|
if (str[index] === "!") {
|
|
@@ -1620,8 +1892,8 @@ var require_utils = __commonJS({
|
|
|
1620
1892
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1621
1893
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1622
1894
|
};
|
|
1623
|
-
exports.escapeNode = (
|
|
1624
|
-
const node =
|
|
1895
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1896
|
+
const node = block2.nodes[n3];
|
|
1625
1897
|
if (!node) return;
|
|
1626
1898
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1627
1899
|
if (node.escaped !== true) {
|
|
@@ -1638,15 +1910,15 @@ var require_utils = __commonJS({
|
|
|
1638
1910
|
}
|
|
1639
1911
|
return false;
|
|
1640
1912
|
};
|
|
1641
|
-
exports.isInvalidBrace = (
|
|
1642
|
-
if (
|
|
1643
|
-
if (
|
|
1644
|
-
if (
|
|
1645
|
-
|
|
1913
|
+
exports.isInvalidBrace = (block2) => {
|
|
1914
|
+
if (block2.type !== "brace") return false;
|
|
1915
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1916
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1917
|
+
block2.invalid = true;
|
|
1646
1918
|
return true;
|
|
1647
1919
|
}
|
|
1648
|
-
if (
|
|
1649
|
-
|
|
1920
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1921
|
+
block2.invalid = true;
|
|
1650
1922
|
return true;
|
|
1651
1923
|
}
|
|
1652
1924
|
return false;
|
|
@@ -1665,8 +1937,8 @@ var require_utils = __commonJS({
|
|
|
1665
1937
|
exports.flatten = (...args) => {
|
|
1666
1938
|
const result = [];
|
|
1667
1939
|
const flat = (arr) => {
|
|
1668
|
-
for (let
|
|
1669
|
-
const ele = arr[
|
|
1940
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1941
|
+
const ele = arr[i2];
|
|
1670
1942
|
if (Array.isArray(ele)) {
|
|
1671
1943
|
flat(ele);
|
|
1672
1944
|
continue;
|
|
@@ -1760,9 +2032,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1760
2032
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1761
2033
|
return toRegexRange.cache[cacheKey].result;
|
|
1762
2034
|
}
|
|
1763
|
-
let
|
|
2035
|
+
let a2 = Math.min(min, max);
|
|
1764
2036
|
let b = Math.max(min, max);
|
|
1765
|
-
if (Math.abs(
|
|
2037
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1766
2038
|
let result = min + "|" + max;
|
|
1767
2039
|
if (opts.capture) {
|
|
1768
2040
|
return `(${result})`;
|
|
@@ -1773,20 +2045,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1773
2045
|
return `(?:${result})`;
|
|
1774
2046
|
}
|
|
1775
2047
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1776
|
-
let state = { min, max, a, b };
|
|
2048
|
+
let state = { min, max, a: a2, b };
|
|
1777
2049
|
let positives = [];
|
|
1778
2050
|
let negatives = [];
|
|
1779
2051
|
if (isPadded) {
|
|
1780
2052
|
state.isPadded = isPadded;
|
|
1781
2053
|
state.maxLen = String(state.max).length;
|
|
1782
2054
|
}
|
|
1783
|
-
if (
|
|
2055
|
+
if (a2 < 0) {
|
|
1784
2056
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1785
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1786
|
-
|
|
2057
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2058
|
+
a2 = state.a = 0;
|
|
1787
2059
|
}
|
|
1788
2060
|
if (b >= 0) {
|
|
1789
|
-
positives = splitToPatterns(
|
|
2061
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1790
2062
|
}
|
|
1791
2063
|
state.negatives = negatives;
|
|
1792
2064
|
state.positives = positives;
|
|
@@ -1834,8 +2106,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1834
2106
|
let digits = zipped.length;
|
|
1835
2107
|
let pattern = "";
|
|
1836
2108
|
let count = 0;
|
|
1837
|
-
for (let
|
|
1838
|
-
let [startDigit, stopDigit] = zipped[
|
|
2109
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2110
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1839
2111
|
if (startDigit === stopDigit) {
|
|
1840
2112
|
pattern += startDigit;
|
|
1841
2113
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1854,8 +2126,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1854
2126
|
let tokens = [];
|
|
1855
2127
|
let start = min;
|
|
1856
2128
|
let prev;
|
|
1857
|
-
for (let
|
|
1858
|
-
let max2 = ranges[
|
|
2129
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2130
|
+
let max2 = ranges[i2];
|
|
1859
2131
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1860
2132
|
let zeros = "";
|
|
1861
2133
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1890,13 +2162,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1890
2162
|
}
|
|
1891
2163
|
return result;
|
|
1892
2164
|
}
|
|
1893
|
-
function zip(
|
|
2165
|
+
function zip(a2, b) {
|
|
1894
2166
|
let arr = [];
|
|
1895
|
-
for (let
|
|
2167
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1896
2168
|
return arr;
|
|
1897
2169
|
}
|
|
1898
|
-
function compare(
|
|
1899
|
-
return
|
|
2170
|
+
function compare(a2, b) {
|
|
2171
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1900
2172
|
}
|
|
1901
2173
|
function contains(arr, key, val) {
|
|
1902
2174
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1914,8 +2186,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1914
2186
|
}
|
|
1915
2187
|
return "";
|
|
1916
2188
|
}
|
|
1917
|
-
function toCharacterClass(
|
|
1918
|
-
return `[${
|
|
2189
|
+
function toCharacterClass(a2, b, options) {
|
|
2190
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1919
2191
|
}
|
|
1920
2192
|
function hasPadding(str) {
|
|
1921
2193
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1994,8 +2266,8 @@ var require_fill_range = __commonJS({
|
|
|
1994
2266
|
return negative ? "-" + input : input;
|
|
1995
2267
|
};
|
|
1996
2268
|
var toSequence = (parts, options, maxLen) => {
|
|
1997
|
-
parts.negatives.sort((
|
|
1998
|
-
parts.positives.sort((
|
|
2269
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2270
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
1999
2271
|
let prefix = options.capture ? "" : "?:";
|
|
2000
2272
|
let positives = "";
|
|
2001
2273
|
let negatives = "";
|
|
@@ -2016,12 +2288,12 @@ var require_fill_range = __commonJS({
|
|
|
2016
2288
|
}
|
|
2017
2289
|
return result;
|
|
2018
2290
|
};
|
|
2019
|
-
var toRange = (
|
|
2291
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
2020
2292
|
if (isNumbers) {
|
|
2021
|
-
return toRegexRange(
|
|
2293
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
2022
2294
|
}
|
|
2023
|
-
let start = String.fromCharCode(
|
|
2024
|
-
if (
|
|
2295
|
+
let start = String.fromCharCode(a2);
|
|
2296
|
+
if (a2 === b) return start;
|
|
2025
2297
|
let stop = String.fromCharCode(b);
|
|
2026
2298
|
return `[${start}-${stop}]`;
|
|
2027
2299
|
};
|
|
@@ -2047,15 +2319,15 @@ var require_fill_range = __commonJS({
|
|
|
2047
2319
|
return [];
|
|
2048
2320
|
};
|
|
2049
2321
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2050
|
-
let
|
|
2322
|
+
let a2 = Number(start);
|
|
2051
2323
|
let b = Number(end);
|
|
2052
|
-
if (!Number.isInteger(
|
|
2324
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2053
2325
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2054
2326
|
return [];
|
|
2055
2327
|
}
|
|
2056
|
-
if (
|
|
2328
|
+
if (a2 === 0) a2 = 0;
|
|
2057
2329
|
if (b === 0) b = 0;
|
|
2058
|
-
let descending =
|
|
2330
|
+
let descending = a2 > b;
|
|
2059
2331
|
let startString = String(start);
|
|
2060
2332
|
let endString = String(end);
|
|
2061
2333
|
let stepString = String(step);
|
|
@@ -2071,13 +2343,13 @@ var require_fill_range = __commonJS({
|
|
|
2071
2343
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2072
2344
|
let range = [];
|
|
2073
2345
|
let index = 0;
|
|
2074
|
-
while (descending ?
|
|
2346
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2075
2347
|
if (options.toRegex === true && step > 1) {
|
|
2076
|
-
push(
|
|
2348
|
+
push(a2);
|
|
2077
2349
|
} else {
|
|
2078
|
-
range.push(pad(format(
|
|
2350
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2079
2351
|
}
|
|
2080
|
-
|
|
2352
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2081
2353
|
index++;
|
|
2082
2354
|
}
|
|
2083
2355
|
if (options.toRegex === true) {
|
|
@@ -2090,19 +2362,19 @@ var require_fill_range = __commonJS({
|
|
|
2090
2362
|
return invalidRange(start, end, options);
|
|
2091
2363
|
}
|
|
2092
2364
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2093
|
-
let
|
|
2365
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2094
2366
|
let b = `${end}`.charCodeAt(0);
|
|
2095
|
-
let descending =
|
|
2096
|
-
let min = Math.min(
|
|
2097
|
-
let max = Math.max(
|
|
2367
|
+
let descending = a2 > b;
|
|
2368
|
+
let min = Math.min(a2, b);
|
|
2369
|
+
let max = Math.max(a2, b);
|
|
2098
2370
|
if (options.toRegex && step === 1) {
|
|
2099
2371
|
return toRange(min, max, false, options);
|
|
2100
2372
|
}
|
|
2101
2373
|
let range = [];
|
|
2102
2374
|
let index = 0;
|
|
2103
|
-
while (descending ?
|
|
2104
|
-
range.push(format(
|
|
2105
|
-
|
|
2375
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2376
|
+
range.push(format(a2, index));
|
|
2377
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2106
2378
|
index++;
|
|
2107
2379
|
}
|
|
2108
2380
|
if (options.toRegex === true) {
|
|
@@ -2225,18 +2497,18 @@ var require_expand = __commonJS({
|
|
|
2225
2497
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2226
2498
|
const walk = (node, parent = {}) => {
|
|
2227
2499
|
node.queue = [];
|
|
2228
|
-
let
|
|
2229
|
-
let
|
|
2230
|
-
while (
|
|
2231
|
-
|
|
2232
|
-
|
|
2500
|
+
let p = parent;
|
|
2501
|
+
let q = parent.queue;
|
|
2502
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2503
|
+
p = p.parent;
|
|
2504
|
+
q = p.queue;
|
|
2233
2505
|
}
|
|
2234
2506
|
if (node.invalid || node.dollar) {
|
|
2235
|
-
|
|
2507
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2236
2508
|
return;
|
|
2237
2509
|
}
|
|
2238
2510
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2239
|
-
|
|
2511
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2240
2512
|
return;
|
|
2241
2513
|
}
|
|
2242
2514
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2248,26 +2520,26 @@ var require_expand = __commonJS({
|
|
|
2248
2520
|
if (range.length === 0) {
|
|
2249
2521
|
range = stringify2(node, options);
|
|
2250
2522
|
}
|
|
2251
|
-
|
|
2523
|
+
q.push(append(q.pop(), range));
|
|
2252
2524
|
node.nodes = [];
|
|
2253
2525
|
return;
|
|
2254
2526
|
}
|
|
2255
2527
|
const enclose = utils.encloseBrace(node);
|
|
2256
2528
|
let queue = node.queue;
|
|
2257
|
-
let
|
|
2258
|
-
while (
|
|
2259
|
-
|
|
2260
|
-
queue =
|
|
2529
|
+
let block2 = node;
|
|
2530
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2531
|
+
block2 = block2.parent;
|
|
2532
|
+
queue = block2.queue;
|
|
2261
2533
|
}
|
|
2262
|
-
for (let
|
|
2263
|
-
const child = node.nodes[
|
|
2534
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2535
|
+
const child = node.nodes[i2];
|
|
2264
2536
|
if (child.type === "comma" && node.type === "brace") {
|
|
2265
|
-
if (
|
|
2537
|
+
if (i2 === 1) queue.push("");
|
|
2266
2538
|
queue.push("");
|
|
2267
2539
|
continue;
|
|
2268
2540
|
}
|
|
2269
2541
|
if (child.type === "close") {
|
|
2270
|
-
|
|
2542
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2271
2543
|
continue;
|
|
2272
2544
|
}
|
|
2273
2545
|
if (child.value && child.type !== "open") {
|
|
@@ -2434,7 +2706,7 @@ var require_parse = __commonJS({
|
|
|
2434
2706
|
}
|
|
2435
2707
|
const ast = { type: "root", input, nodes: [] };
|
|
2436
2708
|
const stack = [ast];
|
|
2437
|
-
let
|
|
2709
|
+
let block2 = ast;
|
|
2438
2710
|
let prev = ast;
|
|
2439
2711
|
let brackets = 0;
|
|
2440
2712
|
const length = input.length;
|
|
@@ -2450,15 +2722,15 @@ var require_parse = __commonJS({
|
|
|
2450
2722
|
prev.value += node.value;
|
|
2451
2723
|
return;
|
|
2452
2724
|
}
|
|
2453
|
-
|
|
2454
|
-
node.parent =
|
|
2725
|
+
block2.nodes.push(node);
|
|
2726
|
+
node.parent = block2;
|
|
2455
2727
|
node.prev = prev;
|
|
2456
2728
|
prev = node;
|
|
2457
2729
|
return node;
|
|
2458
2730
|
};
|
|
2459
2731
|
push({ type: "bos" });
|
|
2460
2732
|
while (index < length) {
|
|
2461
|
-
|
|
2733
|
+
block2 = stack[stack.length - 1];
|
|
2462
2734
|
value = advance();
|
|
2463
2735
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2464
2736
|
continue;
|
|
@@ -2495,19 +2767,19 @@ var require_parse = __commonJS({
|
|
|
2495
2767
|
continue;
|
|
2496
2768
|
}
|
|
2497
2769
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2498
|
-
|
|
2499
|
-
stack.push(
|
|
2770
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2771
|
+
stack.push(block2);
|
|
2500
2772
|
push({ type: "text", value });
|
|
2501
2773
|
continue;
|
|
2502
2774
|
}
|
|
2503
2775
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2504
|
-
if (
|
|
2776
|
+
if (block2.type !== "paren") {
|
|
2505
2777
|
push({ type: "text", value });
|
|
2506
2778
|
continue;
|
|
2507
2779
|
}
|
|
2508
|
-
|
|
2780
|
+
block2 = stack.pop();
|
|
2509
2781
|
push({ type: "text", value });
|
|
2510
|
-
|
|
2782
|
+
block2 = stack[stack.length - 1];
|
|
2511
2783
|
continue;
|
|
2512
2784
|
}
|
|
2513
2785
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2532,7 +2804,7 @@ var require_parse = __commonJS({
|
|
|
2532
2804
|
}
|
|
2533
2805
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2534
2806
|
depth++;
|
|
2535
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2807
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2536
2808
|
const brace = {
|
|
2537
2809
|
type: "brace",
|
|
2538
2810
|
open: true,
|
|
@@ -2543,52 +2815,52 @@ var require_parse = __commonJS({
|
|
|
2543
2815
|
ranges: 0,
|
|
2544
2816
|
nodes: []
|
|
2545
2817
|
};
|
|
2546
|
-
|
|
2547
|
-
stack.push(
|
|
2818
|
+
block2 = push(brace);
|
|
2819
|
+
stack.push(block2);
|
|
2548
2820
|
push({ type: "open", value });
|
|
2549
2821
|
continue;
|
|
2550
2822
|
}
|
|
2551
2823
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2552
|
-
if (
|
|
2824
|
+
if (block2.type !== "brace") {
|
|
2553
2825
|
push({ type: "text", value });
|
|
2554
2826
|
continue;
|
|
2555
2827
|
}
|
|
2556
2828
|
const type = "close";
|
|
2557
|
-
|
|
2558
|
-
|
|
2829
|
+
block2 = stack.pop();
|
|
2830
|
+
block2.close = true;
|
|
2559
2831
|
push({ type, value });
|
|
2560
2832
|
depth--;
|
|
2561
|
-
|
|
2833
|
+
block2 = stack[stack.length - 1];
|
|
2562
2834
|
continue;
|
|
2563
2835
|
}
|
|
2564
2836
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2565
|
-
if (
|
|
2566
|
-
|
|
2567
|
-
const open =
|
|
2568
|
-
|
|
2837
|
+
if (block2.ranges > 0) {
|
|
2838
|
+
block2.ranges = 0;
|
|
2839
|
+
const open = block2.nodes.shift();
|
|
2840
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2569
2841
|
}
|
|
2570
2842
|
push({ type: "comma", value });
|
|
2571
|
-
|
|
2843
|
+
block2.commas++;
|
|
2572
2844
|
continue;
|
|
2573
2845
|
}
|
|
2574
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2575
|
-
const siblings =
|
|
2846
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2847
|
+
const siblings = block2.nodes;
|
|
2576
2848
|
if (depth === 0 || siblings.length === 0) {
|
|
2577
2849
|
push({ type: "text", value });
|
|
2578
2850
|
continue;
|
|
2579
2851
|
}
|
|
2580
2852
|
if (prev.type === "dot") {
|
|
2581
|
-
|
|
2853
|
+
block2.range = [];
|
|
2582
2854
|
prev.value += value;
|
|
2583
2855
|
prev.type = "range";
|
|
2584
|
-
if (
|
|
2585
|
-
|
|
2586
|
-
|
|
2856
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2857
|
+
block2.invalid = true;
|
|
2858
|
+
block2.ranges = 0;
|
|
2587
2859
|
prev.type = "text";
|
|
2588
2860
|
continue;
|
|
2589
2861
|
}
|
|
2590
|
-
|
|
2591
|
-
|
|
2862
|
+
block2.ranges++;
|
|
2863
|
+
block2.args = [];
|
|
2592
2864
|
continue;
|
|
2593
2865
|
}
|
|
2594
2866
|
if (prev.type === "range") {
|
|
@@ -2596,7 +2868,7 @@ var require_parse = __commonJS({
|
|
|
2596
2868
|
const before = siblings[siblings.length - 1];
|
|
2597
2869
|
before.value += prev.value + value;
|
|
2598
2870
|
prev = before;
|
|
2599
|
-
|
|
2871
|
+
block2.ranges--;
|
|
2600
2872
|
continue;
|
|
2601
2873
|
}
|
|
2602
2874
|
push({ type: "dot", value });
|
|
@@ -2605,9 +2877,9 @@ var require_parse = __commonJS({
|
|
|
2605
2877
|
push({ type: "text", value });
|
|
2606
2878
|
}
|
|
2607
2879
|
do {
|
|
2608
|
-
|
|
2609
|
-
if (
|
|
2610
|
-
|
|
2880
|
+
block2 = stack.pop();
|
|
2881
|
+
if (block2.type !== "root") {
|
|
2882
|
+
block2.nodes.forEach((node) => {
|
|
2611
2883
|
if (!node.nodes) {
|
|
2612
2884
|
if (node.type === "open") node.isOpen = true;
|
|
2613
2885
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2616,8 +2888,8 @@ var require_parse = __commonJS({
|
|
|
2616
2888
|
}
|
|
2617
2889
|
});
|
|
2618
2890
|
const parent = stack[stack.length - 1];
|
|
2619
|
-
const index2 = parent.nodes.indexOf(
|
|
2620
|
-
parent.nodes.splice(index2, 1, ...
|
|
2891
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2892
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2621
2893
|
}
|
|
2622
2894
|
} while (stack.length > 0);
|
|
2623
2895
|
push({ type: "eos" });
|
|
@@ -3250,9 +3522,9 @@ var require_scan = __commonJS({
|
|
|
3250
3522
|
if (opts.parts === true || opts.tokens === true) {
|
|
3251
3523
|
let prevIndex;
|
|
3252
3524
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3253
|
-
const
|
|
3254
|
-
const
|
|
3255
|
-
const value = input.slice(
|
|
3525
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3526
|
+
const i2 = slashes[idx];
|
|
3527
|
+
const value = input.slice(n3, i2);
|
|
3256
3528
|
if (opts.tokens) {
|
|
3257
3529
|
if (idx === 0 && start !== 0) {
|
|
3258
3530
|
tokens[idx].isPrefix = true;
|
|
@@ -3266,7 +3538,7 @@ var require_scan = __commonJS({
|
|
|
3266
3538
|
if (idx !== 0 || value !== "") {
|
|
3267
3539
|
parts.push(value);
|
|
3268
3540
|
}
|
|
3269
|
-
prevIndex =
|
|
3541
|
+
prevIndex = i2;
|
|
3270
3542
|
}
|
|
3271
3543
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3272
3544
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3395,15 +3667,15 @@ var require_parse2 = __commonJS({
|
|
|
3395
3667
|
};
|
|
3396
3668
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3397
3669
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3398
|
-
for (let
|
|
3399
|
-
for (let
|
|
3400
|
-
const
|
|
3401
|
-
const b = values[
|
|
3402
|
-
const char =
|
|
3403
|
-
if (!char ||
|
|
3670
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3671
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3672
|
+
const a2 = values[i2];
|
|
3673
|
+
const b = values[j];
|
|
3674
|
+
const char = a2[0];
|
|
3675
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3404
3676
|
continue;
|
|
3405
3677
|
}
|
|
3406
|
-
if (
|
|
3678
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3407
3679
|
return true;
|
|
3408
3680
|
}
|
|
3409
3681
|
}
|
|
@@ -3418,8 +3690,8 @@ var require_parse2 = __commonJS({
|
|
|
3418
3690
|
let paren = 0;
|
|
3419
3691
|
let quote = 0;
|
|
3420
3692
|
let escaped = false;
|
|
3421
|
-
for (let
|
|
3422
|
-
const ch = pattern[
|
|
3693
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3694
|
+
const ch = pattern[i2];
|
|
3423
3695
|
if (escaped === true) {
|
|
3424
3696
|
escaped = false;
|
|
3425
3697
|
continue;
|
|
@@ -3453,13 +3725,13 @@ var require_parse2 = __commonJS({
|
|
|
3453
3725
|
if (ch === ")") {
|
|
3454
3726
|
paren--;
|
|
3455
3727
|
if (paren === 0) {
|
|
3456
|
-
if (requireEnd === true &&
|
|
3728
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3457
3729
|
return;
|
|
3458
3730
|
}
|
|
3459
3731
|
return {
|
|
3460
3732
|
type: pattern[0],
|
|
3461
|
-
body: pattern.slice(2,
|
|
3462
|
-
end:
|
|
3733
|
+
body: pattern.slice(2, i2),
|
|
3734
|
+
end: i2
|
|
3463
3735
|
};
|
|
3464
3736
|
}
|
|
3465
3737
|
}
|
|
@@ -3591,7 +3863,7 @@ var require_parse2 = __commonJS({
|
|
|
3591
3863
|
let prev = bos;
|
|
3592
3864
|
let value;
|
|
3593
3865
|
const eos = () => state.index === len - 1;
|
|
3594
|
-
const peek = state.peek = (
|
|
3866
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3595
3867
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3596
3868
|
const remaining = () => input.slice(state.index + 1);
|
|
3597
3869
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3672,10 +3944,10 @@ var require_parse2 = __commonJS({
|
|
|
3672
3944
|
open.type = "text";
|
|
3673
3945
|
open.value = literal;
|
|
3674
3946
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3675
|
-
for (let
|
|
3676
|
-
tokens[
|
|
3677
|
-
tokens[
|
|
3678
|
-
delete tokens[
|
|
3947
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3948
|
+
tokens[i2].value = "";
|
|
3949
|
+
tokens[i2].output = "";
|
|
3950
|
+
delete tokens[i2].suffix;
|
|
3679
3951
|
}
|
|
3680
3952
|
state.output = token.output + open.output;
|
|
3681
3953
|
state.backtrack = true;
|
|
@@ -3918,13 +4190,13 @@ var require_parse2 = __commonJS({
|
|
|
3918
4190
|
if (brace.dots === true) {
|
|
3919
4191
|
const arr = tokens.slice();
|
|
3920
4192
|
const range = [];
|
|
3921
|
-
for (let
|
|
4193
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3922
4194
|
tokens.pop();
|
|
3923
|
-
if (arr[
|
|
4195
|
+
if (arr[i2].type === "brace") {
|
|
3924
4196
|
break;
|
|
3925
4197
|
}
|
|
3926
|
-
if (arr[
|
|
3927
|
-
range.unshift(arr[
|
|
4198
|
+
if (arr[i2].type !== "dots") {
|
|
4199
|
+
range.unshift(arr[i2].value);
|
|
3928
4200
|
}
|
|
3929
4201
|
}
|
|
3930
4202
|
output = expandRange(range, opts);
|
|
@@ -4383,7 +4655,7 @@ var require_picomatch = __commonJS({
|
|
|
4383
4655
|
};
|
|
4384
4656
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4385
4657
|
picomatch.parse = (pattern, options) => {
|
|
4386
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4658
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4387
4659
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4388
4660
|
};
|
|
4389
4661
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4467,8 +4739,8 @@ var require_micromatch = __commonJS({
|
|
|
4467
4739
|
options.onResult(state);
|
|
4468
4740
|
}
|
|
4469
4741
|
};
|
|
4470
|
-
for (let
|
|
4471
|
-
let isMatch = picomatch(String(patterns[
|
|
4742
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4743
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4472
4744
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4473
4745
|
if (negated) negatives++;
|
|
4474
4746
|
for (let item of list) {
|
|
@@ -4490,7 +4762,7 @@ var require_micromatch = __commonJS({
|
|
|
4490
4762
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4491
4763
|
}
|
|
4492
4764
|
if (options.nonull === true || options.nullglob === true) {
|
|
4493
|
-
return options.unescape ? patterns.map((
|
|
4765
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4494
4766
|
}
|
|
4495
4767
|
}
|
|
4496
4768
|
return matches;
|
|
@@ -4520,7 +4792,7 @@ var require_micromatch = __commonJS({
|
|
|
4520
4792
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4521
4793
|
}
|
|
4522
4794
|
if (Array.isArray(pattern)) {
|
|
4523
|
-
return pattern.some((
|
|
4795
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4524
4796
|
}
|
|
4525
4797
|
if (typeof pattern === "string") {
|
|
4526
4798
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4565,7 +4837,7 @@ var require_micromatch = __commonJS({
|
|
|
4565
4837
|
if (typeof str !== "string") {
|
|
4566
4838
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4567
4839
|
}
|
|
4568
|
-
return [].concat(patterns).every((
|
|
4840
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4569
4841
|
};
|
|
4570
4842
|
micromatch.capture = (glob2, input, options) => {
|
|
4571
4843
|
let posix = utils.isWindows(options);
|
|
@@ -4716,7 +4988,7 @@ var require_pattern = __commonJS({
|
|
|
4716
4988
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4717
4989
|
function expandBraceExpansion(pattern) {
|
|
4718
4990
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4719
|
-
patterns.sort((
|
|
4991
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4720
4992
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4721
4993
|
}
|
|
4722
4994
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4797,8 +5069,8 @@ var require_merge2 = __commonJS({
|
|
|
4797
5069
|
}
|
|
4798
5070
|
const mergedStream = PassThrough(options);
|
|
4799
5071
|
function addStream() {
|
|
4800
|
-
for (let
|
|
4801
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5072
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5073
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4802
5074
|
}
|
|
4803
5075
|
mergeStream();
|
|
4804
5076
|
return this;
|
|
@@ -4847,8 +5119,8 @@ var require_merge2 = __commonJS({
|
|
|
4847
5119
|
stream.pipe(mergedStream, { end: false });
|
|
4848
5120
|
stream.resume();
|
|
4849
5121
|
}
|
|
4850
|
-
for (let
|
|
4851
|
-
pipe(streams[
|
|
5122
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5123
|
+
pipe(streams[i2]);
|
|
4852
5124
|
}
|
|
4853
5125
|
next();
|
|
4854
5126
|
}
|
|
@@ -4879,8 +5151,8 @@ var require_merge2 = __commonJS({
|
|
|
4879
5151
|
}
|
|
4880
5152
|
streams.pause();
|
|
4881
5153
|
} else {
|
|
4882
|
-
for (let
|
|
4883
|
-
streams[
|
|
5154
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5155
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4884
5156
|
}
|
|
4885
5157
|
}
|
|
4886
5158
|
return streams;
|
|
@@ -4962,13 +5234,13 @@ var require_tasks = __commonJS({
|
|
|
4962
5234
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4963
5235
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4964
5236
|
var utils = require_utils3();
|
|
4965
|
-
function generate(input,
|
|
4966
|
-
const patterns = processPatterns(input,
|
|
4967
|
-
const ignore = processPatterns(
|
|
5237
|
+
function generate(input, settings2) {
|
|
5238
|
+
const patterns = processPatterns(input, settings2);
|
|
5239
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4968
5240
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4969
5241
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4970
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4971
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5242
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5243
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4972
5244
|
const staticTasks = convertPatternsToTasks(
|
|
4973
5245
|
staticPatterns,
|
|
4974
5246
|
negativePatterns,
|
|
@@ -4984,12 +5256,12 @@ var require_tasks = __commonJS({
|
|
|
4984
5256
|
return staticTasks.concat(dynamicTasks);
|
|
4985
5257
|
}
|
|
4986
5258
|
exports.generate = generate;
|
|
4987
|
-
function processPatterns(input,
|
|
5259
|
+
function processPatterns(input, settings2) {
|
|
4988
5260
|
let patterns = input;
|
|
4989
|
-
if (
|
|
5261
|
+
if (settings2.braceExpansion) {
|
|
4990
5262
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
4991
5263
|
}
|
|
4992
|
-
if (
|
|
5264
|
+
if (settings2.baseNameMatch) {
|
|
4993
5265
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
4994
5266
|
}
|
|
4995
5267
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -5020,7 +5292,7 @@ var require_tasks = __commonJS({
|
|
|
5020
5292
|
}
|
|
5021
5293
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
5022
5294
|
function groupPatternsByBaseDirectory(patterns) {
|
|
5023
|
-
const
|
|
5295
|
+
const group2 = {};
|
|
5024
5296
|
return patterns.reduce((collection, pattern) => {
|
|
5025
5297
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
5026
5298
|
if (base in collection) {
|
|
@@ -5029,7 +5301,7 @@ var require_tasks = __commonJS({
|
|
|
5029
5301
|
collection[base] = [pattern];
|
|
5030
5302
|
}
|
|
5031
5303
|
return collection;
|
|
5032
|
-
},
|
|
5304
|
+
}, group2);
|
|
5033
5305
|
}
|
|
5034
5306
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5035
5307
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5058,26 +5330,26 @@ var require_async = __commonJS({
|
|
|
5058
5330
|
init_utils2();
|
|
5059
5331
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5060
5332
|
exports.read = void 0;
|
|
5061
|
-
function read2(path,
|
|
5062
|
-
|
|
5333
|
+
function read2(path, settings2, callback) {
|
|
5334
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5063
5335
|
if (lstatError !== null) {
|
|
5064
5336
|
callFailureCallback(callback, lstatError);
|
|
5065
5337
|
return;
|
|
5066
5338
|
}
|
|
5067
|
-
if (!lstat.isSymbolicLink() || !
|
|
5339
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5068
5340
|
callSuccessCallback(callback, lstat);
|
|
5069
5341
|
return;
|
|
5070
5342
|
}
|
|
5071
|
-
|
|
5343
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5072
5344
|
if (statError !== null) {
|
|
5073
|
-
if (
|
|
5345
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5074
5346
|
callFailureCallback(callback, statError);
|
|
5075
5347
|
return;
|
|
5076
5348
|
}
|
|
5077
5349
|
callSuccessCallback(callback, lstat);
|
|
5078
5350
|
return;
|
|
5079
5351
|
}
|
|
5080
|
-
if (
|
|
5352
|
+
if (settings2.markSymbolicLink) {
|
|
5081
5353
|
stat.isSymbolicLink = () => true;
|
|
5082
5354
|
}
|
|
5083
5355
|
callSuccessCallback(callback, stat);
|
|
@@ -5101,19 +5373,19 @@ var require_sync = __commonJS({
|
|
|
5101
5373
|
init_utils2();
|
|
5102
5374
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5103
5375
|
exports.read = void 0;
|
|
5104
|
-
function read2(path,
|
|
5105
|
-
const lstat =
|
|
5106
|
-
if (!lstat.isSymbolicLink() || !
|
|
5376
|
+
function read2(path, settings2) {
|
|
5377
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5378
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5107
5379
|
return lstat;
|
|
5108
5380
|
}
|
|
5109
5381
|
try {
|
|
5110
|
-
const stat =
|
|
5111
|
-
if (
|
|
5382
|
+
const stat = settings2.fs.statSync(path);
|
|
5383
|
+
if (settings2.markSymbolicLink) {
|
|
5112
5384
|
stat.isSymbolicLink = () => true;
|
|
5113
5385
|
}
|
|
5114
5386
|
return stat;
|
|
5115
5387
|
} catch (error2) {
|
|
5116
|
-
if (!
|
|
5388
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5117
5389
|
return lstat;
|
|
5118
5390
|
}
|
|
5119
5391
|
throw error2;
|
|
@@ -5190,8 +5462,8 @@ var require_out = __commonJS({
|
|
|
5190
5462
|
}
|
|
5191
5463
|
exports.stat = stat;
|
|
5192
5464
|
function statSync3(path, optionsOrSettings) {
|
|
5193
|
-
const
|
|
5194
|
-
return sync.read(path,
|
|
5465
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5466
|
+
return sync.read(path, settings2);
|
|
5195
5467
|
}
|
|
5196
5468
|
exports.statSync = statSync3;
|
|
5197
5469
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5239,8 +5511,8 @@ var require_run_parallel = __commonJS({
|
|
|
5239
5511
|
if (isSync) queueMicrotask2(end);
|
|
5240
5512
|
else end();
|
|
5241
5513
|
}
|
|
5242
|
-
function each(
|
|
5243
|
-
results[
|
|
5514
|
+
function each(i2, err, result) {
|
|
5515
|
+
results[i2] = result;
|
|
5244
5516
|
if (--pending === 0 || err) {
|
|
5245
5517
|
done(err);
|
|
5246
5518
|
}
|
|
@@ -5254,9 +5526,9 @@ var require_run_parallel = __commonJS({
|
|
|
5254
5526
|
});
|
|
5255
5527
|
});
|
|
5256
5528
|
} else {
|
|
5257
|
-
tasks.forEach(function(task,
|
|
5529
|
+
tasks.forEach(function(task, i2) {
|
|
5258
5530
|
task(function(err, result) {
|
|
5259
|
-
each(
|
|
5531
|
+
each(i2, err, result);
|
|
5260
5532
|
});
|
|
5261
5533
|
});
|
|
5262
5534
|
}
|
|
@@ -5331,11 +5603,11 @@ var require_common = __commonJS({
|
|
|
5331
5603
|
init_utils2();
|
|
5332
5604
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5333
5605
|
exports.joinPathSegments = void 0;
|
|
5334
|
-
function joinPathSegments(
|
|
5335
|
-
if (
|
|
5336
|
-
return
|
|
5606
|
+
function joinPathSegments(a2, b, separator) {
|
|
5607
|
+
if (a2.endsWith(separator)) {
|
|
5608
|
+
return a2 + b;
|
|
5337
5609
|
}
|
|
5338
|
-
return
|
|
5610
|
+
return a2 + separator + b;
|
|
5339
5611
|
}
|
|
5340
5612
|
exports.joinPathSegments = joinPathSegments;
|
|
5341
5613
|
}
|
|
@@ -5353,16 +5625,16 @@ var require_async2 = __commonJS({
|
|
|
5353
5625
|
var constants_1 = require_constants3();
|
|
5354
5626
|
var utils = require_utils4();
|
|
5355
5627
|
var common = require_common();
|
|
5356
|
-
function read2(directory,
|
|
5357
|
-
if (!
|
|
5358
|
-
readdirWithFileTypes(directory,
|
|
5628
|
+
function read2(directory, settings2, callback) {
|
|
5629
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5630
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5359
5631
|
return;
|
|
5360
5632
|
}
|
|
5361
|
-
readdir2(directory,
|
|
5633
|
+
readdir2(directory, settings2, callback);
|
|
5362
5634
|
}
|
|
5363
5635
|
exports.read = read2;
|
|
5364
|
-
function readdirWithFileTypes(directory,
|
|
5365
|
-
|
|
5636
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5637
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5366
5638
|
if (readdirError !== null) {
|
|
5367
5639
|
callFailureCallback(callback, readdirError);
|
|
5368
5640
|
return;
|
|
@@ -5370,13 +5642,13 @@ var require_async2 = __commonJS({
|
|
|
5370
5642
|
const entries = dirents.map((dirent) => ({
|
|
5371
5643
|
dirent,
|
|
5372
5644
|
name: dirent.name,
|
|
5373
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5645
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5374
5646
|
}));
|
|
5375
|
-
if (!
|
|
5647
|
+
if (!settings2.followSymbolicLinks) {
|
|
5376
5648
|
callSuccessCallback(callback, entries);
|
|
5377
5649
|
return;
|
|
5378
5650
|
}
|
|
5379
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5651
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5380
5652
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5381
5653
|
if (rplError !== null) {
|
|
5382
5654
|
callFailureCallback(callback, rplError);
|
|
@@ -5387,15 +5659,15 @@ var require_async2 = __commonJS({
|
|
|
5387
5659
|
});
|
|
5388
5660
|
}
|
|
5389
5661
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5390
|
-
function makeRplTaskEntry(entry,
|
|
5662
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5391
5663
|
return (done) => {
|
|
5392
5664
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5393
5665
|
done(null, entry);
|
|
5394
5666
|
return;
|
|
5395
5667
|
}
|
|
5396
|
-
|
|
5668
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5397
5669
|
if (statError !== null) {
|
|
5398
|
-
if (
|
|
5670
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5399
5671
|
done(statError);
|
|
5400
5672
|
return;
|
|
5401
5673
|
}
|
|
@@ -5407,16 +5679,16 @@ var require_async2 = __commonJS({
|
|
|
5407
5679
|
});
|
|
5408
5680
|
};
|
|
5409
5681
|
}
|
|
5410
|
-
function readdir2(directory,
|
|
5411
|
-
|
|
5682
|
+
function readdir2(directory, settings2, callback) {
|
|
5683
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5412
5684
|
if (readdirError !== null) {
|
|
5413
5685
|
callFailureCallback(callback, readdirError);
|
|
5414
5686
|
return;
|
|
5415
5687
|
}
|
|
5416
5688
|
const tasks = names.map((name) => {
|
|
5417
|
-
const path = common.joinPathSegments(directory, name,
|
|
5689
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5418
5690
|
return (done) => {
|
|
5419
|
-
fsStat.stat(path,
|
|
5691
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5420
5692
|
if (error2 !== null) {
|
|
5421
5693
|
done(error2);
|
|
5422
5694
|
return;
|
|
@@ -5426,7 +5698,7 @@ var require_async2 = __commonJS({
|
|
|
5426
5698
|
path,
|
|
5427
5699
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5428
5700
|
};
|
|
5429
|
-
if (
|
|
5701
|
+
if (settings2.stats) {
|
|
5430
5702
|
entry.stats = stats;
|
|
5431
5703
|
}
|
|
5432
5704
|
done(null, entry);
|
|
@@ -5463,27 +5735,27 @@ var require_sync2 = __commonJS({
|
|
|
5463
5735
|
var constants_1 = require_constants3();
|
|
5464
5736
|
var utils = require_utils4();
|
|
5465
5737
|
var common = require_common();
|
|
5466
|
-
function read2(directory,
|
|
5467
|
-
if (!
|
|
5468
|
-
return readdirWithFileTypes(directory,
|
|
5738
|
+
function read2(directory, settings2) {
|
|
5739
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5740
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5469
5741
|
}
|
|
5470
|
-
return readdir2(directory,
|
|
5742
|
+
return readdir2(directory, settings2);
|
|
5471
5743
|
}
|
|
5472
5744
|
exports.read = read2;
|
|
5473
|
-
function readdirWithFileTypes(directory,
|
|
5474
|
-
const dirents =
|
|
5745
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5746
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5475
5747
|
return dirents.map((dirent) => {
|
|
5476
5748
|
const entry = {
|
|
5477
5749
|
dirent,
|
|
5478
5750
|
name: dirent.name,
|
|
5479
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5751
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5480
5752
|
};
|
|
5481
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5753
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5482
5754
|
try {
|
|
5483
|
-
const stats =
|
|
5755
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5484
5756
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5485
5757
|
} catch (error2) {
|
|
5486
|
-
if (
|
|
5758
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5487
5759
|
throw error2;
|
|
5488
5760
|
}
|
|
5489
5761
|
}
|
|
@@ -5492,17 +5764,17 @@ var require_sync2 = __commonJS({
|
|
|
5492
5764
|
});
|
|
5493
5765
|
}
|
|
5494
5766
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5495
|
-
function readdir2(directory,
|
|
5496
|
-
const names =
|
|
5767
|
+
function readdir2(directory, settings2) {
|
|
5768
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5497
5769
|
return names.map((name) => {
|
|
5498
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5499
|
-
const stats = fsStat.statSync(entryPath,
|
|
5770
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5771
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5500
5772
|
const entry = {
|
|
5501
5773
|
name,
|
|
5502
5774
|
path: entryPath,
|
|
5503
5775
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5504
5776
|
};
|
|
5505
|
-
if (
|
|
5777
|
+
if (settings2.stats) {
|
|
5506
5778
|
entry.stats = stats;
|
|
5507
5779
|
}
|
|
5508
5780
|
return entry;
|
|
@@ -5589,8 +5861,8 @@ var require_out2 = __commonJS({
|
|
|
5589
5861
|
}
|
|
5590
5862
|
exports.scandir = scandir;
|
|
5591
5863
|
function scandirSync(path, optionsOrSettings) {
|
|
5592
|
-
const
|
|
5593
|
-
return sync.read(path,
|
|
5864
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5865
|
+
return sync.read(path, settings2);
|
|
5594
5866
|
}
|
|
5595
5867
|
exports.scandirSync = scandirSync;
|
|
5596
5868
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5871,7 +6143,7 @@ var require_queue = __commonJS({
|
|
|
5871
6143
|
queue.drained = drained;
|
|
5872
6144
|
return queue;
|
|
5873
6145
|
function push(value) {
|
|
5874
|
-
var
|
|
6146
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5875
6147
|
pushCb(value, function(err, result) {
|
|
5876
6148
|
if (err) {
|
|
5877
6149
|
reject(err);
|
|
@@ -5880,11 +6152,11 @@ var require_queue = __commonJS({
|
|
|
5880
6152
|
resolve4(result);
|
|
5881
6153
|
});
|
|
5882
6154
|
});
|
|
5883
|
-
|
|
5884
|
-
return
|
|
6155
|
+
p.catch(noop);
|
|
6156
|
+
return p;
|
|
5885
6157
|
}
|
|
5886
6158
|
function unshift(value) {
|
|
5887
|
-
var
|
|
6159
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5888
6160
|
unshiftCb(value, function(err, result) {
|
|
5889
6161
|
if (err) {
|
|
5890
6162
|
reject(err);
|
|
@@ -5893,11 +6165,11 @@ var require_queue = __commonJS({
|
|
|
5893
6165
|
resolve4(result);
|
|
5894
6166
|
});
|
|
5895
6167
|
});
|
|
5896
|
-
|
|
5897
|
-
return
|
|
6168
|
+
p.catch(noop);
|
|
6169
|
+
return p;
|
|
5898
6170
|
}
|
|
5899
6171
|
function drained() {
|
|
5900
|
-
var
|
|
6172
|
+
var p = new Promise(function(resolve4) {
|
|
5901
6173
|
process.nextTick(function() {
|
|
5902
6174
|
if (queue.idle()) {
|
|
5903
6175
|
resolve4();
|
|
@@ -5911,7 +6183,7 @@ var require_queue = __commonJS({
|
|
|
5911
6183
|
}
|
|
5912
6184
|
});
|
|
5913
6185
|
});
|
|
5914
|
-
return
|
|
6186
|
+
return p;
|
|
5915
6187
|
}
|
|
5916
6188
|
}
|
|
5917
6189
|
module.exports = fastqueue;
|
|
@@ -5926,11 +6198,11 @@ var require_common2 = __commonJS({
|
|
|
5926
6198
|
init_utils2();
|
|
5927
6199
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5928
6200
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5929
|
-
function isFatalError(
|
|
5930
|
-
if (
|
|
6201
|
+
function isFatalError(settings2, error2) {
|
|
6202
|
+
if (settings2.errorFilter === null) {
|
|
5931
6203
|
return true;
|
|
5932
6204
|
}
|
|
5933
|
-
return !
|
|
6205
|
+
return !settings2.errorFilter(error2);
|
|
5934
6206
|
}
|
|
5935
6207
|
exports.isFatalError = isFatalError;
|
|
5936
6208
|
function isAppliedFilter(filter, value) {
|
|
@@ -5941,14 +6213,14 @@ var require_common2 = __commonJS({
|
|
|
5941
6213
|
return filepath.split(/[/\\]/).join(separator);
|
|
5942
6214
|
}
|
|
5943
6215
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5944
|
-
function joinPathSegments(
|
|
5945
|
-
if (
|
|
6216
|
+
function joinPathSegments(a2, b, separator) {
|
|
6217
|
+
if (a2 === "") {
|
|
5946
6218
|
return b;
|
|
5947
6219
|
}
|
|
5948
|
-
if (
|
|
5949
|
-
return
|
|
6220
|
+
if (a2.endsWith(separator)) {
|
|
6221
|
+
return a2 + b;
|
|
5950
6222
|
}
|
|
5951
|
-
return
|
|
6223
|
+
return a2 + separator + b;
|
|
5952
6224
|
}
|
|
5953
6225
|
exports.joinPathSegments = joinPathSegments;
|
|
5954
6226
|
}
|
|
@@ -6295,14 +6567,14 @@ var require_out3 = __commonJS({
|
|
|
6295
6567
|
}
|
|
6296
6568
|
exports.walk = walk;
|
|
6297
6569
|
function walkSync(directory, optionsOrSettings) {
|
|
6298
|
-
const
|
|
6299
|
-
const provider = new sync_1.default(directory,
|
|
6570
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6571
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6300
6572
|
return provider.read();
|
|
6301
6573
|
}
|
|
6302
6574
|
exports.walkSync = walkSync;
|
|
6303
6575
|
function walkStream(directory, optionsOrSettings) {
|
|
6304
|
-
const
|
|
6305
|
-
const provider = new stream_1.default(directory,
|
|
6576
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6577
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6306
6578
|
return provider.read();
|
|
6307
6579
|
}
|
|
6308
6580
|
exports.walkStream = walkStream;
|
|
@@ -6388,8 +6660,8 @@ var require_stream3 = __commonJS({
|
|
|
6388
6660
|
done();
|
|
6389
6661
|
}).catch(done);
|
|
6390
6662
|
};
|
|
6391
|
-
for (let
|
|
6392
|
-
stream.write(
|
|
6663
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6664
|
+
stream.write(i2);
|
|
6393
6665
|
}
|
|
6394
6666
|
return stream;
|
|
6395
6667
|
}
|
|
@@ -7050,14 +7322,14 @@ var require_out4 = __commonJS({
|
|
|
7050
7322
|
function generateTasks(source, options) {
|
|
7051
7323
|
assertPatternsInput(source);
|
|
7052
7324
|
const patterns = [].concat(source);
|
|
7053
|
-
const
|
|
7054
|
-
return taskManager.generate(patterns,
|
|
7325
|
+
const settings2 = new settings_1.default(options);
|
|
7326
|
+
return taskManager.generate(patterns, settings2);
|
|
7055
7327
|
}
|
|
7056
7328
|
FastGlob2.generateTasks = generateTasks;
|
|
7057
7329
|
function isDynamicPattern(source, options) {
|
|
7058
7330
|
assertPatternsInput(source);
|
|
7059
|
-
const
|
|
7060
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7331
|
+
const settings2 = new settings_1.default(options);
|
|
7332
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7061
7333
|
}
|
|
7062
7334
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7063
7335
|
function escapePath(source) {
|
|
@@ -7099,9 +7371,9 @@ var require_out4 = __commonJS({
|
|
|
7099
7371
|
})(FastGlob || (FastGlob = {}));
|
|
7100
7372
|
function getWorks(source, _Provider, options) {
|
|
7101
7373
|
const patterns = [].concat(source);
|
|
7102
|
-
const
|
|
7103
|
-
const tasks = taskManager.generate(patterns,
|
|
7104
|
-
const provider = new _Provider(
|
|
7374
|
+
const settings2 = new settings_1.default(options);
|
|
7375
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7376
|
+
const provider = new _Provider(settings2);
|
|
7105
7377
|
return tasks.map(provider.read, provider);
|
|
7106
7378
|
}
|
|
7107
7379
|
function assertPatternsInput(input) {
|
|
@@ -7279,8 +7551,8 @@ import "node:fs";
|
|
|
7279
7551
|
import { createRequire } from "node:module";
|
|
7280
7552
|
import {
|
|
7281
7553
|
resolve,
|
|
7282
|
-
join,
|
|
7283
|
-
dirname,
|
|
7554
|
+
join as join2,
|
|
7555
|
+
dirname as dirname2,
|
|
7284
7556
|
relative,
|
|
7285
7557
|
normalize,
|
|
7286
7558
|
sep,
|
|
@@ -7294,7 +7566,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7294
7566
|
);
|
|
7295
7567
|
});
|
|
7296
7568
|
}
|
|
7297
|
-
var import_fast_glob, constants,
|
|
7569
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7298
7570
|
var init_PathResolver = __esm({
|
|
7299
7571
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7300
7572
|
"use strict";
|
|
@@ -7307,7 +7579,7 @@ var init_PathResolver = __esm({
|
|
|
7307
7579
|
getPatternsFor: getPatternsFor || void 0,
|
|
7308
7580
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7309
7581
|
};
|
|
7310
|
-
|
|
7582
|
+
log3 = {
|
|
7311
7583
|
error: (message, error2) => {
|
|
7312
7584
|
},
|
|
7313
7585
|
warn: (message, error2) => {
|
|
@@ -7428,7 +7700,7 @@ var init_PathResolver = __esm({
|
|
|
7428
7700
|
*/
|
|
7429
7701
|
getDirname(path) {
|
|
7430
7702
|
if (!path) return "";
|
|
7431
|
-
return this.normalizePath(
|
|
7703
|
+
return this.normalizePath(dirname2(path));
|
|
7432
7704
|
}
|
|
7433
7705
|
/**
|
|
7434
7706
|
* Resolve package path using Node's module resolution
|
|
@@ -7440,7 +7712,7 @@ var init_PathResolver = __esm({
|
|
|
7440
7712
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7441
7713
|
try {
|
|
7442
7714
|
const basePath = fromPath || this.getAppRoot();
|
|
7443
|
-
const require3 = createRequire(
|
|
7715
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7444
7716
|
const resolved = require3.resolve(packageSpecifier);
|
|
7445
7717
|
return this.normalizePath(resolved);
|
|
7446
7718
|
} catch (error2) {
|
|
@@ -7592,7 +7864,7 @@ var init_PathResolver = __esm({
|
|
|
7592
7864
|
return cleanContent;
|
|
7593
7865
|
} catch (error2) {
|
|
7594
7866
|
if (this.options.debug) {
|
|
7595
|
-
|
|
7867
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7596
7868
|
}
|
|
7597
7869
|
return null;
|
|
7598
7870
|
}
|
|
@@ -7620,7 +7892,7 @@ var init_PathResolver = __esm({
|
|
|
7620
7892
|
return cleanContent;
|
|
7621
7893
|
} catch (error2) {
|
|
7622
7894
|
if (this.options.debug) {
|
|
7623
|
-
|
|
7895
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7624
7896
|
}
|
|
7625
7897
|
return null;
|
|
7626
7898
|
}
|
|
@@ -7642,16 +7914,16 @@ var init_PathResolver = __esm({
|
|
|
7642
7914
|
verbose = false
|
|
7643
7915
|
} = options;
|
|
7644
7916
|
const normalizedPath = this.normalizePath(filePath);
|
|
7645
|
-
const dir = this.normalizePath(
|
|
7917
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7646
7918
|
const fileExists = this.pathExists(normalizedPath);
|
|
7647
7919
|
if (fileExists && !overwrite) {
|
|
7648
7920
|
if (verbose) {
|
|
7649
|
-
|
|
7921
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7650
7922
|
}
|
|
7651
7923
|
return false;
|
|
7652
7924
|
}
|
|
7653
7925
|
if (dryRun) {
|
|
7654
|
-
|
|
7926
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7655
7927
|
return true;
|
|
7656
7928
|
}
|
|
7657
7929
|
try {
|
|
@@ -7676,7 +7948,7 @@ var init_PathResolver = __esm({
|
|
|
7676
7948
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7677
7949
|
}
|
|
7678
7950
|
if (verbose) {
|
|
7679
|
-
|
|
7951
|
+
log3.info(
|
|
7680
7952
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7681
7953
|
);
|
|
7682
7954
|
}
|
|
@@ -7703,16 +7975,16 @@ var init_PathResolver = __esm({
|
|
|
7703
7975
|
verbose = false
|
|
7704
7976
|
} = options;
|
|
7705
7977
|
const normalizedPath = this.normalizePath(filePath);
|
|
7706
|
-
const dir = this.normalizePath(
|
|
7978
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7707
7979
|
const fileExists = this.pathExists(normalizedPath);
|
|
7708
7980
|
if (fileExists && !overwrite) {
|
|
7709
7981
|
if (verbose) {
|
|
7710
|
-
|
|
7982
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7711
7983
|
}
|
|
7712
7984
|
return false;
|
|
7713
7985
|
}
|
|
7714
7986
|
if (dryRun) {
|
|
7715
|
-
|
|
7987
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7716
7988
|
return true;
|
|
7717
7989
|
}
|
|
7718
7990
|
try {
|
|
@@ -7736,7 +8008,7 @@ var init_PathResolver = __esm({
|
|
|
7736
8008
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7737
8009
|
}
|
|
7738
8010
|
if (verbose) {
|
|
7739
|
-
|
|
8011
|
+
log3.info(
|
|
7740
8012
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7741
8013
|
);
|
|
7742
8014
|
}
|
|
@@ -7761,15 +8033,15 @@ var init_PathResolver = __esm({
|
|
|
7761
8033
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7762
8034
|
if (fileExists && !overwrite) {
|
|
7763
8035
|
if (verbose) {
|
|
7764
|
-
|
|
8036
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7765
8037
|
}
|
|
7766
8038
|
return false;
|
|
7767
8039
|
}
|
|
7768
8040
|
if (dryRun) {
|
|
7769
|
-
|
|
8041
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7770
8042
|
return true;
|
|
7771
8043
|
}
|
|
7772
|
-
const dir = this.normalizePath(
|
|
8044
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7773
8045
|
try {
|
|
7774
8046
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7775
8047
|
} catch (error2) {
|
|
@@ -7779,7 +8051,7 @@ var init_PathResolver = __esm({
|
|
|
7779
8051
|
return await safeExecuteAsync(async () => {
|
|
7780
8052
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7781
8053
|
if (verbose) {
|
|
7782
|
-
|
|
8054
|
+
log3.info(
|
|
7783
8055
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7784
8056
|
);
|
|
7785
8057
|
}
|
|
@@ -7803,15 +8075,15 @@ var init_PathResolver = __esm({
|
|
|
7803
8075
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7804
8076
|
if (fileExists && !overwrite) {
|
|
7805
8077
|
if (verbose) {
|
|
7806
|
-
|
|
8078
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7807
8079
|
}
|
|
7808
8080
|
return false;
|
|
7809
8081
|
}
|
|
7810
8082
|
if (dryRun) {
|
|
7811
|
-
|
|
8083
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7812
8084
|
return true;
|
|
7813
8085
|
}
|
|
7814
|
-
const dir = this.normalizePath(
|
|
8086
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7815
8087
|
try {
|
|
7816
8088
|
fs.mkdirSync(dir, { recursive: true });
|
|
7817
8089
|
} catch (error2) {
|
|
@@ -7820,7 +8092,7 @@ var init_PathResolver = __esm({
|
|
|
7820
8092
|
try {
|
|
7821
8093
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
7822
8094
|
if (verbose) {
|
|
7823
|
-
|
|
8095
|
+
log3.info(
|
|
7824
8096
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7825
8097
|
);
|
|
7826
8098
|
}
|
|
@@ -7837,7 +8109,7 @@ var init_PathResolver = __esm({
|
|
|
7837
8109
|
return fs.existsSync(filePath);
|
|
7838
8110
|
} catch (error2) {
|
|
7839
8111
|
if (!silent) {
|
|
7840
|
-
|
|
8112
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7841
8113
|
}
|
|
7842
8114
|
return false;
|
|
7843
8115
|
}
|
|
@@ -7863,7 +8135,7 @@ var init_PathResolver = __esm({
|
|
|
7863
8135
|
return fs.readdirSync(dirPath, options);
|
|
7864
8136
|
} catch (error2) {
|
|
7865
8137
|
if (this.options.debug) {
|
|
7866
|
-
|
|
8138
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7867
8139
|
}
|
|
7868
8140
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7869
8141
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7881,7 +8153,7 @@ var init_PathResolver = __esm({
|
|
|
7881
8153
|
return fs.statSync(filePath);
|
|
7882
8154
|
} catch (error2) {
|
|
7883
8155
|
if (this.options.debug) {
|
|
7884
|
-
|
|
8156
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7885
8157
|
}
|
|
7886
8158
|
return null;
|
|
7887
8159
|
}
|
|
@@ -7898,7 +8170,7 @@ var init_PathResolver = __esm({
|
|
|
7898
8170
|
return fs.lstatSync(filePath);
|
|
7899
8171
|
} catch (error2) {
|
|
7900
8172
|
if (this.options.debug) {
|
|
7901
|
-
|
|
8173
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7902
8174
|
}
|
|
7903
8175
|
return null;
|
|
7904
8176
|
}
|
|
@@ -7987,7 +8259,7 @@ var init_PathResolver = __esm({
|
|
|
7987
8259
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
7988
8260
|
*/
|
|
7989
8261
|
isMonorepo() {
|
|
7990
|
-
const packagesDir =
|
|
8262
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
7991
8263
|
return this.pathExists(packagesDir);
|
|
7992
8264
|
}
|
|
7993
8265
|
/**
|
|
@@ -8004,7 +8276,7 @@ var init_PathResolver = __esm({
|
|
|
8004
8276
|
* Find files matching pattern within directory
|
|
8005
8277
|
*/
|
|
8006
8278
|
async findFiles(directory, pattern, options = {}) {
|
|
8007
|
-
const searchPattern = this.normalizePath(
|
|
8279
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
8008
8280
|
const appRoot = this.getAppRoot();
|
|
8009
8281
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
8010
8282
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8051,7 +8323,7 @@ var init_PathResolver = __esm({
|
|
|
8051
8323
|
return null;
|
|
8052
8324
|
}
|
|
8053
8325
|
const resolvedPath = this.normalizePath(
|
|
8054
|
-
|
|
8326
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8055
8327
|
);
|
|
8056
8328
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8057
8329
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8247,13 +8519,13 @@ var init_PathResolver = __esm({
|
|
|
8247
8519
|
const maxLevels = this.options.maxLevels;
|
|
8248
8520
|
while (levelsChecked < maxLevels) {
|
|
8249
8521
|
const toolingPath = this.normalizePath(
|
|
8250
|
-
|
|
8522
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8251
8523
|
);
|
|
8252
|
-
const corePath = this.normalizePath(
|
|
8524
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8253
8525
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8254
8526
|
return currentDir;
|
|
8255
8527
|
}
|
|
8256
|
-
const appsDir =
|
|
8528
|
+
const appsDir = join2(currentDir, "apps");
|
|
8257
8529
|
if (this.pathExists(appsDir)) {
|
|
8258
8530
|
const appsDirStat = this.statSync(appsDir);
|
|
8259
8531
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8261,15 +8533,15 @@ var init_PathResolver = __esm({
|
|
|
8261
8533
|
}
|
|
8262
8534
|
}
|
|
8263
8535
|
const packageJsonPath = this.normalizePath(
|
|
8264
|
-
|
|
8536
|
+
join2(currentDir, "package.json")
|
|
8265
8537
|
);
|
|
8266
8538
|
if (this.pathExists(packageJsonPath)) {
|
|
8267
|
-
const parentDir2 = this.normalizePath(
|
|
8539
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8268
8540
|
if (parentDir2 === currentDir) {
|
|
8269
8541
|
return currentDir;
|
|
8270
8542
|
}
|
|
8271
8543
|
}
|
|
8272
|
-
const parentDir = this.normalizePath(
|
|
8544
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8273
8545
|
if (parentDir === currentDir) {
|
|
8274
8546
|
break;
|
|
8275
8547
|
}
|
|
@@ -8320,7 +8592,7 @@ __export(pathResolver_exports, {
|
|
|
8320
8592
|
isWithinApp: () => isWithinApp,
|
|
8321
8593
|
isWithinRepoRoot: () => isWithinRepoRoot,
|
|
8322
8594
|
joinPath: () => joinPath,
|
|
8323
|
-
lstatSync: () =>
|
|
8595
|
+
lstatSync: () => lstatSync3,
|
|
8324
8596
|
normalizePath: () => normalizePath,
|
|
8325
8597
|
openFile: () => openFile,
|
|
8326
8598
|
pathExists: () => pathExists,
|
|
@@ -8328,7 +8600,7 @@ __export(pathResolver_exports, {
|
|
|
8328
8600
|
read: () => read,
|
|
8329
8601
|
readSync: () => readSync,
|
|
8330
8602
|
readdir: () => readdir,
|
|
8331
|
-
readdirSync: () =>
|
|
8603
|
+
readdirSync: () => readdirSync3,
|
|
8332
8604
|
remove: () => remove,
|
|
8333
8605
|
removeSync: () => removeSync,
|
|
8334
8606
|
resolveAppPath: () => resolveAppPath,
|
|
@@ -8345,8 +8617,8 @@ __export(pathResolver_exports, {
|
|
|
8345
8617
|
});
|
|
8346
8618
|
import { createRequire as createRequire2 } from "node:module";
|
|
8347
8619
|
import {
|
|
8348
|
-
join as
|
|
8349
|
-
dirname as
|
|
8620
|
+
join as join3,
|
|
8621
|
+
dirname as dirname3,
|
|
8350
8622
|
basename as basename2,
|
|
8351
8623
|
extname as extname2,
|
|
8352
8624
|
relative as relative2,
|
|
@@ -8355,11 +8627,11 @@ import {
|
|
|
8355
8627
|
isAbsolute as pathIsAbsolute
|
|
8356
8628
|
} from "node:path";
|
|
8357
8629
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8358
|
-
function
|
|
8630
|
+
function readdirSync3(dirPath, options) {
|
|
8359
8631
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8360
8632
|
}
|
|
8361
8633
|
function getDirnameFromUrl(importMetaUrl) {
|
|
8362
|
-
return
|
|
8634
|
+
return dirname3(fileURLToPath2(importMetaUrl));
|
|
8363
8635
|
}
|
|
8364
8636
|
function findNodeModulesDir(startDir) {
|
|
8365
8637
|
let currentDir = normalizePath(startDir);
|
|
@@ -8422,7 +8694,7 @@ function getTemplatesRoot() {
|
|
|
8422
8694
|
const mode = detectExecutionMode();
|
|
8423
8695
|
if (mode === "development") {
|
|
8424
8696
|
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
8425
|
-
const frameworkRoot = normalizePath(
|
|
8697
|
+
const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
|
|
8426
8698
|
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8427
8699
|
} else {
|
|
8428
8700
|
try {
|
|
@@ -8438,7 +8710,7 @@ function getTemplatesRoot() {
|
|
|
8438
8710
|
try {
|
|
8439
8711
|
const req = createRequire2(import.meta.url);
|
|
8440
8712
|
const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
|
|
8441
|
-
const cliRoot2 = normalizePath(
|
|
8713
|
+
const cliRoot2 = normalizePath(dirname3(cliPackageJsonPath));
|
|
8442
8714
|
const templatesPath = normalizePath(cliRoot2, "templates");
|
|
8443
8715
|
if (pathExists(templatesPath)) {
|
|
8444
8716
|
return templatesPath;
|
|
@@ -8497,13 +8769,13 @@ async function isBinaryFile(filePath) {
|
|
|
8497
8769
|
if (bytesRead === 0) {
|
|
8498
8770
|
return false;
|
|
8499
8771
|
}
|
|
8500
|
-
for (let
|
|
8501
|
-
if (buffer[
|
|
8772
|
+
for (let i2 = 0; i2 < bytesRead; i2++) {
|
|
8773
|
+
if (buffer[i2] === 0) {
|
|
8502
8774
|
return true;
|
|
8503
8775
|
}
|
|
8504
8776
|
}
|
|
8505
|
-
for (let
|
|
8506
|
-
const byte = buffer[
|
|
8777
|
+
for (let i2 = 0; i2 < bytesRead; i2++) {
|
|
8778
|
+
const byte = buffer[i2];
|
|
8507
8779
|
if (byte && (byte < 9 || byte > 13 && byte < 32 && byte !== 27)) {
|
|
8508
8780
|
return true;
|
|
8509
8781
|
}
|
|
@@ -8515,8 +8787,8 @@ async function isBinaryFile(filePath) {
|
|
|
8515
8787
|
}
|
|
8516
8788
|
}
|
|
8517
8789
|
} catch (err) {
|
|
8518
|
-
const { log:
|
|
8519
|
-
|
|
8790
|
+
const { log: log4 } = await Promise.resolve().then(() => (init_cli_output(), cli_output_exports));
|
|
8791
|
+
log4.warn(`Error checking if file is binary: ${filePath}`, err);
|
|
8520
8792
|
return true;
|
|
8521
8793
|
}
|
|
8522
8794
|
}
|
|
@@ -8524,8 +8796,8 @@ async function glob(pattern, options = {}) {
|
|
|
8524
8796
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8525
8797
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8526
8798
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8527
|
-
const relativePatterns = patterns.map((
|
|
8528
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
8799
|
+
const relativePatterns = patterns.map((p) => {
|
|
8800
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8529
8801
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8530
8802
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8531
8803
|
}
|
|
@@ -8551,8 +8823,8 @@ function globSync(pattern, options = {}) {
|
|
|
8551
8823
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
8552
8824
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
8553
8825
|
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
8554
|
-
const relativePatterns = patterns.map((
|
|
8555
|
-
const normalizedPattern = pathResolverInstance.normalizePath(
|
|
8826
|
+
const relativePatterns = patterns.map((p) => {
|
|
8827
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p);
|
|
8556
8828
|
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
8557
8829
|
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
8558
8830
|
}
|
|
@@ -8576,7 +8848,7 @@ function globSync(pattern, options = {}) {
|
|
|
8576
8848
|
globstar: true,
|
|
8577
8849
|
throwErrorOnBrokenSymbolicLink: options.throwErrorOnBrokenSymbolicLink
|
|
8578
8850
|
});
|
|
8579
|
-
return results.map((
|
|
8851
|
+
return results.map((p) => pathResolverInstance.normalizePath(p));
|
|
8580
8852
|
}
|
|
8581
8853
|
async function pathExistsAsync(filePath) {
|
|
8582
8854
|
try {
|
|
@@ -8595,7 +8867,7 @@ async function openFile(filePath, flags) {
|
|
|
8595
8867
|
function stripBom(content) {
|
|
8596
8868
|
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
8597
8869
|
}
|
|
8598
|
-
var pathResolverInstance, getPathResolver, getRepoRoot, getAppRoot, setAppRoot, resolvePackage, resolveFrameworkPackage, resolvePackageAsset, resolveAppPath, resolveRepoPath, resolvePath, normalizePath, getRelativePath, createImportPath, getFileInfo, pathExists, read, readSync, write, writeSync, copy, copySync, remove, removeSync, statSync2,
|
|
8870
|
+
var pathResolverInstance, getPathResolver, getRepoRoot, getAppRoot, setAppRoot, resolvePackage, resolveFrameworkPackage, resolvePackageAsset, resolveAppPath, resolveRepoPath, resolvePath, normalizePath, getRelativePath, createImportPath, getFileInfo, pathExists, read, readSync, write, writeSync, copy, copySync, remove, removeSync, statSync2, lstatSync3, ensureDir, ensureDirSync, readdir, isWithinApp, findFiles, clearPathCache, fromAppRoot, getRelativePathBetween, getDirname, getBasename, getExtname, getDirnameFromPath, isAbsolute, joinPath, isWithinRepoRoot;
|
|
8599
8871
|
var init_pathResolver = __esm({
|
|
8600
8872
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
8601
8873
|
"use strict";
|
|
@@ -8613,7 +8885,7 @@ var init_pathResolver = __esm({
|
|
|
8613
8885
|
resolveRepoPath = (relativePath) => pathResolverInstance.resolveRepoPath(relativePath);
|
|
8614
8886
|
resolvePath = (relativePath, baseDir) => pathResolverInstance.resolvePath(relativePath, baseDir);
|
|
8615
8887
|
normalizePath = (...pathSegments) => {
|
|
8616
|
-
return pathResolverInstance.normalizePath(
|
|
8888
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8617
8889
|
};
|
|
8618
8890
|
getRelativePath = (absolutePath) => pathResolverInstance.getRelativePath(absolutePath);
|
|
8619
8891
|
createImportPath = (absolutePath) => pathResolverInstance.createImportPath(absolutePath);
|
|
@@ -8628,7 +8900,7 @@ var init_pathResolver = __esm({
|
|
|
8628
8900
|
remove = async (path) => pathResolverInstance.remove(path);
|
|
8629
8901
|
removeSync = (path) => pathResolverInstance.removeSync(path);
|
|
8630
8902
|
statSync2 = (filePath) => pathResolverInstance.statSync(filePath);
|
|
8631
|
-
|
|
8903
|
+
lstatSync3 = (filePath) => pathResolverInstance.lstatSync(filePath);
|
|
8632
8904
|
ensureDir = async (dirPath) => pathResolverInstance.ensureDir(dirPath);
|
|
8633
8905
|
ensureDirSync = (dirPath) => pathResolverInstance.ensureDirSync(dirPath);
|
|
8634
8906
|
readdir = async (dirPath, options) => pathResolverInstance.readdir(dirPath, options);
|
|
@@ -8636,13 +8908,13 @@ var init_pathResolver = __esm({
|
|
|
8636
8908
|
findFiles = async (directory, pattern, options = {}) => pathResolverInstance.findFiles(directory, pattern, options);
|
|
8637
8909
|
clearPathCache = () => pathResolverInstance.clearCache();
|
|
8638
8910
|
fromAppRoot = (...pathSegments) => {
|
|
8639
|
-
return pathResolverInstance.resolveAppPath(
|
|
8911
|
+
return pathResolverInstance.resolveAppPath(join3(...pathSegments));
|
|
8640
8912
|
};
|
|
8641
8913
|
getRelativePathBetween = (from, to) => {
|
|
8642
8914
|
return normalizePath(relative2(from, to));
|
|
8643
8915
|
};
|
|
8644
8916
|
getDirname = (filePath) => {
|
|
8645
|
-
return normalizePath(
|
|
8917
|
+
return normalizePath(dirname3(filePath));
|
|
8646
8918
|
};
|
|
8647
8919
|
getBasename = (filePath, ext) => {
|
|
8648
8920
|
return basename2(filePath, ext);
|
|
@@ -8651,7 +8923,7 @@ var init_pathResolver = __esm({
|
|
|
8651
8923
|
return extname2(filePath);
|
|
8652
8924
|
};
|
|
8653
8925
|
getDirnameFromPath = (filePath) => {
|
|
8654
|
-
return pathResolverInstance.normalizePath(
|
|
8926
|
+
return pathResolverInstance.normalizePath(dirname3(filePath));
|
|
8655
8927
|
};
|
|
8656
8928
|
isAbsolute = (filePath) => {
|
|
8657
8929
|
return pathIsAbsolute(filePath);
|
|
@@ -8678,7 +8950,7 @@ var init_pathResolver = __esm({
|
|
|
8678
8950
|
import { Buffer } from "node:buffer";
|
|
8679
8951
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8680
8952
|
import { createRequire as createRequire3 } from "node:module";
|
|
8681
|
-
import { dirname as
|
|
8953
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8682
8954
|
import process from "node:process";
|
|
8683
8955
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8684
8956
|
var require2, __filename, __dirname;
|
|
@@ -8687,7 +8959,7 @@ var init_utils2 = __esm({
|
|
|
8687
8959
|
"use strict";
|
|
8688
8960
|
require2 = createRequire3(import.meta.url);
|
|
8689
8961
|
__filename = fileURLToPath3(import.meta.url);
|
|
8690
|
-
__dirname =
|
|
8962
|
+
__dirname = dirname4(__filename);
|
|
8691
8963
|
if (typeof globalThis !== "undefined") {
|
|
8692
8964
|
globalThis.require = require2;
|
|
8693
8965
|
globalThis.__filename = __filename;
|
|
@@ -8703,24 +8975,24 @@ var init_utils2 = __esm({
|
|
|
8703
8975
|
|
|
8704
8976
|
// packages/tooling/src/utils/cli-input.ts
|
|
8705
8977
|
async function askForInput(message, defaultValue = "") {
|
|
8706
|
-
const result = await
|
|
8978
|
+
const result = await text({
|
|
8707
8979
|
message,
|
|
8708
8980
|
placeholder: defaultValue || void 0,
|
|
8709
8981
|
defaultValue: defaultValue || void 0
|
|
8710
8982
|
});
|
|
8711
|
-
if (
|
|
8712
|
-
|
|
8983
|
+
if (isCancel(result)) {
|
|
8984
|
+
cancel("Operation cancelled.");
|
|
8713
8985
|
process.exit(0);
|
|
8714
8986
|
}
|
|
8715
8987
|
return result;
|
|
8716
8988
|
}
|
|
8717
8989
|
async function askForConfirmation(message, defaultValue = false) {
|
|
8718
|
-
const result = await
|
|
8990
|
+
const result = await confirm({
|
|
8719
8991
|
message,
|
|
8720
8992
|
initialValue: defaultValue
|
|
8721
8993
|
});
|
|
8722
|
-
if (
|
|
8723
|
-
|
|
8994
|
+
if (isCancel(result)) {
|
|
8995
|
+
cancel("Operation cancelled.");
|
|
8724
8996
|
process.exit(0);
|
|
8725
8997
|
}
|
|
8726
8998
|
return result;
|
|
@@ -8731,13 +9003,13 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8731
9003
|
label: choice.title,
|
|
8732
9004
|
hint: choice.hint
|
|
8733
9005
|
}));
|
|
8734
|
-
const result = await
|
|
9006
|
+
const result = await select({
|
|
8735
9007
|
message,
|
|
8736
9008
|
options,
|
|
8737
9009
|
initialValue: choices[defaultValue]?.value
|
|
8738
9010
|
});
|
|
8739
|
-
if (
|
|
8740
|
-
|
|
9011
|
+
if (isCancel(result)) {
|
|
9012
|
+
cancel("Operation cancelled.");
|
|
8741
9013
|
process.exit(0);
|
|
8742
9014
|
}
|
|
8743
9015
|
return result;
|
|
@@ -8811,8 +9083,8 @@ async function isTextFile(filePath) {
|
|
|
8811
9083
|
try {
|
|
8812
9084
|
const buffer = await read(filePath, { format: "buffer" });
|
|
8813
9085
|
if (buffer.length === 0) return true;
|
|
8814
|
-
for (let
|
|
8815
|
-
if (buffer[
|
|
9086
|
+
for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
|
|
9087
|
+
if (buffer[i2] === 0) return false;
|
|
8816
9088
|
}
|
|
8817
9089
|
return true;
|
|
8818
9090
|
} catch {
|
|
@@ -8837,7 +9109,7 @@ async function replacePlaceholders(filePath, replacements) {
|
|
|
8837
9109
|
}
|
|
8838
9110
|
await write(filePath, content, { overwrite: true });
|
|
8839
9111
|
} catch (error2) {
|
|
8840
|
-
|
|
9112
|
+
log2.warn(
|
|
8841
9113
|
`Warning: Could not process file ${filePath}: ${error2.message || "Unknown error"}`
|
|
8842
9114
|
);
|
|
8843
9115
|
}
|
|
@@ -8891,14 +9163,14 @@ function isReservedAppName(name) {
|
|
|
8891
9163
|
async function updateRootPackageJson(rootDir, appNames) {
|
|
8892
9164
|
const packageJsonPath = joinPath(rootDir, "package.json");
|
|
8893
9165
|
if (!pathExists(packageJsonPath)) {
|
|
8894
|
-
|
|
9166
|
+
log2.warn("Root package.json not found, skipping script updates");
|
|
8895
9167
|
return;
|
|
8896
9168
|
}
|
|
8897
9169
|
try {
|
|
8898
9170
|
const packageJson = await read(packageJsonPath, { format: "json" });
|
|
8899
9171
|
packageJson.scripts = packageJson.scripts || {};
|
|
8900
9172
|
} catch (error2) {
|
|
8901
|
-
|
|
9173
|
+
log2.warn(
|
|
8902
9174
|
`Warning: Could not update root package.json: ${error2.message || "Unknown error"}`
|
|
8903
9175
|
);
|
|
8904
9176
|
}
|
|
@@ -8968,16 +9240,16 @@ function loadMatrix(mode) {
|
|
|
8968
9240
|
return cachedMatrix;
|
|
8969
9241
|
}
|
|
8970
9242
|
function resolveGroup(groupName, matrix) {
|
|
8971
|
-
const
|
|
8972
|
-
if (!
|
|
9243
|
+
const group2 = matrix.groups[groupName];
|
|
9244
|
+
if (!group2) return {};
|
|
8973
9245
|
const result = {};
|
|
8974
|
-
if (
|
|
8975
|
-
for (const included of
|
|
9246
|
+
if (group2.includes) {
|
|
9247
|
+
for (const included of group2.includes) {
|
|
8976
9248
|
Object.assign(result, resolveGroup(included, matrix));
|
|
8977
9249
|
}
|
|
8978
9250
|
}
|
|
8979
|
-
if (
|
|
8980
|
-
Object.assign(result,
|
|
9251
|
+
if (group2.packages) {
|
|
9252
|
+
Object.assign(result, group2.packages);
|
|
8981
9253
|
}
|
|
8982
9254
|
return result;
|
|
8983
9255
|
}
|
|
@@ -9339,9 +9611,9 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9339
9611
|
}
|
|
9340
9612
|
if (mode === "published") {
|
|
9341
9613
|
const overrides = {};
|
|
9342
|
-
for (const [groupName,
|
|
9614
|
+
for (const [groupName, group2] of Object.entries(matrix.groups || {})) {
|
|
9343
9615
|
if (groupName.startsWith("@donotdev/")) {
|
|
9344
|
-
const version =
|
|
9616
|
+
const version = group2.packages?.[groupName];
|
|
9345
9617
|
if (version) {
|
|
9346
9618
|
overrides[groupName] = version.replace(/^\^/, "");
|
|
9347
9619
|
}
|
|
@@ -9373,7 +9645,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9373
9645
|
workspaceRoot = workspaceRoot || currentDir;
|
|
9374
9646
|
}
|
|
9375
9647
|
templatesRoot = templatesRoot || getTemplatesRoot();
|
|
9376
|
-
|
|
9648
|
+
intro("\u{1F680} DoNotDev App Creator");
|
|
9377
9649
|
if (!appName) {
|
|
9378
9650
|
appName = await askForInput(
|
|
9379
9651
|
`App name - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
|
|
@@ -9435,18 +9707,18 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9435
9707
|
1
|
|
9436
9708
|
);
|
|
9437
9709
|
if (action === "skip") {
|
|
9438
|
-
|
|
9710
|
+
log2.info(`\u23ED\uFE0F Skipping app: ${appName}`);
|
|
9439
9711
|
return;
|
|
9440
9712
|
}
|
|
9441
9713
|
if (action === "replace") {
|
|
9442
9714
|
await remove(appDir);
|
|
9443
9715
|
}
|
|
9444
9716
|
} else {
|
|
9445
|
-
|
|
9717
|
+
log2.info(`\u23ED\uFE0F App "${appName}" already exists, skipping.`);
|
|
9446
9718
|
return;
|
|
9447
9719
|
}
|
|
9448
9720
|
}
|
|
9449
|
-
const s =
|
|
9721
|
+
const s = spinner();
|
|
9450
9722
|
s.start(`Creating app: ${appName}`);
|
|
9451
9723
|
await ensureDir(appDir);
|
|
9452
9724
|
const builder = appTemplate;
|
|
@@ -9571,7 +9843,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9571
9843
|
joinPath(templatesRoot, functionsTemplateName)
|
|
9572
9844
|
);
|
|
9573
9845
|
if (!functionsTemplateExists) {
|
|
9574
|
-
|
|
9846
|
+
log2.warn(
|
|
9575
9847
|
`Functions template "${functionsTemplateName}" not found \u2014 skipping functions scaffolding.`
|
|
9576
9848
|
);
|
|
9577
9849
|
} else {
|
|
@@ -9635,7 +9907,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9635
9907
|
});
|
|
9636
9908
|
if (firebaseJson.hosting?.rewrites && Array.isArray(firebaseJson.hosting.rewrites)) {
|
|
9637
9909
|
firebaseJson.hosting.rewrites = firebaseJson.hosting.rewrites.filter(
|
|
9638
|
-
(
|
|
9910
|
+
(r2) => r2.destination !== "/index.html"
|
|
9639
9911
|
);
|
|
9640
9912
|
}
|
|
9641
9913
|
if (firebaseJson.hosting) {
|
|
@@ -9749,16 +10021,16 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9749
10021
|
const appsDir = joinPath(workspaceRoot, "apps");
|
|
9750
10022
|
const allDirs = pathExists(appsDir) ? (await readdir(appsDir, {
|
|
9751
10023
|
withFileTypes: true
|
|
9752
|
-
})).filter((
|
|
10024
|
+
})).filter((d) => d.isDirectory()).map((d) => d.name).filter(isValidFileName) : [];
|
|
9753
10025
|
await updateRootPackageJson(workspaceRoot, allDirs);
|
|
9754
10026
|
}
|
|
9755
10027
|
if (isInteractive) {
|
|
9756
|
-
|
|
10028
|
+
outro("\u{1F389} App created successfully!");
|
|
9757
10029
|
const firebaseStep = row.functionsTemplate === "functions-firebase" ? `2. Set Firebase project: cd apps/${appName} && firebase use --add (or edit .firebaserc)
|
|
9758
10030
|
3. bun install
|
|
9759
10031
|
4. bun run dev` : `2. bun install
|
|
9760
10032
|
3. bun run dev`;
|
|
9761
|
-
|
|
10033
|
+
note(
|
|
9762
10034
|
`Next steps:
|
|
9763
10035
|
|
|
9764
10036
|
1. cd apps/${appName}
|
|
@@ -9806,7 +10078,7 @@ async function main(options) {
|
|
|
9806
10078
|
await createApp(options?.name);
|
|
9807
10079
|
}
|
|
9808
10080
|
} catch (error2) {
|
|
9809
|
-
|
|
10081
|
+
log2.error("\n\u274C Error creating app:", error2);
|
|
9810
10082
|
throw error2;
|
|
9811
10083
|
}
|
|
9812
10084
|
}
|