supaslidev 0.3.6 → 0.4.1
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 +1585 -997
- package/dist/index.d.ts +1 -0
- package/package.json +13 -12
- 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;
|
|
@@ -19,7 +20,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
19
20
|
var __getProtoOf = Object.getPrototypeOf;
|
|
20
21
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21
22
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
22
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
23
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
23
24
|
var __copyProps = (to, from, except, desc) => {
|
|
24
25
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
26
|
key = keys[i];
|
|
@@ -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
|
|
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;
|
|
552
881
|
}
|
|
553
|
-
const
|
|
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
|
-
`);
|
|
702
|
-
}
|
|
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,132 @@ 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 e = this.
|
|
966
|
-
this.value =
|
|
1167
|
+
const t = this._enabledOptions, e = this.value !== void 0 && this.value.length === t.length;
|
|
1168
|
+
this.value = e ? [] : t.map((s) => s.value);
|
|
967
1169
|
}
|
|
968
1170
|
toggleInvert() {
|
|
969
|
-
const
|
|
970
|
-
if (!
|
|
971
|
-
|
|
1171
|
+
const t = this.value;
|
|
1172
|
+
if (!t) return;
|
|
1173
|
+
const e = this._enabledOptions.filter((s) => !t.includes(s.value));
|
|
1174
|
+
this.value = e.map((s) => s.value);
|
|
972
1175
|
}
|
|
973
1176
|
toggleValue() {
|
|
974
1177
|
this.value === void 0 && (this.value = []);
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1178
|
+
const t = this.value.includes(this._value);
|
|
1179
|
+
this.value = t ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
1180
|
+
}
|
|
1181
|
+
constructor(t) {
|
|
1182
|
+
super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
|
|
1183
|
+
const e = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), 0);
|
|
1184
|
+
this.cursor = this.options[e].disabled ? d$1(e, 1, this.options) : e, this.on("key", (s) => {
|
|
1185
|
+
s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
|
|
1186
|
+
}), this.on("cursor", (s) => {
|
|
1187
|
+
switch (s) {
|
|
984
1188
|
case "left":
|
|
985
1189
|
case "up":
|
|
986
|
-
this.cursor =
|
|
1190
|
+
this.cursor = d$1(this.cursor, -1, this.options);
|
|
987
1191
|
break;
|
|
988
1192
|
case "down":
|
|
989
1193
|
case "right":
|
|
990
|
-
this.cursor =
|
|
1194
|
+
this.cursor = d$1(this.cursor, 1, this.options);
|
|
991
1195
|
break;
|
|
992
1196
|
case "space":
|
|
993
1197
|
this.toggleValue();
|
|
@@ -996,342 +1200,192 @@ let Lt$1 = class extends B {
|
|
|
996
1200
|
});
|
|
997
1201
|
}
|
|
998
1202
|
};
|
|
999
|
-
var $
|
|
1203
|
+
var at$1 = class extends p {
|
|
1000
1204
|
get userInputWithCursor() {
|
|
1001
1205
|
if (this.state === "submit") return this.userInput;
|
|
1002
|
-
const
|
|
1003
|
-
if (this.cursor >=
|
|
1004
|
-
const
|
|
1005
|
-
return `${
|
|
1206
|
+
const t = this.userInput;
|
|
1207
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
1208
|
+
const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
|
|
1209
|
+
return `${e}${styleText("inverse", s)}${i.join("")}`;
|
|
1006
1210
|
}
|
|
1007
1211
|
get cursor() {
|
|
1008
1212
|
return this._cursor;
|
|
1009
1213
|
}
|
|
1010
|
-
constructor(
|
|
1214
|
+
constructor(t) {
|
|
1011
1215
|
super({
|
|
1012
|
-
...
|
|
1013
|
-
initialUserInput:
|
|
1014
|
-
}), this.on("userInput", (
|
|
1015
|
-
this._setValue(
|
|
1216
|
+
...t,
|
|
1217
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
1218
|
+
}), this.on("userInput", (e) => {
|
|
1219
|
+
this._setValue(e);
|
|
1016
1220
|
}), this.on("finalize", () => {
|
|
1017
|
-
this.value || (this.value =
|
|
1221
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
1018
1222
|
});
|
|
1019
1223
|
}
|
|
1020
1224
|
};
|
|
1021
1225
|
//#endregion
|
|
1022
|
-
//#region ../../node_modules/.pnpm/@clack+prompts@1.
|
|
1023
|
-
function
|
|
1024
|
-
return
|
|
1226
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1227
|
+
function Ze() {
|
|
1228
|
+
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
1229
|
}
|
|
1026
|
-
const ee =
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const z =
|
|
1030
|
-
|
|
1031
|
-
const se =
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1230
|
+
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("└", "—");
|
|
1231
|
+
w("┐", "T");
|
|
1232
|
+
w("┘", "—");
|
|
1233
|
+
const z = w("●", ">"), H = w("○", " "), te = w("◻", "[•]"), U = w("◼", "[+]"), J = w("◻", "[ ]");
|
|
1234
|
+
w("▪", "•");
|
|
1235
|
+
const se = w("─", "-"), ce = w("╮", "+"), Ge = w("├", "+"), $e = w("╯", "+"), de = w("╰", "+");
|
|
1236
|
+
w("╭", "+");
|
|
1237
|
+
const he = w("●", "•"), pe = w("◆", "*"), me = w("▲", "!"), ge = w("■", "x"), V = (e) => {
|
|
1034
1238
|
switch (e) {
|
|
1035
1239
|
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",
|
|
1240
|
+
case "active": return styleText("cyan", _e);
|
|
1241
|
+
case "cancel": return styleText("red", oe);
|
|
1242
|
+
case "error": return styleText("yellow", ue);
|
|
1243
|
+
case "submit": return styleText("green", F);
|
|
1040
1244
|
}
|
|
1041
|
-
},
|
|
1245
|
+
}, ye = (e) => {
|
|
1042
1246
|
switch (e) {
|
|
1043
1247
|
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",
|
|
1248
|
+
case "active": return styleText("cyan", d);
|
|
1249
|
+
case "cancel": return styleText("red", d);
|
|
1250
|
+
case "error": return styleText("yellow", d);
|
|
1251
|
+
case "submit": return styleText("green", d);
|
|
1048
1252
|
}
|
|
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;
|
|
1253
|
+
}, et = (e, i, s, r, u) => {
|
|
1254
|
+
let n = i, o = 0;
|
|
1255
|
+
for (let c = s; c < r; c++) {
|
|
1256
|
+
const a = e[c];
|
|
1257
|
+
if (n = n - a.length, o++, n <= u) break;
|
|
1111
1258
|
}
|
|
1112
1259
|
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, {
|
|
1260
|
+
lineCount: n,
|
|
1261
|
+
removals: o
|
|
1262
|
+
};
|
|
1263
|
+
}, Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
1264
|
+
const c = O$1(r) - n, a = A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
|
|
1265
|
+
let p = 0;
|
|
1266
|
+
e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
|
|
1267
|
+
let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
|
|
1268
|
+
const S = Math.min(p + y, i.length), h = [];
|
|
1269
|
+
let f = 0;
|
|
1270
|
+
m && f++, g && f++;
|
|
1271
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
1272
|
+
for (let b = v; b < T; b++) {
|
|
1273
|
+
const x = wrapAnsi(s(i[b], b === e), c, {
|
|
1220
1274
|
hard: !0,
|
|
1221
1275
|
trim: !1
|
|
1222
1276
|
}).split(`
|
|
1223
1277
|
`);
|
|
1224
|
-
|
|
1278
|
+
h.push(x), f += x.length;
|
|
1225
1279
|
}
|
|
1226
|
-
if (
|
|
1227
|
-
let
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1280
|
+
if (f > $) {
|
|
1281
|
+
let b = 0, x = 0, G = f;
|
|
1282
|
+
const M = e - v, R = (j, D) => et(h, G, j, D, $);
|
|
1283
|
+
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
1284
|
}
|
|
1231
1285
|
const C = [];
|
|
1232
|
-
|
|
1233
|
-
for (const
|
|
1234
|
-
return
|
|
1286
|
+
m && C.push(l);
|
|
1287
|
+
for (const b of h) for (const x of b) C.push(x);
|
|
1288
|
+
return g && C.push(l), C;
|
|
1235
1289
|
};
|
|
1236
|
-
const
|
|
1237
|
-
const
|
|
1238
|
-
return new
|
|
1239
|
-
active:
|
|
1290
|
+
const ot = (e) => {
|
|
1291
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1292
|
+
return new Q$1({
|
|
1293
|
+
active: i,
|
|
1240
1294
|
inactive: s,
|
|
1241
1295
|
signal: e.signal,
|
|
1242
1296
|
input: e.input,
|
|
1243
1297
|
output: e.output,
|
|
1244
1298
|
initialValue: e.initialValue ?? !0,
|
|
1245
1299
|
render() {
|
|
1246
|
-
const
|
|
1247
|
-
` : ""}${
|
|
1248
|
-
`,
|
|
1300
|
+
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)}
|
|
1301
|
+
` : ""}${o}
|
|
1302
|
+
`, a = this.value ? i : s;
|
|
1249
1303
|
switch (this.state) {
|
|
1250
|
-
case "submit": return `${
|
|
1251
|
-
case "cancel": return `${
|
|
1252
|
-
${styleText("gray",
|
|
1304
|
+
case "submit": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText("dim", a)}`;
|
|
1305
|
+
case "cancel": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText(["strikethrough", "dim"], a)}${r ? `
|
|
1306
|
+
${styleText("gray", d)}` : ""}`;
|
|
1253
1307
|
default: {
|
|
1254
|
-
const
|
|
1255
|
-
return `${
|
|
1256
|
-
${styleText("cyan",
|
|
1308
|
+
const l = r ? `${styleText("cyan", d)} ` : "", $ = r ? styleText("cyan", E) : "";
|
|
1309
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim", H)} ${styleText("dim", i)}`}${e.vertical ? r ? `
|
|
1310
|
+
${styleText("cyan", d)} ` : `
|
|
1257
1311
|
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
1258
|
-
${
|
|
1312
|
+
${$}
|
|
1259
1313
|
`;
|
|
1260
1314
|
}
|
|
1261
1315
|
}
|
|
1262
1316
|
}
|
|
1263
1317
|
}).prompt();
|
|
1264
|
-
},
|
|
1265
|
-
message: (e = [], { symbol:
|
|
1266
|
-
const
|
|
1267
|
-
for (let
|
|
1268
|
-
const
|
|
1318
|
+
}, O = {
|
|
1319
|
+
message: (e = [], { symbol: i = styleText("gray", d), secondarySymbol: s = styleText("gray", d), output: r = process.stdout, spacing: u$7 = 1, withGuide: n } = {}) => {
|
|
1320
|
+
const o = [], c = n ?? u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
1321
|
+
for (let p = 0; p < u$7; p++) o.push(a);
|
|
1322
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
1269
1323
|
`);
|
|
1270
|
-
if (
|
|
1271
|
-
const [
|
|
1272
|
-
|
|
1273
|
-
for (const
|
|
1324
|
+
if (y.length > 0) {
|
|
1325
|
+
const [p, ...m] = y;
|
|
1326
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
1327
|
+
for (const g of m) g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
1274
1328
|
}
|
|
1275
|
-
|
|
1329
|
+
r.write(`${o.join(`
|
|
1276
1330
|
`)}
|
|
1277
1331
|
`);
|
|
1278
1332
|
},
|
|
1279
|
-
info: (e,
|
|
1280
|
-
|
|
1281
|
-
...
|
|
1282
|
-
symbol: styleText("blue",
|
|
1333
|
+
info: (e, i) => {
|
|
1334
|
+
O.message(e, {
|
|
1335
|
+
...i,
|
|
1336
|
+
symbol: styleText("blue", he)
|
|
1283
1337
|
});
|
|
1284
1338
|
},
|
|
1285
|
-
success: (e,
|
|
1286
|
-
|
|
1287
|
-
...
|
|
1288
|
-
symbol: styleText("green",
|
|
1339
|
+
success: (e, i) => {
|
|
1340
|
+
O.message(e, {
|
|
1341
|
+
...i,
|
|
1342
|
+
symbol: styleText("green", pe)
|
|
1289
1343
|
});
|
|
1290
1344
|
},
|
|
1291
|
-
step: (e,
|
|
1292
|
-
|
|
1293
|
-
...
|
|
1294
|
-
symbol: styleText("green",
|
|
1345
|
+
step: (e, i) => {
|
|
1346
|
+
O.message(e, {
|
|
1347
|
+
...i,
|
|
1348
|
+
symbol: styleText("green", F)
|
|
1295
1349
|
});
|
|
1296
1350
|
},
|
|
1297
|
-
warn: (e,
|
|
1298
|
-
|
|
1299
|
-
...
|
|
1300
|
-
symbol: styleText("yellow",
|
|
1351
|
+
warn: (e, i) => {
|
|
1352
|
+
O.message(e, {
|
|
1353
|
+
...i,
|
|
1354
|
+
symbol: styleText("yellow", me)
|
|
1301
1355
|
});
|
|
1302
1356
|
},
|
|
1303
|
-
warning: (e,
|
|
1304
|
-
|
|
1357
|
+
warning: (e, i) => {
|
|
1358
|
+
O.warn(e, i);
|
|
1305
1359
|
},
|
|
1306
|
-
error: (e,
|
|
1307
|
-
|
|
1308
|
-
...
|
|
1309
|
-
symbol: styleText("red",
|
|
1360
|
+
error: (e, i) => {
|
|
1361
|
+
O.message(e, {
|
|
1362
|
+
...i,
|
|
1363
|
+
symbol: styleText("red", ge)
|
|
1310
1364
|
});
|
|
1311
1365
|
}
|
|
1312
|
-
},
|
|
1313
|
-
const s =
|
|
1314
|
-
s.write(`${
|
|
1366
|
+
}, pt = (e = "", i) => {
|
|
1367
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", E)} ` : "";
|
|
1368
|
+
s.write(`${r}${styleText("red", e)}
|
|
1315
1369
|
|
|
1316
1370
|
`);
|
|
1317
|
-
},
|
|
1318
|
-
const s =
|
|
1319
|
-
s.write(`${
|
|
1371
|
+
}, mt = (e = "", i) => {
|
|
1372
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", le)} ` : "";
|
|
1373
|
+
s.write(`${r}${e}
|
|
1320
1374
|
`);
|
|
1321
|
-
},
|
|
1322
|
-
const s =
|
|
1323
|
-
${styleText("gray",
|
|
1324
|
-
s.write(`${
|
|
1375
|
+
}, gt = (e = "", i) => {
|
|
1376
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", d)}
|
|
1377
|
+
${styleText("gray", E)} ` : "";
|
|
1378
|
+
s.write(`${r}${e}
|
|
1325
1379
|
|
|
1326
1380
|
`);
|
|
1327
|
-
}, Q = (e,
|
|
1328
|
-
`).map((s) =>
|
|
1329
|
-
`),
|
|
1330
|
-
const
|
|
1331
|
-
const
|
|
1332
|
-
return
|
|
1381
|
+
}, Q = (e, i) => e.split(`
|
|
1382
|
+
`).map((s) => i(s)).join(`
|
|
1383
|
+
`), yt = (e) => {
|
|
1384
|
+
const i = (r, u) => {
|
|
1385
|
+
const n = r.label ?? String(r.value);
|
|
1386
|
+
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
1387
|
}, s = e.required ?? !0;
|
|
1334
|
-
return new
|
|
1388
|
+
return new it$1({
|
|
1335
1389
|
options: e.options,
|
|
1336
1390
|
signal: e.signal,
|
|
1337
1391
|
input: e.input,
|
|
@@ -1339,8 +1393,8 @@ ${styleText("gray", x)} ` : "";
|
|
|
1339
1393
|
initialValues: e.initialValues,
|
|
1340
1394
|
required: s,
|
|
1341
1395
|
cursorAt: e.cursorAt,
|
|
1342
|
-
validate(
|
|
1343
|
-
if (s && (
|
|
1396
|
+
validate(r) {
|
|
1397
|
+
if (s && (r === void 0 || r.length === 0)) return `Please select at least one option.
|
|
1344
1398
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1345
1399
|
"gray",
|
|
1346
1400
|
"bgWhite",
|
|
@@ -1348,86 +1402,86 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
1348
1402
|
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1349
1403
|
},
|
|
1350
1404
|
render() {
|
|
1351
|
-
const
|
|
1352
|
-
${
|
|
1353
|
-
`, o = this.value ?? [],
|
|
1354
|
-
if (
|
|
1355
|
-
const
|
|
1356
|
-
return
|
|
1405
|
+
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)}
|
|
1406
|
+
` : ""}${u$8}
|
|
1407
|
+
`, o = this.value ?? [], c = (a, l) => {
|
|
1408
|
+
if (a.disabled) return i(a, "disabled");
|
|
1409
|
+
const $ = o.includes(a.value);
|
|
1410
|
+
return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
|
|
1357
1411
|
};
|
|
1358
1412
|
switch (this.state) {
|
|
1359
1413
|
case "submit": {
|
|
1360
|
-
const
|
|
1361
|
-
return `${
|
|
1414
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
|
|
1415
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}`;
|
|
1362
1416
|
}
|
|
1363
1417
|
case "cancel": {
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
-
return `${
|
|
1367
|
-
${styleText("gray",
|
|
1418
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "cancelled")).join(styleText("dim", ", "));
|
|
1419
|
+
if (a.trim() === "") return `${n}${styleText("gray", d)}`;
|
|
1420
|
+
return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}${r ? `
|
|
1421
|
+
${styleText("gray", d)}` : ""}`;
|
|
1368
1422
|
}
|
|
1369
1423
|
case "error": {
|
|
1370
|
-
const
|
|
1371
|
-
`).map((
|
|
1372
|
-
`),
|
|
1373
|
-
`).length,
|
|
1424
|
+
const a = r ? `${styleText("yellow", d)} ` : "", l = this.error.split(`
|
|
1425
|
+
`).map((p, m) => m === 0 ? `${r ? `${styleText("yellow", E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
|
|
1426
|
+
`), $ = n.split(`
|
|
1427
|
+
`).length, y = l.split(`
|
|
1374
1428
|
`).length + 1;
|
|
1375
|
-
return `${
|
|
1429
|
+
return `${n}${a}${Y({
|
|
1376
1430
|
output: e.output,
|
|
1377
1431
|
options: this.options,
|
|
1378
1432
|
cursor: this.cursor,
|
|
1379
1433
|
maxItems: e.maxItems,
|
|
1380
|
-
columnPadding:
|
|
1381
|
-
rowPadding:
|
|
1382
|
-
style:
|
|
1434
|
+
columnPadding: a.length,
|
|
1435
|
+
rowPadding: $ + y,
|
|
1436
|
+
style: c
|
|
1383
1437
|
}).join(`
|
|
1384
|
-
${
|
|
1385
|
-
${
|
|
1438
|
+
${a}`)}
|
|
1439
|
+
${l}
|
|
1386
1440
|
`;
|
|
1387
1441
|
}
|
|
1388
1442
|
default: {
|
|
1389
|
-
const
|
|
1390
|
-
`).length;
|
|
1391
|
-
return `${
|
|
1443
|
+
const a = r ? `${styleText("cyan", d)} ` : "", l = n.split(`
|
|
1444
|
+
`).length, $ = r ? 2 : 1;
|
|
1445
|
+
return `${n}${a}${Y({
|
|
1392
1446
|
output: e.output,
|
|
1393
1447
|
options: this.options,
|
|
1394
1448
|
cursor: this.cursor,
|
|
1395
1449
|
maxItems: e.maxItems,
|
|
1396
|
-
columnPadding:
|
|
1397
|
-
rowPadding:
|
|
1398
|
-
style:
|
|
1450
|
+
columnPadding: a.length,
|
|
1451
|
+
rowPadding: l + $,
|
|
1452
|
+
style: c
|
|
1399
1453
|
}).join(`
|
|
1400
|
-
${
|
|
1401
|
-
${styleText("cyan",
|
|
1454
|
+
${a}`)}
|
|
1455
|
+
${r ? styleText("cyan", E) : ""}
|
|
1402
1456
|
`;
|
|
1403
1457
|
}
|
|
1404
1458
|
}
|
|
1405
1459
|
}
|
|
1406
1460
|
}).prompt();
|
|
1407
|
-
},
|
|
1408
|
-
const
|
|
1461
|
+
}, ft = (e) => styleText("dim", e), vt = (e, i, s) => {
|
|
1462
|
+
const r = {
|
|
1409
1463
|
hard: !0,
|
|
1410
1464
|
trim: !1
|
|
1411
|
-
},
|
|
1412
|
-
`),
|
|
1413
|
-
return
|
|
1414
|
-
},
|
|
1415
|
-
const
|
|
1465
|
+
}, u = wrapAnsi(e, i, r).split(`
|
|
1466
|
+
`), n = u.reduce((a, l) => Math.max(fastStringWidth(l), a), 0);
|
|
1467
|
+
return wrapAnsi(e, i - (u.map(s).reduce((a, l) => Math.max(fastStringWidth(l), a), 0) - n), r);
|
|
1468
|
+
}, wt = (e = "", i = "", s) => {
|
|
1469
|
+
const r = s?.output ?? P.stdout, u$9 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = [
|
|
1416
1470
|
"",
|
|
1417
|
-
...
|
|
1418
|
-
`).map(
|
|
1471
|
+
...vt(e, O$1(r) - 6, n).split(`
|
|
1472
|
+
`).map(n),
|
|
1419
1473
|
""
|
|
1420
|
-
],
|
|
1421
|
-
const
|
|
1422
|
-
return
|
|
1423
|
-
}, 0),
|
|
1424
|
-
`),
|
|
1425
|
-
` : "",
|
|
1426
|
-
|
|
1427
|
-
${
|
|
1428
|
-
${styleText("gray",
|
|
1474
|
+
], c = fastStringWidth(i), a = Math.max(o.reduce((p, m) => {
|
|
1475
|
+
const g = fastStringWidth(m);
|
|
1476
|
+
return g > p ? g : p;
|
|
1477
|
+
}, 0), c) + 2, l = o.map((p) => `${styleText("gray", d)} ${p}${" ".repeat(a - fastStringWidth(p))}${styleText("gray", d)}`).join(`
|
|
1478
|
+
`), $ = u$9 ? `${styleText("gray", d)}
|
|
1479
|
+
` : "", y = u$9 ? Ge : de;
|
|
1480
|
+
r.write(`${$}${styleText("green", F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
|
|
1481
|
+
${l}
|
|
1482
|
+
${styleText("gray", y + se.repeat(a + 2) + $e)}
|
|
1429
1483
|
`);
|
|
1430
|
-
},
|
|
1484
|
+
}, Ct = (e) => styleText("magenta", e), fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u$11, frames: n = ee ? [
|
|
1431
1485
|
"◒",
|
|
1432
1486
|
"◐",
|
|
1433
1487
|
"◓",
|
|
@@ -1437,97 +1491,97 @@ ${styleText("gray", f + se.repeat(n + 2) + me)}
|
|
|
1437
1491
|
"o",
|
|
1438
1492
|
"O",
|
|
1439
1493
|
"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
|
-
|
|
1494
|
+
], delay: o = ee ? 80 : 120, signal: c, ...a } = {}) => {
|
|
1495
|
+
const l = ae();
|
|
1496
|
+
let $, y, p = !1, m = !1, g = "", S, h = performance.now();
|
|
1497
|
+
const f = O$1(s), v = a?.styleFrame ?? Ct, T = (_) => {
|
|
1498
|
+
const A = _ > 1 ? u$11 ?? u.messages.error : r ?? u.messages.cancel;
|
|
1499
|
+
m = _ === 1, p && (W(A, _), m && typeof i == "function" && i());
|
|
1500
|
+
}, C = () => T(2), b = () => T(1), x = () => {
|
|
1501
|
+
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);
|
|
1502
|
+
}, G = () => {
|
|
1503
|
+
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);
|
|
1504
|
+
}, M = () => {
|
|
1505
|
+
if (S === void 0) return;
|
|
1506
|
+
l && s.write(`
|
|
1453
1507
|
`);
|
|
1454
|
-
const
|
|
1508
|
+
const _ = wrapAnsi(S, f, {
|
|
1455
1509
|
hard: !0,
|
|
1456
1510
|
trim: !1
|
|
1457
1511
|
}).split(`
|
|
1458
1512
|
`);
|
|
1459
|
-
|
|
1460
|
-
},
|
|
1461
|
-
const
|
|
1462
|
-
return
|
|
1463
|
-
},
|
|
1464
|
-
|
|
1513
|
+
_.length > 1 && s.write(import_src.cursor.up(_.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1514
|
+
}, R = (_) => _.replace(/\.+$/, ""), j = (_) => {
|
|
1515
|
+
const A = (performance.now() - _) / 1e3, k = Math.floor(A / 60), L = Math.floor(A % 60);
|
|
1516
|
+
return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
|
|
1517
|
+
}, D = a.withGuide ?? u.withGuide, ie = (_ = "") => {
|
|
1518
|
+
p = !0, $ = z$1({ output: s }), g = R(_), h = performance.now(), D && s.write(`${styleText("gray", d)}
|
|
1465
1519
|
`);
|
|
1466
|
-
let
|
|
1467
|
-
|
|
1468
|
-
if (
|
|
1469
|
-
|
|
1470
|
-
const L =
|
|
1520
|
+
let A = 0, k = 0;
|
|
1521
|
+
x(), y = setInterval(() => {
|
|
1522
|
+
if (l && g === S) return;
|
|
1523
|
+
M(), S = g;
|
|
1524
|
+
const L = v(n[A]);
|
|
1471
1525
|
let Z;
|
|
1472
|
-
if (
|
|
1473
|
-
else if (e === "timer") Z = `${L} ${
|
|
1526
|
+
if (l) Z = `${L} ${g}...`;
|
|
1527
|
+
else if (e === "timer") Z = `${L} ${g} ${j(h)}`;
|
|
1474
1528
|
else {
|
|
1475
|
-
const
|
|
1476
|
-
Z = `${L} ${
|
|
1529
|
+
const Be = ".".repeat(Math.floor(k)).slice(0, 3);
|
|
1530
|
+
Z = `${L} ${g}${Be}`;
|
|
1477
1531
|
}
|
|
1478
|
-
const
|
|
1532
|
+
const Ne = wrapAnsi(Z, f, {
|
|
1479
1533
|
hard: !0,
|
|
1480
1534
|
trim: !1
|
|
1481
1535
|
});
|
|
1482
|
-
s.write(
|
|
1483
|
-
},
|
|
1484
|
-
},
|
|
1485
|
-
if (!
|
|
1486
|
-
|
|
1487
|
-
const L =
|
|
1488
|
-
|
|
1489
|
-
`) : s.write(`${L} ${
|
|
1490
|
-
`)),
|
|
1536
|
+
s.write(Ne), A = A + 1 < n.length ? A + 1 : 0, k = k < 4 ? k + .125 : 0;
|
|
1537
|
+
}, o);
|
|
1538
|
+
}, W = (_ = "", A = 0, k = !1) => {
|
|
1539
|
+
if (!p) return;
|
|
1540
|
+
p = !1, clearInterval(y), M();
|
|
1541
|
+
const L = A === 0 ? styleText("green", F) : A === 1 ? styleText("red", oe) : styleText("red", ue);
|
|
1542
|
+
g = _ ?? g, k || (e === "timer" ? s.write(`${L} ${g} ${j(h)}
|
|
1543
|
+
`) : s.write(`${L} ${g}
|
|
1544
|
+
`)), G(), $();
|
|
1491
1545
|
};
|
|
1492
1546
|
return {
|
|
1493
|
-
start:
|
|
1494
|
-
stop: (
|
|
1495
|
-
message: (
|
|
1496
|
-
|
|
1547
|
+
start: ie,
|
|
1548
|
+
stop: (_ = "") => W(_, 0),
|
|
1549
|
+
message: (_ = "") => {
|
|
1550
|
+
g = R(_ ?? g);
|
|
1497
1551
|
},
|
|
1498
|
-
cancel: (
|
|
1499
|
-
error: (
|
|
1500
|
-
clear: () =>
|
|
1552
|
+
cancel: (_ = "") => W(_, 1),
|
|
1553
|
+
error: (_ = "") => W(_, 2),
|
|
1554
|
+
clear: () => W("", 0, !0),
|
|
1501
1555
|
get isCancelled() {
|
|
1502
|
-
return
|
|
1556
|
+
return m;
|
|
1503
1557
|
}
|
|
1504
1558
|
};
|
|
1505
1559
|
};
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
message: async (e, { symbol:
|
|
1509
|
-
process.stdout.write(`${styleText("gray",
|
|
1510
|
-
${
|
|
1560
|
+
w("─", "-"), w("━", "="), w("█", "#");
|
|
1561
|
+
const je = `${styleText("gray", d)} `, K = {
|
|
1562
|
+
message: async (e, { symbol: i = styleText("gray", d) } = {}) => {
|
|
1563
|
+
process.stdout.write(`${styleText("gray", d)}
|
|
1564
|
+
${i} `);
|
|
1511
1565
|
let s = 3;
|
|
1512
|
-
for await (let
|
|
1513
|
-
|
|
1514
|
-
${
|
|
1515
|
-
`) && (s = 3 + stripVTControlCharacters(
|
|
1566
|
+
for await (let r of e) {
|
|
1567
|
+
r = r.replace(/\n/g, `
|
|
1568
|
+
${je}`), r.includes(`
|
|
1569
|
+
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1516
1570
|
`))).length);
|
|
1517
|
-
const
|
|
1518
|
-
s +
|
|
1519
|
-
${
|
|
1571
|
+
const u = stripVTControlCharacters(r).length;
|
|
1572
|
+
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1573
|
+
${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1520
1574
|
}
|
|
1521
1575
|
process.stdout.write(`
|
|
1522
1576
|
`);
|
|
1523
1577
|
},
|
|
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",
|
|
1578
|
+
info: (e) => K.message(e, { symbol: styleText("blue", he) }),
|
|
1579
|
+
success: (e) => K.message(e, { symbol: styleText("green", pe) }),
|
|
1580
|
+
step: (e) => K.message(e, { symbol: styleText("green", F) }),
|
|
1581
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", me) }),
|
|
1528
1582
|
warning: (e) => K.warn(e),
|
|
1529
|
-
error: (e) => K.message(e, { symbol: styleText("red",
|
|
1530
|
-
},
|
|
1583
|
+
error: (e) => K.message(e, { symbol: styleText("red", ge) })
|
|
1584
|
+
}, Ot = (e) => new at$1({
|
|
1531
1585
|
validate: e.validate,
|
|
1532
1586
|
placeholder: e.placeholder,
|
|
1533
1587
|
defaultValue: e.defaultValue,
|
|
@@ -1536,34 +1590,34 @@ ${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length)
|
|
|
1536
1590
|
signal: e.signal,
|
|
1537
1591
|
input: e.input,
|
|
1538
1592
|
render() {
|
|
1539
|
-
const
|
|
1540
|
-
` : ""}${
|
|
1541
|
-
`,
|
|
1593
|
+
const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${styleText("gray", d)}
|
|
1594
|
+
` : ""}${V(this.state)} `}${e.message}
|
|
1595
|
+
`, 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
1596
|
switch (this.state) {
|
|
1543
1597
|
case "error": {
|
|
1544
|
-
const
|
|
1598
|
+
const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", d)} ` : "", a = i ? styleText("yellow", E) : "";
|
|
1545
1599
|
return `${s.trim()}
|
|
1546
|
-
${
|
|
1547
|
-
${
|
|
1600
|
+
${c}${u$13}
|
|
1601
|
+
${a}${o}
|
|
1548
1602
|
`;
|
|
1549
1603
|
}
|
|
1550
1604
|
case "submit": {
|
|
1551
|
-
const
|
|
1552
|
-
return `${s}${
|
|
1605
|
+
const o = n ? ` ${styleText("dim", n)}` : "";
|
|
1606
|
+
return `${s}${i ? styleText("gray", d) : ""}${o}`;
|
|
1553
1607
|
}
|
|
1554
1608
|
case "cancel": {
|
|
1555
|
-
const
|
|
1556
|
-
return `${s}${
|
|
1557
|
-
${
|
|
1609
|
+
const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c = i ? styleText("gray", d) : "";
|
|
1610
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
1611
|
+
${c}` : ""}`;
|
|
1558
1612
|
}
|
|
1559
|
-
default: return `${s}${
|
|
1560
|
-
${
|
|
1613
|
+
default: return `${s}${i ? `${styleText("cyan", d)} ` : ""}${u$13}
|
|
1614
|
+
${i ? styleText("cyan", E) : ""}
|
|
1561
1615
|
`;
|
|
1562
1616
|
}
|
|
1563
1617
|
}
|
|
1564
1618
|
}).prompt();
|
|
1565
1619
|
//#endregion
|
|
1566
|
-
//#region ../../node_modules/.pnpm/ejs@5.0.
|
|
1620
|
+
//#region ../../node_modules/.pnpm/ejs@5.0.2/node_modules/ejs/lib/esm/utils.js
|
|
1567
1621
|
/**
|
|
1568
1622
|
* Private utility functions
|
|
1569
1623
|
* @module utils
|
|
@@ -1575,6 +1629,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
1575
1629
|
var hasOwn = function(obj, key) {
|
|
1576
1630
|
return hasOwnProperty.apply(obj, [key]);
|
|
1577
1631
|
};
|
|
1632
|
+
utils.hasOwn = hasOwn;
|
|
1578
1633
|
/**
|
|
1579
1634
|
* Escape characters reserved in regular expressions.
|
|
1580
1635
|
*
|
|
@@ -1745,7 +1800,7 @@ utils.hasOwnOnlyObject = function(obj) {
|
|
|
1745
1800
|
};
|
|
1746
1801
|
if (typeof exports != "undefined") module.exports = utils;
|
|
1747
1802
|
//#endregion
|
|
1748
|
-
//#region ../../node_modules/.pnpm/ejs@5.0.
|
|
1803
|
+
//#region ../../node_modules/.pnpm/ejs@5.0.2/node_modules/ejs/lib/esm/ejs.js
|
|
1749
1804
|
/**
|
|
1750
1805
|
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
|
1751
1806
|
* @author Matthew Eernisse <mde@fleegix.org>
|
|
@@ -2072,7 +2127,7 @@ ejs.renderFile = function() {
|
|
|
2072
2127
|
data = args.shift();
|
|
2073
2128
|
if (args.length) utils.shallowCopy(opts, args.pop());
|
|
2074
2129
|
else {
|
|
2075
|
-
if (data.settings) {
|
|
2130
|
+
if (utils.hasOwn(data, "settings") && data.settings) {
|
|
2076
2131
|
if (data.settings.views) opts.views = data.settings.views;
|
|
2077
2132
|
if (data.settings["view cache"]) opts.cache = true;
|
|
2078
2133
|
viewOpts = data.settings["view options"];
|
|
@@ -6335,6 +6390,7 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6335
6390
|
onError(token, "UNEXPECTED_TOKEN", token.message);
|
|
6336
6391
|
length += token.source.length;
|
|
6337
6392
|
break;
|
|
6393
|
+
/* istanbul ignore next should not happen */
|
|
6338
6394
|
default: {
|
|
6339
6395
|
onError(token, "UNEXPECTED_TOKEN", `Unexpected token in block scalar header: ${token.type}`);
|
|
6340
6396
|
const ts = token.source;
|
|
@@ -6384,6 +6440,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6384
6440
|
_type = Scalar.Scalar.QUOTE_DOUBLE;
|
|
6385
6441
|
value = doubleQuotedValue(source, _onError);
|
|
6386
6442
|
break;
|
|
6443
|
+
/* istanbul ignore next should not happen */
|
|
6387
6444
|
default:
|
|
6388
6445
|
onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
|
|
6389
6446
|
return {
|
|
@@ -6413,6 +6470,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6413
6470
|
function plainValue(source, onError) {
|
|
6414
6471
|
let badChar = "";
|
|
6415
6472
|
switch (source[0]) {
|
|
6473
|
+
/* istanbul ignore next should not happen */
|
|
6416
6474
|
case " ":
|
|
6417
6475
|
badChar = "a tab character";
|
|
6418
6476
|
break;
|
|
@@ -8073,6 +8131,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8073
8131
|
return it.sep ?? it.start;
|
|
8074
8132
|
}
|
|
8075
8133
|
case "block-seq": return parent.items[parent.items.length - 1].start;
|
|
8134
|
+
/* istanbul ignore next should not happen */
|
|
8076
8135
|
default: return [];
|
|
8077
8136
|
}
|
|
8078
8137
|
}
|
|
@@ -8325,6 +8384,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8325
8384
|
});
|
|
8326
8385
|
return;
|
|
8327
8386
|
}
|
|
8387
|
+
/* istanbul ignore next should not happen */
|
|
8328
8388
|
default:
|
|
8329
8389
|
yield* this.pop();
|
|
8330
8390
|
yield* this.pop(token);
|
|
@@ -8442,6 +8502,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8442
8502
|
}
|
|
8443
8503
|
yield* this.pop();
|
|
8444
8504
|
break;
|
|
8505
|
+
/* istanbul ignore next should not happen */
|
|
8445
8506
|
default:
|
|
8446
8507
|
yield* this.pop();
|
|
8447
8508
|
yield* this.step();
|
|
@@ -9028,7 +9089,7 @@ var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9028
9089
|
exports.visitAsync = visit.visitAsync;
|
|
9029
9090
|
}));
|
|
9030
9091
|
//#endregion
|
|
9031
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
9092
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.9_oxc-resolver@11.19.1_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2__typescript_92be91b1b9812fa08a94dfb31a50e5d5/node_modules/tsdown/esm-shims.js
|
|
9032
9093
|
var getFilename, getDirname, __dirname, __filename;
|
|
9033
9094
|
var init_esm_shims = __esmMin((() => {
|
|
9034
9095
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -11053,7 +11114,7 @@ var require_buffer_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11053
11114
|
//#region ../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js
|
|
11054
11115
|
var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11055
11116
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
11056
|
-
var path$
|
|
11117
|
+
var path$3 = __require("path");
|
|
11057
11118
|
var fs;
|
|
11058
11119
|
try {
|
|
11059
11120
|
fs = __require("fs");
|
|
@@ -11130,15 +11191,15 @@ var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
11130
11191
|
});
|
|
11131
11192
|
function supportRelativeURL(file, url) {
|
|
11132
11193
|
if (!file) return url;
|
|
11133
|
-
var dir = path$
|
|
11194
|
+
var dir = path$3.dirname(file);
|
|
11134
11195
|
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
11135
11196
|
var protocol = match ? match[0] : "";
|
|
11136
11197
|
var startPath = dir.slice(protocol.length);
|
|
11137
11198
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
11138
11199
|
protocol += "/";
|
|
11139
|
-
return protocol + path$
|
|
11200
|
+
return protocol + path$3.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
11140
11201
|
}
|
|
11141
|
-
return protocol + path$
|
|
11202
|
+
return protocol + path$3.resolve(dir.slice(protocol.length), url);
|
|
11142
11203
|
}
|
|
11143
11204
|
function retrieveSourceMapURL(source) {
|
|
11144
11205
|
var fileData;
|
|
@@ -144129,7 +144190,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
144129
144190
|
return this.nextNodeAllOnSameLine;
|
|
144130
144191
|
}
|
|
144131
144192
|
TokensAreOnSameLine() {
|
|
144132
|
-
if (this.tokensAreOnSameLine === void 0)
|
|
144193
|
+
if (this.tokensAreOnSameLine === void 0) {
|
|
144194
|
+
const startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;
|
|
144195
|
+
const endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;
|
|
144196
|
+
this.tokensAreOnSameLine = startLine === endLine;
|
|
144197
|
+
}
|
|
144133
144198
|
return this.tokensAreOnSameLine;
|
|
144134
144199
|
}
|
|
144135
144200
|
ContextNodeBlockIsOnOneLine() {
|
|
@@ -155731,7 +155796,7 @@ ${json}${newLine}`;
|
|
|
155731
155796
|
this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate;
|
|
155732
155797
|
const { throttleWaitMilliseconds } = opts;
|
|
155733
155798
|
this.eventHandler = this.canUseEvents ? opts.eventHandler || ((event) => this.defaultEventHandler(event)) : void 0;
|
|
155734
|
-
|
|
155799
|
+
const multistepOperationHost = {
|
|
155735
155800
|
executeWithRequestId: (requestId, action, performanceData) => this.executeWithRequestId(requestId, action, performanceData),
|
|
155736
155801
|
getCurrentRequestId: () => this.currentRequestId,
|
|
155737
155802
|
getPerformanceData: () => this.performanceData,
|
|
@@ -155739,8 +155804,9 @@ ${json}${newLine}`;
|
|
|
155739
155804
|
logError: (err, cmd) => this.logError(err, cmd),
|
|
155740
155805
|
sendRequestCompletedEvent: (requestId, performanceData) => this.sendRequestCompletedEvent(requestId, performanceData),
|
|
155741
155806
|
isCancellationRequested: () => this.cancellationToken.isCancellationRequested()
|
|
155742
|
-
}
|
|
155743
|
-
this.
|
|
155807
|
+
};
|
|
155808
|
+
this.errorCheck = new MultistepOperation(multistepOperationHost);
|
|
155809
|
+
const settings = {
|
|
155744
155810
|
host: this.host,
|
|
155745
155811
|
logger: this.logger,
|
|
155746
155812
|
cancellationToken: this.cancellationToken,
|
|
@@ -155758,7 +155824,8 @@ ${json}${newLine}`;
|
|
|
155758
155824
|
session: this,
|
|
155759
155825
|
canUseWatchEvents: opts.canUseWatchEvents,
|
|
155760
155826
|
incrementalVerifier: opts.incrementalVerifier
|
|
155761
|
-
}
|
|
155827
|
+
};
|
|
155828
|
+
this.projectService = new ProjectService2(settings);
|
|
155762
155829
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
155763
155830
|
this.gcTimer = new GcTimer(this.host, 7e3, this.logger);
|
|
155764
155831
|
switch (this.projectService.serverMode) {
|
|
@@ -158565,7 +158632,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
158565
158632
|
});
|
|
158566
158633
|
}));
|
|
158567
158634
|
//#endregion
|
|
158568
|
-
//#region ../../node_modules/.pnpm
|
|
158635
|
+
//#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/commonjs/index.js
|
|
158569
158636
|
var require_commonjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158570
158637
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158571
158638
|
exports.range = exports.balanced = void 0;
|
|
@@ -158619,9 +158686,10 @@ var require_commonjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158619
158686
|
exports.range = range;
|
|
158620
158687
|
}));
|
|
158621
158688
|
//#endregion
|
|
158622
|
-
//#region ../../node_modules/.pnpm
|
|
158689
|
+
//#region ../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js
|
|
158623
158690
|
var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158624
158691
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158692
|
+
exports.EXPANSION_MAX = void 0;
|
|
158625
158693
|
exports.expand = expand;
|
|
158626
158694
|
const balanced_match_1 = require_commonjs$2();
|
|
158627
158695
|
const escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -158638,7 +158706,8 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158638
158706
|
const openPattern = /\\{/g;
|
|
158639
158707
|
const closePattern = /\\}/g;
|
|
158640
158708
|
const commaPattern = /\\,/g;
|
|
158641
|
-
const periodPattern =
|
|
158709
|
+
const periodPattern = /\\\./g;
|
|
158710
|
+
exports.EXPANSION_MAX = 1e5;
|
|
158642
158711
|
function numeric(str) {
|
|
158643
158712
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
158644
158713
|
}
|
|
@@ -158669,10 +158738,11 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158669
158738
|
parts.push.apply(parts, p);
|
|
158670
158739
|
return parts;
|
|
158671
158740
|
}
|
|
158672
|
-
function expand(str) {
|
|
158741
|
+
function expand(str, options = {}) {
|
|
158673
158742
|
if (!str) return [];
|
|
158743
|
+
const { max = exports.EXPANSION_MAX } = options;
|
|
158674
158744
|
if (str.slice(0, 2) === "{}") str = "\\{\\}" + str.slice(2);
|
|
158675
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
158745
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
158676
158746
|
}
|
|
158677
158747
|
function embrace(str) {
|
|
158678
158748
|
return "{" + str + "}";
|
|
@@ -158686,14 +158756,14 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158686
158756
|
function gte(i, y) {
|
|
158687
158757
|
return i >= y;
|
|
158688
158758
|
}
|
|
158689
|
-
function expand_(str, isTop) {
|
|
158759
|
+
function expand_(str, max, isTop) {
|
|
158690
158760
|
/** @type {string[]} */
|
|
158691
158761
|
const expansions = [];
|
|
158692
158762
|
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
|
158693
158763
|
if (!m) return [str];
|
|
158694
158764
|
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++) {
|
|
158765
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
158766
|
+
if (/\$$/.test(m.pre)) for (let k = 0; k < post.length && k < max; k++) {
|
|
158697
158767
|
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
158698
158768
|
expansions.push(expansion);
|
|
158699
158769
|
}
|
|
@@ -158705,7 +158775,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158705
158775
|
if (!isSequence && !isOptions) {
|
|
158706
158776
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
158707
158777
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
158708
|
-
return expand_(str);
|
|
158778
|
+
return expand_(str, max, true);
|
|
158709
158779
|
}
|
|
158710
158780
|
return [str];
|
|
158711
158781
|
}
|
|
@@ -158714,7 +158784,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158714
158784
|
else {
|
|
158715
158785
|
n = parseCommaParts(m.body);
|
|
158716
158786
|
if (n.length === 1 && n[0] !== void 0) {
|
|
158717
|
-
n = expand_(n[0], false).map(embrace);
|
|
158787
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
158718
158788
|
/* c8 ignore start */
|
|
158719
158789
|
if (n.length === 1) return post.map((p) => m.pre + n[0] + p);
|
|
158720
158790
|
}
|
|
@@ -158724,7 +158794,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158724
158794
|
const x = numeric(n[0]);
|
|
158725
158795
|
const y = numeric(n[1]);
|
|
158726
158796
|
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;
|
|
158797
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
158728
158798
|
let test = lte;
|
|
158729
158799
|
if (y < x) {
|
|
158730
158800
|
incr *= -1;
|
|
@@ -158752,9 +158822,9 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158752
158822
|
}
|
|
158753
158823
|
} else {
|
|
158754
158824
|
N = [];
|
|
158755
|
-
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], false));
|
|
158825
|
+
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], max, false));
|
|
158756
158826
|
}
|
|
158757
|
-
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length; k++) {
|
|
158827
|
+
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
158758
158828
|
const expansion = pre + N[j] + post[k];
|
|
158759
158829
|
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
158760
158830
|
}
|
|
@@ -158763,7 +158833,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158763
158833
|
}
|
|
158764
158834
|
}));
|
|
158765
158835
|
//#endregion
|
|
158766
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158836
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
|
|
158767
158837
|
var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158768
158838
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158769
158839
|
exports.assertValidPattern = void 0;
|
|
@@ -158775,7 +158845,7 @@ var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158775
158845
|
exports.assertValidPattern = assertValidPattern;
|
|
158776
158846
|
}));
|
|
158777
158847
|
//#endregion
|
|
158778
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158848
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/brace-expressions.js
|
|
158779
158849
|
var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158780
158850
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158781
158851
|
exports.parseClass = void 0;
|
|
@@ -158901,7 +158971,7 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158901
158971
|
exports.parseClass = parseClass;
|
|
158902
158972
|
}));
|
|
158903
158973
|
//#endregion
|
|
158904
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
158974
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/unescape.js
|
|
158905
158975
|
var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
158906
158976
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158907
158977
|
exports.unescape = void 0;
|
|
@@ -158931,8 +159001,9 @@ var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158931
159001
|
exports.unescape = unescape;
|
|
158932
159002
|
}));
|
|
158933
159003
|
//#endregion
|
|
158934
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
159004
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/ast.js
|
|
158935
159005
|
var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
159006
|
+
var _a;
|
|
158936
159007
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158937
159008
|
exports.AST = void 0;
|
|
158938
159009
|
const brace_expressions_js_1 = require_brace_expressions();
|
|
@@ -158945,6 +159016,53 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158945
159016
|
"@"
|
|
158946
159017
|
]);
|
|
158947
159018
|
const isExtglobType = (c) => types.has(c);
|
|
159019
|
+
const isExtglobAST = (c) => isExtglobType(c.type);
|
|
159020
|
+
const adoptionMap = new Map([
|
|
159021
|
+
["!", ["@"]],
|
|
159022
|
+
["?", ["?", "@"]],
|
|
159023
|
+
["@", ["@"]],
|
|
159024
|
+
["*", [
|
|
159025
|
+
"*",
|
|
159026
|
+
"+",
|
|
159027
|
+
"?",
|
|
159028
|
+
"@"
|
|
159029
|
+
]],
|
|
159030
|
+
["+", ["+", "@"]]
|
|
159031
|
+
]);
|
|
159032
|
+
const adoptionWithSpaceMap = new Map([
|
|
159033
|
+
["!", ["?"]],
|
|
159034
|
+
["@", ["?"]],
|
|
159035
|
+
["+", ["?", "*"]]
|
|
159036
|
+
]);
|
|
159037
|
+
const adoptionAnyMap = new Map([
|
|
159038
|
+
["!", ["?", "@"]],
|
|
159039
|
+
["?", ["?", "@"]],
|
|
159040
|
+
["@", ["?", "@"]],
|
|
159041
|
+
["*", [
|
|
159042
|
+
"*",
|
|
159043
|
+
"+",
|
|
159044
|
+
"?",
|
|
159045
|
+
"@"
|
|
159046
|
+
]],
|
|
159047
|
+
["+", [
|
|
159048
|
+
"+",
|
|
159049
|
+
"@",
|
|
159050
|
+
"?",
|
|
159051
|
+
"*"
|
|
159052
|
+
]]
|
|
159053
|
+
]);
|
|
159054
|
+
const usurpMap = new Map([
|
|
159055
|
+
["!", new Map([["!", "@"]])],
|
|
159056
|
+
["?", new Map([["*", "*"], ["+", "*"]])],
|
|
159057
|
+
["@", new Map([
|
|
159058
|
+
["!", "!"],
|
|
159059
|
+
["?", "?"],
|
|
159060
|
+
["@", "@"],
|
|
159061
|
+
["*", "*"],
|
|
159062
|
+
["+", "+"]
|
|
159063
|
+
])],
|
|
159064
|
+
["+", new Map([["?", "*"], ["*", "*"]])]
|
|
159065
|
+
]);
|
|
158948
159066
|
const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
158949
159067
|
const startNoDot = "(?!\\.)";
|
|
158950
159068
|
const addPatternStart = new Set(["[", "."]);
|
|
@@ -158954,7 +159072,8 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158954
159072
|
const qmark = "[^/]";
|
|
158955
159073
|
const star = qmark + "*?";
|
|
158956
159074
|
const starNoEmpty = qmark + "+?";
|
|
158957
|
-
|
|
159075
|
+
let ID = 0;
|
|
159076
|
+
var AST = class {
|
|
158958
159077
|
type;
|
|
158959
159078
|
#root;
|
|
158960
159079
|
#hasMagic;
|
|
@@ -158967,6 +159086,22 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
158967
159086
|
#options;
|
|
158968
159087
|
#toString;
|
|
158969
159088
|
#emptyExt = false;
|
|
159089
|
+
id = ++ID;
|
|
159090
|
+
get depth() {
|
|
159091
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
159092
|
+
}
|
|
159093
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
159094
|
+
return {
|
|
159095
|
+
"@@type": "AST",
|
|
159096
|
+
id: this.id,
|
|
159097
|
+
type: this.type,
|
|
159098
|
+
root: this.#root.id,
|
|
159099
|
+
parent: this.#parent?.id,
|
|
159100
|
+
depth: this.depth,
|
|
159101
|
+
partsLength: this.#parts.length,
|
|
159102
|
+
parts: this.#parts
|
|
159103
|
+
};
|
|
159104
|
+
}
|
|
158970
159105
|
constructor(type, parent, options = {}) {
|
|
158971
159106
|
this.type = type;
|
|
158972
159107
|
if (type) this.#hasMagic = true;
|
|
@@ -159021,7 +159156,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159021
159156
|
for (const p of parts) {
|
|
159022
159157
|
if (p === "") continue;
|
|
159023
159158
|
/* c8 ignore start */
|
|
159024
|
-
if (typeof p !== "string" && !(p instanceof
|
|
159159
|
+
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
|
|
159025
159160
|
/* c8 ignore stop */
|
|
159026
159161
|
this.#parts.push(p);
|
|
159027
159162
|
}
|
|
@@ -159039,7 +159174,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159039
159174
|
const p = this.#parent;
|
|
159040
159175
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
159041
159176
|
const pp = p.#parts[i];
|
|
159042
|
-
if (!(pp instanceof
|
|
159177
|
+
if (!(pp instanceof _a && pp.type === "!")) return false;
|
|
159043
159178
|
}
|
|
159044
159179
|
return true;
|
|
159045
159180
|
}
|
|
@@ -159058,11 +159193,12 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159058
159193
|
else this.push(part.clone(this));
|
|
159059
159194
|
}
|
|
159060
159195
|
clone(parent) {
|
|
159061
|
-
const c = new
|
|
159196
|
+
const c = new _a(this.type, parent);
|
|
159062
159197
|
for (const p of this.#parts) c.copyIn(p);
|
|
159063
159198
|
return c;
|
|
159064
159199
|
}
|
|
159065
|
-
static #parseAST(str, ast, pos, opt) {
|
|
159200
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
159201
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
159066
159202
|
let escaping = false;
|
|
159067
159203
|
let inBrace = false;
|
|
159068
159204
|
let braceStart = -1;
|
|
@@ -159090,11 +159226,11 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159090
159226
|
acc += c;
|
|
159091
159227
|
continue;
|
|
159092
159228
|
}
|
|
159093
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(") {
|
|
159229
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
|
|
159094
159230
|
ast.push(acc);
|
|
159095
159231
|
acc = "";
|
|
159096
|
-
const ext = new
|
|
159097
|
-
i =
|
|
159232
|
+
const ext = new _a(c, ast);
|
|
159233
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
159098
159234
|
ast.push(ext);
|
|
159099
159235
|
continue;
|
|
159100
159236
|
}
|
|
@@ -159104,7 +159240,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159104
159240
|
return i;
|
|
159105
159241
|
}
|
|
159106
159242
|
let i = pos + 1;
|
|
159107
|
-
let part = new
|
|
159243
|
+
let part = new _a(null, ast);
|
|
159108
159244
|
const parts = [];
|
|
159109
159245
|
let acc = "";
|
|
159110
159246
|
while (i < str.length) {
|
|
@@ -159127,19 +159263,21 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159127
159263
|
acc += c;
|
|
159128
159264
|
continue;
|
|
159129
159265
|
}
|
|
159130
|
-
|
|
159266
|
+
/* c8 ignore stop */
|
|
159267
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
|
|
159268
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
159131
159269
|
part.push(acc);
|
|
159132
159270
|
acc = "";
|
|
159133
|
-
const ext = new
|
|
159271
|
+
const ext = new _a(c, part);
|
|
159134
159272
|
part.push(ext);
|
|
159135
|
-
i =
|
|
159273
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
159136
159274
|
continue;
|
|
159137
159275
|
}
|
|
159138
159276
|
if (c === "|") {
|
|
159139
159277
|
part.push(acc);
|
|
159140
159278
|
acc = "";
|
|
159141
159279
|
parts.push(part);
|
|
159142
|
-
part = new
|
|
159280
|
+
part = new _a(null, ast);
|
|
159143
159281
|
continue;
|
|
159144
159282
|
}
|
|
159145
159283
|
if (c === ")") {
|
|
@@ -159156,9 +159294,56 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159156
159294
|
ast.#parts = [str.substring(pos - 1)];
|
|
159157
159295
|
return i;
|
|
159158
159296
|
}
|
|
159297
|
+
#canAdoptWithSpace(child) {
|
|
159298
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
159299
|
+
}
|
|
159300
|
+
#canAdopt(child, map = adoptionMap) {
|
|
159301
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
|
|
159302
|
+
const gc = child.#parts[0];
|
|
159303
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
159304
|
+
return this.#canAdoptType(gc.type, map);
|
|
159305
|
+
}
|
|
159306
|
+
#canAdoptType(c, map = adoptionAnyMap) {
|
|
159307
|
+
return !!map.get(this.type)?.includes(c);
|
|
159308
|
+
}
|
|
159309
|
+
#adoptWithSpace(child, index) {
|
|
159310
|
+
const gc = child.#parts[0];
|
|
159311
|
+
const blank = new _a(null, gc, this.options);
|
|
159312
|
+
blank.#parts.push("");
|
|
159313
|
+
gc.push(blank);
|
|
159314
|
+
this.#adopt(child, index);
|
|
159315
|
+
}
|
|
159316
|
+
#adopt(child, index) {
|
|
159317
|
+
const gc = child.#parts[0];
|
|
159318
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
159319
|
+
for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
|
|
159320
|
+
this.#toString = void 0;
|
|
159321
|
+
}
|
|
159322
|
+
#canUsurpType(c) {
|
|
159323
|
+
return !!usurpMap.get(this.type)?.has(c);
|
|
159324
|
+
}
|
|
159325
|
+
#canUsurp(child) {
|
|
159326
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
|
|
159327
|
+
const gc = child.#parts[0];
|
|
159328
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
159329
|
+
return this.#canUsurpType(gc.type);
|
|
159330
|
+
}
|
|
159331
|
+
#usurp(child) {
|
|
159332
|
+
const m = usurpMap.get(this.type);
|
|
159333
|
+
const gc = child.#parts[0];
|
|
159334
|
+
const nt = m?.get(gc.type);
|
|
159335
|
+
/* c8 ignore start - impossible */
|
|
159336
|
+
if (!nt) return false;
|
|
159337
|
+
/* c8 ignore stop */
|
|
159338
|
+
this.#parts = gc.#parts;
|
|
159339
|
+
for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
|
|
159340
|
+
this.type = nt;
|
|
159341
|
+
this.#toString = void 0;
|
|
159342
|
+
this.#emptyExt = false;
|
|
159343
|
+
}
|
|
159159
159344
|
static fromGlob(pattern, options = {}) {
|
|
159160
|
-
const ast = new
|
|
159161
|
-
|
|
159345
|
+
const ast = new _a(null, void 0, options);
|
|
159346
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
159162
159347
|
return ast;
|
|
159163
159348
|
}
|
|
159164
159349
|
toMMPattern() {
|
|
@@ -159179,11 +159364,14 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159179
159364
|
}
|
|
159180
159365
|
toRegExpSource(allowDot) {
|
|
159181
159366
|
const dot = allowDot ?? !!this.#options.dot;
|
|
159182
|
-
if (this.#root === this)
|
|
159183
|
-
|
|
159367
|
+
if (this.#root === this) {
|
|
159368
|
+
this.#flatten();
|
|
159369
|
+
this.#fillNegs();
|
|
159370
|
+
}
|
|
159371
|
+
if (!isExtglobAST(this)) {
|
|
159184
159372
|
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
159185
159373
|
const src = this.#parts.map((p) => {
|
|
159186
|
-
const [re, _, hasMagic, uflag] = typeof p === "string" ?
|
|
159374
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
159187
159375
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
159188
159376
|
this.#uflag = this.#uflag || uflag;
|
|
159189
159377
|
return re;
|
|
@@ -159213,9 +159401,10 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159213
159401
|
let body = this.#partsToRegExp(dot);
|
|
159214
159402
|
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
159215
159403
|
const s = this.toString();
|
|
159216
|
-
|
|
159217
|
-
|
|
159218
|
-
|
|
159404
|
+
const me = this;
|
|
159405
|
+
me.#parts = [s];
|
|
159406
|
+
me.type = null;
|
|
159407
|
+
me.#hasMagic = void 0;
|
|
159219
159408
|
return [
|
|
159220
159409
|
s,
|
|
159221
159410
|
(0, unescape_js_1.unescape)(this.toString()),
|
|
@@ -159239,6 +159428,34 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159239
159428
|
this.#uflag
|
|
159240
159429
|
];
|
|
159241
159430
|
}
|
|
159431
|
+
#flatten() {
|
|
159432
|
+
if (!isExtglobAST(this)) {
|
|
159433
|
+
for (const p of this.#parts) if (typeof p === "object") p.#flatten();
|
|
159434
|
+
} else {
|
|
159435
|
+
let iterations = 0;
|
|
159436
|
+
let done = false;
|
|
159437
|
+
do {
|
|
159438
|
+
done = true;
|
|
159439
|
+
for (let i = 0; i < this.#parts.length; i++) {
|
|
159440
|
+
const c = this.#parts[i];
|
|
159441
|
+
if (typeof c === "object") {
|
|
159442
|
+
c.#flatten();
|
|
159443
|
+
if (this.#canAdopt(c)) {
|
|
159444
|
+
done = false;
|
|
159445
|
+
this.#adopt(c, i);
|
|
159446
|
+
} else if (this.#canAdoptWithSpace(c)) {
|
|
159447
|
+
done = false;
|
|
159448
|
+
this.#adoptWithSpace(c, i);
|
|
159449
|
+
} else if (this.#canUsurp(c)) {
|
|
159450
|
+
done = false;
|
|
159451
|
+
this.#usurp(c);
|
|
159452
|
+
}
|
|
159453
|
+
}
|
|
159454
|
+
}
|
|
159455
|
+
} while (!done && ++iterations < 10);
|
|
159456
|
+
}
|
|
159457
|
+
this.#toString = void 0;
|
|
159458
|
+
}
|
|
159242
159459
|
#partsToRegExp(dot) {
|
|
159243
159460
|
return this.#parts.map((p) => {
|
|
159244
159461
|
/* c8 ignore start */
|
|
@@ -159253,6 +159470,7 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159253
159470
|
let escaping = false;
|
|
159254
159471
|
let re = "";
|
|
159255
159472
|
let uflag = false;
|
|
159473
|
+
let inStar = false;
|
|
159256
159474
|
for (let i = 0; i < glob.length; i++) {
|
|
159257
159475
|
const c = glob.charAt(i);
|
|
159258
159476
|
if (escaping) {
|
|
@@ -159260,6 +159478,13 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159260
159478
|
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
159261
159479
|
continue;
|
|
159262
159480
|
}
|
|
159481
|
+
if (c === "*") {
|
|
159482
|
+
if (inStar) continue;
|
|
159483
|
+
inStar = true;
|
|
159484
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
159485
|
+
hasMagic = true;
|
|
159486
|
+
continue;
|
|
159487
|
+
} else inStar = false;
|
|
159263
159488
|
if (c === "\\") {
|
|
159264
159489
|
if (i === glob.length - 1) re += "\\\\";
|
|
159265
159490
|
else escaping = true;
|
|
@@ -159275,11 +159500,6 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159275
159500
|
continue;
|
|
159276
159501
|
}
|
|
159277
159502
|
}
|
|
159278
|
-
if (c === "*") {
|
|
159279
|
-
re += noEmpty && glob === "*" ? starNoEmpty : star;
|
|
159280
|
-
hasMagic = true;
|
|
159281
|
-
continue;
|
|
159282
|
-
}
|
|
159283
159503
|
if (c === "?") {
|
|
159284
159504
|
re += qmark;
|
|
159285
159505
|
hasMagic = true;
|
|
@@ -159295,9 +159515,11 @@ var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159295
159515
|
];
|
|
159296
159516
|
}
|
|
159297
159517
|
};
|
|
159518
|
+
exports.AST = AST;
|
|
159519
|
+
_a = AST;
|
|
159298
159520
|
}));
|
|
159299
159521
|
//#endregion
|
|
159300
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
159522
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/escape.js
|
|
159301
159523
|
var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
159302
159524
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
159303
159525
|
exports.escape = void 0;
|
|
@@ -159320,7 +159542,7 @@ var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159320
159542
|
exports.escape = escape;
|
|
159321
159543
|
}));
|
|
159322
159544
|
//#endregion
|
|
159323
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
159545
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/commonjs/index.js
|
|
159324
159546
|
var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
159325
159547
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
159326
159548
|
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 +159662,7 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159440
159662
|
const braceExpand = (pattern, options = {}) => {
|
|
159441
159663
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
159442
159664
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
159443
|
-
return (0, brace_expansion_1.expand)(pattern);
|
|
159665
|
+
return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
|
|
159444
159666
|
};
|
|
159445
159667
|
exports.braceExpand = braceExpand;
|
|
159446
159668
|
exports.minimatch.braceExpand = exports.braceExpand;
|
|
@@ -159474,15 +159696,18 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159474
159696
|
isWindows;
|
|
159475
159697
|
platform;
|
|
159476
159698
|
windowsNoMagicRoot;
|
|
159699
|
+
maxGlobstarRecursion;
|
|
159477
159700
|
regexp;
|
|
159478
159701
|
constructor(pattern, options = {}) {
|
|
159479
159702
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
159480
159703
|
options = options || {};
|
|
159481
159704
|
this.options = options;
|
|
159705
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
159482
159706
|
this.pattern = pattern;
|
|
159483
159707
|
this.platform = options.platform || defaultPlatform;
|
|
159484
159708
|
this.isWindows = this.platform === "win32";
|
|
159485
|
-
|
|
159709
|
+
const awe = "allowWindowsEscape";
|
|
159710
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
|
|
159486
159711
|
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
159487
159712
|
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
159488
159713
|
this.regexp = null;
|
|
@@ -159717,7 +159942,8 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159717
159942
|
this.negate = negate;
|
|
159718
159943
|
}
|
|
159719
159944
|
matchOne(file, pattern, partial = false) {
|
|
159720
|
-
|
|
159945
|
+
let fileStartIndex = 0;
|
|
159946
|
+
let patternStartIndex = 0;
|
|
159721
159947
|
if (this.isWindows) {
|
|
159722
159948
|
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
159723
159949
|
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
@@ -159729,62 +159955,107 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159729
159955
|
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
159730
159956
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
159731
159957
|
pattern[pdi] = fd;
|
|
159732
|
-
|
|
159733
|
-
|
|
159958
|
+
patternStartIndex = pdi;
|
|
159959
|
+
fileStartIndex = fdi;
|
|
159734
159960
|
}
|
|
159735
159961
|
}
|
|
159736
159962
|
}
|
|
159737
159963
|
const { optimizationLevel = 1 } = this.options;
|
|
159738
159964
|
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
159739
|
-
|
|
159740
|
-
|
|
159741
|
-
|
|
159742
|
-
|
|
159743
|
-
|
|
159744
|
-
|
|
159965
|
+
if (pattern.includes(exports.GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
159966
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
159967
|
+
}
|
|
159968
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
159969
|
+
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
|
159970
|
+
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
159971
|
+
const [head, body, tail] = partial ? [
|
|
159972
|
+
pattern.slice(patternIndex, firstgs),
|
|
159973
|
+
pattern.slice(firstgs + 1),
|
|
159974
|
+
[]
|
|
159975
|
+
] : [
|
|
159976
|
+
pattern.slice(patternIndex, firstgs),
|
|
159977
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
159978
|
+
pattern.slice(lastgs + 1)
|
|
159979
|
+
];
|
|
159980
|
+
if (head.length) {
|
|
159981
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
159982
|
+
if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
|
|
159983
|
+
fileIndex += head.length;
|
|
159984
|
+
patternIndex += head.length;
|
|
159985
|
+
}
|
|
159986
|
+
let fileTailMatch = 0;
|
|
159987
|
+
if (tail.length) {
|
|
159988
|
+
if (tail.length + fileIndex > file.length) return false;
|
|
159989
|
+
let tailStart = file.length - tail.length;
|
|
159990
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
|
|
159991
|
+
else {
|
|
159992
|
+
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
|
|
159993
|
+
tailStart--;
|
|
159994
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) return false;
|
|
159995
|
+
fileTailMatch = tail.length + 1;
|
|
159996
|
+
}
|
|
159997
|
+
}
|
|
159998
|
+
if (!body.length) {
|
|
159999
|
+
let sawSome = !!fileTailMatch;
|
|
160000
|
+
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
160001
|
+
const f = String(file[i]);
|
|
160002
|
+
sawSome = true;
|
|
160003
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
160004
|
+
}
|
|
160005
|
+
return partial || sawSome;
|
|
160006
|
+
}
|
|
160007
|
+
const bodySegments = [[[], 0]];
|
|
160008
|
+
let currentBody = bodySegments[0];
|
|
160009
|
+
let nonGsParts = 0;
|
|
160010
|
+
const nonGsPartsSums = [0];
|
|
160011
|
+
for (const b of body) if (b === exports.GLOBSTAR) {
|
|
160012
|
+
nonGsPartsSums.push(nonGsParts);
|
|
160013
|
+
currentBody = [[], 0];
|
|
160014
|
+
bodySegments.push(currentBody);
|
|
160015
|
+
} else {
|
|
160016
|
+
currentBody[0].push(b);
|
|
160017
|
+
nonGsParts++;
|
|
160018
|
+
}
|
|
160019
|
+
let i = bodySegments.length - 1;
|
|
160020
|
+
const fileLength = file.length - fileTailMatch;
|
|
160021
|
+
for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
160022
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
160023
|
+
}
|
|
160024
|
+
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
160025
|
+
const bs = bodySegments[bodyIndex];
|
|
160026
|
+
if (!bs) {
|
|
160027
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
160028
|
+
sawTail = true;
|
|
160029
|
+
const f = file[i];
|
|
160030
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
160031
|
+
}
|
|
160032
|
+
return sawTail;
|
|
160033
|
+
}
|
|
160034
|
+
const [body, after] = bs;
|
|
160035
|
+
while (fileIndex <= after) {
|
|
160036
|
+
if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
|
|
160037
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
160038
|
+
if (sub !== false) return sub;
|
|
160039
|
+
}
|
|
160040
|
+
const f = file[fileIndex];
|
|
160041
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
160042
|
+
fileIndex++;
|
|
160043
|
+
}
|
|
160044
|
+
return partial || null;
|
|
160045
|
+
}
|
|
160046
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
160047
|
+
let fi;
|
|
160048
|
+
let pi;
|
|
160049
|
+
let pl;
|
|
160050
|
+
let fl;
|
|
160051
|
+
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
159745
160052
|
this.debug("matchOne loop");
|
|
159746
|
-
|
|
159747
|
-
|
|
160053
|
+
let p = pattern[pi];
|
|
160054
|
+
let f = file[fi];
|
|
159748
160055
|
this.debug(pattern, p, f);
|
|
159749
160056
|
/* c8 ignore start */
|
|
159750
|
-
if (p === false) return false;
|
|
160057
|
+
if (p === false || p === exports.GLOBSTAR) return false;
|
|
159751
160058
|
/* 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
160059
|
let hit;
|
|
159789
160060
|
if (typeof p === "string") {
|
|
159790
160061
|
hit = f === p;
|
|
@@ -160257,10 +160528,11 @@ var require_path_browserify = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
160257
160528
|
module.exports = posix;
|
|
160258
160529
|
}));
|
|
160259
160530
|
//#endregion
|
|
160260
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160531
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
160261
160532
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160262
160533
|
const WIN_SLASH = "\\\\/";
|
|
160263
160534
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
160535
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
160264
160536
|
/**
|
|
160265
160537
|
* Posix glob regex
|
|
160266
160538
|
*/
|
|
@@ -160310,8 +160582,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160310
160582
|
SEP: "\\"
|
|
160311
160583
|
};
|
|
160312
160584
|
module.exports = {
|
|
160585
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
160313
160586
|
MAX_LENGTH: 1024 * 64,
|
|
160314
160587
|
POSIX_REGEX_SOURCE: {
|
|
160588
|
+
__proto__: null,
|
|
160315
160589
|
alnum: "a-zA-Z0-9",
|
|
160316
160590
|
alpha: "a-zA-Z",
|
|
160317
160591
|
ascii: "\\x00-\\x7F",
|
|
@@ -160417,7 +160691,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160417
160691
|
};
|
|
160418
160692
|
}));
|
|
160419
160693
|
//#endregion
|
|
160420
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160694
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
160421
160695
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
160422
160696
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
160423
160697
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -160465,7 +160739,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
160465
160739
|
};
|
|
160466
160740
|
}));
|
|
160467
160741
|
//#endregion
|
|
160468
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
160742
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
160469
160743
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160470
160744
|
const utils = require_utils();
|
|
160471
160745
|
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 +161026,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160752
161026
|
module.exports = scan;
|
|
160753
161027
|
}));
|
|
160754
161028
|
//#endregion
|
|
160755
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
161029
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
160756
161030
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160757
161031
|
const constants = require_constants();
|
|
160758
161032
|
const utils = require_utils();
|
|
@@ -160780,6 +161054,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160780
161054
|
const syntaxError = (type, char) => {
|
|
160781
161055
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
160782
161056
|
};
|
|
161057
|
+
const splitTopLevel = (input) => {
|
|
161058
|
+
const parts = [];
|
|
161059
|
+
let bracket = 0;
|
|
161060
|
+
let paren = 0;
|
|
161061
|
+
let quote = 0;
|
|
161062
|
+
let value = "";
|
|
161063
|
+
let escaped = false;
|
|
161064
|
+
for (const ch of input) {
|
|
161065
|
+
if (escaped === true) {
|
|
161066
|
+
value += ch;
|
|
161067
|
+
escaped = false;
|
|
161068
|
+
continue;
|
|
161069
|
+
}
|
|
161070
|
+
if (ch === "\\") {
|
|
161071
|
+
value += ch;
|
|
161072
|
+
escaped = true;
|
|
161073
|
+
continue;
|
|
161074
|
+
}
|
|
161075
|
+
if (ch === "\"") {
|
|
161076
|
+
quote = quote === 1 ? 0 : 1;
|
|
161077
|
+
value += ch;
|
|
161078
|
+
continue;
|
|
161079
|
+
}
|
|
161080
|
+
if (quote === 0) {
|
|
161081
|
+
if (ch === "[") bracket++;
|
|
161082
|
+
else if (ch === "]" && bracket > 0) bracket--;
|
|
161083
|
+
else if (bracket === 0) {
|
|
161084
|
+
if (ch === "(") paren++;
|
|
161085
|
+
else if (ch === ")" && paren > 0) paren--;
|
|
161086
|
+
else if (ch === "|" && paren === 0) {
|
|
161087
|
+
parts.push(value);
|
|
161088
|
+
value = "";
|
|
161089
|
+
continue;
|
|
161090
|
+
}
|
|
161091
|
+
}
|
|
161092
|
+
}
|
|
161093
|
+
value += ch;
|
|
161094
|
+
}
|
|
161095
|
+
parts.push(value);
|
|
161096
|
+
return parts;
|
|
161097
|
+
};
|
|
161098
|
+
const isPlainBranch = (branch) => {
|
|
161099
|
+
let escaped = false;
|
|
161100
|
+
for (const ch of branch) {
|
|
161101
|
+
if (escaped === true) {
|
|
161102
|
+
escaped = false;
|
|
161103
|
+
continue;
|
|
161104
|
+
}
|
|
161105
|
+
if (ch === "\\") {
|
|
161106
|
+
escaped = true;
|
|
161107
|
+
continue;
|
|
161108
|
+
}
|
|
161109
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
161110
|
+
}
|
|
161111
|
+
return true;
|
|
161112
|
+
};
|
|
161113
|
+
const normalizeSimpleBranch = (branch) => {
|
|
161114
|
+
let value = branch.trim();
|
|
161115
|
+
let changed = true;
|
|
161116
|
+
while (changed === true) {
|
|
161117
|
+
changed = false;
|
|
161118
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
161119
|
+
value = value.slice(2, -1);
|
|
161120
|
+
changed = true;
|
|
161121
|
+
}
|
|
161122
|
+
}
|
|
161123
|
+
if (!isPlainBranch(value)) return;
|
|
161124
|
+
return value.replace(/\\(.)/g, "$1");
|
|
161125
|
+
};
|
|
161126
|
+
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
161127
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
161128
|
+
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
161129
|
+
const a = values[i];
|
|
161130
|
+
const b = values[j];
|
|
161131
|
+
const char = a[0];
|
|
161132
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
161133
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
161134
|
+
}
|
|
161135
|
+
return false;
|
|
161136
|
+
};
|
|
161137
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
161138
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
161139
|
+
let bracket = 0;
|
|
161140
|
+
let paren = 0;
|
|
161141
|
+
let quote = 0;
|
|
161142
|
+
let escaped = false;
|
|
161143
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
161144
|
+
const ch = pattern[i];
|
|
161145
|
+
if (escaped === true) {
|
|
161146
|
+
escaped = false;
|
|
161147
|
+
continue;
|
|
161148
|
+
}
|
|
161149
|
+
if (ch === "\\") {
|
|
161150
|
+
escaped = true;
|
|
161151
|
+
continue;
|
|
161152
|
+
}
|
|
161153
|
+
if (ch === "\"") {
|
|
161154
|
+
quote = quote === 1 ? 0 : 1;
|
|
161155
|
+
continue;
|
|
161156
|
+
}
|
|
161157
|
+
if (quote === 1) continue;
|
|
161158
|
+
if (ch === "[") {
|
|
161159
|
+
bracket++;
|
|
161160
|
+
continue;
|
|
161161
|
+
}
|
|
161162
|
+
if (ch === "]" && bracket > 0) {
|
|
161163
|
+
bracket--;
|
|
161164
|
+
continue;
|
|
161165
|
+
}
|
|
161166
|
+
if (bracket > 0) continue;
|
|
161167
|
+
if (ch === "(") {
|
|
161168
|
+
paren++;
|
|
161169
|
+
continue;
|
|
161170
|
+
}
|
|
161171
|
+
if (ch === ")") {
|
|
161172
|
+
paren--;
|
|
161173
|
+
if (paren === 0) {
|
|
161174
|
+
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
161175
|
+
return {
|
|
161176
|
+
type: pattern[0],
|
|
161177
|
+
body: pattern.slice(2, i),
|
|
161178
|
+
end: i
|
|
161179
|
+
};
|
|
161180
|
+
}
|
|
161181
|
+
}
|
|
161182
|
+
}
|
|
161183
|
+
};
|
|
161184
|
+
const getStarExtglobSequenceOutput = (pattern) => {
|
|
161185
|
+
let index = 0;
|
|
161186
|
+
const chars = [];
|
|
161187
|
+
while (index < pattern.length) {
|
|
161188
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
161189
|
+
if (!match || match.type !== "*") return;
|
|
161190
|
+
const branches = splitTopLevel(match.body).map((branch) => branch.trim());
|
|
161191
|
+
if (branches.length !== 1) return;
|
|
161192
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
161193
|
+
if (!branch || branch.length !== 1) return;
|
|
161194
|
+
chars.push(branch);
|
|
161195
|
+
index += match.end + 1;
|
|
161196
|
+
}
|
|
161197
|
+
if (chars.length < 1) return;
|
|
161198
|
+
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
161199
|
+
};
|
|
161200
|
+
const repeatedExtglobRecursion = (pattern) => {
|
|
161201
|
+
let depth = 0;
|
|
161202
|
+
let value = pattern.trim();
|
|
161203
|
+
let match = parseRepeatedExtglob(value);
|
|
161204
|
+
while (match) {
|
|
161205
|
+
depth++;
|
|
161206
|
+
value = match.body.trim();
|
|
161207
|
+
match = parseRepeatedExtglob(value);
|
|
161208
|
+
}
|
|
161209
|
+
return depth;
|
|
161210
|
+
};
|
|
161211
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
161212
|
+
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
161213
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
161214
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
161215
|
+
if (branches.length > 1) {
|
|
161216
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
161217
|
+
}
|
|
161218
|
+
for (const branch of branches) {
|
|
161219
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
161220
|
+
if (safeOutput) return {
|
|
161221
|
+
risky: true,
|
|
161222
|
+
safeOutput
|
|
161223
|
+
};
|
|
161224
|
+
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
161225
|
+
}
|
|
161226
|
+
return { risky: false };
|
|
161227
|
+
};
|
|
160783
161228
|
/**
|
|
160784
161229
|
* Parse the given input string.
|
|
160785
161230
|
* @param {String} input
|
|
@@ -160909,6 +161354,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160909
161354
|
token.prev = prev;
|
|
160910
161355
|
token.parens = state.parens;
|
|
160911
161356
|
token.output = state.output;
|
|
161357
|
+
token.startIndex = state.index;
|
|
161358
|
+
token.tokensIndex = tokens.length;
|
|
160912
161359
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
160913
161360
|
increment("parens");
|
|
160914
161361
|
push({
|
|
@@ -160925,6 +161372,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160925
161372
|
extglobs.push(token);
|
|
160926
161373
|
};
|
|
160927
161374
|
const extglobClose = (token) => {
|
|
161375
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
161376
|
+
const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
|
|
161377
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
161378
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
161379
|
+
const open = tokens[token.tokensIndex];
|
|
161380
|
+
open.type = "text";
|
|
161381
|
+
open.value = literal;
|
|
161382
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
161383
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
161384
|
+
tokens[i].value = "";
|
|
161385
|
+
tokens[i].output = "";
|
|
161386
|
+
delete tokens[i].suffix;
|
|
161387
|
+
}
|
|
161388
|
+
state.output = token.output + open.output;
|
|
161389
|
+
state.backtrack = true;
|
|
161390
|
+
push({
|
|
161391
|
+
type: "paren",
|
|
161392
|
+
extglob: true,
|
|
161393
|
+
value,
|
|
161394
|
+
output: ""
|
|
161395
|
+
});
|
|
161396
|
+
decrement("parens");
|
|
161397
|
+
return;
|
|
161398
|
+
}
|
|
160928
161399
|
let output = token.close + (opts.capture ? ")" : "");
|
|
160929
161400
|
let rest;
|
|
160930
161401
|
if (token.type === "negate") {
|
|
@@ -161610,7 +162081,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161610
162081
|
module.exports = parse;
|
|
161611
162082
|
}));
|
|
161612
162083
|
//#endregion
|
|
161613
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
162084
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
161614
162085
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
161615
162086
|
const scan = require_scan();
|
|
161616
162087
|
const parse = require_parse();
|
|
@@ -161820,6 +162291,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161820
162291
|
* Compile a regular expression from the `state` object returned by the
|
|
161821
162292
|
* [parse()](#parse) method.
|
|
161822
162293
|
*
|
|
162294
|
+
* ```js
|
|
162295
|
+
* const picomatch = require('picomatch');
|
|
162296
|
+
* const state = picomatch.parse('*.js');
|
|
162297
|
+
* // picomatch.compileRe(state[, options]);
|
|
162298
|
+
*
|
|
162299
|
+
* console.log(picomatch.compileRe(state));
|
|
162300
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
162301
|
+
* ```
|
|
161823
162302
|
* @param {Object} `state`
|
|
161824
162303
|
* @param {Object} `options`
|
|
161825
162304
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -161843,10 +162322,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161843
162322
|
*
|
|
161844
162323
|
* ```js
|
|
161845
162324
|
* const picomatch = require('picomatch');
|
|
161846
|
-
*
|
|
161847
|
-
* // picomatch.compileRe(state[, options]);
|
|
162325
|
+
* // picomatch.makeRe(state[, options]);
|
|
161848
162326
|
*
|
|
161849
|
-
*
|
|
162327
|
+
* const result = picomatch.makeRe('*.js');
|
|
162328
|
+
* console.log(result);
|
|
161850
162329
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
161851
162330
|
* ```
|
|
161852
162331
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -161902,7 +162381,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161902
162381
|
module.exports = picomatch;
|
|
161903
162382
|
}));
|
|
161904
162383
|
//#endregion
|
|
161905
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
162384
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
|
|
161906
162385
|
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
161907
162386
|
const pico = require_picomatch$1();
|
|
161908
162387
|
const utils = require_utils();
|
|
@@ -161917,7 +162396,7 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
161917
162396
|
module.exports = picomatch;
|
|
161918
162397
|
}));
|
|
161919
162398
|
//#endregion
|
|
161920
|
-
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.
|
|
162399
|
+
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.cjs
|
|
161921
162400
|
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
161922
162401
|
var __create = Object.create;
|
|
161923
162402
|
var __defProp = Object.defineProperty;
|
|
@@ -161939,11 +162418,11 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
161939
162418
|
value: mod,
|
|
161940
162419
|
enumerable: true
|
|
161941
162420
|
}) : target, mod));
|
|
161942
|
-
const path$
|
|
162421
|
+
const path$4 = __toESM(__require("path"));
|
|
161943
162422
|
const fs$3 = __toESM(__require("fs"));
|
|
161944
162423
|
function cleanPath(path$1) {
|
|
161945
|
-
let normalized = (0, path$
|
|
161946
|
-
if (normalized.length > 1 && normalized[normalized.length - 1] === path$
|
|
162424
|
+
let normalized = (0, path$4.normalize)(path$1);
|
|
162425
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === path$4.sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
161947
162426
|
return normalized;
|
|
161948
162427
|
}
|
|
161949
162428
|
const SLASHES_REGEX = /[\\/]/g;
|
|
@@ -161957,7 +162436,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
161957
162436
|
function normalizePath(path$1, options) {
|
|
161958
162437
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
161959
162438
|
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
|
|
161960
|
-
if (resolvePaths) path$1 = (0, path$
|
|
162439
|
+
if (resolvePaths) path$1 = (0, path$4.resolve)(path$1);
|
|
161961
162440
|
if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
161962
162441
|
if (path$1 === ".") return "";
|
|
161963
162442
|
return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
|
|
@@ -161968,7 +162447,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
161968
162447
|
function joinPathWithRelativePath(root, options) {
|
|
161969
162448
|
return function(filename, directoryPath) {
|
|
161970
162449
|
if (directoryPath.startsWith(root)) return directoryPath.slice(root.length) + filename;
|
|
161971
|
-
else return convertSlashes((0, path$
|
|
162450
|
+
else return convertSlashes((0, path$4.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
161972
162451
|
};
|
|
161973
162452
|
}
|
|
161974
162453
|
function joinPath(filename) {
|
|
@@ -162077,12 +162556,12 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162077
162556
|
}
|
|
162078
162557
|
function isRecursive(path$1, resolved, state) {
|
|
162079
162558
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
162080
|
-
let parent = (0, path$
|
|
162559
|
+
let parent = (0, path$4.dirname)(path$1);
|
|
162081
162560
|
let depth = 1;
|
|
162082
162561
|
while (parent !== state.root && depth < 2) {
|
|
162083
162562
|
const resolvedPath = state.symlinks.get(parent);
|
|
162084
162563
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth++;
|
|
162085
|
-
else parent = (0, path$
|
|
162564
|
+
else parent = (0, path$4.dirname)(parent);
|
|
162086
162565
|
}
|
|
162087
162566
|
state.symlinks.set(path$1, resolved);
|
|
162088
162567
|
return depth > 1;
|
|
@@ -162278,8 +162757,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162278
162757
|
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk);
|
|
162279
162758
|
} else {
|
|
162280
162759
|
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
162281
|
-
const filename = (0, path$
|
|
162282
|
-
const directoryPath$1 = normalizePath((0, path$
|
|
162760
|
+
const filename = (0, path$4.basename)(resolvedPath);
|
|
162761
|
+
const directoryPath$1 = normalizePath((0, path$4.dirname)(resolvedPath), this.state.options);
|
|
162283
162762
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
162284
162763
|
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
162285
162764
|
}
|
|
@@ -162329,7 +162808,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162329
162808
|
options = {
|
|
162330
162809
|
maxDepth: Infinity,
|
|
162331
162810
|
suppressErrors: true,
|
|
162332
|
-
pathSeparator: path$
|
|
162811
|
+
pathSeparator: path$4.sep,
|
|
162333
162812
|
filters: []
|
|
162334
162813
|
};
|
|
162335
162814
|
globFunction;
|
|
@@ -162449,8 +162928,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162449
162928
|
exports.fdir = Builder;
|
|
162450
162929
|
}));
|
|
162451
162930
|
//#endregion
|
|
162452
|
-
//#region ../../node_modules/.pnpm/tinyglobby@0.2.
|
|
162931
|
+
//#region ../../node_modules/.pnpm/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.cjs
|
|
162453
162932
|
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
162933
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
162454
162934
|
var __create = Object.create;
|
|
162455
162935
|
var __defProp = Object.defineProperty;
|
|
162456
162936
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -162472,45 +162952,42 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162472
162952
|
enumerable: true
|
|
162473
162953
|
}) : target, mod));
|
|
162474
162954
|
let fs$2 = __require("fs");
|
|
162475
|
-
|
|
162476
|
-
let path$1 = __require("path");
|
|
162477
|
-
path$1 = __toESM(path$1);
|
|
162955
|
+
let path$6 = __require("path");
|
|
162478
162956
|
let url = __require("url");
|
|
162479
|
-
url = __toESM(url);
|
|
162480
162957
|
let fdir = require_dist$1();
|
|
162481
|
-
fdir = __toESM(fdir);
|
|
162482
162958
|
let picomatch = require_picomatch();
|
|
162483
162959
|
picomatch = __toESM(picomatch);
|
|
162484
162960
|
const isReadonlyArray = Array.isArray;
|
|
162961
|
+
const BACKSLASHES = /\\/g;
|
|
162485
162962
|
const isWin = process.platform === "win32";
|
|
162486
162963
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
162487
162964
|
function getPartialMatcher(patterns, options = {}) {
|
|
162488
162965
|
const patternsCount = patterns.length;
|
|
162489
162966
|
const patternsParts = Array(patternsCount);
|
|
162490
162967
|
const matchers = Array(patternsCount);
|
|
162491
|
-
|
|
162492
|
-
for (
|
|
162968
|
+
let i, j;
|
|
162969
|
+
for (i = 0; i < patternsCount; i++) {
|
|
162493
162970
|
const parts = splitPattern(patterns[i]);
|
|
162494
162971
|
patternsParts[i] = parts;
|
|
162495
162972
|
const partsCount = parts.length;
|
|
162496
162973
|
const partMatchers = Array(partsCount);
|
|
162497
|
-
for (
|
|
162974
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = (0, picomatch.default)(parts[j], options);
|
|
162498
162975
|
matchers[i] = partMatchers;
|
|
162499
162976
|
}
|
|
162500
162977
|
return (input) => {
|
|
162501
162978
|
const inputParts = input.split("/");
|
|
162502
162979
|
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
162503
|
-
for (
|
|
162980
|
+
for (i = 0; i < patternsCount; i++) {
|
|
162504
162981
|
const patternParts = patternsParts[i];
|
|
162505
162982
|
const matcher = matchers[i];
|
|
162506
162983
|
const inputPatternCount = inputParts.length;
|
|
162507
162984
|
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
162508
|
-
|
|
162985
|
+
j = 0;
|
|
162509
162986
|
while (j < minParts) {
|
|
162510
162987
|
const part = patternParts[j];
|
|
162511
162988
|
if (part.includes("/")) return true;
|
|
162512
162989
|
if (!matcher[j](inputParts[j])) break;
|
|
162513
|
-
if (
|
|
162990
|
+
if (!options.noglobstar && part === "**") return true;
|
|
162514
162991
|
j++;
|
|
162515
162992
|
}
|
|
162516
162993
|
if (j === inputPatternCount) return true;
|
|
@@ -162524,7 +163001,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162524
163001
|
function buildFormat(cwd, root, absolute) {
|
|
162525
163002
|
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
162526
163003
|
if (absolute) {
|
|
162527
|
-
const start =
|
|
163004
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
162528
163005
|
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
162529
163006
|
}
|
|
162530
163007
|
const prefix = root.slice(cwd.length + 1);
|
|
@@ -162535,8 +163012,8 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162535
163012
|
};
|
|
162536
163013
|
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
162537
163014
|
}
|
|
162538
|
-
if (absolute) return (p) => path$
|
|
162539
|
-
return (p) => path$
|
|
163015
|
+
if (absolute) return (p) => path$6.posix.relative(cwd, p) || ".";
|
|
163016
|
+
return (p) => path$6.posix.relative(cwd, `${root}/${p}`) || ".";
|
|
162540
163017
|
}
|
|
162541
163018
|
function buildRelative(cwd, root) {
|
|
162542
163019
|
if (root.startsWith(`${cwd}/`)) {
|
|
@@ -162544,23 +163021,22 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162544
163021
|
return (p) => `${prefix}/${p}`;
|
|
162545
163022
|
}
|
|
162546
163023
|
return (p) => {
|
|
162547
|
-
const result = path$
|
|
162548
|
-
|
|
162549
|
-
return result || ".";
|
|
163024
|
+
const result = path$6.posix.relative(cwd, `${root}/${p}`);
|
|
163025
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
162550
163026
|
};
|
|
162551
163027
|
}
|
|
162552
163028
|
const splitPatternOptions = { parts: true };
|
|
162553
|
-
function splitPattern(path$
|
|
163029
|
+
function splitPattern(path$1) {
|
|
162554
163030
|
var _result$parts;
|
|
162555
|
-
const result = picomatch.default.scan(path$
|
|
162556
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$
|
|
163031
|
+
const result = picomatch.default.scan(path$1, splitPatternOptions);
|
|
163032
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
162557
163033
|
}
|
|
162558
163034
|
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
162559
163035
|
function convertPosixPathToPattern(path$2) {
|
|
162560
163036
|
return escapePosixPath(path$2);
|
|
162561
163037
|
}
|
|
162562
|
-
function convertWin32PathToPattern(path$
|
|
162563
|
-
return escapeWin32Path(path$
|
|
163038
|
+
function convertWin32PathToPattern(path$3) {
|
|
163039
|
+
return escapeWin32Path(path$3).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
162564
163040
|
}
|
|
162565
163041
|
/**
|
|
162566
163042
|
* Converts a path to a pattern depending on the platform.
|
|
@@ -162571,8 +163047,8 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162571
163047
|
const convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
|
|
162572
163048
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
162573
163049
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
162574
|
-
const escapePosixPath = (path$
|
|
162575
|
-
const escapeWin32Path = (path$
|
|
163050
|
+
const escapePosixPath = (path$4) => path$4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
163051
|
+
const escapeWin32Path = (path$5) => path$5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
162576
163052
|
/**
|
|
162577
163053
|
* Escapes a path's special characters depending on the platform.
|
|
162578
163054
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -162599,28 +163075,31 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162599
163075
|
function log(...tasks) {
|
|
162600
163076
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
162601
163077
|
}
|
|
163078
|
+
function ensureStringArray(value) {
|
|
163079
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
163080
|
+
}
|
|
162602
163081
|
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
162603
163082
|
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
162604
|
-
|
|
162605
|
-
|
|
163083
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
163084
|
+
var _PARENT_DIRECTORY$exe;
|
|
163085
|
+
const cwd = opts.cwd;
|
|
162606
163086
|
let result = pattern;
|
|
162607
|
-
if (pattern.
|
|
162608
|
-
if (
|
|
163087
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
163088
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
162609
163089
|
const escapedCwd = escapePath(cwd);
|
|
162610
|
-
|
|
162611
|
-
|
|
162612
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
163090
|
+
result = (0, path$6.isAbsolute)(result.replace(ESCAPING_BACKSLASHES, "")) ? path$6.posix.relative(escapedCwd, result) : path$6.posix.normalize(result);
|
|
163091
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
162613
163092
|
const parts = splitPattern(result);
|
|
162614
|
-
if (
|
|
162615
|
-
const n = (
|
|
163093
|
+
if (parentDir) {
|
|
163094
|
+
const n = (parentDir.length + 1) / 3;
|
|
162616
163095
|
let i = 0;
|
|
162617
163096
|
const cwdParts = escapedCwd.split("/");
|
|
162618
163097
|
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
162619
163098
|
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
162620
163099
|
i++;
|
|
162621
163100
|
}
|
|
162622
|
-
const potentialRoot = path$
|
|
162623
|
-
if (
|
|
163101
|
+
const potentialRoot = path$6.posix.join(cwd, parentDir.slice(i * 3));
|
|
163102
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
162624
163103
|
props.root = potentialRoot;
|
|
162625
163104
|
props.depthOffset = -n + i;
|
|
162626
163105
|
}
|
|
@@ -162636,152 +163115,139 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162636
163115
|
newCommonPath.pop();
|
|
162637
163116
|
break;
|
|
162638
163117
|
}
|
|
162639
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part)
|
|
163118
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
162640
163119
|
newCommonPath.push(part);
|
|
162641
163120
|
}
|
|
162642
163121
|
props.depthOffset = newCommonPath.length;
|
|
162643
163122
|
props.commonPath = newCommonPath;
|
|
162644
|
-
props.root = newCommonPath.length > 0 ? path$
|
|
163123
|
+
props.root = newCommonPath.length > 0 ? path$6.posix.join(cwd, ...newCommonPath) : cwd;
|
|
162645
163124
|
}
|
|
162646
163125
|
return result;
|
|
162647
163126
|
}
|
|
162648
|
-
function processPatterns(
|
|
162649
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
162650
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
163127
|
+
function processPatterns(options, patterns, props) {
|
|
162651
163128
|
const matchPatterns = [];
|
|
162652
163129
|
const ignorePatterns = [];
|
|
162653
|
-
for (const pattern of ignore) {
|
|
163130
|
+
for (const pattern of options.ignore) {
|
|
162654
163131
|
if (!pattern) continue;
|
|
162655
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern,
|
|
163132
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
162656
163133
|
}
|
|
162657
163134
|
for (const pattern of patterns) {
|
|
162658
163135
|
if (!pattern) continue;
|
|
162659
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern,
|
|
162660
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1),
|
|
163136
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
163137
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
162661
163138
|
}
|
|
162662
163139
|
return {
|
|
162663
163140
|
match: matchPatterns,
|
|
162664
163141
|
ignore: ignorePatterns
|
|
162665
163142
|
};
|
|
162666
163143
|
}
|
|
162667
|
-
function
|
|
162668
|
-
|
|
162669
|
-
const path$2 = paths[i];
|
|
162670
|
-
paths[i] = relative(path$2);
|
|
162671
|
-
}
|
|
162672
|
-
return paths;
|
|
162673
|
-
}
|
|
162674
|
-
function normalizeCwd(cwd) {
|
|
162675
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
162676
|
-
if (cwd instanceof URL) return (0, url.fileURLToPath)(cwd).replace(BACKSLASHES, "/");
|
|
162677
|
-
return path$1.default.resolve(cwd).replace(BACKSLASHES, "/");
|
|
162678
|
-
}
|
|
162679
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
162680
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
162681
|
-
...inputOptions,
|
|
162682
|
-
debug: true
|
|
162683
|
-
} : inputOptions;
|
|
162684
|
-
const cwd = normalizeCwd(options.cwd);
|
|
162685
|
-
if (options.debug) log("globbing with:", {
|
|
162686
|
-
patterns,
|
|
162687
|
-
options,
|
|
162688
|
-
cwd
|
|
162689
|
-
});
|
|
162690
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
162691
|
-
sync: () => [],
|
|
162692
|
-
withPromise: async () => []
|
|
162693
|
-
}, false];
|
|
163144
|
+
function buildCrawler(options, patterns) {
|
|
163145
|
+
const cwd = options.cwd;
|
|
162694
163146
|
const props = {
|
|
162695
163147
|
root: cwd,
|
|
162696
|
-
commonPath: null,
|
|
162697
163148
|
depthOffset: 0
|
|
162698
163149
|
};
|
|
162699
|
-
const processed = processPatterns(
|
|
162700
|
-
...options,
|
|
162701
|
-
patterns
|
|
162702
|
-
}, cwd, props);
|
|
163150
|
+
const processed = processPatterns(options, patterns, props);
|
|
162703
163151
|
if (options.debug) log("internal processing patterns:", processed);
|
|
163152
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
163153
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
162704
163154
|
const matchOptions = {
|
|
162705
|
-
dot
|
|
163155
|
+
dot,
|
|
162706
163156
|
nobrace: options.braceExpansion === false,
|
|
162707
|
-
nocase:
|
|
163157
|
+
nocase: !caseSensitiveMatch,
|
|
162708
163158
|
noextglob: options.extglob === false,
|
|
162709
163159
|
noglobstar: options.globstar === false,
|
|
162710
163160
|
posix: true
|
|
162711
163161
|
};
|
|
162712
|
-
const matcher = (0, picomatch.default)(processed.match,
|
|
162713
|
-
...matchOptions,
|
|
162714
|
-
ignore: processed.ignore
|
|
162715
|
-
});
|
|
163162
|
+
const matcher = (0, picomatch.default)(processed.match, matchOptions);
|
|
162716
163163
|
const ignore = (0, picomatch.default)(processed.ignore, matchOptions);
|
|
162717
163164
|
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
162718
|
-
const format = buildFormat(cwd,
|
|
162719
|
-
const
|
|
162720
|
-
const
|
|
162721
|
-
|
|
162722
|
-
|
|
162723
|
-
|
|
162724
|
-
|
|
163165
|
+
const format = buildFormat(cwd, root, absolute);
|
|
163166
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
163167
|
+
const excludePredicate = (_, p) => {
|
|
163168
|
+
const relativePath = excludeFormatter(p, true);
|
|
163169
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
163170
|
+
};
|
|
163171
|
+
let maxDepth;
|
|
163172
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
163173
|
+
const crawler = new fdir.fdir({
|
|
163174
|
+
filters: [debug ? (p, isDirectory) => {
|
|
163175
|
+
const path = format(p, isDirectory);
|
|
163176
|
+
const matches = matcher(path) && !ignore(path);
|
|
163177
|
+
if (matches) log(`matched ${path}`);
|
|
162725
163178
|
return matches;
|
|
162726
|
-
} : (p, isDirectory) =>
|
|
162727
|
-
|
|
162728
|
-
|
|
162729
|
-
|
|
162730
|
-
|
|
162731
|
-
|
|
163179
|
+
} : (p, isDirectory) => {
|
|
163180
|
+
const path = format(p, isDirectory);
|
|
163181
|
+
return matcher(path) && !ignore(path);
|
|
163182
|
+
}],
|
|
163183
|
+
exclude: debug ? (_, p) => {
|
|
163184
|
+
const skipped = excludePredicate(_, p);
|
|
163185
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
162732
163186
|
return skipped;
|
|
162733
|
-
} :
|
|
162734
|
-
|
|
162735
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
162736
|
-
},
|
|
162737
|
-
fs: options.fs ? {
|
|
162738
|
-
readdir: options.fs.readdir || fs$2.default.readdir,
|
|
162739
|
-
readdirSync: options.fs.readdirSync || fs$2.default.readdirSync,
|
|
162740
|
-
realpath: options.fs.realpath || fs$2.default.realpath,
|
|
162741
|
-
realpathSync: options.fs.realpathSync || fs$2.default.realpathSync,
|
|
162742
|
-
stat: options.fs.stat || fs$2.default.stat,
|
|
162743
|
-
statSync: options.fs.statSync || fs$2.default.statSync
|
|
162744
|
-
} : void 0,
|
|
163187
|
+
} : excludePredicate,
|
|
163188
|
+
fs: options.fs,
|
|
162745
163189
|
pathSeparator: "/",
|
|
162746
|
-
relativePaths:
|
|
162747
|
-
|
|
163190
|
+
relativePaths: !absolute,
|
|
163191
|
+
resolvePaths: absolute,
|
|
163192
|
+
includeBasePath: absolute,
|
|
163193
|
+
resolveSymlinks: followSymbolicLinks,
|
|
163194
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
163195
|
+
excludeFiles: onlyDirectories,
|
|
163196
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
163197
|
+
maxDepth,
|
|
162748
163198
|
signal: options.signal
|
|
163199
|
+
}).crawl(root);
|
|
163200
|
+
if (options.debug) log("internal properties:", {
|
|
163201
|
+
...props,
|
|
163202
|
+
root
|
|
163203
|
+
});
|
|
163204
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
163205
|
+
}
|
|
163206
|
+
function formatPaths(paths, mapper) {
|
|
163207
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
163208
|
+
return paths;
|
|
163209
|
+
}
|
|
163210
|
+
const defaultOptions = {
|
|
163211
|
+
caseSensitiveMatch: true,
|
|
163212
|
+
cwd: process.cwd(),
|
|
163213
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
163214
|
+
expandDirectories: true,
|
|
163215
|
+
followSymbolicLinks: true,
|
|
163216
|
+
onlyFiles: true
|
|
163217
|
+
};
|
|
163218
|
+
function getOptions(options) {
|
|
163219
|
+
const opts = {
|
|
163220
|
+
...defaultOptions,
|
|
163221
|
+
...options
|
|
162749
163222
|
};
|
|
162750
|
-
|
|
162751
|
-
|
|
162752
|
-
|
|
162753
|
-
|
|
162754
|
-
|
|
162755
|
-
|
|
162756
|
-
|
|
162757
|
-
|
|
162758
|
-
|
|
162759
|
-
}
|
|
162760
|
-
if (
|
|
162761
|
-
|
|
162762
|
-
|
|
162763
|
-
|
|
162764
|
-
|
|
162765
|
-
|
|
162766
|
-
|
|
162767
|
-
const
|
|
162768
|
-
|
|
162769
|
-
|
|
162770
|
-
|
|
162771
|
-
|
|
162772
|
-
const
|
|
162773
|
-
|
|
162774
|
-
|
|
162775
|
-
|
|
162776
|
-
|
|
162777
|
-
|
|
162778
|
-
function globSync(patternsOrOptions, options) {
|
|
162779
|
-
if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
162780
|
-
const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
|
|
162781
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
162782
|
-
const [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
162783
|
-
if (!relative) return crawler.sync();
|
|
162784
|
-
return formatPaths(crawler.sync(), relative);
|
|
163223
|
+
opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path$6.resolve)(opts.cwd)).replace(BACKSLASHES, "/");
|
|
163224
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
163225
|
+
opts.fs && (opts.fs = {
|
|
163226
|
+
readdir: opts.fs.readdir || fs$2.readdir,
|
|
163227
|
+
readdirSync: opts.fs.readdirSync || fs$2.readdirSync,
|
|
163228
|
+
realpath: opts.fs.realpath || fs$2.realpath,
|
|
163229
|
+
realpathSync: opts.fs.realpathSync || fs$2.realpathSync,
|
|
163230
|
+
stat: opts.fs.stat || fs$2.stat,
|
|
163231
|
+
statSync: opts.fs.statSync || fs$2.statSync
|
|
163232
|
+
});
|
|
163233
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
163234
|
+
return opts;
|
|
163235
|
+
}
|
|
163236
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
163237
|
+
var _ref;
|
|
163238
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
163239
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
163240
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
163241
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
163242
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
163243
|
+
}
|
|
163244
|
+
async function glob(globInput, options) {
|
|
163245
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
163246
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
|
|
163247
|
+
}
|
|
163248
|
+
function globSync(globInput, options) {
|
|
163249
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
163250
|
+
return crawler ? formatPaths(crawler.sync(), relative) : [];
|
|
162785
163251
|
}
|
|
162786
163252
|
exports.convertPathToPattern = convertPathToPattern;
|
|
162787
163253
|
exports.escapePath = escapePath;
|
|
@@ -186210,7 +186676,7 @@ var require_ts_morph = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
186210
186676
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
186211
186677
|
require_dist$2();
|
|
186212
186678
|
require_ts_morph();
|
|
186213
|
-
const CLI_VERSION = "0.
|
|
186679
|
+
const CLI_VERSION = "0.4.1";
|
|
186214
186680
|
const PACKAGE_NAME = "@supaslidev/cli";
|
|
186215
186681
|
const CACHE_DIR = join(tmpdir(), "supaslidev-cli");
|
|
186216
186682
|
const CACHE_FILE = join(CACHE_DIR, "version-cache.json");
|
|
@@ -186285,7 +186751,7 @@ function checkForUpdatesCached() {
|
|
|
186285
186751
|
const SUPASLIDEV_FALLBACK_VERSION = "0.1.4";
|
|
186286
186752
|
function createSafeSpinner() {
|
|
186287
186753
|
if (process.stdout.isTTY && process.stdin.isTTY) {
|
|
186288
|
-
const spinner =
|
|
186754
|
+
const spinner = fe();
|
|
186289
186755
|
return {
|
|
186290
186756
|
start: (msg) => spinner.start(msg),
|
|
186291
186757
|
stop: (msg) => spinner.stop(msg),
|
|
@@ -186539,24 +187005,24 @@ async function create(options = {}) {
|
|
|
186539
187005
|
initGit = options.git ?? true;
|
|
186540
187006
|
runInstall = options.install ?? true;
|
|
186541
187007
|
if (!/^[a-z0-9-]+$/.test(projectName)) {
|
|
186542
|
-
|
|
187008
|
+
O.error("Project name must be lowercase alphanumeric with hyphens only");
|
|
186543
187009
|
process.exit(1);
|
|
186544
187010
|
}
|
|
186545
187011
|
if (projectName.startsWith("-") || projectName.endsWith("-")) {
|
|
186546
|
-
|
|
187012
|
+
O.error("Project name cannot start or end with a hyphen");
|
|
186547
187013
|
process.exit(1);
|
|
186548
187014
|
}
|
|
186549
187015
|
if (!/^[a-z0-9-]+$/.test(presentationName)) {
|
|
186550
|
-
|
|
187016
|
+
O.error("Presentation name must be lowercase alphanumeric with hyphens only");
|
|
186551
187017
|
process.exit(1);
|
|
186552
187018
|
}
|
|
186553
187019
|
if (presentationName.startsWith("-") || presentationName.endsWith("-")) {
|
|
186554
|
-
|
|
187020
|
+
O.error("Presentation name cannot start or end with a hyphen");
|
|
186555
187021
|
process.exit(1);
|
|
186556
187022
|
}
|
|
186557
187023
|
} else {
|
|
186558
|
-
|
|
186559
|
-
const projectNameResult = await
|
|
187024
|
+
mt(import_picocolors.default.cyan("Create a new Supaslidev workspace"));
|
|
187025
|
+
const projectNameResult = await Ot({
|
|
186560
187026
|
message: "What is your project name?",
|
|
186561
187027
|
placeholder: "my-presentations",
|
|
186562
187028
|
validate: (value) => {
|
|
@@ -186565,12 +187031,12 @@ async function create(options = {}) {
|
|
|
186565
187031
|
if (value.startsWith("-") || value.endsWith("-")) return "Project name cannot start or end with a hyphen";
|
|
186566
187032
|
}
|
|
186567
187033
|
});
|
|
186568
|
-
if (
|
|
186569
|
-
|
|
187034
|
+
if (q(projectNameResult)) {
|
|
187035
|
+
pt("Operation cancelled");
|
|
186570
187036
|
process.exit(0);
|
|
186571
187037
|
}
|
|
186572
187038
|
projectName = projectNameResult;
|
|
186573
|
-
const presentationNameResult = await
|
|
187039
|
+
const presentationNameResult = await Ot({
|
|
186574
187040
|
message: "What is the name of your first presentation?",
|
|
186575
187041
|
placeholder: "my-first-deck",
|
|
186576
187042
|
initialValue: "my-first-deck",
|
|
@@ -186580,33 +187046,33 @@ async function create(options = {}) {
|
|
|
186580
187046
|
if (value.startsWith("-") || value.endsWith("-")) return "Presentation name cannot start or end with a hyphen";
|
|
186581
187047
|
}
|
|
186582
187048
|
});
|
|
186583
|
-
if (
|
|
186584
|
-
|
|
187049
|
+
if (q(presentationNameResult)) {
|
|
187050
|
+
pt("Operation cancelled");
|
|
186585
187051
|
process.exit(0);
|
|
186586
187052
|
}
|
|
186587
187053
|
presentationName = presentationNameResult;
|
|
186588
|
-
const initGitResult = await
|
|
187054
|
+
const initGitResult = await ot({
|
|
186589
187055
|
message: "Initialize a git repository?",
|
|
186590
187056
|
initialValue: true
|
|
186591
187057
|
});
|
|
186592
|
-
if (
|
|
186593
|
-
|
|
187058
|
+
if (q(initGitResult)) {
|
|
187059
|
+
pt("Operation cancelled");
|
|
186594
187060
|
process.exit(0);
|
|
186595
187061
|
}
|
|
186596
187062
|
initGit = initGitResult;
|
|
186597
|
-
const runInstallResult = await
|
|
187063
|
+
const runInstallResult = await ot({
|
|
186598
187064
|
message: "Run pnpm install after scaffolding?",
|
|
186599
187065
|
initialValue: true
|
|
186600
187066
|
});
|
|
186601
|
-
if (
|
|
186602
|
-
|
|
187067
|
+
if (q(runInstallResult)) {
|
|
187068
|
+
pt("Operation cancelled");
|
|
186603
187069
|
process.exit(0);
|
|
186604
187070
|
}
|
|
186605
187071
|
runInstall = runInstallResult;
|
|
186606
187072
|
}
|
|
186607
187073
|
const targetDir = join(process.cwd(), projectName);
|
|
186608
187074
|
if (existsSync(targetDir)) {
|
|
186609
|
-
|
|
187075
|
+
O.error(`Directory "${projectName}" already exists`);
|
|
186610
187076
|
process.exit(1);
|
|
186611
187077
|
}
|
|
186612
187078
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -186635,7 +187101,7 @@ async function create(options = {}) {
|
|
|
186635
187101
|
spinner.stop("Git repository initialized");
|
|
186636
187102
|
} catch {
|
|
186637
187103
|
spinner.stop("Failed to initialize git repository");
|
|
186638
|
-
|
|
187104
|
+
O.warn("Git initialization failed. You can run \"git init\" manually.");
|
|
186639
187105
|
}
|
|
186640
187106
|
}
|
|
186641
187107
|
if (runInstall) {
|
|
@@ -186645,11 +187111,11 @@ async function create(options = {}) {
|
|
|
186645
187111
|
spinner.stop("Dependencies installed");
|
|
186646
187112
|
} catch {
|
|
186647
187113
|
spinner.stop("Failed to install dependencies");
|
|
186648
|
-
|
|
187114
|
+
O.warn("Dependency installation failed. You can run \"pnpm install\" manually.");
|
|
186649
187115
|
}
|
|
186650
187116
|
}
|
|
186651
187117
|
createdPaths.length = 0;
|
|
186652
|
-
|
|
187118
|
+
gt(import_picocolors.default.green("Workspace created successfully!"));
|
|
186653
187119
|
console.log("");
|
|
186654
187120
|
console.log(import_picocolors.default.cyan("Next steps:"));
|
|
186655
187121
|
console.log(` ${import_picocolors.default.dim("$")} cd ${projectName}`);
|
|
@@ -186659,12 +187125,12 @@ async function create(options = {}) {
|
|
|
186659
187125
|
} catch (error) {
|
|
186660
187126
|
spinner.stop("Failed");
|
|
186661
187127
|
if (createdPaths.length > 0) {
|
|
186662
|
-
|
|
187128
|
+
O.warn("Cleaning up partial files...");
|
|
186663
187129
|
cleanup();
|
|
186664
|
-
|
|
187130
|
+
O.info("Cleanup complete");
|
|
186665
187131
|
}
|
|
186666
187132
|
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
186667
|
-
|
|
187133
|
+
O.error(message);
|
|
186668
187134
|
process.exit(1);
|
|
186669
187135
|
}
|
|
186670
187136
|
}
|
|
@@ -187192,9 +187658,9 @@ async function loadInteractiveMigration(id) {
|
|
|
187192
187658
|
};
|
|
187193
187659
|
}
|
|
187194
187660
|
async function promptForCatalogSelection(presentations) {
|
|
187195
|
-
|
|
187196
|
-
|
|
187197
|
-
const selected = await
|
|
187661
|
+
mt(import_picocolors.default.cyan("Catalog Conversion Selection"));
|
|
187662
|
+
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");
|
|
187663
|
+
const selected = await yt({
|
|
187198
187664
|
message: "Which presentations should use catalog: references?",
|
|
187199
187665
|
options: presentations.map((pres) => ({
|
|
187200
187666
|
value: pres.name,
|
|
@@ -187204,8 +187670,8 @@ async function promptForCatalogSelection(presentations) {
|
|
|
187204
187670
|
initialValues: presentations.map((p) => p.name),
|
|
187205
187671
|
required: false
|
|
187206
187672
|
});
|
|
187207
|
-
if (
|
|
187208
|
-
|
|
187673
|
+
if (q(selected)) {
|
|
187674
|
+
pt("Migration cancelled");
|
|
187209
187675
|
return {
|
|
187210
187676
|
selectedForCatalog: [],
|
|
187211
187677
|
cancelled: true
|
|
@@ -187213,8 +187679,8 @@ async function promptForCatalogSelection(presentations) {
|
|
|
187213
187679
|
}
|
|
187214
187680
|
const selectedCount = selected.length;
|
|
187215
187681
|
const pinnedCount = presentations.length - selectedCount;
|
|
187216
|
-
if (selectedCount > 0)
|
|
187217
|
-
if (pinnedCount > 0)
|
|
187682
|
+
if (selectedCount > 0) O.success(`${selectedCount} presentation(s) will use catalog: references`);
|
|
187683
|
+
if (pinnedCount > 0) O.info(`${pinnedCount} presentation(s) will use pinned ^52.11.3`);
|
|
187218
187684
|
return {
|
|
187219
187685
|
selectedForCatalog: selected,
|
|
187220
187686
|
cancelled: false
|
|
@@ -187505,6 +187971,17 @@ async function importPresentation(source, options = {}) {
|
|
|
187505
187971
|
console.log(`Run "supaslidev present ${presentationName}" to start a dev server.`);
|
|
187506
187972
|
}
|
|
187507
187973
|
//#endregion
|
|
187974
|
+
//#region src/shared/optimize-thumbnail.ts
|
|
187975
|
+
const THUMBNAIL_WIDTH = 1280;
|
|
187976
|
+
const WEBP_QUALITY = 80;
|
|
187977
|
+
async function optimizeThumbnail(pngPath) {
|
|
187978
|
+
if (!existsSync(pngPath)) throw new Error(`Thumbnail not found: ${pngPath}`);
|
|
187979
|
+
const webpPath = pngPath.replace(/\.png$/, ".webp");
|
|
187980
|
+
await sharp(pngPath).resize(THUMBNAIL_WIDTH, void 0, { withoutEnlargement: true }).webp({ quality: WEBP_QUALITY }).toFile(webpPath);
|
|
187981
|
+
unlinkSync(pngPath);
|
|
187982
|
+
return webpPath;
|
|
187983
|
+
}
|
|
187984
|
+
//#endregion
|
|
187508
187985
|
//#region src/cli/commands/deploy.ts
|
|
187509
187986
|
function findSupaslidevPackageRoot() {
|
|
187510
187987
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -187604,7 +188081,9 @@ async function deploy(options = {}) {
|
|
|
187604
188081
|
console.log(` Base: ${basePath}`);
|
|
187605
188082
|
console.log(` Presentations: ${presentations.join(", ")}`);
|
|
187606
188083
|
console.log("");
|
|
187607
|
-
|
|
188084
|
+
const totalSteps = 5;
|
|
188085
|
+
const thumbnailsDir = join(projectRoot, "thumbnails");
|
|
188086
|
+
console.log(`Step 1/${totalSteps}: Building ${presentations.length} presentation(s)...\n`);
|
|
187608
188087
|
for (const id of presentations) {
|
|
187609
188088
|
const presentationDir = join(presentationsDir, id);
|
|
187610
188089
|
const presentationBase = `${basePath}presentations/${id}/`;
|
|
@@ -187617,9 +188096,37 @@ async function deploy(options = {}) {
|
|
|
187617
188096
|
], { cwd: presentationDir });
|
|
187618
188097
|
console.log(` Done: ${id}\n`);
|
|
187619
188098
|
}
|
|
187620
|
-
console.log(
|
|
187621
|
-
|
|
187622
|
-
|
|
188099
|
+
console.log(`Step 2/${totalSteps}: Generating thumbnails...\n`);
|
|
188100
|
+
if (!existsSync(thumbnailsDir)) mkdirSync(thumbnailsDir, { recursive: true });
|
|
188101
|
+
for (const id of presentations) {
|
|
188102
|
+
const presentationDir = join(presentationsDir, id);
|
|
188103
|
+
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188104
|
+
const outputBase = join(thumbnailsDir, id);
|
|
188105
|
+
const targetFile = join(thumbnailsDir, `${id}.png`);
|
|
188106
|
+
console.log(` Thumbnail: ${id}`);
|
|
188107
|
+
try {
|
|
188108
|
+
await runCommand(slidevBin, [
|
|
188109
|
+
"export",
|
|
188110
|
+
"--format",
|
|
188111
|
+
"png",
|
|
188112
|
+
"--range",
|
|
188113
|
+
"1",
|
|
188114
|
+
"--output",
|
|
188115
|
+
outputBase
|
|
188116
|
+
], { cwd: presentationDir });
|
|
188117
|
+
if (!existsSync(targetFile) && existsSync(outputBase)) {
|
|
188118
|
+
const pngs = readdirSync(outputBase).filter((f) => f.endsWith(".png")).sort();
|
|
188119
|
+
if (pngs.length > 0) renameSync(join(outputBase, pngs[0]), targetFile);
|
|
188120
|
+
}
|
|
188121
|
+
if (existsSync(targetFile)) {
|
|
188122
|
+
await optimizeThumbnail(targetFile);
|
|
188123
|
+
console.log(` Done: ${id}\n`);
|
|
188124
|
+
} else console.warn(` Warning: Thumbnail for "${id}" could not be found after export.\n`);
|
|
188125
|
+
} catch {
|
|
188126
|
+
console.warn(` Warning: Thumbnail generation failed for "${id}", skipping.\n`);
|
|
188127
|
+
}
|
|
188128
|
+
}
|
|
188129
|
+
console.log(`Step 3/${totalSteps}: Building dashboard...\n`);
|
|
187623
188130
|
const nuxt = findNuxtBin(projectRoot, supaslidevRoot);
|
|
187624
188131
|
const nuxtEnv = {
|
|
187625
188132
|
...process.env,
|
|
@@ -187633,7 +188140,12 @@ async function deploy(options = {}) {
|
|
|
187633
188140
|
cwd: supaslidevRoot,
|
|
187634
188141
|
env: nuxtEnv
|
|
187635
188142
|
});
|
|
187636
|
-
console.log(
|
|
188143
|
+
console.log(`\nStep 4/${totalSteps}: Generating presentations.json...\n`);
|
|
188144
|
+
regeneratePresentationsJson(presentationsDir, presentationsJsonPath, {
|
|
188145
|
+
thumbnailsDir,
|
|
188146
|
+
basePath
|
|
188147
|
+
});
|
|
188148
|
+
console.log(`\nStep 5/${totalSteps}: Assembling deploy output...\n`);
|
|
187637
188149
|
if (existsSync(outputDir)) rmSync(outputDir, { recursive: true });
|
|
187638
188150
|
mkdirSync(outputDir, { recursive: true });
|
|
187639
188151
|
const nuxtOutputDir = join(supaslidevRoot, ".output", "public");
|
|
@@ -187647,6 +188159,16 @@ async function deploy(options = {}) {
|
|
|
187647
188159
|
if (existsSync(distDir)) cpSync(distDir, destDir, { recursive: true });
|
|
187648
188160
|
else console.warn(` Warning: No dist/ found for presentation "${id}", skipping.`);
|
|
187649
188161
|
}
|
|
188162
|
+
if (existsSync(thumbnailsDir)) {
|
|
188163
|
+
const thumbnailsOutputDir = join(outputDir, "thumbnails");
|
|
188164
|
+
mkdirSync(thumbnailsOutputDir, { recursive: true });
|
|
188165
|
+
for (const id of presentations) {
|
|
188166
|
+
const webpFile = join(thumbnailsDir, `${id}.webp`);
|
|
188167
|
+
const pngFile = join(thumbnailsDir, `${id}.png`);
|
|
188168
|
+
if (existsSync(webpFile)) cpSync(webpFile, join(thumbnailsOutputDir, `${id}.webp`));
|
|
188169
|
+
else if (existsSync(pngFile)) cpSync(pngFile, join(thumbnailsOutputDir, `${id}.png`));
|
|
188170
|
+
}
|
|
188171
|
+
}
|
|
187650
188172
|
if (existsSync(presentationsJsonPath)) cpSync(presentationsJsonPath, join(outputDir, "presentations.json"));
|
|
187651
188173
|
writeFileSync(join(outputDir, "vercel.json"), createVercelConfig(basePath, presentations));
|
|
187652
188174
|
writeFileSync(join(outputDir, "netlify.toml"), createNetlifyConfig(basePath, presentations));
|
|
@@ -187665,6 +188187,69 @@ async function deploy(options = {}) {
|
|
|
187665
188187
|
console.log("");
|
|
187666
188188
|
}
|
|
187667
188189
|
//#endregion
|
|
188190
|
+
//#region src/cli/commands/thumbnail.ts
|
|
188191
|
+
async function thumbnail(name, options = {}) {
|
|
188192
|
+
const projectRoot = findProjectRoot();
|
|
188193
|
+
if (!projectRoot) {
|
|
188194
|
+
console.error("Error: Could not find a Supaslidev project.");
|
|
188195
|
+
console.error("Make sure you are in a directory with a \"presentations\" folder.");
|
|
188196
|
+
process.exit(1);
|
|
188197
|
+
}
|
|
188198
|
+
const presentationsDir = join(projectRoot, "presentations");
|
|
188199
|
+
const thumbnailsDir = join(projectRoot, "thumbnails");
|
|
188200
|
+
const presentations = getPresentations$1(presentationsDir);
|
|
188201
|
+
if (!presentations.includes(name)) {
|
|
188202
|
+
console.error(`Error: Presentation "${name}" not found`);
|
|
188203
|
+
printAvailablePresentations(presentations);
|
|
188204
|
+
process.exit(1);
|
|
188205
|
+
}
|
|
188206
|
+
const presentationDir = join(presentationsDir, name);
|
|
188207
|
+
const outputPath = options.output ?? join(thumbnailsDir, name);
|
|
188208
|
+
if (!existsSync(dirname(outputPath))) mkdirSync(dirname(outputPath), { recursive: true });
|
|
188209
|
+
console.log("\n" + "=".repeat(50));
|
|
188210
|
+
console.log(` Generating thumbnail: ${name}`);
|
|
188211
|
+
console.log("=".repeat(50) + "\n");
|
|
188212
|
+
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188213
|
+
await new Promise((resolve) => {
|
|
188214
|
+
const slidev = spawn(slidevBin, [
|
|
188215
|
+
"export",
|
|
188216
|
+
"--format",
|
|
188217
|
+
"png",
|
|
188218
|
+
"--range",
|
|
188219
|
+
"1",
|
|
188220
|
+
"--output",
|
|
188221
|
+
outputPath
|
|
188222
|
+
], {
|
|
188223
|
+
cwd: presentationDir,
|
|
188224
|
+
stdio: "inherit"
|
|
188225
|
+
});
|
|
188226
|
+
slidev.on("error", (err) => {
|
|
188227
|
+
console.error(`Failed to generate thumbnail: ${err.message}`);
|
|
188228
|
+
process.exit(1);
|
|
188229
|
+
});
|
|
188230
|
+
slidev.on("close", (code) => {
|
|
188231
|
+
if (code !== 0) {
|
|
188232
|
+
console.error(`\nThumbnail generation failed with exit code ${code}`);
|
|
188233
|
+
process.exit(code ?? 1);
|
|
188234
|
+
}
|
|
188235
|
+
const targetFile = `${outputPath}.png`;
|
|
188236
|
+
if (!existsSync(targetFile) && existsSync(outputPath)) {
|
|
188237
|
+
const pngs = readdirSync(outputPath).filter((f) => f.endsWith(".png")).sort();
|
|
188238
|
+
if (pngs.length > 0) renameSync(join(outputPath, pngs[0]), targetFile);
|
|
188239
|
+
}
|
|
188240
|
+
resolve();
|
|
188241
|
+
});
|
|
188242
|
+
});
|
|
188243
|
+
const pngFile = `${outputPath}.png`;
|
|
188244
|
+
if (existsSync(pngFile)) {
|
|
188245
|
+
const webpFile = await optimizeThumbnail(pngFile);
|
|
188246
|
+
console.log("\n" + "=".repeat(50));
|
|
188247
|
+
console.log(` Thumbnail generated!`);
|
|
188248
|
+
console.log(` Output: ${webpFile}`);
|
|
188249
|
+
console.log("=".repeat(50) + "\n");
|
|
188250
|
+
}
|
|
188251
|
+
}
|
|
188252
|
+
//#endregion
|
|
187668
188253
|
//#region src/cli/index.ts
|
|
187669
188254
|
const program = new Command();
|
|
187670
188255
|
program.name("supaslidev").description("Supaslidev presentation management CLI").version("0.1.0");
|
|
@@ -187686,6 +188271,9 @@ program.command("import").description("Import existing Sli.dev presentation(s)")
|
|
|
187686
188271
|
install: options.install ?? true
|
|
187687
188272
|
});
|
|
187688
188273
|
});
|
|
188274
|
+
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) => {
|
|
188275
|
+
await thumbnail(name, options);
|
|
188276
|
+
});
|
|
187689
188277
|
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
188278
|
try {
|
|
187691
188279
|
await deploy(options);
|