@hot-updater/test-utils 1.2.0-rc.1 → 1.2.0-rc.11

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/node.cjs CHANGED
@@ -35,6 +35,10 @@ let node_child_process = require("node:child_process");
35
35
  let node_net = require("node:net");
36
36
  node_net = __toESM(node_net, 1);
37
37
  let node_http = require("node:http");
38
+ let node_stream = require("node:stream");
39
+ let node_util = require("node:util");
40
+ let node_process = require("node:process");
41
+ node_process = __toESM(node_process, 1);
38
42
  let execa = require("execa");
39
43
  //#region src/d1TestDatabase.ts
40
44
  /**
@@ -20357,6 +20361,572 @@ const createReleaseCatalogTestStorage = () => ({
20357
20361
  }
20358
20362
  });
20359
20363
  //#endregion
20364
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
20365
+ const getCodePointsLength = (() => {
20366
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
20367
+ return (input) => {
20368
+ let surrogatePairsNr = 0;
20369
+ SURROGATE_PAIR_RE.lastIndex = 0;
20370
+ while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
20371
+ return input.length - surrogatePairsNr;
20372
+ };
20373
+ })();
20374
+ const isFullWidth = (x) => {
20375
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
20376
+ };
20377
+ const isWideNotCJKTNotEmoji = (x) => {
20378
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
20379
+ };
20380
+ //#endregion
20381
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
20382
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
20383
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
20384
+ const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
20385
+ const TAB_RE = /\t{1,1000}/y;
20386
+ 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;
20387
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
20388
+ const MODIFIER_RE = /\p{M}+/gu;
20389
+ const NO_TRUNCATION$1 = {
20390
+ limit: Infinity,
20391
+ ellipsis: ""
20392
+ };
20393
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
20394
+ const LIMIT = truncationOptions.limit ?? Infinity;
20395
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
20396
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
20397
+ const ANSI_WIDTH = 0;
20398
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
20399
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
20400
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
20401
+ const FULL_WIDTH_WIDTH = 2;
20402
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
20403
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
20404
+ const PARSE_BLOCKS = [
20405
+ [LATIN_RE, REGULAR_WIDTH],
20406
+ [ANSI_RE, ANSI_WIDTH],
20407
+ [CONTROL_RE, CONTROL_WIDTH],
20408
+ [TAB_RE, TAB_WIDTH],
20409
+ [EMOJI_RE, EMOJI_WIDTH],
20410
+ [CJKT_WIDE_RE, WIDE_WIDTH]
20411
+ ];
20412
+ let indexPrev = 0;
20413
+ let index = 0;
20414
+ let length = input.length;
20415
+ let lengthExtra = 0;
20416
+ let truncationEnabled = false;
20417
+ let truncationIndex = length;
20418
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
20419
+ let unmatchedStart = 0;
20420
+ let unmatchedEnd = 0;
20421
+ let width = 0;
20422
+ let widthExtra = 0;
20423
+ outer: while (true) {
20424
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
20425
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
20426
+ lengthExtra = 0;
20427
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
20428
+ const codePoint = char.codePointAt(0) || 0;
20429
+ if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
20430
+ else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
20431
+ else widthExtra = REGULAR_WIDTH;
20432
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
20433
+ if (width + widthExtra > LIMIT) {
20434
+ truncationEnabled = true;
20435
+ break outer;
20436
+ }
20437
+ lengthExtra += char.length;
20438
+ width += widthExtra;
20439
+ }
20440
+ unmatchedStart = unmatchedEnd = 0;
20441
+ }
20442
+ if (index >= length) break outer;
20443
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
20444
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
20445
+ BLOCK_RE.lastIndex = index;
20446
+ if (BLOCK_RE.test(input)) {
20447
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
20448
+ widthExtra = lengthExtra * BLOCK_WIDTH;
20449
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
20450
+ if (width + widthExtra > LIMIT) {
20451
+ truncationEnabled = true;
20452
+ break outer;
20453
+ }
20454
+ width += widthExtra;
20455
+ unmatchedStart = indexPrev;
20456
+ unmatchedEnd = index;
20457
+ index = indexPrev = BLOCK_RE.lastIndex;
20458
+ continue outer;
20459
+ }
20460
+ }
20461
+ index += 1;
20462
+ }
20463
+ return {
20464
+ width: truncationEnabled ? truncationLimit : width,
20465
+ index: truncationEnabled ? truncationIndex : length,
20466
+ truncated: truncationEnabled,
20467
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
20468
+ };
20469
+ };
20470
+ //#endregion
20471
+ //#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
20472
+ const NO_TRUNCATION = {
20473
+ limit: Infinity,
20474
+ ellipsis: "",
20475
+ ellipsisWidth: 0
20476
+ };
20477
+ const fastStringWidth = (input, options = {}) => {
20478
+ return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
20479
+ };
20480
+ //#endregion
20481
+ //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
20482
+ const ESC = "\x1B";
20483
+ const CSI = "›";
20484
+ const END_CODE = 39;
20485
+ const ANSI_ESCAPE_BELL = "\x07";
20486
+ const ANSI_CSI = "[";
20487
+ const ANSI_OSC = "]";
20488
+ const ANSI_SGR_TERMINATOR = "m";
20489
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
20490
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
20491
+ const getClosingCode = (openingCode) => {
20492
+ if (openingCode >= 30 && openingCode <= 37) return 39;
20493
+ if (openingCode >= 90 && openingCode <= 97) return 39;
20494
+ if (openingCode >= 40 && openingCode <= 47) return 49;
20495
+ if (openingCode >= 100 && openingCode <= 107) return 49;
20496
+ if (openingCode === 1 || openingCode === 2) return 22;
20497
+ if (openingCode === 3) return 23;
20498
+ if (openingCode === 4) return 24;
20499
+ if (openingCode === 7) return 27;
20500
+ if (openingCode === 8) return 28;
20501
+ if (openingCode === 9) return 29;
20502
+ if (openingCode === 0) return 0;
20503
+ };
20504
+ const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
20505
+ const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
20506
+ const wrapWord = (rows, word, columns) => {
20507
+ const characters = word[Symbol.iterator]();
20508
+ let isInsideEscape = false;
20509
+ let isInsideLinkEscape = false;
20510
+ let lastRow = rows.at(-1);
20511
+ let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
20512
+ let currentCharacter = characters.next();
20513
+ let nextCharacter = characters.next();
20514
+ let rawCharacterIndex = 0;
20515
+ while (!currentCharacter.done) {
20516
+ const character = currentCharacter.value;
20517
+ const characterLength = fastStringWidth(character);
20518
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
20519
+ else {
20520
+ rows.push(character);
20521
+ visible = 0;
20522
+ }
20523
+ if (character === ESC || character === CSI) {
20524
+ isInsideEscape = true;
20525
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
20526
+ }
20527
+ if (isInsideEscape) {
20528
+ if (isInsideLinkEscape) {
20529
+ if (character === ANSI_ESCAPE_BELL) {
20530
+ isInsideEscape = false;
20531
+ isInsideLinkEscape = false;
20532
+ }
20533
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
20534
+ } else {
20535
+ visible += characterLength;
20536
+ if (visible === columns && !nextCharacter.done) {
20537
+ rows.push("");
20538
+ visible = 0;
20539
+ }
20540
+ }
20541
+ currentCharacter = nextCharacter;
20542
+ nextCharacter = characters.next();
20543
+ rawCharacterIndex += character.length;
20544
+ }
20545
+ lastRow = rows.at(-1);
20546
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
20547
+ };
20548
+ const stringVisibleTrimSpacesRight = (string) => {
20549
+ const words = string.split(" ");
20550
+ let last = words.length;
20551
+ while (last) {
20552
+ if (fastStringWidth(words[last - 1])) break;
20553
+ last--;
20554
+ }
20555
+ if (last === words.length) return string;
20556
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
20557
+ };
20558
+ const exec = (string, columns, options = {}) => {
20559
+ if (options.trim !== false && string.trim() === "") return "";
20560
+ let returnValue = "";
20561
+ let escapeCode;
20562
+ let escapeUrl;
20563
+ const words = string.split(" ");
20564
+ let rows = [""];
20565
+ let rowLength = 0;
20566
+ for (let index = 0; index < words.length; index++) {
20567
+ const word = words[index];
20568
+ if (options.trim !== false) {
20569
+ const row = rows.at(-1) ?? "";
20570
+ const trimmed = row.trimStart();
20571
+ if (row.length !== trimmed.length) {
20572
+ rows[rows.length - 1] = trimmed;
20573
+ rowLength = fastStringWidth(trimmed);
20574
+ }
20575
+ }
20576
+ if (index !== 0) {
20577
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
20578
+ rows.push("");
20579
+ rowLength = 0;
20580
+ }
20581
+ if (rowLength || options.trim === false) {
20582
+ rows[rows.length - 1] += " ";
20583
+ rowLength++;
20584
+ }
20585
+ }
20586
+ const wordLength = fastStringWidth(word);
20587
+ if (options.hard && wordLength > columns) {
20588
+ const remainingColumns = columns - rowLength;
20589
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
20590
+ if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
20591
+ wrapWord(rows, word, columns);
20592
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20593
+ continue;
20594
+ }
20595
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
20596
+ if (options.wordWrap === false && rowLength < columns) {
20597
+ wrapWord(rows, word, columns);
20598
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20599
+ continue;
20600
+ }
20601
+ rows.push("");
20602
+ rowLength = 0;
20603
+ }
20604
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
20605
+ wrapWord(rows, word, columns);
20606
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20607
+ continue;
20608
+ }
20609
+ rows[rows.length - 1] += word;
20610
+ rowLength += wordLength;
20611
+ }
20612
+ if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
20613
+ const preString = rows.join("\n");
20614
+ let inSurrogate = false;
20615
+ for (let i = 0; i < preString.length; i++) {
20616
+ const character = preString[i];
20617
+ returnValue += character;
20618
+ if (!inSurrogate) {
20619
+ inSurrogate = character >= "\ud800" && character <= "\udbff";
20620
+ if (inSurrogate) continue;
20621
+ } else inSurrogate = false;
20622
+ if (character === ESC || character === CSI) {
20623
+ GROUP_REGEX.lastIndex = i + 1;
20624
+ const groups = GROUP_REGEX.exec(preString)?.groups;
20625
+ if (groups?.code !== void 0) {
20626
+ const code = Number.parseFloat(groups.code);
20627
+ escapeCode = code === END_CODE ? void 0 : code;
20628
+ } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
20629
+ }
20630
+ if (preString[i + 1] === "\n") {
20631
+ if (escapeUrl) returnValue += wrapAnsiHyperlink("");
20632
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
20633
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
20634
+ } else if (character === "\n") {
20635
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
20636
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
20637
+ }
20638
+ }
20639
+ return returnValue;
20640
+ };
20641
+ const CRLF_OR_LF = /\r?\n/;
20642
+ function wrapAnsi(string, columns, options) {
20643
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
20644
+ }
20645
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
20646
+ const ESC = "\x1B";
20647
+ const CSI = `${ESC}[`;
20648
+ const beep = "\x07";
20649
+ const cursor = {
20650
+ to(x, y) {
20651
+ if (!y) return `${CSI}${x + 1}G`;
20652
+ return `${CSI}${y + 1};${x + 1}H`;
20653
+ },
20654
+ move(x, y) {
20655
+ let ret = "";
20656
+ if (x < 0) ret += `${CSI}${-x}D`;
20657
+ else if (x > 0) ret += `${CSI}${x}C`;
20658
+ if (y < 0) ret += `${CSI}${-y}A`;
20659
+ else if (y > 0) ret += `${CSI}${y}B`;
20660
+ return ret;
20661
+ },
20662
+ up: (count = 1) => `${CSI}${count}A`,
20663
+ down: (count = 1) => `${CSI}${count}B`,
20664
+ forward: (count = 1) => `${CSI}${count}C`,
20665
+ backward: (count = 1) => `${CSI}${count}D`,
20666
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
20667
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
20668
+ left: `${CSI}G`,
20669
+ hide: `${CSI}?25l`,
20670
+ show: `${CSI}?25h`,
20671
+ save: `${ESC}7`,
20672
+ restore: `${ESC}8`
20673
+ };
20674
+ module.exports = {
20675
+ cursor,
20676
+ scroll: {
20677
+ up: (count = 1) => `${CSI}S`.repeat(count),
20678
+ down: (count = 1) => `${CSI}T`.repeat(count)
20679
+ },
20680
+ erase: {
20681
+ screen: `${CSI}2J`,
20682
+ up: (count = 1) => `${CSI}1J`.repeat(count),
20683
+ down: (count = 1) => `${CSI}J`.repeat(count),
20684
+ line: `${CSI}2K`,
20685
+ lineEnd: `${CSI}K`,
20686
+ lineStart: `${CSI}1K`,
20687
+ lines(count) {
20688
+ let clear = "";
20689
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
20690
+ if (count) clear += cursor.left;
20691
+ return clear;
20692
+ }
20693
+ },
20694
+ beep
20695
+ };
20696
+ })))();
20697
+ const settings = {
20698
+ actions: /* @__PURE__ */ new Set([
20699
+ "up",
20700
+ "down",
20701
+ "left",
20702
+ "right",
20703
+ "space",
20704
+ "enter",
20705
+ "cancel"
20706
+ ]),
20707
+ aliases: /* @__PURE__ */ new Map([
20708
+ ["k", "up"],
20709
+ ["j", "down"],
20710
+ ["h", "left"],
20711
+ ["l", "right"],
20712
+ ["", "cancel"],
20713
+ ["escape", "cancel"]
20714
+ ]),
20715
+ messages: {
20716
+ cancel: "Canceled",
20717
+ error: "Something went wrong"
20718
+ },
20719
+ withGuide: true,
20720
+ date: {
20721
+ monthNames: [...[
20722
+ "January",
20723
+ "February",
20724
+ "March",
20725
+ "April",
20726
+ "May",
20727
+ "June",
20728
+ "July",
20729
+ "August",
20730
+ "September",
20731
+ "October",
20732
+ "November",
20733
+ "December"
20734
+ ]],
20735
+ messages: {
20736
+ required: "Please enter a valid date",
20737
+ invalidMonth: "There are only 12 months in a year",
20738
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
20739
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
20740
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
20741
+ }
20742
+ }
20743
+ };
20744
+ globalThis.process.platform.startsWith("win");
20745
+ const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
20746
+ //#endregion
20747
+ //#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
20748
+ function isUnicodeSupported() {
20749
+ if (node_process.default.platform !== "win32") return node_process.default.env.TERM !== "linux";
20750
+ return Boolean(node_process.default.env.CI) || Boolean(node_process.default.env.WT_SESSION) || Boolean(node_process.default.env.TERMINUS_SUBLIME) || node_process.default.env.ConEmuTask === "{cmd::Cmder}" || node_process.default.env.TERM_PROGRAM === "Terminus-Sublime" || node_process.default.env.TERM_PROGRAM === "vscode" || node_process.default.env.TERM === "xterm-256color" || node_process.default.env.TERM === "alacritty" || node_process.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
20751
+ }
20752
+ const unicode = isUnicodeSupported();
20753
+ const unicodeOr = (o, e) => unicode ? o : e;
20754
+ const S_STEP_SUBMIT = unicodeOr("◇", "o");
20755
+ const S_BAR_START = unicodeOr("┌", "T");
20756
+ const S_BAR = unicodeOr("│", "|");
20757
+ const S_BAR_END = unicodeOr("└", "—");
20758
+ const S_BAR_H = unicodeOr("─", "-");
20759
+ const S_CORNER_TOP_RIGHT = unicodeOr("╮", "+");
20760
+ const S_CONNECT_LEFT = unicodeOr("├", "+");
20761
+ const S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+");
20762
+ const S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+");
20763
+ const S_INFO = unicodeOr("●", "•");
20764
+ const S_SUCCESS = unicodeOr("◆", "*");
20765
+ const S_WARN = unicodeOr("▲", "!");
20766
+ const S_ERROR = unicodeOr("■", "x");
20767
+ `${(0, node_util.styleText)("dim", "↑/↓")}`, `${(0, node_util.styleText)("dim", "Space:")}`, `${(0, node_util.styleText)("dim", "Enter:")}`;
20768
+ const log = {
20769
+ message: (s = [], { symbol: e = (0, node_util.styleText)("gray", S_BAR), secondarySymbol: r = (0, node_util.styleText)("gray", S_BAR), output: m = process.stdout, spacing: l = 1, withGuide: c } = {}) => {
20770
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
20771
+ for (let i = 0; i < l; i++) t.push(f);
20772
+ const g = Array.isArray(s) ? s : s.split(`
20773
+ `);
20774
+ if (g.length > 0) {
20775
+ const [i, ...y] = g;
20776
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
20777
+ for (const p of y) p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
20778
+ }
20779
+ m.write(`${t.join(`
20780
+ `)}
20781
+ `);
20782
+ },
20783
+ info: (s, e) => {
20784
+ log.message(s, {
20785
+ ...e,
20786
+ symbol: (0, node_util.styleText)("blue", S_INFO)
20787
+ });
20788
+ },
20789
+ success: (s, e) => {
20790
+ log.message(s, {
20791
+ ...e,
20792
+ symbol: (0, node_util.styleText)("green", S_SUCCESS)
20793
+ });
20794
+ },
20795
+ step: (s, e) => {
20796
+ log.message(s, {
20797
+ ...e,
20798
+ symbol: (0, node_util.styleText)("green", S_STEP_SUBMIT)
20799
+ });
20800
+ },
20801
+ warn: (s, e) => {
20802
+ log.message(s, {
20803
+ ...e,
20804
+ symbol: (0, node_util.styleText)("yellow", S_WARN)
20805
+ });
20806
+ },
20807
+ /** alias for `log.warn()`. */
20808
+ warning: (s, e) => {
20809
+ log.warn(s, e);
20810
+ },
20811
+ error: (s, e) => {
20812
+ log.message(s, {
20813
+ ...e,
20814
+ symbol: (0, node_util.styleText)("red", S_ERROR)
20815
+ });
20816
+ }
20817
+ };
20818
+ const cancel = (o = "", t) => {
20819
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${(0, node_util.styleText)("gray", S_BAR_END)} ` : "";
20820
+ i.write(`${e}${(0, node_util.styleText)("red", o)}
20821
+
20822
+ `);
20823
+ };
20824
+ const intro = (o = "", t) => {
20825
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${(0, node_util.styleText)("gray", S_BAR_START)} ` : "";
20826
+ i.write(`${e}${o}
20827
+ `);
20828
+ };
20829
+ const outro = (o = "", t) => {
20830
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${(0, node_util.styleText)("gray", S_BAR)}
20831
+ ${(0, node_util.styleText)("gray", S_BAR_END)} ` : "";
20832
+ i.write(`${e}${o}
20833
+
20834
+ `);
20835
+ };
20836
+ const W$1 = (o) => o;
20837
+ const C = (o, e, s) => {
20838
+ const a = {
20839
+ hard: true,
20840
+ trim: false
20841
+ }, i = wrapAnsi(o, e, a).split(`
20842
+ `), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
20843
+ return wrapAnsi(o, e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c), a);
20844
+ };
20845
+ const note = (o = "", e = "", s) => {
20846
+ const a = s?.output ?? node_process.default.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
20847
+ "",
20848
+ ...C(o, getColumns(a) - 6, c).split(`
20849
+ `).map(c),
20850
+ ""
20851
+ ], n = fastStringWidth(e), t = Math.max(g.reduce((m, F) => {
20852
+ const O = fastStringWidth(F);
20853
+ return O > m ? O : m;
20854
+ }, 0), n) + 2, h = g.map((m) => `${(0, node_util.styleText)("gray", S_BAR)} ${m}${" ".repeat(t - fastStringWidth(m))}${(0, node_util.styleText)("gray", S_BAR)}`).join(`
20855
+ `), T = i ? `${(0, node_util.styleText)("gray", S_BAR)}
20856
+ ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
20857
+ a.write(`${T}${(0, node_util.styleText)("green", S_STEP_SUBMIT)} ${(0, node_util.styleText)("reset", e)} ${(0, node_util.styleText)("gray", S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT)}
20858
+ ${h}
20859
+ ${(0, node_util.styleText)("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
20860
+ `);
20861
+ };
20862
+ `${(0, node_util.styleText)("dim", "↑/↓")}`, `${(0, node_util.styleText)("dim", "Enter:")}`;
20863
+ `${(0, node_util.styleText)("gray", S_BAR)}`;
20864
+ //#endregion
20865
+ //#region src/renderClackLog.ts
20866
+ const METHODS = /* @__PURE__ */ new Set([
20867
+ "message",
20868
+ "info",
20869
+ "success",
20870
+ "step",
20871
+ "warn",
20872
+ "error",
20873
+ "note",
20874
+ "intro",
20875
+ "outro",
20876
+ "cancel"
20877
+ ]);
20878
+ /**
20879
+ * The calls a spec's stand-ins for `p.log` (and `p.note`, `p.outro`, ...)
20880
+ * recorded, in the order the command made them.
20881
+ */
20882
+ const recordedClackCalls = (...stubs) => stubs.flatMap((stub) => Object.entries(stub).flatMap(([method, fn]) => {
20883
+ const mock = fn?.mock;
20884
+ if (!mock || !METHODS.has(method)) return [];
20885
+ return mock.calls.map((args, index) => [mock.invocationCallOrder[index] ?? 0, [method, ...args]]);
20886
+ })).sort(([a], [b]) => a - b).map(([, call]) => call);
20887
+ /**
20888
+ * The lines the calls print through `@clack/prompts`, without colors, on a
20889
+ * terminal `columns` wide: clack wraps only a note, so any other line wider
20890
+ * than the terminal is one the terminal wraps.
20891
+ */
20892
+ const renderClackLog = (calls, { columns = 80 } = {}) => {
20893
+ let text = "";
20894
+ const options = {
20895
+ output: Object.assign(new node_stream.Writable({ write(chunk, _encoding, done) {
20896
+ text += String(chunk);
20897
+ done();
20898
+ } }), {
20899
+ columns,
20900
+ isTTY: false
20901
+ }),
20902
+ withGuide: true
20903
+ };
20904
+ for (const [method, ...args] of calls) {
20905
+ const [message = "", title = ""] = args.map((arg) => arg === void 0 ? "" : String(arg));
20906
+ if (method === "note") note(message, title, options);
20907
+ else if (method === "intro") intro(message, options);
20908
+ else if (method === "outro") outro(message, options);
20909
+ else if (method === "cancel") cancel(message, options);
20910
+ else log[method](message, options);
20911
+ }
20912
+ return (0, node_util.stripVTControlCharacters)(text).replace(/\n+$/, "").split("\n");
20913
+ };
20914
+ const graphemes = new Intl.Segmenter();
20915
+ const WIDE_PATTERN = /[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Emoji_Presentation}/u;
20916
+ /**
20917
+ * The columns a line takes in a terminal, as East Asian Width counts them,
20918
+ * not its bytes or code units: `│`, `■`, and `…` take one each, a wide
20919
+ * character or an emoji two, and a combining mark none. The CLI keeps its
20920
+ * own count; this one is the specs' measure of it.
20921
+ */
20922
+ const displayColumns = (line) => [...graphemes.segment((0, node_util.stripVTControlCharacters)(line))].reduce((columns, { segment }) => columns + (/^[\p{M}\p{Cf}\p{Cc}]+$/u.test(segment) ? 0 : WIDE_PATTERN.test(segment) ? 2 : 1), 0);
20923
+ /**
20924
+ * The lines wider than `columns` display columns, which a terminal that
20925
+ * wide wraps, but for a line that is one word after clack's gutter, such
20926
+ * as a URL, which no line break could shorten.
20927
+ */
20928
+ const linesWiderThan = (lines, columns = 80) => lines.filter((line) => displayColumns(line) > columns && /\s/u.test(line.slice(3).trim()));
20929
+ //#endregion
20360
20930
  //#region src/setupHandlerIntegrationTestSuite.ts
20361
20931
  const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
20362
20932
  /**
@@ -20629,21 +21199,25 @@ exports.cleanupServer = cleanupServer;
20629
21199
  exports.createD1TestDatabase = createD1TestDatabase;
20630
21200
  exports.createReleaseCatalogTestStorage = createReleaseCatalogTestStorage;
20631
21201
  exports.createTestDbPath = createTestDbPath;
21202
+ exports.displayColumns = displayColumns;
20632
21203
  exports.findOpenPort = findOpenPort;
20633
21204
  exports.formatRuntimeLogs = formatRuntimeLogs;
20634
21205
  exports.hasCommand = hasCommand;
20635
21206
  exports.hasDockerCompose = hasDockerCompose;
20636
21207
  exports.hasDockerDaemon = hasDockerDaemon;
20637
21208
  exports.killPort = killPort;
21209
+ exports.linesWiderThan = linesWiderThan;
20638
21210
  exports.mockReactNativeProjectRoot = mockReactNativeProjectRoot;
20639
21211
  exports.mysqlExecutor = mysqlExecutor;
20640
21212
  exports.pgBatchExecutor = pgBatchExecutor;
20641
21213
  exports.pgExecutor = pgExecutor;
20642
21214
  exports.pgliteBatchExecutor = pgliteBatchExecutor;
20643
21215
  exports.pgliteExecutor = pgliteExecutor;
21216
+ exports.recordedClackCalls = recordedClackCalls;
20644
21217
  exports.releaseCatalogArtifact = releaseCatalogArtifact;
20645
21218
  exports.releaseCatalogArtifactFiles = releaseCatalogArtifactFiles;
20646
21219
  exports.releaseCatalogDownloadUrl = releaseCatalogDownloadUrl;
21220
+ exports.renderClackLog = renderClackLog;
20647
21221
  exports.runCheckedCommand = runCheckedCommand;
20648
21222
  exports.spawnRuntime = spawnRuntime;
20649
21223
  exports.spawnServerProcess = spawnServerProcess;
package/dist/node.d.cts CHANGED
@@ -105,6 +105,38 @@ declare const RELEASE_CATALOG_STORAGE_FIXTURES: Readonly<Record<string, string>>
105
105
  /** Storage boundary shared by provider and separately spawned server tests. */
106
106
  declare const createReleaseCatalogTestStorage: () => StorageAdapter;
107
107
  //#endregion
108
+ //#region src/renderClackLog.d.ts
109
+ /** The `p` calls a command prints with, as a spec's stand-ins record them. */
110
+ type ClackLogMethod = "message" | "info" | "success" | "step" | "warn" | "error" | "note" | "intro" | "outro" | "cancel";
111
+ /** One call: the method and its arguments, such as a note's title. */
112
+ type ClackLogCall = readonly [method: ClackLogMethod, ...args: readonly unknown[]];
113
+ /**
114
+ * The calls a spec's stand-ins for `p.log` (and `p.note`, `p.outro`, ...)
115
+ * recorded, in the order the command made them.
116
+ */
117
+ declare const recordedClackCalls: (...stubs: readonly object[]) => ClackLogCall[];
118
+ /**
119
+ * The lines the calls print through `@clack/prompts`, without colors, on a
120
+ * terminal `columns` wide: clack wraps only a note, so any other line wider
121
+ * than the terminal is one the terminal wraps.
122
+ */
123
+ declare const renderClackLog: (calls: readonly ClackLogCall[], { columns }?: {
124
+ columns?: number;
125
+ }) => string[];
126
+ /**
127
+ * The columns a line takes in a terminal, as East Asian Width counts them,
128
+ * not its bytes or code units: `│`, `■`, and `…` take one each, a wide
129
+ * character or an emoji two, and a combining mark none. The CLI keeps its
130
+ * own count; this one is the specs' measure of it.
131
+ */
132
+ declare const displayColumns: (line: string) => number;
133
+ /**
134
+ * The lines wider than `columns` display columns, which a terminal that
135
+ * wide wraps, but for a line that is one word after clack's gutter, such
136
+ * as a URL, which no line break could shorten.
137
+ */
138
+ declare const linesWiderThan: (lines: readonly string[], columns?: number) => string[];
139
+ //#endregion
108
140
  //#region src/setupHandlerIntegrationTestSuite.d.ts
109
141
  declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
110
142
  /**
@@ -151,4 +183,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
151
183
  declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
152
184
  declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
153
185
  //#endregion
154
- export { D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
186
+ export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, displayColumns, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, linesWiderThan, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
package/dist/node.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ChildProcessByStdio } from "node:child_process";
2
+ import { Readable } from "node:stream";
2
3
  import { execa } from "execa";
3
4
  import { DatabaseSync } from "node:sqlite";
4
- import { Readable } from "node:stream";
5
5
  import { BundleRow, SqlExecutor, StorageAdapter } from "@hot-updater/plugin-core";
6
6
  import { ArtifactFiles, ArtifactInfo } from "@hot-updater/protocol";
7
7
  import { PGlite } from "@electric-sql/pglite";
@@ -105,6 +105,38 @@ declare const RELEASE_CATALOG_STORAGE_FIXTURES: Readonly<Record<string, string>>
105
105
  /** Storage boundary shared by provider and separately spawned server tests. */
106
106
  declare const createReleaseCatalogTestStorage: () => StorageAdapter;
107
107
  //#endregion
108
+ //#region src/renderClackLog.d.ts
109
+ /** The `p` calls a command prints with, as a spec's stand-ins record them. */
110
+ type ClackLogMethod = "message" | "info" | "success" | "step" | "warn" | "error" | "note" | "intro" | "outro" | "cancel";
111
+ /** One call: the method and its arguments, such as a note's title. */
112
+ type ClackLogCall = readonly [method: ClackLogMethod, ...args: readonly unknown[]];
113
+ /**
114
+ * The calls a spec's stand-ins for `p.log` (and `p.note`, `p.outro`, ...)
115
+ * recorded, in the order the command made them.
116
+ */
117
+ declare const recordedClackCalls: (...stubs: readonly object[]) => ClackLogCall[];
118
+ /**
119
+ * The lines the calls print through `@clack/prompts`, without colors, on a
120
+ * terminal `columns` wide: clack wraps only a note, so any other line wider
121
+ * than the terminal is one the terminal wraps.
122
+ */
123
+ declare const renderClackLog: (calls: readonly ClackLogCall[], { columns }?: {
124
+ columns?: number;
125
+ }) => string[];
126
+ /**
127
+ * The columns a line takes in a terminal, as East Asian Width counts them,
128
+ * not its bytes or code units: `│`, `■`, and `…` take one each, a wide
129
+ * character or an emoji two, and a combining mark none. The CLI keeps its
130
+ * own count; this one is the specs' measure of it.
131
+ */
132
+ declare const displayColumns: (line: string) => number;
133
+ /**
134
+ * The lines wider than `columns` display columns, which a terminal that
135
+ * wide wraps, but for a line that is one word after clack's gutter, such
136
+ * as a URL, which no line break could shorten.
137
+ */
138
+ declare const linesWiderThan: (lines: readonly string[], columns?: number) => string[];
139
+ //#endregion
108
140
  //#region src/setupHandlerIntegrationTestSuite.d.ts
109
141
  declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
110
142
  /**
@@ -151,4 +183,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
151
183
  declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
152
184
  declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
153
185
  //#endregion
154
- export { D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
186
+ export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, displayColumns, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, linesWiderThan, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
package/dist/node.mjs CHANGED
@@ -7,6 +7,9 @@ import fs$1 from "fs/promises";
7
7
  import { spawn, spawnSync } from "node:child_process";
8
8
  import net from "node:net";
9
9
  import { createServer } from "node:http";
10
+ import { Writable } from "node:stream";
11
+ import { stripVTControlCharacters, styleText } from "node:util";
12
+ import process$1 from "node:process";
10
13
  import { execa } from "execa";
11
14
  //#region \0rolldown/runtime.js
12
15
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
@@ -20333,6 +20336,572 @@ const createReleaseCatalogTestStorage = () => ({
20333
20336
  }
20334
20337
  });
20335
20338
  //#endregion
20339
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
20340
+ const getCodePointsLength = (() => {
20341
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
20342
+ return (input) => {
20343
+ let surrogatePairsNr = 0;
20344
+ SURROGATE_PAIR_RE.lastIndex = 0;
20345
+ while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
20346
+ return input.length - surrogatePairsNr;
20347
+ };
20348
+ })();
20349
+ const isFullWidth = (x) => {
20350
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
20351
+ };
20352
+ const isWideNotCJKTNotEmoji = (x) => {
20353
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
20354
+ };
20355
+ //#endregion
20356
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
20357
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
20358
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
20359
+ const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
20360
+ const TAB_RE = /\t{1,1000}/y;
20361
+ 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;
20362
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
20363
+ const MODIFIER_RE = /\p{M}+/gu;
20364
+ const NO_TRUNCATION$1 = {
20365
+ limit: Infinity,
20366
+ ellipsis: ""
20367
+ };
20368
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
20369
+ const LIMIT = truncationOptions.limit ?? Infinity;
20370
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
20371
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
20372
+ const ANSI_WIDTH = 0;
20373
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
20374
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
20375
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
20376
+ const FULL_WIDTH_WIDTH = 2;
20377
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
20378
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
20379
+ const PARSE_BLOCKS = [
20380
+ [LATIN_RE, REGULAR_WIDTH],
20381
+ [ANSI_RE, ANSI_WIDTH],
20382
+ [CONTROL_RE, CONTROL_WIDTH],
20383
+ [TAB_RE, TAB_WIDTH],
20384
+ [EMOJI_RE, EMOJI_WIDTH],
20385
+ [CJKT_WIDE_RE, WIDE_WIDTH]
20386
+ ];
20387
+ let indexPrev = 0;
20388
+ let index = 0;
20389
+ let length = input.length;
20390
+ let lengthExtra = 0;
20391
+ let truncationEnabled = false;
20392
+ let truncationIndex = length;
20393
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
20394
+ let unmatchedStart = 0;
20395
+ let unmatchedEnd = 0;
20396
+ let width = 0;
20397
+ let widthExtra = 0;
20398
+ outer: while (true) {
20399
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
20400
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
20401
+ lengthExtra = 0;
20402
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
20403
+ const codePoint = char.codePointAt(0) || 0;
20404
+ if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
20405
+ else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
20406
+ else widthExtra = REGULAR_WIDTH;
20407
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
20408
+ if (width + widthExtra > LIMIT) {
20409
+ truncationEnabled = true;
20410
+ break outer;
20411
+ }
20412
+ lengthExtra += char.length;
20413
+ width += widthExtra;
20414
+ }
20415
+ unmatchedStart = unmatchedEnd = 0;
20416
+ }
20417
+ if (index >= length) break outer;
20418
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
20419
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
20420
+ BLOCK_RE.lastIndex = index;
20421
+ if (BLOCK_RE.test(input)) {
20422
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
20423
+ widthExtra = lengthExtra * BLOCK_WIDTH;
20424
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
20425
+ if (width + widthExtra > LIMIT) {
20426
+ truncationEnabled = true;
20427
+ break outer;
20428
+ }
20429
+ width += widthExtra;
20430
+ unmatchedStart = indexPrev;
20431
+ unmatchedEnd = index;
20432
+ index = indexPrev = BLOCK_RE.lastIndex;
20433
+ continue outer;
20434
+ }
20435
+ }
20436
+ index += 1;
20437
+ }
20438
+ return {
20439
+ width: truncationEnabled ? truncationLimit : width,
20440
+ index: truncationEnabled ? truncationIndex : length,
20441
+ truncated: truncationEnabled,
20442
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
20443
+ };
20444
+ };
20445
+ //#endregion
20446
+ //#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
20447
+ const NO_TRUNCATION = {
20448
+ limit: Infinity,
20449
+ ellipsis: "",
20450
+ ellipsisWidth: 0
20451
+ };
20452
+ const fastStringWidth = (input, options = {}) => {
20453
+ return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
20454
+ };
20455
+ //#endregion
20456
+ //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
20457
+ const ESC = "\x1B";
20458
+ const CSI = "›";
20459
+ const END_CODE = 39;
20460
+ const ANSI_ESCAPE_BELL = "\x07";
20461
+ const ANSI_CSI = "[";
20462
+ const ANSI_OSC = "]";
20463
+ const ANSI_SGR_TERMINATOR = "m";
20464
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
20465
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
20466
+ const getClosingCode = (openingCode) => {
20467
+ if (openingCode >= 30 && openingCode <= 37) return 39;
20468
+ if (openingCode >= 90 && openingCode <= 97) return 39;
20469
+ if (openingCode >= 40 && openingCode <= 47) return 49;
20470
+ if (openingCode >= 100 && openingCode <= 107) return 49;
20471
+ if (openingCode === 1 || openingCode === 2) return 22;
20472
+ if (openingCode === 3) return 23;
20473
+ if (openingCode === 4) return 24;
20474
+ if (openingCode === 7) return 27;
20475
+ if (openingCode === 8) return 28;
20476
+ if (openingCode === 9) return 29;
20477
+ if (openingCode === 0) return 0;
20478
+ };
20479
+ const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
20480
+ const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
20481
+ const wrapWord = (rows, word, columns) => {
20482
+ const characters = word[Symbol.iterator]();
20483
+ let isInsideEscape = false;
20484
+ let isInsideLinkEscape = false;
20485
+ let lastRow = rows.at(-1);
20486
+ let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
20487
+ let currentCharacter = characters.next();
20488
+ let nextCharacter = characters.next();
20489
+ let rawCharacterIndex = 0;
20490
+ while (!currentCharacter.done) {
20491
+ const character = currentCharacter.value;
20492
+ const characterLength = fastStringWidth(character);
20493
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
20494
+ else {
20495
+ rows.push(character);
20496
+ visible = 0;
20497
+ }
20498
+ if (character === ESC || character === CSI) {
20499
+ isInsideEscape = true;
20500
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
20501
+ }
20502
+ if (isInsideEscape) {
20503
+ if (isInsideLinkEscape) {
20504
+ if (character === ANSI_ESCAPE_BELL) {
20505
+ isInsideEscape = false;
20506
+ isInsideLinkEscape = false;
20507
+ }
20508
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
20509
+ } else {
20510
+ visible += characterLength;
20511
+ if (visible === columns && !nextCharacter.done) {
20512
+ rows.push("");
20513
+ visible = 0;
20514
+ }
20515
+ }
20516
+ currentCharacter = nextCharacter;
20517
+ nextCharacter = characters.next();
20518
+ rawCharacterIndex += character.length;
20519
+ }
20520
+ lastRow = rows.at(-1);
20521
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
20522
+ };
20523
+ const stringVisibleTrimSpacesRight = (string) => {
20524
+ const words = string.split(" ");
20525
+ let last = words.length;
20526
+ while (last) {
20527
+ if (fastStringWidth(words[last - 1])) break;
20528
+ last--;
20529
+ }
20530
+ if (last === words.length) return string;
20531
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
20532
+ };
20533
+ const exec = (string, columns, options = {}) => {
20534
+ if (options.trim !== false && string.trim() === "") return "";
20535
+ let returnValue = "";
20536
+ let escapeCode;
20537
+ let escapeUrl;
20538
+ const words = string.split(" ");
20539
+ let rows = [""];
20540
+ let rowLength = 0;
20541
+ for (let index = 0; index < words.length; index++) {
20542
+ const word = words[index];
20543
+ if (options.trim !== false) {
20544
+ const row = rows.at(-1) ?? "";
20545
+ const trimmed = row.trimStart();
20546
+ if (row.length !== trimmed.length) {
20547
+ rows[rows.length - 1] = trimmed;
20548
+ rowLength = fastStringWidth(trimmed);
20549
+ }
20550
+ }
20551
+ if (index !== 0) {
20552
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
20553
+ rows.push("");
20554
+ rowLength = 0;
20555
+ }
20556
+ if (rowLength || options.trim === false) {
20557
+ rows[rows.length - 1] += " ";
20558
+ rowLength++;
20559
+ }
20560
+ }
20561
+ const wordLength = fastStringWidth(word);
20562
+ if (options.hard && wordLength > columns) {
20563
+ const remainingColumns = columns - rowLength;
20564
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
20565
+ if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
20566
+ wrapWord(rows, word, columns);
20567
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20568
+ continue;
20569
+ }
20570
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
20571
+ if (options.wordWrap === false && rowLength < columns) {
20572
+ wrapWord(rows, word, columns);
20573
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20574
+ continue;
20575
+ }
20576
+ rows.push("");
20577
+ rowLength = 0;
20578
+ }
20579
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
20580
+ wrapWord(rows, word, columns);
20581
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
20582
+ continue;
20583
+ }
20584
+ rows[rows.length - 1] += word;
20585
+ rowLength += wordLength;
20586
+ }
20587
+ if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
20588
+ const preString = rows.join("\n");
20589
+ let inSurrogate = false;
20590
+ for (let i = 0; i < preString.length; i++) {
20591
+ const character = preString[i];
20592
+ returnValue += character;
20593
+ if (!inSurrogate) {
20594
+ inSurrogate = character >= "\ud800" && character <= "\udbff";
20595
+ if (inSurrogate) continue;
20596
+ } else inSurrogate = false;
20597
+ if (character === ESC || character === CSI) {
20598
+ GROUP_REGEX.lastIndex = i + 1;
20599
+ const groups = GROUP_REGEX.exec(preString)?.groups;
20600
+ if (groups?.code !== void 0) {
20601
+ const code = Number.parseFloat(groups.code);
20602
+ escapeCode = code === END_CODE ? void 0 : code;
20603
+ } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
20604
+ }
20605
+ if (preString[i + 1] === "\n") {
20606
+ if (escapeUrl) returnValue += wrapAnsiHyperlink("");
20607
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
20608
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
20609
+ } else if (character === "\n") {
20610
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
20611
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
20612
+ }
20613
+ }
20614
+ return returnValue;
20615
+ };
20616
+ const CRLF_OR_LF = /\r?\n/;
20617
+ function wrapAnsi(string, columns, options) {
20618
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
20619
+ }
20620
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
20621
+ const ESC = "\x1B";
20622
+ const CSI = `${ESC}[`;
20623
+ const beep = "\x07";
20624
+ const cursor = {
20625
+ to(x, y) {
20626
+ if (!y) return `${CSI}${x + 1}G`;
20627
+ return `${CSI}${y + 1};${x + 1}H`;
20628
+ },
20629
+ move(x, y) {
20630
+ let ret = "";
20631
+ if (x < 0) ret += `${CSI}${-x}D`;
20632
+ else if (x > 0) ret += `${CSI}${x}C`;
20633
+ if (y < 0) ret += `${CSI}${-y}A`;
20634
+ else if (y > 0) ret += `${CSI}${y}B`;
20635
+ return ret;
20636
+ },
20637
+ up: (count = 1) => `${CSI}${count}A`,
20638
+ down: (count = 1) => `${CSI}${count}B`,
20639
+ forward: (count = 1) => `${CSI}${count}C`,
20640
+ backward: (count = 1) => `${CSI}${count}D`,
20641
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
20642
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
20643
+ left: `${CSI}G`,
20644
+ hide: `${CSI}?25l`,
20645
+ show: `${CSI}?25h`,
20646
+ save: `${ESC}7`,
20647
+ restore: `${ESC}8`
20648
+ };
20649
+ module.exports = {
20650
+ cursor,
20651
+ scroll: {
20652
+ up: (count = 1) => `${CSI}S`.repeat(count),
20653
+ down: (count = 1) => `${CSI}T`.repeat(count)
20654
+ },
20655
+ erase: {
20656
+ screen: `${CSI}2J`,
20657
+ up: (count = 1) => `${CSI}1J`.repeat(count),
20658
+ down: (count = 1) => `${CSI}J`.repeat(count),
20659
+ line: `${CSI}2K`,
20660
+ lineEnd: `${CSI}K`,
20661
+ lineStart: `${CSI}1K`,
20662
+ lines(count) {
20663
+ let clear = "";
20664
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
20665
+ if (count) clear += cursor.left;
20666
+ return clear;
20667
+ }
20668
+ },
20669
+ beep
20670
+ };
20671
+ })))();
20672
+ const settings = {
20673
+ actions: /* @__PURE__ */ new Set([
20674
+ "up",
20675
+ "down",
20676
+ "left",
20677
+ "right",
20678
+ "space",
20679
+ "enter",
20680
+ "cancel"
20681
+ ]),
20682
+ aliases: /* @__PURE__ */ new Map([
20683
+ ["k", "up"],
20684
+ ["j", "down"],
20685
+ ["h", "left"],
20686
+ ["l", "right"],
20687
+ ["", "cancel"],
20688
+ ["escape", "cancel"]
20689
+ ]),
20690
+ messages: {
20691
+ cancel: "Canceled",
20692
+ error: "Something went wrong"
20693
+ },
20694
+ withGuide: true,
20695
+ date: {
20696
+ monthNames: [...[
20697
+ "January",
20698
+ "February",
20699
+ "March",
20700
+ "April",
20701
+ "May",
20702
+ "June",
20703
+ "July",
20704
+ "August",
20705
+ "September",
20706
+ "October",
20707
+ "November",
20708
+ "December"
20709
+ ]],
20710
+ messages: {
20711
+ required: "Please enter a valid date",
20712
+ invalidMonth: "There are only 12 months in a year",
20713
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
20714
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
20715
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
20716
+ }
20717
+ }
20718
+ };
20719
+ globalThis.process.platform.startsWith("win");
20720
+ const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
20721
+ //#endregion
20722
+ //#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
20723
+ function isUnicodeSupported() {
20724
+ if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
20725
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
20726
+ }
20727
+ const unicode = isUnicodeSupported();
20728
+ const unicodeOr = (o, e) => unicode ? o : e;
20729
+ const S_STEP_SUBMIT = unicodeOr("◇", "o");
20730
+ const S_BAR_START = unicodeOr("┌", "T");
20731
+ const S_BAR = unicodeOr("│", "|");
20732
+ const S_BAR_END = unicodeOr("└", "—");
20733
+ const S_BAR_H = unicodeOr("─", "-");
20734
+ const S_CORNER_TOP_RIGHT = unicodeOr("╮", "+");
20735
+ const S_CONNECT_LEFT = unicodeOr("├", "+");
20736
+ const S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+");
20737
+ const S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+");
20738
+ const S_INFO = unicodeOr("●", "•");
20739
+ const S_SUCCESS = unicodeOr("◆", "*");
20740
+ const S_WARN = unicodeOr("▲", "!");
20741
+ const S_ERROR = unicodeOr("■", "x");
20742
+ `${styleText("dim", "↑/↓")}`, `${styleText("dim", "Space:")}`, `${styleText("dim", "Enter:")}`;
20743
+ const log = {
20744
+ message: (s = [], { symbol: e = styleText("gray", S_BAR), secondarySymbol: r = styleText("gray", S_BAR), output: m = process.stdout, spacing: l = 1, withGuide: c } = {}) => {
20745
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
20746
+ for (let i = 0; i < l; i++) t.push(f);
20747
+ const g = Array.isArray(s) ? s : s.split(`
20748
+ `);
20749
+ if (g.length > 0) {
20750
+ const [i, ...y] = g;
20751
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
20752
+ for (const p of y) p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
20753
+ }
20754
+ m.write(`${t.join(`
20755
+ `)}
20756
+ `);
20757
+ },
20758
+ info: (s, e) => {
20759
+ log.message(s, {
20760
+ ...e,
20761
+ symbol: styleText("blue", S_INFO)
20762
+ });
20763
+ },
20764
+ success: (s, e) => {
20765
+ log.message(s, {
20766
+ ...e,
20767
+ symbol: styleText("green", S_SUCCESS)
20768
+ });
20769
+ },
20770
+ step: (s, e) => {
20771
+ log.message(s, {
20772
+ ...e,
20773
+ symbol: styleText("green", S_STEP_SUBMIT)
20774
+ });
20775
+ },
20776
+ warn: (s, e) => {
20777
+ log.message(s, {
20778
+ ...e,
20779
+ symbol: styleText("yellow", S_WARN)
20780
+ });
20781
+ },
20782
+ /** alias for `log.warn()`. */
20783
+ warning: (s, e) => {
20784
+ log.warn(s, e);
20785
+ },
20786
+ error: (s, e) => {
20787
+ log.message(s, {
20788
+ ...e,
20789
+ symbol: styleText("red", S_ERROR)
20790
+ });
20791
+ }
20792
+ };
20793
+ const cancel = (o = "", t) => {
20794
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_END)} ` : "";
20795
+ i.write(`${e}${styleText("red", o)}
20796
+
20797
+ `);
20798
+ };
20799
+ const intro = (o = "", t) => {
20800
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_START)} ` : "";
20801
+ i.write(`${e}${o}
20802
+ `);
20803
+ };
20804
+ const outro = (o = "", t) => {
20805
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
20806
+ ${styleText("gray", S_BAR_END)} ` : "";
20807
+ i.write(`${e}${o}
20808
+
20809
+ `);
20810
+ };
20811
+ const W$1 = (o) => o;
20812
+ const C = (o, e, s) => {
20813
+ const a = {
20814
+ hard: true,
20815
+ trim: false
20816
+ }, i = wrapAnsi(o, e, a).split(`
20817
+ `), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
20818
+ return wrapAnsi(o, e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c), a);
20819
+ };
20820
+ const note = (o = "", e = "", s) => {
20821
+ const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
20822
+ "",
20823
+ ...C(o, getColumns(a) - 6, c).split(`
20824
+ `).map(c),
20825
+ ""
20826
+ ], n = fastStringWidth(e), t = Math.max(g.reduce((m, F) => {
20827
+ const O = fastStringWidth(F);
20828
+ return O > m ? O : m;
20829
+ }, 0), n) + 2, h = g.map((m) => `${styleText("gray", S_BAR)} ${m}${" ".repeat(t - fastStringWidth(m))}${styleText("gray", S_BAR)}`).join(`
20830
+ `), T = i ? `${styleText("gray", S_BAR)}
20831
+ ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
20832
+ a.write(`${T}${styleText("green", S_STEP_SUBMIT)} ${styleText("reset", e)} ${styleText("gray", S_BAR_H.repeat(Math.max(t - n - 1, 1)) + S_CORNER_TOP_RIGHT)}
20833
+ ${h}
20834
+ ${styleText("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
20835
+ `);
20836
+ };
20837
+ `${styleText("dim", "↑/↓")}`, `${styleText("dim", "Enter:")}`;
20838
+ `${styleText("gray", S_BAR)}`;
20839
+ //#endregion
20840
+ //#region src/renderClackLog.ts
20841
+ const METHODS = /* @__PURE__ */ new Set([
20842
+ "message",
20843
+ "info",
20844
+ "success",
20845
+ "step",
20846
+ "warn",
20847
+ "error",
20848
+ "note",
20849
+ "intro",
20850
+ "outro",
20851
+ "cancel"
20852
+ ]);
20853
+ /**
20854
+ * The calls a spec's stand-ins for `p.log` (and `p.note`, `p.outro`, ...)
20855
+ * recorded, in the order the command made them.
20856
+ */
20857
+ const recordedClackCalls = (...stubs) => stubs.flatMap((stub) => Object.entries(stub).flatMap(([method, fn]) => {
20858
+ const mock = fn?.mock;
20859
+ if (!mock || !METHODS.has(method)) return [];
20860
+ return mock.calls.map((args, index) => [mock.invocationCallOrder[index] ?? 0, [method, ...args]]);
20861
+ })).sort(([a], [b]) => a - b).map(([, call]) => call);
20862
+ /**
20863
+ * The lines the calls print through `@clack/prompts`, without colors, on a
20864
+ * terminal `columns` wide: clack wraps only a note, so any other line wider
20865
+ * than the terminal is one the terminal wraps.
20866
+ */
20867
+ const renderClackLog = (calls, { columns = 80 } = {}) => {
20868
+ let text = "";
20869
+ const options = {
20870
+ output: Object.assign(new Writable({ write(chunk, _encoding, done) {
20871
+ text += String(chunk);
20872
+ done();
20873
+ } }), {
20874
+ columns,
20875
+ isTTY: false
20876
+ }),
20877
+ withGuide: true
20878
+ };
20879
+ for (const [method, ...args] of calls) {
20880
+ const [message = "", title = ""] = args.map((arg) => arg === void 0 ? "" : String(arg));
20881
+ if (method === "note") note(message, title, options);
20882
+ else if (method === "intro") intro(message, options);
20883
+ else if (method === "outro") outro(message, options);
20884
+ else if (method === "cancel") cancel(message, options);
20885
+ else log[method](message, options);
20886
+ }
20887
+ return stripVTControlCharacters(text).replace(/\n+$/, "").split("\n");
20888
+ };
20889
+ const graphemes = new Intl.Segmenter();
20890
+ const WIDE_PATTERN = /[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Emoji_Presentation}/u;
20891
+ /**
20892
+ * The columns a line takes in a terminal, as East Asian Width counts them,
20893
+ * not its bytes or code units: `│`, `■`, and `…` take one each, a wide
20894
+ * character or an emoji two, and a combining mark none. The CLI keeps its
20895
+ * own count; this one is the specs' measure of it.
20896
+ */
20897
+ const displayColumns = (line) => [...graphemes.segment(stripVTControlCharacters(line))].reduce((columns, { segment }) => columns + (/^[\p{M}\p{Cf}\p{Cc}]+$/u.test(segment) ? 0 : WIDE_PATTERN.test(segment) ? 2 : 1), 0);
20898
+ /**
20899
+ * The lines wider than `columns` display columns, which a terminal that
20900
+ * wide wraps, but for a line that is one word after clack's gutter, such
20901
+ * as a URL, which no line break could shorten.
20902
+ */
20903
+ const linesWiderThan = (lines, columns = 80) => lines.filter((line) => displayColumns(line) > columns && /\s/u.test(line.slice(3).trim()));
20904
+ //#endregion
20336
20905
  //#region src/setupHandlerIntegrationTestSuite.ts
20337
20906
  const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
20338
20907
  /**
@@ -20593,4 +21162,4 @@ const mysqlExecutor = (pool) => {
20593
21162
  };
20594
21163
  };
20595
21164
  //#endregion
20596
- export { RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
21165
+ export { RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, displayColumns, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, linesWiderThan, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/test-utils",
3
- "version": "1.2.0-rc.1",
3
+ "version": "1.2.0-rc.11",
4
4
  "type": "module",
5
5
  "description": "Test utilities for Hot Updater packages",
6
6
  "sideEffects": false,
@@ -50,10 +50,10 @@
50
50
  "mysql2": "*",
51
51
  "pg": "*",
52
52
  "vitest": "^4.0.0",
53
- "@hot-updater/plugin-insights": "^1.2.0-rc.1",
54
- "@hot-updater/protocol": "^1.2.0-rc.1",
55
- "@hot-updater/plugin-core": "^1.2.0-rc.1",
56
- "@hot-updater/server": "^1.2.0-rc.1"
53
+ "@hot-updater/plugin-insights": "^1.2.0-rc.11",
54
+ "@hot-updater/plugin-core": "^1.2.0-rc.11",
55
+ "@hot-updater/protocol": "^1.2.0-rc.11",
56
+ "@hot-updater/server": "^1.2.0-rc.11"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@electric-sql/pglite": {
@@ -73,6 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
+ "@clack/prompts": "1.7.0",
76
77
  "@electric-sql/pglite": "0.4.1",
77
78
  "@types/node": "^20",
78
79
  "@types/pg": "^8.11.10",
@@ -83,10 +84,10 @@
83
84
  "typescript": "npm:@typescript/typescript6@6.0.2",
84
85
  "vitest": "4.1.4",
85
86
  "workspace-tools": "^0.41.7",
86
- "@hot-updater/protocol": "1.2.0-rc.1",
87
- "@hot-updater/plugin-core": "1.2.0-rc.1",
88
- "@hot-updater/server": "1.2.0-rc.1",
89
- "@hot-updater/plugin-insights": "1.2.0-rc.1"
87
+ "@hot-updater/plugin-insights": "1.2.0-rc.11",
88
+ "@hot-updater/plugin-core": "1.2.0-rc.11",
89
+ "@hot-updater/server": "1.2.0-rc.11",
90
+ "@hot-updater/protocol": "1.2.0-rc.11"
90
91
  },
91
92
  "inlinedDependencies": {
92
93
  "@nodelib/fs.scandir": "2.1.5",