@hot-updater/test-utils 1.2.0-rc.2 → 1.2.0-rc.20

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.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,557 @@ 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
+ //#endregion
20336
20890
  //#region src/setupHandlerIntegrationTestSuite.ts
20337
20891
  const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
20338
20892
  /**
@@ -20593,4 +21147,4 @@ const mysqlExecutor = (pool) => {
20593
21147
  };
20594
21148
  };
20595
21149
  //#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 };
21150
+ 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, 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.2",
3
+ "version": "1.2.0-rc.20",
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.2",
54
- "@hot-updater/protocol": "^1.2.0-rc.2",
55
- "@hot-updater/server": "^1.2.0-rc.2",
56
- "@hot-updater/plugin-core": "^1.2.0-rc.2"
53
+ "@hot-updater/plugin-insights": "^1.2.0-rc.20",
54
+ "@hot-updater/server": "^1.2.0-rc.20",
55
+ "@hot-updater/plugin-core": "^1.2.0-rc.20",
56
+ "@hot-updater/protocol": "^1.2.0-rc.20"
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.2",
87
- "@hot-updater/plugin-core": "1.2.0-rc.2",
88
- "@hot-updater/server": "1.2.0-rc.2",
89
- "@hot-updater/plugin-insights": "1.2.0-rc.2"
87
+ "@hot-updater/plugin-insights": "1.2.0-rc.20",
88
+ "@hot-updater/protocol": "1.2.0-rc.20",
89
+ "@hot-updater/plugin-core": "1.2.0-rc.20",
90
+ "@hot-updater/server": "1.2.0-rc.20"
90
91
  },
91
92
  "inlinedDependencies": {
92
93
  "@nodelib/fs.scandir": "2.1.5",