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

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,557 @@ 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
+ //#endregion
20360
20915
  //#region src/setupHandlerIntegrationTestSuite.ts
20361
20916
  const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
20362
20917
  /**
@@ -20641,9 +21196,11 @@ exports.pgBatchExecutor = pgBatchExecutor;
20641
21196
  exports.pgExecutor = pgExecutor;
20642
21197
  exports.pgliteBatchExecutor = pgliteBatchExecutor;
20643
21198
  exports.pgliteExecutor = pgliteExecutor;
21199
+ exports.recordedClackCalls = recordedClackCalls;
20644
21200
  exports.releaseCatalogArtifact = releaseCatalogArtifact;
20645
21201
  exports.releaseCatalogArtifactFiles = releaseCatalogArtifactFiles;
20646
21202
  exports.releaseCatalogDownloadUrl = releaseCatalogDownloadUrl;
21203
+ exports.renderClackLog = renderClackLog;
20647
21204
  exports.runCheckedCommand = runCheckedCommand;
20648
21205
  exports.spawnRuntime = spawnRuntime;
20649
21206
  exports.spawnServerProcess = spawnServerProcess;
package/dist/node.d.cts CHANGED
@@ -105,6 +105,25 @@ 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
+ //#endregion
108
127
  //#region src/setupHandlerIntegrationTestSuite.d.ts
109
128
  declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
110
129
  /**
@@ -151,4 +170,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
151
170
  declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
152
171
  declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
153
172
  //#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 };
173
+ 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, 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/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,25 @@ 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
+ //#endregion
108
127
  //#region src/setupHandlerIntegrationTestSuite.d.ts
109
128
  declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
110
129
  /**
@@ -151,4 +170,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
151
170
  declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
152
171
  declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
153
172
  //#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 };
173
+ 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, 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 };