supaslidev 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/PresentationCard.vue +67 -0
- package/app/components/PresentationListItem.vue +60 -0
- package/app/composables/useServers.ts +13 -0
- package/app/pages/index.vue +79 -1
- package/dist/cli/index.js +1414 -829
- package/dist/index.d.ts +1 -0
- package/package.json +11 -10
- package/server/api/thumbnail/[id].post.ts +115 -0
- package/server/routes/thumbnails/[...path].get.ts +27 -0
- package/server/utils/process-manager.ts +1 -1
- package/src/cli/commands/deploy.ts +87 -8
- package/src/cli/commands/thumbnail.ts +89 -0
- package/src/cli/index.ts +10 -0
- package/src/shared/optimize-thumbnail.ts +23 -0
- package/src/shared/presentations.ts +20 -1
- package/src/shared/types.ts +1 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs, { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import fs, { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import path, { basename, dirname, join, relative, resolve } from "node:path";
|
|
8
8
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
9
|
-
import
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
9
|
+
import P, { stdin, stdout } from "node:process";
|
|
10
|
+
import * as _ from "node:readline";
|
|
11
|
+
import P$1 from "node:readline";
|
|
12
12
|
import { ReadStream } from "node:tty";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
|
+
import sharp from "sharp";
|
|
14
15
|
//#region \0rolldown/runtime.js
|
|
15
16
|
var __create = Object.create;
|
|
16
17
|
var __defProp = Object.defineProperty;
|
|
@@ -196,7 +197,7 @@ function extractDescription(info) {
|
|
|
196
197
|
if (!info) return "";
|
|
197
198
|
return info.replace(/^##?\s+.*$/gm, "").replace(/\*\*/g, "").trim().split("\n").filter(Boolean).join(" ");
|
|
198
199
|
}
|
|
199
|
-
function regeneratePresentationsJson(presentationsDir, presentationsJsonPath) {
|
|
200
|
+
function regeneratePresentationsJson(presentationsDir, presentationsJsonPath, options = {}) {
|
|
200
201
|
if (!existsSync(presentationsDir)) return;
|
|
201
202
|
const presentations = readdirSync(presentationsDir).filter((name) => {
|
|
202
203
|
const fullPath = join(presentationsDir, name);
|
|
@@ -205,7 +206,7 @@ function regeneratePresentationsJson(presentationsDir, presentationsJsonPath) {
|
|
|
205
206
|
return isDir && hasSlides;
|
|
206
207
|
}).map((name) => {
|
|
207
208
|
const frontmatter = parseFrontmatter(readFileSync(join(presentationsDir, name, "slides.md"), "utf-8"));
|
|
208
|
-
|
|
209
|
+
const presentation = {
|
|
209
210
|
id: name,
|
|
210
211
|
title: frontmatter.title || name,
|
|
211
212
|
description: extractDescription(frontmatter.info) || "",
|
|
@@ -213,6 +214,14 @@ function regeneratePresentationsJson(presentationsDir, presentationsJsonPath) {
|
|
|
213
214
|
background: frontmatter.background || "",
|
|
214
215
|
duration: frontmatter.duration || ""
|
|
215
216
|
};
|
|
217
|
+
if (options.thumbnailsDir) {
|
|
218
|
+
const base = (options.basePath ?? "/").replace(/\/*$/, "/");
|
|
219
|
+
const webpFile = join(options.thumbnailsDir, `${name}.webp`);
|
|
220
|
+
const pngFile = join(options.thumbnailsDir, `${name}.png`);
|
|
221
|
+
if (existsSync(webpFile)) presentation.thumbnail = `${base}thumbnails/${name}.webp`;
|
|
222
|
+
else if (existsSync(pngFile)) presentation.thumbnail = `${base}thumbnails/${name}.png`;
|
|
223
|
+
}
|
|
224
|
+
return presentation;
|
|
216
225
|
}).sort((a, b) => a.title.localeCompare(b.title));
|
|
217
226
|
const outputDir = dirname(presentationsJsonPath);
|
|
218
227
|
if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true });
|
|
@@ -492,7 +501,327 @@ async function exportPdf(name, options = {}) {
|
|
|
492
501
|
});
|
|
493
502
|
}
|
|
494
503
|
//#endregion
|
|
495
|
-
//#region ../../node_modules/.pnpm
|
|
504
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
505
|
+
const isAmbiguous = (x) => {
|
|
506
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
507
|
+
};
|
|
508
|
+
const isFullWidth = (x) => {
|
|
509
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
510
|
+
};
|
|
511
|
+
const isWide = (x) => {
|
|
512
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || 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 >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
513
|
+
};
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
516
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
517
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
518
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
519
|
+
const EMOJI_RE = /[\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?))*/uy;
|
|
520
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
521
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
522
|
+
const NO_TRUNCATION$1 = {
|
|
523
|
+
limit: Infinity,
|
|
524
|
+
ellipsis: ""
|
|
525
|
+
};
|
|
526
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
527
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
528
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
529
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
530
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
531
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
532
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
533
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
534
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
535
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
536
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
537
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
538
|
+
let indexPrev = 0;
|
|
539
|
+
let index = 0;
|
|
540
|
+
let length = input.length;
|
|
541
|
+
let lengthExtra = 0;
|
|
542
|
+
let truncationEnabled = false;
|
|
543
|
+
let truncationIndex = length;
|
|
544
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
545
|
+
let unmatchedStart = 0;
|
|
546
|
+
let unmatchedEnd = 0;
|
|
547
|
+
let width = 0;
|
|
548
|
+
let widthExtra = 0;
|
|
549
|
+
outer: while (true) {
|
|
550
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
551
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
552
|
+
lengthExtra = 0;
|
|
553
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
554
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
555
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
556
|
+
else if (isWide(codePoint)) widthExtra = WIDE_WIDTH;
|
|
557
|
+
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
558
|
+
else widthExtra = REGULAR_WIDTH;
|
|
559
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
560
|
+
if (width + widthExtra > LIMIT) {
|
|
561
|
+
truncationEnabled = true;
|
|
562
|
+
break outer;
|
|
563
|
+
}
|
|
564
|
+
lengthExtra += char.length;
|
|
565
|
+
width += widthExtra;
|
|
566
|
+
}
|
|
567
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
568
|
+
}
|
|
569
|
+
if (index >= length) break;
|
|
570
|
+
LATIN_RE.lastIndex = index;
|
|
571
|
+
if (LATIN_RE.test(input)) {
|
|
572
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
573
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
574
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
575
|
+
if (width + widthExtra > LIMIT) {
|
|
576
|
+
truncationEnabled = true;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
width += widthExtra;
|
|
580
|
+
unmatchedStart = indexPrev;
|
|
581
|
+
unmatchedEnd = index;
|
|
582
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
ANSI_RE.lastIndex = index;
|
|
586
|
+
if (ANSI_RE.test(input)) {
|
|
587
|
+
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
588
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
589
|
+
truncationEnabled = true;
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
width += ANSI_WIDTH;
|
|
593
|
+
unmatchedStart = indexPrev;
|
|
594
|
+
unmatchedEnd = index;
|
|
595
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
CONTROL_RE.lastIndex = index;
|
|
599
|
+
if (CONTROL_RE.test(input)) {
|
|
600
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
601
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
602
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
603
|
+
if (width + widthExtra > LIMIT) {
|
|
604
|
+
truncationEnabled = true;
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
width += widthExtra;
|
|
608
|
+
unmatchedStart = indexPrev;
|
|
609
|
+
unmatchedEnd = index;
|
|
610
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
TAB_RE.lastIndex = index;
|
|
614
|
+
if (TAB_RE.test(input)) {
|
|
615
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
616
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
617
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
618
|
+
if (width + widthExtra > LIMIT) {
|
|
619
|
+
truncationEnabled = true;
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
width += widthExtra;
|
|
623
|
+
unmatchedStart = indexPrev;
|
|
624
|
+
unmatchedEnd = index;
|
|
625
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
EMOJI_RE.lastIndex = index;
|
|
629
|
+
if (EMOJI_RE.test(input)) {
|
|
630
|
+
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
631
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
632
|
+
truncationEnabled = true;
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
width += EMOJI_WIDTH;
|
|
636
|
+
unmatchedStart = indexPrev;
|
|
637
|
+
unmatchedEnd = index;
|
|
638
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
index += 1;
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
645
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
646
|
+
truncated: truncationEnabled,
|
|
647
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
648
|
+
};
|
|
649
|
+
};
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
652
|
+
const NO_TRUNCATION = {
|
|
653
|
+
limit: Infinity,
|
|
654
|
+
ellipsis: "",
|
|
655
|
+
ellipsisWidth: 0
|
|
656
|
+
};
|
|
657
|
+
const fastStringWidth = (input, options = {}) => {
|
|
658
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
659
|
+
};
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
662
|
+
const ESC = "\x1B";
|
|
663
|
+
const CSI = "";
|
|
664
|
+
const END_CODE = 39;
|
|
665
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
666
|
+
const ANSI_CSI = "[";
|
|
667
|
+
const ANSI_OSC = "]";
|
|
668
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
669
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
670
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
671
|
+
const getClosingCode = (openingCode) => {
|
|
672
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
673
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
674
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
675
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
676
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
677
|
+
if (openingCode === 3) return 23;
|
|
678
|
+
if (openingCode === 4) return 24;
|
|
679
|
+
if (openingCode === 7) return 27;
|
|
680
|
+
if (openingCode === 8) return 28;
|
|
681
|
+
if (openingCode === 9) return 29;
|
|
682
|
+
if (openingCode === 0) return 0;
|
|
683
|
+
};
|
|
684
|
+
const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
685
|
+
const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
686
|
+
const wrapWord = (rows, word, columns) => {
|
|
687
|
+
const characters = word[Symbol.iterator]();
|
|
688
|
+
let isInsideEscape = false;
|
|
689
|
+
let isInsideLinkEscape = false;
|
|
690
|
+
let lastRow = rows.at(-1);
|
|
691
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
692
|
+
let currentCharacter = characters.next();
|
|
693
|
+
let nextCharacter = characters.next();
|
|
694
|
+
let rawCharacterIndex = 0;
|
|
695
|
+
while (!currentCharacter.done) {
|
|
696
|
+
const character = currentCharacter.value;
|
|
697
|
+
const characterLength = fastStringWidth(character);
|
|
698
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
699
|
+
else {
|
|
700
|
+
rows.push(character);
|
|
701
|
+
visible = 0;
|
|
702
|
+
}
|
|
703
|
+
if (character === ESC || character === CSI) {
|
|
704
|
+
isInsideEscape = true;
|
|
705
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
706
|
+
}
|
|
707
|
+
if (isInsideEscape) {
|
|
708
|
+
if (isInsideLinkEscape) {
|
|
709
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
710
|
+
isInsideEscape = false;
|
|
711
|
+
isInsideLinkEscape = false;
|
|
712
|
+
}
|
|
713
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
714
|
+
} else {
|
|
715
|
+
visible += characterLength;
|
|
716
|
+
if (visible === columns && !nextCharacter.done) {
|
|
717
|
+
rows.push("");
|
|
718
|
+
visible = 0;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
currentCharacter = nextCharacter;
|
|
722
|
+
nextCharacter = characters.next();
|
|
723
|
+
rawCharacterIndex += character.length;
|
|
724
|
+
}
|
|
725
|
+
lastRow = rows.at(-1);
|
|
726
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
727
|
+
};
|
|
728
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
729
|
+
const words = string.split(" ");
|
|
730
|
+
let last = words.length;
|
|
731
|
+
while (last) {
|
|
732
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
733
|
+
last--;
|
|
734
|
+
}
|
|
735
|
+
if (last === words.length) return string;
|
|
736
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
737
|
+
};
|
|
738
|
+
const exec = (string, columns, options = {}) => {
|
|
739
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
740
|
+
let returnValue = "";
|
|
741
|
+
let escapeCode;
|
|
742
|
+
let escapeUrl;
|
|
743
|
+
const words = string.split(" ");
|
|
744
|
+
let rows = [""];
|
|
745
|
+
let rowLength = 0;
|
|
746
|
+
for (let index = 0; index < words.length; index++) {
|
|
747
|
+
const word = words[index];
|
|
748
|
+
if (options.trim !== false) {
|
|
749
|
+
const row = rows.at(-1) ?? "";
|
|
750
|
+
const trimmed = row.trimStart();
|
|
751
|
+
if (row.length !== trimmed.length) {
|
|
752
|
+
rows[rows.length - 1] = trimmed;
|
|
753
|
+
rowLength = fastStringWidth(trimmed);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
if (index !== 0) {
|
|
757
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
758
|
+
rows.push("");
|
|
759
|
+
rowLength = 0;
|
|
760
|
+
}
|
|
761
|
+
if (rowLength || options.trim === false) {
|
|
762
|
+
rows[rows.length - 1] += " ";
|
|
763
|
+
rowLength++;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
const wordLength = fastStringWidth(word);
|
|
767
|
+
if (options.hard && wordLength > columns) {
|
|
768
|
+
const remainingColumns = columns - rowLength;
|
|
769
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
770
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
771
|
+
wrapWord(rows, word, columns);
|
|
772
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
776
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
777
|
+
wrapWord(rows, word, columns);
|
|
778
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
rows.push("");
|
|
782
|
+
rowLength = 0;
|
|
783
|
+
}
|
|
784
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
785
|
+
wrapWord(rows, word, columns);
|
|
786
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
rows[rows.length - 1] += word;
|
|
790
|
+
rowLength += wordLength;
|
|
791
|
+
}
|
|
792
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
793
|
+
const preString = rows.join("\n");
|
|
794
|
+
let inSurrogate = false;
|
|
795
|
+
for (let i = 0; i < preString.length; i++) {
|
|
796
|
+
const character = preString[i];
|
|
797
|
+
returnValue += character;
|
|
798
|
+
if (!inSurrogate) inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
799
|
+
else continue;
|
|
800
|
+
if (character === ESC || character === CSI) {
|
|
801
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
802
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
803
|
+
if (groups?.code !== void 0) {
|
|
804
|
+
const code = Number.parseFloat(groups.code);
|
|
805
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
806
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
807
|
+
}
|
|
808
|
+
if (preString[i + 1] === "\n") {
|
|
809
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
810
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
811
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
812
|
+
} else if (character === "\n") {
|
|
813
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
814
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return returnValue;
|
|
818
|
+
};
|
|
819
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
820
|
+
function wrapAnsi(string, columns, options) {
|
|
821
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
496
825
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
497
826
|
const ESC = "\x1B";
|
|
498
827
|
const CSI = `${ESC}[`;
|
|
@@ -545,162 +874,12 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
545
874
|
beep
|
|
546
875
|
};
|
|
547
876
|
})))();
|
|
548
|
-
function
|
|
549
|
-
if (!
|
|
550
|
-
const
|
|
551
|
-
return
|
|
552
|
-
}
|
|
553
|
-
const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, P = /[\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?))*/uy, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft$1 = {
|
|
554
|
-
limit: Infinity,
|
|
555
|
-
ellipsis: ""
|
|
556
|
-
}, X$1 = (t, e = {}, s = {}) => {
|
|
557
|
-
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$1(r, ft$1, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
558
|
-
let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
559
|
-
t: for (;;) {
|
|
560
|
-
if (w > C || o >= p && o > h) {
|
|
561
|
-
const ut = t.slice(C, w) || t.slice(h, o);
|
|
562
|
-
v = 0;
|
|
563
|
-
for (const Y of ut.replaceAll(ct, "")) {
|
|
564
|
-
const $ = Y.codePointAt(0) || 0;
|
|
565
|
-
if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
566
|
-
F = !0;
|
|
567
|
-
break t;
|
|
568
|
-
}
|
|
569
|
-
v += Y.length, c += f;
|
|
570
|
-
}
|
|
571
|
-
C = w = 0;
|
|
572
|
-
}
|
|
573
|
-
if (o >= p) break;
|
|
574
|
-
if (M.lastIndex = o, M.test(t)) {
|
|
575
|
-
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
576
|
-
F = !0;
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
580
|
-
continue;
|
|
581
|
-
}
|
|
582
|
-
if (O.lastIndex = o, O.test(t)) {
|
|
583
|
-
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
584
|
-
F = !0;
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
588
|
-
continue;
|
|
589
|
-
}
|
|
590
|
-
if (y.lastIndex = o, y.test(t)) {
|
|
591
|
-
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
592
|
-
F = !0;
|
|
593
|
-
break;
|
|
594
|
-
}
|
|
595
|
-
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
596
|
-
continue;
|
|
597
|
-
}
|
|
598
|
-
if (L.lastIndex = o, L.test(t)) {
|
|
599
|
-
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
600
|
-
F = !0;
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
604
|
-
continue;
|
|
605
|
-
}
|
|
606
|
-
if (P.lastIndex = o, P.test(t)) {
|
|
607
|
-
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
608
|
-
F = !0;
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
612
|
-
continue;
|
|
613
|
-
}
|
|
614
|
-
o += 1;
|
|
615
|
-
}
|
|
616
|
-
return {
|
|
617
|
-
width: F ? b : c,
|
|
618
|
-
index: F ? d : p,
|
|
619
|
-
truncated: F,
|
|
620
|
-
ellipsed: F && i >= n
|
|
621
|
-
};
|
|
622
|
-
}, pt$1 = {
|
|
623
|
-
limit: Infinity,
|
|
624
|
-
ellipsis: "",
|
|
625
|
-
ellipsisWidth: 0
|
|
626
|
-
}, S = (t, e = {}) => X$1(t, pt$1, e).width, T = "\x1B", Z = "", Ft$1 = 39, j = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
|
|
627
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
628
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
629
|
-
if (t === 1 || t === 2) return 22;
|
|
630
|
-
if (t === 3) return 23;
|
|
631
|
-
if (t === 4) return 24;
|
|
632
|
-
if (t === 7) return 27;
|
|
633
|
-
if (t === 8) return 28;
|
|
634
|
-
if (t === 9) return 29;
|
|
635
|
-
if (t === 0) return 0;
|
|
636
|
-
}, st = (t) => `${T}${Q$1}${t}${tt}`, it = (t) => `${T}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
637
|
-
const i = e[Symbol.iterator]();
|
|
638
|
-
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
639
|
-
for (; !l.done;) {
|
|
640
|
-
const m = l.value, A = S(m);
|
|
641
|
-
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
642
|
-
}
|
|
643
|
-
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
644
|
-
}, vt$1 = (t) => {
|
|
645
|
-
const e = t.split(" ");
|
|
646
|
-
let s = e.length;
|
|
647
|
-
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
648
|
-
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
649
|
-
}, Et$1 = (t, e, s = {}) => {
|
|
650
|
-
if (s.trim !== !1 && t.trim() === "") return "";
|
|
651
|
-
let i = "", r, n;
|
|
652
|
-
const u = t.split(" "), a = gt$1(u);
|
|
653
|
-
let l = [""];
|
|
654
|
-
for (const [h, o] of u.entries()) {
|
|
655
|
-
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
656
|
-
let p = S(l.at(-1) ?? "");
|
|
657
|
-
if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
658
|
-
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
659
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
662
|
-
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
663
|
-
if (s.wordWrap === !1 && p < e) {
|
|
664
|
-
G(l, o, e);
|
|
665
|
-
continue;
|
|
666
|
-
}
|
|
667
|
-
l.push("");
|
|
668
|
-
}
|
|
669
|
-
if (p + a[h] > e && s.wordWrap === !1) {
|
|
670
|
-
G(l, o, e);
|
|
671
|
-
continue;
|
|
672
|
-
}
|
|
673
|
-
l[l.length - 1] += o;
|
|
674
|
-
}
|
|
675
|
-
s.trim !== !1 && (l = l.map((h) => vt$1(h)));
|
|
676
|
-
const E = l.join(`
|
|
677
|
-
`), g = E[Symbol.iterator]();
|
|
678
|
-
let m = g.next(), A = g.next(), V = 0;
|
|
679
|
-
for (; !m.done;) {
|
|
680
|
-
const h = m.value, o = A.value;
|
|
681
|
-
if (i += h, h === T || h === Z) {
|
|
682
|
-
et.lastIndex = V + 1;
|
|
683
|
-
const F = et.exec(E)?.groups;
|
|
684
|
-
if (F?.code !== void 0) {
|
|
685
|
-
const d = Number.parseFloat(F.code);
|
|
686
|
-
r = d === Ft$1 ? void 0 : d;
|
|
687
|
-
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
688
|
-
}
|
|
689
|
-
const p = r ? mt$1(r) : void 0;
|
|
690
|
-
o === `
|
|
691
|
-
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
692
|
-
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
693
|
-
}
|
|
694
|
-
return i;
|
|
695
|
-
};
|
|
696
|
-
function K$1(t, e, s) {
|
|
697
|
-
return String(t).normalize().replaceAll(`\r
|
|
698
|
-
`, `
|
|
699
|
-
`).split(`
|
|
700
|
-
`).map((i) => Et$1(i, e, s)).join(`
|
|
701
|
-
`);
|
|
877
|
+
function d$1(r, t, e) {
|
|
878
|
+
if (!e.some((o) => !o.disabled)) return r;
|
|
879
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
880
|
+
return e[n].disabled ? d$1(n, t < 0 ? -1 : 1, e) : n;
|
|
702
881
|
}
|
|
703
|
-
const
|
|
882
|
+
const u = {
|
|
704
883
|
actions: new Set([
|
|
705
884
|
"up",
|
|
706
885
|
"down",
|
|
@@ -722,73 +901,96 @@ const _ = {
|
|
|
722
901
|
cancel: "Canceled",
|
|
723
902
|
error: "Something went wrong"
|
|
724
903
|
},
|
|
725
|
-
withGuide: !0
|
|
904
|
+
withGuide: !0,
|
|
905
|
+
date: {
|
|
906
|
+
monthNames: [...[
|
|
907
|
+
"January",
|
|
908
|
+
"February",
|
|
909
|
+
"March",
|
|
910
|
+
"April",
|
|
911
|
+
"May",
|
|
912
|
+
"June",
|
|
913
|
+
"July",
|
|
914
|
+
"August",
|
|
915
|
+
"September",
|
|
916
|
+
"October",
|
|
917
|
+
"November",
|
|
918
|
+
"December"
|
|
919
|
+
]],
|
|
920
|
+
messages: {
|
|
921
|
+
required: "Please enter a valid date",
|
|
922
|
+
invalidMonth: "There are only 12 months in a year",
|
|
923
|
+
invalidDay: (r, t) => `There are only ${r} days in ${t}`,
|
|
924
|
+
afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
925
|
+
beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
926
|
+
}
|
|
927
|
+
}
|
|
726
928
|
};
|
|
727
|
-
function
|
|
728
|
-
if (typeof
|
|
729
|
-
for (const
|
|
929
|
+
function V$1(r, t) {
|
|
930
|
+
if (typeof r == "string") return u.aliases.get(r) === t;
|
|
931
|
+
for (const e of r) if (e !== void 0 && V$1(e, t)) return !0;
|
|
730
932
|
return !1;
|
|
731
933
|
}
|
|
732
|
-
function
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
`),
|
|
736
|
-
`),
|
|
737
|
-
for (let
|
|
934
|
+
function j(r, t) {
|
|
935
|
+
if (r === t) return;
|
|
936
|
+
const e = r.split(`
|
|
937
|
+
`), s = t.split(`
|
|
938
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
939
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
738
940
|
return {
|
|
739
941
|
lines: n,
|
|
740
|
-
numLinesBefore:
|
|
741
|
-
numLinesAfter:
|
|
742
|
-
numLines:
|
|
942
|
+
numLinesBefore: e.length,
|
|
943
|
+
numLinesAfter: s.length,
|
|
944
|
+
numLines: i
|
|
743
945
|
};
|
|
744
946
|
}
|
|
745
|
-
const
|
|
746
|
-
function
|
|
747
|
-
return
|
|
947
|
+
const Y$1 = globalThis.process.platform.startsWith("win"), C = Symbol("clack:cancel");
|
|
948
|
+
function q(r) {
|
|
949
|
+
return r === C;
|
|
748
950
|
}
|
|
749
|
-
function
|
|
750
|
-
const
|
|
751
|
-
|
|
951
|
+
function w$1(r, t) {
|
|
952
|
+
const e = r;
|
|
953
|
+
e.isTTY && e.setRawMode(t);
|
|
752
954
|
}
|
|
753
|
-
function
|
|
754
|
-
const
|
|
755
|
-
input:
|
|
756
|
-
output:
|
|
955
|
+
function z$1({ input: r = stdin, output: t = stdout, overwrite: e = !0, hideCursor: s = !0 } = {}) {
|
|
956
|
+
const i = _.createInterface({
|
|
957
|
+
input: r,
|
|
958
|
+
output: t,
|
|
757
959
|
prompt: "",
|
|
758
960
|
tabSize: 1
|
|
759
961
|
});
|
|
760
|
-
|
|
761
|
-
const n = (
|
|
762
|
-
if (
|
|
763
|
-
String(
|
|
962
|
+
_.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
|
|
963
|
+
const n = (o, { name: a, sequence: h }) => {
|
|
964
|
+
if (V$1([
|
|
965
|
+
String(o),
|
|
764
966
|
a,
|
|
765
|
-
|
|
967
|
+
h
|
|
766
968
|
], "cancel")) {
|
|
767
|
-
|
|
969
|
+
s && t.write(import_src.cursor.show), process.exit(0);
|
|
768
970
|
return;
|
|
769
971
|
}
|
|
770
|
-
if (!
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
972
|
+
if (!e) return;
|
|
973
|
+
const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
|
|
974
|
+
_.moveCursor(t, f, v, () => {
|
|
975
|
+
_.clearLine(t, 1, () => {
|
|
976
|
+
r.once("keypress", n);
|
|
775
977
|
});
|
|
776
978
|
});
|
|
777
979
|
};
|
|
778
|
-
return
|
|
779
|
-
|
|
980
|
+
return s && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
981
|
+
r.off("keypress", n), s && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !Y$1 && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
780
982
|
};
|
|
781
983
|
}
|
|
782
|
-
const
|
|
783
|
-
function
|
|
784
|
-
return
|
|
984
|
+
const O$1 = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
985
|
+
function R(r, t, e, s = e) {
|
|
986
|
+
return wrapAnsi(t, O$1(r ?? stdout) - e.length, {
|
|
785
987
|
hard: !0,
|
|
786
988
|
trim: !1
|
|
787
989
|
}).split(`
|
|
788
|
-
`).map((n,
|
|
990
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
789
991
|
`);
|
|
790
992
|
}
|
|
791
|
-
|
|
993
|
+
let p = class {
|
|
792
994
|
input;
|
|
793
995
|
output;
|
|
794
996
|
_abortSignal;
|
|
@@ -803,60 +1005,60 @@ var B = class {
|
|
|
803
1005
|
error = "";
|
|
804
1006
|
value;
|
|
805
1007
|
userInput = "";
|
|
806
|
-
constructor(
|
|
807
|
-
const { input:
|
|
808
|
-
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track =
|
|
1008
|
+
constructor(t, e = !0) {
|
|
1009
|
+
const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
|
|
1010
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
809
1011
|
}
|
|
810
1012
|
unsubscribe() {
|
|
811
1013
|
this._subscribers.clear();
|
|
812
1014
|
}
|
|
813
|
-
setSubscriber(
|
|
814
|
-
const
|
|
815
|
-
|
|
1015
|
+
setSubscriber(t, e) {
|
|
1016
|
+
const s = this._subscribers.get(t) ?? [];
|
|
1017
|
+
s.push(e), this._subscribers.set(t, s);
|
|
816
1018
|
}
|
|
817
|
-
on(
|
|
818
|
-
this.setSubscriber(
|
|
1019
|
+
on(t, e) {
|
|
1020
|
+
this.setSubscriber(t, { cb: e });
|
|
819
1021
|
}
|
|
820
|
-
once(
|
|
821
|
-
this.setSubscriber(
|
|
822
|
-
cb:
|
|
1022
|
+
once(t, e) {
|
|
1023
|
+
this.setSubscriber(t, {
|
|
1024
|
+
cb: e,
|
|
823
1025
|
once: !0
|
|
824
1026
|
});
|
|
825
1027
|
}
|
|
826
|
-
emit(
|
|
827
|
-
const
|
|
828
|
-
for (const n of
|
|
829
|
-
for (const n of
|
|
1028
|
+
emit(t, ...e) {
|
|
1029
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
1030
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
1031
|
+
for (const n of i) n();
|
|
830
1032
|
}
|
|
831
1033
|
prompt() {
|
|
832
|
-
return new Promise((
|
|
1034
|
+
return new Promise((t) => {
|
|
833
1035
|
if (this._abortSignal) {
|
|
834
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
1036
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(C);
|
|
835
1037
|
this._abortSignal.addEventListener("abort", () => {
|
|
836
1038
|
this.state = "cancel", this.close();
|
|
837
1039
|
}, { once: !0 });
|
|
838
1040
|
}
|
|
839
|
-
this.rl =
|
|
1041
|
+
this.rl = P$1.createInterface({
|
|
840
1042
|
input: this.input,
|
|
841
1043
|
tabSize: 2,
|
|
842
1044
|
prompt: "",
|
|
843
1045
|
escapeCodeTimeout: 50,
|
|
844
1046
|
terminal: !0
|
|
845
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
846
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
1047
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
1048
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(this.value);
|
|
847
1049
|
}), this.once("cancel", () => {
|
|
848
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
1050
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(C);
|
|
849
1051
|
});
|
|
850
1052
|
});
|
|
851
1053
|
}
|
|
852
|
-
_isActionKey(
|
|
853
|
-
return
|
|
1054
|
+
_isActionKey(t, e) {
|
|
1055
|
+
return t === " ";
|
|
854
1056
|
}
|
|
855
|
-
_setValue(
|
|
856
|
-
this.value =
|
|
1057
|
+
_setValue(t) {
|
|
1058
|
+
this.value = t, this.emit("value", this.value);
|
|
857
1059
|
}
|
|
858
|
-
_setUserInput(
|
|
859
|
-
this.userInput =
|
|
1060
|
+
_setUserInput(t, e) {
|
|
1061
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
860
1062
|
}
|
|
861
1063
|
_clearUserInput() {
|
|
862
1064
|
this.rl?.write(null, {
|
|
@@ -864,130 +1066,130 @@ var B = class {
|
|
|
864
1066
|
name: "u"
|
|
865
1067
|
}), this._setUserInput("");
|
|
866
1068
|
}
|
|
867
|
-
onKeypress(
|
|
868
|
-
if (this._track &&
|
|
1069
|
+
onKeypress(t, e) {
|
|
1070
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
869
1071
|
ctrl: !0,
|
|
870
1072
|
name: "h"
|
|
871
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"),
|
|
1073
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
|
|
872
1074
|
if (this.opts.validate) {
|
|
873
|
-
const
|
|
874
|
-
|
|
1075
|
+
const s = this.opts.validate(this.value);
|
|
1076
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
875
1077
|
}
|
|
876
1078
|
this.state !== "error" && (this.state = "submit");
|
|
877
1079
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
1080
|
+
V$1([
|
|
1081
|
+
t,
|
|
1082
|
+
e?.name,
|
|
1083
|
+
e?.sequence
|
|
882
1084
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
883
1085
|
}
|
|
884
1086
|
close() {
|
|
885
1087
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
886
|
-
`),
|
|
1088
|
+
`), w$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
887
1089
|
}
|
|
888
1090
|
restoreCursor() {
|
|
889
|
-
const
|
|
1091
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
890
1092
|
hard: !0,
|
|
891
1093
|
trim: !1
|
|
892
1094
|
}).split(`
|
|
893
1095
|
`).length - 1;
|
|
894
|
-
this.output.write(import_src.cursor.move(-999,
|
|
1096
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
895
1097
|
}
|
|
896
1098
|
render() {
|
|
897
|
-
const
|
|
1099
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
898
1100
|
hard: !0,
|
|
899
1101
|
trim: !1
|
|
900
1102
|
});
|
|
901
|
-
if (
|
|
1103
|
+
if (t !== this._prevFrame) {
|
|
902
1104
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
903
1105
|
else {
|
|
904
|
-
const
|
|
905
|
-
if (this.restoreCursor(),
|
|
906
|
-
const
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
909
|
-
this._prevFrame =
|
|
1106
|
+
const e = j(this._prevFrame, t), s = A(this.output);
|
|
1107
|
+
if (this.restoreCursor(), e) {
|
|
1108
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
1109
|
+
let o = e.lines.find((a) => a >= i);
|
|
1110
|
+
if (o === void 0) {
|
|
1111
|
+
this._prevFrame = t;
|
|
910
1112
|
return;
|
|
911
1113
|
}
|
|
912
|
-
if (
|
|
913
|
-
this.output.write(import_src.cursor.move(0,
|
|
914
|
-
const a =
|
|
1114
|
+
if (e.lines.length === 1) {
|
|
1115
|
+
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
1116
|
+
const a = t.split(`
|
|
915
1117
|
`);
|
|
916
|
-
this.output.write(a[
|
|
1118
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, a.length - o - 1));
|
|
917
1119
|
return;
|
|
918
|
-
} else if (
|
|
919
|
-
if (
|
|
1120
|
+
} else if (e.lines.length > 1) {
|
|
1121
|
+
if (i < n) o = i;
|
|
920
1122
|
else {
|
|
921
|
-
const
|
|
922
|
-
|
|
1123
|
+
const h = o - n;
|
|
1124
|
+
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
923
1125
|
}
|
|
924
1126
|
this.output.write(import_src.erase.down());
|
|
925
|
-
const a =
|
|
926
|
-
`).slice(
|
|
1127
|
+
const a = t.split(`
|
|
1128
|
+
`).slice(o);
|
|
927
1129
|
this.output.write(a.join(`
|
|
928
|
-
`)), this._prevFrame =
|
|
1130
|
+
`)), this._prevFrame = t;
|
|
929
1131
|
return;
|
|
930
1132
|
}
|
|
931
1133
|
}
|
|
932
1134
|
this.output.write(import_src.erase.down());
|
|
933
1135
|
}
|
|
934
|
-
this.output.write(
|
|
1136
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
935
1137
|
}
|
|
936
1138
|
}
|
|
937
1139
|
};
|
|
938
|
-
var
|
|
1140
|
+
var Q$1 = class extends p {
|
|
939
1141
|
get cursor() {
|
|
940
1142
|
return this.value ? 0 : 1;
|
|
941
1143
|
}
|
|
942
1144
|
get _value() {
|
|
943
1145
|
return this.cursor === 0;
|
|
944
1146
|
}
|
|
945
|
-
constructor(
|
|
946
|
-
super(
|
|
1147
|
+
constructor(t) {
|
|
1148
|
+
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
947
1149
|
this.value = this._value;
|
|
948
|
-
}), this.on("confirm", (
|
|
949
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
1150
|
+
}), this.on("confirm", (e) => {
|
|
1151
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
950
1152
|
}), this.on("cursor", () => {
|
|
951
1153
|
this.value = !this.value;
|
|
952
1154
|
});
|
|
953
1155
|
}
|
|
954
1156
|
};
|
|
955
|
-
let
|
|
1157
|
+
let it$1 = class extends p {
|
|
956
1158
|
options;
|
|
957
1159
|
cursor = 0;
|
|
958
1160
|
get _value() {
|
|
959
1161
|
return this.options[this.cursor].value;
|
|
960
1162
|
}
|
|
961
1163
|
get _enabledOptions() {
|
|
962
|
-
return this.options.filter((
|
|
1164
|
+
return this.options.filter((t) => t.disabled !== !0);
|
|
963
1165
|
}
|
|
964
1166
|
toggleAll() {
|
|
965
|
-
const
|
|
966
|
-
this.value = this.value !== void 0 && this.value.length ===
|
|
1167
|
+
const t = this._enabledOptions;
|
|
1168
|
+
this.value = this.value !== void 0 && this.value.length === t.length ? [] : t.map((s) => s.value);
|
|
967
1169
|
}
|
|
968
1170
|
toggleInvert() {
|
|
969
|
-
const
|
|
970
|
-
if (!
|
|
971
|
-
this.value = this._enabledOptions.filter((
|
|
1171
|
+
const t = this.value;
|
|
1172
|
+
if (!t) return;
|
|
1173
|
+
this.value = this._enabledOptions.filter((s) => !t.includes(s.value)).map((s) => s.value);
|
|
972
1174
|
}
|
|
973
1175
|
toggleValue() {
|
|
974
1176
|
this.value === void 0 && (this.value = []);
|
|
975
|
-
this.value = this.value.includes(this._value) ? this.value.filter((
|
|
976
|
-
}
|
|
977
|
-
constructor(
|
|
978
|
-
super(
|
|
979
|
-
const
|
|
980
|
-
this.cursor = this.options[
|
|
981
|
-
|
|
982
|
-
}), this.on("cursor", (
|
|
983
|
-
switch (
|
|
1177
|
+
this.value = this.value.includes(this._value) ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
1178
|
+
}
|
|
1179
|
+
constructor(t) {
|
|
1180
|
+
super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
|
|
1181
|
+
const e = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), 0);
|
|
1182
|
+
this.cursor = this.options[e].disabled ? d$1(e, 1, this.options) : e, this.on("key", (s) => {
|
|
1183
|
+
s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
|
|
1184
|
+
}), this.on("cursor", (s) => {
|
|
1185
|
+
switch (s) {
|
|
984
1186
|
case "left":
|
|
985
1187
|
case "up":
|
|
986
|
-
this.cursor =
|
|
1188
|
+
this.cursor = d$1(this.cursor, -1, this.options);
|
|
987
1189
|
break;
|
|
988
1190
|
case "down":
|
|
989
1191
|
case "right":
|
|
990
|
-
this.cursor =
|
|
1192
|
+
this.cursor = d$1(this.cursor, 1, this.options);
|
|
991
1193
|
break;
|
|
992
1194
|
case "space":
|
|
993
1195
|
this.toggleValue();
|
|
@@ -996,342 +1198,192 @@ let Lt$1 = class extends B {
|
|
|
996
1198
|
});
|
|
997
1199
|
}
|
|
998
1200
|
};
|
|
999
|
-
var $
|
|
1201
|
+
var at$1 = class extends p {
|
|
1000
1202
|
get userInputWithCursor() {
|
|
1001
1203
|
if (this.state === "submit") return this.userInput;
|
|
1002
|
-
const
|
|
1003
|
-
if (this.cursor >=
|
|
1004
|
-
const
|
|
1005
|
-
return `${
|
|
1204
|
+
const t = this.userInput;
|
|
1205
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
1206
|
+
const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
|
|
1207
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
1006
1208
|
}
|
|
1007
1209
|
get cursor() {
|
|
1008
1210
|
return this._cursor;
|
|
1009
1211
|
}
|
|
1010
|
-
constructor(
|
|
1212
|
+
constructor(t) {
|
|
1011
1213
|
super({
|
|
1012
|
-
...
|
|
1013
|
-
initialUserInput:
|
|
1014
|
-
}), this.on("userInput", (
|
|
1015
|
-
this._setValue(
|
|
1214
|
+
...t,
|
|
1215
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
1216
|
+
}), this.on("userInput", (e) => {
|
|
1217
|
+
this._setValue(e);
|
|
1016
1218
|
}), this.on("finalize", () => {
|
|
1017
|
-
this.value || (this.value =
|
|
1219
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
1018
1220
|
});
|
|
1019
1221
|
}
|
|
1020
1222
|
};
|
|
1021
1223
|
//#endregion
|
|
1022
|
-
//#region ../../node_modules/.pnpm/@clack+prompts@1.
|
|
1023
|
-
function
|
|
1024
|
-
return
|
|
1224
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1225
|
+
function Ze() {
|
|
1226
|
+
return P.platform !== "win32" ? P.env.TERM !== "linux" : !!P.env.CI || !!P.env.WT_SESSION || !!P.env.TERMINUS_SUBLIME || P.env.ConEmuTask === "{cmd::Cmder}" || P.env.TERM_PROGRAM === "Terminus-Sublime" || P.env.TERM_PROGRAM === "vscode" || P.env.TERM === "xterm-256color" || P.env.TERM === "alacritty" || P.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1025
1227
|
}
|
|
1026
|
-
const ee =
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const z =
|
|
1030
|
-
|
|
1031
|
-
const se =
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1228
|
+
const ee = Ze(), ae = () => process.env.CI === "true", w = (e, i) => ee ? e : i, _e = w("◆", "*"), oe = w("■", "x"), ue = w("▲", "x"), F = w("◇", "o"), le = w("┌", "T"), d = w("│", "|"), E = w("└", "—");
|
|
1229
|
+
w("┐", "T");
|
|
1230
|
+
w("┘", "—");
|
|
1231
|
+
const z = w("●", ">"), H = w("○", " "), te = w("◻", "[•]"), U = w("◼", "[+]"), J = w("◻", "[ ]");
|
|
1232
|
+
w("▪", "•");
|
|
1233
|
+
const se = w("─", "-"), ce = w("╮", "+"), Ge = w("├", "+"), $e = w("╯", "+"), de = w("╰", "+");
|
|
1234
|
+
w("╭", "+");
|
|
1235
|
+
const he = w("●", "•"), pe = w("◆", "*"), me = w("▲", "!"), ge = w("■", "x"), V = (e) => {
|
|
1034
1236
|
switch (e) {
|
|
1035
1237
|
case "initial":
|
|
1036
|
-
case "active": return styleText("cyan",
|
|
1037
|
-
case "cancel": return styleText("red",
|
|
1038
|
-
case "error": return styleText("yellow",
|
|
1039
|
-
case "submit": return styleText("green",
|
|
1238
|
+
case "active": return styleText("cyan", _e);
|
|
1239
|
+
case "cancel": return styleText("red", oe);
|
|
1240
|
+
case "error": return styleText("yellow", ue);
|
|
1241
|
+
case "submit": return styleText("green", F);
|
|
1040
1242
|
}
|
|
1041
|
-
},
|
|
1243
|
+
}, ye = (e) => {
|
|
1042
1244
|
switch (e) {
|
|
1043
1245
|
case "initial":
|
|
1044
|
-
case "active": return styleText("cyan",
|
|
1045
|
-
case "cancel": return styleText("red",
|
|
1046
|
-
case "error": return styleText("yellow",
|
|
1047
|
-
case "submit": return styleText("green",
|
|
1246
|
+
case "active": return styleText("cyan", d);
|
|
1247
|
+
case "cancel": return styleText("red", d);
|
|
1248
|
+
case "error": return styleText("yellow", d);
|
|
1249
|
+
case "submit": return styleText("green", d);
|
|
1048
1250
|
}
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
|
|
1055
|
-
e: for (;;) {
|
|
1056
|
-
if (b > A || m >= d && m > $) {
|
|
1057
|
-
const T = e.slice(A, b) || e.slice($, m);
|
|
1058
|
-
F = 0;
|
|
1059
|
-
for (const M of T.replaceAll(Ft, "")) {
|
|
1060
|
-
const O = M.codePointAt(0) || 0;
|
|
1061
|
-
if (gt(O) ? S = f : ft(O) ? S = E : c !== g && mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
|
|
1062
|
-
y = !0;
|
|
1063
|
-
break e;
|
|
1064
|
-
}
|
|
1065
|
-
F += M.length, w += S;
|
|
1066
|
-
}
|
|
1067
|
-
A = b = 0;
|
|
1068
|
-
}
|
|
1069
|
-
if (m >= d) break;
|
|
1070
|
-
if (ne.lastIndex = m, ne.test(e)) {
|
|
1071
|
-
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
1072
|
-
y = !0;
|
|
1073
|
-
break;
|
|
1074
|
-
}
|
|
1075
|
-
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
1076
|
-
continue;
|
|
1077
|
-
}
|
|
1078
|
-
if (we.lastIndex = m, we.test(e)) {
|
|
1079
|
-
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
1080
|
-
y = !0;
|
|
1081
|
-
break;
|
|
1082
|
-
}
|
|
1083
|
-
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
1084
|
-
continue;
|
|
1085
|
-
}
|
|
1086
|
-
if (re.lastIndex = m, re.test(e)) {
|
|
1087
|
-
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
1088
|
-
y = !0;
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
1092
|
-
continue;
|
|
1093
|
-
}
|
|
1094
|
-
if (ie.lastIndex = m, ie.test(e)) {
|
|
1095
|
-
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
1096
|
-
y = !0;
|
|
1097
|
-
break;
|
|
1098
|
-
}
|
|
1099
|
-
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
1100
|
-
continue;
|
|
1101
|
-
}
|
|
1102
|
-
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
1103
|
-
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
1104
|
-
y = !0;
|
|
1105
|
-
break;
|
|
1106
|
-
}
|
|
1107
|
-
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
1108
|
-
continue;
|
|
1109
|
-
}
|
|
1110
|
-
m += 1;
|
|
1251
|
+
}, et = (e, i, s, r, u) => {
|
|
1252
|
+
let n = i, o = 0;
|
|
1253
|
+
for (let c = s; c < r; c++) {
|
|
1254
|
+
const a = e[c];
|
|
1255
|
+
if (n = n - a.length, o++, n <= u) break;
|
|
1111
1256
|
}
|
|
1112
1257
|
return {
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
if (e === 4) return 24;
|
|
1128
|
-
if (e === 7) return 27;
|
|
1129
|
-
if (e === 8) return 28;
|
|
1130
|
-
if (e === 9) return 29;
|
|
1131
|
-
if (e === 0) return 0;
|
|
1132
|
-
}, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct = (e) => e.map((r) => D(r)), Ie = (e, r, s) => {
|
|
1133
|
-
const i = r[Symbol.iterator]();
|
|
1134
|
-
let a = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
|
|
1135
|
-
for (; !n.done;) {
|
|
1136
|
-
const f = n.value, g = D(f);
|
|
1137
|
-
l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
|
|
1138
|
-
}
|
|
1139
|
-
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1140
|
-
}, St = (e) => {
|
|
1141
|
-
const r = e.split(" ");
|
|
1142
|
-
let s = r.length;
|
|
1143
|
-
for (; s > 0 && !(D(r[s - 1]) > 0);) s--;
|
|
1144
|
-
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
1145
|
-
}, It = (e, r, s = {}) => {
|
|
1146
|
-
if (s.trim !== !1 && e.trim() === "") return "";
|
|
1147
|
-
let i = "", a, o;
|
|
1148
|
-
const u = e.split(" "), l = Ct(u);
|
|
1149
|
-
let n = [""];
|
|
1150
|
-
for (const [$, m] of u.entries()) {
|
|
1151
|
-
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
1152
|
-
let d = D(n.at(-1) ?? "");
|
|
1153
|
-
if ($ !== 0 && (d >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), d = 0), (d > 0 || s.trim === !1) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
|
|
1154
|
-
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
1155
|
-
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
1156
|
-
continue;
|
|
1157
|
-
}
|
|
1158
|
-
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
1159
|
-
if (s.wordWrap === !1 && d < r) {
|
|
1160
|
-
Ie(n, m, r);
|
|
1161
|
-
continue;
|
|
1162
|
-
}
|
|
1163
|
-
n.push("");
|
|
1164
|
-
}
|
|
1165
|
-
if (d + l[$] > r && s.wordWrap === !1) {
|
|
1166
|
-
Ie(n, m, r);
|
|
1167
|
-
continue;
|
|
1168
|
-
}
|
|
1169
|
-
n[n.length - 1] += m;
|
|
1170
|
-
}
|
|
1171
|
-
s.trim !== !1 && (n = n.map(($) => St($)));
|
|
1172
|
-
const c = n.join(`
|
|
1173
|
-
`), p = c[Symbol.iterator]();
|
|
1174
|
-
let f = p.next(), g = p.next(), E = 0;
|
|
1175
|
-
for (; !f.done;) {
|
|
1176
|
-
const $ = f.value, m = g.value;
|
|
1177
|
-
if (i += $, $ === ae || $ === je) {
|
|
1178
|
-
He.lastIndex = E + 1;
|
|
1179
|
-
const y = He.exec(c)?.groups;
|
|
1180
|
-
if (y?.code !== void 0) {
|
|
1181
|
-
const v = Number.parseFloat(y.code);
|
|
1182
|
-
a = v === vt ? void 0 : v;
|
|
1183
|
-
} else y?.uri !== void 0 && (o = y.uri.length === 0 ? void 0 : y.uri);
|
|
1184
|
-
}
|
|
1185
|
-
const d = a ? At(a) : void 0;
|
|
1186
|
-
m === `
|
|
1187
|
-
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
1188
|
-
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
1189
|
-
}
|
|
1190
|
-
return i;
|
|
1191
|
-
};
|
|
1192
|
-
function J(e, r, s) {
|
|
1193
|
-
return String(e).normalize().replaceAll(`\r
|
|
1194
|
-
`, `
|
|
1195
|
-
`).split(`
|
|
1196
|
-
`).map((i) => It(i, r, s)).join(`
|
|
1197
|
-
`);
|
|
1198
|
-
}
|
|
1199
|
-
const bt = (e, r, s, i, a) => {
|
|
1200
|
-
let o = r, u = 0;
|
|
1201
|
-
for (let l = s; l < i; l++) {
|
|
1202
|
-
const n = e[l];
|
|
1203
|
-
if (o = o - n.length, u++, o <= a) break;
|
|
1204
|
-
}
|
|
1205
|
-
return {
|
|
1206
|
-
lineCount: o,
|
|
1207
|
-
removals: u
|
|
1208
|
-
};
|
|
1209
|
-
}, X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
|
|
1210
|
-
const l = rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
|
|
1211
|
-
let g = 0;
|
|
1212
|
-
e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
|
|
1213
|
-
let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
|
|
1214
|
-
const m = Math.min(g + f, r.length), d = [];
|
|
1215
|
-
let F = 0;
|
|
1216
|
-
E && F++, $ && F++;
|
|
1217
|
-
const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
|
|
1218
|
-
for (let A = y; A < v; A++) {
|
|
1219
|
-
const b = J(s(r[A], A === e), l, {
|
|
1258
|
+
lineCount: n,
|
|
1259
|
+
removals: o
|
|
1260
|
+
};
|
|
1261
|
+
}, Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
1262
|
+
const c = O$1(r) - n, a = A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
|
|
1263
|
+
let p = 0;
|
|
1264
|
+
e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
|
|
1265
|
+
let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
|
|
1266
|
+
const S = Math.min(p + y, i.length), h = [];
|
|
1267
|
+
let f = 0;
|
|
1268
|
+
m && f++, g && f++;
|
|
1269
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
1270
|
+
for (let b = v; b < T; b++) {
|
|
1271
|
+
const x = wrapAnsi(s(i[b], b === e), c, {
|
|
1220
1272
|
hard: !0,
|
|
1221
1273
|
trim: !1
|
|
1222
1274
|
}).split(`
|
|
1223
1275
|
`);
|
|
1224
|
-
|
|
1276
|
+
h.push(x), f += x.length;
|
|
1225
1277
|
}
|
|
1226
|
-
if (
|
|
1227
|
-
let
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1278
|
+
if (f > $) {
|
|
1279
|
+
let b = 0, x = 0, G = f;
|
|
1280
|
+
const M = e - v, R = (j, D) => et(h, G, j, D, $);
|
|
1281
|
+
m ? ({lineCount: G, removals: b} = R(0, M), G > $ && ({lineCount: G, removals: x} = R(M + 1, h.length))) : ({lineCount: G, removals: x} = R(M + 1, h.length), G > $ && ({lineCount: G, removals: b} = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
|
|
1230
1282
|
}
|
|
1231
1283
|
const C = [];
|
|
1232
|
-
|
|
1233
|
-
for (const
|
|
1234
|
-
return
|
|
1284
|
+
m && C.push(l);
|
|
1285
|
+
for (const b of h) for (const x of b) C.push(x);
|
|
1286
|
+
return g && C.push(l), C;
|
|
1235
1287
|
};
|
|
1236
|
-
const
|
|
1237
|
-
const
|
|
1238
|
-
return new
|
|
1239
|
-
active:
|
|
1288
|
+
const ot = (e) => {
|
|
1289
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1290
|
+
return new Q$1({
|
|
1291
|
+
active: i,
|
|
1240
1292
|
inactive: s,
|
|
1241
1293
|
signal: e.signal,
|
|
1242
1294
|
input: e.input,
|
|
1243
1295
|
output: e.output,
|
|
1244
1296
|
initialValue: e.initialValue ?? !0,
|
|
1245
1297
|
render() {
|
|
1246
|
-
const
|
|
1247
|
-
` : ""}${
|
|
1248
|
-
`,
|
|
1298
|
+
const r = e.withGuide ?? u.withGuide, u$4 = `${V(this.state)} `, n = r ? `${styleText("gray", d)} ` : "", o = R(e.output, e.message, n, u$4), c = `${r ? `${styleText("gray", d)}
|
|
1299
|
+
` : ""}${o}
|
|
1300
|
+
`, a = this.value ? i : s;
|
|
1249
1301
|
switch (this.state) {
|
|
1250
|
-
case "submit": return `${
|
|
1251
|
-
case "cancel": return `${
|
|
1252
|
-
${styleText("gray",
|
|
1302
|
+
case "submit": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText("dim", a)}`;
|
|
1303
|
+
case "cancel": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText(["strikethrough", "dim"], a)}${r ? `
|
|
1304
|
+
${styleText("gray", d)}` : ""}`;
|
|
1253
1305
|
default: {
|
|
1254
|
-
const
|
|
1255
|
-
return `${
|
|
1256
|
-
${styleText("cyan",
|
|
1306
|
+
const l = r ? `${styleText("cyan", d)} ` : "", $ = r ? styleText("cyan", E) : "";
|
|
1307
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim", H)} ${styleText("dim", i)}`}${e.vertical ? r ? `
|
|
1308
|
+
${styleText("cyan", d)} ` : `
|
|
1257
1309
|
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
1258
|
-
${
|
|
1310
|
+
${$}
|
|
1259
1311
|
`;
|
|
1260
1312
|
}
|
|
1261
1313
|
}
|
|
1262
1314
|
}
|
|
1263
1315
|
}).prompt();
|
|
1264
|
-
},
|
|
1265
|
-
message: (e = [], { symbol:
|
|
1266
|
-
const
|
|
1267
|
-
for (let
|
|
1268
|
-
const
|
|
1316
|
+
}, O = {
|
|
1317
|
+
message: (e = [], { symbol: i = styleText("gray", d), secondarySymbol: s = styleText("gray", d), output: r = process.stdout, spacing: u$7 = 1, withGuide: n } = {}) => {
|
|
1318
|
+
const o = [], c = n ?? u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
1319
|
+
for (let p = 0; p < u$7; p++) o.push(a);
|
|
1320
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
1269
1321
|
`);
|
|
1270
|
-
if (
|
|
1271
|
-
const [
|
|
1272
|
-
|
|
1273
|
-
for (const
|
|
1322
|
+
if (y.length > 0) {
|
|
1323
|
+
const [p, ...m] = y;
|
|
1324
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
1325
|
+
for (const g of m) g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
1274
1326
|
}
|
|
1275
|
-
|
|
1327
|
+
r.write(`${o.join(`
|
|
1276
1328
|
`)}
|
|
1277
1329
|
`);
|
|
1278
1330
|
},
|
|
1279
|
-
info: (e,
|
|
1280
|
-
|
|
1281
|
-
...
|
|
1282
|
-
symbol: styleText("blue",
|
|
1331
|
+
info: (e, i) => {
|
|
1332
|
+
O.message(e, {
|
|
1333
|
+
...i,
|
|
1334
|
+
symbol: styleText("blue", he)
|
|
1283
1335
|
});
|
|
1284
1336
|
},
|
|
1285
|
-
success: (e,
|
|
1286
|
-
|
|
1287
|
-
...
|
|
1288
|
-
symbol: styleText("green",
|
|
1337
|
+
success: (e, i) => {
|
|
1338
|
+
O.message(e, {
|
|
1339
|
+
...i,
|
|
1340
|
+
symbol: styleText("green", pe)
|
|
1289
1341
|
});
|
|
1290
1342
|
},
|
|
1291
|
-
step: (e,
|
|
1292
|
-
|
|
1293
|
-
...
|
|
1294
|
-
symbol: styleText("green",
|
|
1343
|
+
step: (e, i) => {
|
|
1344
|
+
O.message(e, {
|
|
1345
|
+
...i,
|
|
1346
|
+
symbol: styleText("green", F)
|
|
1295
1347
|
});
|
|
1296
1348
|
},
|
|
1297
|
-
warn: (e,
|
|
1298
|
-
|
|
1299
|
-
...
|
|
1300
|
-
symbol: styleText("yellow",
|
|
1349
|
+
warn: (e, i) => {
|
|
1350
|
+
O.message(e, {
|
|
1351
|
+
...i,
|
|
1352
|
+
symbol: styleText("yellow", me)
|
|
1301
1353
|
});
|
|
1302
1354
|
},
|
|
1303
|
-
warning: (e,
|
|
1304
|
-
|
|
1355
|
+
warning: (e, i) => {
|
|
1356
|
+
O.warn(e, i);
|
|
1305
1357
|
},
|
|
1306
|
-
error: (e,
|
|
1307
|
-
|
|
1308
|
-
...
|
|
1309
|
-
symbol: styleText("red",
|
|
1358
|
+
error: (e, i) => {
|
|
1359
|
+
O.message(e, {
|
|
1360
|
+
...i,
|
|
1361
|
+
symbol: styleText("red", ge)
|
|
1310
1362
|
});
|
|
1311
1363
|
}
|
|
1312
|
-
},
|
|
1313
|
-
const s =
|
|
1314
|
-
s.write(`${
|
|
1364
|
+
}, pt = (e = "", i) => {
|
|
1365
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", E)} ` : "";
|
|
1366
|
+
s.write(`${r}${styleText("red", e)}
|
|
1315
1367
|
|
|
1316
1368
|
`);
|
|
1317
|
-
},
|
|
1318
|
-
const s =
|
|
1319
|
-
s.write(`${
|
|
1369
|
+
}, mt = (e = "", i) => {
|
|
1370
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", le)} ` : "";
|
|
1371
|
+
s.write(`${r}${e}
|
|
1320
1372
|
`);
|
|
1321
|
-
},
|
|
1322
|
-
const s =
|
|
1323
|
-
${styleText("gray",
|
|
1324
|
-
s.write(`${
|
|
1373
|
+
}, gt = (e = "", i) => {
|
|
1374
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", d)}
|
|
1375
|
+
${styleText("gray", E)} ` : "";
|
|
1376
|
+
s.write(`${r}${e}
|
|
1325
1377
|
|
|
1326
1378
|
`);
|
|
1327
|
-
}, Q = (e,
|
|
1328
|
-
`).map((s) =>
|
|
1329
|
-
`),
|
|
1330
|
-
const
|
|
1331
|
-
const
|
|
1332
|
-
return
|
|
1379
|
+
}, Q = (e, i) => e.split(`
|
|
1380
|
+
`).map((s) => i(s)).join(`
|
|
1381
|
+
`), yt = (e) => {
|
|
1382
|
+
const i = (r, u) => {
|
|
1383
|
+
const n = r.label ?? String(r.value);
|
|
1384
|
+
return u === "disabled" ? `${styleText("gray", J)} ${Q(n, (o) => styleText(["strikethrough", "gray"], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u === "active" ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "selected" ? `${styleText("green", U)} ${Q(n, (o) => styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "cancelled" ? `${Q(n, (o) => styleText(["strikethrough", "dim"], o))}` : u === "active-selected" ? `${styleText("green", U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "submitted" ? `${Q(n, (o) => styleText("dim", o))}` : `${styleText("dim", J)} ${Q(n, (o) => styleText("dim", o))}`;
|
|
1333
1385
|
}, s = e.required ?? !0;
|
|
1334
|
-
return new
|
|
1386
|
+
return new it$1({
|
|
1335
1387
|
options: e.options,
|
|
1336
1388
|
signal: e.signal,
|
|
1337
1389
|
input: e.input,
|
|
@@ -1339,8 +1391,8 @@ ${styleText("gray", x)} ` : "";
|
|
|
1339
1391
|
initialValues: e.initialValues,
|
|
1340
1392
|
required: s,
|
|
1341
1393
|
cursorAt: e.cursorAt,
|
|
1342
|
-
validate(
|
|
1343
|
-
if (s && (
|
|
1394
|
+
validate(r) {
|
|
1395
|
+
if (s && (r === void 0 || r.length === 0)) return `Please select at least one option.
|
|
1344
1396
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1345
1397
|
"gray",
|
|
1346
1398
|
"bgWhite",
|
|
@@ -1348,86 +1400,86 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
1348
1400
|
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1349
1401
|
},
|
|
1350
1402
|
render() {
|
|
1351
|
-
const
|
|
1352
|
-
${
|
|
1353
|
-
`, o = this.value ?? [],
|
|
1354
|
-
if (
|
|
1355
|
-
const
|
|
1356
|
-
return
|
|
1403
|
+
const r = e.withGuide ?? u.withGuide, u$8 = R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${V(this.state)} `), n = `${r ? `${styleText("gray", d)}
|
|
1404
|
+
` : ""}${u$8}
|
|
1405
|
+
`, o = this.value ?? [], c = (a, l) => {
|
|
1406
|
+
if (a.disabled) return i(a, "disabled");
|
|
1407
|
+
const $ = o.includes(a.value);
|
|
1408
|
+
return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
|
|
1357
1409
|
};
|
|
1358
1410
|
switch (this.state) {
|
|
1359
1411
|
case "submit": {
|
|
1360
|
-
const
|
|
1361
|
-
return `${
|
|
1412
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
1413
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}`;
|
|
1362
1414
|
}
|
|
1363
1415
|
case "cancel": {
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
-
return `${
|
|
1367
|
-
${styleText("gray",
|
|
1416
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "cancelled")).join(styleText("dim", ", "));
|
|
1417
|
+
if (a.trim() === "") return `${n}${styleText("gray", d)}`;
|
|
1418
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}${r ? `
|
|
1419
|
+
${styleText("gray", d)}` : ""}`;
|
|
1368
1420
|
}
|
|
1369
1421
|
case "error": {
|
|
1370
|
-
const
|
|
1371
|
-
`).map((
|
|
1372
|
-
`),
|
|
1373
|
-
`).length,
|
|
1422
|
+
const a = r ? `${styleText("yellow", d)} ` : "", l = this.error.split(`
|
|
1423
|
+
`).map((p, m) => m === 0 ? `${r ? `${styleText("yellow", E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
|
|
1424
|
+
`), $ = n.split(`
|
|
1425
|
+
`).length, y = l.split(`
|
|
1374
1426
|
`).length + 1;
|
|
1375
|
-
return `${
|
|
1427
|
+
return `${n}${a}${Y({
|
|
1376
1428
|
output: e.output,
|
|
1377
1429
|
options: this.options,
|
|
1378
1430
|
cursor: this.cursor,
|
|
1379
1431
|
maxItems: e.maxItems,
|
|
1380
|
-
columnPadding:
|
|
1381
|
-
rowPadding:
|
|
1382
|
-
style:
|
|
1432
|
+
columnPadding: a.length,
|
|
1433
|
+
rowPadding: $ + y,
|
|
1434
|
+
style: c
|
|
1383
1435
|
}).join(`
|
|
1384
|
-
${
|
|
1385
|
-
${
|
|
1436
|
+
${a}`)}
|
|
1437
|
+
${l}
|
|
1386
1438
|
`;
|
|
1387
1439
|
}
|
|
1388
1440
|
default: {
|
|
1389
|
-
const
|
|
1390
|
-
`).length;
|
|
1391
|
-
return `${
|
|
1441
|
+
const a = r ? `${styleText("cyan", d)} ` : "", l = n.split(`
|
|
1442
|
+
`).length, $ = r ? 2 : 1;
|
|
1443
|
+
return `${n}${a}${Y({
|
|
1392
1444
|
output: e.output,
|
|
1393
1445
|
options: this.options,
|
|
1394
1446
|
cursor: this.cursor,
|
|
1395
1447
|
maxItems: e.maxItems,
|
|
1396
|
-
columnPadding:
|
|
1397
|
-
rowPadding:
|
|
1398
|
-
style:
|
|
1448
|
+
columnPadding: a.length,
|
|
1449
|
+
rowPadding: l + $,
|
|
1450
|
+
style: c
|
|
1399
1451
|
}).join(`
|
|
1400
|
-
${
|
|
1401
|
-
${styleText("cyan",
|
|
1452
|
+
${a}`)}
|
|
1453
|
+
${r ? styleText("cyan", E) : ""}
|
|
1402
1454
|
`;
|
|
1403
1455
|
}
|
|
1404
1456
|
}
|
|
1405
1457
|
}
|
|
1406
1458
|
}).prompt();
|
|
1407
|
-
},
|
|
1408
|
-
const
|
|
1459
|
+
}, ft = (e) => styleText("dim", e), vt = (e, i, s) => {
|
|
1460
|
+
const r = {
|
|
1409
1461
|
hard: !0,
|
|
1410
1462
|
trim: !1
|
|
1411
|
-
},
|
|
1412
|
-
`),
|
|
1413
|
-
return
|
|
1414
|
-
},
|
|
1415
|
-
const
|
|
1463
|
+
}, u = wrapAnsi(e, i, r).split(`
|
|
1464
|
+
`), n = u.reduce((a, l) => Math.max(fastStringWidth(l), a), 0);
|
|
1465
|
+
return wrapAnsi(e, i - (u.map(s).reduce((a, l) => Math.max(fastStringWidth(l), a), 0) - n), r);
|
|
1466
|
+
}, wt = (e = "", i = "", s) => {
|
|
1467
|
+
const r = s?.output ?? P.stdout, u$9 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = [
|
|
1416
1468
|
"",
|
|
1417
|
-
...
|
|
1418
|
-
`).map(
|
|
1469
|
+
...vt(e, O$1(r) - 6, n).split(`
|
|
1470
|
+
`).map(n),
|
|
1419
1471
|
""
|
|
1420
|
-
],
|
|
1421
|
-
const
|
|
1422
|
-
return
|
|
1423
|
-
}, 0),
|
|
1424
|
-
`),
|
|
1425
|
-
` : "",
|
|
1426
|
-
|
|
1427
|
-
${
|
|
1428
|
-
${styleText("gray",
|
|
1472
|
+
], c = fastStringWidth(i), a = Math.max(o.reduce((p, m) => {
|
|
1473
|
+
const g = fastStringWidth(m);
|
|
1474
|
+
return g > p ? g : p;
|
|
1475
|
+
}, 0), c) + 2, l = o.map((p) => `${styleText("gray", d)} ${p}${" ".repeat(a - fastStringWidth(p))}${styleText("gray", d)}`).join(`
|
|
1476
|
+
`), $ = u$9 ? `${styleText("gray", d)}
|
|
1477
|
+
` : "", y = u$9 ? Ge : de;
|
|
1478
|
+
r.write(`${$}${styleText("green", F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
|
|
1479
|
+
${l}
|
|
1480
|
+
${styleText("gray", y + se.repeat(a + 2) + $e)}
|
|
1429
1481
|
`);
|
|
1430
|
-
},
|
|
1482
|
+
}, Ct = (e) => styleText("magenta", e), fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u$11, frames: n = ee ? [
|
|
1431
1483
|
"◒",
|
|
1432
1484
|
"◐",
|
|
1433
1485
|
"◓",
|
|
@@ -1437,97 +1489,97 @@ ${styleText("gray", f + se.repeat(n + 2) + me)}
|
|
|
1437
1489
|
"o",
|
|
1438
1490
|
"O",
|
|
1439
1491
|
"0"
|
|
1440
|
-
], delay:
|
|
1441
|
-
const
|
|
1442
|
-
let
|
|
1443
|
-
const
|
|
1444
|
-
const
|
|
1445
|
-
|
|
1446
|
-
}, C = () =>
|
|
1447
|
-
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT",
|
|
1448
|
-
},
|
|
1449
|
-
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT",
|
|
1450
|
-
},
|
|
1451
|
-
if (
|
|
1452
|
-
|
|
1492
|
+
], delay: o = ee ? 80 : 120, signal: c, ...a } = {}) => {
|
|
1493
|
+
const l = ae();
|
|
1494
|
+
let $, y, p = !1, m = !1, g = "", S, h = performance.now();
|
|
1495
|
+
const f = O$1(s), v = a?.styleFrame ?? Ct, T = (_) => {
|
|
1496
|
+
const A = _ > 1 ? u$11 ?? u.messages.error : r ?? u.messages.cancel;
|
|
1497
|
+
m = _ === 1, p && (W(A, _), m && typeof i == "function" && i());
|
|
1498
|
+
}, C = () => T(2), b = () => T(1), x = () => {
|
|
1499
|
+
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T), c && c.addEventListener("abort", b);
|
|
1500
|
+
}, G = () => {
|
|
1501
|
+
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c && c.removeEventListener("abort", b);
|
|
1502
|
+
}, M = () => {
|
|
1503
|
+
if (S === void 0) return;
|
|
1504
|
+
l && s.write(`
|
|
1453
1505
|
`);
|
|
1454
|
-
const
|
|
1506
|
+
const _ = wrapAnsi(S, f, {
|
|
1455
1507
|
hard: !0,
|
|
1456
1508
|
trim: !1
|
|
1457
1509
|
}).split(`
|
|
1458
1510
|
`);
|
|
1459
|
-
|
|
1460
|
-
},
|
|
1461
|
-
const
|
|
1462
|
-
return
|
|
1463
|
-
},
|
|
1464
|
-
|
|
1511
|
+
_.length > 1 && s.write(import_src.cursor.up(_.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1512
|
+
}, R = (_) => _.replace(/\.+$/, ""), j = (_) => {
|
|
1513
|
+
const A = (performance.now() - _) / 1e3, k = Math.floor(A / 60), L = Math.floor(A % 60);
|
|
1514
|
+
return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
|
|
1515
|
+
}, D = a.withGuide ?? u.withGuide, ie = (_ = "") => {
|
|
1516
|
+
p = !0, $ = z$1({ output: s }), g = R(_), h = performance.now(), D && s.write(`${styleText("gray", d)}
|
|
1465
1517
|
`);
|
|
1466
|
-
let
|
|
1467
|
-
|
|
1468
|
-
if (
|
|
1469
|
-
|
|
1470
|
-
const L =
|
|
1518
|
+
let A = 0, k = 0;
|
|
1519
|
+
x(), y = setInterval(() => {
|
|
1520
|
+
if (l && g === S) return;
|
|
1521
|
+
M(), S = g;
|
|
1522
|
+
const L = v(n[A]);
|
|
1471
1523
|
let Z;
|
|
1472
|
-
if (
|
|
1473
|
-
else if (e === "timer") Z = `${L} ${
|
|
1524
|
+
if (l) Z = `${L} ${g}...`;
|
|
1525
|
+
else if (e === "timer") Z = `${L} ${g} ${j(h)}`;
|
|
1474
1526
|
else {
|
|
1475
|
-
const
|
|
1476
|
-
Z = `${L} ${
|
|
1527
|
+
const Be = ".".repeat(Math.floor(k)).slice(0, 3);
|
|
1528
|
+
Z = `${L} ${g}${Be}`;
|
|
1477
1529
|
}
|
|
1478
|
-
const
|
|
1530
|
+
const Ne = wrapAnsi(Z, f, {
|
|
1479
1531
|
hard: !0,
|
|
1480
1532
|
trim: !1
|
|
1481
1533
|
});
|
|
1482
|
-
s.write(
|
|
1483
|
-
},
|
|
1484
|
-
},
|
|
1485
|
-
if (!
|
|
1486
|
-
|
|
1487
|
-
const L =
|
|
1488
|
-
|
|
1489
|
-
`) : s.write(`${L} ${
|
|
1490
|
-
`)),
|
|
1534
|
+
s.write(Ne), A = A + 1 < n.length ? A + 1 : 0, k = k < 4 ? k + .125 : 0;
|
|
1535
|
+
}, o);
|
|
1536
|
+
}, W = (_ = "", A = 0, k = !1) => {
|
|
1537
|
+
if (!p) return;
|
|
1538
|
+
p = !1, clearInterval(y), M();
|
|
1539
|
+
const L = A === 0 ? styleText("green", F) : A === 1 ? styleText("red", oe) : styleText("red", ue);
|
|
1540
|
+
g = _ ?? g, k || (e === "timer" ? s.write(`${L} ${g} ${j(h)}
|
|
1541
|
+
`) : s.write(`${L} ${g}
|
|
1542
|
+
`)), G(), $();
|
|
1491
1543
|
};
|
|
1492
1544
|
return {
|
|
1493
|
-
start:
|
|
1494
|
-
stop: (
|
|
1495
|
-
message: (
|
|
1496
|
-
|
|
1545
|
+
start: ie,
|
|
1546
|
+
stop: (_ = "") => W(_, 0),
|
|
1547
|
+
message: (_ = "") => {
|
|
1548
|
+
g = R(_ ?? g);
|
|
1497
1549
|
},
|
|
1498
|
-
cancel: (
|
|
1499
|
-
error: (
|
|
1500
|
-
clear: () =>
|
|
1550
|
+
cancel: (_ = "") => W(_, 1),
|
|
1551
|
+
error: (_ = "") => W(_, 2),
|
|
1552
|
+
clear: () => W("", 0, !0),
|
|
1501
1553
|
get isCancelled() {
|
|
1502
|
-
return
|
|
1554
|
+
return m;
|
|
1503
1555
|
}
|
|
1504
1556
|
};
|
|
1505
1557
|
};
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
message: async (e, { symbol:
|
|
1509
|
-
process.stdout.write(`${styleText("gray",
|
|
1510
|
-
${
|
|
1558
|
+
w("─", "-"), w("━", "="), w("█", "#");
|
|
1559
|
+
const je = `${styleText("gray", d)} `, K = {
|
|
1560
|
+
message: async (e, { symbol: i = styleText("gray", d) } = {}) => {
|
|
1561
|
+
process.stdout.write(`${styleText("gray", d)}
|
|
1562
|
+
${i} `);
|
|
1511
1563
|
let s = 3;
|
|
1512
|
-
for await (let
|
|
1513
|
-
|
|
1514
|
-
${
|
|
1515
|
-
`) && (s = 3 + stripVTControlCharacters(
|
|
1564
|
+
for await (let r of e) {
|
|
1565
|
+
r = r.replace(/\n/g, `
|
|
1566
|
+
${je}`), r.includes(`
|
|
1567
|
+
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1516
1568
|
`))).length);
|
|
1517
|
-
const
|
|
1518
|
-
s +
|
|
1519
|
-
${
|
|
1569
|
+
const u = stripVTControlCharacters(r).length;
|
|
1570
|
+
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1571
|
+
${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1520
1572
|
}
|
|
1521
1573
|
process.stdout.write(`
|
|
1522
1574
|
`);
|
|
1523
1575
|
},
|
|
1524
|
-
info: (e) => K.message(e, { symbol: styleText("blue",
|
|
1525
|
-
success: (e) => K.message(e, { symbol: styleText("green",
|
|
1526
|
-
step: (e) => K.message(e, { symbol: styleText("green",
|
|
1527
|
-
warn: (e) => K.message(e, { symbol: styleText("yellow",
|
|
1576
|
+
info: (e) => K.message(e, { symbol: styleText("blue", he) }),
|
|
1577
|
+
success: (e) => K.message(e, { symbol: styleText("green", pe) }),
|
|
1578
|
+
step: (e) => K.message(e, { symbol: styleText("green", F) }),
|
|
1579
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", me) }),
|
|
1528
1580
|
warning: (e) => K.warn(e),
|
|
1529
|
-
error: (e) => K.message(e, { symbol: styleText("red",
|
|
1530
|
-
},
|
|
1581
|
+
error: (e) => K.message(e, { symbol: styleText("red", ge) })
|
|
1582
|
+
}, Ot = (e) => new at$1({
|
|
1531
1583
|
validate: e.validate,
|
|
1532
1584
|
placeholder: e.placeholder,
|
|
1533
1585
|
defaultValue: e.defaultValue,
|
|
@@ -1536,28 +1588,28 @@ ${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length)
|
|
|
1536
1588
|
signal: e.signal,
|
|
1537
1589
|
input: e.input,
|
|
1538
1590
|
render() {
|
|
1539
|
-
const
|
|
1540
|
-
` : ""}${
|
|
1541
|
-
`,
|
|
1591
|
+
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${styleText("gray", d)}
|
|
1592
|
+
` : ""}${V(this.state)} `}${e.message}
|
|
1593
|
+
`, r = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u$13 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1542
1594
|
switch (this.state) {
|
|
1543
1595
|
case "error": {
|
|
1544
|
-
const
|
|
1596
|
+
const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", d)} ` : "", a = i ? styleText("yellow", E) : "";
|
|
1545
1597
|
return `${s.trim()}
|
|
1546
|
-
${
|
|
1547
|
-
${
|
|
1598
|
+
${c}${u$13}
|
|
1599
|
+
${a}${o}
|
|
1548
1600
|
`;
|
|
1549
1601
|
}
|
|
1550
1602
|
case "submit": {
|
|
1551
|
-
const
|
|
1552
|
-
return `${s}${
|
|
1603
|
+
const o = n ? ` ${styleText("dim", n)}` : "";
|
|
1604
|
+
return `${s}${i ? styleText("gray", d) : ""}${o}`;
|
|
1553
1605
|
}
|
|
1554
1606
|
case "cancel": {
|
|
1555
|
-
const
|
|
1556
|
-
return `${s}${
|
|
1557
|
-
${
|
|
1607
|
+
const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c = i ? styleText("gray", d) : "";
|
|
1608
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
1609
|
+
${c}` : ""}`;
|
|
1558
1610
|
}
|
|
1559
|
-
default: return `${s}${
|
|
1560
|
-
${
|
|
1611
|
+
default: return `${s}${i ? `${styleText("cyan", d)} ` : ""}${u$13}
|
|
1612
|
+
${i ? styleText("cyan", E) : ""}
|
|
1561
1613
|
`;
|
|
1562
1614
|
}
|
|
1563
1615
|
}
|
|
@@ -9028,7 +9080,7 @@ var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9028
9080
|
exports.visitAsync = visit.visitAsync;
|
|
9029
9081
|
}));
|
|
9030
9082
|
//#endregion
|
|
9031
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
9083
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_oxc-resolver@11.19.1_typescript@6.0.2_vue-tsc@3.2.6_typescript@6.0.2_/node_modules/tsdown/esm-shims.js
|
|
9032
9084
|
var getFilename, getDirname, __dirname, __filename;
|
|
9033
9085
|
var init_esm_shims = __esmMin((() => {
|
|
9034
9086
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -158565,7 +158617,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
158565
158617
|
});
|
|
158566
158618
|
}));
|
|
158567
158619
|
//#endregion
|
|
158568
|
-
//#region ../../node_modules/.pnpm
|
|
158620
|
+
//#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/commonjs/index.js
|
|
158569
158621
|
var require_commonjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158570
158622
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158571
158623
|
exports.range = exports.balanced = void 0;
|
|
@@ -158619,9 +158671,10 @@ var require_commonjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158619
158671
|
exports.range = range;
|
|
158620
158672
|
}));
|
|
158621
158673
|
//#endregion
|
|
158622
|
-
//#region ../../node_modules/.pnpm
|
|
158674
|
+
//#region ../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js
|
|
158623
158675
|
var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158624
158676
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158677
|
+
exports.EXPANSION_MAX = void 0;
|
|
158625
158678
|
exports.expand = expand;
|
|
158626
158679
|
const balanced_match_1 = require_commonjs$2();
|
|
158627
158680
|
const escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -158638,7 +158691,8 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158638
158691
|
const openPattern = /\\{/g;
|
|
158639
158692
|
const closePattern = /\\}/g;
|
|
158640
158693
|
const commaPattern = /\\,/g;
|
|
158641
|
-
const periodPattern =
|
|
158694
|
+
const periodPattern = /\\\./g;
|
|
158695
|
+
exports.EXPANSION_MAX = 1e5;
|
|
158642
158696
|
function numeric(str) {
|
|
158643
158697
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
158644
158698
|
}
|
|
@@ -158669,10 +158723,11 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158669
158723
|
parts.push.apply(parts, p);
|
|
158670
158724
|
return parts;
|
|
158671
158725
|
}
|
|
158672
|
-
function expand(str) {
|
|
158726
|
+
function expand(str, options = {}) {
|
|
158673
158727
|
if (!str) return [];
|
|
158728
|
+
const { max = exports.EXPANSION_MAX } = options;
|
|
158674
158729
|
if (str.slice(0, 2) === "{}") str = "\\{\\}" + str.slice(2);
|
|
158675
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
158730
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
158676
158731
|
}
|
|
158677
158732
|
function embrace(str) {
|
|
158678
158733
|
return "{" + str + "}";
|
|
@@ -158686,14 +158741,14 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158686
158741
|
function gte(i, y) {
|
|
158687
158742
|
return i >= y;
|
|
158688
158743
|
}
|
|
158689
|
-
function expand_(str, isTop) {
|
|
158744
|
+
function expand_(str, max, isTop) {
|
|
158690
158745
|
/** @type {string[]} */
|
|
158691
158746
|
const expansions = [];
|
|
158692
158747
|
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
|
158693
158748
|
if (!m) return [str];
|
|
158694
158749
|
const pre = m.pre;
|
|
158695
|
-
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
158696
|
-
if (/\$$/.test(m.pre)) for (let k = 0; k < post.length; k++) {
|
|
158750
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
158751
|
+
if (/\$$/.test(m.pre)) for (let k = 0; k < post.length && k < max; k++) {
|
|
158697
158752
|
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
158698
158753
|
expansions.push(expansion);
|
|
158699
158754
|
}
|
|
@@ -158705,7 +158760,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158705
158760
|
if (!isSequence && !isOptions) {
|
|
158706
158761
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
158707
158762
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
158708
|
-
return expand_(str);
|
|
158763
|
+
return expand_(str, max, true);
|
|
158709
158764
|
}
|
|
158710
158765
|
return [str];
|
|
158711
158766
|
}
|
|
@@ -158714,7 +158769,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158714
158769
|
else {
|
|
158715
158770
|
n = parseCommaParts(m.body);
|
|
158716
158771
|
if (n.length === 1 && n[0] !== void 0) {
|
|
158717
|
-
n = expand_(n[0], false).map(embrace);
|
|
158772
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
158718
158773
|
/* c8 ignore start */
|
|
158719
158774
|
if (n.length === 1) return post.map((p) => m.pre + n[0] + p);
|
|
158720
158775
|
}
|
|
@@ -158724,7 +158779,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158724
158779
|
const x = numeric(n[0]);
|
|
158725
158780
|
const y = numeric(n[1]);
|
|
158726
158781
|
const width = Math.max(n[0].length, n[1].length);
|
|
158727
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
158782
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
158728
158783
|
let test = lte;
|
|
158729
158784
|
if (y < x) {
|
|
158730
158785
|
incr *= -1;
|
|
@@ -158752,9 +158807,9 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158752
158807
|
}
|
|
158753
158808
|
} else {
|
|
158754
158809
|
N = [];
|
|
158755
|
-
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], false));
|
|
158810
|
+
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], max, false));
|
|
158756
158811
|
}
|
|
158757
|
-
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length; k++) {
|
|
158812
|
+
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
158758
158813
|
const expansion = pre + N[j] + post[k];
|
|
158759
158814
|
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
158760
158815
|
}
|
|
@@ -158763,7 +158818,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158763
158818
|
}
|
|
158764
158819
|
}));
|
|
158765
158820
|
//#endregion
|
|
158766
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158821
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
|
|
158767
158822
|
var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158768
158823
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158769
158824
|
exports.assertValidPattern = void 0;
|
|
@@ -158775,7 +158830,7 @@ var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158775
158830
|
exports.assertValidPattern = assertValidPattern;
|
|
158776
158831
|
}));
|
|
158777
158832
|
//#endregion
|
|
158778
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158833
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/brace-expressions.js
|
|
158779
158834
|
var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158780
158835
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158781
158836
|
exports.parseClass = void 0;
|
|
@@ -158901,7 +158956,7 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158901
158956
|
exports.parseClass = parseClass;
|
|
158902
158957
|
}));
|
|
158903
158958
|
//#endregion
|
|
158904
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158959
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/unescape.js
|
|
158905
158960
|
var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158906
158961
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158907
158962
|
exports.unescape = void 0;
|
|
@@ -158931,8 +158986,9 @@ var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158931
158986
|
exports.unescape = unescape;
|
|
158932
158987
|
}));
|
|
158933
158988
|
//#endregion
|
|
158934
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158989
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/ast.js
|
|
158935
158990
|
var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158991
|
+
var _a;
|
|
158936
158992
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158937
158993
|
exports.AST = void 0;
|
|
158938
158994
|
const brace_expressions_js_1 = require_brace_expressions();
|
|
@@ -158945,6 +159001,53 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158945
159001
|
"@"
|
|
158946
159002
|
]);
|
|
158947
159003
|
const isExtglobType = (c) => types.has(c);
|
|
159004
|
+
const isExtglobAST = (c) => isExtglobType(c.type);
|
|
159005
|
+
const adoptionMap = new Map([
|
|
159006
|
+
["!", ["@"]],
|
|
159007
|
+
["?", ["?", "@"]],
|
|
159008
|
+
["@", ["@"]],
|
|
159009
|
+
["*", [
|
|
159010
|
+
"*",
|
|
159011
|
+
"+",
|
|
159012
|
+
"?",
|
|
159013
|
+
"@"
|
|
159014
|
+
]],
|
|
159015
|
+
["+", ["+", "@"]]
|
|
159016
|
+
]);
|
|
159017
|
+
const adoptionWithSpaceMap = new Map([
|
|
159018
|
+
["!", ["?"]],
|
|
159019
|
+
["@", ["?"]],
|
|
159020
|
+
["+", ["?", "*"]]
|
|
159021
|
+
]);
|
|
159022
|
+
const adoptionAnyMap = new Map([
|
|
159023
|
+
["!", ["?", "@"]],
|
|
159024
|
+
["?", ["?", "@"]],
|
|
159025
|
+
["@", ["?", "@"]],
|
|
159026
|
+
["*", [
|
|
159027
|
+
"*",
|
|
159028
|
+
"+",
|
|
159029
|
+
"?",
|
|
159030
|
+
"@"
|
|
159031
|
+
]],
|
|
159032
|
+
["+", [
|
|
159033
|
+
"+",
|
|
159034
|
+
"@",
|
|
159035
|
+
"?",
|
|
159036
|
+
"*"
|
|
159037
|
+
]]
|
|
159038
|
+
]);
|
|
159039
|
+
const usurpMap = new Map([
|
|
159040
|
+
["!", new Map([["!", "@"]])],
|
|
159041
|
+
["?", new Map([["*", "*"], ["+", "*"]])],
|
|
159042
|
+
["@", new Map([
|
|
159043
|
+
["!", "!"],
|
|
159044
|
+
["?", "?"],
|
|
159045
|
+
["@", "@"],
|
|
159046
|
+
["*", "*"],
|
|
159047
|
+
["+", "+"]
|
|
159048
|
+
])],
|
|
159049
|
+
["+", new Map([["?", "*"], ["*", "*"]])]
|
|
159050
|
+
]);
|
|
158948
159051
|
const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
158949
159052
|
const startNoDot = "(?!\\.)";
|
|
158950
159053
|
const addPatternStart = new Set(["[", "."]);
|
|
@@ -158954,7 +159057,8 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158954
159057
|
const qmark = "[^/]";
|
|
158955
159058
|
const star = qmark + "*?";
|
|
158956
159059
|
const starNoEmpty = qmark + "+?";
|
|
158957
|
-
|
|
159060
|
+
let ID = 0;
|
|
159061
|
+
var AST = class {
|
|
158958
159062
|
type;
|
|
158959
159063
|
#root;
|
|
158960
159064
|
#hasMagic;
|
|
@@ -158967,6 +159071,22 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158967
159071
|
#options;
|
|
158968
159072
|
#toString;
|
|
158969
159073
|
#emptyExt = false;
|
|
159074
|
+
id = ++ID;
|
|
159075
|
+
get depth() {
|
|
159076
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
159077
|
+
}
|
|
159078
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
159079
|
+
return {
|
|
159080
|
+
"@@type": "AST",
|
|
159081
|
+
id: this.id,
|
|
159082
|
+
type: this.type,
|
|
159083
|
+
root: this.#root.id,
|
|
159084
|
+
parent: this.#parent?.id,
|
|
159085
|
+
depth: this.depth,
|
|
159086
|
+
partsLength: this.#parts.length,
|
|
159087
|
+
parts: this.#parts
|
|
159088
|
+
};
|
|
159089
|
+
}
|
|
158970
159090
|
constructor(type, parent, options = {}) {
|
|
158971
159091
|
this.type = type;
|
|
158972
159092
|
if (type) this.#hasMagic = true;
|
|
@@ -159021,7 +159141,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159021
159141
|
for (const p of parts) {
|
|
159022
159142
|
if (p === "") continue;
|
|
159023
159143
|
/* c8 ignore start */
|
|
159024
|
-
if (typeof p !== "string" && !(p instanceof
|
|
159144
|
+
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
|
|
159025
159145
|
/* c8 ignore stop */
|
|
159026
159146
|
this.#parts.push(p);
|
|
159027
159147
|
}
|
|
@@ -159039,7 +159159,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159039
159159
|
const p = this.#parent;
|
|
159040
159160
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
159041
159161
|
const pp = p.#parts[i];
|
|
159042
|
-
if (!(pp instanceof
|
|
159162
|
+
if (!(pp instanceof _a && pp.type === "!")) return false;
|
|
159043
159163
|
}
|
|
159044
159164
|
return true;
|
|
159045
159165
|
}
|
|
@@ -159058,11 +159178,12 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159058
159178
|
else this.push(part.clone(this));
|
|
159059
159179
|
}
|
|
159060
159180
|
clone(parent) {
|
|
159061
|
-
const c = new
|
|
159181
|
+
const c = new _a(this.type, parent);
|
|
159062
159182
|
for (const p of this.#parts) c.copyIn(p);
|
|
159063
159183
|
return c;
|
|
159064
159184
|
}
|
|
159065
|
-
static #parseAST(str, ast, pos, opt) {
|
|
159185
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
159186
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
159066
159187
|
let escaping = false;
|
|
159067
159188
|
let inBrace = false;
|
|
159068
159189
|
let braceStart = -1;
|
|
@@ -159090,11 +159211,11 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159090
159211
|
acc += c;
|
|
159091
159212
|
continue;
|
|
159092
159213
|
}
|
|
159093
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(") {
|
|
159214
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
|
|
159094
159215
|
ast.push(acc);
|
|
159095
159216
|
acc = "";
|
|
159096
|
-
const ext = new
|
|
159097
|
-
i =
|
|
159217
|
+
const ext = new _a(c, ast);
|
|
159218
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
159098
159219
|
ast.push(ext);
|
|
159099
159220
|
continue;
|
|
159100
159221
|
}
|
|
@@ -159104,7 +159225,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159104
159225
|
return i;
|
|
159105
159226
|
}
|
|
159106
159227
|
let i = pos + 1;
|
|
159107
|
-
let part = new
|
|
159228
|
+
let part = new _a(null, ast);
|
|
159108
159229
|
const parts = [];
|
|
159109
159230
|
let acc = "";
|
|
159110
159231
|
while (i < str.length) {
|
|
@@ -159127,19 +159248,21 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159127
159248
|
acc += c;
|
|
159128
159249
|
continue;
|
|
159129
159250
|
}
|
|
159130
|
-
|
|
159251
|
+
/* c8 ignore stop */
|
|
159252
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
|
|
159253
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
159131
159254
|
part.push(acc);
|
|
159132
159255
|
acc = "";
|
|
159133
|
-
const ext = new
|
|
159256
|
+
const ext = new _a(c, part);
|
|
159134
159257
|
part.push(ext);
|
|
159135
|
-
i =
|
|
159258
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
159136
159259
|
continue;
|
|
159137
159260
|
}
|
|
159138
159261
|
if (c === "|") {
|
|
159139
159262
|
part.push(acc);
|
|
159140
159263
|
acc = "";
|
|
159141
159264
|
parts.push(part);
|
|
159142
|
-
part = new
|
|
159265
|
+
part = new _a(null, ast);
|
|
159143
159266
|
continue;
|
|
159144
159267
|
}
|
|
159145
159268
|
if (c === ")") {
|
|
@@ -159156,9 +159279,56 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159156
159279
|
ast.#parts = [str.substring(pos - 1)];
|
|
159157
159280
|
return i;
|
|
159158
159281
|
}
|
|
159282
|
+
#canAdoptWithSpace(child) {
|
|
159283
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
159284
|
+
}
|
|
159285
|
+
#canAdopt(child, map = adoptionMap) {
|
|
159286
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
|
|
159287
|
+
const gc = child.#parts[0];
|
|
159288
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
159289
|
+
return this.#canAdoptType(gc.type, map);
|
|
159290
|
+
}
|
|
159291
|
+
#canAdoptType(c, map = adoptionAnyMap) {
|
|
159292
|
+
return !!map.get(this.type)?.includes(c);
|
|
159293
|
+
}
|
|
159294
|
+
#adoptWithSpace(child, index) {
|
|
159295
|
+
const gc = child.#parts[0];
|
|
159296
|
+
const blank = new _a(null, gc, this.options);
|
|
159297
|
+
blank.#parts.push("");
|
|
159298
|
+
gc.push(blank);
|
|
159299
|
+
this.#adopt(child, index);
|
|
159300
|
+
}
|
|
159301
|
+
#adopt(child, index) {
|
|
159302
|
+
const gc = child.#parts[0];
|
|
159303
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
159304
|
+
for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
|
|
159305
|
+
this.#toString = void 0;
|
|
159306
|
+
}
|
|
159307
|
+
#canUsurpType(c) {
|
|
159308
|
+
return !!usurpMap.get(this.type)?.has(c);
|
|
159309
|
+
}
|
|
159310
|
+
#canUsurp(child) {
|
|
159311
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
|
|
159312
|
+
const gc = child.#parts[0];
|
|
159313
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
159314
|
+
return this.#canUsurpType(gc.type);
|
|
159315
|
+
}
|
|
159316
|
+
#usurp(child) {
|
|
159317
|
+
const m = usurpMap.get(this.type);
|
|
159318
|
+
const gc = child.#parts[0];
|
|
159319
|
+
const nt = m?.get(gc.type);
|
|
159320
|
+
/* c8 ignore start - impossible */
|
|
159321
|
+
if (!nt) return false;
|
|
159322
|
+
/* c8 ignore stop */
|
|
159323
|
+
this.#parts = gc.#parts;
|
|
159324
|
+
for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
|
|
159325
|
+
this.type = nt;
|
|
159326
|
+
this.#toString = void 0;
|
|
159327
|
+
this.#emptyExt = false;
|
|
159328
|
+
}
|
|
159159
159329
|
static fromGlob(pattern, options = {}) {
|
|
159160
|
-
const ast = new
|
|
159161
|
-
|
|
159330
|
+
const ast = new _a(null, void 0, options);
|
|
159331
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
159162
159332
|
return ast;
|
|
159163
159333
|
}
|
|
159164
159334
|
toMMPattern() {
|
|
@@ -159179,11 +159349,14 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159179
159349
|
}
|
|
159180
159350
|
toRegExpSource(allowDot) {
|
|
159181
159351
|
const dot = allowDot ?? !!this.#options.dot;
|
|
159182
|
-
if (this.#root === this)
|
|
159183
|
-
|
|
159352
|
+
if (this.#root === this) {
|
|
159353
|
+
this.#flatten();
|
|
159354
|
+
this.#fillNegs();
|
|
159355
|
+
}
|
|
159356
|
+
if (!isExtglobAST(this)) {
|
|
159184
159357
|
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
159185
159358
|
const src = this.#parts.map((p) => {
|
|
159186
|
-
const [re, _, hasMagic, uflag] = typeof p === "string" ?
|
|
159359
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
159187
159360
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
159188
159361
|
this.#uflag = this.#uflag || uflag;
|
|
159189
159362
|
return re;
|
|
@@ -159213,9 +159386,10 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159213
159386
|
let body = this.#partsToRegExp(dot);
|
|
159214
159387
|
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
159215
159388
|
const s = this.toString();
|
|
159216
|
-
|
|
159217
|
-
|
|
159218
|
-
|
|
159389
|
+
const me = this;
|
|
159390
|
+
me.#parts = [s];
|
|
159391
|
+
me.type = null;
|
|
159392
|
+
me.#hasMagic = void 0;
|
|
159219
159393
|
return [
|
|
159220
159394
|
s,
|
|
159221
159395
|
(0, unescape_js_1.unescape)(this.toString()),
|
|
@@ -159239,6 +159413,34 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159239
159413
|
this.#uflag
|
|
159240
159414
|
];
|
|
159241
159415
|
}
|
|
159416
|
+
#flatten() {
|
|
159417
|
+
if (!isExtglobAST(this)) {
|
|
159418
|
+
for (const p of this.#parts) if (typeof p === "object") p.#flatten();
|
|
159419
|
+
} else {
|
|
159420
|
+
let iterations = 0;
|
|
159421
|
+
let done = false;
|
|
159422
|
+
do {
|
|
159423
|
+
done = true;
|
|
159424
|
+
for (let i = 0; i < this.#parts.length; i++) {
|
|
159425
|
+
const c = this.#parts[i];
|
|
159426
|
+
if (typeof c === "object") {
|
|
159427
|
+
c.#flatten();
|
|
159428
|
+
if (this.#canAdopt(c)) {
|
|
159429
|
+
done = false;
|
|
159430
|
+
this.#adopt(c, i);
|
|
159431
|
+
} else if (this.#canAdoptWithSpace(c)) {
|
|
159432
|
+
done = false;
|
|
159433
|
+
this.#adoptWithSpace(c, i);
|
|
159434
|
+
} else if (this.#canUsurp(c)) {
|
|
159435
|
+
done = false;
|
|
159436
|
+
this.#usurp(c);
|
|
159437
|
+
}
|
|
159438
|
+
}
|
|
159439
|
+
}
|
|
159440
|
+
} while (!done && ++iterations < 10);
|
|
159441
|
+
}
|
|
159442
|
+
this.#toString = void 0;
|
|
159443
|
+
}
|
|
159242
159444
|
#partsToRegExp(dot) {
|
|
159243
159445
|
return this.#parts.map((p) => {
|
|
159244
159446
|
/* c8 ignore start */
|
|
@@ -159253,6 +159455,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159253
159455
|
let escaping = false;
|
|
159254
159456
|
let re = "";
|
|
159255
159457
|
let uflag = false;
|
|
159458
|
+
let inStar = false;
|
|
159256
159459
|
for (let i = 0; i < glob.length; i++) {
|
|
159257
159460
|
const c = glob.charAt(i);
|
|
159258
159461
|
if (escaping) {
|
|
@@ -159260,6 +159463,13 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159260
159463
|
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
159261
159464
|
continue;
|
|
159262
159465
|
}
|
|
159466
|
+
if (c === "*") {
|
|
159467
|
+
if (inStar) continue;
|
|
159468
|
+
inStar = true;
|
|
159469
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
159470
|
+
hasMagic = true;
|
|
159471
|
+
continue;
|
|
159472
|
+
} else inStar = false;
|
|
159263
159473
|
if (c === "\\") {
|
|
159264
159474
|
if (i === glob.length - 1) re += "\\\\";
|
|
159265
159475
|
else escaping = true;
|
|
@@ -159275,11 +159485,6 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159275
159485
|
continue;
|
|
159276
159486
|
}
|
|
159277
159487
|
}
|
|
159278
|
-
if (c === "*") {
|
|
159279
|
-
re += noEmpty && glob === "*" ? starNoEmpty : star;
|
|
159280
|
-
hasMagic = true;
|
|
159281
|
-
continue;
|
|
159282
|
-
}
|
|
159283
159488
|
if (c === "?") {
|
|
159284
159489
|
re += qmark;
|
|
159285
159490
|
hasMagic = true;
|
|
@@ -159295,9 +159500,11 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159295
159500
|
];
|
|
159296
159501
|
}
|
|
159297
159502
|
};
|
|
159503
|
+
exports.AST = AST;
|
|
159504
|
+
_a = AST;
|
|
159298
159505
|
}));
|
|
159299
159506
|
//#endregion
|
|
159300
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
159507
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/escape.js
|
|
159301
159508
|
var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
159302
159509
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
159303
159510
|
exports.escape = void 0;
|
|
@@ -159320,7 +159527,7 @@ var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159320
159527
|
exports.escape = escape;
|
|
159321
159528
|
}));
|
|
159322
159529
|
//#endregion
|
|
159323
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
159530
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/index.js
|
|
159324
159531
|
var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
159325
159532
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
159326
159533
|
exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
|
|
@@ -159440,7 +159647,7 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159440
159647
|
const braceExpand = (pattern, options = {}) => {
|
|
159441
159648
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
159442
159649
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
159443
|
-
return (0, brace_expansion_1.expand)(pattern);
|
|
159650
|
+
return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
|
|
159444
159651
|
};
|
|
159445
159652
|
exports.braceExpand = braceExpand;
|
|
159446
159653
|
exports.minimatch.braceExpand = exports.braceExpand;
|
|
@@ -159474,15 +159681,17 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159474
159681
|
isWindows;
|
|
159475
159682
|
platform;
|
|
159476
159683
|
windowsNoMagicRoot;
|
|
159684
|
+
maxGlobstarRecursion;
|
|
159477
159685
|
regexp;
|
|
159478
159686
|
constructor(pattern, options = {}) {
|
|
159479
159687
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
159480
159688
|
options = options || {};
|
|
159481
159689
|
this.options = options;
|
|
159690
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
159482
159691
|
this.pattern = pattern;
|
|
159483
159692
|
this.platform = options.platform || defaultPlatform;
|
|
159484
159693
|
this.isWindows = this.platform === "win32";
|
|
159485
|
-
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options
|
|
159694
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
|
|
159486
159695
|
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
159487
159696
|
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
159488
159697
|
this.regexp = null;
|
|
@@ -159717,7 +159926,8 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159717
159926
|
this.negate = negate;
|
|
159718
159927
|
}
|
|
159719
159928
|
matchOne(file, pattern, partial = false) {
|
|
159720
|
-
|
|
159929
|
+
let fileStartIndex = 0;
|
|
159930
|
+
let patternStartIndex = 0;
|
|
159721
159931
|
if (this.isWindows) {
|
|
159722
159932
|
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
159723
159933
|
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
@@ -159729,62 +159939,107 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159729
159939
|
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
159730
159940
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
159731
159941
|
pattern[pdi] = fd;
|
|
159732
|
-
|
|
159733
|
-
|
|
159942
|
+
patternStartIndex = pdi;
|
|
159943
|
+
fileStartIndex = fdi;
|
|
159734
159944
|
}
|
|
159735
159945
|
}
|
|
159736
159946
|
}
|
|
159737
159947
|
const { optimizationLevel = 1 } = this.options;
|
|
159738
159948
|
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
159739
|
-
|
|
159740
|
-
|
|
159741
|
-
|
|
159742
|
-
|
|
159743
|
-
|
|
159744
|
-
|
|
159949
|
+
if (pattern.includes(exports.GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
159950
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
159951
|
+
}
|
|
159952
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
159953
|
+
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
|
159954
|
+
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
159955
|
+
const [head, body, tail] = partial ? [
|
|
159956
|
+
pattern.slice(patternIndex, firstgs),
|
|
159957
|
+
pattern.slice(firstgs + 1),
|
|
159958
|
+
[]
|
|
159959
|
+
] : [
|
|
159960
|
+
pattern.slice(patternIndex, firstgs),
|
|
159961
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
159962
|
+
pattern.slice(lastgs + 1)
|
|
159963
|
+
];
|
|
159964
|
+
if (head.length) {
|
|
159965
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
159966
|
+
if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
|
|
159967
|
+
fileIndex += head.length;
|
|
159968
|
+
patternIndex += head.length;
|
|
159969
|
+
}
|
|
159970
|
+
let fileTailMatch = 0;
|
|
159971
|
+
if (tail.length) {
|
|
159972
|
+
if (tail.length + fileIndex > file.length) return false;
|
|
159973
|
+
let tailStart = file.length - tail.length;
|
|
159974
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
|
|
159975
|
+
else {
|
|
159976
|
+
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
|
|
159977
|
+
tailStart--;
|
|
159978
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) return false;
|
|
159979
|
+
fileTailMatch = tail.length + 1;
|
|
159980
|
+
}
|
|
159981
|
+
}
|
|
159982
|
+
if (!body.length) {
|
|
159983
|
+
let sawSome = !!fileTailMatch;
|
|
159984
|
+
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
159985
|
+
const f = String(file[i]);
|
|
159986
|
+
sawSome = true;
|
|
159987
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
159988
|
+
}
|
|
159989
|
+
return partial || sawSome;
|
|
159990
|
+
}
|
|
159991
|
+
const bodySegments = [[[], 0]];
|
|
159992
|
+
let currentBody = bodySegments[0];
|
|
159993
|
+
let nonGsParts = 0;
|
|
159994
|
+
const nonGsPartsSums = [0];
|
|
159995
|
+
for (const b of body) if (b === exports.GLOBSTAR) {
|
|
159996
|
+
nonGsPartsSums.push(nonGsParts);
|
|
159997
|
+
currentBody = [[], 0];
|
|
159998
|
+
bodySegments.push(currentBody);
|
|
159999
|
+
} else {
|
|
160000
|
+
currentBody[0].push(b);
|
|
160001
|
+
nonGsParts++;
|
|
160002
|
+
}
|
|
160003
|
+
let i = bodySegments.length - 1;
|
|
160004
|
+
const fileLength = file.length - fileTailMatch;
|
|
160005
|
+
for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
160006
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
160007
|
+
}
|
|
160008
|
+
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
160009
|
+
const bs = bodySegments[bodyIndex];
|
|
160010
|
+
if (!bs) {
|
|
160011
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
160012
|
+
sawTail = true;
|
|
160013
|
+
const f = file[i];
|
|
160014
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
160015
|
+
}
|
|
160016
|
+
return sawTail;
|
|
160017
|
+
}
|
|
160018
|
+
const [body, after] = bs;
|
|
160019
|
+
while (fileIndex <= after) {
|
|
160020
|
+
if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
|
|
160021
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
160022
|
+
if (sub !== false) return sub;
|
|
160023
|
+
}
|
|
160024
|
+
const f = file[fileIndex];
|
|
160025
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
160026
|
+
fileIndex++;
|
|
160027
|
+
}
|
|
160028
|
+
return partial || null;
|
|
160029
|
+
}
|
|
160030
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
160031
|
+
let fi;
|
|
160032
|
+
let pi;
|
|
160033
|
+
let pl;
|
|
160034
|
+
let fl;
|
|
160035
|
+
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
159745
160036
|
this.debug("matchOne loop");
|
|
159746
|
-
|
|
159747
|
-
|
|
160037
|
+
let p = pattern[pi];
|
|
160038
|
+
let f = file[fi];
|
|
159748
160039
|
this.debug(pattern, p, f);
|
|
159749
160040
|
/* c8 ignore start */
|
|
159750
|
-
if (p === false) return false;
|
|
160041
|
+
if (p === false || p === exports.GLOBSTAR) return false;
|
|
159751
160042
|
/* c8 ignore stop */
|
|
159752
|
-
if (p === exports.GLOBSTAR) {
|
|
159753
|
-
this.debug("GLOBSTAR", [
|
|
159754
|
-
pattern,
|
|
159755
|
-
p,
|
|
159756
|
-
f
|
|
159757
|
-
]);
|
|
159758
|
-
var fr = fi;
|
|
159759
|
-
var pr = pi + 1;
|
|
159760
|
-
if (pr === pl) {
|
|
159761
|
-
this.debug("** at the end");
|
|
159762
|
-
for (; fi < fl; fi++) if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
|
159763
|
-
return true;
|
|
159764
|
-
}
|
|
159765
|
-
while (fr < fl) {
|
|
159766
|
-
var swallowee = file[fr];
|
|
159767
|
-
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
159768
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
159769
|
-
this.debug("globstar found match!", fr, fl, swallowee);
|
|
159770
|
-
return true;
|
|
159771
|
-
} else {
|
|
159772
|
-
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
159773
|
-
this.debug("dot detected!", file, fr, pattern, pr);
|
|
159774
|
-
break;
|
|
159775
|
-
}
|
|
159776
|
-
this.debug("globstar swallow a segment, and continue");
|
|
159777
|
-
fr++;
|
|
159778
|
-
}
|
|
159779
|
-
}
|
|
159780
|
-
/* c8 ignore start */
|
|
159781
|
-
if (partial) {
|
|
159782
|
-
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
159783
|
-
if (fr === fl) return true;
|
|
159784
|
-
}
|
|
159785
|
-
/* c8 ignore stop */
|
|
159786
|
-
return false;
|
|
159787
|
-
}
|
|
159788
160043
|
let hit;
|
|
159789
160044
|
if (typeof p === "string") {
|
|
159790
160045
|
hit = f === p;
|
|
@@ -160257,10 +160512,11 @@ var require_path_browserify = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
160257
160512
|
module.exports = posix;
|
|
160258
160513
|
}));
|
|
160259
160514
|
//#endregion
|
|
160260
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160515
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
160261
160516
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160262
160517
|
const WIN_SLASH = "\\\\/";
|
|
160263
160518
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
160519
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
160264
160520
|
/**
|
|
160265
160521
|
* Posix glob regex
|
|
160266
160522
|
*/
|
|
@@ -160310,8 +160566,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160310
160566
|
SEP: "\\"
|
|
160311
160567
|
};
|
|
160312
160568
|
module.exports = {
|
|
160569
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
160313
160570
|
MAX_LENGTH: 1024 * 64,
|
|
160314
160571
|
POSIX_REGEX_SOURCE: {
|
|
160572
|
+
__proto__: null,
|
|
160315
160573
|
alnum: "a-zA-Z0-9",
|
|
160316
160574
|
alpha: "a-zA-Z",
|
|
160317
160575
|
ascii: "\\x00-\\x7F",
|
|
@@ -160417,7 +160675,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160417
160675
|
};
|
|
160418
160676
|
}));
|
|
160419
160677
|
//#endregion
|
|
160420
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160678
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
160421
160679
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
160422
160680
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
160423
160681
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -160465,7 +160723,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
160465
160723
|
};
|
|
160466
160724
|
}));
|
|
160467
160725
|
//#endregion
|
|
160468
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160726
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
160469
160727
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160470
160728
|
const utils = require_utils();
|
|
160471
160729
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -160752,7 +161010,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160752
161010
|
module.exports = scan;
|
|
160753
161011
|
}));
|
|
160754
161012
|
//#endregion
|
|
160755
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
161013
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
160756
161014
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160757
161015
|
const constants = require_constants();
|
|
160758
161016
|
const utils = require_utils();
|
|
@@ -160780,6 +161038,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160780
161038
|
const syntaxError = (type, char) => {
|
|
160781
161039
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
160782
161040
|
};
|
|
161041
|
+
const splitTopLevel = (input) => {
|
|
161042
|
+
const parts = [];
|
|
161043
|
+
let bracket = 0;
|
|
161044
|
+
let paren = 0;
|
|
161045
|
+
let quote = 0;
|
|
161046
|
+
let value = "";
|
|
161047
|
+
let escaped = false;
|
|
161048
|
+
for (const ch of input) {
|
|
161049
|
+
if (escaped === true) {
|
|
161050
|
+
value += ch;
|
|
161051
|
+
escaped = false;
|
|
161052
|
+
continue;
|
|
161053
|
+
}
|
|
161054
|
+
if (ch === "\\") {
|
|
161055
|
+
value += ch;
|
|
161056
|
+
escaped = true;
|
|
161057
|
+
continue;
|
|
161058
|
+
}
|
|
161059
|
+
if (ch === "\"") {
|
|
161060
|
+
quote = quote === 1 ? 0 : 1;
|
|
161061
|
+
value += ch;
|
|
161062
|
+
continue;
|
|
161063
|
+
}
|
|
161064
|
+
if (quote === 0) {
|
|
161065
|
+
if (ch === "[") bracket++;
|
|
161066
|
+
else if (ch === "]" && bracket > 0) bracket--;
|
|
161067
|
+
else if (bracket === 0) {
|
|
161068
|
+
if (ch === "(") paren++;
|
|
161069
|
+
else if (ch === ")" && paren > 0) paren--;
|
|
161070
|
+
else if (ch === "|" && paren === 0) {
|
|
161071
|
+
parts.push(value);
|
|
161072
|
+
value = "";
|
|
161073
|
+
continue;
|
|
161074
|
+
}
|
|
161075
|
+
}
|
|
161076
|
+
}
|
|
161077
|
+
value += ch;
|
|
161078
|
+
}
|
|
161079
|
+
parts.push(value);
|
|
161080
|
+
return parts;
|
|
161081
|
+
};
|
|
161082
|
+
const isPlainBranch = (branch) => {
|
|
161083
|
+
let escaped = false;
|
|
161084
|
+
for (const ch of branch) {
|
|
161085
|
+
if (escaped === true) {
|
|
161086
|
+
escaped = false;
|
|
161087
|
+
continue;
|
|
161088
|
+
}
|
|
161089
|
+
if (ch === "\\") {
|
|
161090
|
+
escaped = true;
|
|
161091
|
+
continue;
|
|
161092
|
+
}
|
|
161093
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
161094
|
+
}
|
|
161095
|
+
return true;
|
|
161096
|
+
};
|
|
161097
|
+
const normalizeSimpleBranch = (branch) => {
|
|
161098
|
+
let value = branch.trim();
|
|
161099
|
+
let changed = true;
|
|
161100
|
+
while (changed === true) {
|
|
161101
|
+
changed = false;
|
|
161102
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
161103
|
+
value = value.slice(2, -1);
|
|
161104
|
+
changed = true;
|
|
161105
|
+
}
|
|
161106
|
+
}
|
|
161107
|
+
if (!isPlainBranch(value)) return;
|
|
161108
|
+
return value.replace(/\\(.)/g, "$1");
|
|
161109
|
+
};
|
|
161110
|
+
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
161111
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
161112
|
+
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
161113
|
+
const a = values[i];
|
|
161114
|
+
const b = values[j];
|
|
161115
|
+
const char = a[0];
|
|
161116
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
161117
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
161118
|
+
}
|
|
161119
|
+
return false;
|
|
161120
|
+
};
|
|
161121
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
161122
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
161123
|
+
let bracket = 0;
|
|
161124
|
+
let paren = 0;
|
|
161125
|
+
let quote = 0;
|
|
161126
|
+
let escaped = false;
|
|
161127
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
161128
|
+
const ch = pattern[i];
|
|
161129
|
+
if (escaped === true) {
|
|
161130
|
+
escaped = false;
|
|
161131
|
+
continue;
|
|
161132
|
+
}
|
|
161133
|
+
if (ch === "\\") {
|
|
161134
|
+
escaped = true;
|
|
161135
|
+
continue;
|
|
161136
|
+
}
|
|
161137
|
+
if (ch === "\"") {
|
|
161138
|
+
quote = quote === 1 ? 0 : 1;
|
|
161139
|
+
continue;
|
|
161140
|
+
}
|
|
161141
|
+
if (quote === 1) continue;
|
|
161142
|
+
if (ch === "[") {
|
|
161143
|
+
bracket++;
|
|
161144
|
+
continue;
|
|
161145
|
+
}
|
|
161146
|
+
if (ch === "]" && bracket > 0) {
|
|
161147
|
+
bracket--;
|
|
161148
|
+
continue;
|
|
161149
|
+
}
|
|
161150
|
+
if (bracket > 0) continue;
|
|
161151
|
+
if (ch === "(") {
|
|
161152
|
+
paren++;
|
|
161153
|
+
continue;
|
|
161154
|
+
}
|
|
161155
|
+
if (ch === ")") {
|
|
161156
|
+
paren--;
|
|
161157
|
+
if (paren === 0) {
|
|
161158
|
+
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
161159
|
+
return {
|
|
161160
|
+
type: pattern[0],
|
|
161161
|
+
body: pattern.slice(2, i),
|
|
161162
|
+
end: i
|
|
161163
|
+
};
|
|
161164
|
+
}
|
|
161165
|
+
}
|
|
161166
|
+
}
|
|
161167
|
+
};
|
|
161168
|
+
const getStarExtglobSequenceOutput = (pattern) => {
|
|
161169
|
+
let index = 0;
|
|
161170
|
+
const chars = [];
|
|
161171
|
+
while (index < pattern.length) {
|
|
161172
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
161173
|
+
if (!match || match.type !== "*") return;
|
|
161174
|
+
const branches = splitTopLevel(match.body).map((branch) => branch.trim());
|
|
161175
|
+
if (branches.length !== 1) return;
|
|
161176
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
161177
|
+
if (!branch || branch.length !== 1) return;
|
|
161178
|
+
chars.push(branch);
|
|
161179
|
+
index += match.end + 1;
|
|
161180
|
+
}
|
|
161181
|
+
if (chars.length < 1) return;
|
|
161182
|
+
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
161183
|
+
};
|
|
161184
|
+
const repeatedExtglobRecursion = (pattern) => {
|
|
161185
|
+
let depth = 0;
|
|
161186
|
+
let value = pattern.trim();
|
|
161187
|
+
let match = parseRepeatedExtglob(value);
|
|
161188
|
+
while (match) {
|
|
161189
|
+
depth++;
|
|
161190
|
+
value = match.body.trim();
|
|
161191
|
+
match = parseRepeatedExtglob(value);
|
|
161192
|
+
}
|
|
161193
|
+
return depth;
|
|
161194
|
+
};
|
|
161195
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
161196
|
+
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
161197
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
161198
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
161199
|
+
if (branches.length > 1) {
|
|
161200
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
161201
|
+
}
|
|
161202
|
+
for (const branch of branches) {
|
|
161203
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
161204
|
+
if (safeOutput) return {
|
|
161205
|
+
risky: true,
|
|
161206
|
+
safeOutput
|
|
161207
|
+
};
|
|
161208
|
+
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
161209
|
+
}
|
|
161210
|
+
return { risky: false };
|
|
161211
|
+
};
|
|
160783
161212
|
/**
|
|
160784
161213
|
* Parse the given input string.
|
|
160785
161214
|
* @param {String} input
|
|
@@ -160909,6 +161338,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160909
161338
|
token.prev = prev;
|
|
160910
161339
|
token.parens = state.parens;
|
|
160911
161340
|
token.output = state.output;
|
|
161341
|
+
token.startIndex = state.index;
|
|
161342
|
+
token.tokensIndex = tokens.length;
|
|
160912
161343
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
160913
161344
|
increment("parens");
|
|
160914
161345
|
push({
|
|
@@ -160925,6 +161356,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160925
161356
|
extglobs.push(token);
|
|
160926
161357
|
};
|
|
160927
161358
|
const extglobClose = (token) => {
|
|
161359
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
161360
|
+
const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
|
|
161361
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
161362
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
161363
|
+
const open = tokens[token.tokensIndex];
|
|
161364
|
+
open.type = "text";
|
|
161365
|
+
open.value = literal;
|
|
161366
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
161367
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
161368
|
+
tokens[i].value = "";
|
|
161369
|
+
tokens[i].output = "";
|
|
161370
|
+
delete tokens[i].suffix;
|
|
161371
|
+
}
|
|
161372
|
+
state.output = token.output + open.output;
|
|
161373
|
+
state.backtrack = true;
|
|
161374
|
+
push({
|
|
161375
|
+
type: "paren",
|
|
161376
|
+
extglob: true,
|
|
161377
|
+
value,
|
|
161378
|
+
output: ""
|
|
161379
|
+
});
|
|
161380
|
+
decrement("parens");
|
|
161381
|
+
return;
|
|
161382
|
+
}
|
|
160928
161383
|
let output = token.close + (opts.capture ? ")" : "");
|
|
160929
161384
|
let rest;
|
|
160930
161385
|
if (token.type === "negate") {
|
|
@@ -161610,7 +162065,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161610
162065
|
module.exports = parse;
|
|
161611
162066
|
}));
|
|
161612
162067
|
//#endregion
|
|
161613
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
162068
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
161614
162069
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
161615
162070
|
const scan = require_scan();
|
|
161616
162071
|
const parse = require_parse();
|
|
@@ -161820,6 +162275,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161820
162275
|
* Compile a regular expression from the `state` object returned by the
|
|
161821
162276
|
* [parse()](#parse) method.
|
|
161822
162277
|
*
|
|
162278
|
+
* ```js
|
|
162279
|
+
* const picomatch = require('picomatch');
|
|
162280
|
+
* const state = picomatch.parse('*.js');
|
|
162281
|
+
* // picomatch.compileRe(state[, options]);
|
|
162282
|
+
*
|
|
162283
|
+
* console.log(picomatch.compileRe(state));
|
|
162284
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
162285
|
+
* ```
|
|
161823
162286
|
* @param {Object} `state`
|
|
161824
162287
|
* @param {Object} `options`
|
|
161825
162288
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -161843,10 +162306,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161843
162306
|
*
|
|
161844
162307
|
* ```js
|
|
161845
162308
|
* const picomatch = require('picomatch');
|
|
161846
|
-
*
|
|
161847
|
-
* // picomatch.compileRe(state[, options]);
|
|
162309
|
+
* // picomatch.makeRe(state[, options]);
|
|
161848
162310
|
*
|
|
161849
|
-
*
|
|
162311
|
+
* const result = picomatch.makeRe('*.js');
|
|
162312
|
+
* console.log(result);
|
|
161850
162313
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
161851
162314
|
* ```
|
|
161852
162315
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -161902,7 +162365,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161902
162365
|
module.exports = picomatch;
|
|
161903
162366
|
}));
|
|
161904
162367
|
//#endregion
|
|
161905
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
162368
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
|
|
161906
162369
|
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
161907
162370
|
const pico = require_picomatch$1();
|
|
161908
162371
|
const utils = require_utils();
|
|
@@ -161917,7 +162380,7 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161917
162380
|
module.exports = picomatch;
|
|
161918
162381
|
}));
|
|
161919
162382
|
//#endregion
|
|
161920
|
-
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.
|
|
162383
|
+
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.cjs
|
|
161921
162384
|
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
161922
162385
|
var __create = Object.create;
|
|
161923
162386
|
var __defProp = Object.defineProperty;
|
|
@@ -186210,7 +186673,7 @@ var require_ts_morph = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
186210
186673
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
186211
186674
|
require_dist$2();
|
|
186212
186675
|
require_ts_morph();
|
|
186213
|
-
const CLI_VERSION = "0.
|
|
186676
|
+
const CLI_VERSION = "0.4.0";
|
|
186214
186677
|
const PACKAGE_NAME = "@supaslidev/cli";
|
|
186215
186678
|
const CACHE_DIR = join(tmpdir(), "supaslidev-cli");
|
|
186216
186679
|
const CACHE_FILE = join(CACHE_DIR, "version-cache.json");
|
|
@@ -186285,7 +186748,7 @@ function checkForUpdatesCached() {
|
|
|
186285
186748
|
const SUPASLIDEV_FALLBACK_VERSION = "0.1.4";
|
|
186286
186749
|
function createSafeSpinner() {
|
|
186287
186750
|
if (process.stdout.isTTY && process.stdin.isTTY) {
|
|
186288
|
-
const spinner =
|
|
186751
|
+
const spinner = fe();
|
|
186289
186752
|
return {
|
|
186290
186753
|
start: (msg) => spinner.start(msg),
|
|
186291
186754
|
stop: (msg) => spinner.stop(msg),
|
|
@@ -186539,24 +187002,24 @@ async function create(options = {}) {
|
|
|
186539
187002
|
initGit = options.git ?? true;
|
|
186540
187003
|
runInstall = options.install ?? true;
|
|
186541
187004
|
if (!/^[a-z0-9-]+$/.test(projectName)) {
|
|
186542
|
-
|
|
187005
|
+
O.error("Project name must be lowercase alphanumeric with hyphens only");
|
|
186543
187006
|
process.exit(1);
|
|
186544
187007
|
}
|
|
186545
187008
|
if (projectName.startsWith("-") || projectName.endsWith("-")) {
|
|
186546
|
-
|
|
187009
|
+
O.error("Project name cannot start or end with a hyphen");
|
|
186547
187010
|
process.exit(1);
|
|
186548
187011
|
}
|
|
186549
187012
|
if (!/^[a-z0-9-]+$/.test(presentationName)) {
|
|
186550
|
-
|
|
187013
|
+
O.error("Presentation name must be lowercase alphanumeric with hyphens only");
|
|
186551
187014
|
process.exit(1);
|
|
186552
187015
|
}
|
|
186553
187016
|
if (presentationName.startsWith("-") || presentationName.endsWith("-")) {
|
|
186554
|
-
|
|
187017
|
+
O.error("Presentation name cannot start or end with a hyphen");
|
|
186555
187018
|
process.exit(1);
|
|
186556
187019
|
}
|
|
186557
187020
|
} else {
|
|
186558
|
-
|
|
186559
|
-
const projectNameResult = await
|
|
187021
|
+
mt(import_picocolors.default.cyan("Create a new Supaslidev workspace"));
|
|
187022
|
+
const projectNameResult = await Ot({
|
|
186560
187023
|
message: "What is your project name?",
|
|
186561
187024
|
placeholder: "my-presentations",
|
|
186562
187025
|
validate: (value) => {
|
|
@@ -186565,12 +187028,12 @@ async function create(options = {}) {
|
|
|
186565
187028
|
if (value.startsWith("-") || value.endsWith("-")) return "Project name cannot start or end with a hyphen";
|
|
186566
187029
|
}
|
|
186567
187030
|
});
|
|
186568
|
-
if (
|
|
186569
|
-
|
|
187031
|
+
if (q(projectNameResult)) {
|
|
187032
|
+
pt("Operation cancelled");
|
|
186570
187033
|
process.exit(0);
|
|
186571
187034
|
}
|
|
186572
187035
|
projectName = projectNameResult;
|
|
186573
|
-
const presentationNameResult = await
|
|
187036
|
+
const presentationNameResult = await Ot({
|
|
186574
187037
|
message: "What is the name of your first presentation?",
|
|
186575
187038
|
placeholder: "my-first-deck",
|
|
186576
187039
|
initialValue: "my-first-deck",
|
|
@@ -186580,33 +187043,33 @@ async function create(options = {}) {
|
|
|
186580
187043
|
if (value.startsWith("-") || value.endsWith("-")) return "Presentation name cannot start or end with a hyphen";
|
|
186581
187044
|
}
|
|
186582
187045
|
});
|
|
186583
|
-
if (
|
|
186584
|
-
|
|
187046
|
+
if (q(presentationNameResult)) {
|
|
187047
|
+
pt("Operation cancelled");
|
|
186585
187048
|
process.exit(0);
|
|
186586
187049
|
}
|
|
186587
187050
|
presentationName = presentationNameResult;
|
|
186588
|
-
const initGitResult = await
|
|
187051
|
+
const initGitResult = await ot({
|
|
186589
187052
|
message: "Initialize a git repository?",
|
|
186590
187053
|
initialValue: true
|
|
186591
187054
|
});
|
|
186592
|
-
if (
|
|
186593
|
-
|
|
187055
|
+
if (q(initGitResult)) {
|
|
187056
|
+
pt("Operation cancelled");
|
|
186594
187057
|
process.exit(0);
|
|
186595
187058
|
}
|
|
186596
187059
|
initGit = initGitResult;
|
|
186597
|
-
const runInstallResult = await
|
|
187060
|
+
const runInstallResult = await ot({
|
|
186598
187061
|
message: "Run pnpm install after scaffolding?",
|
|
186599
187062
|
initialValue: true
|
|
186600
187063
|
});
|
|
186601
|
-
if (
|
|
186602
|
-
|
|
187064
|
+
if (q(runInstallResult)) {
|
|
187065
|
+
pt("Operation cancelled");
|
|
186603
187066
|
process.exit(0);
|
|
186604
187067
|
}
|
|
186605
187068
|
runInstall = runInstallResult;
|
|
186606
187069
|
}
|
|
186607
187070
|
const targetDir = join(process.cwd(), projectName);
|
|
186608
187071
|
if (existsSync(targetDir)) {
|
|
186609
|
-
|
|
187072
|
+
O.error(`Directory "${projectName}" already exists`);
|
|
186610
187073
|
process.exit(1);
|
|
186611
187074
|
}
|
|
186612
187075
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -186635,7 +187098,7 @@ async function create(options = {}) {
|
|
|
186635
187098
|
spinner.stop("Git repository initialized");
|
|
186636
187099
|
} catch {
|
|
186637
187100
|
spinner.stop("Failed to initialize git repository");
|
|
186638
|
-
|
|
187101
|
+
O.warn("Git initialization failed. You can run \"git init\" manually.");
|
|
186639
187102
|
}
|
|
186640
187103
|
}
|
|
186641
187104
|
if (runInstall) {
|
|
@@ -186645,11 +187108,11 @@ async function create(options = {}) {
|
|
|
186645
187108
|
spinner.stop("Dependencies installed");
|
|
186646
187109
|
} catch {
|
|
186647
187110
|
spinner.stop("Failed to install dependencies");
|
|
186648
|
-
|
|
187111
|
+
O.warn("Dependency installation failed. You can run \"pnpm install\" manually.");
|
|
186649
187112
|
}
|
|
186650
187113
|
}
|
|
186651
187114
|
createdPaths.length = 0;
|
|
186652
|
-
|
|
187115
|
+
gt(import_picocolors.default.green("Workspace created successfully!"));
|
|
186653
187116
|
console.log("");
|
|
186654
187117
|
console.log(import_picocolors.default.cyan("Next steps:"));
|
|
186655
187118
|
console.log(` ${import_picocolors.default.dim("$")} cd ${projectName}`);
|
|
@@ -186659,12 +187122,12 @@ async function create(options = {}) {
|
|
|
186659
187122
|
} catch (error) {
|
|
186660
187123
|
spinner.stop("Failed");
|
|
186661
187124
|
if (createdPaths.length > 0) {
|
|
186662
|
-
|
|
187125
|
+
O.warn("Cleaning up partial files...");
|
|
186663
187126
|
cleanup();
|
|
186664
|
-
|
|
187127
|
+
O.info("Cleanup complete");
|
|
186665
187128
|
}
|
|
186666
187129
|
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
186667
|
-
|
|
187130
|
+
O.error(message);
|
|
186668
187131
|
process.exit(1);
|
|
186669
187132
|
}
|
|
186670
187133
|
}
|
|
@@ -187192,9 +187655,9 @@ async function loadInteractiveMigration(id) {
|
|
|
187192
187655
|
};
|
|
187193
187656
|
}
|
|
187194
187657
|
async function promptForCatalogSelection(presentations) {
|
|
187195
|
-
|
|
187196
|
-
|
|
187197
|
-
const selected = await
|
|
187658
|
+
mt(import_picocolors.default.cyan("Catalog Conversion Selection"));
|
|
187659
|
+
wt(`${import_picocolors.default.bold("Select presentations to convert to catalog: references")}\n\nSelected presentations will use ${import_picocolors.default.green("catalog:")} (managed versions)\nUnselected presentations will use ${import_picocolors.default.yellow("^52.11.3")} (pinned version)\n\n${import_picocolors.default.dim("Controls:")} ${import_picocolors.default.bold("Space")} ${import_picocolors.default.dim("toggle |")} ${import_picocolors.default.bold("a")} ${import_picocolors.default.dim("toggle all |")} ${import_picocolors.default.bold("Enter")} ${import_picocolors.default.dim("confirm")}`, "Migration Options");
|
|
187660
|
+
const selected = await yt({
|
|
187198
187661
|
message: "Which presentations should use catalog: references?",
|
|
187199
187662
|
options: presentations.map((pres) => ({
|
|
187200
187663
|
value: pres.name,
|
|
@@ -187204,8 +187667,8 @@ async function promptForCatalogSelection(presentations) {
|
|
|
187204
187667
|
initialValues: presentations.map((p) => p.name),
|
|
187205
187668
|
required: false
|
|
187206
187669
|
});
|
|
187207
|
-
if (
|
|
187208
|
-
|
|
187670
|
+
if (q(selected)) {
|
|
187671
|
+
pt("Migration cancelled");
|
|
187209
187672
|
return {
|
|
187210
187673
|
selectedForCatalog: [],
|
|
187211
187674
|
cancelled: true
|
|
@@ -187213,8 +187676,8 @@ async function promptForCatalogSelection(presentations) {
|
|
|
187213
187676
|
}
|
|
187214
187677
|
const selectedCount = selected.length;
|
|
187215
187678
|
const pinnedCount = presentations.length - selectedCount;
|
|
187216
|
-
if (selectedCount > 0)
|
|
187217
|
-
if (pinnedCount > 0)
|
|
187679
|
+
if (selectedCount > 0) O.success(`${selectedCount} presentation(s) will use catalog: references`);
|
|
187680
|
+
if (pinnedCount > 0) O.info(`${pinnedCount} presentation(s) will use pinned ^52.11.3`);
|
|
187218
187681
|
return {
|
|
187219
187682
|
selectedForCatalog: selected,
|
|
187220
187683
|
cancelled: false
|
|
@@ -187505,6 +187968,17 @@ async function importPresentation(source, options = {}) {
|
|
|
187505
187968
|
console.log(`Run "supaslidev present ${presentationName}" to start a dev server.`);
|
|
187506
187969
|
}
|
|
187507
187970
|
//#endregion
|
|
187971
|
+
//#region src/shared/optimize-thumbnail.ts
|
|
187972
|
+
const THUMBNAIL_WIDTH = 1280;
|
|
187973
|
+
const WEBP_QUALITY = 80;
|
|
187974
|
+
async function optimizeThumbnail(pngPath) {
|
|
187975
|
+
if (!existsSync(pngPath)) throw new Error(`Thumbnail not found: ${pngPath}`);
|
|
187976
|
+
const webpPath = pngPath.replace(/\.png$/, ".webp");
|
|
187977
|
+
await sharp(pngPath).resize(THUMBNAIL_WIDTH, void 0, { withoutEnlargement: true }).webp({ quality: WEBP_QUALITY }).toFile(webpPath);
|
|
187978
|
+
unlinkSync(pngPath);
|
|
187979
|
+
return webpPath;
|
|
187980
|
+
}
|
|
187981
|
+
//#endregion
|
|
187508
187982
|
//#region src/cli/commands/deploy.ts
|
|
187509
187983
|
function findSupaslidevPackageRoot() {
|
|
187510
187984
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -187604,7 +188078,9 @@ async function deploy(options = {}) {
|
|
|
187604
188078
|
console.log(` Base: ${basePath}`);
|
|
187605
188079
|
console.log(` Presentations: ${presentations.join(", ")}`);
|
|
187606
188080
|
console.log("");
|
|
187607
|
-
|
|
188081
|
+
const totalSteps = 5;
|
|
188082
|
+
const thumbnailsDir = join(projectRoot, "thumbnails");
|
|
188083
|
+
console.log(`Step 1/${totalSteps}: Building ${presentations.length} presentation(s)...\n`);
|
|
187608
188084
|
for (const id of presentations) {
|
|
187609
188085
|
const presentationDir = join(presentationsDir, id);
|
|
187610
188086
|
const presentationBase = `${basePath}presentations/${id}/`;
|
|
@@ -187617,9 +188093,37 @@ async function deploy(options = {}) {
|
|
|
187617
188093
|
], { cwd: presentationDir });
|
|
187618
188094
|
console.log(` Done: ${id}\n`);
|
|
187619
188095
|
}
|
|
187620
|
-
console.log(
|
|
187621
|
-
|
|
187622
|
-
|
|
188096
|
+
console.log(`Step 2/${totalSteps}: Generating thumbnails...\n`);
|
|
188097
|
+
if (!existsSync(thumbnailsDir)) mkdirSync(thumbnailsDir, { recursive: true });
|
|
188098
|
+
for (const id of presentations) {
|
|
188099
|
+
const presentationDir = join(presentationsDir, id);
|
|
188100
|
+
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188101
|
+
const outputBase = join(thumbnailsDir, id);
|
|
188102
|
+
const targetFile = join(thumbnailsDir, `${id}.png`);
|
|
188103
|
+
console.log(` Thumbnail: ${id}`);
|
|
188104
|
+
try {
|
|
188105
|
+
await runCommand(slidevBin, [
|
|
188106
|
+
"export",
|
|
188107
|
+
"--format",
|
|
188108
|
+
"png",
|
|
188109
|
+
"--range",
|
|
188110
|
+
"1",
|
|
188111
|
+
"--output",
|
|
188112
|
+
outputBase
|
|
188113
|
+
], { cwd: presentationDir });
|
|
188114
|
+
if (!existsSync(targetFile) && existsSync(outputBase)) {
|
|
188115
|
+
const pngs = readdirSync(outputBase).filter((f) => f.endsWith(".png")).sort();
|
|
188116
|
+
if (pngs.length > 0) renameSync(join(outputBase, pngs[0]), targetFile);
|
|
188117
|
+
}
|
|
188118
|
+
if (existsSync(targetFile)) {
|
|
188119
|
+
await optimizeThumbnail(targetFile);
|
|
188120
|
+
console.log(` Done: ${id}\n`);
|
|
188121
|
+
} else console.warn(` Warning: Thumbnail for "${id}" could not be found after export.\n`);
|
|
188122
|
+
} catch {
|
|
188123
|
+
console.warn(` Warning: Thumbnail generation failed for "${id}", skipping.\n`);
|
|
188124
|
+
}
|
|
188125
|
+
}
|
|
188126
|
+
console.log(`Step 3/${totalSteps}: Building dashboard...\n`);
|
|
187623
188127
|
const nuxt = findNuxtBin(projectRoot, supaslidevRoot);
|
|
187624
188128
|
const nuxtEnv = {
|
|
187625
188129
|
...process.env,
|
|
@@ -187633,7 +188137,12 @@ async function deploy(options = {}) {
|
|
|
187633
188137
|
cwd: supaslidevRoot,
|
|
187634
188138
|
env: nuxtEnv
|
|
187635
188139
|
});
|
|
187636
|
-
console.log(
|
|
188140
|
+
console.log(`\nStep 4/${totalSteps}: Generating presentations.json...\n`);
|
|
188141
|
+
regeneratePresentationsJson(presentationsDir, presentationsJsonPath, {
|
|
188142
|
+
thumbnailsDir,
|
|
188143
|
+
basePath
|
|
188144
|
+
});
|
|
188145
|
+
console.log(`\nStep 5/${totalSteps}: Assembling deploy output...\n`);
|
|
187637
188146
|
if (existsSync(outputDir)) rmSync(outputDir, { recursive: true });
|
|
187638
188147
|
mkdirSync(outputDir, { recursive: true });
|
|
187639
188148
|
const nuxtOutputDir = join(supaslidevRoot, ".output", "public");
|
|
@@ -187647,6 +188156,16 @@ async function deploy(options = {}) {
|
|
|
187647
188156
|
if (existsSync(distDir)) cpSync(distDir, destDir, { recursive: true });
|
|
187648
188157
|
else console.warn(` Warning: No dist/ found for presentation "${id}", skipping.`);
|
|
187649
188158
|
}
|
|
188159
|
+
if (existsSync(thumbnailsDir)) {
|
|
188160
|
+
const thumbnailsOutputDir = join(outputDir, "thumbnails");
|
|
188161
|
+
mkdirSync(thumbnailsOutputDir, { recursive: true });
|
|
188162
|
+
for (const id of presentations) {
|
|
188163
|
+
const webpFile = join(thumbnailsDir, `${id}.webp`);
|
|
188164
|
+
const pngFile = join(thumbnailsDir, `${id}.png`);
|
|
188165
|
+
if (existsSync(webpFile)) cpSync(webpFile, join(thumbnailsOutputDir, `${id}.webp`));
|
|
188166
|
+
else if (existsSync(pngFile)) cpSync(pngFile, join(thumbnailsOutputDir, `${id}.png`));
|
|
188167
|
+
}
|
|
188168
|
+
}
|
|
187650
188169
|
if (existsSync(presentationsJsonPath)) cpSync(presentationsJsonPath, join(outputDir, "presentations.json"));
|
|
187651
188170
|
writeFileSync(join(outputDir, "vercel.json"), createVercelConfig(basePath, presentations));
|
|
187652
188171
|
writeFileSync(join(outputDir, "netlify.toml"), createNetlifyConfig(basePath, presentations));
|
|
@@ -187665,6 +188184,69 @@ async function deploy(options = {}) {
|
|
|
187665
188184
|
console.log("");
|
|
187666
188185
|
}
|
|
187667
188186
|
//#endregion
|
|
188187
|
+
//#region src/cli/commands/thumbnail.ts
|
|
188188
|
+
async function thumbnail(name, options = {}) {
|
|
188189
|
+
const projectRoot = findProjectRoot();
|
|
188190
|
+
if (!projectRoot) {
|
|
188191
|
+
console.error("Error: Could not find a Supaslidev project.");
|
|
188192
|
+
console.error("Make sure you are in a directory with a \"presentations\" folder.");
|
|
188193
|
+
process.exit(1);
|
|
188194
|
+
}
|
|
188195
|
+
const presentationsDir = join(projectRoot, "presentations");
|
|
188196
|
+
const thumbnailsDir = join(projectRoot, "thumbnails");
|
|
188197
|
+
const presentations = getPresentations$1(presentationsDir);
|
|
188198
|
+
if (!presentations.includes(name)) {
|
|
188199
|
+
console.error(`Error: Presentation "${name}" not found`);
|
|
188200
|
+
printAvailablePresentations(presentations);
|
|
188201
|
+
process.exit(1);
|
|
188202
|
+
}
|
|
188203
|
+
const presentationDir = join(presentationsDir, name);
|
|
188204
|
+
const outputPath = options.output ?? join(thumbnailsDir, name);
|
|
188205
|
+
if (!existsSync(dirname(outputPath))) mkdirSync(dirname(outputPath), { recursive: true });
|
|
188206
|
+
console.log("\n" + "=".repeat(50));
|
|
188207
|
+
console.log(` Generating thumbnail: ${name}`);
|
|
188208
|
+
console.log("=".repeat(50) + "\n");
|
|
188209
|
+
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188210
|
+
await new Promise((resolve) => {
|
|
188211
|
+
const slidev = spawn(slidevBin, [
|
|
188212
|
+
"export",
|
|
188213
|
+
"--format",
|
|
188214
|
+
"png",
|
|
188215
|
+
"--range",
|
|
188216
|
+
"1",
|
|
188217
|
+
"--output",
|
|
188218
|
+
outputPath
|
|
188219
|
+
], {
|
|
188220
|
+
cwd: presentationDir,
|
|
188221
|
+
stdio: "inherit"
|
|
188222
|
+
});
|
|
188223
|
+
slidev.on("error", (err) => {
|
|
188224
|
+
console.error(`Failed to generate thumbnail: ${err.message}`);
|
|
188225
|
+
process.exit(1);
|
|
188226
|
+
});
|
|
188227
|
+
slidev.on("close", (code) => {
|
|
188228
|
+
if (code !== 0) {
|
|
188229
|
+
console.error(`\nThumbnail generation failed with exit code ${code}`);
|
|
188230
|
+
process.exit(code ?? 1);
|
|
188231
|
+
}
|
|
188232
|
+
const targetFile = `${outputPath}.png`;
|
|
188233
|
+
if (!existsSync(targetFile) && existsSync(outputPath)) {
|
|
188234
|
+
const pngs = readdirSync(outputPath).filter((f) => f.endsWith(".png")).sort();
|
|
188235
|
+
if (pngs.length > 0) renameSync(join(outputPath, pngs[0]), targetFile);
|
|
188236
|
+
}
|
|
188237
|
+
resolve();
|
|
188238
|
+
});
|
|
188239
|
+
});
|
|
188240
|
+
const pngFile = `${outputPath}.png`;
|
|
188241
|
+
if (existsSync(pngFile)) {
|
|
188242
|
+
const webpFile = await optimizeThumbnail(pngFile);
|
|
188243
|
+
console.log("\n" + "=".repeat(50));
|
|
188244
|
+
console.log(` Thumbnail generated!`);
|
|
188245
|
+
console.log(` Output: ${webpFile}`);
|
|
188246
|
+
console.log("=".repeat(50) + "\n");
|
|
188247
|
+
}
|
|
188248
|
+
}
|
|
188249
|
+
//#endregion
|
|
187668
188250
|
//#region src/cli/index.ts
|
|
187669
188251
|
const program = new Command();
|
|
187670
188252
|
program.name("supaslidev").description("Supaslidev presentation management CLI").version("0.1.0");
|
|
@@ -187686,6 +188268,9 @@ program.command("import").description("Import existing Sli.dev presentation(s)")
|
|
|
187686
188268
|
install: options.install ?? true
|
|
187687
188269
|
});
|
|
187688
188270
|
});
|
|
188271
|
+
program.command("thumbnail").description("Generate a PNG thumbnail of the first slide").argument("<name>", "Name of the presentation").option("-o, --output <path>", "Output path for the thumbnail (without extension)").action(async (name, options) => {
|
|
188272
|
+
await thumbnail(name, options);
|
|
188273
|
+
});
|
|
187689
188274
|
program.command("deploy").description("Build all presentations into a static deployable site").option("-o, --output <dir>", "Output directory for the deploy package").option("--base <path>", "Base path for the deployed site (default: /)").action(async (options) => {
|
|
187690
188275
|
try {
|
|
187691
188276
|
await deploy(options);
|