@vitejs/devtools 0.1.10 → 0.1.13
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/dist/{DockStandalone-CX4RwLuJ.js → DockStandalone-kfuGuU1K.js} +128 -21
- package/dist/{LogItem-Ca0SsU39.js → LogItem-DOamSzjc.js} +1 -1
- package/dist/{ViewBuiltinLogs-B_CLlali.js → ViewBuiltinLogs-BW-Z3LV1.js} +35 -25
- package/dist/{ViewBuiltinTerminals-ZrMObMte.js → ViewBuiltinTerminals-D_aHYGk9.js} +1 -1
- package/dist/{ViewJsonRender-Cc5BPfnv.js → ViewJsonRender-BlN5HDyU.js} +1 -1
- package/dist/{build-static-Cb3vKjJS.js → build-static-SRf6Mx0K.js} +4 -4
- package/dist/cli-commands.js +8 -5
- package/dist/client/inject.js +3 -3
- package/dist/client/standalone/assets/DockIcon-Bn9P0BA3.js +1 -0
- package/dist/client/standalone/assets/DockStandalone-BNVMXM6t.js +3 -0
- package/dist/client/standalone/assets/DockStandalone-GABFNqKk.js +1 -0
- package/dist/client/standalone/assets/{LogItem-BnVhub2j.js → LogItem-B2zhdfw_.js} +1 -1
- package/dist/client/standalone/assets/ViewBuiltinLogs-Bv93zOX9.js +1 -0
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-DqaYBA6Q.js → ViewBuiltinTerminals-DPB8d-Q0.js} +4 -4
- package/dist/client/standalone/assets/{ViewJsonRender-De5eeIha.js → ViewJsonRender-CSnziLMr.js} +1 -1
- package/dist/client/standalone/assets/dist-DIiIv9-S.js +5 -0
- package/dist/client/standalone/assets/index-C05Px9az.css +1 -0
- package/dist/client/standalone/assets/index-C9nheAgG.js +1 -0
- package/dist/client/standalone/assets/runtime-core.esm-bundler-Dfaj58fA.js +1 -0
- package/dist/client/standalone/index.html +8 -6
- package/dist/client/webcomponents.js +3 -3
- package/dist/{context-BWju7fup.js → context-WJ5shSfy.js} +564 -506
- package/dist/{dist-CCdqIez-.js → dist-DD29zy1v.js} +390 -5
- package/dist/index.d.ts +90 -87
- package/dist/index.js +3 -3
- package/dist/{plugins-Dhpm6Ql_.js → plugins-D8NH18dj.js} +6 -4
- package/dist/{popup-DgYOsFy3.js → popup-D4DzCx7h.js} +1 -1
- package/dist/{server-DSh-GQIq.js → server-CE1QMUPY.js} +4 -4
- package/dist/server-Cz5aS6Hb.js +2 -0
- package/dist/{server-ZWEvQMOm.js → server-kLW_T-bo.js} +3 -3
- package/dist/{standalone-D_6Gsoqw.js → standalone-eqACht_F.js} +2 -2
- package/package.json +17 -14
- package/dist/client/standalone/assets/DockStandalone-BvXvOkmY.js +0 -1
- package/dist/client/standalone/assets/ViewBuiltinLogs-rU-E-8qT.js +0 -1
- package/dist/client/standalone/assets/dist-CAaP5Isp.js +0 -1
- package/dist/client/standalone/assets/index-2_yFTdkG.js +0 -3
- package/dist/client/standalone/assets/index-DtZFMvER.css +0 -1
- package/dist/client/standalone/assets/runtime-core.esm-bundler-Bvz2jy0O.js +0 -1
- package/dist/server-BQ4s1VXj.js +0 -2
- /package/dist/client/standalone/assets/{iconify-C-CPDXMf.js → iconify-DTCjcGxu.js} +0 -0
|
@@ -16,9 +16,9 @@ import process$1, { stdin, stdout } from "node:process";
|
|
|
16
16
|
import sirv from "sirv";
|
|
17
17
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
18
18
|
import "node:readline";
|
|
19
|
-
import
|
|
19
|
+
import P from "node:readline";
|
|
20
20
|
import "node:tty";
|
|
21
|
-
import "node:path";
|
|
21
|
+
import { relative as relative$1, resolve as resolve$1 } from "node:path";
|
|
22
22
|
import { defineRpcFunction } from "@vitejs/devtools-kit";
|
|
23
23
|
//#region src/node/context-utils.ts
|
|
24
24
|
const ContextUtils = { createSimpleClientScript(fn) {
|
|
@@ -472,7 +472,327 @@ var DevToolsViewHost = class {
|
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
474
|
//#endregion
|
|
475
|
-
//#region ../../node_modules/.pnpm
|
|
475
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
476
|
+
const isAmbiguous = (x) => {
|
|
477
|
+
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;
|
|
478
|
+
};
|
|
479
|
+
const isFullWidth = (x) => {
|
|
480
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
481
|
+
};
|
|
482
|
+
const isWide = (x) => {
|
|
483
|
+
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;
|
|
484
|
+
};
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
487
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
488
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
489
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
490
|
+
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;
|
|
491
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
492
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
493
|
+
const NO_TRUNCATION$1 = {
|
|
494
|
+
limit: Infinity,
|
|
495
|
+
ellipsis: ""
|
|
496
|
+
};
|
|
497
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
498
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
499
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
500
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
501
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
502
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
503
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
504
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
505
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
506
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
507
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
508
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
509
|
+
let indexPrev = 0;
|
|
510
|
+
let index = 0;
|
|
511
|
+
let length = input.length;
|
|
512
|
+
let lengthExtra = 0;
|
|
513
|
+
let truncationEnabled = false;
|
|
514
|
+
let truncationIndex = length;
|
|
515
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
516
|
+
let unmatchedStart = 0;
|
|
517
|
+
let unmatchedEnd = 0;
|
|
518
|
+
let width = 0;
|
|
519
|
+
let widthExtra = 0;
|
|
520
|
+
outer: while (true) {
|
|
521
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
522
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
523
|
+
lengthExtra = 0;
|
|
524
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
525
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
526
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
527
|
+
else if (isWide(codePoint)) widthExtra = WIDE_WIDTH;
|
|
528
|
+
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
529
|
+
else widthExtra = REGULAR_WIDTH;
|
|
530
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
531
|
+
if (width + widthExtra > LIMIT) {
|
|
532
|
+
truncationEnabled = true;
|
|
533
|
+
break outer;
|
|
534
|
+
}
|
|
535
|
+
lengthExtra += char.length;
|
|
536
|
+
width += widthExtra;
|
|
537
|
+
}
|
|
538
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
539
|
+
}
|
|
540
|
+
if (index >= length) break;
|
|
541
|
+
LATIN_RE.lastIndex = index;
|
|
542
|
+
if (LATIN_RE.test(input)) {
|
|
543
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
544
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
545
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
546
|
+
if (width + widthExtra > LIMIT) {
|
|
547
|
+
truncationEnabled = true;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
width += widthExtra;
|
|
551
|
+
unmatchedStart = indexPrev;
|
|
552
|
+
unmatchedEnd = index;
|
|
553
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
ANSI_RE.lastIndex = index;
|
|
557
|
+
if (ANSI_RE.test(input)) {
|
|
558
|
+
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
559
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
560
|
+
truncationEnabled = true;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
width += ANSI_WIDTH;
|
|
564
|
+
unmatchedStart = indexPrev;
|
|
565
|
+
unmatchedEnd = index;
|
|
566
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
CONTROL_RE.lastIndex = index;
|
|
570
|
+
if (CONTROL_RE.test(input)) {
|
|
571
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
572
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
573
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
574
|
+
if (width + widthExtra > LIMIT) {
|
|
575
|
+
truncationEnabled = true;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
width += widthExtra;
|
|
579
|
+
unmatchedStart = indexPrev;
|
|
580
|
+
unmatchedEnd = index;
|
|
581
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
TAB_RE.lastIndex = index;
|
|
585
|
+
if (TAB_RE.test(input)) {
|
|
586
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
587
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
588
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
589
|
+
if (width + widthExtra > LIMIT) {
|
|
590
|
+
truncationEnabled = true;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
width += widthExtra;
|
|
594
|
+
unmatchedStart = indexPrev;
|
|
595
|
+
unmatchedEnd = index;
|
|
596
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
EMOJI_RE.lastIndex = index;
|
|
600
|
+
if (EMOJI_RE.test(input)) {
|
|
601
|
+
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
602
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
603
|
+
truncationEnabled = true;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
width += EMOJI_WIDTH;
|
|
607
|
+
unmatchedStart = indexPrev;
|
|
608
|
+
unmatchedEnd = index;
|
|
609
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
index += 1;
|
|
613
|
+
}
|
|
614
|
+
return {
|
|
615
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
616
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
617
|
+
truncated: truncationEnabled,
|
|
618
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
623
|
+
const NO_TRUNCATION = {
|
|
624
|
+
limit: Infinity,
|
|
625
|
+
ellipsis: "",
|
|
626
|
+
ellipsisWidth: 0
|
|
627
|
+
};
|
|
628
|
+
const fastStringWidth = (input, options = {}) => {
|
|
629
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
630
|
+
};
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
633
|
+
const ESC = "\x1B";
|
|
634
|
+
const CSI = "";
|
|
635
|
+
const END_CODE = 39;
|
|
636
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
637
|
+
const ANSI_CSI = "[";
|
|
638
|
+
const ANSI_OSC = "]";
|
|
639
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
640
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
641
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
642
|
+
const getClosingCode = (openingCode) => {
|
|
643
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
644
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
645
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
646
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
647
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
648
|
+
if (openingCode === 3) return 23;
|
|
649
|
+
if (openingCode === 4) return 24;
|
|
650
|
+
if (openingCode === 7) return 27;
|
|
651
|
+
if (openingCode === 8) return 28;
|
|
652
|
+
if (openingCode === 9) return 29;
|
|
653
|
+
if (openingCode === 0) return 0;
|
|
654
|
+
};
|
|
655
|
+
const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
656
|
+
const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
657
|
+
const wrapWord = (rows, word, columns) => {
|
|
658
|
+
const characters = word[Symbol.iterator]();
|
|
659
|
+
let isInsideEscape = false;
|
|
660
|
+
let isInsideLinkEscape = false;
|
|
661
|
+
let lastRow = rows.at(-1);
|
|
662
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
663
|
+
let currentCharacter = characters.next();
|
|
664
|
+
let nextCharacter = characters.next();
|
|
665
|
+
let rawCharacterIndex = 0;
|
|
666
|
+
while (!currentCharacter.done) {
|
|
667
|
+
const character = currentCharacter.value;
|
|
668
|
+
const characterLength = fastStringWidth(character);
|
|
669
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
670
|
+
else {
|
|
671
|
+
rows.push(character);
|
|
672
|
+
visible = 0;
|
|
673
|
+
}
|
|
674
|
+
if (character === ESC || character === CSI) {
|
|
675
|
+
isInsideEscape = true;
|
|
676
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
677
|
+
}
|
|
678
|
+
if (isInsideEscape) {
|
|
679
|
+
if (isInsideLinkEscape) {
|
|
680
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
681
|
+
isInsideEscape = false;
|
|
682
|
+
isInsideLinkEscape = false;
|
|
683
|
+
}
|
|
684
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
685
|
+
} else {
|
|
686
|
+
visible += characterLength;
|
|
687
|
+
if (visible === columns && !nextCharacter.done) {
|
|
688
|
+
rows.push("");
|
|
689
|
+
visible = 0;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
currentCharacter = nextCharacter;
|
|
693
|
+
nextCharacter = characters.next();
|
|
694
|
+
rawCharacterIndex += character.length;
|
|
695
|
+
}
|
|
696
|
+
lastRow = rows.at(-1);
|
|
697
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
698
|
+
};
|
|
699
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
700
|
+
const words = string.split(" ");
|
|
701
|
+
let last = words.length;
|
|
702
|
+
while (last) {
|
|
703
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
704
|
+
last--;
|
|
705
|
+
}
|
|
706
|
+
if (last === words.length) return string;
|
|
707
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
708
|
+
};
|
|
709
|
+
const exec = (string, columns, options = {}) => {
|
|
710
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
711
|
+
let returnValue = "";
|
|
712
|
+
let escapeCode;
|
|
713
|
+
let escapeUrl;
|
|
714
|
+
const words = string.split(" ");
|
|
715
|
+
let rows = [""];
|
|
716
|
+
let rowLength = 0;
|
|
717
|
+
for (let index = 0; index < words.length; index++) {
|
|
718
|
+
const word = words[index];
|
|
719
|
+
if (options.trim !== false) {
|
|
720
|
+
const row = rows.at(-1) ?? "";
|
|
721
|
+
const trimmed = row.trimStart();
|
|
722
|
+
if (row.length !== trimmed.length) {
|
|
723
|
+
rows[rows.length - 1] = trimmed;
|
|
724
|
+
rowLength = fastStringWidth(trimmed);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (index !== 0) {
|
|
728
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
729
|
+
rows.push("");
|
|
730
|
+
rowLength = 0;
|
|
731
|
+
}
|
|
732
|
+
if (rowLength || options.trim === false) {
|
|
733
|
+
rows[rows.length - 1] += " ";
|
|
734
|
+
rowLength++;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
const wordLength = fastStringWidth(word);
|
|
738
|
+
if (options.hard && wordLength > columns) {
|
|
739
|
+
const remainingColumns = columns - rowLength;
|
|
740
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
741
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
742
|
+
wrapWord(rows, word, columns);
|
|
743
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
746
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
747
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
748
|
+
wrapWord(rows, word, columns);
|
|
749
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
rows.push("");
|
|
753
|
+
rowLength = 0;
|
|
754
|
+
}
|
|
755
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
756
|
+
wrapWord(rows, word, columns);
|
|
757
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
rows[rows.length - 1] += word;
|
|
761
|
+
rowLength += wordLength;
|
|
762
|
+
}
|
|
763
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
764
|
+
const preString = rows.join("\n");
|
|
765
|
+
let inSurrogate = false;
|
|
766
|
+
for (let i = 0; i < preString.length; i++) {
|
|
767
|
+
const character = preString[i];
|
|
768
|
+
returnValue += character;
|
|
769
|
+
if (!inSurrogate) inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
770
|
+
else continue;
|
|
771
|
+
if (character === ESC || character === CSI) {
|
|
772
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
773
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
774
|
+
if (groups?.code !== void 0) {
|
|
775
|
+
const code = Number.parseFloat(groups.code);
|
|
776
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
777
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
778
|
+
}
|
|
779
|
+
if (preString[i + 1] === "\n") {
|
|
780
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
781
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
782
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
783
|
+
} else if (character === "\n") {
|
|
784
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
785
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return returnValue;
|
|
789
|
+
};
|
|
790
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
791
|
+
function wrapAnsi(string, columns, options) {
|
|
792
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
476
796
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
477
797
|
const ESC = "\x1B";
|
|
478
798
|
const CSI = `${ESC}[`;
|
|
@@ -525,162 +845,12 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
525
845
|
beep
|
|
526
846
|
};
|
|
527
847
|
})))();
|
|
528
|
-
function
|
|
529
|
-
if (!
|
|
530
|
-
const
|
|
531
|
-
return
|
|
848
|
+
function d$1(r, t, e) {
|
|
849
|
+
if (!e.some((o) => !o.disabled)) return r;
|
|
850
|
+
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
851
|
+
return e[n].disabled ? d$1(n, t < 0 ? -1 : 1, e) : n;
|
|
532
852
|
}
|
|
533
|
-
const
|
|
534
|
-
limit: Infinity,
|
|
535
|
-
ellipsis: ""
|
|
536
|
-
}, X$1 = (t, e = {}, s = {}) => {
|
|
537
|
-
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;
|
|
538
|
-
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;
|
|
539
|
-
t: for (;;) {
|
|
540
|
-
if (w > C || o >= p && o > h) {
|
|
541
|
-
const ut = t.slice(C, w) || t.slice(h, o);
|
|
542
|
-
v = 0;
|
|
543
|
-
for (const Y of ut.replaceAll(ct, "")) {
|
|
544
|
-
const $ = Y.codePointAt(0) || 0;
|
|
545
|
-
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) {
|
|
546
|
-
F = !0;
|
|
547
|
-
break t;
|
|
548
|
-
}
|
|
549
|
-
v += Y.length, c += f;
|
|
550
|
-
}
|
|
551
|
-
C = w = 0;
|
|
552
|
-
}
|
|
553
|
-
if (o >= p) break;
|
|
554
|
-
if (M.lastIndex = o, M.test(t)) {
|
|
555
|
-
if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
556
|
-
F = !0;
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
|
-
c += f, C = h, w = o, o = h = M.lastIndex;
|
|
560
|
-
continue;
|
|
561
|
-
}
|
|
562
|
-
if (O.lastIndex = o, O.test(t)) {
|
|
563
|
-
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
564
|
-
F = !0;
|
|
565
|
-
break;
|
|
566
|
-
}
|
|
567
|
-
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
568
|
-
continue;
|
|
569
|
-
}
|
|
570
|
-
if (y.lastIndex = o, y.test(t)) {
|
|
571
|
-
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
572
|
-
F = !0;
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
576
|
-
continue;
|
|
577
|
-
}
|
|
578
|
-
if (L.lastIndex = o, L.test(t)) {
|
|
579
|
-
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
580
|
-
F = !0;
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
584
|
-
continue;
|
|
585
|
-
}
|
|
586
|
-
if (P.lastIndex = o, P.test(t)) {
|
|
587
|
-
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
588
|
-
F = !0;
|
|
589
|
-
break;
|
|
590
|
-
}
|
|
591
|
-
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
592
|
-
continue;
|
|
593
|
-
}
|
|
594
|
-
o += 1;
|
|
595
|
-
}
|
|
596
|
-
return {
|
|
597
|
-
width: F ? b : c,
|
|
598
|
-
index: F ? d : p,
|
|
599
|
-
truncated: F,
|
|
600
|
-
ellipsed: F && i >= n
|
|
601
|
-
};
|
|
602
|
-
}, pt$1 = {
|
|
603
|
-
limit: Infinity,
|
|
604
|
-
ellipsis: "",
|
|
605
|
-
ellipsisWidth: 0
|
|
606
|
-
}, 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) => {
|
|
607
|
-
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
608
|
-
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
609
|
-
if (t === 1 || t === 2) return 22;
|
|
610
|
-
if (t === 3) return 23;
|
|
611
|
-
if (t === 4) return 24;
|
|
612
|
-
if (t === 7) return 27;
|
|
613
|
-
if (t === 8) return 28;
|
|
614
|
-
if (t === 9) return 29;
|
|
615
|
-
if (t === 0) return 0;
|
|
616
|
-
}, 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) => {
|
|
617
|
-
const i = e[Symbol.iterator]();
|
|
618
|
-
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
619
|
-
for (; !l.done;) {
|
|
620
|
-
const m = l.value, A = S(m);
|
|
621
|
-
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;
|
|
622
|
-
}
|
|
623
|
-
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
624
|
-
}, vt$1 = (t) => {
|
|
625
|
-
const e = t.split(" ");
|
|
626
|
-
let s = e.length;
|
|
627
|
-
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
628
|
-
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
629
|
-
}, Et$1 = (t, e, s = {}) => {
|
|
630
|
-
if (s.trim !== !1 && t.trim() === "") return "";
|
|
631
|
-
let i = "", r, n;
|
|
632
|
-
const u = t.split(" "), a = gt$1(u);
|
|
633
|
-
let l = [""];
|
|
634
|
-
for (const [h, o] of u.entries()) {
|
|
635
|
-
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
636
|
-
let p = S(l.at(-1) ?? "");
|
|
637
|
-
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) {
|
|
638
|
-
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
639
|
-
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
640
|
-
continue;
|
|
641
|
-
}
|
|
642
|
-
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
643
|
-
if (s.wordWrap === !1 && p < e) {
|
|
644
|
-
G(l, o, e);
|
|
645
|
-
continue;
|
|
646
|
-
}
|
|
647
|
-
l.push("");
|
|
648
|
-
}
|
|
649
|
-
if (p + a[h] > e && s.wordWrap === !1) {
|
|
650
|
-
G(l, o, e);
|
|
651
|
-
continue;
|
|
652
|
-
}
|
|
653
|
-
l[l.length - 1] += o;
|
|
654
|
-
}
|
|
655
|
-
s.trim !== !1 && (l = l.map((h) => vt$1(h)));
|
|
656
|
-
const E = l.join(`
|
|
657
|
-
`), g = E[Symbol.iterator]();
|
|
658
|
-
let m = g.next(), A = g.next(), V = 0;
|
|
659
|
-
for (; !m.done;) {
|
|
660
|
-
const h = m.value, o = A.value;
|
|
661
|
-
if (i += h, h === T || h === Z) {
|
|
662
|
-
et.lastIndex = V + 1;
|
|
663
|
-
const F = et.exec(E)?.groups;
|
|
664
|
-
if (F?.code !== void 0) {
|
|
665
|
-
const d = Number.parseFloat(F.code);
|
|
666
|
-
r = d === Ft$1 ? void 0 : d;
|
|
667
|
-
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
668
|
-
}
|
|
669
|
-
const p = r ? mt$1(r) : void 0;
|
|
670
|
-
o === `
|
|
671
|
-
` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
|
|
672
|
-
` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
673
|
-
}
|
|
674
|
-
return i;
|
|
675
|
-
};
|
|
676
|
-
function K$1(t, e, s) {
|
|
677
|
-
return String(t).normalize().replaceAll(`\r
|
|
678
|
-
`, `
|
|
679
|
-
`).split(`
|
|
680
|
-
`).map((i) => Et$1(i, e, s)).join(`
|
|
681
|
-
`);
|
|
682
|
-
}
|
|
683
|
-
const _ = {
|
|
853
|
+
const u = {
|
|
684
854
|
actions: new Set([
|
|
685
855
|
"up",
|
|
686
856
|
"down",
|
|
@@ -702,37 +872,68 @@ const _ = {
|
|
|
702
872
|
cancel: "Canceled",
|
|
703
873
|
error: "Something went wrong"
|
|
704
874
|
},
|
|
705
|
-
withGuide: !0
|
|
875
|
+
withGuide: !0,
|
|
876
|
+
date: {
|
|
877
|
+
monthNames: [...[
|
|
878
|
+
"January",
|
|
879
|
+
"February",
|
|
880
|
+
"March",
|
|
881
|
+
"April",
|
|
882
|
+
"May",
|
|
883
|
+
"June",
|
|
884
|
+
"July",
|
|
885
|
+
"August",
|
|
886
|
+
"September",
|
|
887
|
+
"October",
|
|
888
|
+
"November",
|
|
889
|
+
"December"
|
|
890
|
+
]],
|
|
891
|
+
messages: {
|
|
892
|
+
required: "Please enter a valid date",
|
|
893
|
+
invalidMonth: "There are only 12 months in a year",
|
|
894
|
+
invalidDay: (r, t) => `There are only ${r} days in ${t}`,
|
|
895
|
+
afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
896
|
+
beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
897
|
+
}
|
|
898
|
+
}
|
|
706
899
|
};
|
|
707
|
-
function
|
|
708
|
-
if (typeof
|
|
709
|
-
for (const
|
|
900
|
+
function V$1(r, t) {
|
|
901
|
+
if (typeof r == "string") return u.aliases.get(r) === t;
|
|
902
|
+
for (const e of r) if (e !== void 0 && V$1(e, t)) return !0;
|
|
710
903
|
return !1;
|
|
711
904
|
}
|
|
712
|
-
function
|
|
713
|
-
if (
|
|
714
|
-
const
|
|
715
|
-
`),
|
|
716
|
-
`),
|
|
717
|
-
for (let
|
|
905
|
+
function j(r, t) {
|
|
906
|
+
if (r === t) return;
|
|
907
|
+
const e = r.split(`
|
|
908
|
+
`), s = t.split(`
|
|
909
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
910
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
718
911
|
return {
|
|
719
912
|
lines: n,
|
|
720
|
-
numLinesBefore:
|
|
721
|
-
numLinesAfter:
|
|
722
|
-
numLines:
|
|
913
|
+
numLinesBefore: e.length,
|
|
914
|
+
numLinesAfter: s.length,
|
|
915
|
+
numLines: i
|
|
723
916
|
};
|
|
724
917
|
}
|
|
725
918
|
globalThis.process.platform.startsWith("win");
|
|
726
|
-
const
|
|
727
|
-
function
|
|
728
|
-
return
|
|
919
|
+
const C = Symbol("clack:cancel");
|
|
920
|
+
function q(r) {
|
|
921
|
+
return r === C;
|
|
729
922
|
}
|
|
730
|
-
function
|
|
731
|
-
const
|
|
732
|
-
|
|
923
|
+
function w$1(r, t) {
|
|
924
|
+
const e = r;
|
|
925
|
+
e.isTTY && e.setRawMode(t);
|
|
733
926
|
}
|
|
734
|
-
const
|
|
735
|
-
|
|
927
|
+
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;
|
|
928
|
+
function R(r, t, e, s = e) {
|
|
929
|
+
return wrapAnsi(t, O$1(r ?? stdout) - e.length, {
|
|
930
|
+
hard: !0,
|
|
931
|
+
trim: !1
|
|
932
|
+
}).split(`
|
|
933
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
934
|
+
`);
|
|
935
|
+
}
|
|
936
|
+
let p = class {
|
|
736
937
|
input;
|
|
737
938
|
output;
|
|
738
939
|
_abortSignal;
|
|
@@ -747,60 +948,60 @@ var B = class {
|
|
|
747
948
|
error = "";
|
|
748
949
|
value;
|
|
749
950
|
userInput = "";
|
|
750
|
-
constructor(
|
|
751
|
-
const { input:
|
|
752
|
-
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 =
|
|
951
|
+
constructor(t, e = !0) {
|
|
952
|
+
const { input: s = stdin, output: i = stdout, render: n, signal: o, ...a } = t;
|
|
953
|
+
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;
|
|
753
954
|
}
|
|
754
955
|
unsubscribe() {
|
|
755
956
|
this._subscribers.clear();
|
|
756
957
|
}
|
|
757
|
-
setSubscriber(
|
|
758
|
-
const
|
|
759
|
-
|
|
958
|
+
setSubscriber(t, e) {
|
|
959
|
+
const s = this._subscribers.get(t) ?? [];
|
|
960
|
+
s.push(e), this._subscribers.set(t, s);
|
|
760
961
|
}
|
|
761
|
-
on(
|
|
762
|
-
this.setSubscriber(
|
|
962
|
+
on(t, e) {
|
|
963
|
+
this.setSubscriber(t, { cb: e });
|
|
763
964
|
}
|
|
764
|
-
once(
|
|
765
|
-
this.setSubscriber(
|
|
766
|
-
cb:
|
|
965
|
+
once(t, e) {
|
|
966
|
+
this.setSubscriber(t, {
|
|
967
|
+
cb: e,
|
|
767
968
|
once: !0
|
|
768
969
|
});
|
|
769
970
|
}
|
|
770
|
-
emit(
|
|
771
|
-
const
|
|
772
|
-
for (const n of
|
|
773
|
-
for (const n of
|
|
971
|
+
emit(t, ...e) {
|
|
972
|
+
const s = this._subscribers.get(t) ?? [], i = [];
|
|
973
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
974
|
+
for (const n of i) n();
|
|
774
975
|
}
|
|
775
976
|
prompt() {
|
|
776
|
-
return new Promise((
|
|
977
|
+
return new Promise((t) => {
|
|
777
978
|
if (this._abortSignal) {
|
|
778
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
979
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(C);
|
|
779
980
|
this._abortSignal.addEventListener("abort", () => {
|
|
780
981
|
this.state = "cancel", this.close();
|
|
781
982
|
}, { once: !0 });
|
|
782
983
|
}
|
|
783
|
-
this.rl =
|
|
984
|
+
this.rl = P.createInterface({
|
|
784
985
|
input: this.input,
|
|
785
986
|
tabSize: 2,
|
|
786
987
|
prompt: "",
|
|
787
988
|
escapeCodeTimeout: 50,
|
|
788
989
|
terminal: !0
|
|
789
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
790
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
990
|
+
}), 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", () => {
|
|
991
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(this.value);
|
|
791
992
|
}), this.once("cancel", () => {
|
|
792
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
993
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(C);
|
|
793
994
|
});
|
|
794
995
|
});
|
|
795
996
|
}
|
|
796
|
-
_isActionKey(
|
|
797
|
-
return
|
|
997
|
+
_isActionKey(t, e) {
|
|
998
|
+
return t === " ";
|
|
798
999
|
}
|
|
799
|
-
_setValue(
|
|
800
|
-
this.value =
|
|
1000
|
+
_setValue(t) {
|
|
1001
|
+
this.value = t, this.emit("value", this.value);
|
|
801
1002
|
}
|
|
802
|
-
_setUserInput(
|
|
803
|
-
this.userInput =
|
|
1003
|
+
_setUserInput(t, e) {
|
|
1004
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
804
1005
|
}
|
|
805
1006
|
_clearUserInput() {
|
|
806
1007
|
this.rl?.write(null, {
|
|
@@ -808,399 +1009,250 @@ var B = class {
|
|
|
808
1009
|
name: "u"
|
|
809
1010
|
}), this._setUserInput("");
|
|
810
1011
|
}
|
|
811
|
-
onKeypress(
|
|
812
|
-
if (this._track &&
|
|
1012
|
+
onKeypress(t, e) {
|
|
1013
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
813
1014
|
ctrl: !0,
|
|
814
1015
|
name: "h"
|
|
815
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"),
|
|
1016
|
+
}), 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") {
|
|
816
1017
|
if (this.opts.validate) {
|
|
817
|
-
const
|
|
818
|
-
|
|
1018
|
+
const s = this.opts.validate(this.value);
|
|
1019
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
819
1020
|
}
|
|
820
1021
|
this.state !== "error" && (this.state = "submit");
|
|
821
1022
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1023
|
+
V$1([
|
|
1024
|
+
t,
|
|
1025
|
+
e?.name,
|
|
1026
|
+
e?.sequence
|
|
826
1027
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
827
1028
|
}
|
|
828
1029
|
close() {
|
|
829
1030
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
830
|
-
`),
|
|
1031
|
+
`), w$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
831
1032
|
}
|
|
832
1033
|
restoreCursor() {
|
|
833
|
-
const
|
|
1034
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
834
1035
|
hard: !0,
|
|
835
1036
|
trim: !1
|
|
836
1037
|
}).split(`
|
|
837
1038
|
`).length - 1;
|
|
838
|
-
this.output.write(import_src.cursor.move(-999,
|
|
1039
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
839
1040
|
}
|
|
840
1041
|
render() {
|
|
841
|
-
const
|
|
1042
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
842
1043
|
hard: !0,
|
|
843
1044
|
trim: !1
|
|
844
1045
|
});
|
|
845
|
-
if (
|
|
1046
|
+
if (t !== this._prevFrame) {
|
|
846
1047
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
847
1048
|
else {
|
|
848
|
-
const
|
|
849
|
-
if (this.restoreCursor(),
|
|
850
|
-
const
|
|
851
|
-
let
|
|
852
|
-
if (
|
|
853
|
-
this._prevFrame =
|
|
1049
|
+
const e = j(this._prevFrame, t), s = A(this.output);
|
|
1050
|
+
if (this.restoreCursor(), e) {
|
|
1051
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
1052
|
+
let o = e.lines.find((a) => a >= i);
|
|
1053
|
+
if (o === void 0) {
|
|
1054
|
+
this._prevFrame = t;
|
|
854
1055
|
return;
|
|
855
1056
|
}
|
|
856
|
-
if (
|
|
857
|
-
this.output.write(import_src.cursor.move(0,
|
|
858
|
-
const a =
|
|
1057
|
+
if (e.lines.length === 1) {
|
|
1058
|
+
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
1059
|
+
const a = t.split(`
|
|
859
1060
|
`);
|
|
860
|
-
this.output.write(a[
|
|
1061
|
+
this.output.write(a[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, a.length - o - 1));
|
|
861
1062
|
return;
|
|
862
|
-
} else if (
|
|
863
|
-
if (
|
|
1063
|
+
} else if (e.lines.length > 1) {
|
|
1064
|
+
if (i < n) o = i;
|
|
864
1065
|
else {
|
|
865
|
-
const
|
|
866
|
-
|
|
1066
|
+
const h = o - n;
|
|
1067
|
+
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
867
1068
|
}
|
|
868
1069
|
this.output.write(import_src.erase.down());
|
|
869
|
-
const a =
|
|
870
|
-
`).slice(
|
|
1070
|
+
const a = t.split(`
|
|
1071
|
+
`).slice(o);
|
|
871
1072
|
this.output.write(a.join(`
|
|
872
|
-
`)), this._prevFrame =
|
|
1073
|
+
`)), this._prevFrame = t;
|
|
873
1074
|
return;
|
|
874
1075
|
}
|
|
875
1076
|
}
|
|
876
1077
|
this.output.write(import_src.erase.down());
|
|
877
1078
|
}
|
|
878
|
-
this.output.write(
|
|
1079
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
879
1080
|
}
|
|
880
1081
|
}
|
|
881
1082
|
};
|
|
882
|
-
var
|
|
1083
|
+
var Q$1 = class extends p {
|
|
883
1084
|
get cursor() {
|
|
884
1085
|
return this.value ? 0 : 1;
|
|
885
1086
|
}
|
|
886
1087
|
get _value() {
|
|
887
1088
|
return this.cursor === 0;
|
|
888
1089
|
}
|
|
889
|
-
constructor(
|
|
890
|
-
super(
|
|
1090
|
+
constructor(t) {
|
|
1091
|
+
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
891
1092
|
this.value = this._value;
|
|
892
|
-
}), this.on("confirm", (
|
|
893
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
1093
|
+
}), this.on("confirm", (e) => {
|
|
1094
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
894
1095
|
}), this.on("cursor", () => {
|
|
895
1096
|
this.value = !this.value;
|
|
896
1097
|
});
|
|
897
1098
|
}
|
|
898
1099
|
};
|
|
899
1100
|
//#endregion
|
|
900
|
-
//#region ../../node_modules/.pnpm/@clack+prompts@1.
|
|
901
|
-
function
|
|
1101
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1102
|
+
function Ze() {
|
|
902
1103
|
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
903
1104
|
}
|
|
904
|
-
const ee =
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
const z =
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
const se =
|
|
915
|
-
|
|
916
|
-
const
|
|
1105
|
+
const ee = Ze(), w = (e, i) => ee ? e : i, _e = w("◆", "*"), oe = w("■", "x"), ue = w("▲", "x"), F = w("◇", "o");
|
|
1106
|
+
w("┌", "T");
|
|
1107
|
+
const d = w("│", "|"), E = w("└", "—");
|
|
1108
|
+
w("┐", "T");
|
|
1109
|
+
w("┘", "—");
|
|
1110
|
+
const z = w("●", ">"), H = w("○", " ");
|
|
1111
|
+
w("◻", "[•]");
|
|
1112
|
+
w("◼", "[+]");
|
|
1113
|
+
w("◻", "[ ]");
|
|
1114
|
+
w("▪", "•");
|
|
1115
|
+
const se = w("─", "-"), ce = w("╮", "+"), Ge = w("├", "+"), $e = w("╯", "+"), de = w("╰", "+");
|
|
1116
|
+
w("╭", "+");
|
|
1117
|
+
const he = w("●", "•"), pe = w("◆", "*"), me = w("▲", "!"), ge = w("■", "x"), V = (e) => {
|
|
917
1118
|
switch (e) {
|
|
918
1119
|
case "initial":
|
|
919
|
-
case "active": return styleText("cyan",
|
|
920
|
-
case "cancel": return styleText("red",
|
|
921
|
-
case "error": return styleText("yellow",
|
|
922
|
-
case "submit": return styleText("green",
|
|
1120
|
+
case "active": return styleText("cyan", _e);
|
|
1121
|
+
case "cancel": return styleText("red", oe);
|
|
1122
|
+
case "error": return styleText("yellow", ue);
|
|
1123
|
+
case "submit": return styleText("green", F);
|
|
923
1124
|
}
|
|
924
|
-
}, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, gt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ft = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\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, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ft = /\p{M}+/gu, yt = {
|
|
925
|
-
limit: Infinity,
|
|
926
|
-
ellipsis: ""
|
|
927
|
-
}, Le = (e, r = {}, s = {}) => {
|
|
928
|
-
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
929
|
-
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;
|
|
930
|
-
e: for (;;) {
|
|
931
|
-
if (b > A || m >= d && m > $) {
|
|
932
|
-
const T = e.slice(A, b) || e.slice($, m);
|
|
933
|
-
F = 0;
|
|
934
|
-
for (const M of T.replaceAll(Ft, "")) {
|
|
935
|
-
const O = M.codePointAt(0) || 0;
|
|
936
|
-
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) {
|
|
937
|
-
y = !0;
|
|
938
|
-
break e;
|
|
939
|
-
}
|
|
940
|
-
F += M.length, w += S;
|
|
941
|
-
}
|
|
942
|
-
A = b = 0;
|
|
943
|
-
}
|
|
944
|
-
if (m >= d) break;
|
|
945
|
-
if (ne.lastIndex = m, ne.test(e)) {
|
|
946
|
-
if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
|
|
947
|
-
y = !0;
|
|
948
|
-
break;
|
|
949
|
-
}
|
|
950
|
-
w += S, A = $, b = m, m = $ = ne.lastIndex;
|
|
951
|
-
continue;
|
|
952
|
-
}
|
|
953
|
-
if (we.lastIndex = m, we.test(e)) {
|
|
954
|
-
if (w + u > C && (v = Math.min(v, m)), w + u > i) {
|
|
955
|
-
y = !0;
|
|
956
|
-
break;
|
|
957
|
-
}
|
|
958
|
-
w += u, A = $, b = m, m = $ = we.lastIndex;
|
|
959
|
-
continue;
|
|
960
|
-
}
|
|
961
|
-
if (re.lastIndex = m, re.test(e)) {
|
|
962
|
-
if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
|
|
963
|
-
y = !0;
|
|
964
|
-
break;
|
|
965
|
-
}
|
|
966
|
-
w += S, A = $, b = m, m = $ = re.lastIndex;
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
969
|
-
if (ie.lastIndex = m, ie.test(e)) {
|
|
970
|
-
if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
|
|
971
|
-
y = !0;
|
|
972
|
-
break;
|
|
973
|
-
}
|
|
974
|
-
w += S, A = $, b = m, m = $ = ie.lastIndex;
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
if (Ae.lastIndex = m, Ae.test(e)) {
|
|
978
|
-
if (w + p > C && (v = Math.min(v, m)), w + p > i) {
|
|
979
|
-
y = !0;
|
|
980
|
-
break;
|
|
981
|
-
}
|
|
982
|
-
w += p, A = $, b = m, m = $ = Ae.lastIndex;
|
|
983
|
-
continue;
|
|
984
|
-
}
|
|
985
|
-
m += 1;
|
|
986
|
-
}
|
|
987
|
-
return {
|
|
988
|
-
width: y ? C : w,
|
|
989
|
-
index: y ? v : d,
|
|
990
|
-
truncated: y,
|
|
991
|
-
ellipsed: y && i >= o
|
|
992
|
-
};
|
|
993
|
-
}, Et = {
|
|
994
|
-
limit: Infinity,
|
|
995
|
-
ellipsis: "",
|
|
996
|
-
ellipsisWidth: 0
|
|
997
|
-
}, D = (e, r = {}) => Le(e, Et, r).width, ae = "\x1B", je = "", vt = 39, Ce = "\x07", ke = "[", wt = "]", Ve = "m", Se = `${wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), At = (e) => {
|
|
998
|
-
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
999
|
-
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
1000
|
-
if (e === 1 || e === 2) return 22;
|
|
1001
|
-
if (e === 3) return 23;
|
|
1002
|
-
if (e === 4) return 24;
|
|
1003
|
-
if (e === 7) return 27;
|
|
1004
|
-
if (e === 8) return 28;
|
|
1005
|
-
if (e === 9) return 29;
|
|
1006
|
-
if (e === 0) return 0;
|
|
1007
|
-
}, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct = (e) => e.map((r) => D(r)), Ie = (e, r, s) => {
|
|
1008
|
-
const i = r[Symbol.iterator]();
|
|
1009
|
-
let a = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
|
|
1010
|
-
for (; !n.done;) {
|
|
1011
|
-
const f = n.value, g = D(f);
|
|
1012
|
-
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;
|
|
1013
|
-
}
|
|
1014
|
-
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
1015
|
-
}, St = (e) => {
|
|
1016
|
-
const r = e.split(" ");
|
|
1017
|
-
let s = r.length;
|
|
1018
|
-
for (; s > 0 && !(D(r[s - 1]) > 0);) s--;
|
|
1019
|
-
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
1020
|
-
}, It = (e, r, s = {}) => {
|
|
1021
|
-
if (s.trim !== !1 && e.trim() === "") return "";
|
|
1022
|
-
let i = "", a, o;
|
|
1023
|
-
const u = e.split(" "), l = Ct(u);
|
|
1024
|
-
let n = [""];
|
|
1025
|
-
for (const [$, m] of u.entries()) {
|
|
1026
|
-
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
1027
|
-
let d = D(n.at(-1) ?? "");
|
|
1028
|
-
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) {
|
|
1029
|
-
const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
|
|
1030
|
-
Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
|
|
1031
|
-
continue;
|
|
1032
|
-
}
|
|
1033
|
-
if (d + l[$] > r && d > 0 && l[$] > 0) {
|
|
1034
|
-
if (s.wordWrap === !1 && d < r) {
|
|
1035
|
-
Ie(n, m, r);
|
|
1036
|
-
continue;
|
|
1037
|
-
}
|
|
1038
|
-
n.push("");
|
|
1039
|
-
}
|
|
1040
|
-
if (d + l[$] > r && s.wordWrap === !1) {
|
|
1041
|
-
Ie(n, m, r);
|
|
1042
|
-
continue;
|
|
1043
|
-
}
|
|
1044
|
-
n[n.length - 1] += m;
|
|
1045
|
-
}
|
|
1046
|
-
s.trim !== !1 && (n = n.map(($) => St($)));
|
|
1047
|
-
const c = n.join(`
|
|
1048
|
-
`), p = c[Symbol.iterator]();
|
|
1049
|
-
let f = p.next(), g = p.next(), E = 0;
|
|
1050
|
-
for (; !f.done;) {
|
|
1051
|
-
const $ = f.value, m = g.value;
|
|
1052
|
-
if (i += $, $ === ae || $ === je) {
|
|
1053
|
-
He.lastIndex = E + 1;
|
|
1054
|
-
const y = He.exec(c)?.groups;
|
|
1055
|
-
if (y?.code !== void 0) {
|
|
1056
|
-
const v = Number.parseFloat(y.code);
|
|
1057
|
-
a = v === vt ? void 0 : v;
|
|
1058
|
-
} else y?.uri !== void 0 && (o = y.uri.length === 0 ? void 0 : y.uri);
|
|
1059
|
-
}
|
|
1060
|
-
const d = a ? At(a) : void 0;
|
|
1061
|
-
m === `
|
|
1062
|
-
` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
|
|
1063
|
-
` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
|
|
1064
|
-
}
|
|
1065
|
-
return i;
|
|
1066
1125
|
};
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
`).map((i) => It(i, r, s)).join(`
|
|
1072
|
-
`);
|
|
1073
|
-
}
|
|
1074
|
-
const Rt = (e) => {
|
|
1075
|
-
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1076
|
-
return new kt$1({
|
|
1077
|
-
active: r,
|
|
1126
|
+
const ot = (e) => {
|
|
1127
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1128
|
+
return new Q$1({
|
|
1129
|
+
active: i,
|
|
1078
1130
|
inactive: s,
|
|
1079
1131
|
signal: e.signal,
|
|
1080
1132
|
input: e.input,
|
|
1081
1133
|
output: e.output,
|
|
1082
1134
|
initialValue: e.initialValue ?? !0,
|
|
1083
1135
|
render() {
|
|
1084
|
-
const
|
|
1085
|
-
` : ""}${
|
|
1086
|
-
`,
|
|
1136
|
+
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)}
|
|
1137
|
+
` : ""}${o}
|
|
1138
|
+
`, a = this.value ? i : s;
|
|
1087
1139
|
switch (this.state) {
|
|
1088
|
-
case "submit": return `${
|
|
1089
|
-
case "cancel": return `${
|
|
1090
|
-
${styleText("gray",
|
|
1140
|
+
case "submit": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText("dim", a)}`;
|
|
1141
|
+
case "cancel": return `${c}${r ? `${styleText("gray", d)} ` : ""}${styleText(["strikethrough", "dim"], a)}${r ? `
|
|
1142
|
+
${styleText("gray", d)}` : ""}`;
|
|
1091
1143
|
default: {
|
|
1092
|
-
const
|
|
1093
|
-
return `${
|
|
1094
|
-
${styleText("cyan",
|
|
1144
|
+
const l = r ? `${styleText("cyan", d)} ` : "", $ = r ? styleText("cyan", E) : "";
|
|
1145
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim", H)} ${styleText("dim", i)}`}${e.vertical ? r ? `
|
|
1146
|
+
${styleText("cyan", d)} ` : `
|
|
1095
1147
|
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
1096
|
-
${
|
|
1148
|
+
${$}
|
|
1097
1149
|
`;
|
|
1098
1150
|
}
|
|
1099
1151
|
}
|
|
1100
1152
|
}
|
|
1101
1153
|
}).prompt();
|
|
1102
|
-
},
|
|
1103
|
-
message: (e = [], { symbol:
|
|
1104
|
-
const
|
|
1105
|
-
for (let
|
|
1106
|
-
const
|
|
1154
|
+
}, O = {
|
|
1155
|
+
message: (e = [], { symbol: i = styleText("gray", d), secondarySymbol: s = styleText("gray", d), output: r = process.stdout, spacing: u$7 = 1, withGuide: n } = {}) => {
|
|
1156
|
+
const o = [], c = n ?? u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
1157
|
+
for (let p = 0; p < u$7; p++) o.push(a);
|
|
1158
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
1107
1159
|
`);
|
|
1108
|
-
if (
|
|
1109
|
-
const [
|
|
1110
|
-
|
|
1111
|
-
for (const
|
|
1160
|
+
if (y.length > 0) {
|
|
1161
|
+
const [p, ...m] = y;
|
|
1162
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
1163
|
+
for (const g of m) g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
1112
1164
|
}
|
|
1113
|
-
|
|
1165
|
+
r.write(`${o.join(`
|
|
1114
1166
|
`)}
|
|
1115
1167
|
`);
|
|
1116
1168
|
},
|
|
1117
|
-
info: (e,
|
|
1118
|
-
|
|
1119
|
-
...
|
|
1120
|
-
symbol: styleText("blue",
|
|
1169
|
+
info: (e, i) => {
|
|
1170
|
+
O.message(e, {
|
|
1171
|
+
...i,
|
|
1172
|
+
symbol: styleText("blue", he)
|
|
1121
1173
|
});
|
|
1122
1174
|
},
|
|
1123
|
-
success: (e,
|
|
1124
|
-
|
|
1125
|
-
...
|
|
1126
|
-
symbol: styleText("green",
|
|
1175
|
+
success: (e, i) => {
|
|
1176
|
+
O.message(e, {
|
|
1177
|
+
...i,
|
|
1178
|
+
symbol: styleText("green", pe)
|
|
1127
1179
|
});
|
|
1128
1180
|
},
|
|
1129
|
-
step: (e,
|
|
1130
|
-
|
|
1131
|
-
...
|
|
1132
|
-
symbol: styleText("green",
|
|
1181
|
+
step: (e, i) => {
|
|
1182
|
+
O.message(e, {
|
|
1183
|
+
...i,
|
|
1184
|
+
symbol: styleText("green", F)
|
|
1133
1185
|
});
|
|
1134
1186
|
},
|
|
1135
|
-
warn: (e,
|
|
1136
|
-
|
|
1137
|
-
...
|
|
1138
|
-
symbol: styleText("yellow",
|
|
1187
|
+
warn: (e, i) => {
|
|
1188
|
+
O.message(e, {
|
|
1189
|
+
...i,
|
|
1190
|
+
symbol: styleText("yellow", me)
|
|
1139
1191
|
});
|
|
1140
1192
|
},
|
|
1141
|
-
warning: (e,
|
|
1142
|
-
|
|
1193
|
+
warning: (e, i) => {
|
|
1194
|
+
O.warn(e, i);
|
|
1143
1195
|
},
|
|
1144
|
-
error: (e,
|
|
1145
|
-
|
|
1146
|
-
...
|
|
1147
|
-
symbol: styleText("red",
|
|
1196
|
+
error: (e, i) => {
|
|
1197
|
+
O.message(e, {
|
|
1198
|
+
...i,
|
|
1199
|
+
symbol: styleText("red", ge)
|
|
1148
1200
|
});
|
|
1149
1201
|
}
|
|
1150
|
-
},
|
|
1151
|
-
const s =
|
|
1152
|
-
${styleText("gray",
|
|
1153
|
-
s.write(`${
|
|
1202
|
+
}, gt = (e = "", i) => {
|
|
1203
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${styleText("gray", d)}
|
|
1204
|
+
${styleText("gray", E)} ` : "";
|
|
1205
|
+
s.write(`${r}${e}
|
|
1154
1206
|
|
|
1155
1207
|
`);
|
|
1156
|
-
},
|
|
1157
|
-
const
|
|
1208
|
+
}, ft = (e) => styleText("dim", e), vt = (e, i, s) => {
|
|
1209
|
+
const r = {
|
|
1158
1210
|
hard: !0,
|
|
1159
1211
|
trim: !1
|
|
1160
|
-
},
|
|
1161
|
-
`),
|
|
1162
|
-
return
|
|
1163
|
-
},
|
|
1164
|
-
const
|
|
1212
|
+
}, u = wrapAnsi(e, i, r).split(`
|
|
1213
|
+
`), n = u.reduce((a, l) => Math.max(fastStringWidth(l), a), 0);
|
|
1214
|
+
return wrapAnsi(e, i - (u.map(s).reduce((a, l) => Math.max(fastStringWidth(l), a), 0) - n), r);
|
|
1215
|
+
}, wt = (e = "", i = "", s) => {
|
|
1216
|
+
const r = s?.output ?? process$1.stdout, u$9 = s?.withGuide ?? u.withGuide, n = s?.format ?? ft, o = [
|
|
1165
1217
|
"",
|
|
1166
|
-
...
|
|
1167
|
-
`).map(
|
|
1218
|
+
...vt(e, O$1(r) - 6, n).split(`
|
|
1219
|
+
`).map(n),
|
|
1168
1220
|
""
|
|
1169
|
-
],
|
|
1170
|
-
const
|
|
1171
|
-
return
|
|
1172
|
-
}, 0),
|
|
1173
|
-
`),
|
|
1174
|
-
` : "",
|
|
1175
|
-
|
|
1176
|
-
${
|
|
1177
|
-
${styleText("gray",
|
|
1221
|
+
], c = fastStringWidth(i), a = Math.max(o.reduce((p, m) => {
|
|
1222
|
+
const g = fastStringWidth(m);
|
|
1223
|
+
return g > p ? g : p;
|
|
1224
|
+
}, 0), c) + 2, l = o.map((p) => `${styleText("gray", d)} ${p}${" ".repeat(a - fastStringWidth(p))}${styleText("gray", d)}`).join(`
|
|
1225
|
+
`), $ = u$9 ? `${styleText("gray", d)}
|
|
1226
|
+
` : "", y = u$9 ? Ge : de;
|
|
1227
|
+
r.write(`${$}${styleText("green", F)} ${styleText("reset", i)} ${styleText("gray", se.repeat(Math.max(a - c - 1, 1)) + ce)}
|
|
1228
|
+
${l}
|
|
1229
|
+
${styleText("gray", y + se.repeat(a + 2) + $e)}
|
|
1178
1230
|
`);
|
|
1179
1231
|
};
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1182
|
-
message: async (e, { symbol:
|
|
1183
|
-
process.stdout.write(`${styleText("gray",
|
|
1184
|
-
${
|
|
1232
|
+
w("─", "-"), w("━", "="), w("█", "#");
|
|
1233
|
+
const je = `${styleText("gray", d)} `, K = {
|
|
1234
|
+
message: async (e, { symbol: i = styleText("gray", d) } = {}) => {
|
|
1235
|
+
process.stdout.write(`${styleText("gray", d)}
|
|
1236
|
+
${i} `);
|
|
1185
1237
|
let s = 3;
|
|
1186
|
-
for await (let
|
|
1187
|
-
|
|
1188
|
-
${
|
|
1189
|
-
`) && (s = 3 + stripVTControlCharacters(
|
|
1238
|
+
for await (let r of e) {
|
|
1239
|
+
r = r.replace(/\n/g, `
|
|
1240
|
+
${je}`), r.includes(`
|
|
1241
|
+
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1190
1242
|
`))).length);
|
|
1191
|
-
const
|
|
1192
|
-
s +
|
|
1193
|
-
${
|
|
1243
|
+
const u = stripVTControlCharacters(r).length;
|
|
1244
|
+
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1245
|
+
${je}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1194
1246
|
}
|
|
1195
1247
|
process.stdout.write(`
|
|
1196
1248
|
`);
|
|
1197
1249
|
},
|
|
1198
|
-
info: (e) => K.message(e, { symbol: styleText("blue",
|
|
1199
|
-
success: (e) => K.message(e, { symbol: styleText("green",
|
|
1200
|
-
step: (e) => K.message(e, { symbol: styleText("green",
|
|
1201
|
-
warn: (e) => K.message(e, { symbol: styleText("yellow",
|
|
1250
|
+
info: (e) => K.message(e, { symbol: styleText("blue", he) }),
|
|
1251
|
+
success: (e) => K.message(e, { symbol: styleText("green", pe) }),
|
|
1252
|
+
step: (e) => K.message(e, { symbol: styleText("green", F) }),
|
|
1253
|
+
warn: (e) => K.message(e, { symbol: styleText("yellow", me) }),
|
|
1202
1254
|
warning: (e) => K.warn(e),
|
|
1203
|
-
error: (e) => K.message(e, { symbol: styleText("red",
|
|
1255
|
+
error: (e) => K.message(e, { symbol: styleText("red", ge) })
|
|
1204
1256
|
};
|
|
1205
1257
|
//#endregion
|
|
1206
1258
|
//#region src/node/rpc/anonymous/auth.ts
|
|
@@ -1218,7 +1270,7 @@ const anonymousAuth = defineRpcFunction({
|
|
|
1218
1270
|
session.meta.isTrusted = true;
|
|
1219
1271
|
return { isTrusted: true };
|
|
1220
1272
|
}
|
|
1221
|
-
if ((
|
|
1273
|
+
if ((context.viteConfig.devtools?.config?.clientAuthTokens ?? []).includes(query.authToken)) {
|
|
1222
1274
|
session.meta.clientAuthToken = query.authToken;
|
|
1223
1275
|
session.meta.isTrusted = true;
|
|
1224
1276
|
return { isTrusted: true };
|
|
@@ -1253,7 +1305,7 @@ const anonymousAuth = defineRpcFunction({
|
|
|
1253
1305
|
"This will allow the browser to interact with the server, make file changes and run commands.",
|
|
1254
1306
|
ansis_default.red(ansis_default.bold("You should only trust your local development browsers."))
|
|
1255
1307
|
];
|
|
1256
|
-
|
|
1308
|
+
wt(ansis_default.reset(message.join("\n")), ansis_default.bold(ansis_default.yellow(" Vite DevTools Permission Request ")));
|
|
1257
1309
|
if (!process$1.stdout.isTTY) return { isTrusted: false };
|
|
1258
1310
|
const abortController = new AbortController();
|
|
1259
1311
|
return new Promise((resolve) => {
|
|
@@ -1272,14 +1324,14 @@ const anonymousAuth = defineRpcFunction({
|
|
|
1272
1324
|
abortController,
|
|
1273
1325
|
timeout
|
|
1274
1326
|
});
|
|
1275
|
-
|
|
1327
|
+
ot({
|
|
1276
1328
|
message: ansis_default.bold(`Do you trust this client (${ansis_default.green(ansis_default.bold(query.authToken))})?`),
|
|
1277
1329
|
initialValue: false,
|
|
1278
1330
|
signal: abortController.signal
|
|
1279
1331
|
}).then((answer) => {
|
|
1280
1332
|
clearTimeout(timeout);
|
|
1281
1333
|
setPendingAuth(null);
|
|
1282
|
-
if (
|
|
1334
|
+
if (q(answer)) return;
|
|
1283
1335
|
if (answer) {
|
|
1284
1336
|
storage.mutate((state) => {
|
|
1285
1337
|
state.trusted[query.authToken] = {
|
|
@@ -1291,10 +1343,10 @@ const anonymousAuth = defineRpcFunction({
|
|
|
1291
1343
|
});
|
|
1292
1344
|
session.meta.clientAuthToken = query.authToken;
|
|
1293
1345
|
session.meta.isTrusted = true;
|
|
1294
|
-
|
|
1346
|
+
gt(ansis_default.green(ansis_default.bold(`You have granted permissions to ${ansis_default.bold(query.authToken)}`)));
|
|
1295
1347
|
resolve({ isTrusted: true });
|
|
1296
1348
|
} else {
|
|
1297
|
-
|
|
1349
|
+
gt(ansis_default.red(ansis_default.bold(`You have denied permissions to ${ansis_default.bold(query.authToken)}`)));
|
|
1298
1350
|
resolve({ isTrusted: false });
|
|
1299
1351
|
}
|
|
1300
1352
|
}).catch(() => {
|
|
@@ -1557,17 +1609,23 @@ const terminalsRead = defineRpcFunction({
|
|
|
1557
1609
|
const builtinPublicRpcDeclarations = [defineRpcFunction({
|
|
1558
1610
|
name: "vite:core:open-in-editor",
|
|
1559
1611
|
type: "action",
|
|
1560
|
-
setup: () => {
|
|
1612
|
+
setup: (context) => {
|
|
1561
1613
|
return { handler: async (path) => {
|
|
1562
|
-
|
|
1614
|
+
const resolved = resolve$1(context.workspaceRoot, path);
|
|
1615
|
+
const rel = relative$1(context.workspaceRoot, resolved);
|
|
1616
|
+
if (rel.startsWith("..") || rel.includes("\0")) throw new Error("Path is outside the workspace root");
|
|
1617
|
+
await import("launch-editor").then((r) => r.default(resolved));
|
|
1563
1618
|
} };
|
|
1564
1619
|
}
|
|
1565
1620
|
}), defineRpcFunction({
|
|
1566
1621
|
name: "vite:core:open-in-finder",
|
|
1567
1622
|
type: "action",
|
|
1568
|
-
setup: () => {
|
|
1623
|
+
setup: (context) => {
|
|
1569
1624
|
return { handler: async (path) => {
|
|
1570
|
-
|
|
1625
|
+
const resolved = resolve$1(context.workspaceRoot, path);
|
|
1626
|
+
const rel = relative$1(context.workspaceRoot, resolved);
|
|
1627
|
+
if (rel.startsWith("..") || rel.includes("\0")) throw new Error("Path is outside the workspace root");
|
|
1628
|
+
await import("open").then((r) => r.default(resolved));
|
|
1571
1629
|
} };
|
|
1572
1630
|
}
|
|
1573
1631
|
})];
|