@mizchi/vlmkit-core 0.23.2 → 0.28.0

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.
Files changed (112) hide show
  1. package/dist/a11y-semantic.d.mts +6 -10
  2. package/dist/a11y-semantic.mjs +3 -4
  3. package/dist/animated-image.d.mts +27 -0
  4. package/dist/animated-image.mjs +112 -0
  5. package/dist/apng.d.mts +5 -9
  6. package/dist/apng.mjs +6 -7
  7. package/dist/arg-reader.d.mts +9 -12
  8. package/dist/arg-reader.mjs +1 -2
  9. package/dist/auth-state.d.mts +6 -9
  10. package/dist/auth-state.mjs +1 -2
  11. package/dist/authored-style-capture.d.mts +7 -10
  12. package/dist/authored-style-capture.mjs +1 -2
  13. package/dist/authored-style-diff.d.mts +8 -12
  14. package/dist/authored-style-diff.mjs +1 -2
  15. package/dist/bitmap-font.d.mts +7 -10
  16. package/dist/bitmap-font.mjs +1 -2
  17. package/dist/browser-launch.d.mts +7 -11
  18. package/dist/browser-launch.mjs +1 -2
  19. package/dist/cli-args.d.mts +8 -11
  20. package/dist/cli-args.mjs +1 -2
  21. package/dist/cli-error.d.mts +10 -13
  22. package/dist/cli-error.mjs +2 -3
  23. package/dist/computed-style-capture.d.mts +20 -23
  24. package/dist/computed-style-capture.mjs +4 -5
  25. package/dist/computed-style-diff.d.mts +8 -11
  26. package/dist/computed-style-diff.mjs +2 -3
  27. package/dist/diff-regions.d.mts +3 -7
  28. package/dist/diff-regions.mjs +1 -2
  29. package/dist/dom-equivalence.d.mts +5 -8
  30. package/dist/dom-equivalence.mjs +1 -2
  31. package/dist/dom-position-styles.d.mts +14 -15
  32. package/dist/dom-position-styles.mjs +4 -5
  33. package/dist/element-compare.d.mts +8 -9
  34. package/dist/element-compare.mjs +5 -5
  35. package/dist/filmstrip.d.mts +60 -9
  36. package/dist/filmstrip.mjs +83 -12
  37. package/dist/gate-config.d.mts +18 -22
  38. package/dist/gate-config.mjs +8 -4
  39. package/dist/gate-exit.d.mts +5 -8
  40. package/dist/gate-exit.mjs +1 -2
  41. package/dist/gif.d.mts +41 -0
  42. package/dist/gif.mjs +73 -0
  43. package/dist/heatmap-regions.d.mts +4 -7
  44. package/dist/heatmap-regions.mjs +1 -2
  45. package/dist/heatmap.d.mts +21 -17
  46. package/dist/heatmap.mjs +23 -11
  47. package/dist/image-resize.d.mts +9 -12
  48. package/dist/image-resize.mjs +1 -2
  49. package/dist/image-timing.d.mts +57 -0
  50. package/dist/image-timing.mjs +166 -0
  51. package/dist/index.d.mts +14 -14
  52. package/dist/index.mjs +11 -11
  53. package/dist/mask.d.mts +5 -9
  54. package/dist/mask.mjs +1 -2
  55. package/dist/motion-spec.d.mts +97 -0
  56. package/dist/motion-spec.mjs +145 -0
  57. package/dist/navigation-redirect.d.mts +1 -4
  58. package/dist/navigation-redirect.mjs +1 -2
  59. package/dist/page-load.d.mts +40 -16
  60. package/dist/page-load.mjs +34 -5
  61. package/dist/page-open.d.mts +15 -15
  62. package/dist/page-open.mjs +4 -3
  63. package/dist/plugin/args.d.mts +16 -12
  64. package/dist/plugin/args.mjs +15 -4
  65. package/dist/plugin/browser.d.mts +3 -3
  66. package/dist/plugin/browser.mjs +2 -2
  67. package/dist/plugin/cli-entry.d.mts +1 -4
  68. package/dist/plugin/cli-entry.mjs +1 -2
  69. package/dist/plugin/contract.d.mts +17 -21
  70. package/dist/plugin/contract.mjs +1 -2
  71. package/dist/plugin/index.d.mts +6 -9
  72. package/dist/plugin/index.mjs +7 -8
  73. package/dist/plugin/load.d.mts +7 -11
  74. package/dist/plugin/load.mjs +1 -2
  75. package/dist/plugin/registry.d.mts +8 -12
  76. package/dist/plugin/registry.mjs +1 -2
  77. package/dist/plugin/rule-prose.d.mts +4 -8
  78. package/dist/plugin/rule-prose.mjs +1 -2
  79. package/dist/plugin/rule-tier.d.mts +7 -11
  80. package/dist/plugin/rule-tier.mjs +1 -2
  81. package/dist/plugin/rules.d.mts +18 -22
  82. package/dist/plugin/rules.mjs +1 -2
  83. package/dist/plugin/runner.d.mts +18 -21
  84. package/dist/plugin/runner.mjs +55 -6
  85. package/dist/png-decode.d.mts +17 -0
  86. package/dist/png-decode.mjs +160 -0
  87. package/dist/png-utils.d.mts +7 -10
  88. package/dist/png-utils.mjs +3 -3
  89. package/dist/project-config.d.mts +7 -10
  90. package/dist/project-config.mjs +1 -2
  91. package/dist/rect-overlap.d.mts +3 -6
  92. package/dist/rect-overlap.mjs +1 -2
  93. package/dist/region-shift.d.mts +3 -6
  94. package/dist/region-shift.mjs +1 -2
  95. package/dist/run-ledger.d.mts +10 -13
  96. package/dist/run-ledger.mjs +4 -4
  97. package/dist/stable-selector.d.mts +1 -4
  98. package/dist/stable-selector.mjs +1 -2
  99. package/dist/terminal-colors.d.mts +8 -11
  100. package/dist/terminal-colors.mjs +1 -2
  101. package/dist/text-rows.d.mts +10 -13
  102. package/dist/text-rows.mjs +1 -2
  103. package/dist/types.d.mts +87 -64
  104. package/dist/version.d.mts +1 -4
  105. package/dist/version.mjs +2 -3
  106. package/dist/video-decode.d.mts +144 -0
  107. package/dist/video-decode.mjs +939 -0
  108. package/dist/video-frames.d.mts +310 -0
  109. package/dist/video-frames.mjs +576 -0
  110. package/dist/webp.d.mts +7 -11
  111. package/dist/webp.mjs +3 -3
  112. package/package.json +7 -7
@@ -1,12 +1,10 @@
1
1
  import { A11yDiff, A11yNode, A11ySnapshot } from "./types.mjs";
2
-
3
- //#region src/a11y-semantic.d.ts
4
- declare const LANDMARK_ROLES: Set<string>;
5
- declare const INTERACTIVE_ROLES: Set<string>;
2
+ export declare const LANDMARK_ROLES: Set<string>;
3
+ export declare const INTERACTIVE_ROLES: Set<string>;
6
4
  /**
7
5
  * Compare two a11y tree snapshots and return the semantic diff.
8
6
  */
9
- declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A11yDiff;
7
+ export declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A11yDiff;
10
8
  /**
11
9
  * A11y tree quality checks (standalone, no diff).
12
10
  *
@@ -14,8 +12,8 @@ declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A
14
12
  * interactive elements and missing alt text on images.
15
13
  *
16
14
  */
17
- declare function verifyA11yTree(tree: A11yNode): A11yIssue[];
18
- interface A11yIssue {
15
+ export declare function verifyA11yTree(tree: A11yNode): A11yIssue[];
16
+ export interface A11yIssue {
19
17
  path: string;
20
18
  rule: string;
21
19
  severity: "error" | "warning";
@@ -24,6 +22,4 @@ interface A11yIssue {
24
22
  /**
25
23
  * Convert Playwright page.accessibility.snapshot() output to A11ySnapshot.
26
24
  */
27
- declare function parsePlaywrightA11ySnapshot(testId: string, testTitle: string, raw: Record<string, unknown>): A11ySnapshot;
28
- //#endregion
29
- export { A11yIssue, INTERACTIVE_ROLES, LANDMARK_ROLES, diffA11yTrees, parsePlaywrightA11ySnapshot, verifyA11yTree };
25
+ export declare function parsePlaywrightA11ySnapshot(testId: string, testTitle: string, raw: Record<string, unknown>): A11ySnapshot;
@@ -1,5 +1,5 @@
1
- //#region src/a11y-semantic.ts
2
- const LANDMARK_ROLES = new Set([
1
+ // src/a11y-semantic.ts
2
+ const LANDMARK_ROLES = /* @__PURE__ */ new Set([
3
3
  "banner",
4
4
  "complementary",
5
5
  "contentinfo",
@@ -9,7 +9,7 @@ const LANDMARK_ROLES = new Set([
9
9
  "region",
10
10
  "search"
11
11
  ]);
12
- const INTERACTIVE_ROLES = new Set([
12
+ const INTERACTIVE_ROLES = /* @__PURE__ */ new Set([
13
13
  "button",
14
14
  "checkbox",
15
15
  "combobox",
@@ -252,5 +252,4 @@ function normalizeA11yNode(raw) {
252
252
  ...raw.children ? { children: raw.children.map(normalizeA11yNode) } : {}
253
253
  };
254
254
  }
255
- //#endregion
256
255
  export { INTERACTIVE_ROLES, LANDMARK_ROLES, diffA11yTrees, parsePlaywrightA11ySnapshot, verifyA11yTree };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Whether an image file animates, from its bytes: a GIF with more than one image, a PNG whose
3
+ * `acTL` (before its first `IDAT`) declares two or more frames and that holds two `fcTL` frame
4
+ * controls (APNG), a WebP whose `VP8X` header sets the animation flag and that holds two `ANMF`
5
+ * frames, or an AVIF whose `ftyp` names the image-sequence brand `avis`.
6
+ *
7
+ * An APNG or WebP header is a promise, not the frames: a file whose header says animated and that
8
+ * holds one frame shows one picture and never moves, and reading the header alone called it
9
+ * animated. So the frames are counted. The caller may hand over only the first bytes of a large
10
+ * file (`check flash` reads at most 8MB); when the bytes end before the chunk list does, the
11
+ * header is all there is and it is believed. An image wrongly called animated is a region the
12
+ * report says it did not judge; one wrongly called still is pixels moving on the browser's clock,
13
+ * counted as if the held clock had put them there.
14
+ *
15
+ * An animated image runs on the browser's own clock, which nothing a page's script sees can hold
16
+ * (`requestAnimationFrame`, timers and the animation timeline are what the held clock replaces), so
17
+ * a capture that holds page time still sees it move. `check flash` uses this to say which images
18
+ * it could not measure rather than judging pixels that moved on a clock it did not drive.
19
+ *
20
+ * Pure: bytes in, no I/O.
21
+ */
22
+ export type ImageFormat = "gif" | "png" | "webp" | "avif" | "other";
23
+ export interface ImageAnimation {
24
+ format: ImageFormat;
25
+ animated: boolean;
26
+ }
27
+ export declare function sniffImageAnimation(bytes: Uint8Array): ImageAnimation;
@@ -0,0 +1,112 @@
1
+ // src/animated-image.ts
2
+ const ascii = (bytes, at, length) => String.fromCharCode(...bytes.subarray(at, at + length));
3
+ const u32 = (bytes, at) => (bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0;
4
+ /** RIFF sizes are little-endian. */
5
+ const u32le = (bytes, at) => (bytes[at + 3] << 24 | bytes[at + 2] << 16 | bytes[at + 1] << 8 | bytes[at]) >>> 0;
6
+ /** A GIF animates when it holds a second image descriptor. Malformed tails count what was read. */
7
+ function gifAnimated(bytes) {
8
+ let at = 13;
9
+ const lsd = bytes[10] ?? 0;
10
+ if (lsd & 128) at += 3 * (1 << (lsd & 7) + 1);
11
+ let images = 0;
12
+ const skipSubBlocks = () => {
13
+ while (at < bytes.length) {
14
+ const size = bytes[at];
15
+ at += 1;
16
+ if (size === 0) return;
17
+ at += size;
18
+ }
19
+ };
20
+ while (at < bytes.length) {
21
+ const block = bytes[at];
22
+ if (block === 59) break;
23
+ if (block === 33) {
24
+ at += 2;
25
+ skipSubBlocks();
26
+ } else if (block === 44) {
27
+ if (++images > 1) return true;
28
+ const packed = bytes[at + 9] ?? 0;
29
+ at += 10;
30
+ if (packed & 128) at += 3 * (1 << (packed & 7) + 1);
31
+ at += 1;
32
+ skipSubBlocks();
33
+ } else break;
34
+ }
35
+ return false;
36
+ }
37
+ /**
38
+ * An APNG declares its frame count in `acTL`, which must come before the first `IDAT`, and each
39
+ * frame has an `fcTL`: the first may sit before the `IDAT` (the default image is frame 0) and the
40
+ * rest after it, so the whole chunk list is walked.
41
+ */
42
+ function pngAnimated(bytes) {
43
+ let at = 8;
44
+ let declared = 0;
45
+ let controls = 0;
46
+ while (at + 8 <= bytes.length) {
47
+ const length = u32(bytes, at);
48
+ const type = ascii(bytes, at + 4, 4);
49
+ if (type === "IEND") return false;
50
+ if (type === "IDAT" && declared < 2) return false;
51
+ if (type === "acTL" && declared === 0) {
52
+ if (at + 12 > bytes.length) return false;
53
+ declared = u32(bytes, at + 8);
54
+ if (declared < 2) return false;
55
+ }
56
+ if (type === "fcTL" && declared >= 2 && ++controls >= 2) return true;
57
+ at += 12 + length;
58
+ }
59
+ return declared >= 2;
60
+ }
61
+ /**
62
+ * A WebP animates when its extended header (`VP8X`) sets the animation flag (bit 1) and two
63
+ * `ANMF` frames follow. The chunk list ends where the RIFF size says the file does.
64
+ */
65
+ function webpAnimated(bytes) {
66
+ if (ascii(bytes, 12, 4) !== "VP8X") return false;
67
+ if (((bytes[20] ?? 0) & 2) === 0) return false;
68
+ const end = 8 + u32le(bytes, 4);
69
+ let frames = 0;
70
+ for (let at = 12; at < end;) {
71
+ if (at + 8 > bytes.length) return true;
72
+ if (ascii(bytes, at, 4) === "ANMF" && ++frames >= 2) return true;
73
+ const size = u32le(bytes, at + 4);
74
+ at += 8 + size + (size & 1);
75
+ }
76
+ return false;
77
+ }
78
+ /** An AVIF sequence names `avis` as its major or a compatible brand. */
79
+ function avifAnimated(bytes) {
80
+ const size = u32(bytes, 0);
81
+ for (let at = 8; at + 4 <= Math.min(size, bytes.length); at += 4) {
82
+ if (at === 12) continue;
83
+ if (ascii(bytes, at, 4) === "avis") return true;
84
+ }
85
+ return false;
86
+ }
87
+ function sniffImageAnimation(bytes) {
88
+ if (bytes.length >= 13 && (ascii(bytes, 0, 6) === "GIF87a" || ascii(bytes, 0, 6) === "GIF89a")) return {
89
+ format: "gif",
90
+ animated: gifAnimated(bytes)
91
+ };
92
+ if (bytes.length >= 8 && bytes[0] === 137 && ascii(bytes, 1, 3) === "PNG") return {
93
+ format: "png",
94
+ animated: pngAnimated(bytes)
95
+ };
96
+ if (bytes.length >= 16 && ascii(bytes, 0, 4) === "RIFF" && ascii(bytes, 8, 4) === "WEBP") return {
97
+ format: "webp",
98
+ animated: webpAnimated(bytes)
99
+ };
100
+ if (bytes.length >= 12 && ascii(bytes, 4, 4) === "ftyp") {
101
+ const brand = ascii(bytes, 8, 4);
102
+ if (brand === "avif" || brand === "avis" || avifAnimated(bytes)) return {
103
+ format: "avif",
104
+ animated: avifAnimated(bytes)
105
+ };
106
+ }
107
+ return {
108
+ format: "other",
109
+ animated: false
110
+ };
111
+ }
112
+ export { sniffImageAnimation };
package/dist/apng.d.mts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { PngData } from "./png-utils.mjs";
2
-
3
- //#region src/apng.d.ts
4
- interface ApngOptions {
2
+ export interface ApngOptions {
5
3
  /** Per-frame delay in milliseconds. Default 200. */
6
4
  delayMs?: number;
7
5
  /** Loop count; 0 means forever, which is the default a reviewer expects. */
@@ -12,7 +10,7 @@ interface ApngOptions {
12
10
  */
13
11
  delaysMs?: readonly number[];
14
12
  }
15
- declare class ApngFrameMismatchError extends Error {
13
+ export declare class ApngFrameMismatchError extends Error {
16
14
  readonly name = "ApngFrameMismatchError";
17
15
  }
18
16
  /**
@@ -23,8 +21,8 @@ declare class ApngFrameMismatchError extends Error {
23
21
  * produce equal-sized frames of one component, and a silent offset would let a mis-sized frame
24
22
  * animate in a corner instead of failing.
25
23
  */
26
- declare function encodeApng(frames: readonly PngData[], options?: ApngOptions): Uint8Array;
27
- interface ApngChunk {
24
+ export declare function encodeApng(frames: readonly PngData[], options?: ApngOptions): Uint8Array;
25
+ export interface ApngChunk {
28
26
  type: string;
29
27
  length: number;
30
28
  /** Sequence number for `fcTL` / `fdAT`, which is the field a viewer validates. */
@@ -37,6 +35,4 @@ interface ApngChunk {
37
35
  * browser, and this file's whole risk is byte-level: a wrong CRC, a wrong chunk order or a broken
38
36
  * sequence produces a file that looks fine in a hex dump and is rejected on load.
39
37
  */
40
- declare function readApngChunks(bytes: Uint8Array): ApngChunk[];
41
- //#endregion
42
- export { ApngChunk, ApngFrameMismatchError, ApngOptions, encodeApng, readApngChunks };
38
+ export declare function readApngChunks(bytes: Uint8Array): ApngChunk[];
package/dist/apng.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { deflateSync } from "node:zlib";
2
- //#region src/apng.ts
2
+ // src/apng.ts
3
3
  /**
4
4
  * Animated PNG, for the "one file that actually plays" output.
5
5
  *
@@ -48,7 +48,7 @@ const SIGNATURE = new Uint8Array([
48
48
  ]);
49
49
  /** CRC-32, table built once. Every PNG chunk carries one and a viewer checks it. */
50
50
  const CRC_TABLE = (() => {
51
- const table = new Uint32Array(256);
51
+ const table = /* @__PURE__ */ new Uint32Array(256);
52
52
  for (let n = 0; n < 256; n++) {
53
53
  let c = n;
54
54
  for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
@@ -120,7 +120,7 @@ function encodeApng(frames, options = {}) {
120
120
  if (frame.data.length < width * height * 4) throw new ApngFrameMismatchError(`frame ${index} carries ${frame.data.length} bytes, ${width * height * 4} needed for RGBA`);
121
121
  }
122
122
  const parts = [SIGNATURE];
123
- const ihdr = new Uint8Array(13);
123
+ const ihdr = /* @__PURE__ */ new Uint8Array(13);
124
124
  const ihdrView = new DataView(ihdr.buffer);
125
125
  ihdrView.setUint32(0, width);
126
126
  ihdrView.setUint32(4, height);
@@ -130,7 +130,7 @@ function encodeApng(frames, options = {}) {
130
130
  ihdr[11] = 0;
131
131
  ihdr[12] = 0;
132
132
  parts.push(chunk("IHDR", ihdr));
133
- const actl = new Uint8Array(8);
133
+ const actl = /* @__PURE__ */ new Uint8Array(8);
134
134
  const actlView = new DataView(actl.buffer);
135
135
  actlView.setUint32(0, frames.length);
136
136
  actlView.setUint32(4, options.loops ?? 0);
@@ -138,7 +138,7 @@ function encodeApng(frames, options = {}) {
138
138
  let sequence = 0;
139
139
  frames.forEach((frame, index) => {
140
140
  const { num, den } = delayPair(options.delaysMs?.[index] ?? options.delayMs ?? 200);
141
- const fctl = new Uint8Array(26);
141
+ const fctl = /* @__PURE__ */ new Uint8Array(26);
142
142
  const fctlView = new DataView(fctl.buffer);
143
143
  fctlView.setUint32(0, sequence++);
144
144
  fctlView.setUint32(4, width);
@@ -159,7 +159,7 @@ function encodeApng(frames, options = {}) {
159
159
  parts.push(chunk("fdAT", fdat));
160
160
  }
161
161
  });
162
- parts.push(chunk("IEND", new Uint8Array(0)));
162
+ parts.push(chunk("IEND", /* @__PURE__ */ new Uint8Array(0)));
163
163
  const total = parts.reduce((n, part) => n + part.length, 0);
164
164
  const out = new Uint8Array(total);
165
165
  let offset = 0;
@@ -195,5 +195,4 @@ function readApngChunks(bytes) {
195
195
  }
196
196
  return chunks;
197
197
  }
198
- //#endregion
199
198
  export { ApngFrameMismatchError, encodeApng, readApngChunks };
@@ -1,4 +1,3 @@
1
- //#region src/arg-reader.d.ts
2
1
  /**
3
2
  * Argv readers that take the array explicitly, and refuse to guess.
4
3
  *
@@ -14,23 +13,23 @@
14
13
  * error, and a numeric flag is validated where it is read rather than wherever
15
14
  * the NaN eventually lands.
16
15
  */
17
- declare function hasFlag(argv: readonly string[], name: string): boolean;
16
+ export declare function hasFlag(argv: readonly string[], name: string): boolean;
18
17
  /**
19
18
  * Last occurrence wins, matching how shells and most CLIs behave when a flag is
20
19
  * repeated. Throws when the value is missing or is another flag.
21
20
  */
22
- declare function readFlag(argv: readonly string[], name: string): string | undefined;
21
+ export declare function readFlag(argv: readonly string[], name: string): string | undefined;
23
22
  /** Read a string flag whose public contract is a closed set of values. */
24
- declare function readChoice<const T extends readonly string[]>(argv: readonly string[], name: string, choices: T): T[number] | undefined;
23
+ export declare function readChoice<const T extends readonly string[]>(argv: readonly string[], name: string, choices: T): T[number] | undefined;
25
24
  /** Every occurrence, for repeatable flags (`--gate`, `--only`, `--pages`). */
26
- declare function readAll(argv: readonly string[], name: string): string[];
27
- interface NumberFlagOptions {
25
+ export declare function readAll(argv: readonly string[], name: string): string[];
26
+ export interface NumberFlagOptions {
28
27
  min?: number;
29
28
  max?: number;
30
29
  integer?: boolean;
31
30
  }
32
- declare function readNumber(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
33
- declare function readInt(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
31
+ export declare function readNumber(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
32
+ export declare function readInt(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
34
33
  /**
35
34
  * Arguments that are neither a flag nor a flag's value.
36
35
  *
@@ -39,7 +38,7 @@ declare function readInt(argv: readonly string[], name: string, options?: Number
39
38
  * hand-rolled version of this was a for-loop per CLI that advanced its own
40
39
  * index, i.e. the same knowledge encoded three times.
41
40
  */
42
- declare function readPositionals(argv: readonly string[], valueFlags?: readonly string[]): string[];
41
+ export declare function readPositionals(argv: readonly string[], valueFlags?: readonly string[]): string[];
43
42
  /**
44
43
  * Split a command string into argv, honouring quotes.
45
44
  *
@@ -49,6 +48,4 @@ declare function readPositionals(argv: readonly string[], valueFlags?: readonly
49
48
  * whitespace would hand the gate `kit.txt` and `.promo"` as separate
50
49
  * arguments, which fails in a way that looks like the gate's fault.
51
50
  */
52
- declare function tokenizeCommand(command: string): string[];
53
- //#endregion
54
- export { NumberFlagOptions, hasFlag, readAll, readChoice, readFlag, readInt, readNumber, readPositionals, tokenizeCommand };
51
+ export declare function tokenizeCommand(command: string): string[];
@@ -1,5 +1,5 @@
1
1
  import { UsageError } from "./cli-error.mjs";
2
- //#region src/arg-reader.ts
2
+ // src/arg-reader.ts
3
3
  /**
4
4
  * Argv readers that take the array explicitly, and refuse to guess.
5
5
  *
@@ -132,5 +132,4 @@ function tokenizeCommand(command) {
132
132
  if (started) out.push(current);
133
133
  return out;
134
134
  }
135
- //#endregion
136
135
  export { hasFlag, readAll, readChoice, readFlag, readInt, readNumber, readPositionals, tokenizeCommand };
@@ -1,18 +1,17 @@
1
- //#region src/auth-state.d.ts
2
- declare const STORAGE_STATE_ENV = "VLMKIT_STORAGE_STATE";
1
+ export declare const STORAGE_STATE_ENV = "VLMKIT_STORAGE_STATE";
3
2
  /**
4
3
  * Explicit flag beats env; returns undefined when neither is set. A blank
5
4
  * explicit value counts as "not passed" and falls through to the
6
5
  * environment, so `--storage-state "$MAYBE_UNSET"` in a script does not
7
6
  * silently disable an env-configured session.
8
7
  */
9
- declare function storageStatePath(explicit?: string): string | undefined;
8
+ export declare function storageStatePath(explicit?: string): string | undefined;
10
9
  /**
11
10
  * Validate eagerly and loudly. A silently ignored auth file would send the
12
11
  * caller straight back to the failure this feature exists to fix — an
13
12
  * unauthenticated measurement that looks like a real result.
14
13
  */
15
- declare function readStorageState(path: string): {
14
+ export declare function readStorageState(path: string): {
16
15
  cookies: unknown[];
17
16
  origins: unknown[];
18
17
  };
@@ -21,11 +20,11 @@ declare function readStorageState(path: string): {
21
20
  * `browser.newPage(options)` forwards context options, so every gate can
22
21
  * adopt this by wrapping its existing options object.
23
22
  */
24
- declare function withAuthState<T extends object>(base: T, explicit?: string): T & {
23
+ export declare function withAuthState<T extends object>(base: T, explicit?: string): T & {
25
24
  storageState?: string;
26
25
  };
27
26
  /** Forget any session applied by a previous run. Called per gate invocation. */
28
- declare function resetAuthStateNotice(): void;
27
+ export declare function resetAuthStateNotice(): void;
29
28
  /**
30
29
  * One line naming the session a run used, or `null` when it ran unauthenticated.
31
30
  *
@@ -36,6 +35,4 @@ declare function resetAuthStateNotice(): void;
36
35
  * from "the login wall it redirected to". Reported from what was applied rather than
37
36
  * from what was configured, so a gate that ignores auth never claims to have used it.
38
37
  */
39
- declare function authStateNotice(): string | null;
40
- //#endregion
41
- export { STORAGE_STATE_ENV, authStateNotice, readStorageState, resetAuthStateNotice, storageStatePath, withAuthState };
38
+ export declare function authStateNotice(): string | null;
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
- //#region src/auth-state.ts
3
+ // src/auth-state.ts
4
4
  /**
5
5
  * Authenticated-page support for the gates.
6
6
  *
@@ -102,5 +102,4 @@ function resetAuthStateNotice() {
102
102
  function authStateNotice() {
103
103
  return appliedPath ? `auth: storage state from ${appliedPath}` : null;
104
104
  }
105
- //#endregion
106
105
  export { STORAGE_STATE_ENV, authStateNotice, readStorageState, resetAuthStateNotice, storageStatePath, withAuthState };
@@ -1,4 +1,3 @@
1
- //#region src/authored-style-capture.d.ts
2
1
  /**
3
2
  * Authored CSS capture for properties whose computed form lies about the
4
3
  * authored shape.
@@ -16,13 +15,13 @@
16
15
  * `diffComputedStyles` (it's just `Record<selector, Record<prop, value>>`
17
16
  * → `Record<selector, Record<prop, value>>` either way).
18
17
  */
19
- type AuthoredStyleSnapshot = Record<string, Record<string, string>>;
18
+ export type AuthoredStyleSnapshot = Record<string, Record<string, string>>;
20
19
  /**
21
20
  * Properties tracked by default. These are the ones whose computed
22
21
  * representation differs structurally from the authored source — anything
23
22
  * already faithful in `getComputedStyle` does not need this channel.
24
23
  */
25
- declare const AUTHORED_PROPERTIES: string[];
24
+ export declare const AUTHORED_PROPERTIES: string[];
26
25
  /**
27
26
  * Browser-context capture. Walks all same-origin stylesheets and nested
28
27
  * `@media` / `@supports` rules, collecting authored `value` strings for
@@ -33,10 +32,8 @@ declare const AUTHORED_PROPERTIES: string[];
33
32
  * Selectors are comma-split so `.a, .b { grid-template-columns: ... }`
34
33
  * fans out into both `.a` and `.b` entries.
35
34
  */
36
- declare function captureAuthoredStyleSnapshotInDom(props: string[]): AuthoredStyleSnapshot;
37
- declare function buildAuthoredStyleCaptureExpression(props?: string[]): string;
38
- declare function buildAuthoredStyleCaptureJsonExpression(props?: string[]): string;
39
- declare function parseAuthoredStyleSnapshot(value: unknown): AuthoredStyleSnapshot;
40
- declare function hasMeaningfulAuthoredStyleSnapshot(snapshot: AuthoredStyleSnapshot): boolean;
41
- //#endregion
42
- export { AUTHORED_PROPERTIES, AuthoredStyleSnapshot, buildAuthoredStyleCaptureExpression, buildAuthoredStyleCaptureJsonExpression, captureAuthoredStyleSnapshotInDom, hasMeaningfulAuthoredStyleSnapshot, parseAuthoredStyleSnapshot };
35
+ export declare function captureAuthoredStyleSnapshotInDom(props: string[]): AuthoredStyleSnapshot;
36
+ export declare function buildAuthoredStyleCaptureExpression(props?: string[]): string;
37
+ export declare function buildAuthoredStyleCaptureJsonExpression(props?: string[]): string;
38
+ export declare function parseAuthoredStyleSnapshot(value: unknown): AuthoredStyleSnapshot;
39
+ export declare function hasMeaningfulAuthoredStyleSnapshot(snapshot: AuthoredStyleSnapshot): boolean;
@@ -1,4 +1,4 @@
1
- //#region src/authored-style-capture.ts
1
+ // src/authored-style-capture.ts
2
2
  /**
3
3
  * Properties tracked by default. These are the ones whose computed
4
4
  * representation differs structurally from the authored source — anything
@@ -113,5 +113,4 @@ function safeJsonParse(value) {
113
113
  function isRecord(value) {
114
114
  return typeof value === "object" && value !== null && !Array.isArray(value);
115
115
  }
116
- //#endregion
117
116
  export { AUTHORED_PROPERTIES, buildAuthoredStyleCaptureExpression, buildAuthoredStyleCaptureJsonExpression, captureAuthoredStyleSnapshotInDom, hasMeaningfulAuthoredStyleSnapshot, parseAuthoredStyleSnapshot };
@@ -1,15 +1,11 @@
1
- import { AuthoredStyleSnapshot } from "./authored-style-capture.mjs";
2
1
  import { CsdEntry, CsdPerViewportEntry, CsdPerViewportResult, CsdResult } from "./computed-style-diff.mjs";
3
-
4
- //#region src/authored-style-diff.d.ts
5
- type AuthoredStyleEntry = CsdEntry;
6
- type AuthoredStyleDiffResult = CsdResult;
7
- type AuthoredStylePerViewportEntry = CsdPerViewportEntry;
8
- type AuthoredStylePerViewportResult = CsdPerViewportResult;
9
- declare function diffAuthoredStyles(baseline: AuthoredStyleSnapshot, variant: AuthoredStyleSnapshot): AuthoredStyleDiffResult;
10
- declare function aggregateAuthoredStyleByViewport(perViewport: ReadonlyArray<{
2
+ import { AuthoredStyleSnapshot } from "./authored-style-capture.mjs";
3
+ export type AuthoredStyleEntry = CsdEntry;
4
+ export type AuthoredStyleDiffResult = CsdResult;
5
+ export type AuthoredStylePerViewportEntry = CsdPerViewportEntry;
6
+ export type AuthoredStylePerViewportResult = CsdPerViewportResult;
7
+ export declare function diffAuthoredStyles(baseline: AuthoredStyleSnapshot, variant: AuthoredStyleSnapshot): AuthoredStyleDiffResult;
8
+ export declare function aggregateAuthoredStyleByViewport(perViewport: ReadonlyArray<{
11
9
  viewport: string;
12
10
  result: AuthoredStyleDiffResult;
13
- }>): AuthoredStylePerViewportResult;
14
- //#endregion
15
- export { AuthoredStyleDiffResult, AuthoredStyleEntry, AuthoredStylePerViewportEntry, AuthoredStylePerViewportResult, aggregateAuthoredStyleByViewport, diffAuthoredStyles };
11
+ }>): AuthoredStylePerViewportResult;
@@ -1,5 +1,5 @@
1
1
  import { aggregateCsdByViewport, diffComputedStyles } from "./computed-style-diff.mjs";
2
- //#region src/authored-style-diff.ts
2
+ // src/authored-style-diff.ts
3
3
  /**
4
4
  * Authored-style diff. Same shape as `computed-style-diff` (a snapshot is
5
5
  * `Record<scopedSelector, Record<property, value>>` in both cases), so the
@@ -12,5 +12,4 @@ function diffAuthoredStyles(baseline, variant) {
12
12
  function aggregateAuthoredStyleByViewport(perViewport) {
13
13
  return aggregateCsdByViewport(perViewport);
14
14
  }
15
- //#endregion
16
15
  export { aggregateAuthoredStyleByViewport, diffAuthoredStyles };
@@ -1,4 +1,3 @@
1
- //#region src/bitmap-font.d.ts
2
1
  /**
3
2
  * A 5x7 bitmap font, drawn here rather than taken from the system.
4
3
  *
@@ -18,18 +17,18 @@
18
17
  * millisecond count and a row index need. Anything outside it is dropped rather
19
18
  * than substituted, so a label can never come out as a row of boxes.
20
19
  */
21
- declare const GLYPH_WIDTH = 5;
22
- declare const GLYPH_HEIGHT = 7;
20
+ export declare const GLYPH_WIDTH = 5;
21
+ export declare const GLYPH_HEIGHT = 7;
23
22
  /** Target of a draw: any RGBA buffer that knows its own dimensions. */
24
- interface RgbaTarget {
23
+ export interface RgbaTarget {
25
24
  width: number;
26
25
  height: number;
27
26
  data: Uint8Array;
28
27
  }
29
28
  /** Height in px of one line at `scale`. */
30
- declare function textHeight(scale?: number): number;
29
+ export declare function textHeight(scale?: number): number;
31
30
  /** Width in px of `text` at `scale`, excluding the trailing blank column. */
32
- declare function measureText(text: string, scale?: number): number;
31
+ export declare function measureText(text: string, scale?: number): number;
33
32
  /**
34
33
  * The longest prefix of `text` that fits in `maxWidth`, with a trailing `..` when
35
34
  * something was dropped.
@@ -38,11 +37,9 @@ declare function measureText(text: string, scale?: number): number;
38
37
  * CSS selector is usually its tail: a label whose head is cut cannot be matched back
39
38
  * to the terminal output at all, while one whose tail is cut still can.
40
39
  */
41
- declare function fitText(text: string, maxWidth: number, scale?: number): string;
40
+ export declare function fitText(text: string, maxWidth: number, scale?: number): string;
42
41
  /**
43
42
  * Draw `text` into an RGBA buffer with its top-left at (x, y). Writes fully opaque
44
43
  * ink; pixels outside the buffer are skipped rather than wrapped.
45
44
  */
46
- declare function drawText(target: RgbaTarget, text: string, x: number, y: number, rgb: readonly [number, number, number], scale?: number): void;
47
- //#endregion
48
- export { GLYPH_HEIGHT, GLYPH_WIDTH, RgbaTarget, drawText, fitText, measureText, textHeight };
45
+ export declare function drawText(target: RgbaTarget, text: string, x: number, y: number, rgb: readonly [number, number, number], scale?: number): void;
@@ -1,4 +1,4 @@
1
- //#region src/bitmap-font.ts
1
+ // src/bitmap-font.ts
2
2
  /**
3
3
  * A 5x7 bitmap font, drawn here rather than taken from the system.
4
4
  *
@@ -941,5 +941,4 @@ function drawText(target, text, x, y, rgb, scale = 1) {
941
941
  cursor += ADVANCE * scale;
942
942
  }
943
943
  }
944
- //#endregion
945
944
  export { GLYPH_HEIGHT, GLYPH_WIDTH, drawText, fitText, measureText, textHeight };
@@ -1,7 +1,5 @@
1
1
  import { Browser, BrowserType, LaunchOptions } from "playwright";
2
-
3
- //#region src/browser-launch.d.ts
4
- type BrowserEngine = "chromium" | "firefox" | "webkit";
2
+ export type BrowserEngine = "chromium" | "firefox" | "webkit";
5
3
  /**
6
4
  * Engine name → Playwright browser type.
7
5
  *
@@ -9,8 +7,8 @@ type BrowserEngine = "chromium" | "firefox" | "webkit";
9
7
  * `ENGINE_BY_NAME` table); the other 64 sites are Chromium-only, which is why
10
8
  * `engine` defaults to `"chromium"` rather than being required.
11
9
  */
12
- declare const BROWSER_ENGINES: Record<BrowserEngine, BrowserType>;
13
- declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
10
+ export declare const BROWSER_ENGINES: Record<BrowserEngine, BrowserType>;
11
+ export declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
14
12
  /**
15
13
  * A launch that failed for a reason we can explain.
16
14
  *
@@ -19,13 +17,13 @@ declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
19
17
  * what it printed when the same diagnosis lived only in the error handler.
20
18
  * `cause` keeps the original Playwright error for anyone who wants the stack.
21
19
  */
22
- declare class BrowserLaunchError extends Error {
20
+ export declare class BrowserLaunchError extends Error {
23
21
  readonly name = "BrowserLaunchError";
24
22
  constructor(message: string, options?: {
25
23
  cause?: unknown;
26
24
  });
27
25
  }
28
- interface LaunchBrowserOptions {
26
+ export interface LaunchBrowserOptions {
29
27
  /** Defaults to `"chromium"`. */
30
28
  engine?: BrowserEngine;
31
29
  /**
@@ -51,7 +49,7 @@ interface LaunchBrowserOptions {
51
49
  * Prefer `withBrowser` — this exists for the handful of sites that cannot have
52
50
  * a scope (a factory that returns a Browser, a browser owned by a session).
53
51
  */
54
- declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>;
52
+ export declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>;
55
53
  /**
56
54
  * Launch a browser, run `fn`, and close the browser whether `fn` throws or not.
57
55
  *
@@ -60,6 +58,4 @@ declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>
60
58
  * failure masking a body failure is pre-existing behaviour, not something this
61
59
  * refactor gets to change.
62
60
  */
63
- declare function withBrowser<T>(fn: (browser: Browser) => Promise<T>, options?: LaunchBrowserOptions): Promise<T>;
64
- //#endregion
65
- export { ALL_BROWSER_ENGINES, BROWSER_ENGINES, BrowserEngine, BrowserLaunchError, LaunchBrowserOptions, launchBrowser, withBrowser };
61
+ export declare function withBrowser<T>(fn: (browser: Browser) => Promise<T>, options?: LaunchBrowserOptions): Promise<T>;
@@ -1,6 +1,6 @@
1
1
  import { formatMissingPlaywrightBrowserError } from "./cli-error.mjs";
2
2
  import { chromium, firefox, webkit } from "playwright";
3
- //#region src/browser-launch.ts
3
+ // src/browser-launch.ts
4
4
  /**
5
5
  * The one place a browser is launched.
6
6
  *
@@ -190,5 +190,4 @@ async function withBrowser(fn, options = {}) {
190
190
  await browser.close();
191
191
  }
192
192
  }
193
- //#endregion
194
193
  export { ALL_BROWSER_ENGINES, BROWSER_ENGINES, BrowserLaunchError, launchBrowser, withBrowser };