@donotdev/cli 0.1.45 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dependencies-matrix.json +9 -8
- package/dist/bin/commands/agent-setup.js +553 -509
- package/dist/bin/commands/build.js +1144 -908
- package/dist/bin/commands/bump.js +1206 -931
- package/dist/bin/commands/cacheout.js +464 -390
- package/dist/bin/commands/coach.js +467 -393
- package/dist/bin/commands/create-app.js +1118 -846
- package/dist/bin/commands/create-project.js +1158 -886
- package/dist/bin/commands/db.js +16351 -33069
- package/dist/bin/commands/deploy.js +2171 -1870
- package/dist/bin/commands/dev.js +833 -647
- package/dist/bin/commands/doctor.js +555 -511
- package/dist/bin/commands/emu.js +1014 -770
- package/dist/bin/commands/format.js +509 -435
- package/dist/bin/commands/get-demo.js +964 -741
- package/dist/bin/commands/make-admin.js +10368 -27067
- package/dist/bin/commands/preview.js +834 -648
- package/dist/bin/commands/seed.js +16352 -33070
- package/dist/bin/commands/setup-cicd.js +1050 -801
- package/dist/bin/commands/setup.js +1216 -944
- package/dist/bin/commands/staging.js +2171 -1870
- package/dist/bin/commands/sync-secrets.js +916 -717
- package/dist/bin/commands/type-check.js +654 -583
- package/dist/bin/commands/wai.js +454 -380
- package/dist/bin/dndev.js +2 -6
- package/dist/index.js +2582 -2223
- package/package.json +1 -1
package/dist/bin/commands/emu.js
CHANGED
|
@@ -5,7 +5,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (
|
|
8
|
+
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
9
9
|
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
@@ -33,31 +33,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
37
|
-
var
|
|
36
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
37
|
+
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
38
38
|
var init_utils = __esm({
|
|
39
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
39
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
40
40
|
init_utils2();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
42
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
43
|
+
return (input) => {
|
|
44
|
+
let surrogatePairsNr = 0;
|
|
45
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
46
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
47
|
+
surrogatePairsNr += 1;
|
|
48
|
+
}
|
|
49
|
+
return input.length - surrogatePairsNr;
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
44
52
|
isFullWidth = (x) => {
|
|
45
53
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
46
54
|
};
|
|
47
|
-
|
|
48
|
-
return x
|
|
55
|
+
isWideNotCJKTNotEmoji = (x) => {
|
|
56
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
});
|
|
52
60
|
|
|
53
|
-
// node_modules/.bun/fast-string-truncated-width@
|
|
54
|
-
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
61
|
+
// node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
62
|
+
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default;
|
|
55
63
|
var init_dist = __esm({
|
|
56
|
-
"node_modules/.bun/fast-string-truncated-width@
|
|
64
|
+
"node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
57
65
|
init_utils2();
|
|
58
66
|
init_utils();
|
|
59
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
67
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
60
68
|
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
69
|
+
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
61
70
|
TAB_RE = /\t{1,1000}/y;
|
|
62
71
|
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
63
72
|
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -67,14 +76,21 @@ var init_dist = __esm({
|
|
|
67
76
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
68
77
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
69
78
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
70
|
-
const ANSI_WIDTH =
|
|
79
|
+
const ANSI_WIDTH = 0;
|
|
71
80
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
72
81
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
73
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
74
82
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
75
|
-
const FULL_WIDTH_WIDTH =
|
|
83
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
76
84
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
77
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
85
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
86
|
+
const PARSE_BLOCKS = [
|
|
87
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
88
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
89
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
90
|
+
[TAB_RE, TAB_WIDTH],
|
|
91
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
92
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
93
|
+
];
|
|
78
94
|
let indexPrev = 0;
|
|
79
95
|
let index = 0;
|
|
80
96
|
let length = input.length;
|
|
@@ -94,10 +110,8 @@ var init_dist = __esm({
|
|
|
94
110
|
const codePoint = char.codePointAt(0) || 0;
|
|
95
111
|
if (isFullWidth(codePoint)) {
|
|
96
112
|
widthExtra = FULL_WIDTH_WIDTH;
|
|
97
|
-
} else if (
|
|
113
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
98
114
|
widthExtra = WIDE_WIDTH;
|
|
99
|
-
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
100
|
-
widthExtra = AMBIGUOUS_WIDTH;
|
|
101
115
|
} else {
|
|
102
116
|
widthExtra = REGULAR_WIDTH;
|
|
103
117
|
}
|
|
@@ -113,88 +127,28 @@ var init_dist = __esm({
|
|
|
113
127
|
}
|
|
114
128
|
unmatchedStart = unmatchedEnd = 0;
|
|
115
129
|
}
|
|
116
|
-
if (index >= length)
|
|
117
|
-
break;
|
|
118
|
-
LATIN_RE.lastIndex = index;
|
|
119
|
-
if (LATIN_RE.test(input)) {
|
|
120
|
-
lengthExtra = LATIN_RE.lastIndex - index;
|
|
121
|
-
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
122
|
-
if (width + widthExtra > truncationLimit) {
|
|
123
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
124
|
-
}
|
|
125
|
-
if (width + widthExtra > LIMIT) {
|
|
126
|
-
truncationEnabled = true;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
width += widthExtra;
|
|
130
|
-
unmatchedStart = indexPrev;
|
|
131
|
-
unmatchedEnd = index;
|
|
132
|
-
index = indexPrev = LATIN_RE.lastIndex;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
ANSI_RE.lastIndex = index;
|
|
136
|
-
if (ANSI_RE.test(input)) {
|
|
137
|
-
if (width + ANSI_WIDTH > truncationLimit) {
|
|
138
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
139
|
-
}
|
|
140
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
141
|
-
truncationEnabled = true;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
width += ANSI_WIDTH;
|
|
145
|
-
unmatchedStart = indexPrev;
|
|
146
|
-
unmatchedEnd = index;
|
|
147
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
CONTROL_RE.lastIndex = index;
|
|
151
|
-
if (CONTROL_RE.test(input)) {
|
|
152
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
153
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
154
|
-
if (width + widthExtra > truncationLimit) {
|
|
155
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
156
|
-
}
|
|
157
|
-
if (width + widthExtra > LIMIT) {
|
|
158
|
-
truncationEnabled = true;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
width += widthExtra;
|
|
162
|
-
unmatchedStart = indexPrev;
|
|
163
|
-
unmatchedEnd = index;
|
|
164
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
165
|
-
continue;
|
|
130
|
+
if (index >= length) {
|
|
131
|
+
break outer;
|
|
166
132
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (EMOJI_RE.test(input)) {
|
|
186
|
-
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
187
|
-
truncationIndex = Math.min(truncationIndex, index);
|
|
188
|
-
}
|
|
189
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
190
|
-
truncationEnabled = true;
|
|
191
|
-
break;
|
|
133
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
134
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
135
|
+
BLOCK_RE.lastIndex = index;
|
|
136
|
+
if (BLOCK_RE.test(input)) {
|
|
137
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
138
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
139
|
+
if (width + widthExtra > truncationLimit) {
|
|
140
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
141
|
+
}
|
|
142
|
+
if (width + widthExtra > LIMIT) {
|
|
143
|
+
truncationEnabled = true;
|
|
144
|
+
break outer;
|
|
145
|
+
}
|
|
146
|
+
width += widthExtra;
|
|
147
|
+
unmatchedStart = indexPrev;
|
|
148
|
+
unmatchedEnd = index;
|
|
149
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
150
|
+
continue outer;
|
|
192
151
|
}
|
|
193
|
-
width += EMOJI_WIDTH;
|
|
194
|
-
unmatchedStart = indexPrev;
|
|
195
|
-
unmatchedEnd = index;
|
|
196
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
197
|
-
continue;
|
|
198
152
|
}
|
|
199
153
|
index += 1;
|
|
200
154
|
}
|
|
@@ -209,10 +163,10 @@ var init_dist = __esm({
|
|
|
209
163
|
}
|
|
210
164
|
});
|
|
211
165
|
|
|
212
|
-
// node_modules/.bun/fast-string-width@
|
|
166
|
+
// node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
213
167
|
var NO_TRUNCATION2, fastStringWidth, dist_default2;
|
|
214
168
|
var init_dist2 = __esm({
|
|
215
|
-
"node_modules/.bun/fast-string-width@
|
|
169
|
+
"node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js"() {
|
|
216
170
|
init_utils2();
|
|
217
171
|
init_dist();
|
|
218
172
|
NO_TRUNCATION2 = {
|
|
@@ -227,13 +181,13 @@ var init_dist2 = __esm({
|
|
|
227
181
|
}
|
|
228
182
|
});
|
|
229
183
|
|
|
230
|
-
// node_modules/.bun/fast-wrap-ansi@0.
|
|
184
|
+
// node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
231
185
|
function wrapAnsi(string, columns, options) {
|
|
232
186
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
233
187
|
}
|
|
234
188
|
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec, CRLF_OR_LF;
|
|
235
189
|
var init_main = __esm({
|
|
236
|
-
"node_modules/.bun/fast-wrap-ansi@0.
|
|
190
|
+
"node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
237
191
|
init_utils2();
|
|
238
192
|
init_dist2();
|
|
239
193
|
ESC = "\x1B";
|
|
@@ -397,16 +351,19 @@ var init_main = __esm({
|
|
|
397
351
|
}
|
|
398
352
|
const preString = rows.join("\n");
|
|
399
353
|
let inSurrogate = false;
|
|
400
|
-
for (let
|
|
401
|
-
const character = preString[
|
|
354
|
+
for (let i2 = 0; i2 < preString.length; i2++) {
|
|
355
|
+
const character = preString[i2];
|
|
402
356
|
returnValue += character;
|
|
403
357
|
if (!inSurrogate) {
|
|
404
358
|
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
359
|
+
if (inSurrogate) {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
405
362
|
} else {
|
|
406
|
-
|
|
363
|
+
inSurrogate = false;
|
|
407
364
|
}
|
|
408
365
|
if (character === ESC || character === CSI) {
|
|
409
|
-
GROUP_REGEX.lastIndex =
|
|
366
|
+
GROUP_REGEX.lastIndex = i2 + 1;
|
|
410
367
|
const groupsResult = GROUP_REGEX.exec(preString);
|
|
411
368
|
const groups = groupsResult?.groups;
|
|
412
369
|
if (groups?.code !== void 0) {
|
|
@@ -416,7 +373,7 @@ var init_main = __esm({
|
|
|
416
373
|
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
417
374
|
}
|
|
418
375
|
}
|
|
419
|
-
if (preString[
|
|
376
|
+
if (preString[i2 + 1] === "\n") {
|
|
420
377
|
if (escapeUrl) {
|
|
421
378
|
returnValue += wrapAnsiHyperlink("");
|
|
422
379
|
}
|
|
@@ -447,7 +404,7 @@ var require_src = __commonJS({
|
|
|
447
404
|
var ESC2 = "\x1B";
|
|
448
405
|
var CSI2 = `${ESC2}[`;
|
|
449
406
|
var beep = "\x07";
|
|
450
|
-
var
|
|
407
|
+
var cursor3 = {
|
|
451
408
|
to(x, y2) {
|
|
452
409
|
if (!y2) return `${CSI2}${x + 1}G`;
|
|
453
410
|
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
@@ -476,7 +433,7 @@ var require_src = __commonJS({
|
|
|
476
433
|
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
477
434
|
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
478
435
|
};
|
|
479
|
-
var
|
|
436
|
+
var erase3 = {
|
|
480
437
|
screen: `${CSI2}2J`,
|
|
481
438
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
482
439
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -485,67 +442,137 @@ var require_src = __commonJS({
|
|
|
485
442
|
lineStart: `${CSI2}1K`,
|
|
486
443
|
lines(count) {
|
|
487
444
|
let clear = "";
|
|
488
|
-
for (let
|
|
489
|
-
clear += this.line + (
|
|
445
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
446
|
+
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
490
447
|
if (count)
|
|
491
|
-
clear +=
|
|
448
|
+
clear += cursor3.left;
|
|
492
449
|
return clear;
|
|
493
450
|
}
|
|
494
451
|
};
|
|
495
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
452
|
+
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
496
453
|
}
|
|
497
454
|
});
|
|
498
455
|
|
|
499
|
-
// node_modules/.bun/@clack+core@1.
|
|
500
|
-
import { styleText
|
|
501
|
-
import { stdout
|
|
502
|
-
import
|
|
503
|
-
import { ReadStream
|
|
504
|
-
function
|
|
505
|
-
if (!
|
|
506
|
-
|
|
507
|
-
|
|
456
|
+
// node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
|
|
457
|
+
import { styleText } from "node:util";
|
|
458
|
+
import { stdout, stdin } from "node:process";
|
|
459
|
+
import l__default from "node:readline";
|
|
460
|
+
import { ReadStream } from "node:tty";
|
|
461
|
+
function findCursor(s, o, l) {
|
|
462
|
+
if (!l.some((r2) => !r2.disabled))
|
|
463
|
+
return s;
|
|
464
|
+
const t2 = s + o, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
465
|
+
return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
|
|
466
|
+
}
|
|
467
|
+
function isAccessible(n3) {
|
|
468
|
+
if (n3 !== void 0) return n3;
|
|
469
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
470
|
+
const e = process.env.ACCESSIBLE;
|
|
471
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
508
472
|
}
|
|
509
|
-
function
|
|
510
|
-
if (typeof
|
|
511
|
-
|
|
473
|
+
function isActionKey(n3, e) {
|
|
474
|
+
if (typeof n3 == "string")
|
|
475
|
+
return settings.aliases.get(n3) === e;
|
|
476
|
+
for (const s of n3)
|
|
477
|
+
if (s !== void 0 && isActionKey(s, e))
|
|
478
|
+
return true;
|
|
512
479
|
return false;
|
|
513
480
|
}
|
|
514
|
-
function
|
|
515
|
-
if (
|
|
516
|
-
const e =
|
|
517
|
-
`),
|
|
518
|
-
`),
|
|
519
|
-
for (let
|
|
520
|
-
|
|
481
|
+
function diffLines(i2, s) {
|
|
482
|
+
if (i2 === s) return;
|
|
483
|
+
const e = i2.split(`
|
|
484
|
+
`), t2 = s.split(`
|
|
485
|
+
`), r2 = Math.max(e.length, t2.length), f = [];
|
|
486
|
+
for (let n3 = 0; n3 < r2; n3++)
|
|
487
|
+
e[n3] !== t2[n3] && f.push(n3);
|
|
488
|
+
return {
|
|
489
|
+
lines: f,
|
|
490
|
+
numLinesBefore: e.length,
|
|
491
|
+
numLinesAfter: t2.length,
|
|
492
|
+
numLines: r2
|
|
493
|
+
};
|
|
521
494
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
495
|
+
function isCancel(e) {
|
|
496
|
+
return e === CANCEL_SYMBOL;
|
|
524
497
|
}
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
498
|
+
function setRawMode(e, r2) {
|
|
499
|
+
const o = e;
|
|
500
|
+
o.isTTY && o.setRawMode(r2);
|
|
528
501
|
}
|
|
529
|
-
function
|
|
530
|
-
const
|
|
531
|
-
return wrapAnsi(
|
|
532
|
-
|
|
502
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
503
|
+
const f = getColumns(e ?? stdout);
|
|
504
|
+
return wrapAnsi(r2, f - o.length, {
|
|
505
|
+
hard: true,
|
|
506
|
+
trim: false
|
|
507
|
+
}).split(`
|
|
508
|
+
`).map((c2, i2, m2) => {
|
|
509
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
510
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
511
|
+
}).join(`
|
|
533
512
|
`);
|
|
534
513
|
}
|
|
535
|
-
|
|
514
|
+
function runValidation(e, a2) {
|
|
515
|
+
if ("~standard" in e) {
|
|
516
|
+
const n3 = e["~standard"].validate(a2);
|
|
517
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
518
|
+
}
|
|
519
|
+
return e(a2);
|
|
520
|
+
}
|
|
521
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, a, n$1;
|
|
536
522
|
var init_dist3 = __esm({
|
|
537
|
-
"node_modules/.bun/@clack+core@1.
|
|
523
|
+
"node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
538
524
|
init_utils2();
|
|
539
525
|
init_main();
|
|
540
526
|
import_sisteransi = __toESM(require_src(), 1);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
527
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
528
|
+
t = [
|
|
529
|
+
"January",
|
|
530
|
+
"February",
|
|
531
|
+
"March",
|
|
532
|
+
"April",
|
|
533
|
+
"May",
|
|
534
|
+
"June",
|
|
535
|
+
"July",
|
|
536
|
+
"August",
|
|
537
|
+
"September",
|
|
538
|
+
"October",
|
|
539
|
+
"November",
|
|
540
|
+
"December"
|
|
541
|
+
];
|
|
542
|
+
settings = {
|
|
543
|
+
actions: new Set(a$1),
|
|
544
|
+
aliases: /* @__PURE__ */ new Map([
|
|
545
|
+
// vim support
|
|
546
|
+
["k", "up"],
|
|
547
|
+
["j", "down"],
|
|
548
|
+
["h", "left"],
|
|
549
|
+
["l", "right"],
|
|
550
|
+
["", "cancel"],
|
|
551
|
+
// opinionated defaults!
|
|
552
|
+
["escape", "cancel"]
|
|
553
|
+
]),
|
|
554
|
+
messages: {
|
|
555
|
+
cancel: "Canceled",
|
|
556
|
+
error: "Something went wrong"
|
|
557
|
+
},
|
|
558
|
+
withGuide: true,
|
|
559
|
+
accessible: void 0,
|
|
560
|
+
date: {
|
|
561
|
+
monthNames: [...t],
|
|
562
|
+
messages: {
|
|
563
|
+
required: "Please enter a valid date",
|
|
564
|
+
invalidMonth: "There are only 12 months in a year",
|
|
565
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
566
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
567
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
R = globalThis.process.platform.startsWith("win");
|
|
572
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
573
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
574
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
575
|
+
y = class {
|
|
549
576
|
input;
|
|
550
577
|
output;
|
|
551
578
|
_abortSignal;
|
|
@@ -560,46 +587,92 @@ var init_dist3 = __esm({
|
|
|
560
587
|
error = "";
|
|
561
588
|
value;
|
|
562
589
|
userInput = "";
|
|
590
|
+
/**
|
|
591
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
592
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
593
|
+
* and the `ACCESSIBLE` env var.
|
|
594
|
+
*/
|
|
595
|
+
get accessible() {
|
|
596
|
+
return isAccessible(this.opts.accessible);
|
|
597
|
+
}
|
|
563
598
|
constructor(t2, e = true) {
|
|
564
|
-
const { input:
|
|
565
|
-
this.opts =
|
|
599
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
600
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
|
|
566
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Unsubscribe all listeners
|
|
604
|
+
*/
|
|
567
605
|
unsubscribe() {
|
|
568
606
|
this._subscribers.clear();
|
|
569
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Set a subscriber with opts
|
|
610
|
+
* @param event - The event name
|
|
611
|
+
*/
|
|
570
612
|
setSubscriber(t2, e) {
|
|
571
|
-
const
|
|
572
|
-
|
|
613
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
614
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
573
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Subscribe to an event
|
|
618
|
+
* @param event - The event name
|
|
619
|
+
* @param cb - The callback
|
|
620
|
+
*/
|
|
574
621
|
on(t2, e) {
|
|
575
622
|
this.setSubscriber(t2, { cb: e });
|
|
576
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Subscribe to an event once
|
|
626
|
+
* @param event - The event name
|
|
627
|
+
* @param cb - The callback
|
|
628
|
+
*/
|
|
577
629
|
once(t2, e) {
|
|
578
630
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
579
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Emit an event with data
|
|
634
|
+
* @param event - The event name
|
|
635
|
+
* @param data - The data to pass to the callback
|
|
636
|
+
*/
|
|
580
637
|
emit(t2, ...e) {
|
|
581
|
-
const
|
|
582
|
-
for (const
|
|
583
|
-
|
|
638
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
639
|
+
for (const r2 of i2)
|
|
640
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
641
|
+
for (const r2 of s)
|
|
642
|
+
r2();
|
|
584
643
|
}
|
|
585
644
|
prompt() {
|
|
586
645
|
return new Promise((t2) => {
|
|
587
646
|
if (this._abortSignal) {
|
|
588
|
-
if (this._abortSignal.aborted)
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
647
|
+
if (this._abortSignal.aborted)
|
|
648
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
649
|
+
this._abortSignal.addEventListener(
|
|
650
|
+
"abort",
|
|
651
|
+
() => {
|
|
652
|
+
this.state = "cancel", this.close();
|
|
653
|
+
},
|
|
654
|
+
{ once: true }
|
|
655
|
+
);
|
|
592
656
|
}
|
|
593
|
-
this.rl =
|
|
594
|
-
|
|
657
|
+
this.rl = l__default.createInterface({
|
|
658
|
+
input: this.input,
|
|
659
|
+
tabSize: 2,
|
|
660
|
+
prompt: "",
|
|
661
|
+
escapeCodeTimeout: 50,
|
|
662
|
+
terminal: true
|
|
663
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
664
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
595
665
|
}), this.once("cancel", () => {
|
|
596
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
666
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
597
667
|
});
|
|
598
668
|
});
|
|
599
669
|
}
|
|
600
670
|
_isActionKey(t2, e) {
|
|
601
671
|
return t2 === " ";
|
|
602
672
|
}
|
|
673
|
+
_shouldSubmit(t2, e) {
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
603
676
|
_setValue(t2) {
|
|
604
677
|
this.value = t2, this.emit("value", this.value);
|
|
605
678
|
}
|
|
@@ -609,19 +682,22 @@ var init_dist3 = __esm({
|
|
|
609
682
|
_clearUserInput() {
|
|
610
683
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
611
684
|
}
|
|
612
|
-
onKeypress(t2, e) {
|
|
613
|
-
if (this.
|
|
614
|
-
if (this.
|
|
615
|
-
|
|
616
|
-
|
|
685
|
+
async onKeypress(t2, e) {
|
|
686
|
+
if (this.state !== "validating") {
|
|
687
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
|
|
688
|
+
if (this.opts.validate) {
|
|
689
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
690
|
+
let s;
|
|
691
|
+
i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
692
|
+
}
|
|
693
|
+
this.state !== "error" && (this.state = "submit");
|
|
617
694
|
}
|
|
618
|
-
this.state
|
|
695
|
+
isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
619
696
|
}
|
|
620
|
-
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
621
697
|
}
|
|
622
698
|
close() {
|
|
623
699
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
624
|
-
`),
|
|
700
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
625
701
|
}
|
|
626
702
|
restoreCursor() {
|
|
627
703
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -629,34 +705,39 @@ var init_dist3 = __esm({
|
|
|
629
705
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
630
706
|
}
|
|
631
707
|
render() {
|
|
632
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
708
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
709
|
+
hard: true,
|
|
710
|
+
trim: false
|
|
711
|
+
});
|
|
633
712
|
if (t2 !== this._prevFrame) {
|
|
634
|
-
if (this.state === "initial")
|
|
713
|
+
if (this.state === "initial")
|
|
714
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
635
715
|
else {
|
|
636
|
-
const e =
|
|
716
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
637
717
|
if (this.restoreCursor(), e) {
|
|
638
|
-
const
|
|
639
|
-
let
|
|
640
|
-
if (
|
|
718
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
719
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
720
|
+
if (n3 === void 0) {
|
|
641
721
|
this._prevFrame = t2;
|
|
642
722
|
return;
|
|
643
723
|
}
|
|
644
724
|
if (e.lines.length === 1) {
|
|
645
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
646
|
-
const
|
|
725
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
726
|
+
const o = t2.split(`
|
|
647
727
|
`);
|
|
648
|
-
this.output.write(
|
|
728
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
649
729
|
return;
|
|
650
730
|
} else if (e.lines.length > 1) {
|
|
651
|
-
if (
|
|
731
|
+
if (s < r2)
|
|
732
|
+
n3 = s;
|
|
652
733
|
else {
|
|
653
|
-
const
|
|
654
|
-
|
|
734
|
+
const h2 = n3 - r2;
|
|
735
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
655
736
|
}
|
|
656
737
|
this.output.write(import_sisteransi.erase.down());
|
|
657
|
-
const
|
|
658
|
-
`).slice(
|
|
659
|
-
this.output.write(
|
|
738
|
+
const f = t2.split(`
|
|
739
|
+
`).slice(n3);
|
|
740
|
+
this.output.write(f.join(`
|
|
660
741
|
`)), this._prevFrame = t2;
|
|
661
742
|
return;
|
|
662
743
|
}
|
|
@@ -667,44 +748,48 @@ var init_dist3 = __esm({
|
|
|
667
748
|
}
|
|
668
749
|
}
|
|
669
750
|
};
|
|
670
|
-
|
|
751
|
+
a = class extends y {
|
|
671
752
|
options;
|
|
672
753
|
cursor = 0;
|
|
673
754
|
get _value() {
|
|
674
|
-
return this.options[this.cursor]
|
|
755
|
+
return this.options[this.cursor]?.value;
|
|
675
756
|
}
|
|
676
757
|
get _enabledOptions() {
|
|
677
|
-
return this.options.filter((
|
|
758
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
678
759
|
}
|
|
679
760
|
toggleAll() {
|
|
680
|
-
const
|
|
681
|
-
this.value =
|
|
761
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
762
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
682
763
|
}
|
|
683
764
|
toggleInvert() {
|
|
684
|
-
const
|
|
685
|
-
if (!
|
|
686
|
-
|
|
687
|
-
|
|
765
|
+
const e = this.value;
|
|
766
|
+
if (!e)
|
|
767
|
+
return;
|
|
768
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
769
|
+
this.value = i2.map((t2) => t2.value);
|
|
688
770
|
}
|
|
689
771
|
toggleValue() {
|
|
690
772
|
this.value === void 0 && (this.value = []);
|
|
691
|
-
const
|
|
692
|
-
this.value =
|
|
693
|
-
}
|
|
694
|
-
constructor(
|
|
695
|
-
super(
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
773
|
+
const e = this.value.includes(this._value);
|
|
774
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
775
|
+
}
|
|
776
|
+
constructor(e) {
|
|
777
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
778
|
+
const i2 = Math.max(
|
|
779
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
780
|
+
0
|
|
781
|
+
);
|
|
782
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l) => {
|
|
783
|
+
l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
|
|
784
|
+
}), this.on("cursor", (t2) => {
|
|
785
|
+
switch (t2) {
|
|
701
786
|
case "left":
|
|
702
787
|
case "up":
|
|
703
|
-
this.cursor =
|
|
788
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
704
789
|
break;
|
|
705
790
|
case "down":
|
|
706
791
|
case "right":
|
|
707
|
-
this.cursor =
|
|
792
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
708
793
|
break;
|
|
709
794
|
case "space":
|
|
710
795
|
this.toggleValue();
|
|
@@ -713,27 +798,28 @@ var init_dist3 = __esm({
|
|
|
713
798
|
});
|
|
714
799
|
}
|
|
715
800
|
};
|
|
716
|
-
|
|
801
|
+
n$1 = class n extends y {
|
|
717
802
|
options;
|
|
718
803
|
cursor = 0;
|
|
719
804
|
get _selectedValue() {
|
|
720
805
|
return this.options[this.cursor];
|
|
721
806
|
}
|
|
722
807
|
changeValue() {
|
|
723
|
-
|
|
808
|
+
const e = this._selectedValue;
|
|
809
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
724
810
|
}
|
|
725
|
-
constructor(
|
|
726
|
-
super(
|
|
727
|
-
const
|
|
728
|
-
this.cursor = this.options[
|
|
729
|
-
switch (
|
|
811
|
+
constructor(e) {
|
|
812
|
+
super(e, false), this.options = e.options;
|
|
813
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
814
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
815
|
+
switch (s) {
|
|
730
816
|
case "left":
|
|
731
817
|
case "up":
|
|
732
|
-
this.cursor =
|
|
818
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
733
819
|
break;
|
|
734
820
|
case "down":
|
|
735
821
|
case "right":
|
|
736
|
-
this.cursor =
|
|
822
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
737
823
|
break;
|
|
738
824
|
}
|
|
739
825
|
this.changeValue();
|
|
@@ -743,240 +829,398 @@ var init_dist3 = __esm({
|
|
|
743
829
|
}
|
|
744
830
|
});
|
|
745
831
|
|
|
746
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
747
|
-
import { styleText as
|
|
748
|
-
import
|
|
749
|
-
import { existsSync
|
|
750
|
-
import { dirname
|
|
751
|
-
function
|
|
752
|
-
|
|
832
|
+
// node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
|
|
833
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
834
|
+
import process$1 from "node:process";
|
|
835
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
836
|
+
import { dirname, join } from "node:path";
|
|
837
|
+
function isUnicodeSupported() {
|
|
838
|
+
if (process$1.platform !== "win32") {
|
|
839
|
+
return process$1.env.TERM !== "linux";
|
|
840
|
+
}
|
|
841
|
+
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";
|
|
842
|
+
}
|
|
843
|
+
function formatInstructionFooter(o, e) {
|
|
844
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
845
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
753
846
|
}
|
|
754
|
-
var import_sisteransi2,
|
|
847
|
+
var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, u2, SELECT_INSTRUCTIONS, c, select, i;
|
|
755
848
|
var init_dist4 = __esm({
|
|
756
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
849
|
+
"node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
757
850
|
init_utils2();
|
|
758
851
|
init_dist3();
|
|
759
852
|
init_dist3();
|
|
760
853
|
init_main();
|
|
761
854
|
init_dist2();
|
|
762
855
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
switch (
|
|
856
|
+
unicode = isUnicodeSupported();
|
|
857
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
858
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
859
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
860
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
861
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
862
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
863
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
864
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
865
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
866
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
867
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
868
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
869
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
870
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
871
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
872
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
873
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
874
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
875
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
876
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
877
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
878
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
879
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
880
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
881
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
882
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
883
|
+
symbol = (o) => {
|
|
884
|
+
switch (o) {
|
|
792
885
|
case "initial":
|
|
793
886
|
case "active":
|
|
794
|
-
return
|
|
887
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
795
888
|
case "cancel":
|
|
796
|
-
return
|
|
889
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
797
890
|
case "error":
|
|
798
|
-
return
|
|
891
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
799
892
|
case "submit":
|
|
800
|
-
return
|
|
893
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
894
|
+
case "validating":
|
|
895
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
801
896
|
}
|
|
802
897
|
};
|
|
803
|
-
|
|
804
|
-
switch (
|
|
898
|
+
symbolBar = (o) => {
|
|
899
|
+
switch (o) {
|
|
805
900
|
case "initial":
|
|
806
901
|
case "active":
|
|
807
|
-
return
|
|
902
|
+
return styleText2("cyan", S_BAR);
|
|
808
903
|
case "cancel":
|
|
809
|
-
return
|
|
904
|
+
return styleText2("red", S_BAR);
|
|
810
905
|
case "error":
|
|
811
|
-
return
|
|
906
|
+
return styleText2("yellow", S_BAR);
|
|
812
907
|
case "submit":
|
|
813
|
-
return
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
let
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
908
|
+
return styleText2("green", S_BAR);
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
I = (l, e, w, p, b, C = false) => {
|
|
912
|
+
let r2 = e, O = 0;
|
|
913
|
+
if (C)
|
|
914
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
915
|
+
const m2 = l[i2];
|
|
916
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
917
|
+
}
|
|
918
|
+
else
|
|
919
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
920
|
+
const m2 = l[i2];
|
|
921
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
922
|
+
}
|
|
923
|
+
return { lineCount: r2, removals: O };
|
|
924
|
+
};
|
|
925
|
+
limitOptions = ({
|
|
926
|
+
cursor: l,
|
|
927
|
+
options: e,
|
|
928
|
+
style: w,
|
|
929
|
+
output: p = process.stdout,
|
|
930
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
931
|
+
columnPadding: C = 0,
|
|
932
|
+
rowPadding: r2 = 4
|
|
933
|
+
}) => {
|
|
934
|
+
const i2 = getColumns(p) - C, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
830
935
|
let f = 0;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
O2 = { message: (e = [], { symbol: i = t("gray", d2), secondarySymbol: s = t("gray", d2), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
|
|
849
|
-
const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
|
|
850
|
-
for (let p2 = 0; p2 < u2; p2++) o.push(a);
|
|
851
|
-
const y2 = Array.isArray(e) ? e : e.split(`
|
|
852
|
-
`);
|
|
853
|
-
if (y2.length > 0) {
|
|
854
|
-
const [p2, ...m] = y2;
|
|
855
|
-
p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
|
|
856
|
-
for (const g of m) g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
|
|
857
|
-
}
|
|
858
|
-
r.write(`${o.join(`
|
|
859
|
-
`)}
|
|
860
|
-
`);
|
|
861
|
-
}, info: (e, i) => {
|
|
862
|
-
O2.message(e, { ...i, symbol: t("blue", he) });
|
|
863
|
-
}, success: (e, i) => {
|
|
864
|
-
O2.message(e, { ...i, symbol: t("green", pe) });
|
|
865
|
-
}, step: (e, i) => {
|
|
866
|
-
O2.message(e, { ...i, symbol: t("green", F) });
|
|
867
|
-
}, warn: (e, i) => {
|
|
868
|
-
O2.message(e, { ...i, symbol: t("yellow", me) });
|
|
869
|
-
}, warning: (e, i) => {
|
|
870
|
-
O2.warn(e, i);
|
|
871
|
-
}, error: (e, i) => {
|
|
872
|
-
O2.message(e, { ...i, symbol: t("red", ge) });
|
|
873
|
-
} };
|
|
874
|
-
pt = (e = "", i) => {
|
|
875
|
-
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", E2)} ` : "";
|
|
876
|
-
s.write(`${r}${t("red", e)}
|
|
877
|
-
|
|
936
|
+
l >= a2 - 3 && (f = Math.max(
|
|
937
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
938
|
+
0
|
|
939
|
+
));
|
|
940
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
941
|
+
const W = Math.min(
|
|
942
|
+
f + a2,
|
|
943
|
+
e.length
|
|
944
|
+
), s = [];
|
|
945
|
+
let g = 0;
|
|
946
|
+
d && g++, c2 && g++;
|
|
947
|
+
const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
|
|
948
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
949
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
950
|
+
hard: true,
|
|
951
|
+
trim: false
|
|
952
|
+
}).split(`
|
|
878
953
|
`);
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
954
|
+
s.push(h2), g += h2.length;
|
|
955
|
+
}
|
|
956
|
+
if (g > v) {
|
|
957
|
+
let t2 = 0, n3 = 0, o = g;
|
|
958
|
+
const h2 = l - T;
|
|
959
|
+
let u3 = v;
|
|
960
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
961
|
+
s,
|
|
962
|
+
o,
|
|
963
|
+
h2 + 1,
|
|
964
|
+
s.length,
|
|
965
|
+
u3,
|
|
966
|
+
true
|
|
967
|
+
);
|
|
968
|
+
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));
|
|
969
|
+
}
|
|
970
|
+
const x = [];
|
|
971
|
+
d && x.push(M);
|
|
972
|
+
for (const t2 of s)
|
|
973
|
+
for (const n3 of t2)
|
|
974
|
+
x.push(n3);
|
|
975
|
+
return c2 && x.push(M), x;
|
|
976
|
+
};
|
|
977
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
978
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
979
|
+
`${styleText2("dim", "Space:")} select`,
|
|
980
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
981
|
+
];
|
|
982
|
+
m = (i2, u3) => i2.split(`
|
|
983
|
+
`).map((d) => u3(d)).join(`
|
|
882
984
|
`);
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
const
|
|
886
|
-
return
|
|
887
|
-
},
|
|
888
|
-
return new
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
985
|
+
multiselect = (i2) => {
|
|
986
|
+
const u3 = (t2, a2) => {
|
|
987
|
+
const r2 = t2.label ?? String(t2.value);
|
|
988
|
+
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
989
|
+
}, d = i2.required ?? true, v = i2.showInstructions ?? true;
|
|
990
|
+
return new a({
|
|
991
|
+
options: i2.options,
|
|
992
|
+
signal: i2.signal,
|
|
993
|
+
input: i2.input,
|
|
994
|
+
output: i2.output,
|
|
995
|
+
initialValues: i2.initialValues,
|
|
996
|
+
required: d,
|
|
997
|
+
cursorAt: i2.cursorAt,
|
|
998
|
+
validate(t2) {
|
|
999
|
+
if (d && (t2 === void 0 || t2.length === 0))
|
|
1000
|
+
return `Please select at least one option.
|
|
1001
|
+
${styleText2(
|
|
1002
|
+
"reset",
|
|
1003
|
+
styleText2(
|
|
1004
|
+
"dim",
|
|
1005
|
+
`Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
|
|
1006
|
+
"gray",
|
|
1007
|
+
styleText2("bgWhite", styleText2("inverse", " enter "))
|
|
1008
|
+
)} to submit`
|
|
1009
|
+
)
|
|
1010
|
+
)}`;
|
|
1011
|
+
},
|
|
1012
|
+
render() {
|
|
1013
|
+
const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1014
|
+
i2.output,
|
|
1015
|
+
i2.message,
|
|
1016
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1017
|
+
`${symbol(this.state)} `
|
|
1018
|
+
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1019
|
+
` : ""}${a2}
|
|
1020
|
+
`, o = this.value ?? [], p = (n3, l) => {
|
|
1021
|
+
if (n3.disabled)
|
|
1022
|
+
return u3(n3, "disabled");
|
|
1023
|
+
const s = o.includes(n3.value);
|
|
1024
|
+
return l && s ? u3(n3, "active-selected") : s ? u3(n3, "selected") : u3(n3, l ? "active" : "inactive");
|
|
1025
|
+
};
|
|
1026
|
+
switch (this.state) {
|
|
1027
|
+
case "submit": {
|
|
1028
|
+
const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1029
|
+
i2.output,
|
|
1030
|
+
n3,
|
|
1031
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1032
|
+
);
|
|
1033
|
+
return `${r2}${l}`;
|
|
1034
|
+
}
|
|
1035
|
+
case "cancel": {
|
|
1036
|
+
const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1037
|
+
if (n3.trim() === "")
|
|
1038
|
+
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1039
|
+
const l = wrapTextWithPrefix(
|
|
1040
|
+
i2.output,
|
|
1041
|
+
n3,
|
|
1042
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1043
|
+
);
|
|
1044
|
+
return `${r2}${l}${t2 ? `
|
|
1045
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1046
|
+
}
|
|
1047
|
+
case "error": {
|
|
1048
|
+
const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1049
|
+
`).map(
|
|
1050
|
+
($, C) => C === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1051
|
+
).join(`
|
|
1052
|
+
`), s = r2.split(`
|
|
1053
|
+
`).length, h2 = l.split(`
|
|
916
1054
|
`).length + 1;
|
|
917
|
-
|
|
918
|
-
|
|
1055
|
+
return `${r2}${n3}${limitOptions({
|
|
1056
|
+
output: i2.output,
|
|
1057
|
+
options: this.options,
|
|
1058
|
+
cursor: this.cursor,
|
|
1059
|
+
maxItems: i2.maxItems,
|
|
1060
|
+
columnPadding: n3.length,
|
|
1061
|
+
rowPadding: s + h2,
|
|
1062
|
+
style: p
|
|
1063
|
+
}).join(`
|
|
1064
|
+
${n3}`)}
|
|
919
1065
|
${l}
|
|
920
1066
|
`;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
`).length,
|
|
925
|
-
|
|
926
|
-
${
|
|
927
|
-
|
|
1067
|
+
}
|
|
1068
|
+
default: {
|
|
1069
|
+
const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1070
|
+
`).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1071
|
+
`), $ = s.length + 1;
|
|
1072
|
+
return `${r2}${n3}${limitOptions({
|
|
1073
|
+
output: i2.output,
|
|
1074
|
+
options: this.options,
|
|
1075
|
+
cursor: this.cursor,
|
|
1076
|
+
maxItems: i2.maxItems,
|
|
1077
|
+
columnPadding: n3.length,
|
|
1078
|
+
rowPadding: l + $,
|
|
1079
|
+
style: p
|
|
1080
|
+
}).join(`
|
|
1081
|
+
${n3}`)}
|
|
1082
|
+
${h2}
|
|
928
1083
|
`;
|
|
1084
|
+
}
|
|
929
1085
|
}
|
|
930
1086
|
}
|
|
931
|
-
}
|
|
1087
|
+
}).prompt();
|
|
932
1088
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1089
|
+
log = {
|
|
1090
|
+
message: (s = [], {
|
|
1091
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
1092
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1093
|
+
output: m2 = process.stdout,
|
|
1094
|
+
spacing: l = 1,
|
|
1095
|
+
withGuide: c2
|
|
1096
|
+
} = {}) => {
|
|
1097
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1098
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
1099
|
+
t2.push(f);
|
|
1100
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
1101
|
+
`);
|
|
1102
|
+
if (g.length > 0) {
|
|
1103
|
+
const [i2, ...y2] = g;
|
|
1104
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1105
|
+
for (const p of y2)
|
|
1106
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1107
|
+
}
|
|
1108
|
+
m2.write(`${t2.join(`
|
|
1109
|
+
`)}
|
|
1110
|
+
`);
|
|
1111
|
+
},
|
|
1112
|
+
info: (s, e) => {
|
|
1113
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
1114
|
+
},
|
|
1115
|
+
success: (s, e) => {
|
|
1116
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
1117
|
+
},
|
|
1118
|
+
step: (s, e) => {
|
|
1119
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
1120
|
+
},
|
|
1121
|
+
warn: (s, e) => {
|
|
1122
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
1123
|
+
},
|
|
1124
|
+
/** alias for `log.warn()`. */
|
|
1125
|
+
warning: (s, e) => {
|
|
1126
|
+
log.warn(s, e);
|
|
1127
|
+
},
|
|
1128
|
+
error: (s, e) => {
|
|
1129
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
cancel = (o = "", t2) => {
|
|
1133
|
+
const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
|
|
1134
|
+
i2.write(`${e}${styleText2("red", o)}
|
|
1135
|
+
|
|
1136
|
+
`);
|
|
1137
|
+
};
|
|
1138
|
+
u2 = {
|
|
1139
|
+
light: unicodeOr("\u2500", "-"),
|
|
1140
|
+
heavy: unicodeOr("\u2501", "="),
|
|
1141
|
+
block: unicodeOr("\u2588", "#")
|
|
1142
|
+
};
|
|
1143
|
+
SELECT_INSTRUCTIONS = [
|
|
1144
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1145
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
1146
|
+
];
|
|
1147
|
+
c = (t2, o) => t2.includes(`
|
|
1148
|
+
`) ? t2.split(`
|
|
1149
|
+
`).map((d) => o(d)).join(`
|
|
1150
|
+
`) : o(t2);
|
|
1151
|
+
select = (t2) => {
|
|
1152
|
+
const o = (n3, m2) => {
|
|
1153
|
+
if (n3 === void 0)
|
|
1154
|
+
return "";
|
|
1155
|
+
const s = n3.label ?? String(n3.value);
|
|
1156
|
+
switch (m2) {
|
|
942
1157
|
case "disabled":
|
|
943
|
-
return `${
|
|
1158
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
944
1159
|
case "selected":
|
|
945
|
-
return `${
|
|
1160
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
946
1161
|
case "active":
|
|
947
|
-
return `${
|
|
1162
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
948
1163
|
case "cancelled":
|
|
949
|
-
return `${
|
|
1164
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
950
1165
|
default:
|
|
951
|
-
return `${
|
|
952
|
-
}
|
|
953
|
-
};
|
|
954
|
-
return new
|
|
955
|
-
|
|
956
|
-
|
|
1166
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1167
|
+
}
|
|
1168
|
+
}, d = t2.showInstructions ?? true;
|
|
1169
|
+
return new n$1({
|
|
1170
|
+
options: t2.options,
|
|
1171
|
+
signal: t2.signal,
|
|
1172
|
+
input: t2.input,
|
|
1173
|
+
output: t2.output,
|
|
1174
|
+
initialValue: t2.initialValue,
|
|
1175
|
+
render() {
|
|
1176
|
+
const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1177
|
+
t2.output,
|
|
1178
|
+
t2.message,
|
|
1179
|
+
s,
|
|
1180
|
+
m2
|
|
1181
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1182
|
+
` : ""}${i2}
|
|
957
1183
|
`;
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
${
|
|
1184
|
+
switch (this.state) {
|
|
1185
|
+
case "submit": {
|
|
1186
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1187
|
+
t2.output,
|
|
1188
|
+
o(this.options[this.cursor], "selected"),
|
|
1189
|
+
r2
|
|
1190
|
+
);
|
|
1191
|
+
return `${u3}${a2}`;
|
|
1192
|
+
}
|
|
1193
|
+
case "cancel": {
|
|
1194
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1195
|
+
t2.output,
|
|
1196
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1197
|
+
r2
|
|
1198
|
+
);
|
|
1199
|
+
return `${u3}${a2}${n3 ? `
|
|
1200
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1201
|
+
}
|
|
1202
|
+
default: {
|
|
1203
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1204
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1205
|
+
`), f = p.length + 1;
|
|
1206
|
+
return `${u3}${r2}${limitOptions({
|
|
1207
|
+
output: t2.output,
|
|
1208
|
+
cursor: this.cursor,
|
|
1209
|
+
options: this.options,
|
|
1210
|
+
maxItems: t2.maxItems,
|
|
1211
|
+
columnPadding: r2.length,
|
|
1212
|
+
rowPadding: a2 + f,
|
|
1213
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1214
|
+
}).join(`
|
|
1215
|
+
${r2}`)}
|
|
1216
|
+
${b}
|
|
974
1217
|
`;
|
|
1218
|
+
}
|
|
975
1219
|
}
|
|
976
1220
|
}
|
|
977
|
-
}
|
|
1221
|
+
}).prompt();
|
|
978
1222
|
};
|
|
979
|
-
|
|
1223
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
980
1224
|
}
|
|
981
1225
|
});
|
|
982
1226
|
|
|
@@ -989,9 +1233,9 @@ function supportsColor() {
|
|
|
989
1233
|
}
|
|
990
1234
|
return process.stdout.isTTY === true;
|
|
991
1235
|
}
|
|
992
|
-
function colorize(
|
|
993
|
-
if (!supportsColor()) return
|
|
994
|
-
return `${color}${
|
|
1236
|
+
function colorize(text2, color) {
|
|
1237
|
+
if (!supportsColor()) return text2;
|
|
1238
|
+
return `${color}${text2}${colors.reset}`;
|
|
995
1239
|
}
|
|
996
1240
|
function stringify(value) {
|
|
997
1241
|
if (typeof value === "string") return value;
|
|
@@ -1021,7 +1265,7 @@ function stringify(value) {
|
|
|
1021
1265
|
function formatMessage(...args) {
|
|
1022
1266
|
return args.map(stringify).join(" ");
|
|
1023
1267
|
}
|
|
1024
|
-
var colors, currentLogLevel,
|
|
1268
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
1025
1269
|
var init_cli_output = __esm({
|
|
1026
1270
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1027
1271
|
"use strict";
|
|
@@ -1054,7 +1298,7 @@ var init_cli_output = __esm({
|
|
|
1054
1298
|
currentLogLevel = envLevel;
|
|
1055
1299
|
}
|
|
1056
1300
|
}
|
|
1057
|
-
|
|
1301
|
+
log2 = {
|
|
1058
1302
|
/**
|
|
1059
1303
|
* Logs an error message (always shows unless Quiet level)
|
|
1060
1304
|
* Uses clack's log.error + explicit red color
|
|
@@ -1062,7 +1306,7 @@ var init_cli_output = __esm({
|
|
|
1062
1306
|
error(...args) {
|
|
1063
1307
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
1064
1308
|
const message = formatMessage(...args);
|
|
1065
|
-
|
|
1309
|
+
log.error(colorize(message, colors.brightRed));
|
|
1066
1310
|
},
|
|
1067
1311
|
/**
|
|
1068
1312
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -1071,7 +1315,7 @@ var init_cli_output = __esm({
|
|
|
1071
1315
|
warn(...args) {
|
|
1072
1316
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1073
1317
|
const message = formatMessage(...args);
|
|
1074
|
-
|
|
1318
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
1075
1319
|
},
|
|
1076
1320
|
/**
|
|
1077
1321
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -1080,7 +1324,7 @@ var init_cli_output = __esm({
|
|
|
1080
1324
|
info(...args) {
|
|
1081
1325
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1082
1326
|
const message = formatMessage(...args);
|
|
1083
|
-
|
|
1327
|
+
log.info(colorize(message, colors.brightCyan));
|
|
1084
1328
|
},
|
|
1085
1329
|
/**
|
|
1086
1330
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -1089,7 +1333,7 @@ var init_cli_output = __esm({
|
|
|
1089
1333
|
success(...args) {
|
|
1090
1334
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
1091
1335
|
const message = formatMessage(...args);
|
|
1092
|
-
|
|
1336
|
+
log.success(colorize(message, colors.brightGreen));
|
|
1093
1337
|
},
|
|
1094
1338
|
/**
|
|
1095
1339
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -1098,7 +1342,7 @@ var init_cli_output = __esm({
|
|
|
1098
1342
|
debug(...args) {
|
|
1099
1343
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
1100
1344
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1101
|
-
|
|
1345
|
+
log.message(
|
|
1102
1346
|
colorize(
|
|
1103
1347
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
1104
1348
|
colors.gray
|
|
@@ -1112,7 +1356,7 @@ var init_cli_output = __esm({
|
|
|
1112
1356
|
trace(...args) {
|
|
1113
1357
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1114
1358
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1115
|
-
|
|
1359
|
+
log.message(
|
|
1116
1360
|
colorize(
|
|
1117
1361
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1118
1362
|
colors.gray
|
|
@@ -1120,10 +1364,10 @@ var init_cli_output = __esm({
|
|
|
1120
1364
|
);
|
|
1121
1365
|
}
|
|
1122
1366
|
};
|
|
1123
|
-
error =
|
|
1124
|
-
warn =
|
|
1125
|
-
info =
|
|
1126
|
-
success =
|
|
1367
|
+
error = log2.error.bind(log2);
|
|
1368
|
+
warn = log2.warn.bind(log2);
|
|
1369
|
+
info = log2.info.bind(log2);
|
|
1370
|
+
success = log2.success.bind(log2);
|
|
1127
1371
|
}
|
|
1128
1372
|
});
|
|
1129
1373
|
|
|
@@ -1483,9 +1727,9 @@ var require_is_glob = __commonJS({
|
|
|
1483
1727
|
index += 2;
|
|
1484
1728
|
var close = chars[open];
|
|
1485
1729
|
if (close) {
|
|
1486
|
-
var
|
|
1487
|
-
if (
|
|
1488
|
-
index =
|
|
1730
|
+
var n3 = str.indexOf(close, index);
|
|
1731
|
+
if (n3 !== -1) {
|
|
1732
|
+
index = n3 + 1;
|
|
1489
1733
|
}
|
|
1490
1734
|
}
|
|
1491
1735
|
if (str[index] === "!") {
|
|
@@ -1511,9 +1755,9 @@ var require_is_glob = __commonJS({
|
|
|
1511
1755
|
index += 2;
|
|
1512
1756
|
var close = chars[open];
|
|
1513
1757
|
if (close) {
|
|
1514
|
-
var
|
|
1515
|
-
if (
|
|
1516
|
-
index =
|
|
1758
|
+
var n3 = str.indexOf(close, index);
|
|
1759
|
+
if (n3 !== -1) {
|
|
1760
|
+
index = n3 + 1;
|
|
1517
1761
|
}
|
|
1518
1762
|
}
|
|
1519
1763
|
if (str[index] === "!") {
|
|
@@ -1591,8 +1835,8 @@ var require_utils = __commonJS({
|
|
|
1591
1835
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1592
1836
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1593
1837
|
};
|
|
1594
|
-
exports.escapeNode = (
|
|
1595
|
-
const node =
|
|
1838
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1839
|
+
const node = block2.nodes[n3];
|
|
1596
1840
|
if (!node) return;
|
|
1597
1841
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1598
1842
|
if (node.escaped !== true) {
|
|
@@ -1609,15 +1853,15 @@ var require_utils = __commonJS({
|
|
|
1609
1853
|
}
|
|
1610
1854
|
return false;
|
|
1611
1855
|
};
|
|
1612
|
-
exports.isInvalidBrace = (
|
|
1613
|
-
if (
|
|
1614
|
-
if (
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1856
|
+
exports.isInvalidBrace = (block2) => {
|
|
1857
|
+
if (block2.type !== "brace") return false;
|
|
1858
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1859
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1860
|
+
block2.invalid = true;
|
|
1617
1861
|
return true;
|
|
1618
1862
|
}
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1863
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1864
|
+
block2.invalid = true;
|
|
1621
1865
|
return true;
|
|
1622
1866
|
}
|
|
1623
1867
|
return false;
|
|
@@ -1636,8 +1880,8 @@ var require_utils = __commonJS({
|
|
|
1636
1880
|
exports.flatten = (...args) => {
|
|
1637
1881
|
const result = [];
|
|
1638
1882
|
const flat = (arr) => {
|
|
1639
|
-
for (let
|
|
1640
|
-
const ele = arr[
|
|
1883
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1884
|
+
const ele = arr[i2];
|
|
1641
1885
|
if (Array.isArray(ele)) {
|
|
1642
1886
|
flat(ele);
|
|
1643
1887
|
continue;
|
|
@@ -1731,9 +1975,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1731
1975
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1732
1976
|
return toRegexRange.cache[cacheKey].result;
|
|
1733
1977
|
}
|
|
1734
|
-
let
|
|
1978
|
+
let a2 = Math.min(min, max);
|
|
1735
1979
|
let b = Math.max(min, max);
|
|
1736
|
-
if (Math.abs(
|
|
1980
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1737
1981
|
let result = min + "|" + max;
|
|
1738
1982
|
if (opts.capture) {
|
|
1739
1983
|
return `(${result})`;
|
|
@@ -1744,20 +1988,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1744
1988
|
return `(?:${result})`;
|
|
1745
1989
|
}
|
|
1746
1990
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1747
|
-
let state = { min, max, a, b };
|
|
1991
|
+
let state = { min, max, a: a2, b };
|
|
1748
1992
|
let positives = [];
|
|
1749
1993
|
let negatives = [];
|
|
1750
1994
|
if (isPadded) {
|
|
1751
1995
|
state.isPadded = isPadded;
|
|
1752
1996
|
state.maxLen = String(state.max).length;
|
|
1753
1997
|
}
|
|
1754
|
-
if (
|
|
1998
|
+
if (a2 < 0) {
|
|
1755
1999
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1756
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1757
|
-
|
|
2000
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
2001
|
+
a2 = state.a = 0;
|
|
1758
2002
|
}
|
|
1759
2003
|
if (b >= 0) {
|
|
1760
|
-
positives = splitToPatterns(
|
|
2004
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1761
2005
|
}
|
|
1762
2006
|
state.negatives = negatives;
|
|
1763
2007
|
state.positives = positives;
|
|
@@ -1805,8 +2049,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1805
2049
|
let digits = zipped.length;
|
|
1806
2050
|
let pattern = "";
|
|
1807
2051
|
let count = 0;
|
|
1808
|
-
for (let
|
|
1809
|
-
let [startDigit, stopDigit] = zipped[
|
|
2052
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
2053
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1810
2054
|
if (startDigit === stopDigit) {
|
|
1811
2055
|
pattern += startDigit;
|
|
1812
2056
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1825,8 +2069,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1825
2069
|
let tokens = [];
|
|
1826
2070
|
let start = min;
|
|
1827
2071
|
let prev;
|
|
1828
|
-
for (let
|
|
1829
|
-
let max2 = ranges[
|
|
2072
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
2073
|
+
let max2 = ranges[i2];
|
|
1830
2074
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1831
2075
|
let zeros = "";
|
|
1832
2076
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1861,13 +2105,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1861
2105
|
}
|
|
1862
2106
|
return result;
|
|
1863
2107
|
}
|
|
1864
|
-
function zip(
|
|
2108
|
+
function zip(a2, b) {
|
|
1865
2109
|
let arr = [];
|
|
1866
|
-
for (let
|
|
2110
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1867
2111
|
return arr;
|
|
1868
2112
|
}
|
|
1869
|
-
function compare(
|
|
1870
|
-
return
|
|
2113
|
+
function compare(a2, b) {
|
|
2114
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1871
2115
|
}
|
|
1872
2116
|
function contains(arr, key, val) {
|
|
1873
2117
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1885,8 +2129,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1885
2129
|
}
|
|
1886
2130
|
return "";
|
|
1887
2131
|
}
|
|
1888
|
-
function toCharacterClass(
|
|
1889
|
-
return `[${
|
|
2132
|
+
function toCharacterClass(a2, b, options) {
|
|
2133
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1890
2134
|
}
|
|
1891
2135
|
function hasPadding(str) {
|
|
1892
2136
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1965,8 +2209,8 @@ var require_fill_range = __commonJS({
|
|
|
1965
2209
|
return negative ? "-" + input : input;
|
|
1966
2210
|
};
|
|
1967
2211
|
var toSequence = (parts, options, maxLen) => {
|
|
1968
|
-
parts.negatives.sort((
|
|
1969
|
-
parts.positives.sort((
|
|
2212
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2213
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
1970
2214
|
let prefix = options.capture ? "" : "?:";
|
|
1971
2215
|
let positives = "";
|
|
1972
2216
|
let negatives = "";
|
|
@@ -1987,12 +2231,12 @@ var require_fill_range = __commonJS({
|
|
|
1987
2231
|
}
|
|
1988
2232
|
return result;
|
|
1989
2233
|
};
|
|
1990
|
-
var toRange = (
|
|
2234
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
1991
2235
|
if (isNumbers) {
|
|
1992
|
-
return toRegexRange(
|
|
2236
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
1993
2237
|
}
|
|
1994
|
-
let start = String.fromCharCode(
|
|
1995
|
-
if (
|
|
2238
|
+
let start = String.fromCharCode(a2);
|
|
2239
|
+
if (a2 === b) return start;
|
|
1996
2240
|
let stop = String.fromCharCode(b);
|
|
1997
2241
|
return `[${start}-${stop}]`;
|
|
1998
2242
|
};
|
|
@@ -2018,15 +2262,15 @@ var require_fill_range = __commonJS({
|
|
|
2018
2262
|
return [];
|
|
2019
2263
|
};
|
|
2020
2264
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
2021
|
-
let
|
|
2265
|
+
let a2 = Number(start);
|
|
2022
2266
|
let b = Number(end);
|
|
2023
|
-
if (!Number.isInteger(
|
|
2267
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
2024
2268
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
2025
2269
|
return [];
|
|
2026
2270
|
}
|
|
2027
|
-
if (
|
|
2271
|
+
if (a2 === 0) a2 = 0;
|
|
2028
2272
|
if (b === 0) b = 0;
|
|
2029
|
-
let descending =
|
|
2273
|
+
let descending = a2 > b;
|
|
2030
2274
|
let startString = String(start);
|
|
2031
2275
|
let endString = String(end);
|
|
2032
2276
|
let stepString = String(step);
|
|
@@ -2042,13 +2286,13 @@ var require_fill_range = __commonJS({
|
|
|
2042
2286
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
2043
2287
|
let range = [];
|
|
2044
2288
|
let index = 0;
|
|
2045
|
-
while (descending ?
|
|
2289
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2046
2290
|
if (options.toRegex === true && step > 1) {
|
|
2047
|
-
push(
|
|
2291
|
+
push(a2);
|
|
2048
2292
|
} else {
|
|
2049
|
-
range.push(pad(format(
|
|
2293
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
2050
2294
|
}
|
|
2051
|
-
|
|
2295
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2052
2296
|
index++;
|
|
2053
2297
|
}
|
|
2054
2298
|
if (options.toRegex === true) {
|
|
@@ -2061,19 +2305,19 @@ var require_fill_range = __commonJS({
|
|
|
2061
2305
|
return invalidRange(start, end, options);
|
|
2062
2306
|
}
|
|
2063
2307
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
2064
|
-
let
|
|
2308
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
2065
2309
|
let b = `${end}`.charCodeAt(0);
|
|
2066
|
-
let descending =
|
|
2067
|
-
let min = Math.min(
|
|
2068
|
-
let max = Math.max(
|
|
2310
|
+
let descending = a2 > b;
|
|
2311
|
+
let min = Math.min(a2, b);
|
|
2312
|
+
let max = Math.max(a2, b);
|
|
2069
2313
|
if (options.toRegex && step === 1) {
|
|
2070
2314
|
return toRange(min, max, false, options);
|
|
2071
2315
|
}
|
|
2072
2316
|
let range = [];
|
|
2073
2317
|
let index = 0;
|
|
2074
|
-
while (descending ?
|
|
2075
|
-
range.push(format(
|
|
2076
|
-
|
|
2318
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2319
|
+
range.push(format(a2, index));
|
|
2320
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
2077
2321
|
index++;
|
|
2078
2322
|
}
|
|
2079
2323
|
if (options.toRegex === true) {
|
|
@@ -2196,18 +2440,18 @@ var require_expand = __commonJS({
|
|
|
2196
2440
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2197
2441
|
const walk = (node, parent = {}) => {
|
|
2198
2442
|
node.queue = [];
|
|
2199
|
-
let
|
|
2200
|
-
let
|
|
2201
|
-
while (
|
|
2202
|
-
|
|
2203
|
-
|
|
2443
|
+
let p = parent;
|
|
2444
|
+
let q = parent.queue;
|
|
2445
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2446
|
+
p = p.parent;
|
|
2447
|
+
q = p.queue;
|
|
2204
2448
|
}
|
|
2205
2449
|
if (node.invalid || node.dollar) {
|
|
2206
|
-
|
|
2450
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2207
2451
|
return;
|
|
2208
2452
|
}
|
|
2209
2453
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2210
|
-
|
|
2454
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2211
2455
|
return;
|
|
2212
2456
|
}
|
|
2213
2457
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2219,26 +2463,26 @@ var require_expand = __commonJS({
|
|
|
2219
2463
|
if (range.length === 0) {
|
|
2220
2464
|
range = stringify2(node, options);
|
|
2221
2465
|
}
|
|
2222
|
-
|
|
2466
|
+
q.push(append(q.pop(), range));
|
|
2223
2467
|
node.nodes = [];
|
|
2224
2468
|
return;
|
|
2225
2469
|
}
|
|
2226
2470
|
const enclose = utils.encloseBrace(node);
|
|
2227
2471
|
let queue = node.queue;
|
|
2228
|
-
let
|
|
2229
|
-
while (
|
|
2230
|
-
|
|
2231
|
-
queue =
|
|
2472
|
+
let block2 = node;
|
|
2473
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2474
|
+
block2 = block2.parent;
|
|
2475
|
+
queue = block2.queue;
|
|
2232
2476
|
}
|
|
2233
|
-
for (let
|
|
2234
|
-
const child = node.nodes[
|
|
2477
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2478
|
+
const child = node.nodes[i2];
|
|
2235
2479
|
if (child.type === "comma" && node.type === "brace") {
|
|
2236
|
-
if (
|
|
2480
|
+
if (i2 === 1) queue.push("");
|
|
2237
2481
|
queue.push("");
|
|
2238
2482
|
continue;
|
|
2239
2483
|
}
|
|
2240
2484
|
if (child.type === "close") {
|
|
2241
|
-
|
|
2485
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2242
2486
|
continue;
|
|
2243
2487
|
}
|
|
2244
2488
|
if (child.value && child.type !== "open") {
|
|
@@ -2405,7 +2649,7 @@ var require_parse = __commonJS({
|
|
|
2405
2649
|
}
|
|
2406
2650
|
const ast = { type: "root", input, nodes: [] };
|
|
2407
2651
|
const stack = [ast];
|
|
2408
|
-
let
|
|
2652
|
+
let block2 = ast;
|
|
2409
2653
|
let prev = ast;
|
|
2410
2654
|
let brackets = 0;
|
|
2411
2655
|
const length = input.length;
|
|
@@ -2421,15 +2665,15 @@ var require_parse = __commonJS({
|
|
|
2421
2665
|
prev.value += node.value;
|
|
2422
2666
|
return;
|
|
2423
2667
|
}
|
|
2424
|
-
|
|
2425
|
-
node.parent =
|
|
2668
|
+
block2.nodes.push(node);
|
|
2669
|
+
node.parent = block2;
|
|
2426
2670
|
node.prev = prev;
|
|
2427
2671
|
prev = node;
|
|
2428
2672
|
return node;
|
|
2429
2673
|
};
|
|
2430
2674
|
push({ type: "bos" });
|
|
2431
2675
|
while (index < length) {
|
|
2432
|
-
|
|
2676
|
+
block2 = stack[stack.length - 1];
|
|
2433
2677
|
value = advance();
|
|
2434
2678
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2435
2679
|
continue;
|
|
@@ -2466,19 +2710,19 @@ var require_parse = __commonJS({
|
|
|
2466
2710
|
continue;
|
|
2467
2711
|
}
|
|
2468
2712
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2469
|
-
|
|
2470
|
-
stack.push(
|
|
2713
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2714
|
+
stack.push(block2);
|
|
2471
2715
|
push({ type: "text", value });
|
|
2472
2716
|
continue;
|
|
2473
2717
|
}
|
|
2474
2718
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2475
|
-
if (
|
|
2719
|
+
if (block2.type !== "paren") {
|
|
2476
2720
|
push({ type: "text", value });
|
|
2477
2721
|
continue;
|
|
2478
2722
|
}
|
|
2479
|
-
|
|
2723
|
+
block2 = stack.pop();
|
|
2480
2724
|
push({ type: "text", value });
|
|
2481
|
-
|
|
2725
|
+
block2 = stack[stack.length - 1];
|
|
2482
2726
|
continue;
|
|
2483
2727
|
}
|
|
2484
2728
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2503,7 +2747,7 @@ var require_parse = __commonJS({
|
|
|
2503
2747
|
}
|
|
2504
2748
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2505
2749
|
depth++;
|
|
2506
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2750
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2507
2751
|
const brace = {
|
|
2508
2752
|
type: "brace",
|
|
2509
2753
|
open: true,
|
|
@@ -2514,52 +2758,52 @@ var require_parse = __commonJS({
|
|
|
2514
2758
|
ranges: 0,
|
|
2515
2759
|
nodes: []
|
|
2516
2760
|
};
|
|
2517
|
-
|
|
2518
|
-
stack.push(
|
|
2761
|
+
block2 = push(brace);
|
|
2762
|
+
stack.push(block2);
|
|
2519
2763
|
push({ type: "open", value });
|
|
2520
2764
|
continue;
|
|
2521
2765
|
}
|
|
2522
2766
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2523
|
-
if (
|
|
2767
|
+
if (block2.type !== "brace") {
|
|
2524
2768
|
push({ type: "text", value });
|
|
2525
2769
|
continue;
|
|
2526
2770
|
}
|
|
2527
2771
|
const type = "close";
|
|
2528
|
-
|
|
2529
|
-
|
|
2772
|
+
block2 = stack.pop();
|
|
2773
|
+
block2.close = true;
|
|
2530
2774
|
push({ type, value });
|
|
2531
2775
|
depth--;
|
|
2532
|
-
|
|
2776
|
+
block2 = stack[stack.length - 1];
|
|
2533
2777
|
continue;
|
|
2534
2778
|
}
|
|
2535
2779
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2536
|
-
if (
|
|
2537
|
-
|
|
2538
|
-
const open =
|
|
2539
|
-
|
|
2780
|
+
if (block2.ranges > 0) {
|
|
2781
|
+
block2.ranges = 0;
|
|
2782
|
+
const open = block2.nodes.shift();
|
|
2783
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2540
2784
|
}
|
|
2541
2785
|
push({ type: "comma", value });
|
|
2542
|
-
|
|
2786
|
+
block2.commas++;
|
|
2543
2787
|
continue;
|
|
2544
2788
|
}
|
|
2545
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2546
|
-
const siblings =
|
|
2789
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2790
|
+
const siblings = block2.nodes;
|
|
2547
2791
|
if (depth === 0 || siblings.length === 0) {
|
|
2548
2792
|
push({ type: "text", value });
|
|
2549
2793
|
continue;
|
|
2550
2794
|
}
|
|
2551
2795
|
if (prev.type === "dot") {
|
|
2552
|
-
|
|
2796
|
+
block2.range = [];
|
|
2553
2797
|
prev.value += value;
|
|
2554
2798
|
prev.type = "range";
|
|
2555
|
-
if (
|
|
2556
|
-
|
|
2557
|
-
|
|
2799
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2800
|
+
block2.invalid = true;
|
|
2801
|
+
block2.ranges = 0;
|
|
2558
2802
|
prev.type = "text";
|
|
2559
2803
|
continue;
|
|
2560
2804
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2805
|
+
block2.ranges++;
|
|
2806
|
+
block2.args = [];
|
|
2563
2807
|
continue;
|
|
2564
2808
|
}
|
|
2565
2809
|
if (prev.type === "range") {
|
|
@@ -2567,7 +2811,7 @@ var require_parse = __commonJS({
|
|
|
2567
2811
|
const before = siblings[siblings.length - 1];
|
|
2568
2812
|
before.value += prev.value + value;
|
|
2569
2813
|
prev = before;
|
|
2570
|
-
|
|
2814
|
+
block2.ranges--;
|
|
2571
2815
|
continue;
|
|
2572
2816
|
}
|
|
2573
2817
|
push({ type: "dot", value });
|
|
@@ -2576,9 +2820,9 @@ var require_parse = __commonJS({
|
|
|
2576
2820
|
push({ type: "text", value });
|
|
2577
2821
|
}
|
|
2578
2822
|
do {
|
|
2579
|
-
|
|
2580
|
-
if (
|
|
2581
|
-
|
|
2823
|
+
block2 = stack.pop();
|
|
2824
|
+
if (block2.type !== "root") {
|
|
2825
|
+
block2.nodes.forEach((node) => {
|
|
2582
2826
|
if (!node.nodes) {
|
|
2583
2827
|
if (node.type === "open") node.isOpen = true;
|
|
2584
2828
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2587,8 +2831,8 @@ var require_parse = __commonJS({
|
|
|
2587
2831
|
}
|
|
2588
2832
|
});
|
|
2589
2833
|
const parent = stack[stack.length - 1];
|
|
2590
|
-
const index2 = parent.nodes.indexOf(
|
|
2591
|
-
parent.nodes.splice(index2, 1, ...
|
|
2834
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2835
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2592
2836
|
}
|
|
2593
2837
|
} while (stack.length > 0);
|
|
2594
2838
|
push({ type: "eos" });
|
|
@@ -3221,9 +3465,9 @@ var require_scan = __commonJS({
|
|
|
3221
3465
|
if (opts.parts === true || opts.tokens === true) {
|
|
3222
3466
|
let prevIndex;
|
|
3223
3467
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3224
|
-
const
|
|
3225
|
-
const
|
|
3226
|
-
const value = input.slice(
|
|
3468
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3469
|
+
const i2 = slashes[idx];
|
|
3470
|
+
const value = input.slice(n3, i2);
|
|
3227
3471
|
if (opts.tokens) {
|
|
3228
3472
|
if (idx === 0 && start !== 0) {
|
|
3229
3473
|
tokens[idx].isPrefix = true;
|
|
@@ -3237,7 +3481,7 @@ var require_scan = __commonJS({
|
|
|
3237
3481
|
if (idx !== 0 || value !== "") {
|
|
3238
3482
|
parts.push(value);
|
|
3239
3483
|
}
|
|
3240
|
-
prevIndex =
|
|
3484
|
+
prevIndex = i2;
|
|
3241
3485
|
}
|
|
3242
3486
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3243
3487
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3366,15 +3610,15 @@ var require_parse2 = __commonJS({
|
|
|
3366
3610
|
};
|
|
3367
3611
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3368
3612
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3369
|
-
for (let
|
|
3370
|
-
for (let
|
|
3371
|
-
const
|
|
3372
|
-
const b = values[
|
|
3373
|
-
const char =
|
|
3374
|
-
if (!char ||
|
|
3613
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3614
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3615
|
+
const a2 = values[i2];
|
|
3616
|
+
const b = values[j];
|
|
3617
|
+
const char = a2[0];
|
|
3618
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3375
3619
|
continue;
|
|
3376
3620
|
}
|
|
3377
|
-
if (
|
|
3621
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3378
3622
|
return true;
|
|
3379
3623
|
}
|
|
3380
3624
|
}
|
|
@@ -3389,8 +3633,8 @@ var require_parse2 = __commonJS({
|
|
|
3389
3633
|
let paren = 0;
|
|
3390
3634
|
let quote = 0;
|
|
3391
3635
|
let escaped = false;
|
|
3392
|
-
for (let
|
|
3393
|
-
const ch = pattern[
|
|
3636
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3637
|
+
const ch = pattern[i2];
|
|
3394
3638
|
if (escaped === true) {
|
|
3395
3639
|
escaped = false;
|
|
3396
3640
|
continue;
|
|
@@ -3424,13 +3668,13 @@ var require_parse2 = __commonJS({
|
|
|
3424
3668
|
if (ch === ")") {
|
|
3425
3669
|
paren--;
|
|
3426
3670
|
if (paren === 0) {
|
|
3427
|
-
if (requireEnd === true &&
|
|
3671
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3428
3672
|
return;
|
|
3429
3673
|
}
|
|
3430
3674
|
return {
|
|
3431
3675
|
type: pattern[0],
|
|
3432
|
-
body: pattern.slice(2,
|
|
3433
|
-
end:
|
|
3676
|
+
body: pattern.slice(2, i2),
|
|
3677
|
+
end: i2
|
|
3434
3678
|
};
|
|
3435
3679
|
}
|
|
3436
3680
|
}
|
|
@@ -3562,7 +3806,7 @@ var require_parse2 = __commonJS({
|
|
|
3562
3806
|
let prev = bos;
|
|
3563
3807
|
let value;
|
|
3564
3808
|
const eos = () => state.index === len - 1;
|
|
3565
|
-
const peek = state.peek = (
|
|
3809
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3566
3810
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3567
3811
|
const remaining = () => input.slice(state.index + 1);
|
|
3568
3812
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3643,10 +3887,10 @@ var require_parse2 = __commonJS({
|
|
|
3643
3887
|
open.type = "text";
|
|
3644
3888
|
open.value = literal;
|
|
3645
3889
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3646
|
-
for (let
|
|
3647
|
-
tokens[
|
|
3648
|
-
tokens[
|
|
3649
|
-
delete tokens[
|
|
3890
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3891
|
+
tokens[i2].value = "";
|
|
3892
|
+
tokens[i2].output = "";
|
|
3893
|
+
delete tokens[i2].suffix;
|
|
3650
3894
|
}
|
|
3651
3895
|
state.output = token.output + open.output;
|
|
3652
3896
|
state.backtrack = true;
|
|
@@ -3677,10 +3921,10 @@ var require_parse2 = __commonJS({
|
|
|
3677
3921
|
};
|
|
3678
3922
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
3679
3923
|
let backslashes = false;
|
|
3680
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
3924
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
|
|
3681
3925
|
if (first === "\\") {
|
|
3682
3926
|
backslashes = true;
|
|
3683
|
-
return
|
|
3927
|
+
return m2;
|
|
3684
3928
|
}
|
|
3685
3929
|
if (first === "?") {
|
|
3686
3930
|
if (esc) {
|
|
@@ -3700,14 +3944,14 @@ var require_parse2 = __commonJS({
|
|
|
3700
3944
|
}
|
|
3701
3945
|
return star;
|
|
3702
3946
|
}
|
|
3703
|
-
return esc ?
|
|
3947
|
+
return esc ? m2 : `\\${m2}`;
|
|
3704
3948
|
});
|
|
3705
3949
|
if (backslashes === true) {
|
|
3706
3950
|
if (opts.unescape === true) {
|
|
3707
3951
|
output = output.replace(/\\/g, "");
|
|
3708
3952
|
} else {
|
|
3709
|
-
output = output.replace(/\\+/g, (
|
|
3710
|
-
return
|
|
3953
|
+
output = output.replace(/\\+/g, (m2) => {
|
|
3954
|
+
return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
|
|
3711
3955
|
});
|
|
3712
3956
|
}
|
|
3713
3957
|
}
|
|
@@ -3889,13 +4133,13 @@ var require_parse2 = __commonJS({
|
|
|
3889
4133
|
if (brace.dots === true) {
|
|
3890
4134
|
const arr = tokens.slice();
|
|
3891
4135
|
const range = [];
|
|
3892
|
-
for (let
|
|
4136
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3893
4137
|
tokens.pop();
|
|
3894
|
-
if (arr[
|
|
4138
|
+
if (arr[i2].type === "brace") {
|
|
3895
4139
|
break;
|
|
3896
4140
|
}
|
|
3897
|
-
if (arr[
|
|
3898
|
-
range.unshift(arr[
|
|
4141
|
+
if (arr[i2].type !== "dots") {
|
|
4142
|
+
range.unshift(arr[i2].value);
|
|
3899
4143
|
}
|
|
3900
4144
|
}
|
|
3901
4145
|
output = expandRange(range, opts);
|
|
@@ -4354,7 +4598,7 @@ var require_picomatch = __commonJS({
|
|
|
4354
4598
|
};
|
|
4355
4599
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4356
4600
|
picomatch.parse = (pattern, options) => {
|
|
4357
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4601
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4358
4602
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4359
4603
|
};
|
|
4360
4604
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4438,8 +4682,8 @@ var require_micromatch = __commonJS({
|
|
|
4438
4682
|
options.onResult(state);
|
|
4439
4683
|
}
|
|
4440
4684
|
};
|
|
4441
|
-
for (let
|
|
4442
|
-
let isMatch = picomatch(String(patterns[
|
|
4685
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4686
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4443
4687
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4444
4688
|
if (negated) negatives++;
|
|
4445
4689
|
for (let item of list) {
|
|
@@ -4461,7 +4705,7 @@ var require_micromatch = __commonJS({
|
|
|
4461
4705
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4462
4706
|
}
|
|
4463
4707
|
if (options.nonull === true || options.nullglob === true) {
|
|
4464
|
-
return options.unescape ? patterns.map((
|
|
4708
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4465
4709
|
}
|
|
4466
4710
|
}
|
|
4467
4711
|
return matches;
|
|
@@ -4491,7 +4735,7 @@ var require_micromatch = __commonJS({
|
|
|
4491
4735
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4492
4736
|
}
|
|
4493
4737
|
if (Array.isArray(pattern)) {
|
|
4494
|
-
return pattern.some((
|
|
4738
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4495
4739
|
}
|
|
4496
4740
|
if (typeof pattern === "string") {
|
|
4497
4741
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4536,7 +4780,7 @@ var require_micromatch = __commonJS({
|
|
|
4536
4780
|
if (typeof str !== "string") {
|
|
4537
4781
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4538
4782
|
}
|
|
4539
|
-
return [].concat(patterns).every((
|
|
4783
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4540
4784
|
};
|
|
4541
4785
|
micromatch.capture = (glob, input, options) => {
|
|
4542
4786
|
let posix = utils.isWindows(options);
|
|
@@ -4687,7 +4931,7 @@ var require_pattern = __commonJS({
|
|
|
4687
4931
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4688
4932
|
function expandBraceExpansion(pattern) {
|
|
4689
4933
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4690
|
-
patterns.sort((
|
|
4934
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4691
4935
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4692
4936
|
}
|
|
4693
4937
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4768,8 +5012,8 @@ var require_merge2 = __commonJS({
|
|
|
4768
5012
|
}
|
|
4769
5013
|
const mergedStream = PassThrough(options);
|
|
4770
5014
|
function addStream() {
|
|
4771
|
-
for (let
|
|
4772
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
5015
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
5016
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4773
5017
|
}
|
|
4774
5018
|
mergeStream();
|
|
4775
5019
|
return this;
|
|
@@ -4818,8 +5062,8 @@ var require_merge2 = __commonJS({
|
|
|
4818
5062
|
stream.pipe(mergedStream, { end: false });
|
|
4819
5063
|
stream.resume();
|
|
4820
5064
|
}
|
|
4821
|
-
for (let
|
|
4822
|
-
pipe(streams[
|
|
5065
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
5066
|
+
pipe(streams[i2]);
|
|
4823
5067
|
}
|
|
4824
5068
|
next();
|
|
4825
5069
|
}
|
|
@@ -4850,8 +5094,8 @@ var require_merge2 = __commonJS({
|
|
|
4850
5094
|
}
|
|
4851
5095
|
streams.pause();
|
|
4852
5096
|
} else {
|
|
4853
|
-
for (let
|
|
4854
|
-
streams[
|
|
5097
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
5098
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4855
5099
|
}
|
|
4856
5100
|
}
|
|
4857
5101
|
return streams;
|
|
@@ -4933,13 +5177,13 @@ var require_tasks = __commonJS({
|
|
|
4933
5177
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4934
5178
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4935
5179
|
var utils = require_utils3();
|
|
4936
|
-
function generate(input,
|
|
4937
|
-
const patterns = processPatterns(input,
|
|
4938
|
-
const ignore = processPatterns(
|
|
5180
|
+
function generate(input, settings2) {
|
|
5181
|
+
const patterns = processPatterns(input, settings2);
|
|
5182
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4939
5183
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4940
5184
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4941
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4942
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5185
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5186
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4943
5187
|
const staticTasks = convertPatternsToTasks(
|
|
4944
5188
|
staticPatterns,
|
|
4945
5189
|
negativePatterns,
|
|
@@ -4955,12 +5199,12 @@ var require_tasks = __commonJS({
|
|
|
4955
5199
|
return staticTasks.concat(dynamicTasks);
|
|
4956
5200
|
}
|
|
4957
5201
|
exports.generate = generate;
|
|
4958
|
-
function processPatterns(input,
|
|
5202
|
+
function processPatterns(input, settings2) {
|
|
4959
5203
|
let patterns = input;
|
|
4960
|
-
if (
|
|
5204
|
+
if (settings2.braceExpansion) {
|
|
4961
5205
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
4962
5206
|
}
|
|
4963
|
-
if (
|
|
5207
|
+
if (settings2.baseNameMatch) {
|
|
4964
5208
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
4965
5209
|
}
|
|
4966
5210
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -4991,7 +5235,7 @@ var require_tasks = __commonJS({
|
|
|
4991
5235
|
}
|
|
4992
5236
|
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
|
4993
5237
|
function groupPatternsByBaseDirectory(patterns) {
|
|
4994
|
-
const
|
|
5238
|
+
const group2 = {};
|
|
4995
5239
|
return patterns.reduce((collection, pattern) => {
|
|
4996
5240
|
const base = utils.pattern.getBaseDirectory(pattern);
|
|
4997
5241
|
if (base in collection) {
|
|
@@ -5000,7 +5244,7 @@ var require_tasks = __commonJS({
|
|
|
5000
5244
|
collection[base] = [pattern];
|
|
5001
5245
|
}
|
|
5002
5246
|
return collection;
|
|
5003
|
-
},
|
|
5247
|
+
}, group2);
|
|
5004
5248
|
}
|
|
5005
5249
|
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
5006
5250
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
@@ -5029,26 +5273,26 @@ var require_async = __commonJS({
|
|
|
5029
5273
|
init_utils2();
|
|
5030
5274
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5031
5275
|
exports.read = void 0;
|
|
5032
|
-
function read(path,
|
|
5033
|
-
|
|
5276
|
+
function read(path, settings2, callback) {
|
|
5277
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
5034
5278
|
if (lstatError !== null) {
|
|
5035
5279
|
callFailureCallback(callback, lstatError);
|
|
5036
5280
|
return;
|
|
5037
5281
|
}
|
|
5038
|
-
if (!lstat.isSymbolicLink() || !
|
|
5282
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5039
5283
|
callSuccessCallback(callback, lstat);
|
|
5040
5284
|
return;
|
|
5041
5285
|
}
|
|
5042
|
-
|
|
5286
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
5043
5287
|
if (statError !== null) {
|
|
5044
|
-
if (
|
|
5288
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5045
5289
|
callFailureCallback(callback, statError);
|
|
5046
5290
|
return;
|
|
5047
5291
|
}
|
|
5048
5292
|
callSuccessCallback(callback, lstat);
|
|
5049
5293
|
return;
|
|
5050
5294
|
}
|
|
5051
|
-
if (
|
|
5295
|
+
if (settings2.markSymbolicLink) {
|
|
5052
5296
|
stat.isSymbolicLink = () => true;
|
|
5053
5297
|
}
|
|
5054
5298
|
callSuccessCallback(callback, stat);
|
|
@@ -5072,19 +5316,19 @@ var require_sync = __commonJS({
|
|
|
5072
5316
|
init_utils2();
|
|
5073
5317
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5074
5318
|
exports.read = void 0;
|
|
5075
|
-
function read(path,
|
|
5076
|
-
const lstat =
|
|
5077
|
-
if (!lstat.isSymbolicLink() || !
|
|
5319
|
+
function read(path, settings2) {
|
|
5320
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5321
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
5078
5322
|
return lstat;
|
|
5079
5323
|
}
|
|
5080
5324
|
try {
|
|
5081
|
-
const stat =
|
|
5082
|
-
if (
|
|
5325
|
+
const stat = settings2.fs.statSync(path);
|
|
5326
|
+
if (settings2.markSymbolicLink) {
|
|
5083
5327
|
stat.isSymbolicLink = () => true;
|
|
5084
5328
|
}
|
|
5085
5329
|
return stat;
|
|
5086
5330
|
} catch (error2) {
|
|
5087
|
-
if (!
|
|
5331
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5088
5332
|
return lstat;
|
|
5089
5333
|
}
|
|
5090
5334
|
throw error2;
|
|
@@ -5161,8 +5405,8 @@ var require_out = __commonJS({
|
|
|
5161
5405
|
}
|
|
5162
5406
|
exports.stat = stat;
|
|
5163
5407
|
function statSync3(path, optionsOrSettings) {
|
|
5164
|
-
const
|
|
5165
|
-
return sync.read(path,
|
|
5408
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5409
|
+
return sync.read(path, settings2);
|
|
5166
5410
|
}
|
|
5167
5411
|
exports.statSync = statSync3;
|
|
5168
5412
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5210,8 +5454,8 @@ var require_run_parallel = __commonJS({
|
|
|
5210
5454
|
if (isSync) queueMicrotask2(end);
|
|
5211
5455
|
else end();
|
|
5212
5456
|
}
|
|
5213
|
-
function each(
|
|
5214
|
-
results[
|
|
5457
|
+
function each(i2, err, result) {
|
|
5458
|
+
results[i2] = result;
|
|
5215
5459
|
if (--pending === 0 || err) {
|
|
5216
5460
|
done(err);
|
|
5217
5461
|
}
|
|
@@ -5225,9 +5469,9 @@ var require_run_parallel = __commonJS({
|
|
|
5225
5469
|
});
|
|
5226
5470
|
});
|
|
5227
5471
|
} else {
|
|
5228
|
-
tasks.forEach(function(task,
|
|
5472
|
+
tasks.forEach(function(task, i2) {
|
|
5229
5473
|
task(function(err, result) {
|
|
5230
|
-
each(
|
|
5474
|
+
each(i2, err, result);
|
|
5231
5475
|
});
|
|
5232
5476
|
});
|
|
5233
5477
|
}
|
|
@@ -5302,11 +5546,11 @@ var require_common = __commonJS({
|
|
|
5302
5546
|
init_utils2();
|
|
5303
5547
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5304
5548
|
exports.joinPathSegments = void 0;
|
|
5305
|
-
function joinPathSegments(
|
|
5306
|
-
if (
|
|
5307
|
-
return
|
|
5549
|
+
function joinPathSegments(a2, b, separator) {
|
|
5550
|
+
if (a2.endsWith(separator)) {
|
|
5551
|
+
return a2 + b;
|
|
5308
5552
|
}
|
|
5309
|
-
return
|
|
5553
|
+
return a2 + separator + b;
|
|
5310
5554
|
}
|
|
5311
5555
|
exports.joinPathSegments = joinPathSegments;
|
|
5312
5556
|
}
|
|
@@ -5324,16 +5568,16 @@ var require_async2 = __commonJS({
|
|
|
5324
5568
|
var constants_1 = require_constants3();
|
|
5325
5569
|
var utils = require_utils4();
|
|
5326
5570
|
var common = require_common();
|
|
5327
|
-
function read(directory,
|
|
5328
|
-
if (!
|
|
5329
|
-
readdirWithFileTypes(directory,
|
|
5571
|
+
function read(directory, settings2, callback) {
|
|
5572
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5573
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5330
5574
|
return;
|
|
5331
5575
|
}
|
|
5332
|
-
readdir(directory,
|
|
5576
|
+
readdir(directory, settings2, callback);
|
|
5333
5577
|
}
|
|
5334
5578
|
exports.read = read;
|
|
5335
|
-
function readdirWithFileTypes(directory,
|
|
5336
|
-
|
|
5579
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5580
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5337
5581
|
if (readdirError !== null) {
|
|
5338
5582
|
callFailureCallback(callback, readdirError);
|
|
5339
5583
|
return;
|
|
@@ -5341,13 +5585,13 @@ var require_async2 = __commonJS({
|
|
|
5341
5585
|
const entries = dirents.map((dirent) => ({
|
|
5342
5586
|
dirent,
|
|
5343
5587
|
name: dirent.name,
|
|
5344
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5588
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5345
5589
|
}));
|
|
5346
|
-
if (!
|
|
5590
|
+
if (!settings2.followSymbolicLinks) {
|
|
5347
5591
|
callSuccessCallback(callback, entries);
|
|
5348
5592
|
return;
|
|
5349
5593
|
}
|
|
5350
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5594
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5351
5595
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5352
5596
|
if (rplError !== null) {
|
|
5353
5597
|
callFailureCallback(callback, rplError);
|
|
@@ -5358,15 +5602,15 @@ var require_async2 = __commonJS({
|
|
|
5358
5602
|
});
|
|
5359
5603
|
}
|
|
5360
5604
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5361
|
-
function makeRplTaskEntry(entry,
|
|
5605
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5362
5606
|
return (done) => {
|
|
5363
5607
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5364
5608
|
done(null, entry);
|
|
5365
5609
|
return;
|
|
5366
5610
|
}
|
|
5367
|
-
|
|
5611
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5368
5612
|
if (statError !== null) {
|
|
5369
|
-
if (
|
|
5613
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5370
5614
|
done(statError);
|
|
5371
5615
|
return;
|
|
5372
5616
|
}
|
|
@@ -5378,16 +5622,16 @@ var require_async2 = __commonJS({
|
|
|
5378
5622
|
});
|
|
5379
5623
|
};
|
|
5380
5624
|
}
|
|
5381
|
-
function readdir(directory,
|
|
5382
|
-
|
|
5625
|
+
function readdir(directory, settings2, callback) {
|
|
5626
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5383
5627
|
if (readdirError !== null) {
|
|
5384
5628
|
callFailureCallback(callback, readdirError);
|
|
5385
5629
|
return;
|
|
5386
5630
|
}
|
|
5387
5631
|
const tasks = names.map((name) => {
|
|
5388
|
-
const path = common.joinPathSegments(directory, name,
|
|
5632
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5389
5633
|
return (done) => {
|
|
5390
|
-
fsStat.stat(path,
|
|
5634
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5391
5635
|
if (error2 !== null) {
|
|
5392
5636
|
done(error2);
|
|
5393
5637
|
return;
|
|
@@ -5397,7 +5641,7 @@ var require_async2 = __commonJS({
|
|
|
5397
5641
|
path,
|
|
5398
5642
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5399
5643
|
};
|
|
5400
|
-
if (
|
|
5644
|
+
if (settings2.stats) {
|
|
5401
5645
|
entry.stats = stats;
|
|
5402
5646
|
}
|
|
5403
5647
|
done(null, entry);
|
|
@@ -5434,27 +5678,27 @@ var require_sync2 = __commonJS({
|
|
|
5434
5678
|
var constants_1 = require_constants3();
|
|
5435
5679
|
var utils = require_utils4();
|
|
5436
5680
|
var common = require_common();
|
|
5437
|
-
function read(directory,
|
|
5438
|
-
if (!
|
|
5439
|
-
return readdirWithFileTypes(directory,
|
|
5681
|
+
function read(directory, settings2) {
|
|
5682
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5683
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5440
5684
|
}
|
|
5441
|
-
return readdir(directory,
|
|
5685
|
+
return readdir(directory, settings2);
|
|
5442
5686
|
}
|
|
5443
5687
|
exports.read = read;
|
|
5444
|
-
function readdirWithFileTypes(directory,
|
|
5445
|
-
const dirents =
|
|
5688
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5689
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5446
5690
|
return dirents.map((dirent) => {
|
|
5447
5691
|
const entry = {
|
|
5448
5692
|
dirent,
|
|
5449
5693
|
name: dirent.name,
|
|
5450
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5694
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5451
5695
|
};
|
|
5452
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5696
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5453
5697
|
try {
|
|
5454
|
-
const stats =
|
|
5698
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5455
5699
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5456
5700
|
} catch (error2) {
|
|
5457
|
-
if (
|
|
5701
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5458
5702
|
throw error2;
|
|
5459
5703
|
}
|
|
5460
5704
|
}
|
|
@@ -5463,17 +5707,17 @@ var require_sync2 = __commonJS({
|
|
|
5463
5707
|
});
|
|
5464
5708
|
}
|
|
5465
5709
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5466
|
-
function readdir(directory,
|
|
5467
|
-
const names =
|
|
5710
|
+
function readdir(directory, settings2) {
|
|
5711
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5468
5712
|
return names.map((name) => {
|
|
5469
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5470
|
-
const stats = fsStat.statSync(entryPath,
|
|
5713
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5714
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5471
5715
|
const entry = {
|
|
5472
5716
|
name,
|
|
5473
5717
|
path: entryPath,
|
|
5474
5718
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5475
5719
|
};
|
|
5476
|
-
if (
|
|
5720
|
+
if (settings2.stats) {
|
|
5477
5721
|
entry.stats = stats;
|
|
5478
5722
|
}
|
|
5479
5723
|
return entry;
|
|
@@ -5560,8 +5804,8 @@ var require_out2 = __commonJS({
|
|
|
5560
5804
|
}
|
|
5561
5805
|
exports.scandir = scandir;
|
|
5562
5806
|
function scandirSync(path, optionsOrSettings) {
|
|
5563
|
-
const
|
|
5564
|
-
return sync.read(path,
|
|
5807
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5808
|
+
return sync.read(path, settings2);
|
|
5565
5809
|
}
|
|
5566
5810
|
exports.scandirSync = scandirSync;
|
|
5567
5811
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5842,7 +6086,7 @@ var require_queue = __commonJS({
|
|
|
5842
6086
|
queue.drained = drained;
|
|
5843
6087
|
return queue;
|
|
5844
6088
|
function push(value) {
|
|
5845
|
-
var
|
|
6089
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5846
6090
|
pushCb(value, function(err, result) {
|
|
5847
6091
|
if (err) {
|
|
5848
6092
|
reject(err);
|
|
@@ -5851,11 +6095,11 @@ var require_queue = __commonJS({
|
|
|
5851
6095
|
resolve4(result);
|
|
5852
6096
|
});
|
|
5853
6097
|
});
|
|
5854
|
-
|
|
5855
|
-
return
|
|
6098
|
+
p.catch(noop);
|
|
6099
|
+
return p;
|
|
5856
6100
|
}
|
|
5857
6101
|
function unshift(value) {
|
|
5858
|
-
var
|
|
6102
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5859
6103
|
unshiftCb(value, function(err, result) {
|
|
5860
6104
|
if (err) {
|
|
5861
6105
|
reject(err);
|
|
@@ -5864,11 +6108,11 @@ var require_queue = __commonJS({
|
|
|
5864
6108
|
resolve4(result);
|
|
5865
6109
|
});
|
|
5866
6110
|
});
|
|
5867
|
-
|
|
5868
|
-
return
|
|
6111
|
+
p.catch(noop);
|
|
6112
|
+
return p;
|
|
5869
6113
|
}
|
|
5870
6114
|
function drained() {
|
|
5871
|
-
var
|
|
6115
|
+
var p = new Promise(function(resolve4) {
|
|
5872
6116
|
process.nextTick(function() {
|
|
5873
6117
|
if (queue.idle()) {
|
|
5874
6118
|
resolve4();
|
|
@@ -5882,7 +6126,7 @@ var require_queue = __commonJS({
|
|
|
5882
6126
|
}
|
|
5883
6127
|
});
|
|
5884
6128
|
});
|
|
5885
|
-
return
|
|
6129
|
+
return p;
|
|
5886
6130
|
}
|
|
5887
6131
|
}
|
|
5888
6132
|
module.exports = fastqueue;
|
|
@@ -5897,11 +6141,11 @@ var require_common2 = __commonJS({
|
|
|
5897
6141
|
init_utils2();
|
|
5898
6142
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5899
6143
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5900
|
-
function isFatalError(
|
|
5901
|
-
if (
|
|
6144
|
+
function isFatalError(settings2, error2) {
|
|
6145
|
+
if (settings2.errorFilter === null) {
|
|
5902
6146
|
return true;
|
|
5903
6147
|
}
|
|
5904
|
-
return !
|
|
6148
|
+
return !settings2.errorFilter(error2);
|
|
5905
6149
|
}
|
|
5906
6150
|
exports.isFatalError = isFatalError;
|
|
5907
6151
|
function isAppliedFilter(filter, value) {
|
|
@@ -5912,14 +6156,14 @@ var require_common2 = __commonJS({
|
|
|
5912
6156
|
return filepath.split(/[/\\]/).join(separator);
|
|
5913
6157
|
}
|
|
5914
6158
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5915
|
-
function joinPathSegments(
|
|
5916
|
-
if (
|
|
6159
|
+
function joinPathSegments(a2, b, separator) {
|
|
6160
|
+
if (a2 === "") {
|
|
5917
6161
|
return b;
|
|
5918
6162
|
}
|
|
5919
|
-
if (
|
|
5920
|
-
return
|
|
6163
|
+
if (a2.endsWith(separator)) {
|
|
6164
|
+
return a2 + b;
|
|
5921
6165
|
}
|
|
5922
|
-
return
|
|
6166
|
+
return a2 + separator + b;
|
|
5923
6167
|
}
|
|
5924
6168
|
exports.joinPathSegments = joinPathSegments;
|
|
5925
6169
|
}
|
|
@@ -6266,14 +6510,14 @@ var require_out3 = __commonJS({
|
|
|
6266
6510
|
}
|
|
6267
6511
|
exports.walk = walk;
|
|
6268
6512
|
function walkSync(directory, optionsOrSettings) {
|
|
6269
|
-
const
|
|
6270
|
-
const provider = new sync_1.default(directory,
|
|
6513
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6514
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6271
6515
|
return provider.read();
|
|
6272
6516
|
}
|
|
6273
6517
|
exports.walkSync = walkSync;
|
|
6274
6518
|
function walkStream(directory, optionsOrSettings) {
|
|
6275
|
-
const
|
|
6276
|
-
const provider = new stream_1.default(directory,
|
|
6519
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6520
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6277
6521
|
return provider.read();
|
|
6278
6522
|
}
|
|
6279
6523
|
exports.walkStream = walkStream;
|
|
@@ -6359,8 +6603,8 @@ var require_stream3 = __commonJS({
|
|
|
6359
6603
|
done();
|
|
6360
6604
|
}).catch(done);
|
|
6361
6605
|
};
|
|
6362
|
-
for (let
|
|
6363
|
-
stream.write(
|
|
6606
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6607
|
+
stream.write(i2);
|
|
6364
6608
|
}
|
|
6365
6609
|
return stream;
|
|
6366
6610
|
}
|
|
@@ -7021,14 +7265,14 @@ var require_out4 = __commonJS({
|
|
|
7021
7265
|
function generateTasks(source, options) {
|
|
7022
7266
|
assertPatternsInput(source);
|
|
7023
7267
|
const patterns = [].concat(source);
|
|
7024
|
-
const
|
|
7025
|
-
return taskManager.generate(patterns,
|
|
7268
|
+
const settings2 = new settings_1.default(options);
|
|
7269
|
+
return taskManager.generate(patterns, settings2);
|
|
7026
7270
|
}
|
|
7027
7271
|
FastGlob2.generateTasks = generateTasks;
|
|
7028
7272
|
function isDynamicPattern(source, options) {
|
|
7029
7273
|
assertPatternsInput(source);
|
|
7030
|
-
const
|
|
7031
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7274
|
+
const settings2 = new settings_1.default(options);
|
|
7275
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
7032
7276
|
}
|
|
7033
7277
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
7034
7278
|
function escapePath(source) {
|
|
@@ -7070,9 +7314,9 @@ var require_out4 = __commonJS({
|
|
|
7070
7314
|
})(FastGlob || (FastGlob = {}));
|
|
7071
7315
|
function getWorks(source, _Provider, options) {
|
|
7072
7316
|
const patterns = [].concat(source);
|
|
7073
|
-
const
|
|
7074
|
-
const tasks = taskManager.generate(patterns,
|
|
7075
|
-
const provider = new _Provider(
|
|
7317
|
+
const settings2 = new settings_1.default(options);
|
|
7318
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7319
|
+
const provider = new _Provider(settings2);
|
|
7076
7320
|
return tasks.map(provider.read, provider);
|
|
7077
7321
|
}
|
|
7078
7322
|
function assertPatternsInput(input) {
|
|
@@ -7250,8 +7494,8 @@ import "node:fs";
|
|
|
7250
7494
|
import { createRequire } from "node:module";
|
|
7251
7495
|
import {
|
|
7252
7496
|
resolve,
|
|
7253
|
-
join,
|
|
7254
|
-
dirname,
|
|
7497
|
+
join as join2,
|
|
7498
|
+
dirname as dirname2,
|
|
7255
7499
|
relative,
|
|
7256
7500
|
normalize,
|
|
7257
7501
|
sep,
|
|
@@ -7265,7 +7509,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7265
7509
|
);
|
|
7266
7510
|
});
|
|
7267
7511
|
}
|
|
7268
|
-
var import_fast_glob, constants,
|
|
7512
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7269
7513
|
var init_PathResolver = __esm({
|
|
7270
7514
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7271
7515
|
"use strict";
|
|
@@ -7278,7 +7522,7 @@ var init_PathResolver = __esm({
|
|
|
7278
7522
|
getPatternsFor: getPatternsFor || void 0,
|
|
7279
7523
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7280
7524
|
};
|
|
7281
|
-
|
|
7525
|
+
log3 = {
|
|
7282
7526
|
error: (message, error2) => {
|
|
7283
7527
|
},
|
|
7284
7528
|
warn: (message, error2) => {
|
|
@@ -7399,7 +7643,7 @@ var init_PathResolver = __esm({
|
|
|
7399
7643
|
*/
|
|
7400
7644
|
getDirname(path) {
|
|
7401
7645
|
if (!path) return "";
|
|
7402
|
-
return this.normalizePath(
|
|
7646
|
+
return this.normalizePath(dirname2(path));
|
|
7403
7647
|
}
|
|
7404
7648
|
/**
|
|
7405
7649
|
* Resolve package path using Node's module resolution
|
|
@@ -7411,7 +7655,7 @@ var init_PathResolver = __esm({
|
|
|
7411
7655
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7412
7656
|
try {
|
|
7413
7657
|
const basePath = fromPath || this.getAppRoot();
|
|
7414
|
-
const require3 = createRequire(
|
|
7658
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7415
7659
|
const resolved = require3.resolve(packageSpecifier);
|
|
7416
7660
|
return this.normalizePath(resolved);
|
|
7417
7661
|
} catch (error2) {
|
|
@@ -7563,7 +7807,7 @@ var init_PathResolver = __esm({
|
|
|
7563
7807
|
return cleanContent;
|
|
7564
7808
|
} catch (error2) {
|
|
7565
7809
|
if (this.options.debug) {
|
|
7566
|
-
|
|
7810
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7567
7811
|
}
|
|
7568
7812
|
return null;
|
|
7569
7813
|
}
|
|
@@ -7591,7 +7835,7 @@ var init_PathResolver = __esm({
|
|
|
7591
7835
|
return cleanContent;
|
|
7592
7836
|
} catch (error2) {
|
|
7593
7837
|
if (this.options.debug) {
|
|
7594
|
-
|
|
7838
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7595
7839
|
}
|
|
7596
7840
|
return null;
|
|
7597
7841
|
}
|
|
@@ -7613,16 +7857,16 @@ var init_PathResolver = __esm({
|
|
|
7613
7857
|
verbose = false
|
|
7614
7858
|
} = options;
|
|
7615
7859
|
const normalizedPath = this.normalizePath(filePath);
|
|
7616
|
-
const dir = this.normalizePath(
|
|
7860
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7617
7861
|
const fileExists = this.pathExists(normalizedPath);
|
|
7618
7862
|
if (fileExists && !overwrite) {
|
|
7619
7863
|
if (verbose) {
|
|
7620
|
-
|
|
7864
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7621
7865
|
}
|
|
7622
7866
|
return false;
|
|
7623
7867
|
}
|
|
7624
7868
|
if (dryRun) {
|
|
7625
|
-
|
|
7869
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7626
7870
|
return true;
|
|
7627
7871
|
}
|
|
7628
7872
|
try {
|
|
@@ -7647,7 +7891,7 @@ var init_PathResolver = __esm({
|
|
|
7647
7891
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7648
7892
|
}
|
|
7649
7893
|
if (verbose) {
|
|
7650
|
-
|
|
7894
|
+
log3.info(
|
|
7651
7895
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7652
7896
|
);
|
|
7653
7897
|
}
|
|
@@ -7674,16 +7918,16 @@ var init_PathResolver = __esm({
|
|
|
7674
7918
|
verbose = false
|
|
7675
7919
|
} = options;
|
|
7676
7920
|
const normalizedPath = this.normalizePath(filePath);
|
|
7677
|
-
const dir = this.normalizePath(
|
|
7921
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7678
7922
|
const fileExists = this.pathExists(normalizedPath);
|
|
7679
7923
|
if (fileExists && !overwrite) {
|
|
7680
7924
|
if (verbose) {
|
|
7681
|
-
|
|
7925
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7682
7926
|
}
|
|
7683
7927
|
return false;
|
|
7684
7928
|
}
|
|
7685
7929
|
if (dryRun) {
|
|
7686
|
-
|
|
7930
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7687
7931
|
return true;
|
|
7688
7932
|
}
|
|
7689
7933
|
try {
|
|
@@ -7707,7 +7951,7 @@ var init_PathResolver = __esm({
|
|
|
7707
7951
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7708
7952
|
}
|
|
7709
7953
|
if (verbose) {
|
|
7710
|
-
|
|
7954
|
+
log3.info(
|
|
7711
7955
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7712
7956
|
);
|
|
7713
7957
|
}
|
|
@@ -7732,15 +7976,15 @@ var init_PathResolver = __esm({
|
|
|
7732
7976
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7733
7977
|
if (fileExists && !overwrite) {
|
|
7734
7978
|
if (verbose) {
|
|
7735
|
-
|
|
7979
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7736
7980
|
}
|
|
7737
7981
|
return false;
|
|
7738
7982
|
}
|
|
7739
7983
|
if (dryRun) {
|
|
7740
|
-
|
|
7984
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7741
7985
|
return true;
|
|
7742
7986
|
}
|
|
7743
|
-
const dir = this.normalizePath(
|
|
7987
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7744
7988
|
try {
|
|
7745
7989
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7746
7990
|
} catch (error2) {
|
|
@@ -7750,7 +7994,7 @@ var init_PathResolver = __esm({
|
|
|
7750
7994
|
return await safeExecuteAsync(async () => {
|
|
7751
7995
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7752
7996
|
if (verbose) {
|
|
7753
|
-
|
|
7997
|
+
log3.info(
|
|
7754
7998
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7755
7999
|
);
|
|
7756
8000
|
}
|
|
@@ -7774,15 +8018,15 @@ var init_PathResolver = __esm({
|
|
|
7774
8018
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7775
8019
|
if (fileExists && !overwrite) {
|
|
7776
8020
|
if (verbose) {
|
|
7777
|
-
|
|
8021
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7778
8022
|
}
|
|
7779
8023
|
return false;
|
|
7780
8024
|
}
|
|
7781
8025
|
if (dryRun) {
|
|
7782
|
-
|
|
8026
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7783
8027
|
return true;
|
|
7784
8028
|
}
|
|
7785
|
-
const dir = this.normalizePath(
|
|
8029
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7786
8030
|
try {
|
|
7787
8031
|
fs.mkdirSync(dir, { recursive: true });
|
|
7788
8032
|
} catch (error2) {
|
|
@@ -7791,7 +8035,7 @@ var init_PathResolver = __esm({
|
|
|
7791
8035
|
try {
|
|
7792
8036
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
7793
8037
|
if (verbose) {
|
|
7794
|
-
|
|
8038
|
+
log3.info(
|
|
7795
8039
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7796
8040
|
);
|
|
7797
8041
|
}
|
|
@@ -7808,7 +8052,7 @@ var init_PathResolver = __esm({
|
|
|
7808
8052
|
return fs.existsSync(filePath);
|
|
7809
8053
|
} catch (error2) {
|
|
7810
8054
|
if (!silent) {
|
|
7811
|
-
|
|
8055
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7812
8056
|
}
|
|
7813
8057
|
return false;
|
|
7814
8058
|
}
|
|
@@ -7834,7 +8078,7 @@ var init_PathResolver = __esm({
|
|
|
7834
8078
|
return fs.readdirSync(dirPath, options);
|
|
7835
8079
|
} catch (error2) {
|
|
7836
8080
|
if (this.options.debug) {
|
|
7837
|
-
|
|
8081
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7838
8082
|
}
|
|
7839
8083
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7840
8084
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7852,7 +8096,7 @@ var init_PathResolver = __esm({
|
|
|
7852
8096
|
return fs.statSync(filePath);
|
|
7853
8097
|
} catch (error2) {
|
|
7854
8098
|
if (this.options.debug) {
|
|
7855
|
-
|
|
8099
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7856
8100
|
}
|
|
7857
8101
|
return null;
|
|
7858
8102
|
}
|
|
@@ -7869,7 +8113,7 @@ var init_PathResolver = __esm({
|
|
|
7869
8113
|
return fs.lstatSync(filePath);
|
|
7870
8114
|
} catch (error2) {
|
|
7871
8115
|
if (this.options.debug) {
|
|
7872
|
-
|
|
8116
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7873
8117
|
}
|
|
7874
8118
|
return null;
|
|
7875
8119
|
}
|
|
@@ -7958,7 +8202,7 @@ var init_PathResolver = __esm({
|
|
|
7958
8202
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
7959
8203
|
*/
|
|
7960
8204
|
isMonorepo() {
|
|
7961
|
-
const packagesDir =
|
|
8205
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
7962
8206
|
return this.pathExists(packagesDir);
|
|
7963
8207
|
}
|
|
7964
8208
|
/**
|
|
@@ -7975,7 +8219,7 @@ var init_PathResolver = __esm({
|
|
|
7975
8219
|
* Find files matching pattern within directory
|
|
7976
8220
|
*/
|
|
7977
8221
|
async findFiles(directory, pattern, options = {}) {
|
|
7978
|
-
const searchPattern = this.normalizePath(
|
|
8222
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
7979
8223
|
const appRoot = this.getAppRoot();
|
|
7980
8224
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
7981
8225
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -8022,7 +8266,7 @@ var init_PathResolver = __esm({
|
|
|
8022
8266
|
return null;
|
|
8023
8267
|
}
|
|
8024
8268
|
const resolvedPath = this.normalizePath(
|
|
8025
|
-
|
|
8269
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
8026
8270
|
);
|
|
8027
8271
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
8028
8272
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8218,13 +8462,13 @@ var init_PathResolver = __esm({
|
|
|
8218
8462
|
const maxLevels = this.options.maxLevels;
|
|
8219
8463
|
while (levelsChecked < maxLevels) {
|
|
8220
8464
|
const toolingPath = this.normalizePath(
|
|
8221
|
-
|
|
8465
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8222
8466
|
);
|
|
8223
|
-
const corePath = this.normalizePath(
|
|
8467
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8224
8468
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8225
8469
|
return currentDir;
|
|
8226
8470
|
}
|
|
8227
|
-
const appsDir =
|
|
8471
|
+
const appsDir = join2(currentDir, "apps");
|
|
8228
8472
|
if (this.pathExists(appsDir)) {
|
|
8229
8473
|
const appsDirStat = this.statSync(appsDir);
|
|
8230
8474
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8232,15 +8476,15 @@ var init_PathResolver = __esm({
|
|
|
8232
8476
|
}
|
|
8233
8477
|
}
|
|
8234
8478
|
const packageJsonPath = this.normalizePath(
|
|
8235
|
-
|
|
8479
|
+
join2(currentDir, "package.json")
|
|
8236
8480
|
);
|
|
8237
8481
|
if (this.pathExists(packageJsonPath)) {
|
|
8238
|
-
const parentDir2 = this.normalizePath(
|
|
8482
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8239
8483
|
if (parentDir2 === currentDir) {
|
|
8240
8484
|
return currentDir;
|
|
8241
8485
|
}
|
|
8242
8486
|
}
|
|
8243
|
-
const parentDir = this.normalizePath(
|
|
8487
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8244
8488
|
if (parentDir === currentDir) {
|
|
8245
8489
|
break;
|
|
8246
8490
|
}
|
|
@@ -8256,8 +8500,8 @@ var init_PathResolver = __esm({
|
|
|
8256
8500
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8257
8501
|
import { createRequire as createRequire2 } from "node:module";
|
|
8258
8502
|
import {
|
|
8259
|
-
join as
|
|
8260
|
-
dirname as
|
|
8503
|
+
join as join3,
|
|
8504
|
+
dirname as dirname3,
|
|
8261
8505
|
basename as basename2,
|
|
8262
8506
|
extname as extname2,
|
|
8263
8507
|
relative as relative2,
|
|
@@ -8266,7 +8510,7 @@ import {
|
|
|
8266
8510
|
isAbsolute as pathIsAbsolute
|
|
8267
8511
|
} from "node:path";
|
|
8268
8512
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8269
|
-
function
|
|
8513
|
+
function readdirSync3(dirPath, options) {
|
|
8270
8514
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8271
8515
|
}
|
|
8272
8516
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, writeSync, statSync2, joinPath;
|
|
@@ -8278,7 +8522,7 @@ var init_pathResolver = __esm({
|
|
|
8278
8522
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8279
8523
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8280
8524
|
normalizePath = (...pathSegments) => {
|
|
8281
|
-
return pathResolverInstance.normalizePath(
|
|
8525
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8282
8526
|
};
|
|
8283
8527
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8284
8528
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
@@ -8340,7 +8584,7 @@ var init_typed_file_operations = __esm({
|
|
|
8340
8584
|
import { Buffer } from "node:buffer";
|
|
8341
8585
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8342
8586
|
import { createRequire as createRequire3 } from "node:module";
|
|
8343
|
-
import { dirname as
|
|
8587
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8344
8588
|
import process from "node:process";
|
|
8345
8589
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8346
8590
|
var require2, __filename, __dirname;
|
|
@@ -8349,7 +8593,7 @@ var init_utils2 = __esm({
|
|
|
8349
8593
|
"use strict";
|
|
8350
8594
|
require2 = createRequire3(import.meta.url);
|
|
8351
8595
|
__filename = fileURLToPath3(import.meta.url);
|
|
8352
|
-
__dirname =
|
|
8596
|
+
__dirname = dirname4(__filename);
|
|
8353
8597
|
if (typeof globalThis !== "undefined") {
|
|
8354
8598
|
globalThis.require = require2;
|
|
8355
8599
|
globalThis.__filename = __filename;
|
|
@@ -8381,7 +8625,7 @@ function detectApps(projectRoot) {
|
|
|
8381
8625
|
const appsDir = joinPath(projectRoot, "apps");
|
|
8382
8626
|
const appsDirStat = statSync2(appsDir);
|
|
8383
8627
|
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
8384
|
-
const appDirs =
|
|
8628
|
+
const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
8385
8629
|
for (const appDir of appDirs) {
|
|
8386
8630
|
const appPath = joinPath(appsDir, appDir);
|
|
8387
8631
|
const packageJsonPath = joinPath(appPath, "package.json");
|
|
@@ -8558,17 +8802,17 @@ var init_app_detection = __esm({
|
|
|
8558
8802
|
async function selectApp(projectRoot, appName) {
|
|
8559
8803
|
const apps = detectApps(projectRoot);
|
|
8560
8804
|
if (apps.length === 0) {
|
|
8561
|
-
|
|
8562
|
-
|
|
8805
|
+
log2.error("No apps found in this project.");
|
|
8806
|
+
log2.info('Run "dndev init" to create a new project.');
|
|
8563
8807
|
return null;
|
|
8564
8808
|
}
|
|
8565
8809
|
if (appName) {
|
|
8566
|
-
const app = apps.find((
|
|
8810
|
+
const app = apps.find((a2) => a2.name === appName);
|
|
8567
8811
|
if (!app) {
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
apps.forEach((
|
|
8571
|
-
|
|
8812
|
+
log2.warn(`App "${appName}" not found.`);
|
|
8813
|
+
log2.info("Available apps:");
|
|
8814
|
+
apps.forEach((a2) => log2.info(` - ${a2.name}`));
|
|
8815
|
+
log2.info("Please select from the list:");
|
|
8572
8816
|
} else {
|
|
8573
8817
|
return app;
|
|
8574
8818
|
}
|
|
@@ -8576,7 +8820,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8576
8820
|
if (apps.length === 1) {
|
|
8577
8821
|
return apps[0] || null;
|
|
8578
8822
|
}
|
|
8579
|
-
const selected = await
|
|
8823
|
+
const selected = await select({
|
|
8580
8824
|
message: "Select app:",
|
|
8581
8825
|
options: apps.map((app) => ({
|
|
8582
8826
|
value: app.name,
|
|
@@ -8586,7 +8830,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8586
8830
|
if (typeof selected !== "string") {
|
|
8587
8831
|
return null;
|
|
8588
8832
|
}
|
|
8589
|
-
return apps.find((
|
|
8833
|
+
return apps.find((a2) => a2.name === selected) || null;
|
|
8590
8834
|
}
|
|
8591
8835
|
var init_app_selector = __esm({
|
|
8592
8836
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
@@ -8605,14 +8849,14 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
|
8605
8849
|
label: choice.title,
|
|
8606
8850
|
hint: choice.hint
|
|
8607
8851
|
}));
|
|
8608
|
-
const initialValues = defaultIndices.map((
|
|
8609
|
-
const result = await
|
|
8852
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
|
|
8853
|
+
const result = await multiselect({
|
|
8610
8854
|
message,
|
|
8611
8855
|
options,
|
|
8612
8856
|
initialValues: initialValues.length > 0 ? initialValues : void 0
|
|
8613
8857
|
});
|
|
8614
|
-
if (
|
|
8615
|
-
|
|
8858
|
+
if (isCancel(result)) {
|
|
8859
|
+
cancel("Operation cancelled.");
|
|
8616
8860
|
process.exit(0);
|
|
8617
8861
|
}
|
|
8618
8862
|
return result;
|
|
@@ -8695,13 +8939,13 @@ init_utils2();
|
|
|
8695
8939
|
|
|
8696
8940
|
// packages/tooling/src/apps/emu-firebase.ts
|
|
8697
8941
|
init_utils2();
|
|
8942
|
+
init_app_detection();
|
|
8698
8943
|
init_cli_input();
|
|
8699
8944
|
init_cli_output();
|
|
8700
8945
|
init_pathResolver();
|
|
8701
8946
|
import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
|
|
8702
8947
|
import { platform as platform2 } from "node:os";
|
|
8703
8948
|
init_typed_file_operations();
|
|
8704
|
-
init_app_detection();
|
|
8705
8949
|
function discoverFirebaseProjectId(appPath) {
|
|
8706
8950
|
const firebasercPath = joinPath(appPath, ".firebaserc");
|
|
8707
8951
|
if (pathExists(firebasercPath)) {
|
|
@@ -8742,7 +8986,7 @@ function killPorts(ports) {
|
|
|
8742
8986
|
for (const pid of Array.from(pids)) {
|
|
8743
8987
|
try {
|
|
8744
8988
|
execFileSync("taskkill", ["/F", "/PID", pid], { stdio: "ignore" });
|
|
8745
|
-
|
|
8989
|
+
log2.debug(`Killed process ${pid} on port ${port}`);
|
|
8746
8990
|
} catch {
|
|
8747
8991
|
}
|
|
8748
8992
|
}
|
|
@@ -8756,7 +9000,7 @@ function killPorts(ports) {
|
|
|
8756
9000
|
for (const pid of pids) {
|
|
8757
9001
|
try {
|
|
8758
9002
|
process.kill(Number(pid), "SIGKILL");
|
|
8759
|
-
|
|
9003
|
+
log2.debug(`Killed process ${pid} on port ${port}`);
|
|
8760
9004
|
} catch {
|
|
8761
9005
|
}
|
|
8762
9006
|
}
|
|
@@ -8826,7 +9070,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8826
9070
|
hint: "Stripe webhook forwarding (for payment testing)"
|
|
8827
9071
|
}
|
|
8828
9072
|
];
|
|
8829
|
-
|
|
9073
|
+
log2.info(`Starting Firebase emulators + dev server for ${app.name}...
|
|
8830
9074
|
`);
|
|
8831
9075
|
if (selectedServices.length === 0) {
|
|
8832
9076
|
selectedServices = await askForMultiSelection(
|
|
@@ -8836,7 +9080,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8836
9080
|
// Default: Functions and Firestore
|
|
8837
9081
|
);
|
|
8838
9082
|
} else {
|
|
8839
|
-
|
|
9083
|
+
log2.info(`Selected services: ${selectedServices.join(", ")}
|
|
8840
9084
|
`);
|
|
8841
9085
|
}
|
|
8842
9086
|
const useAuth = selectedServices.includes("auth");
|
|
@@ -8844,16 +9088,16 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
8844
9088
|
const useFirestore = selectedServices.includes("firestore");
|
|
8845
9089
|
const useStripe = selectedServices.includes("stripe");
|
|
8846
9090
|
if (!useFunctions) {
|
|
8847
|
-
|
|
9091
|
+
log2.error("Functions emulator is required for Firebase apps.");
|
|
8848
9092
|
return 1;
|
|
8849
9093
|
}
|
|
8850
9094
|
const functionsDir = getFunctionsPath(app);
|
|
8851
9095
|
const envLocalPath = joinPath(functionsDir, ".env.local");
|
|
8852
9096
|
if (pathExists(envLocalPath)) {
|
|
8853
9097
|
loadEnvFile(envLocalPath);
|
|
8854
|
-
|
|
9098
|
+
log2.debug("Loaded functions/.env.local for emulator context");
|
|
8855
9099
|
} else {
|
|
8856
|
-
|
|
9100
|
+
log2.warn(
|
|
8857
9101
|
"No .env.local found in functions directory. Emulator may lack required secrets."
|
|
8858
9102
|
);
|
|
8859
9103
|
}
|
|
@@ -8869,7 +9113,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8869
9113
|
` : `FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
8870
9114
|
`;
|
|
8871
9115
|
writeSync(envLocalPath, newContent);
|
|
8872
|
-
|
|
9116
|
+
log2.debug("Set FIREBASE_AUTH_EMULATOR_HOST in functions/.env.local");
|
|
8873
9117
|
} else if (!useAuth && hasAuthEmulatorHost) {
|
|
8874
9118
|
const lines = existingContent.split("\n");
|
|
8875
9119
|
const filteredLines = lines.filter(
|
|
@@ -8877,12 +9121,12 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8877
9121
|
);
|
|
8878
9122
|
const newContent = filteredLines.join("\n");
|
|
8879
9123
|
writeSync(envLocalPath, newContent);
|
|
8880
|
-
|
|
9124
|
+
log2.debug(
|
|
8881
9125
|
"Removed FIREBASE_AUTH_EMULATOR_HOST from functions/.env.local"
|
|
8882
9126
|
);
|
|
8883
9127
|
}
|
|
8884
9128
|
}
|
|
8885
|
-
|
|
9129
|
+
log2.info("Building functions...");
|
|
8886
9130
|
const buildResult = spawnSync2("bun", ["run", "build"], {
|
|
8887
9131
|
cwd: functionsDir,
|
|
8888
9132
|
stdio: "pipe",
|
|
@@ -8898,7 +9142,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8898
9142
|
if (buildResult.stderr) {
|
|
8899
9143
|
process.stderr.write(buildResult.stderr);
|
|
8900
9144
|
}
|
|
8901
|
-
|
|
9145
|
+
log2.error("Functions build failed. Fix errors and try again.");
|
|
8902
9146
|
return 1;
|
|
8903
9147
|
}
|
|
8904
9148
|
const appFirebaseJson = joinPath(app.path, "firebase.json");
|
|
@@ -8914,7 +9158,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8914
9158
|
}
|
|
8915
9159
|
const ports = getEmulatorPorts(emulatorConfig);
|
|
8916
9160
|
if (ports.length > 0) {
|
|
8917
|
-
|
|
9161
|
+
log2.info("Clearing ports...");
|
|
8918
9162
|
killPorts(ports);
|
|
8919
9163
|
}
|
|
8920
9164
|
const emulatorsToStart = [];
|
|
@@ -8956,12 +9200,12 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8956
9200
|
if (useStripe && projectId) {
|
|
8957
9201
|
const stripeWebhookUrl = `http://localhost:5001/${projectId}/${region}/stripeWebhook`;
|
|
8958
9202
|
concurrentlyArgs.push(`stripe listen --forward-to ${stripeWebhookUrl}`);
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
9203
|
+
log2.info("");
|
|
9204
|
+
log2.info("Stripe webhook forwarding will start automatically");
|
|
9205
|
+
log2.info(` Webhook URL: ${stripeWebhookUrl}`);
|
|
9206
|
+
log2.info(" To trigger test events, run in another terminal:");
|
|
9207
|
+
log2.info(" stripe trigger checkout.session.completed");
|
|
9208
|
+
log2.info("");
|
|
8965
9209
|
}
|
|
8966
9210
|
const isWindows = platform2() === "win32";
|
|
8967
9211
|
const childProcess = spawnCrossPlatform(
|
|
@@ -8982,7 +9226,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
8982
9226
|
};
|
|
8983
9227
|
const cleanup = (signal) => {
|
|
8984
9228
|
if (!childProcess.pid) return;
|
|
8985
|
-
|
|
9229
|
+
log2.debug(`Received ${signal}, cleaning up processes...`);
|
|
8986
9230
|
if (isWindows) {
|
|
8987
9231
|
try {
|
|
8988
9232
|
execFileSync(
|
|
@@ -9014,7 +9258,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
9014
9258
|
for (const signal of signals) {
|
|
9015
9259
|
const handler = () => {
|
|
9016
9260
|
cleanup(signal);
|
|
9017
|
-
handlers.forEach((
|
|
9261
|
+
handlers.forEach((h2) => h2());
|
|
9018
9262
|
process.exit(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
9019
9263
|
};
|
|
9020
9264
|
process.on(signal, handler);
|
|
@@ -9022,17 +9266,17 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
|
|
|
9022
9266
|
}
|
|
9023
9267
|
return new Promise((resolve4) => {
|
|
9024
9268
|
childProcess.on("exit", (code, signal) => {
|
|
9025
|
-
handlers.forEach((
|
|
9269
|
+
handlers.forEach((h2) => h2());
|
|
9026
9270
|
if (signal) {
|
|
9027
|
-
|
|
9271
|
+
log2.debug(`Process killed by signal: ${signal}`);
|
|
9028
9272
|
resolve4(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
9029
9273
|
} else {
|
|
9030
9274
|
resolve4(code ?? 0);
|
|
9031
9275
|
}
|
|
9032
9276
|
});
|
|
9033
9277
|
childProcess.on("error", (error2) => {
|
|
9034
|
-
handlers.forEach((
|
|
9035
|
-
|
|
9278
|
+
handlers.forEach((h2) => h2());
|
|
9279
|
+
log2.error(`Failed to start Firebase emulators: ${error2.message}`);
|
|
9036
9280
|
resolve4(1);
|
|
9037
9281
|
});
|
|
9038
9282
|
});
|
|
@@ -9052,18 +9296,18 @@ function isDockerRunning() {
|
|
|
9052
9296
|
}
|
|
9053
9297
|
}
|
|
9054
9298
|
async function startSupabase(app, _projectRoot) {
|
|
9055
|
-
|
|
9299
|
+
log2.info(`Starting Supabase local stack + dev server for ${app.name}...
|
|
9056
9300
|
`);
|
|
9057
9301
|
if (!isDockerRunning()) {
|
|
9058
|
-
|
|
9059
|
-
|
|
9302
|
+
log2.error("Docker is not running. Supabase local dev requires Docker.");
|
|
9303
|
+
log2.error("Start Docker Desktop and try again.\n");
|
|
9060
9304
|
return 1;
|
|
9061
9305
|
}
|
|
9062
9306
|
try {
|
|
9063
9307
|
execSync2("supabase --version", { stdio: "pipe" });
|
|
9064
9308
|
} catch {
|
|
9065
|
-
|
|
9066
|
-
|
|
9309
|
+
log2.error("Supabase CLI not found. Install it:");
|
|
9310
|
+
log2.error(" bun install -g supabase\n");
|
|
9067
9311
|
return 1;
|
|
9068
9312
|
}
|
|
9069
9313
|
const isWindows = platform3() === "win32";
|
|
@@ -9118,7 +9362,7 @@ async function startSupabase(app, _projectRoot) {
|
|
|
9118
9362
|
return new Promise((resolve4) => {
|
|
9119
9363
|
childProcess.on("exit", (code) => resolve4(code ?? 0));
|
|
9120
9364
|
childProcess.on("error", (error2) => {
|
|
9121
|
-
|
|
9365
|
+
log2.error(`Failed to start Supabase local dev: ${error2.message}`);
|
|
9122
9366
|
resolve4(1);
|
|
9123
9367
|
});
|
|
9124
9368
|
});
|
|
@@ -9130,13 +9374,13 @@ init_cli_output();
|
|
|
9130
9374
|
import { execFileSync as execFileSync3, execSync as execSync3 } from "node:child_process";
|
|
9131
9375
|
import { platform as platform4 } from "node:os";
|
|
9132
9376
|
async function startVercel(app, _projectRoot) {
|
|
9133
|
-
|
|
9377
|
+
log2.info(`Starting Vercel dev server for ${app.name}...
|
|
9134
9378
|
`);
|
|
9135
9379
|
try {
|
|
9136
9380
|
execSync3("vercel --version", { stdio: "pipe" });
|
|
9137
9381
|
} catch {
|
|
9138
|
-
|
|
9139
|
-
|
|
9382
|
+
log2.error("Vercel CLI not found. Install it:");
|
|
9383
|
+
log2.error(" bun install -g vercel\n");
|
|
9140
9384
|
return 1;
|
|
9141
9385
|
}
|
|
9142
9386
|
const isWindows = platform4() === "win32";
|
|
@@ -9176,7 +9420,7 @@ async function startVercel(app, _projectRoot) {
|
|
|
9176
9420
|
return new Promise((resolve4) => {
|
|
9177
9421
|
childProcess.on("exit", (code) => resolve4(code ?? 0));
|
|
9178
9422
|
childProcess.on("error", (error2) => {
|
|
9179
|
-
|
|
9423
|
+
log2.error(`Failed to start Vercel dev: ${error2.message}`);
|
|
9180
9424
|
resolve4(1);
|
|
9181
9425
|
});
|
|
9182
9426
|
});
|
|
@@ -9207,10 +9451,10 @@ async function main(options) {
|
|
|
9207
9451
|
switch (emuTarget) {
|
|
9208
9452
|
case "firebase": {
|
|
9209
9453
|
if (!app.functions) {
|
|
9210
|
-
|
|
9454
|
+
log2.error(
|
|
9211
9455
|
`App "${app.name}" has Firebase config but no functions directory.`
|
|
9212
9456
|
);
|
|
9213
|
-
|
|
9457
|
+
log2.error('Use "dndev dev" for apps without backend functions.\n');
|
|
9214
9458
|
return 1;
|
|
9215
9459
|
}
|
|
9216
9460
|
const selectedServices = parseFirebaseServices(args, options);
|
|
@@ -9224,11 +9468,11 @@ async function main(options) {
|
|
|
9224
9468
|
case "vercel":
|
|
9225
9469
|
return startVercel(app, projectRoot);
|
|
9226
9470
|
default:
|
|
9227
|
-
|
|
9228
|
-
|
|
9471
|
+
log2.error(`App "${app.name}" does not have a detected backend.`);
|
|
9472
|
+
log2.error(
|
|
9229
9473
|
"Expected: firebase.json (Firebase), supabase/config.toml or @donotdev/supabase (Supabase), or vercel.json (Vercel)."
|
|
9230
9474
|
);
|
|
9231
|
-
|
|
9475
|
+
log2.error('Use "dndev dev" for apps without a backend.\n');
|
|
9232
9476
|
return 1;
|
|
9233
9477
|
}
|
|
9234
9478
|
}
|