@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/dev.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;
|
|
166
|
-
}
|
|
167
|
-
TAB_RE.lastIndex = index;
|
|
168
|
-
if (TAB_RE.test(input)) {
|
|
169
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
170
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
171
|
-
if (width + widthExtra > truncationLimit) {
|
|
172
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
173
|
-
}
|
|
174
|
-
if (width + widthExtra > LIMIT) {
|
|
175
|
-
truncationEnabled = true;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
width += widthExtra;
|
|
179
|
-
unmatchedStart = indexPrev;
|
|
180
|
-
unmatchedEnd = index;
|
|
181
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
182
|
-
continue;
|
|
130
|
+
if (index >= length) {
|
|
131
|
+
break outer;
|
|
183
132
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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,64 +442,134 @@ 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
|
-
const
|
|
524
|
-
|
|
495
|
+
function setRawMode(e, r2) {
|
|
496
|
+
const o = e;
|
|
497
|
+
o.isTTY && o.setRawMode(r2);
|
|
525
498
|
}
|
|
526
|
-
function
|
|
527
|
-
const
|
|
528
|
-
return wrapAnsi(
|
|
529
|
-
|
|
499
|
+
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
500
|
+
const f = getColumns(e ?? stdout);
|
|
501
|
+
return wrapAnsi(r2, f - o.length, {
|
|
502
|
+
hard: true,
|
|
503
|
+
trim: false
|
|
504
|
+
}).split(`
|
|
505
|
+
`).map((c2, i2, m) => {
|
|
506
|
+
const d = t2 ? t2(c2, i2) : c2;
|
|
507
|
+
return i2 === 0 ? `${n3}${d}` : i2 === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
508
|
+
}).join(`
|
|
530
509
|
`);
|
|
531
510
|
}
|
|
532
|
-
|
|
511
|
+
function runValidation(e, a2) {
|
|
512
|
+
if ("~standard" in e) {
|
|
513
|
+
const n3 = e["~standard"].validate(a2);
|
|
514
|
+
return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
|
|
515
|
+
}
|
|
516
|
+
return e(a2);
|
|
517
|
+
}
|
|
518
|
+
var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, n$1;
|
|
533
519
|
var init_dist3 = __esm({
|
|
534
|
-
"node_modules/.bun/@clack+core@1.
|
|
520
|
+
"node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
535
521
|
init_utils2();
|
|
536
522
|
init_main();
|
|
537
523
|
import_sisteransi = __toESM(require_src(), 1);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
524
|
+
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
525
|
+
t = [
|
|
526
|
+
"January",
|
|
527
|
+
"February",
|
|
528
|
+
"March",
|
|
529
|
+
"April",
|
|
530
|
+
"May",
|
|
531
|
+
"June",
|
|
532
|
+
"July",
|
|
533
|
+
"August",
|
|
534
|
+
"September",
|
|
535
|
+
"October",
|
|
536
|
+
"November",
|
|
537
|
+
"December"
|
|
538
|
+
];
|
|
539
|
+
settings = {
|
|
540
|
+
actions: new Set(a$1),
|
|
541
|
+
aliases: /* @__PURE__ */ new Map([
|
|
542
|
+
// vim support
|
|
543
|
+
["k", "up"],
|
|
544
|
+
["j", "down"],
|
|
545
|
+
["h", "left"],
|
|
546
|
+
["l", "right"],
|
|
547
|
+
["", "cancel"],
|
|
548
|
+
// opinionated defaults!
|
|
549
|
+
["escape", "cancel"]
|
|
550
|
+
]),
|
|
551
|
+
messages: {
|
|
552
|
+
cancel: "Canceled",
|
|
553
|
+
error: "Something went wrong"
|
|
554
|
+
},
|
|
555
|
+
withGuide: true,
|
|
556
|
+
accessible: void 0,
|
|
557
|
+
date: {
|
|
558
|
+
monthNames: [...t],
|
|
559
|
+
messages: {
|
|
560
|
+
required: "Please enter a valid date",
|
|
561
|
+
invalidMonth: "There are only 12 months in a year",
|
|
562
|
+
invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
|
|
563
|
+
afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
|
|
564
|
+
beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
R = globalThis.process.platform.startsWith("win");
|
|
569
|
+
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
570
|
+
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
571
|
+
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
572
|
+
y = class {
|
|
546
573
|
input;
|
|
547
574
|
output;
|
|
548
575
|
_abortSignal;
|
|
@@ -557,46 +584,92 @@ var init_dist3 = __esm({
|
|
|
557
584
|
error = "";
|
|
558
585
|
value;
|
|
559
586
|
userInput = "";
|
|
587
|
+
/**
|
|
588
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
589
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
590
|
+
* and the `ACCESSIBLE` env var.
|
|
591
|
+
*/
|
|
592
|
+
get accessible() {
|
|
593
|
+
return isAccessible(this.opts.accessible);
|
|
594
|
+
}
|
|
560
595
|
constructor(t2, e = true) {
|
|
561
|
-
const { input:
|
|
562
|
-
this.opts =
|
|
596
|
+
const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
|
|
597
|
+
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;
|
|
563
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Unsubscribe all listeners
|
|
601
|
+
*/
|
|
564
602
|
unsubscribe() {
|
|
565
603
|
this._subscribers.clear();
|
|
566
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Set a subscriber with opts
|
|
607
|
+
* @param event - The event name
|
|
608
|
+
*/
|
|
567
609
|
setSubscriber(t2, e) {
|
|
568
|
-
const
|
|
569
|
-
|
|
610
|
+
const i2 = this._subscribers.get(t2) ?? [];
|
|
611
|
+
i2.push(e), this._subscribers.set(t2, i2);
|
|
570
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Subscribe to an event
|
|
615
|
+
* @param event - The event name
|
|
616
|
+
* @param cb - The callback
|
|
617
|
+
*/
|
|
571
618
|
on(t2, e) {
|
|
572
619
|
this.setSubscriber(t2, { cb: e });
|
|
573
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Subscribe to an event once
|
|
623
|
+
* @param event - The event name
|
|
624
|
+
* @param cb - The callback
|
|
625
|
+
*/
|
|
574
626
|
once(t2, e) {
|
|
575
627
|
this.setSubscriber(t2, { cb: e, once: true });
|
|
576
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* Emit an event with data
|
|
631
|
+
* @param event - The event name
|
|
632
|
+
* @param data - The data to pass to the callback
|
|
633
|
+
*/
|
|
577
634
|
emit(t2, ...e) {
|
|
578
|
-
const
|
|
579
|
-
for (const
|
|
580
|
-
|
|
635
|
+
const i2 = this._subscribers.get(t2) ?? [], s = [];
|
|
636
|
+
for (const r2 of i2)
|
|
637
|
+
r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
|
|
638
|
+
for (const r2 of s)
|
|
639
|
+
r2();
|
|
581
640
|
}
|
|
582
641
|
prompt() {
|
|
583
642
|
return new Promise((t2) => {
|
|
584
643
|
if (this._abortSignal) {
|
|
585
|
-
if (this._abortSignal.aborted)
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
644
|
+
if (this._abortSignal.aborted)
|
|
645
|
+
return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
|
|
646
|
+
this._abortSignal.addEventListener(
|
|
647
|
+
"abort",
|
|
648
|
+
() => {
|
|
649
|
+
this.state = "cancel", this.close();
|
|
650
|
+
},
|
|
651
|
+
{ once: true }
|
|
652
|
+
);
|
|
589
653
|
}
|
|
590
|
-
this.rl =
|
|
591
|
-
|
|
654
|
+
this.rl = l__default.createInterface({
|
|
655
|
+
input: this.input,
|
|
656
|
+
tabSize: 2,
|
|
657
|
+
prompt: "",
|
|
658
|
+
escapeCodeTimeout: 50,
|
|
659
|
+
terminal: true
|
|
660
|
+
}), 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", () => {
|
|
661
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
592
662
|
}), this.once("cancel", () => {
|
|
593
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render),
|
|
663
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
594
664
|
});
|
|
595
665
|
});
|
|
596
666
|
}
|
|
597
667
|
_isActionKey(t2, e) {
|
|
598
668
|
return t2 === " ";
|
|
599
669
|
}
|
|
670
|
+
_shouldSubmit(t2, e) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
600
673
|
_setValue(t2) {
|
|
601
674
|
this.value = t2, this.emit("value", this.value);
|
|
602
675
|
}
|
|
@@ -606,19 +679,22 @@ var init_dist3 = __esm({
|
|
|
606
679
|
_clearUserInput() {
|
|
607
680
|
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
608
681
|
}
|
|
609
|
-
onKeypress(t2, e) {
|
|
610
|
-
if (this.
|
|
611
|
-
if (this.
|
|
612
|
-
|
|
613
|
-
|
|
682
|
+
async onKeypress(t2, e) {
|
|
683
|
+
if (this.state !== "validating") {
|
|
684
|
+
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)) {
|
|
685
|
+
if (this.opts.validate) {
|
|
686
|
+
const i2 = runValidation(this.opts.validate, this.value);
|
|
687
|
+
let s;
|
|
688
|
+
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));
|
|
689
|
+
}
|
|
690
|
+
this.state !== "error" && (this.state = "submit");
|
|
614
691
|
}
|
|
615
|
-
this.state
|
|
692
|
+
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();
|
|
616
693
|
}
|
|
617
|
-
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();
|
|
618
694
|
}
|
|
619
695
|
close() {
|
|
620
696
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
621
|
-
`),
|
|
697
|
+
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
622
698
|
}
|
|
623
699
|
restoreCursor() {
|
|
624
700
|
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
@@ -626,34 +702,39 @@ var init_dist3 = __esm({
|
|
|
626
702
|
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
627
703
|
}
|
|
628
704
|
render() {
|
|
629
|
-
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
705
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
706
|
+
hard: true,
|
|
707
|
+
trim: false
|
|
708
|
+
});
|
|
630
709
|
if (t2 !== this._prevFrame) {
|
|
631
|
-
if (this.state === "initial")
|
|
710
|
+
if (this.state === "initial")
|
|
711
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
632
712
|
else {
|
|
633
|
-
const e =
|
|
713
|
+
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
634
714
|
if (this.restoreCursor(), e) {
|
|
635
|
-
const
|
|
636
|
-
let
|
|
637
|
-
if (
|
|
715
|
+
const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
|
|
716
|
+
let n3 = e.lines.find((o) => o >= s);
|
|
717
|
+
if (n3 === void 0) {
|
|
638
718
|
this._prevFrame = t2;
|
|
639
719
|
return;
|
|
640
720
|
}
|
|
641
721
|
if (e.lines.length === 1) {
|
|
642
|
-
this.output.write(import_sisteransi.cursor.move(0,
|
|
643
|
-
const
|
|
722
|
+
this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
723
|
+
const o = t2.split(`
|
|
644
724
|
`);
|
|
645
|
-
this.output.write(
|
|
725
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
|
|
646
726
|
return;
|
|
647
727
|
} else if (e.lines.length > 1) {
|
|
648
|
-
if (
|
|
728
|
+
if (s < r2)
|
|
729
|
+
n3 = s;
|
|
649
730
|
else {
|
|
650
|
-
const
|
|
651
|
-
|
|
731
|
+
const h2 = n3 - r2;
|
|
732
|
+
h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
|
|
652
733
|
}
|
|
653
734
|
this.output.write(import_sisteransi.erase.down());
|
|
654
|
-
const
|
|
655
|
-
`).slice(
|
|
656
|
-
this.output.write(
|
|
735
|
+
const f = t2.split(`
|
|
736
|
+
`).slice(n3);
|
|
737
|
+
this.output.write(f.join(`
|
|
657
738
|
`)), this._prevFrame = t2;
|
|
658
739
|
return;
|
|
659
740
|
}
|
|
@@ -664,27 +745,28 @@ var init_dist3 = __esm({
|
|
|
664
745
|
}
|
|
665
746
|
}
|
|
666
747
|
};
|
|
667
|
-
|
|
748
|
+
n$1 = class n extends y {
|
|
668
749
|
options;
|
|
669
750
|
cursor = 0;
|
|
670
751
|
get _selectedValue() {
|
|
671
752
|
return this.options[this.cursor];
|
|
672
753
|
}
|
|
673
754
|
changeValue() {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
755
|
+
const e = this._selectedValue;
|
|
756
|
+
this.value = e === void 0 ? void 0 : e.value;
|
|
757
|
+
}
|
|
758
|
+
constructor(e) {
|
|
759
|
+
super(e, false), this.options = e.options;
|
|
760
|
+
const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
|
|
761
|
+
this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
|
|
762
|
+
switch (s) {
|
|
681
763
|
case "left":
|
|
682
764
|
case "up":
|
|
683
|
-
this.cursor =
|
|
765
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
684
766
|
break;
|
|
685
767
|
case "down":
|
|
686
768
|
case "right":
|
|
687
|
-
this.cursor =
|
|
769
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
688
770
|
break;
|
|
689
771
|
}
|
|
690
772
|
this.changeValue();
|
|
@@ -694,181 +776,285 @@ var init_dist3 = __esm({
|
|
|
694
776
|
}
|
|
695
777
|
});
|
|
696
778
|
|
|
697
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
698
|
-
import { styleText as
|
|
699
|
-
import
|
|
700
|
-
import { existsSync
|
|
701
|
-
import { dirname
|
|
702
|
-
function
|
|
703
|
-
|
|
779
|
+
// node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
|
|
780
|
+
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
781
|
+
import process$1 from "node:process";
|
|
782
|
+
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
783
|
+
import { dirname, join } from "node:path";
|
|
784
|
+
function isUnicodeSupported() {
|
|
785
|
+
if (process$1.platform !== "win32") {
|
|
786
|
+
return process$1.env.TERM !== "linux";
|
|
787
|
+
}
|
|
788
|
+
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";
|
|
789
|
+
}
|
|
790
|
+
function formatInstructionFooter(o, e) {
|
|
791
|
+
const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
792
|
+
return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
|
|
704
793
|
}
|
|
705
|
-
var import_sisteransi2,
|
|
794
|
+
var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, MULTISELECT_INSTRUCTIONS, log, u2, SELECT_INSTRUCTIONS, c, select, i;
|
|
706
795
|
var init_dist4 = __esm({
|
|
707
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
796
|
+
"node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
708
797
|
init_utils2();
|
|
709
798
|
init_dist3();
|
|
710
799
|
init_dist3();
|
|
711
800
|
init_main();
|
|
712
801
|
init_dist2();
|
|
713
802
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
switch (
|
|
803
|
+
unicode = isUnicodeSupported();
|
|
804
|
+
unicodeOr = (o, e) => unicode ? o : e;
|
|
805
|
+
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
806
|
+
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
807
|
+
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
808
|
+
S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
|
|
809
|
+
S_BAR_START = unicodeOr("\u250C", "T");
|
|
810
|
+
S_BAR = unicodeOr("\u2502", "|");
|
|
811
|
+
S_BAR_END = unicodeOr("\u2514", "\u2014");
|
|
812
|
+
S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
|
|
813
|
+
S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
|
|
814
|
+
S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
|
|
815
|
+
S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
|
|
816
|
+
S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
|
|
817
|
+
S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
|
|
818
|
+
S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
|
|
819
|
+
S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
|
|
820
|
+
S_BAR_H = unicodeOr("\u2500", "-");
|
|
821
|
+
S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
|
|
822
|
+
S_CONNECT_LEFT = unicodeOr("\u251C", "+");
|
|
823
|
+
S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
|
|
824
|
+
S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
|
|
825
|
+
S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
|
|
826
|
+
S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
827
|
+
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
828
|
+
S_WARN = unicodeOr("\u25B2", "!");
|
|
829
|
+
S_ERROR = unicodeOr("\u25A0", "x");
|
|
830
|
+
symbol = (o) => {
|
|
831
|
+
switch (o) {
|
|
743
832
|
case "initial":
|
|
744
833
|
case "active":
|
|
745
|
-
return
|
|
834
|
+
return styleText2("cyan", S_STEP_ACTIVE);
|
|
746
835
|
case "cancel":
|
|
747
|
-
return
|
|
836
|
+
return styleText2("red", S_STEP_CANCEL);
|
|
748
837
|
case "error":
|
|
749
|
-
return
|
|
838
|
+
return styleText2("yellow", S_STEP_ERROR);
|
|
750
839
|
case "submit":
|
|
751
|
-
return
|
|
840
|
+
return styleText2("green", S_STEP_SUBMIT);
|
|
841
|
+
case "validating":
|
|
842
|
+
return styleText2("dim", S_STEP_ACTIVE);
|
|
752
843
|
}
|
|
753
844
|
};
|
|
754
|
-
|
|
755
|
-
switch (
|
|
845
|
+
symbolBar = (o) => {
|
|
846
|
+
switch (o) {
|
|
756
847
|
case "initial":
|
|
757
848
|
case "active":
|
|
758
|
-
return
|
|
849
|
+
return styleText2("cyan", S_BAR);
|
|
759
850
|
case "cancel":
|
|
760
|
-
return
|
|
851
|
+
return styleText2("red", S_BAR);
|
|
761
852
|
case "error":
|
|
762
|
-
return
|
|
853
|
+
return styleText2("yellow", S_BAR);
|
|
763
854
|
case "submit":
|
|
764
|
-
return
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
let
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
855
|
+
return styleText2("green", S_BAR);
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
I = (l, e, w, p, b, C = false) => {
|
|
859
|
+
let r2 = e, O = 0;
|
|
860
|
+
if (C)
|
|
861
|
+
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
862
|
+
const m = l[i2];
|
|
863
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
864
|
+
}
|
|
865
|
+
else
|
|
866
|
+
for (let i2 = w; i2 < p; i2++) {
|
|
867
|
+
const m = l[i2];
|
|
868
|
+
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
869
|
+
}
|
|
870
|
+
return { lineCount: r2, removals: O };
|
|
871
|
+
};
|
|
872
|
+
limitOptions = ({
|
|
873
|
+
cursor: l,
|
|
874
|
+
options: e,
|
|
875
|
+
style: w,
|
|
876
|
+
output: p = process.stdout,
|
|
877
|
+
maxItems: b = Number.POSITIVE_INFINITY,
|
|
878
|
+
columnPadding: C = 0,
|
|
879
|
+
rowPadding: r2 = 4
|
|
880
|
+
}) => {
|
|
881
|
+
const i2 = getColumns(p) - C, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
781
882
|
let f = 0;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
883
|
+
l >= a2 - 3 && (f = Math.max(
|
|
884
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
885
|
+
0
|
|
886
|
+
));
|
|
887
|
+
let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
|
|
888
|
+
const W = Math.min(
|
|
889
|
+
f + a2,
|
|
890
|
+
e.length
|
|
891
|
+
), s = [];
|
|
892
|
+
let g = 0;
|
|
893
|
+
d && g++, c2 && g++;
|
|
894
|
+
const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
|
|
895
|
+
for (let t2 = T; t2 < y2; t2++) {
|
|
896
|
+
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
897
|
+
hard: true,
|
|
898
|
+
trim: false
|
|
899
|
+
}).split(`
|
|
786
900
|
`);
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
if (
|
|
790
|
-
let
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
901
|
+
s.push(h2), g += h2.length;
|
|
902
|
+
}
|
|
903
|
+
if (g > v) {
|
|
904
|
+
let t2 = 0, n3 = 0, o = g;
|
|
905
|
+
const h2 = l - T;
|
|
906
|
+
let u3 = v;
|
|
907
|
+
const L = () => I(s, o, 0, h2, u3), E = () => I(
|
|
908
|
+
s,
|
|
909
|
+
o,
|
|
910
|
+
h2 + 1,
|
|
911
|
+
s.length,
|
|
912
|
+
u3,
|
|
913
|
+
true
|
|
914
|
+
);
|
|
915
|
+
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));
|
|
916
|
+
}
|
|
917
|
+
const x = [];
|
|
918
|
+
d && x.push(M);
|
|
919
|
+
for (const t2 of s)
|
|
920
|
+
for (const n3 of t2)
|
|
921
|
+
x.push(n3);
|
|
922
|
+
return c2 && x.push(M), x;
|
|
923
|
+
};
|
|
924
|
+
MULTISELECT_INSTRUCTIONS = [
|
|
925
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
926
|
+
`${styleText2("dim", "Space:")} select`,
|
|
927
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
928
|
+
];
|
|
929
|
+
log = {
|
|
930
|
+
message: (s = [], {
|
|
931
|
+
symbol: e = styleText2("gray", S_BAR),
|
|
932
|
+
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
933
|
+
output: m = process.stdout,
|
|
934
|
+
spacing: l = 1,
|
|
935
|
+
withGuide: c2
|
|
936
|
+
} = {}) => {
|
|
937
|
+
const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
938
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
939
|
+
t2.push(f);
|
|
940
|
+
const g = Array.isArray(s) ? s : s.split(`
|
|
803
941
|
`);
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
942
|
+
if (g.length > 0) {
|
|
943
|
+
const [i2, ...y2] = g;
|
|
944
|
+
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
945
|
+
for (const p of y2)
|
|
946
|
+
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
947
|
+
}
|
|
948
|
+
m.write(`${t2.join(`
|
|
810
949
|
`)}
|
|
811
950
|
`);
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
951
|
+
},
|
|
952
|
+
info: (s, e) => {
|
|
953
|
+
log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
|
|
954
|
+
},
|
|
955
|
+
success: (s, e) => {
|
|
956
|
+
log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
|
|
957
|
+
},
|
|
958
|
+
step: (s, e) => {
|
|
959
|
+
log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
|
|
960
|
+
},
|
|
961
|
+
warn: (s, e) => {
|
|
962
|
+
log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
|
|
963
|
+
},
|
|
964
|
+
/** alias for `log.warn()`. */
|
|
965
|
+
warning: (s, e) => {
|
|
966
|
+
log.warn(s, e);
|
|
967
|
+
},
|
|
968
|
+
error: (s, e) => {
|
|
969
|
+
log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
u2 = {
|
|
973
|
+
light: unicodeOr("\u2500", "-"),
|
|
974
|
+
heavy: unicodeOr("\u2501", "="),
|
|
975
|
+
block: unicodeOr("\u2588", "#")
|
|
976
|
+
};
|
|
977
|
+
SELECT_INSTRUCTIONS = [
|
|
978
|
+
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
979
|
+
`${styleText2("dim", "Enter:")} confirm`
|
|
980
|
+
];
|
|
981
|
+
c = (t2, o) => t2.includes(`
|
|
982
|
+
`) ? t2.split(`
|
|
983
|
+
`).map((d) => o(d)).join(`
|
|
984
|
+
`) : o(t2);
|
|
985
|
+
select = (t2) => {
|
|
986
|
+
const o = (n3, m) => {
|
|
987
|
+
if (n3 === void 0)
|
|
988
|
+
return "";
|
|
989
|
+
const s = n3.label ?? String(n3.value);
|
|
990
|
+
switch (m) {
|
|
834
991
|
case "disabled":
|
|
835
|
-
return `${
|
|
992
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
836
993
|
case "selected":
|
|
837
|
-
return `${
|
|
994
|
+
return `${c(s, (i2) => styleText2("dim", i2))}`;
|
|
838
995
|
case "active":
|
|
839
|
-
return `${
|
|
996
|
+
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
840
997
|
case "cancelled":
|
|
841
|
-
return `${
|
|
998
|
+
return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
842
999
|
default:
|
|
843
|
-
return `${
|
|
844
|
-
}
|
|
845
|
-
};
|
|
846
|
-
return new
|
|
847
|
-
|
|
848
|
-
|
|
1000
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
|
|
1001
|
+
}
|
|
1002
|
+
}, d = t2.showInstructions ?? true;
|
|
1003
|
+
return new n$1({
|
|
1004
|
+
options: t2.options,
|
|
1005
|
+
signal: t2.signal,
|
|
1006
|
+
input: t2.input,
|
|
1007
|
+
output: t2.output,
|
|
1008
|
+
initialValue: t2.initialValue,
|
|
1009
|
+
render() {
|
|
1010
|
+
const n3 = t2.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1011
|
+
t2.output,
|
|
1012
|
+
t2.message,
|
|
1013
|
+
s,
|
|
1014
|
+
m
|
|
1015
|
+
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1016
|
+
` : ""}${i2}
|
|
849
1017
|
`;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
${
|
|
1018
|
+
switch (this.state) {
|
|
1019
|
+
case "submit": {
|
|
1020
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1021
|
+
t2.output,
|
|
1022
|
+
o(this.options[this.cursor], "selected"),
|
|
1023
|
+
r2
|
|
1024
|
+
);
|
|
1025
|
+
return `${u3}${a2}`;
|
|
1026
|
+
}
|
|
1027
|
+
case "cancel": {
|
|
1028
|
+
const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
|
|
1029
|
+
t2.output,
|
|
1030
|
+
o(this.options[this.cursor], "cancelled"),
|
|
1031
|
+
r2
|
|
1032
|
+
);
|
|
1033
|
+
return `${u3}${a2}${n3 ? `
|
|
1034
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1035
|
+
}
|
|
1036
|
+
default: {
|
|
1037
|
+
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1038
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
|
|
1039
|
+
`), f = p.length + 1;
|
|
1040
|
+
return `${u3}${r2}${limitOptions({
|
|
1041
|
+
output: t2.output,
|
|
1042
|
+
cursor: this.cursor,
|
|
1043
|
+
options: this.options,
|
|
1044
|
+
maxItems: t2.maxItems,
|
|
1045
|
+
columnPadding: r2.length,
|
|
1046
|
+
rowPadding: a2 + f,
|
|
1047
|
+
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1048
|
+
}).join(`
|
|
1049
|
+
${r2}`)}
|
|
1050
|
+
${b}
|
|
866
1051
|
`;
|
|
1052
|
+
}
|
|
867
1053
|
}
|
|
868
1054
|
}
|
|
869
|
-
}
|
|
1055
|
+
}).prompt();
|
|
870
1056
|
};
|
|
871
|
-
|
|
1057
|
+
i = `${styleText2("gray", S_BAR)} `;
|
|
872
1058
|
}
|
|
873
1059
|
});
|
|
874
1060
|
|
|
@@ -913,7 +1099,7 @@ function stringify(value) {
|
|
|
913
1099
|
function formatMessage(...args) {
|
|
914
1100
|
return args.map(stringify).join(" ");
|
|
915
1101
|
}
|
|
916
|
-
var colors, currentLogLevel,
|
|
1102
|
+
var colors, currentLogLevel, log2, error, warn, info, success;
|
|
917
1103
|
var init_cli_output = __esm({
|
|
918
1104
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
919
1105
|
"use strict";
|
|
@@ -946,7 +1132,7 @@ var init_cli_output = __esm({
|
|
|
946
1132
|
currentLogLevel = envLevel;
|
|
947
1133
|
}
|
|
948
1134
|
}
|
|
949
|
-
|
|
1135
|
+
log2 = {
|
|
950
1136
|
/**
|
|
951
1137
|
* Logs an error message (always shows unless Quiet level)
|
|
952
1138
|
* Uses clack's log.error + explicit red color
|
|
@@ -954,7 +1140,7 @@ var init_cli_output = __esm({
|
|
|
954
1140
|
error(...args) {
|
|
955
1141
|
if (currentLogLevel < 0 /* Quiet */) return;
|
|
956
1142
|
const message = formatMessage(...args);
|
|
957
|
-
|
|
1143
|
+
log.error(colorize(message, colors.brightRed));
|
|
958
1144
|
},
|
|
959
1145
|
/**
|
|
960
1146
|
* Logs a warning message (shows at Normal level and above)
|
|
@@ -963,7 +1149,7 @@ var init_cli_output = __esm({
|
|
|
963
1149
|
warn(...args) {
|
|
964
1150
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
965
1151
|
const message = formatMessage(...args);
|
|
966
|
-
|
|
1152
|
+
log.warn(colorize(message, colors.brightYellow));
|
|
967
1153
|
},
|
|
968
1154
|
/**
|
|
969
1155
|
* Logs an info message (shows at Normal level and above)
|
|
@@ -972,7 +1158,7 @@ var init_cli_output = __esm({
|
|
|
972
1158
|
info(...args) {
|
|
973
1159
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
974
1160
|
const message = formatMessage(...args);
|
|
975
|
-
|
|
1161
|
+
log.info(colorize(message, colors.brightCyan));
|
|
976
1162
|
},
|
|
977
1163
|
/**
|
|
978
1164
|
* Logs a success message (shows at Normal level and above)
|
|
@@ -981,7 +1167,7 @@ var init_cli_output = __esm({
|
|
|
981
1167
|
success(...args) {
|
|
982
1168
|
if (currentLogLevel < 1 /* Normal */) return;
|
|
983
1169
|
const message = formatMessage(...args);
|
|
984
|
-
|
|
1170
|
+
log.success(colorize(message, colors.brightGreen));
|
|
985
1171
|
},
|
|
986
1172
|
/**
|
|
987
1173
|
* Logs a debug message (only shows at Verbose level and above)
|
|
@@ -990,7 +1176,7 @@ var init_cli_output = __esm({
|
|
|
990
1176
|
debug(...args) {
|
|
991
1177
|
if (currentLogLevel < 2 /* Verbose */) return;
|
|
992
1178
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
993
|
-
|
|
1179
|
+
log.message(
|
|
994
1180
|
colorize(
|
|
995
1181
|
`[${timeStamp}] \u{1F50D} DEBUG: ${formatMessage(...args)}`,
|
|
996
1182
|
colors.gray
|
|
@@ -1004,7 +1190,7 @@ var init_cli_output = __esm({
|
|
|
1004
1190
|
trace(...args) {
|
|
1005
1191
|
if (currentLogLevel < 3 /* Debug */) return;
|
|
1006
1192
|
const timeStamp = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
1007
|
-
|
|
1193
|
+
log.message(
|
|
1008
1194
|
colorize(
|
|
1009
1195
|
`[${timeStamp}] \u{1F52C} TRACE: ${formatMessage(...args)}`,
|
|
1010
1196
|
colors.gray
|
|
@@ -1012,10 +1198,10 @@ var init_cli_output = __esm({
|
|
|
1012
1198
|
);
|
|
1013
1199
|
}
|
|
1014
1200
|
};
|
|
1015
|
-
error =
|
|
1016
|
-
warn =
|
|
1017
|
-
info =
|
|
1018
|
-
success =
|
|
1201
|
+
error = log2.error.bind(log2);
|
|
1202
|
+
warn = log2.warn.bind(log2);
|
|
1203
|
+
info = log2.info.bind(log2);
|
|
1204
|
+
success = log2.success.bind(log2);
|
|
1019
1205
|
}
|
|
1020
1206
|
});
|
|
1021
1207
|
|
|
@@ -1375,9 +1561,9 @@ var require_is_glob = __commonJS({
|
|
|
1375
1561
|
index += 2;
|
|
1376
1562
|
var close = chars[open];
|
|
1377
1563
|
if (close) {
|
|
1378
|
-
var
|
|
1379
|
-
if (
|
|
1380
|
-
index =
|
|
1564
|
+
var n3 = str.indexOf(close, index);
|
|
1565
|
+
if (n3 !== -1) {
|
|
1566
|
+
index = n3 + 1;
|
|
1381
1567
|
}
|
|
1382
1568
|
}
|
|
1383
1569
|
if (str[index] === "!") {
|
|
@@ -1403,9 +1589,9 @@ var require_is_glob = __commonJS({
|
|
|
1403
1589
|
index += 2;
|
|
1404
1590
|
var close = chars[open];
|
|
1405
1591
|
if (close) {
|
|
1406
|
-
var
|
|
1407
|
-
if (
|
|
1408
|
-
index =
|
|
1592
|
+
var n3 = str.indexOf(close, index);
|
|
1593
|
+
if (n3 !== -1) {
|
|
1594
|
+
index = n3 + 1;
|
|
1409
1595
|
}
|
|
1410
1596
|
}
|
|
1411
1597
|
if (str[index] === "!") {
|
|
@@ -1483,8 +1669,8 @@ var require_utils = __commonJS({
|
|
|
1483
1669
|
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1484
1670
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1485
1671
|
};
|
|
1486
|
-
exports.escapeNode = (
|
|
1487
|
-
const node =
|
|
1672
|
+
exports.escapeNode = (block2, n3 = 0, type) => {
|
|
1673
|
+
const node = block2.nodes[n3];
|
|
1488
1674
|
if (!node) return;
|
|
1489
1675
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1490
1676
|
if (node.escaped !== true) {
|
|
@@ -1501,15 +1687,15 @@ var require_utils = __commonJS({
|
|
|
1501
1687
|
}
|
|
1502
1688
|
return false;
|
|
1503
1689
|
};
|
|
1504
|
-
exports.isInvalidBrace = (
|
|
1505
|
-
if (
|
|
1506
|
-
if (
|
|
1507
|
-
if (
|
|
1508
|
-
|
|
1690
|
+
exports.isInvalidBrace = (block2) => {
|
|
1691
|
+
if (block2.type !== "brace") return false;
|
|
1692
|
+
if (block2.invalid === true || block2.dollar) return true;
|
|
1693
|
+
if (block2.commas >> 0 + block2.ranges >> 0 === 0) {
|
|
1694
|
+
block2.invalid = true;
|
|
1509
1695
|
return true;
|
|
1510
1696
|
}
|
|
1511
|
-
if (
|
|
1512
|
-
|
|
1697
|
+
if (block2.open !== true || block2.close !== true) {
|
|
1698
|
+
block2.invalid = true;
|
|
1513
1699
|
return true;
|
|
1514
1700
|
}
|
|
1515
1701
|
return false;
|
|
@@ -1528,8 +1714,8 @@ var require_utils = __commonJS({
|
|
|
1528
1714
|
exports.flatten = (...args) => {
|
|
1529
1715
|
const result = [];
|
|
1530
1716
|
const flat = (arr) => {
|
|
1531
|
-
for (let
|
|
1532
|
-
const ele = arr[
|
|
1717
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
1718
|
+
const ele = arr[i2];
|
|
1533
1719
|
if (Array.isArray(ele)) {
|
|
1534
1720
|
flat(ele);
|
|
1535
1721
|
continue;
|
|
@@ -1623,9 +1809,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1623
1809
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1624
1810
|
return toRegexRange.cache[cacheKey].result;
|
|
1625
1811
|
}
|
|
1626
|
-
let
|
|
1812
|
+
let a2 = Math.min(min, max);
|
|
1627
1813
|
let b = Math.max(min, max);
|
|
1628
|
-
if (Math.abs(
|
|
1814
|
+
if (Math.abs(a2 - b) === 1) {
|
|
1629
1815
|
let result = min + "|" + max;
|
|
1630
1816
|
if (opts.capture) {
|
|
1631
1817
|
return `(${result})`;
|
|
@@ -1636,20 +1822,20 @@ var require_to_regex_range = __commonJS({
|
|
|
1636
1822
|
return `(?:${result})`;
|
|
1637
1823
|
}
|
|
1638
1824
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1639
|
-
let state = { min, max, a, b };
|
|
1825
|
+
let state = { min, max, a: a2, b };
|
|
1640
1826
|
let positives = [];
|
|
1641
1827
|
let negatives = [];
|
|
1642
1828
|
if (isPadded) {
|
|
1643
1829
|
state.isPadded = isPadded;
|
|
1644
1830
|
state.maxLen = String(state.max).length;
|
|
1645
1831
|
}
|
|
1646
|
-
if (
|
|
1832
|
+
if (a2 < 0) {
|
|
1647
1833
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1648
|
-
negatives = splitToPatterns(newMin, Math.abs(
|
|
1649
|
-
|
|
1834
|
+
negatives = splitToPatterns(newMin, Math.abs(a2), state, opts);
|
|
1835
|
+
a2 = state.a = 0;
|
|
1650
1836
|
}
|
|
1651
1837
|
if (b >= 0) {
|
|
1652
|
-
positives = splitToPatterns(
|
|
1838
|
+
positives = splitToPatterns(a2, b, state, opts);
|
|
1653
1839
|
}
|
|
1654
1840
|
state.negatives = negatives;
|
|
1655
1841
|
state.positives = positives;
|
|
@@ -1697,8 +1883,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1697
1883
|
let digits = zipped.length;
|
|
1698
1884
|
let pattern = "";
|
|
1699
1885
|
let count = 0;
|
|
1700
|
-
for (let
|
|
1701
|
-
let [startDigit, stopDigit] = zipped[
|
|
1886
|
+
for (let i2 = 0; i2 < digits; i2++) {
|
|
1887
|
+
let [startDigit, stopDigit] = zipped[i2];
|
|
1702
1888
|
if (startDigit === stopDigit) {
|
|
1703
1889
|
pattern += startDigit;
|
|
1704
1890
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
@@ -1717,8 +1903,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1717
1903
|
let tokens = [];
|
|
1718
1904
|
let start = min;
|
|
1719
1905
|
let prev;
|
|
1720
|
-
for (let
|
|
1721
|
-
let max2 = ranges[
|
|
1906
|
+
for (let i2 = 0; i2 < ranges.length; i2++) {
|
|
1907
|
+
let max2 = ranges[i2];
|
|
1722
1908
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1723
1909
|
let zeros = "";
|
|
1724
1910
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
@@ -1753,13 +1939,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1753
1939
|
}
|
|
1754
1940
|
return result;
|
|
1755
1941
|
}
|
|
1756
|
-
function zip(
|
|
1942
|
+
function zip(a2, b) {
|
|
1757
1943
|
let arr = [];
|
|
1758
|
-
for (let
|
|
1944
|
+
for (let i2 = 0; i2 < a2.length; i2++) arr.push([a2[i2], b[i2]]);
|
|
1759
1945
|
return arr;
|
|
1760
1946
|
}
|
|
1761
|
-
function compare(
|
|
1762
|
-
return
|
|
1947
|
+
function compare(a2, b) {
|
|
1948
|
+
return a2 > b ? 1 : b > a2 ? -1 : 0;
|
|
1763
1949
|
}
|
|
1764
1950
|
function contains(arr, key, val) {
|
|
1765
1951
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1777,8 +1963,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1777
1963
|
}
|
|
1778
1964
|
return "";
|
|
1779
1965
|
}
|
|
1780
|
-
function toCharacterClass(
|
|
1781
|
-
return `[${
|
|
1966
|
+
function toCharacterClass(a2, b, options) {
|
|
1967
|
+
return `[${a2}${b - a2 === 1 ? "" : "-"}${b}]`;
|
|
1782
1968
|
}
|
|
1783
1969
|
function hasPadding(str) {
|
|
1784
1970
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1857,8 +2043,8 @@ var require_fill_range = __commonJS({
|
|
|
1857
2043
|
return negative ? "-" + input : input;
|
|
1858
2044
|
};
|
|
1859
2045
|
var toSequence = (parts, options, maxLen) => {
|
|
1860
|
-
parts.negatives.sort((
|
|
1861
|
-
parts.positives.sort((
|
|
2046
|
+
parts.negatives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
2047
|
+
parts.positives.sort((a2, b) => a2 < b ? -1 : a2 > b ? 1 : 0);
|
|
1862
2048
|
let prefix = options.capture ? "" : "?:";
|
|
1863
2049
|
let positives = "";
|
|
1864
2050
|
let negatives = "";
|
|
@@ -1879,12 +2065,12 @@ var require_fill_range = __commonJS({
|
|
|
1879
2065
|
}
|
|
1880
2066
|
return result;
|
|
1881
2067
|
};
|
|
1882
|
-
var toRange = (
|
|
2068
|
+
var toRange = (a2, b, isNumbers, options) => {
|
|
1883
2069
|
if (isNumbers) {
|
|
1884
|
-
return toRegexRange(
|
|
2070
|
+
return toRegexRange(a2, b, { wrap: false, ...options });
|
|
1885
2071
|
}
|
|
1886
|
-
let start = String.fromCharCode(
|
|
1887
|
-
if (
|
|
2072
|
+
let start = String.fromCharCode(a2);
|
|
2073
|
+
if (a2 === b) return start;
|
|
1888
2074
|
let stop = String.fromCharCode(b);
|
|
1889
2075
|
return `[${start}-${stop}]`;
|
|
1890
2076
|
};
|
|
@@ -1910,15 +2096,15 @@ var require_fill_range = __commonJS({
|
|
|
1910
2096
|
return [];
|
|
1911
2097
|
};
|
|
1912
2098
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1913
|
-
let
|
|
2099
|
+
let a2 = Number(start);
|
|
1914
2100
|
let b = Number(end);
|
|
1915
|
-
if (!Number.isInteger(
|
|
2101
|
+
if (!Number.isInteger(a2) || !Number.isInteger(b)) {
|
|
1916
2102
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1917
2103
|
return [];
|
|
1918
2104
|
}
|
|
1919
|
-
if (
|
|
2105
|
+
if (a2 === 0) a2 = 0;
|
|
1920
2106
|
if (b === 0) b = 0;
|
|
1921
|
-
let descending =
|
|
2107
|
+
let descending = a2 > b;
|
|
1922
2108
|
let startString = String(start);
|
|
1923
2109
|
let endString = String(end);
|
|
1924
2110
|
let stepString = String(step);
|
|
@@ -1934,13 +2120,13 @@ var require_fill_range = __commonJS({
|
|
|
1934
2120
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
1935
2121
|
let range = [];
|
|
1936
2122
|
let index = 0;
|
|
1937
|
-
while (descending ?
|
|
2123
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
1938
2124
|
if (options.toRegex === true && step > 1) {
|
|
1939
|
-
push(
|
|
2125
|
+
push(a2);
|
|
1940
2126
|
} else {
|
|
1941
|
-
range.push(pad(format(
|
|
2127
|
+
range.push(pad(format(a2, index), maxLen, toNumber));
|
|
1942
2128
|
}
|
|
1943
|
-
|
|
2129
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
1944
2130
|
index++;
|
|
1945
2131
|
}
|
|
1946
2132
|
if (options.toRegex === true) {
|
|
@@ -1953,19 +2139,19 @@ var require_fill_range = __commonJS({
|
|
|
1953
2139
|
return invalidRange(start, end, options);
|
|
1954
2140
|
}
|
|
1955
2141
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
1956
|
-
let
|
|
2142
|
+
let a2 = `${start}`.charCodeAt(0);
|
|
1957
2143
|
let b = `${end}`.charCodeAt(0);
|
|
1958
|
-
let descending =
|
|
1959
|
-
let min = Math.min(
|
|
1960
|
-
let max = Math.max(
|
|
2144
|
+
let descending = a2 > b;
|
|
2145
|
+
let min = Math.min(a2, b);
|
|
2146
|
+
let max = Math.max(a2, b);
|
|
1961
2147
|
if (options.toRegex && step === 1) {
|
|
1962
2148
|
return toRange(min, max, false, options);
|
|
1963
2149
|
}
|
|
1964
2150
|
let range = [];
|
|
1965
2151
|
let index = 0;
|
|
1966
|
-
while (descending ?
|
|
1967
|
-
range.push(format(
|
|
1968
|
-
|
|
2152
|
+
while (descending ? a2 >= b : a2 <= b) {
|
|
2153
|
+
range.push(format(a2, index));
|
|
2154
|
+
a2 = descending ? a2 - step : a2 + step;
|
|
1969
2155
|
index++;
|
|
1970
2156
|
}
|
|
1971
2157
|
if (options.toRegex === true) {
|
|
@@ -2088,18 +2274,18 @@ var require_expand = __commonJS({
|
|
|
2088
2274
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2089
2275
|
const walk = (node, parent = {}) => {
|
|
2090
2276
|
node.queue = [];
|
|
2091
|
-
let
|
|
2092
|
-
let
|
|
2093
|
-
while (
|
|
2094
|
-
|
|
2095
|
-
|
|
2277
|
+
let p = parent;
|
|
2278
|
+
let q = parent.queue;
|
|
2279
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
2280
|
+
p = p.parent;
|
|
2281
|
+
q = p.queue;
|
|
2096
2282
|
}
|
|
2097
2283
|
if (node.invalid || node.dollar) {
|
|
2098
|
-
|
|
2284
|
+
q.push(append(q.pop(), stringify2(node, options)));
|
|
2099
2285
|
return;
|
|
2100
2286
|
}
|
|
2101
2287
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
2102
|
-
|
|
2288
|
+
q.push(append(q.pop(), ["{}"]));
|
|
2103
2289
|
return;
|
|
2104
2290
|
}
|
|
2105
2291
|
if (node.nodes && node.ranges > 0) {
|
|
@@ -2111,26 +2297,26 @@ var require_expand = __commonJS({
|
|
|
2111
2297
|
if (range.length === 0) {
|
|
2112
2298
|
range = stringify2(node, options);
|
|
2113
2299
|
}
|
|
2114
|
-
|
|
2300
|
+
q.push(append(q.pop(), range));
|
|
2115
2301
|
node.nodes = [];
|
|
2116
2302
|
return;
|
|
2117
2303
|
}
|
|
2118
2304
|
const enclose = utils.encloseBrace(node);
|
|
2119
2305
|
let queue = node.queue;
|
|
2120
|
-
let
|
|
2121
|
-
while (
|
|
2122
|
-
|
|
2123
|
-
queue =
|
|
2306
|
+
let block2 = node;
|
|
2307
|
+
while (block2.type !== "brace" && block2.type !== "root" && block2.parent) {
|
|
2308
|
+
block2 = block2.parent;
|
|
2309
|
+
queue = block2.queue;
|
|
2124
2310
|
}
|
|
2125
|
-
for (let
|
|
2126
|
-
const child = node.nodes[
|
|
2311
|
+
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
|
2312
|
+
const child = node.nodes[i2];
|
|
2127
2313
|
if (child.type === "comma" && node.type === "brace") {
|
|
2128
|
-
if (
|
|
2314
|
+
if (i2 === 1) queue.push("");
|
|
2129
2315
|
queue.push("");
|
|
2130
2316
|
continue;
|
|
2131
2317
|
}
|
|
2132
2318
|
if (child.type === "close") {
|
|
2133
|
-
|
|
2319
|
+
q.push(append(q.pop(), queue, enclose));
|
|
2134
2320
|
continue;
|
|
2135
2321
|
}
|
|
2136
2322
|
if (child.value && child.type !== "open") {
|
|
@@ -2297,7 +2483,7 @@ var require_parse = __commonJS({
|
|
|
2297
2483
|
}
|
|
2298
2484
|
const ast = { type: "root", input, nodes: [] };
|
|
2299
2485
|
const stack = [ast];
|
|
2300
|
-
let
|
|
2486
|
+
let block2 = ast;
|
|
2301
2487
|
let prev = ast;
|
|
2302
2488
|
let brackets = 0;
|
|
2303
2489
|
const length = input.length;
|
|
@@ -2313,15 +2499,15 @@ var require_parse = __commonJS({
|
|
|
2313
2499
|
prev.value += node.value;
|
|
2314
2500
|
return;
|
|
2315
2501
|
}
|
|
2316
|
-
|
|
2317
|
-
node.parent =
|
|
2502
|
+
block2.nodes.push(node);
|
|
2503
|
+
node.parent = block2;
|
|
2318
2504
|
node.prev = prev;
|
|
2319
2505
|
prev = node;
|
|
2320
2506
|
return node;
|
|
2321
2507
|
};
|
|
2322
2508
|
push({ type: "bos" });
|
|
2323
2509
|
while (index < length) {
|
|
2324
|
-
|
|
2510
|
+
block2 = stack[stack.length - 1];
|
|
2325
2511
|
value = advance();
|
|
2326
2512
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2327
2513
|
continue;
|
|
@@ -2358,19 +2544,19 @@ var require_parse = __commonJS({
|
|
|
2358
2544
|
continue;
|
|
2359
2545
|
}
|
|
2360
2546
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2361
|
-
|
|
2362
|
-
stack.push(
|
|
2547
|
+
block2 = push({ type: "paren", nodes: [] });
|
|
2548
|
+
stack.push(block2);
|
|
2363
2549
|
push({ type: "text", value });
|
|
2364
2550
|
continue;
|
|
2365
2551
|
}
|
|
2366
2552
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2367
|
-
if (
|
|
2553
|
+
if (block2.type !== "paren") {
|
|
2368
2554
|
push({ type: "text", value });
|
|
2369
2555
|
continue;
|
|
2370
2556
|
}
|
|
2371
|
-
|
|
2557
|
+
block2 = stack.pop();
|
|
2372
2558
|
push({ type: "text", value });
|
|
2373
|
-
|
|
2559
|
+
block2 = stack[stack.length - 1];
|
|
2374
2560
|
continue;
|
|
2375
2561
|
}
|
|
2376
2562
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
@@ -2395,7 +2581,7 @@ var require_parse = __commonJS({
|
|
|
2395
2581
|
}
|
|
2396
2582
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2397
2583
|
depth++;
|
|
2398
|
-
const dollar = prev.value && prev.value.slice(-1) === "$" ||
|
|
2584
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block2.dollar === true;
|
|
2399
2585
|
const brace = {
|
|
2400
2586
|
type: "brace",
|
|
2401
2587
|
open: true,
|
|
@@ -2406,52 +2592,52 @@ var require_parse = __commonJS({
|
|
|
2406
2592
|
ranges: 0,
|
|
2407
2593
|
nodes: []
|
|
2408
2594
|
};
|
|
2409
|
-
|
|
2410
|
-
stack.push(
|
|
2595
|
+
block2 = push(brace);
|
|
2596
|
+
stack.push(block2);
|
|
2411
2597
|
push({ type: "open", value });
|
|
2412
2598
|
continue;
|
|
2413
2599
|
}
|
|
2414
2600
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2415
|
-
if (
|
|
2601
|
+
if (block2.type !== "brace") {
|
|
2416
2602
|
push({ type: "text", value });
|
|
2417
2603
|
continue;
|
|
2418
2604
|
}
|
|
2419
2605
|
const type = "close";
|
|
2420
|
-
|
|
2421
|
-
|
|
2606
|
+
block2 = stack.pop();
|
|
2607
|
+
block2.close = true;
|
|
2422
2608
|
push({ type, value });
|
|
2423
2609
|
depth--;
|
|
2424
|
-
|
|
2610
|
+
block2 = stack[stack.length - 1];
|
|
2425
2611
|
continue;
|
|
2426
2612
|
}
|
|
2427
2613
|
if (value === CHAR_COMMA && depth > 0) {
|
|
2428
|
-
if (
|
|
2429
|
-
|
|
2430
|
-
const open =
|
|
2431
|
-
|
|
2614
|
+
if (block2.ranges > 0) {
|
|
2615
|
+
block2.ranges = 0;
|
|
2616
|
+
const open = block2.nodes.shift();
|
|
2617
|
+
block2.nodes = [open, { type: "text", value: stringify2(block2) }];
|
|
2432
2618
|
}
|
|
2433
2619
|
push({ type: "comma", value });
|
|
2434
|
-
|
|
2620
|
+
block2.commas++;
|
|
2435
2621
|
continue;
|
|
2436
2622
|
}
|
|
2437
|
-
if (value === CHAR_DOT && depth > 0 &&
|
|
2438
|
-
const siblings =
|
|
2623
|
+
if (value === CHAR_DOT && depth > 0 && block2.commas === 0) {
|
|
2624
|
+
const siblings = block2.nodes;
|
|
2439
2625
|
if (depth === 0 || siblings.length === 0) {
|
|
2440
2626
|
push({ type: "text", value });
|
|
2441
2627
|
continue;
|
|
2442
2628
|
}
|
|
2443
2629
|
if (prev.type === "dot") {
|
|
2444
|
-
|
|
2630
|
+
block2.range = [];
|
|
2445
2631
|
prev.value += value;
|
|
2446
2632
|
prev.type = "range";
|
|
2447
|
-
if (
|
|
2448
|
-
|
|
2449
|
-
|
|
2633
|
+
if (block2.nodes.length !== 3 && block2.nodes.length !== 5) {
|
|
2634
|
+
block2.invalid = true;
|
|
2635
|
+
block2.ranges = 0;
|
|
2450
2636
|
prev.type = "text";
|
|
2451
2637
|
continue;
|
|
2452
2638
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2639
|
+
block2.ranges++;
|
|
2640
|
+
block2.args = [];
|
|
2455
2641
|
continue;
|
|
2456
2642
|
}
|
|
2457
2643
|
if (prev.type === "range") {
|
|
@@ -2459,7 +2645,7 @@ var require_parse = __commonJS({
|
|
|
2459
2645
|
const before = siblings[siblings.length - 1];
|
|
2460
2646
|
before.value += prev.value + value;
|
|
2461
2647
|
prev = before;
|
|
2462
|
-
|
|
2648
|
+
block2.ranges--;
|
|
2463
2649
|
continue;
|
|
2464
2650
|
}
|
|
2465
2651
|
push({ type: "dot", value });
|
|
@@ -2468,9 +2654,9 @@ var require_parse = __commonJS({
|
|
|
2468
2654
|
push({ type: "text", value });
|
|
2469
2655
|
}
|
|
2470
2656
|
do {
|
|
2471
|
-
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2657
|
+
block2 = stack.pop();
|
|
2658
|
+
if (block2.type !== "root") {
|
|
2659
|
+
block2.nodes.forEach((node) => {
|
|
2474
2660
|
if (!node.nodes) {
|
|
2475
2661
|
if (node.type === "open") node.isOpen = true;
|
|
2476
2662
|
if (node.type === "close") node.isClose = true;
|
|
@@ -2479,8 +2665,8 @@ var require_parse = __commonJS({
|
|
|
2479
2665
|
}
|
|
2480
2666
|
});
|
|
2481
2667
|
const parent = stack[stack.length - 1];
|
|
2482
|
-
const index2 = parent.nodes.indexOf(
|
|
2483
|
-
parent.nodes.splice(index2, 1, ...
|
|
2668
|
+
const index2 = parent.nodes.indexOf(block2);
|
|
2669
|
+
parent.nodes.splice(index2, 1, ...block2.nodes);
|
|
2484
2670
|
}
|
|
2485
2671
|
} while (stack.length > 0);
|
|
2486
2672
|
push({ type: "eos" });
|
|
@@ -3113,9 +3299,9 @@ var require_scan = __commonJS({
|
|
|
3113
3299
|
if (opts.parts === true || opts.tokens === true) {
|
|
3114
3300
|
let prevIndex;
|
|
3115
3301
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3116
|
-
const
|
|
3117
|
-
const
|
|
3118
|
-
const value = input.slice(
|
|
3302
|
+
const n3 = prevIndex ? prevIndex + 1 : start;
|
|
3303
|
+
const i2 = slashes[idx];
|
|
3304
|
+
const value = input.slice(n3, i2);
|
|
3119
3305
|
if (opts.tokens) {
|
|
3120
3306
|
if (idx === 0 && start !== 0) {
|
|
3121
3307
|
tokens[idx].isPrefix = true;
|
|
@@ -3129,7 +3315,7 @@ var require_scan = __commonJS({
|
|
|
3129
3315
|
if (idx !== 0 || value !== "") {
|
|
3130
3316
|
parts.push(value);
|
|
3131
3317
|
}
|
|
3132
|
-
prevIndex =
|
|
3318
|
+
prevIndex = i2;
|
|
3133
3319
|
}
|
|
3134
3320
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3135
3321
|
const value = input.slice(prevIndex + 1);
|
|
@@ -3258,15 +3444,15 @@ var require_parse2 = __commonJS({
|
|
|
3258
3444
|
};
|
|
3259
3445
|
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3260
3446
|
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3261
|
-
for (let
|
|
3262
|
-
for (let
|
|
3263
|
-
const
|
|
3264
|
-
const b = values[
|
|
3265
|
-
const char =
|
|
3266
|
-
if (!char ||
|
|
3447
|
+
for (let i2 = 0; i2 < values.length; i2++) {
|
|
3448
|
+
for (let j = i2 + 1; j < values.length; j++) {
|
|
3449
|
+
const a2 = values[i2];
|
|
3450
|
+
const b = values[j];
|
|
3451
|
+
const char = a2[0];
|
|
3452
|
+
if (!char || a2 !== char.repeat(a2.length) || b !== char.repeat(b.length)) {
|
|
3267
3453
|
continue;
|
|
3268
3454
|
}
|
|
3269
|
-
if (
|
|
3455
|
+
if (a2 === b || a2.startsWith(b) || b.startsWith(a2)) {
|
|
3270
3456
|
return true;
|
|
3271
3457
|
}
|
|
3272
3458
|
}
|
|
@@ -3281,8 +3467,8 @@ var require_parse2 = __commonJS({
|
|
|
3281
3467
|
let paren = 0;
|
|
3282
3468
|
let quote = 0;
|
|
3283
3469
|
let escaped = false;
|
|
3284
|
-
for (let
|
|
3285
|
-
const ch = pattern[
|
|
3470
|
+
for (let i2 = 1; i2 < pattern.length; i2++) {
|
|
3471
|
+
const ch = pattern[i2];
|
|
3286
3472
|
if (escaped === true) {
|
|
3287
3473
|
escaped = false;
|
|
3288
3474
|
continue;
|
|
@@ -3316,13 +3502,13 @@ var require_parse2 = __commonJS({
|
|
|
3316
3502
|
if (ch === ")") {
|
|
3317
3503
|
paren--;
|
|
3318
3504
|
if (paren === 0) {
|
|
3319
|
-
if (requireEnd === true &&
|
|
3505
|
+
if (requireEnd === true && i2 !== pattern.length - 1) {
|
|
3320
3506
|
return;
|
|
3321
3507
|
}
|
|
3322
3508
|
return {
|
|
3323
3509
|
type: pattern[0],
|
|
3324
|
-
body: pattern.slice(2,
|
|
3325
|
-
end:
|
|
3510
|
+
body: pattern.slice(2, i2),
|
|
3511
|
+
end: i2
|
|
3326
3512
|
};
|
|
3327
3513
|
}
|
|
3328
3514
|
}
|
|
@@ -3454,7 +3640,7 @@ var require_parse2 = __commonJS({
|
|
|
3454
3640
|
let prev = bos;
|
|
3455
3641
|
let value;
|
|
3456
3642
|
const eos = () => state.index === len - 1;
|
|
3457
|
-
const peek = state.peek = (
|
|
3643
|
+
const peek = state.peek = (n3 = 1) => input[state.index + n3];
|
|
3458
3644
|
const advance = state.advance = () => input[++state.index] || "";
|
|
3459
3645
|
const remaining = () => input.slice(state.index + 1);
|
|
3460
3646
|
const consume = (value2 = "", num = 0) => {
|
|
@@ -3535,10 +3721,10 @@ var require_parse2 = __commonJS({
|
|
|
3535
3721
|
open.type = "text";
|
|
3536
3722
|
open.value = literal;
|
|
3537
3723
|
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3538
|
-
for (let
|
|
3539
|
-
tokens[
|
|
3540
|
-
tokens[
|
|
3541
|
-
delete tokens[
|
|
3724
|
+
for (let i2 = token.tokensIndex + 1; i2 < tokens.length; i2++) {
|
|
3725
|
+
tokens[i2].value = "";
|
|
3726
|
+
tokens[i2].output = "";
|
|
3727
|
+
delete tokens[i2].suffix;
|
|
3542
3728
|
}
|
|
3543
3729
|
state.output = token.output + open.output;
|
|
3544
3730
|
state.backtrack = true;
|
|
@@ -3781,13 +3967,13 @@ var require_parse2 = __commonJS({
|
|
|
3781
3967
|
if (brace.dots === true) {
|
|
3782
3968
|
const arr = tokens.slice();
|
|
3783
3969
|
const range = [];
|
|
3784
|
-
for (let
|
|
3970
|
+
for (let i2 = arr.length - 1; i2 >= 0; i2--) {
|
|
3785
3971
|
tokens.pop();
|
|
3786
|
-
if (arr[
|
|
3972
|
+
if (arr[i2].type === "brace") {
|
|
3787
3973
|
break;
|
|
3788
3974
|
}
|
|
3789
|
-
if (arr[
|
|
3790
|
-
range.unshift(arr[
|
|
3975
|
+
if (arr[i2].type !== "dots") {
|
|
3976
|
+
range.unshift(arr[i2].value);
|
|
3791
3977
|
}
|
|
3792
3978
|
}
|
|
3793
3979
|
output = expandRange(range, opts);
|
|
@@ -4246,7 +4432,7 @@ var require_picomatch = __commonJS({
|
|
|
4246
4432
|
};
|
|
4247
4433
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4248
4434
|
picomatch.parse = (pattern, options) => {
|
|
4249
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
4435
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
4250
4436
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
4251
4437
|
};
|
|
4252
4438
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -4330,8 +4516,8 @@ var require_micromatch = __commonJS({
|
|
|
4330
4516
|
options.onResult(state);
|
|
4331
4517
|
}
|
|
4332
4518
|
};
|
|
4333
|
-
for (let
|
|
4334
|
-
let isMatch = picomatch(String(patterns[
|
|
4519
|
+
for (let i2 = 0; i2 < patterns.length; i2++) {
|
|
4520
|
+
let isMatch = picomatch(String(patterns[i2]), { ...options, onResult }, true);
|
|
4335
4521
|
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4336
4522
|
if (negated) negatives++;
|
|
4337
4523
|
for (let item of list) {
|
|
@@ -4353,7 +4539,7 @@ var require_micromatch = __commonJS({
|
|
|
4353
4539
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4354
4540
|
}
|
|
4355
4541
|
if (options.nonull === true || options.nullglob === true) {
|
|
4356
|
-
return options.unescape ? patterns.map((
|
|
4542
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4357
4543
|
}
|
|
4358
4544
|
}
|
|
4359
4545
|
return matches;
|
|
@@ -4383,7 +4569,7 @@ var require_micromatch = __commonJS({
|
|
|
4383
4569
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4384
4570
|
}
|
|
4385
4571
|
if (Array.isArray(pattern)) {
|
|
4386
|
-
return pattern.some((
|
|
4572
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
4387
4573
|
}
|
|
4388
4574
|
if (typeof pattern === "string") {
|
|
4389
4575
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -4428,7 +4614,7 @@ var require_micromatch = __commonJS({
|
|
|
4428
4614
|
if (typeof str !== "string") {
|
|
4429
4615
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4430
4616
|
}
|
|
4431
|
-
return [].concat(patterns).every((
|
|
4617
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4432
4618
|
};
|
|
4433
4619
|
micromatch.capture = (glob, input, options) => {
|
|
4434
4620
|
let posix = utils.isWindows(options);
|
|
@@ -4579,7 +4765,7 @@ var require_pattern = __commonJS({
|
|
|
4579
4765
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
4580
4766
|
function expandBraceExpansion(pattern) {
|
|
4581
4767
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
4582
|
-
patterns.sort((
|
|
4768
|
+
patterns.sort((a2, b) => a2.length - b.length);
|
|
4583
4769
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
4584
4770
|
}
|
|
4585
4771
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4660,8 +4846,8 @@ var require_merge2 = __commonJS({
|
|
|
4660
4846
|
}
|
|
4661
4847
|
const mergedStream = PassThrough(options);
|
|
4662
4848
|
function addStream() {
|
|
4663
|
-
for (let
|
|
4664
|
-
streamsQueue.push(pauseStreams(arguments[
|
|
4849
|
+
for (let i2 = 0, len = arguments.length; i2 < len; i2++) {
|
|
4850
|
+
streamsQueue.push(pauseStreams(arguments[i2], options));
|
|
4665
4851
|
}
|
|
4666
4852
|
mergeStream();
|
|
4667
4853
|
return this;
|
|
@@ -4710,8 +4896,8 @@ var require_merge2 = __commonJS({
|
|
|
4710
4896
|
stream.pipe(mergedStream, { end: false });
|
|
4711
4897
|
stream.resume();
|
|
4712
4898
|
}
|
|
4713
|
-
for (let
|
|
4714
|
-
pipe(streams[
|
|
4899
|
+
for (let i2 = 0; i2 < streams.length; i2++) {
|
|
4900
|
+
pipe(streams[i2]);
|
|
4715
4901
|
}
|
|
4716
4902
|
next();
|
|
4717
4903
|
}
|
|
@@ -4742,8 +4928,8 @@ var require_merge2 = __commonJS({
|
|
|
4742
4928
|
}
|
|
4743
4929
|
streams.pause();
|
|
4744
4930
|
} else {
|
|
4745
|
-
for (let
|
|
4746
|
-
streams[
|
|
4931
|
+
for (let i2 = 0, len = streams.length; i2 < len; i2++) {
|
|
4932
|
+
streams[i2] = pauseStreams(streams[i2], options);
|
|
4747
4933
|
}
|
|
4748
4934
|
}
|
|
4749
4935
|
return streams;
|
|
@@ -4825,13 +5011,13 @@ var require_tasks = __commonJS({
|
|
|
4825
5011
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4826
5012
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
|
4827
5013
|
var utils = require_utils3();
|
|
4828
|
-
function generate(input,
|
|
4829
|
-
const patterns = processPatterns(input,
|
|
4830
|
-
const ignore = processPatterns(
|
|
5014
|
+
function generate(input, settings2) {
|
|
5015
|
+
const patterns = processPatterns(input, settings2);
|
|
5016
|
+
const ignore = processPatterns(settings2.ignore, settings2);
|
|
4831
5017
|
const positivePatterns = getPositivePatterns(patterns);
|
|
4832
5018
|
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
|
4833
|
-
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern,
|
|
4834
|
-
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern,
|
|
5019
|
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
|
|
5020
|
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
|
|
4835
5021
|
const staticTasks = convertPatternsToTasks(
|
|
4836
5022
|
staticPatterns,
|
|
4837
5023
|
negativePatterns,
|
|
@@ -4847,12 +5033,12 @@ var require_tasks = __commonJS({
|
|
|
4847
5033
|
return staticTasks.concat(dynamicTasks);
|
|
4848
5034
|
}
|
|
4849
5035
|
exports.generate = generate;
|
|
4850
|
-
function processPatterns(input,
|
|
5036
|
+
function processPatterns(input, settings2) {
|
|
4851
5037
|
let patterns = input;
|
|
4852
|
-
if (
|
|
5038
|
+
if (settings2.braceExpansion) {
|
|
4853
5039
|
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
|
4854
5040
|
}
|
|
4855
|
-
if (
|
|
5041
|
+
if (settings2.baseNameMatch) {
|
|
4856
5042
|
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
|
4857
5043
|
}
|
|
4858
5044
|
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
|
@@ -4921,26 +5107,26 @@ var require_async = __commonJS({
|
|
|
4921
5107
|
init_utils2();
|
|
4922
5108
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4923
5109
|
exports.read = void 0;
|
|
4924
|
-
function read(path,
|
|
4925
|
-
|
|
5110
|
+
function read(path, settings2, callback) {
|
|
5111
|
+
settings2.fs.lstat(path, (lstatError, lstat) => {
|
|
4926
5112
|
if (lstatError !== null) {
|
|
4927
5113
|
callFailureCallback(callback, lstatError);
|
|
4928
5114
|
return;
|
|
4929
5115
|
}
|
|
4930
|
-
if (!lstat.isSymbolicLink() || !
|
|
5116
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
4931
5117
|
callSuccessCallback(callback, lstat);
|
|
4932
5118
|
return;
|
|
4933
5119
|
}
|
|
4934
|
-
|
|
5120
|
+
settings2.fs.stat(path, (statError, stat) => {
|
|
4935
5121
|
if (statError !== null) {
|
|
4936
|
-
if (
|
|
5122
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
4937
5123
|
callFailureCallback(callback, statError);
|
|
4938
5124
|
return;
|
|
4939
5125
|
}
|
|
4940
5126
|
callSuccessCallback(callback, lstat);
|
|
4941
5127
|
return;
|
|
4942
5128
|
}
|
|
4943
|
-
if (
|
|
5129
|
+
if (settings2.markSymbolicLink) {
|
|
4944
5130
|
stat.isSymbolicLink = () => true;
|
|
4945
5131
|
}
|
|
4946
5132
|
callSuccessCallback(callback, stat);
|
|
@@ -4964,19 +5150,19 @@ var require_sync = __commonJS({
|
|
|
4964
5150
|
init_utils2();
|
|
4965
5151
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4966
5152
|
exports.read = void 0;
|
|
4967
|
-
function read(path,
|
|
4968
|
-
const lstat =
|
|
4969
|
-
if (!lstat.isSymbolicLink() || !
|
|
5153
|
+
function read(path, settings2) {
|
|
5154
|
+
const lstat = settings2.fs.lstatSync(path);
|
|
5155
|
+
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
4970
5156
|
return lstat;
|
|
4971
5157
|
}
|
|
4972
5158
|
try {
|
|
4973
|
-
const stat =
|
|
4974
|
-
if (
|
|
5159
|
+
const stat = settings2.fs.statSync(path);
|
|
5160
|
+
if (settings2.markSymbolicLink) {
|
|
4975
5161
|
stat.isSymbolicLink = () => true;
|
|
4976
5162
|
}
|
|
4977
5163
|
return stat;
|
|
4978
5164
|
} catch (error2) {
|
|
4979
|
-
if (!
|
|
5165
|
+
if (!settings2.throwErrorOnBrokenSymbolicLink) {
|
|
4980
5166
|
return lstat;
|
|
4981
5167
|
}
|
|
4982
5168
|
throw error2;
|
|
@@ -5053,8 +5239,8 @@ var require_out = __commonJS({
|
|
|
5053
5239
|
}
|
|
5054
5240
|
exports.stat = stat;
|
|
5055
5241
|
function statSync3(path, optionsOrSettings) {
|
|
5056
|
-
const
|
|
5057
|
-
return sync.read(path,
|
|
5242
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5243
|
+
return sync.read(path, settings2);
|
|
5058
5244
|
}
|
|
5059
5245
|
exports.statSync = statSync3;
|
|
5060
5246
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5102,8 +5288,8 @@ var require_run_parallel = __commonJS({
|
|
|
5102
5288
|
if (isSync) queueMicrotask2(end);
|
|
5103
5289
|
else end();
|
|
5104
5290
|
}
|
|
5105
|
-
function each(
|
|
5106
|
-
results[
|
|
5291
|
+
function each(i2, err, result) {
|
|
5292
|
+
results[i2] = result;
|
|
5107
5293
|
if (--pending === 0 || err) {
|
|
5108
5294
|
done(err);
|
|
5109
5295
|
}
|
|
@@ -5117,9 +5303,9 @@ var require_run_parallel = __commonJS({
|
|
|
5117
5303
|
});
|
|
5118
5304
|
});
|
|
5119
5305
|
} else {
|
|
5120
|
-
tasks.forEach(function(task,
|
|
5306
|
+
tasks.forEach(function(task, i2) {
|
|
5121
5307
|
task(function(err, result) {
|
|
5122
|
-
each(
|
|
5308
|
+
each(i2, err, result);
|
|
5123
5309
|
});
|
|
5124
5310
|
});
|
|
5125
5311
|
}
|
|
@@ -5194,11 +5380,11 @@ var require_common = __commonJS({
|
|
|
5194
5380
|
init_utils2();
|
|
5195
5381
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5196
5382
|
exports.joinPathSegments = void 0;
|
|
5197
|
-
function joinPathSegments(
|
|
5198
|
-
if (
|
|
5199
|
-
return
|
|
5383
|
+
function joinPathSegments(a2, b, separator) {
|
|
5384
|
+
if (a2.endsWith(separator)) {
|
|
5385
|
+
return a2 + b;
|
|
5200
5386
|
}
|
|
5201
|
-
return
|
|
5387
|
+
return a2 + separator + b;
|
|
5202
5388
|
}
|
|
5203
5389
|
exports.joinPathSegments = joinPathSegments;
|
|
5204
5390
|
}
|
|
@@ -5216,16 +5402,16 @@ var require_async2 = __commonJS({
|
|
|
5216
5402
|
var constants_1 = require_constants3();
|
|
5217
5403
|
var utils = require_utils4();
|
|
5218
5404
|
var common = require_common();
|
|
5219
|
-
function read(directory,
|
|
5220
|
-
if (!
|
|
5221
|
-
readdirWithFileTypes(directory,
|
|
5405
|
+
function read(directory, settings2, callback) {
|
|
5406
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5407
|
+
readdirWithFileTypes(directory, settings2, callback);
|
|
5222
5408
|
return;
|
|
5223
5409
|
}
|
|
5224
|
-
readdir(directory,
|
|
5410
|
+
readdir(directory, settings2, callback);
|
|
5225
5411
|
}
|
|
5226
5412
|
exports.read = read;
|
|
5227
|
-
function readdirWithFileTypes(directory,
|
|
5228
|
-
|
|
5413
|
+
function readdirWithFileTypes(directory, settings2, callback) {
|
|
5414
|
+
settings2.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
5229
5415
|
if (readdirError !== null) {
|
|
5230
5416
|
callFailureCallback(callback, readdirError);
|
|
5231
5417
|
return;
|
|
@@ -5233,13 +5419,13 @@ var require_async2 = __commonJS({
|
|
|
5233
5419
|
const entries = dirents.map((dirent) => ({
|
|
5234
5420
|
dirent,
|
|
5235
5421
|
name: dirent.name,
|
|
5236
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5422
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5237
5423
|
}));
|
|
5238
|
-
if (!
|
|
5424
|
+
if (!settings2.followSymbolicLinks) {
|
|
5239
5425
|
callSuccessCallback(callback, entries);
|
|
5240
5426
|
return;
|
|
5241
5427
|
}
|
|
5242
|
-
const tasks = entries.map((entry) => makeRplTaskEntry(entry,
|
|
5428
|
+
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings2));
|
|
5243
5429
|
rpl(tasks, (rplError, rplEntries) => {
|
|
5244
5430
|
if (rplError !== null) {
|
|
5245
5431
|
callFailureCallback(callback, rplError);
|
|
@@ -5250,15 +5436,15 @@ var require_async2 = __commonJS({
|
|
|
5250
5436
|
});
|
|
5251
5437
|
}
|
|
5252
5438
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5253
|
-
function makeRplTaskEntry(entry,
|
|
5439
|
+
function makeRplTaskEntry(entry, settings2) {
|
|
5254
5440
|
return (done) => {
|
|
5255
5441
|
if (!entry.dirent.isSymbolicLink()) {
|
|
5256
5442
|
done(null, entry);
|
|
5257
5443
|
return;
|
|
5258
5444
|
}
|
|
5259
|
-
|
|
5445
|
+
settings2.fs.stat(entry.path, (statError, stats) => {
|
|
5260
5446
|
if (statError !== null) {
|
|
5261
|
-
if (
|
|
5447
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5262
5448
|
done(statError);
|
|
5263
5449
|
return;
|
|
5264
5450
|
}
|
|
@@ -5270,16 +5456,16 @@ var require_async2 = __commonJS({
|
|
|
5270
5456
|
});
|
|
5271
5457
|
};
|
|
5272
5458
|
}
|
|
5273
|
-
function readdir(directory,
|
|
5274
|
-
|
|
5459
|
+
function readdir(directory, settings2, callback) {
|
|
5460
|
+
settings2.fs.readdir(directory, (readdirError, names) => {
|
|
5275
5461
|
if (readdirError !== null) {
|
|
5276
5462
|
callFailureCallback(callback, readdirError);
|
|
5277
5463
|
return;
|
|
5278
5464
|
}
|
|
5279
5465
|
const tasks = names.map((name) => {
|
|
5280
|
-
const path = common.joinPathSegments(directory, name,
|
|
5466
|
+
const path = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5281
5467
|
return (done) => {
|
|
5282
|
-
fsStat.stat(path,
|
|
5468
|
+
fsStat.stat(path, settings2.fsStatSettings, (error2, stats) => {
|
|
5283
5469
|
if (error2 !== null) {
|
|
5284
5470
|
done(error2);
|
|
5285
5471
|
return;
|
|
@@ -5289,7 +5475,7 @@ var require_async2 = __commonJS({
|
|
|
5289
5475
|
path,
|
|
5290
5476
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5291
5477
|
};
|
|
5292
|
-
if (
|
|
5478
|
+
if (settings2.stats) {
|
|
5293
5479
|
entry.stats = stats;
|
|
5294
5480
|
}
|
|
5295
5481
|
done(null, entry);
|
|
@@ -5326,27 +5512,27 @@ var require_sync2 = __commonJS({
|
|
|
5326
5512
|
var constants_1 = require_constants3();
|
|
5327
5513
|
var utils = require_utils4();
|
|
5328
5514
|
var common = require_common();
|
|
5329
|
-
function read(directory,
|
|
5330
|
-
if (!
|
|
5331
|
-
return readdirWithFileTypes(directory,
|
|
5515
|
+
function read(directory, settings2) {
|
|
5516
|
+
if (!settings2.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
5517
|
+
return readdirWithFileTypes(directory, settings2);
|
|
5332
5518
|
}
|
|
5333
|
-
return readdir(directory,
|
|
5519
|
+
return readdir(directory, settings2);
|
|
5334
5520
|
}
|
|
5335
5521
|
exports.read = read;
|
|
5336
|
-
function readdirWithFileTypes(directory,
|
|
5337
|
-
const dirents =
|
|
5522
|
+
function readdirWithFileTypes(directory, settings2) {
|
|
5523
|
+
const dirents = settings2.fs.readdirSync(directory, { withFileTypes: true });
|
|
5338
5524
|
return dirents.map((dirent) => {
|
|
5339
5525
|
const entry = {
|
|
5340
5526
|
dirent,
|
|
5341
5527
|
name: dirent.name,
|
|
5342
|
-
path: common.joinPathSegments(directory, dirent.name,
|
|
5528
|
+
path: common.joinPathSegments(directory, dirent.name, settings2.pathSegmentSeparator)
|
|
5343
5529
|
};
|
|
5344
|
-
if (entry.dirent.isSymbolicLink() &&
|
|
5530
|
+
if (entry.dirent.isSymbolicLink() && settings2.followSymbolicLinks) {
|
|
5345
5531
|
try {
|
|
5346
|
-
const stats =
|
|
5532
|
+
const stats = settings2.fs.statSync(entry.path);
|
|
5347
5533
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
5348
5534
|
} catch (error2) {
|
|
5349
|
-
if (
|
|
5535
|
+
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
5350
5536
|
throw error2;
|
|
5351
5537
|
}
|
|
5352
5538
|
}
|
|
@@ -5355,17 +5541,17 @@ var require_sync2 = __commonJS({
|
|
|
5355
5541
|
});
|
|
5356
5542
|
}
|
|
5357
5543
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
5358
|
-
function readdir(directory,
|
|
5359
|
-
const names =
|
|
5544
|
+
function readdir(directory, settings2) {
|
|
5545
|
+
const names = settings2.fs.readdirSync(directory);
|
|
5360
5546
|
return names.map((name) => {
|
|
5361
|
-
const entryPath = common.joinPathSegments(directory, name,
|
|
5362
|
-
const stats = fsStat.statSync(entryPath,
|
|
5547
|
+
const entryPath = common.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
5548
|
+
const stats = fsStat.statSync(entryPath, settings2.fsStatSettings);
|
|
5363
5549
|
const entry = {
|
|
5364
5550
|
name,
|
|
5365
5551
|
path: entryPath,
|
|
5366
5552
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
5367
5553
|
};
|
|
5368
|
-
if (
|
|
5554
|
+
if (settings2.stats) {
|
|
5369
5555
|
entry.stats = stats;
|
|
5370
5556
|
}
|
|
5371
5557
|
return entry;
|
|
@@ -5452,8 +5638,8 @@ var require_out2 = __commonJS({
|
|
|
5452
5638
|
}
|
|
5453
5639
|
exports.scandir = scandir;
|
|
5454
5640
|
function scandirSync(path, optionsOrSettings) {
|
|
5455
|
-
const
|
|
5456
|
-
return sync.read(path,
|
|
5641
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
5642
|
+
return sync.read(path, settings2);
|
|
5457
5643
|
}
|
|
5458
5644
|
exports.scandirSync = scandirSync;
|
|
5459
5645
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -5734,7 +5920,7 @@ var require_queue = __commonJS({
|
|
|
5734
5920
|
queue.drained = drained;
|
|
5735
5921
|
return queue;
|
|
5736
5922
|
function push(value) {
|
|
5737
|
-
var
|
|
5923
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5738
5924
|
pushCb(value, function(err, result) {
|
|
5739
5925
|
if (err) {
|
|
5740
5926
|
reject(err);
|
|
@@ -5743,11 +5929,11 @@ var require_queue = __commonJS({
|
|
|
5743
5929
|
resolve4(result);
|
|
5744
5930
|
});
|
|
5745
5931
|
});
|
|
5746
|
-
|
|
5747
|
-
return
|
|
5932
|
+
p.catch(noop);
|
|
5933
|
+
return p;
|
|
5748
5934
|
}
|
|
5749
5935
|
function unshift(value) {
|
|
5750
|
-
var
|
|
5936
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5751
5937
|
unshiftCb(value, function(err, result) {
|
|
5752
5938
|
if (err) {
|
|
5753
5939
|
reject(err);
|
|
@@ -5756,11 +5942,11 @@ var require_queue = __commonJS({
|
|
|
5756
5942
|
resolve4(result);
|
|
5757
5943
|
});
|
|
5758
5944
|
});
|
|
5759
|
-
|
|
5760
|
-
return
|
|
5945
|
+
p.catch(noop);
|
|
5946
|
+
return p;
|
|
5761
5947
|
}
|
|
5762
5948
|
function drained() {
|
|
5763
|
-
var
|
|
5949
|
+
var p = new Promise(function(resolve4) {
|
|
5764
5950
|
process.nextTick(function() {
|
|
5765
5951
|
if (queue.idle()) {
|
|
5766
5952
|
resolve4();
|
|
@@ -5774,7 +5960,7 @@ var require_queue = __commonJS({
|
|
|
5774
5960
|
}
|
|
5775
5961
|
});
|
|
5776
5962
|
});
|
|
5777
|
-
return
|
|
5963
|
+
return p;
|
|
5778
5964
|
}
|
|
5779
5965
|
}
|
|
5780
5966
|
module.exports = fastqueue;
|
|
@@ -5789,11 +5975,11 @@ var require_common2 = __commonJS({
|
|
|
5789
5975
|
init_utils2();
|
|
5790
5976
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5791
5977
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
5792
|
-
function isFatalError(
|
|
5793
|
-
if (
|
|
5978
|
+
function isFatalError(settings2, error2) {
|
|
5979
|
+
if (settings2.errorFilter === null) {
|
|
5794
5980
|
return true;
|
|
5795
5981
|
}
|
|
5796
|
-
return !
|
|
5982
|
+
return !settings2.errorFilter(error2);
|
|
5797
5983
|
}
|
|
5798
5984
|
exports.isFatalError = isFatalError;
|
|
5799
5985
|
function isAppliedFilter(filter, value) {
|
|
@@ -5804,14 +5990,14 @@ var require_common2 = __commonJS({
|
|
|
5804
5990
|
return filepath.split(/[/\\]/).join(separator);
|
|
5805
5991
|
}
|
|
5806
5992
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5807
|
-
function joinPathSegments(
|
|
5808
|
-
if (
|
|
5993
|
+
function joinPathSegments(a2, b, separator) {
|
|
5994
|
+
if (a2 === "") {
|
|
5809
5995
|
return b;
|
|
5810
5996
|
}
|
|
5811
|
-
if (
|
|
5812
|
-
return
|
|
5997
|
+
if (a2.endsWith(separator)) {
|
|
5998
|
+
return a2 + b;
|
|
5813
5999
|
}
|
|
5814
|
-
return
|
|
6000
|
+
return a2 + separator + b;
|
|
5815
6001
|
}
|
|
5816
6002
|
exports.joinPathSegments = joinPathSegments;
|
|
5817
6003
|
}
|
|
@@ -6158,14 +6344,14 @@ var require_out3 = __commonJS({
|
|
|
6158
6344
|
}
|
|
6159
6345
|
exports.walk = walk;
|
|
6160
6346
|
function walkSync(directory, optionsOrSettings) {
|
|
6161
|
-
const
|
|
6162
|
-
const provider = new sync_1.default(directory,
|
|
6347
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6348
|
+
const provider = new sync_1.default(directory, settings2);
|
|
6163
6349
|
return provider.read();
|
|
6164
6350
|
}
|
|
6165
6351
|
exports.walkSync = walkSync;
|
|
6166
6352
|
function walkStream(directory, optionsOrSettings) {
|
|
6167
|
-
const
|
|
6168
|
-
const provider = new stream_1.default(directory,
|
|
6353
|
+
const settings2 = getSettings(optionsOrSettings);
|
|
6354
|
+
const provider = new stream_1.default(directory, settings2);
|
|
6169
6355
|
return provider.read();
|
|
6170
6356
|
}
|
|
6171
6357
|
exports.walkStream = walkStream;
|
|
@@ -6251,8 +6437,8 @@ var require_stream3 = __commonJS({
|
|
|
6251
6437
|
done();
|
|
6252
6438
|
}).catch(done);
|
|
6253
6439
|
};
|
|
6254
|
-
for (let
|
|
6255
|
-
stream.write(
|
|
6440
|
+
for (let i2 = 0; i2 < filepaths.length; i2++) {
|
|
6441
|
+
stream.write(i2);
|
|
6256
6442
|
}
|
|
6257
6443
|
return stream;
|
|
6258
6444
|
}
|
|
@@ -6913,14 +7099,14 @@ var require_out4 = __commonJS({
|
|
|
6913
7099
|
function generateTasks(source, options) {
|
|
6914
7100
|
assertPatternsInput(source);
|
|
6915
7101
|
const patterns = [].concat(source);
|
|
6916
|
-
const
|
|
6917
|
-
return taskManager.generate(patterns,
|
|
7102
|
+
const settings2 = new settings_1.default(options);
|
|
7103
|
+
return taskManager.generate(patterns, settings2);
|
|
6918
7104
|
}
|
|
6919
7105
|
FastGlob2.generateTasks = generateTasks;
|
|
6920
7106
|
function isDynamicPattern(source, options) {
|
|
6921
7107
|
assertPatternsInput(source);
|
|
6922
|
-
const
|
|
6923
|
-
return utils.pattern.isDynamicPattern(source,
|
|
7108
|
+
const settings2 = new settings_1.default(options);
|
|
7109
|
+
return utils.pattern.isDynamicPattern(source, settings2);
|
|
6924
7110
|
}
|
|
6925
7111
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
6926
7112
|
function escapePath(source) {
|
|
@@ -6962,9 +7148,9 @@ var require_out4 = __commonJS({
|
|
|
6962
7148
|
})(FastGlob || (FastGlob = {}));
|
|
6963
7149
|
function getWorks(source, _Provider, options) {
|
|
6964
7150
|
const patterns = [].concat(source);
|
|
6965
|
-
const
|
|
6966
|
-
const tasks = taskManager.generate(patterns,
|
|
6967
|
-
const provider = new _Provider(
|
|
7151
|
+
const settings2 = new settings_1.default(options);
|
|
7152
|
+
const tasks = taskManager.generate(patterns, settings2);
|
|
7153
|
+
const provider = new _Provider(settings2);
|
|
6968
7154
|
return tasks.map(provider.read, provider);
|
|
6969
7155
|
}
|
|
6970
7156
|
function assertPatternsInput(input) {
|
|
@@ -7142,8 +7328,8 @@ import "node:fs";
|
|
|
7142
7328
|
import { createRequire } from "node:module";
|
|
7143
7329
|
import {
|
|
7144
7330
|
resolve,
|
|
7145
|
-
join,
|
|
7146
|
-
dirname,
|
|
7331
|
+
join as join2,
|
|
7332
|
+
dirname as dirname2,
|
|
7147
7333
|
relative,
|
|
7148
7334
|
normalize,
|
|
7149
7335
|
sep,
|
|
@@ -7157,7 +7343,7 @@ function safeExecuteAsync(fn, message) {
|
|
|
7157
7343
|
);
|
|
7158
7344
|
});
|
|
7159
7345
|
}
|
|
7160
|
-
var import_fast_glob, constants,
|
|
7346
|
+
var import_fast_glob, constants, log3, PACKAGE_PATHS, PathResolver;
|
|
7161
7347
|
var init_PathResolver = __esm({
|
|
7162
7348
|
"packages/core/config/utils/PathResolver.ts"() {
|
|
7163
7349
|
"use strict";
|
|
@@ -7170,7 +7356,7 @@ var init_PathResolver = __esm({
|
|
|
7170
7356
|
getPatternsFor: getPatternsFor || void 0,
|
|
7171
7357
|
I18N_PATHS: I18N_PATHS || void 0
|
|
7172
7358
|
};
|
|
7173
|
-
|
|
7359
|
+
log3 = {
|
|
7174
7360
|
error: (message, error2) => {
|
|
7175
7361
|
},
|
|
7176
7362
|
warn: (message, error2) => {
|
|
@@ -7291,7 +7477,7 @@ var init_PathResolver = __esm({
|
|
|
7291
7477
|
*/
|
|
7292
7478
|
getDirname(path) {
|
|
7293
7479
|
if (!path) return "";
|
|
7294
|
-
return this.normalizePath(
|
|
7480
|
+
return this.normalizePath(dirname2(path));
|
|
7295
7481
|
}
|
|
7296
7482
|
/**
|
|
7297
7483
|
* Resolve package path using Node's module resolution
|
|
@@ -7303,7 +7489,7 @@ var init_PathResolver = __esm({
|
|
|
7303
7489
|
resolvePackage(packageSpecifier, fromPath = null) {
|
|
7304
7490
|
try {
|
|
7305
7491
|
const basePath = fromPath || this.getAppRoot();
|
|
7306
|
-
const require3 = createRequire(
|
|
7492
|
+
const require3 = createRequire(join2(basePath, "package.json"));
|
|
7307
7493
|
const resolved = require3.resolve(packageSpecifier);
|
|
7308
7494
|
return this.normalizePath(resolved);
|
|
7309
7495
|
} catch (error2) {
|
|
@@ -7455,7 +7641,7 @@ var init_PathResolver = __esm({
|
|
|
7455
7641
|
return cleanContent;
|
|
7456
7642
|
} catch (error2) {
|
|
7457
7643
|
if (this.options.debug) {
|
|
7458
|
-
|
|
7644
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7459
7645
|
}
|
|
7460
7646
|
return null;
|
|
7461
7647
|
}
|
|
@@ -7483,7 +7669,7 @@ var init_PathResolver = __esm({
|
|
|
7483
7669
|
return cleanContent;
|
|
7484
7670
|
} catch (error2) {
|
|
7485
7671
|
if (this.options.debug) {
|
|
7486
|
-
|
|
7672
|
+
log3.warn(`Failed to read file: ${filePath}`, error2);
|
|
7487
7673
|
}
|
|
7488
7674
|
return null;
|
|
7489
7675
|
}
|
|
@@ -7505,16 +7691,16 @@ var init_PathResolver = __esm({
|
|
|
7505
7691
|
verbose = false
|
|
7506
7692
|
} = options;
|
|
7507
7693
|
const normalizedPath = this.normalizePath(filePath);
|
|
7508
|
-
const dir = this.normalizePath(
|
|
7694
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7509
7695
|
const fileExists = this.pathExists(normalizedPath);
|
|
7510
7696
|
if (fileExists && !overwrite) {
|
|
7511
7697
|
if (verbose) {
|
|
7512
|
-
|
|
7698
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7513
7699
|
}
|
|
7514
7700
|
return false;
|
|
7515
7701
|
}
|
|
7516
7702
|
if (dryRun) {
|
|
7517
|
-
|
|
7703
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7518
7704
|
return true;
|
|
7519
7705
|
}
|
|
7520
7706
|
try {
|
|
@@ -7539,7 +7725,7 @@ var init_PathResolver = __esm({
|
|
|
7539
7725
|
await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
|
|
7540
7726
|
}
|
|
7541
7727
|
if (verbose) {
|
|
7542
|
-
|
|
7728
|
+
log3.info(
|
|
7543
7729
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7544
7730
|
);
|
|
7545
7731
|
}
|
|
@@ -7566,16 +7752,16 @@ var init_PathResolver = __esm({
|
|
|
7566
7752
|
verbose = false
|
|
7567
7753
|
} = options;
|
|
7568
7754
|
const normalizedPath = this.normalizePath(filePath);
|
|
7569
|
-
const dir = this.normalizePath(
|
|
7755
|
+
const dir = this.normalizePath(dirname2(normalizedPath));
|
|
7570
7756
|
const fileExists = this.pathExists(normalizedPath);
|
|
7571
7757
|
if (fileExists && !overwrite) {
|
|
7572
7758
|
if (verbose) {
|
|
7573
|
-
|
|
7759
|
+
log3.info(`Skipping existing file: ${normalizedPath}`);
|
|
7574
7760
|
}
|
|
7575
7761
|
return false;
|
|
7576
7762
|
}
|
|
7577
7763
|
if (dryRun) {
|
|
7578
|
-
|
|
7764
|
+
log3.info(`[DRY RUN] Would write file: ${normalizedPath}`);
|
|
7579
7765
|
return true;
|
|
7580
7766
|
}
|
|
7581
7767
|
try {
|
|
@@ -7599,7 +7785,7 @@ var init_PathResolver = __esm({
|
|
|
7599
7785
|
fs.writeFileSync(normalizedPath, writeContent, "utf8");
|
|
7600
7786
|
}
|
|
7601
7787
|
if (verbose) {
|
|
7602
|
-
|
|
7788
|
+
log3.info(
|
|
7603
7789
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
|
|
7604
7790
|
);
|
|
7605
7791
|
}
|
|
@@ -7624,15 +7810,15 @@ var init_PathResolver = __esm({
|
|
|
7624
7810
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7625
7811
|
if (fileExists && !overwrite) {
|
|
7626
7812
|
if (verbose) {
|
|
7627
|
-
|
|
7813
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7628
7814
|
}
|
|
7629
7815
|
return false;
|
|
7630
7816
|
}
|
|
7631
7817
|
if (dryRun) {
|
|
7632
|
-
|
|
7818
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7633
7819
|
return true;
|
|
7634
7820
|
}
|
|
7635
|
-
const dir = this.normalizePath(
|
|
7821
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7636
7822
|
try {
|
|
7637
7823
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7638
7824
|
} catch (error2) {
|
|
@@ -7642,7 +7828,7 @@ var init_PathResolver = __esm({
|
|
|
7642
7828
|
return await safeExecuteAsync(async () => {
|
|
7643
7829
|
await fs.promises.copyFile(srcPath, normalizedDestPath);
|
|
7644
7830
|
if (verbose) {
|
|
7645
|
-
|
|
7831
|
+
log3.info(
|
|
7646
7832
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7647
7833
|
);
|
|
7648
7834
|
}
|
|
@@ -7666,15 +7852,15 @@ var init_PathResolver = __esm({
|
|
|
7666
7852
|
const fileExists = this.pathExists(normalizedDestPath);
|
|
7667
7853
|
if (fileExists && !overwrite) {
|
|
7668
7854
|
if (verbose) {
|
|
7669
|
-
|
|
7855
|
+
log3.info(`Skipping existing file: ${normalizedDestPath}`);
|
|
7670
7856
|
}
|
|
7671
7857
|
return false;
|
|
7672
7858
|
}
|
|
7673
7859
|
if (dryRun) {
|
|
7674
|
-
|
|
7860
|
+
log3.info(`[DRY RUN] Would copy file: ${normalizedDestPath}`);
|
|
7675
7861
|
return true;
|
|
7676
7862
|
}
|
|
7677
|
-
const dir = this.normalizePath(
|
|
7863
|
+
const dir = this.normalizePath(dirname2(normalizedDestPath));
|
|
7678
7864
|
try {
|
|
7679
7865
|
fs.mkdirSync(dir, { recursive: true });
|
|
7680
7866
|
} catch (error2) {
|
|
@@ -7683,7 +7869,7 @@ var init_PathResolver = __esm({
|
|
|
7683
7869
|
try {
|
|
7684
7870
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
7685
7871
|
if (verbose) {
|
|
7686
|
-
|
|
7872
|
+
log3.info(
|
|
7687
7873
|
`${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
|
|
7688
7874
|
);
|
|
7689
7875
|
}
|
|
@@ -7700,7 +7886,7 @@ var init_PathResolver = __esm({
|
|
|
7700
7886
|
return fs.existsSync(filePath);
|
|
7701
7887
|
} catch (error2) {
|
|
7702
7888
|
if (!silent) {
|
|
7703
|
-
|
|
7889
|
+
log3.error(`Error checking path existence: ${filePath}`, error2);
|
|
7704
7890
|
}
|
|
7705
7891
|
return false;
|
|
7706
7892
|
}
|
|
@@ -7726,7 +7912,7 @@ var init_PathResolver = __esm({
|
|
|
7726
7912
|
return fs.readdirSync(dirPath, options);
|
|
7727
7913
|
} catch (error2) {
|
|
7728
7914
|
if (this.options.debug) {
|
|
7729
|
-
|
|
7915
|
+
log3.warn(`Failed to read directory: ${dirPath}`, error2);
|
|
7730
7916
|
}
|
|
7731
7917
|
const isObjectOptions = options && typeof options === "object" && "withFileTypes" in options;
|
|
7732
7918
|
return isObjectOptions && options.withFileTypes ? [] : [];
|
|
@@ -7744,7 +7930,7 @@ var init_PathResolver = __esm({
|
|
|
7744
7930
|
return fs.statSync(filePath);
|
|
7745
7931
|
} catch (error2) {
|
|
7746
7932
|
if (this.options.debug) {
|
|
7747
|
-
|
|
7933
|
+
log3.warn(`Failed to stat file: ${filePath}`, error2);
|
|
7748
7934
|
}
|
|
7749
7935
|
return null;
|
|
7750
7936
|
}
|
|
@@ -7761,7 +7947,7 @@ var init_PathResolver = __esm({
|
|
|
7761
7947
|
return fs.lstatSync(filePath);
|
|
7762
7948
|
} catch (error2) {
|
|
7763
7949
|
if (this.options.debug) {
|
|
7764
|
-
|
|
7950
|
+
log3.warn(`Failed to lstat file: ${filePath}`, error2);
|
|
7765
7951
|
}
|
|
7766
7952
|
return null;
|
|
7767
7953
|
}
|
|
@@ -7850,7 +8036,7 @@ var init_PathResolver = __esm({
|
|
|
7850
8036
|
* @returns True if repoRoot is the monorepo (has packages directory)
|
|
7851
8037
|
*/
|
|
7852
8038
|
isMonorepo() {
|
|
7853
|
-
const packagesDir =
|
|
8039
|
+
const packagesDir = join2(this._repoRoot, "packages");
|
|
7854
8040
|
return this.pathExists(packagesDir);
|
|
7855
8041
|
}
|
|
7856
8042
|
/**
|
|
@@ -7867,7 +8053,7 @@ var init_PathResolver = __esm({
|
|
|
7867
8053
|
* Find files matching pattern within directory
|
|
7868
8054
|
*/
|
|
7869
8055
|
async findFiles(directory, pattern, options = {}) {
|
|
7870
|
-
const searchPattern = this.normalizePath(
|
|
8056
|
+
const searchPattern = this.normalizePath(join2(directory, pattern));
|
|
7871
8057
|
const appRoot = this.getAppRoot();
|
|
7872
8058
|
const normalizeAppRoot = this.normalizePath(appRoot);
|
|
7873
8059
|
const relativePattern = searchPattern.startsWith(normalizeAppRoot) ? searchPattern.slice(normalizeAppRoot.length + 1) : searchPattern;
|
|
@@ -7914,7 +8100,7 @@ var init_PathResolver = __esm({
|
|
|
7914
8100
|
return null;
|
|
7915
8101
|
}
|
|
7916
8102
|
const resolvedPath = this.normalizePath(
|
|
7917
|
-
|
|
8103
|
+
join2(corePackageRoot, I18N_PATHS2.PUBLISHED_ROOT, i18nSubpath)
|
|
7918
8104
|
);
|
|
7919
8105
|
const resolvedDir = resolvedPath.replace(/\/[^/]*\*.*$/, "");
|
|
7920
8106
|
if (this.pathExists(resolvedDir)) {
|
|
@@ -8110,13 +8296,13 @@ var init_PathResolver = __esm({
|
|
|
8110
8296
|
const maxLevels = this.options.maxLevels;
|
|
8111
8297
|
while (levelsChecked < maxLevels) {
|
|
8112
8298
|
const toolingPath = this.normalizePath(
|
|
8113
|
-
|
|
8299
|
+
join2(currentDir, PACKAGE_PATHS.TOOLING)
|
|
8114
8300
|
);
|
|
8115
|
-
const corePath = this.normalizePath(
|
|
8301
|
+
const corePath = this.normalizePath(join2(currentDir, PACKAGE_PATHS.CORE));
|
|
8116
8302
|
if (this.pathExists(toolingPath) && this.pathExists(corePath)) {
|
|
8117
8303
|
return currentDir;
|
|
8118
8304
|
}
|
|
8119
|
-
const appsDir =
|
|
8305
|
+
const appsDir = join2(currentDir, "apps");
|
|
8120
8306
|
if (this.pathExists(appsDir)) {
|
|
8121
8307
|
const appsDirStat = this.statSync(appsDir);
|
|
8122
8308
|
if (appsDirStat?.isDirectory()) {
|
|
@@ -8124,15 +8310,15 @@ var init_PathResolver = __esm({
|
|
|
8124
8310
|
}
|
|
8125
8311
|
}
|
|
8126
8312
|
const packageJsonPath = this.normalizePath(
|
|
8127
|
-
|
|
8313
|
+
join2(currentDir, "package.json")
|
|
8128
8314
|
);
|
|
8129
8315
|
if (this.pathExists(packageJsonPath)) {
|
|
8130
|
-
const parentDir2 = this.normalizePath(
|
|
8316
|
+
const parentDir2 = this.normalizePath(dirname2(currentDir));
|
|
8131
8317
|
if (parentDir2 === currentDir) {
|
|
8132
8318
|
return currentDir;
|
|
8133
8319
|
}
|
|
8134
8320
|
}
|
|
8135
|
-
const parentDir = this.normalizePath(
|
|
8321
|
+
const parentDir = this.normalizePath(dirname2(currentDir));
|
|
8136
8322
|
if (parentDir === currentDir) {
|
|
8137
8323
|
break;
|
|
8138
8324
|
}
|
|
@@ -8148,8 +8334,8 @@ var init_PathResolver = __esm({
|
|
|
8148
8334
|
// packages/tooling/src/utils/pathResolver.ts
|
|
8149
8335
|
import { createRequire as createRequire2 } from "node:module";
|
|
8150
8336
|
import {
|
|
8151
|
-
join as
|
|
8152
|
-
dirname as
|
|
8337
|
+
join as join3,
|
|
8338
|
+
dirname as dirname3,
|
|
8153
8339
|
basename as basename2,
|
|
8154
8340
|
extname as extname2,
|
|
8155
8341
|
relative as relative2,
|
|
@@ -8158,7 +8344,7 @@ import {
|
|
|
8158
8344
|
isAbsolute as pathIsAbsolute
|
|
8159
8345
|
} from "node:path";
|
|
8160
8346
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8161
|
-
function
|
|
8347
|
+
function readdirSync3(dirPath, options) {
|
|
8162
8348
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8163
8349
|
}
|
|
8164
8350
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, statSync2, joinPath;
|
|
@@ -8170,7 +8356,7 @@ var init_pathResolver = __esm({
|
|
|
8170
8356
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8171
8357
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8172
8358
|
normalizePath = (...pathSegments) => {
|
|
8173
|
-
return pathResolverInstance.normalizePath(
|
|
8359
|
+
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8174
8360
|
};
|
|
8175
8361
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
8176
8362
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
@@ -8213,7 +8399,7 @@ var init_typed_file_operations = __esm({
|
|
|
8213
8399
|
import { Buffer } from "node:buffer";
|
|
8214
8400
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8215
8401
|
import { createRequire as createRequire3 } from "node:module";
|
|
8216
|
-
import { dirname as
|
|
8402
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
8217
8403
|
import process from "node:process";
|
|
8218
8404
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8219
8405
|
var require2, __filename, __dirname;
|
|
@@ -8222,7 +8408,7 @@ var init_utils2 = __esm({
|
|
|
8222
8408
|
"use strict";
|
|
8223
8409
|
require2 = createRequire3(import.meta.url);
|
|
8224
8410
|
__filename = fileURLToPath3(import.meta.url);
|
|
8225
|
-
__dirname =
|
|
8411
|
+
__dirname = dirname4(__filename);
|
|
8226
8412
|
if (typeof globalThis !== "undefined") {
|
|
8227
8413
|
globalThis.require = require2;
|
|
8228
8414
|
globalThis.__filename = __filename;
|
|
@@ -8242,7 +8428,7 @@ function detectApps(projectRoot) {
|
|
|
8242
8428
|
const appsDir = joinPath(projectRoot, "apps");
|
|
8243
8429
|
const appsDirStat = statSync2(appsDir);
|
|
8244
8430
|
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
8245
|
-
const appDirs =
|
|
8431
|
+
const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
8246
8432
|
for (const appDir of appDirs) {
|
|
8247
8433
|
const appPath = joinPath(appsDir, appDir);
|
|
8248
8434
|
const packageJsonPath = joinPath(appPath, "package.json");
|
|
@@ -8419,17 +8605,17 @@ var init_app_detection = __esm({
|
|
|
8419
8605
|
async function selectApp(projectRoot, appName) {
|
|
8420
8606
|
const apps = detectApps(projectRoot);
|
|
8421
8607
|
if (apps.length === 0) {
|
|
8422
|
-
|
|
8423
|
-
|
|
8608
|
+
log2.error("No apps found in this project.");
|
|
8609
|
+
log2.info('Run "dndev init" to create a new project.');
|
|
8424
8610
|
return null;
|
|
8425
8611
|
}
|
|
8426
8612
|
if (appName) {
|
|
8427
|
-
const app = apps.find((
|
|
8613
|
+
const app = apps.find((a2) => a2.name === appName);
|
|
8428
8614
|
if (!app) {
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
apps.forEach((
|
|
8432
|
-
|
|
8615
|
+
log2.warn(`App "${appName}" not found.`);
|
|
8616
|
+
log2.info("Available apps:");
|
|
8617
|
+
apps.forEach((a2) => log2.info(` - ${a2.name}`));
|
|
8618
|
+
log2.info("Please select from the list:");
|
|
8433
8619
|
} else {
|
|
8434
8620
|
return app;
|
|
8435
8621
|
}
|
|
@@ -8437,7 +8623,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8437
8623
|
if (apps.length === 1) {
|
|
8438
8624
|
return apps[0] || null;
|
|
8439
8625
|
}
|
|
8440
|
-
const selected = await
|
|
8626
|
+
const selected = await select({
|
|
8441
8627
|
message: "Select app:",
|
|
8442
8628
|
options: apps.map((app) => ({
|
|
8443
8629
|
value: app.name,
|
|
@@ -8447,7 +8633,7 @@ async function selectApp(projectRoot, appName) {
|
|
|
8447
8633
|
if (typeof selected !== "string") {
|
|
8448
8634
|
return null;
|
|
8449
8635
|
}
|
|
8450
|
-
return apps.find((
|
|
8636
|
+
return apps.find((a2) => a2.name === selected) || null;
|
|
8451
8637
|
}
|
|
8452
8638
|
var init_app_selector = __esm({
|
|
8453
8639
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
@@ -8520,7 +8706,7 @@ async function main() {
|
|
|
8520
8706
|
if (!app) {
|
|
8521
8707
|
return 1;
|
|
8522
8708
|
}
|
|
8523
|
-
|
|
8709
|
+
log2.info(`Starting dev server for ${app.name}...
|
|
8524
8710
|
`);
|
|
8525
8711
|
const turboArgs = ["dev", "--filter", app.packageName];
|
|
8526
8712
|
const isWindows = platform2() === "win32";
|
|
@@ -8535,7 +8721,7 @@ async function main() {
|
|
|
8535
8721
|
);
|
|
8536
8722
|
const cleanup = (signal) => {
|
|
8537
8723
|
if (!childProcess.pid) return;
|
|
8538
|
-
|
|
8724
|
+
log2.debug(`Received ${signal}, cleaning up processes...`);
|
|
8539
8725
|
if (isWindows) {
|
|
8540
8726
|
try {
|
|
8541
8727
|
execSync2(`taskkill /F /T /PID ${childProcess.pid}`, {
|
|
@@ -8563,7 +8749,7 @@ async function main() {
|
|
|
8563
8749
|
for (const signal of signals) {
|
|
8564
8750
|
const handler = () => {
|
|
8565
8751
|
cleanup(signal);
|
|
8566
|
-
handlers.forEach((
|
|
8752
|
+
handlers.forEach((h2) => h2());
|
|
8567
8753
|
process.exit(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
8568
8754
|
};
|
|
8569
8755
|
process.on(signal, handler);
|
|
@@ -8571,17 +8757,17 @@ async function main() {
|
|
|
8571
8757
|
}
|
|
8572
8758
|
return new Promise((resolve4) => {
|
|
8573
8759
|
childProcess.on("exit", (code, signal) => {
|
|
8574
|
-
handlers.forEach((
|
|
8760
|
+
handlers.forEach((h2) => h2());
|
|
8575
8761
|
if (signal) {
|
|
8576
|
-
|
|
8762
|
+
log2.debug(`Process killed by signal: ${signal}`);
|
|
8577
8763
|
resolve4(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
8578
8764
|
} else {
|
|
8579
8765
|
resolve4(code ?? 0);
|
|
8580
8766
|
}
|
|
8581
8767
|
});
|
|
8582
8768
|
childProcess.on("error", (error2) => {
|
|
8583
|
-
handlers.forEach((
|
|
8584
|
-
|
|
8769
|
+
handlers.forEach((h2) => h2());
|
|
8770
|
+
log2.error(`Failed to start dev server: ${error2.message}`);
|
|
8585
8771
|
resolve4(1);
|
|
8586
8772
|
});
|
|
8587
8773
|
});
|