@mizchi/vlmkit-core 0.23.2 → 0.24.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 (77) hide show
  1. package/dist/a11y-semantic.d.mts +7 -9
  2. package/dist/a11y-semantic.mjs +2 -2
  3. package/dist/animated-image.d.mts +29 -0
  4. package/dist/animated-image.mjs +113 -0
  5. package/dist/apng.d.mts +6 -8
  6. package/dist/apng.mjs +5 -5
  7. package/dist/arg-reader.d.mts +10 -11
  8. package/dist/auth-state.d.mts +7 -8
  9. package/dist/authored-style-capture.d.mts +8 -9
  10. package/dist/authored-style-diff.d.mts +7 -9
  11. package/dist/bitmap-font.d.mts +8 -9
  12. package/dist/browser-launch.d.mts +8 -10
  13. package/dist/cli-args.d.mts +9 -10
  14. package/dist/cli-error.d.mts +10 -11
  15. package/dist/cli-error.mjs +1 -1
  16. package/dist/computed-style-capture.d.mts +21 -22
  17. package/dist/computed-style-capture.mjs +3 -3
  18. package/dist/computed-style-diff.d.mts +8 -9
  19. package/dist/computed-style-diff.mjs +1 -1
  20. package/dist/diff-regions.d.mts +4 -6
  21. package/dist/dom-equivalence.d.mts +6 -7
  22. package/dist/dom-position-styles.d.mts +15 -14
  23. package/dist/dom-position-styles.mjs +3 -3
  24. package/dist/element-compare.d.mts +9 -8
  25. package/dist/element-compare.mjs +3 -2
  26. package/dist/filmstrip.d.mts +61 -8
  27. package/dist/filmstrip.mjs +82 -10
  28. package/dist/gate-config.d.mts +19 -21
  29. package/dist/gate-exit.d.mts +6 -7
  30. package/dist/gif.d.mts +43 -0
  31. package/dist/gif.mjs +74 -0
  32. package/dist/heatmap-regions.d.mts +5 -6
  33. package/dist/heatmap.d.mts +21 -15
  34. package/dist/heatmap.mjs +11 -3
  35. package/dist/image-resize.d.mts +9 -10
  36. package/dist/image-timing.d.mts +59 -0
  37. package/dist/image-timing.mjs +167 -0
  38. package/dist/index.d.mts +2 -2
  39. package/dist/mask.d.mts +6 -8
  40. package/dist/navigation-redirect.d.mts +2 -3
  41. package/dist/page-load.d.mts +12 -13
  42. package/dist/page-open.d.mts +12 -14
  43. package/dist/plugin/args.d.mts +17 -11
  44. package/dist/plugin/args.mjs +12 -1
  45. package/dist/plugin/cli-entry.d.mts +2 -3
  46. package/dist/plugin/contract.d.mts +18 -20
  47. package/dist/plugin/index.d.mts +3 -4
  48. package/dist/plugin/index.mjs +2 -2
  49. package/dist/plugin/load.d.mts +7 -9
  50. package/dist/plugin/registry.d.mts +9 -11
  51. package/dist/plugin/rule-prose.d.mts +5 -7
  52. package/dist/plugin/rule-tier.d.mts +8 -10
  53. package/dist/plugin/rules.d.mts +19 -21
  54. package/dist/plugin/runner.d.mts +19 -20
  55. package/dist/plugin/runner.mjs +43 -2
  56. package/dist/png-decode.d.mts +19 -0
  57. package/dist/png-decode.mjs +161 -0
  58. package/dist/png-utils.d.mts +8 -9
  59. package/dist/png-utils.mjs +2 -1
  60. package/dist/project-config.d.mts +8 -9
  61. package/dist/rect-overlap.d.mts +4 -5
  62. package/dist/region-shift.d.mts +3 -5
  63. package/dist/run-ledger.d.mts +11 -12
  64. package/dist/run-ledger.mjs +3 -2
  65. package/dist/stable-selector.d.mts +2 -3
  66. package/dist/terminal-colors.d.mts +9 -10
  67. package/dist/text-rows.d.mts +11 -12
  68. package/dist/types.d.mts +87 -62
  69. package/dist/version.d.mts +2 -3
  70. package/dist/version.mjs +1 -1
  71. package/dist/video-decode.d.mts +146 -0
  72. package/dist/video-decode.mjs +936 -0
  73. package/dist/video-frames.d.mts +306 -0
  74. package/dist/video-frames.mjs +565 -0
  75. package/dist/webp.d.mts +8 -10
  76. package/dist/webp.mjs +2 -1
  77. package/package.json +4 -4
@@ -1,12 +1,11 @@
1
1
  import { A11yDiff, A11yNode, A11ySnapshot } from "./types.mjs";
2
-
3
2
  //#region src/a11y-semantic.d.ts
4
- declare const LANDMARK_ROLES: Set<string>;
5
- declare const INTERACTIVE_ROLES: Set<string>;
3
+ export declare const LANDMARK_ROLES: Set<string>;
4
+ export declare const INTERACTIVE_ROLES: Set<string>;
6
5
  /**
7
6
  * Compare two a11y tree snapshots and return the semantic diff.
8
7
  */
9
- declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A11yDiff;
8
+ export declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A11yDiff;
10
9
  /**
11
10
  * A11y tree quality checks (standalone, no diff).
12
11
  *
@@ -14,8 +13,8 @@ declare function diffA11yTrees(baseline: A11ySnapshot, current: A11ySnapshot): A
14
13
  * interactive elements and missing alt text on images.
15
14
  *
16
15
  */
17
- declare function verifyA11yTree(tree: A11yNode): A11yIssue[];
18
- interface A11yIssue {
16
+ export declare function verifyA11yTree(tree: A11yNode): A11yIssue[];
17
+ export interface A11yIssue {
19
18
  path: string;
20
19
  rule: string;
21
20
  severity: "error" | "warning";
@@ -24,6 +23,5 @@ interface A11yIssue {
24
23
  /**
25
24
  * Convert Playwright page.accessibility.snapshot() output to A11ySnapshot.
26
25
  */
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 };
26
+ export declare function parsePlaywrightA11ySnapshot(testId: string, testTitle: string, raw: Record<string, unknown>): A11ySnapshot;
27
+ //#endregion
@@ -1,5 +1,5 @@
1
1
  //#region src/a11y-semantic.ts
2
- const LANDMARK_ROLES = new Set([
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",
@@ -0,0 +1,29 @@
1
+ //#region src/animated-image.d.ts
2
+ /**
3
+ * Whether an image file animates, from its bytes: a GIF with more than one image, a PNG whose
4
+ * `acTL` (before its first `IDAT`) declares two or more frames and that holds two `fcTL` frame
5
+ * controls (APNG), a WebP whose `VP8X` header sets the animation flag and that holds two `ANMF`
6
+ * frames, or an AVIF whose `ftyp` names the image-sequence brand `avis`.
7
+ *
8
+ * An APNG or WebP header is a promise, not the frames: a file whose header says animated and that
9
+ * holds one frame shows one picture and never moves, and reading the header alone called it
10
+ * animated. So the frames are counted. The caller may hand over only the first bytes of a large
11
+ * file (`check flash` reads at most 8MB); when the bytes end before the chunk list does, the
12
+ * header is all there is and it is believed. An image wrongly called animated is a region the
13
+ * report says it did not judge; one wrongly called still is pixels moving on the browser's clock,
14
+ * counted as if the held clock had put them there.
15
+ *
16
+ * An animated image runs on the browser's own clock, which nothing a page's script sees can hold
17
+ * (`requestAnimationFrame`, timers and the animation timeline are what the held clock replaces), so
18
+ * a capture that holds page time still sees it move. `check flash` uses this to say which images
19
+ * it could not measure rather than judging pixels that moved on a clock it did not drive.
20
+ *
21
+ * Pure: bytes in, no I/O.
22
+ */
23
+ export type ImageFormat = "gif" | "png" | "webp" | "avif" | "other";
24
+ export interface ImageAnimation {
25
+ format: ImageFormat;
26
+ animated: boolean;
27
+ }
28
+ export declare function sniffImageAnimation(bytes: Uint8Array): ImageAnimation;
29
+ //#endregion
@@ -0,0 +1,113 @@
1
+ //#region 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
+ //#endregion
113
+ export { sniffImageAnimation };
package/dist/apng.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { PngData } from "./png-utils.mjs";
2
-
3
2
  //#region src/apng.d.ts
4
- interface ApngOptions {
3
+ export interface ApngOptions {
5
4
  /** Per-frame delay in milliseconds. Default 200. */
6
5
  delayMs?: number;
7
6
  /** Loop count; 0 means forever, which is the default a reviewer expects. */
@@ -12,7 +11,7 @@ interface ApngOptions {
12
11
  */
13
12
  delaysMs?: readonly number[];
14
13
  }
15
- declare class ApngFrameMismatchError extends Error {
14
+ export declare class ApngFrameMismatchError extends Error {
16
15
  readonly name = "ApngFrameMismatchError";
17
16
  }
18
17
  /**
@@ -23,8 +22,8 @@ declare class ApngFrameMismatchError extends Error {
23
22
  * produce equal-sized frames of one component, and a silent offset would let a mis-sized frame
24
23
  * animate in a corner instead of failing.
25
24
  */
26
- declare function encodeApng(frames: readonly PngData[], options?: ApngOptions): Uint8Array;
27
- interface ApngChunk {
25
+ export declare function encodeApng(frames: readonly PngData[], options?: ApngOptions): Uint8Array;
26
+ export interface ApngChunk {
28
27
  type: string;
29
28
  length: number;
30
29
  /** Sequence number for `fcTL` / `fdAT`, which is the field a viewer validates. */
@@ -37,6 +36,5 @@ interface ApngChunk {
37
36
  * browser, and this file's whole risk is byte-level: a wrong CRC, a wrong chunk order or a broken
38
37
  * sequence produces a file that looks fine in a hex dump and is rejected on load.
39
38
  */
40
- declare function readApngChunks(bytes: Uint8Array): ApngChunk[];
41
- //#endregion
42
- export { ApngChunk, ApngFrameMismatchError, ApngOptions, encodeApng, readApngChunks };
39
+ export declare function readApngChunks(bytes: Uint8Array): ApngChunk[];
40
+ //#endregion
package/dist/apng.mjs CHANGED
@@ -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;
@@ -14,23 +14,23 @@
14
14
  * error, and a numeric flag is validated where it is read rather than wherever
15
15
  * the NaN eventually lands.
16
16
  */
17
- declare function hasFlag(argv: readonly string[], name: string): boolean;
17
+ export declare function hasFlag(argv: readonly string[], name: string): boolean;
18
18
  /**
19
19
  * Last occurrence wins, matching how shells and most CLIs behave when a flag is
20
20
  * repeated. Throws when the value is missing or is another flag.
21
21
  */
22
- declare function readFlag(argv: readonly string[], name: string): string | undefined;
22
+ export declare function readFlag(argv: readonly string[], name: string): string | undefined;
23
23
  /** 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;
24
+ export declare function readChoice<const T extends readonly string[]>(argv: readonly string[], name: string, choices: T): T[number] | undefined;
25
25
  /** Every occurrence, for repeatable flags (`--gate`, `--only`, `--pages`). */
26
- declare function readAll(argv: readonly string[], name: string): string[];
27
- interface NumberFlagOptions {
26
+ export declare function readAll(argv: readonly string[], name: string): string[];
27
+ export interface NumberFlagOptions {
28
28
  min?: number;
29
29
  max?: number;
30
30
  integer?: boolean;
31
31
  }
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;
32
+ export declare function readNumber(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
33
+ export declare function readInt(argv: readonly string[], name: string, options?: NumberFlagOptions): number | undefined;
34
34
  /**
35
35
  * Arguments that are neither a flag nor a flag's value.
36
36
  *
@@ -39,7 +39,7 @@ declare function readInt(argv: readonly string[], name: string, options?: Number
39
39
  * hand-rolled version of this was a for-loop per CLI that advanced its own
40
40
  * index, i.e. the same knowledge encoded three times.
41
41
  */
42
- declare function readPositionals(argv: readonly string[], valueFlags?: readonly string[]): string[];
42
+ export declare function readPositionals(argv: readonly string[], valueFlags?: readonly string[]): string[];
43
43
  /**
44
44
  * Split a command string into argv, honouring quotes.
45
45
  *
@@ -49,6 +49,5 @@ declare function readPositionals(argv: readonly string[], valueFlags?: readonly
49
49
  * whitespace would hand the gate `kit.txt` and `.promo"` as separate
50
50
  * arguments, which fails in a way that looks like the gate's fault.
51
51
  */
52
- declare function tokenizeCommand(command: string): string[];
53
- //#endregion
54
- export { NumberFlagOptions, hasFlag, readAll, readChoice, readFlag, readInt, readNumber, readPositionals, tokenizeCommand };
52
+ export declare function tokenizeCommand(command: string): string[];
53
+ //#endregion
@@ -1,18 +1,18 @@
1
1
  //#region src/auth-state.d.ts
2
- declare const STORAGE_STATE_ENV = "VLMKIT_STORAGE_STATE";
2
+ export declare const STORAGE_STATE_ENV = "VLMKIT_STORAGE_STATE";
3
3
  /**
4
4
  * Explicit flag beats env; returns undefined when neither is set. A blank
5
5
  * explicit value counts as "not passed" and falls through to the
6
6
  * environment, so `--storage-state "$MAYBE_UNSET"` in a script does not
7
7
  * silently disable an env-configured session.
8
8
  */
9
- declare function storageStatePath(explicit?: string): string | undefined;
9
+ export declare function storageStatePath(explicit?: string): string | undefined;
10
10
  /**
11
11
  * Validate eagerly and loudly. A silently ignored auth file would send the
12
12
  * caller straight back to the failure this feature exists to fix — an
13
13
  * unauthenticated measurement that looks like a real result.
14
14
  */
15
- declare function readStorageState(path: string): {
15
+ export declare function readStorageState(path: string): {
16
16
  cookies: unknown[];
17
17
  origins: unknown[];
18
18
  };
@@ -21,11 +21,11 @@ declare function readStorageState(path: string): {
21
21
  * `browser.newPage(options)` forwards context options, so every gate can
22
22
  * adopt this by wrapping its existing options object.
23
23
  */
24
- declare function withAuthState<T extends object>(base: T, explicit?: string): T & {
24
+ export declare function withAuthState<T extends object>(base: T, explicit?: string): T & {
25
25
  storageState?: string;
26
26
  };
27
27
  /** Forget any session applied by a previous run. Called per gate invocation. */
28
- declare function resetAuthStateNotice(): void;
28
+ export declare function resetAuthStateNotice(): void;
29
29
  /**
30
30
  * One line naming the session a run used, or `null` when it ran unauthenticated.
31
31
  *
@@ -36,6 +36,5 @@ declare function resetAuthStateNotice(): void;
36
36
  * from "the login wall it redirected to". Reported from what was applied rather than
37
37
  * from what was configured, so a gate that ignores auth never claims to have used it.
38
38
  */
39
- declare function authStateNotice(): string | null;
40
- //#endregion
41
- export { STORAGE_STATE_ENV, authStateNotice, readStorageState, resetAuthStateNotice, storageStatePath, withAuthState };
39
+ export declare function authStateNotice(): string | null;
40
+ //#endregion
@@ -16,13 +16,13 @@
16
16
  * `diffComputedStyles` (it's just `Record<selector, Record<prop, value>>`
17
17
  * → `Record<selector, Record<prop, value>>` either way).
18
18
  */
19
- type AuthoredStyleSnapshot = Record<string, Record<string, string>>;
19
+ export type AuthoredStyleSnapshot = Record<string, Record<string, string>>;
20
20
  /**
21
21
  * Properties tracked by default. These are the ones whose computed
22
22
  * representation differs structurally from the authored source — anything
23
23
  * already faithful in `getComputedStyle` does not need this channel.
24
24
  */
25
- declare const AUTHORED_PROPERTIES: string[];
25
+ export declare const AUTHORED_PROPERTIES: string[];
26
26
  /**
27
27
  * Browser-context capture. Walks all same-origin stylesheets and nested
28
28
  * `@media` / `@supports` rules, collecting authored `value` strings for
@@ -33,10 +33,9 @@ declare const AUTHORED_PROPERTIES: string[];
33
33
  * Selectors are comma-split so `.a, .b { grid-template-columns: ... }`
34
34
  * fans out into both `.a` and `.b` entries.
35
35
  */
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 };
36
+ export declare function captureAuthoredStyleSnapshotInDom(props: string[]): AuthoredStyleSnapshot;
37
+ export declare function buildAuthoredStyleCaptureExpression(props?: string[]): string;
38
+ export declare function buildAuthoredStyleCaptureJsonExpression(props?: string[]): string;
39
+ export declare function parseAuthoredStyleSnapshot(value: unknown): AuthoredStyleSnapshot;
40
+ export declare function hasMeaningfulAuthoredStyleSnapshot(snapshot: AuthoredStyleSnapshot): boolean;
41
+ //#endregion
@@ -1,15 +1,13 @@
1
1
  import { AuthoredStyleSnapshot } from "./authored-style-capture.mjs";
2
2
  import { CsdEntry, CsdPerViewportEntry, CsdPerViewportResult, CsdResult } from "./computed-style-diff.mjs";
3
-
4
3
  //#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<{
4
+ export type AuthoredStyleEntry = CsdEntry;
5
+ export type AuthoredStyleDiffResult = CsdResult;
6
+ export type AuthoredStylePerViewportEntry = CsdPerViewportEntry;
7
+ export type AuthoredStylePerViewportResult = CsdPerViewportResult;
8
+ export declare function diffAuthoredStyles(baseline: AuthoredStyleSnapshot, variant: AuthoredStyleSnapshot): AuthoredStyleDiffResult;
9
+ export declare function aggregateAuthoredStyleByViewport(perViewport: ReadonlyArray<{
11
10
  viewport: string;
12
11
  result: AuthoredStyleDiffResult;
13
12
  }>): AuthoredStylePerViewportResult;
14
- //#endregion
15
- export { AuthoredStyleDiffResult, AuthoredStyleEntry, AuthoredStylePerViewportEntry, AuthoredStylePerViewportResult, aggregateAuthoredStyleByViewport, diffAuthoredStyles };
13
+ //#endregion
@@ -18,18 +18,18 @@
18
18
  * millisecond count and a row index need. Anything outside it is dropped rather
19
19
  * than substituted, so a label can never come out as a row of boxes.
20
20
  */
21
- declare const GLYPH_WIDTH = 5;
22
- declare const GLYPH_HEIGHT = 7;
21
+ export declare const GLYPH_WIDTH = 5;
22
+ export declare const GLYPH_HEIGHT = 7;
23
23
  /** Target of a draw: any RGBA buffer that knows its own dimensions. */
24
- interface RgbaTarget {
24
+ export interface RgbaTarget {
25
25
  width: number;
26
26
  height: number;
27
27
  data: Uint8Array;
28
28
  }
29
29
  /** Height in px of one line at `scale`. */
30
- declare function textHeight(scale?: number): number;
30
+ export declare function textHeight(scale?: number): number;
31
31
  /** Width in px of `text` at `scale`, excluding the trailing blank column. */
32
- declare function measureText(text: string, scale?: number): number;
32
+ export declare function measureText(text: string, scale?: number): number;
33
33
  /**
34
34
  * The longest prefix of `text` that fits in `maxWidth`, with a trailing `..` when
35
35
  * something was dropped.
@@ -38,11 +38,10 @@ declare function measureText(text: string, scale?: number): number;
38
38
  * CSS selector is usually its tail: a label whose head is cut cannot be matched back
39
39
  * to the terminal output at all, while one whose tail is cut still can.
40
40
  */
41
- declare function fitText(text: string, maxWidth: number, scale?: number): string;
41
+ export declare function fitText(text: string, maxWidth: number, scale?: number): string;
42
42
  /**
43
43
  * Draw `text` into an RGBA buffer with its top-left at (x, y). Writes fully opaque
44
44
  * ink; pixels outside the buffer are skipped rather than wrapped.
45
45
  */
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 };
46
+ export declare function drawText(target: RgbaTarget, text: string, x: number, y: number, rgb: readonly [number, number, number], scale?: number): void;
47
+ //#endregion
@@ -1,7 +1,6 @@
1
1
  import { Browser, BrowserType, LaunchOptions } from "playwright";
2
-
3
2
  //#region src/browser-launch.d.ts
4
- type BrowserEngine = "chromium" | "firefox" | "webkit";
3
+ export type BrowserEngine = "chromium" | "firefox" | "webkit";
5
4
  /**
6
5
  * Engine name → Playwright browser type.
7
6
  *
@@ -9,8 +8,8 @@ type BrowserEngine = "chromium" | "firefox" | "webkit";
9
8
  * `ENGINE_BY_NAME` table); the other 64 sites are Chromium-only, which is why
10
9
  * `engine` defaults to `"chromium"` rather than being required.
11
10
  */
12
- declare const BROWSER_ENGINES: Record<BrowserEngine, BrowserType>;
13
- declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
11
+ export declare const BROWSER_ENGINES: Record<BrowserEngine, BrowserType>;
12
+ export declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
14
13
  /**
15
14
  * A launch that failed for a reason we can explain.
16
15
  *
@@ -19,13 +18,13 @@ declare const ALL_BROWSER_ENGINES: readonly BrowserEngine[];
19
18
  * what it printed when the same diagnosis lived only in the error handler.
20
19
  * `cause` keeps the original Playwright error for anyone who wants the stack.
21
20
  */
22
- declare class BrowserLaunchError extends Error {
21
+ export declare class BrowserLaunchError extends Error {
23
22
  readonly name = "BrowserLaunchError";
24
23
  constructor(message: string, options?: {
25
24
  cause?: unknown;
26
25
  });
27
26
  }
28
- interface LaunchBrowserOptions {
27
+ export interface LaunchBrowserOptions {
29
28
  /** Defaults to `"chromium"`. */
30
29
  engine?: BrowserEngine;
31
30
  /**
@@ -51,7 +50,7 @@ interface LaunchBrowserOptions {
51
50
  * Prefer `withBrowser` — this exists for the handful of sites that cannot have
52
51
  * a scope (a factory that returns a Browser, a browser owned by a session).
53
52
  */
54
- declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>;
53
+ export declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>;
55
54
  /**
56
55
  * Launch a browser, run `fn`, and close the browser whether `fn` throws or not.
57
56
  *
@@ -60,6 +59,5 @@ declare function launchBrowser(options?: LaunchBrowserOptions): Promise<Browser>
60
59
  * failure masking a body failure is pre-existing behaviour, not something this
61
60
  * refactor gets to change.
62
61
  */
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 };
62
+ export declare function withBrowser<T>(fn: (browser: Browser) => Promise<T>, options?: LaunchBrowserOptions): Promise<T>;
63
+ //#endregion
@@ -1,20 +1,20 @@
1
1
  //#region src/cli-args.d.ts
2
- declare function getArg(name: string, fallback: string): string;
3
- declare function getArg(name: string): string | undefined;
2
+ export declare function getArg(name: string, fallback: string): string;
3
+ export declare function getArg(name: string): string | undefined;
4
4
  /**
5
5
  * Numeric flags, validated. Callers used to write `parseInt(getArg(n, d), 10)`,
6
6
  * which is where a bad value became `NaN` — far from the flag that caused it.
7
7
  */
8
- declare function getIntArg(name: string, fallback: number, options?: {
8
+ export declare function getIntArg(name: string, fallback: number, options?: {
9
9
  min?: number;
10
10
  max?: number;
11
11
  }): number;
12
- declare function getFloatArg(name: string, fallback: number, options?: {
12
+ export declare function getFloatArg(name: string, fallback: number, options?: {
13
13
  min?: number;
14
14
  max?: number;
15
15
  }): number;
16
- declare function hasFlag(name: string): boolean;
17
- declare function getArgValues(name: string): string[];
16
+ export declare function hasFlag(name: string): boolean;
17
+ export declare function getArgValues(name: string): string[];
18
18
  /**
19
19
  * Positional arguments.
20
20
  *
@@ -23,8 +23,7 @@ declare function getArgValues(name: string): string[];
23
23
  * implementation assumed *every* flag takes a value, which silently dropped a
24
24
  * positional that happened to follow a boolean flag.
25
25
  */
26
- declare function getPositionalArgs(valueFlags?: readonly string[]): string[];
26
+ export declare function getPositionalArgs(valueFlags?: readonly string[]): string[];
27
27
  /** Raw argv tail, for callers doing their own scanning. */
28
- declare function getRawArgs(): string[];
29
- //#endregion
30
- export { getArg, getArgValues, getFloatArg, getIntArg, getPositionalArgs, getRawArgs, hasFlag };
28
+ export declare function getRawArgs(): string[];
29
+ //#endregion
@@ -1,5 +1,4 @@
1
1
  import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
2
-
3
2
  //#region src/cli-error.d.ts
4
3
  /**
5
4
  * The `playwright` peer range. Duplicated from this package's own
@@ -9,9 +8,9 @@ import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
9
8
  * the manifest and fails if the two drift, so the duplication cannot rot
10
9
  * silently.
11
10
  */
12
- declare const PLAYWRIGHT_PEER_RANGE = ">=1.61 <2";
11
+ export declare const PLAYWRIGHT_PEER_RANGE = ">=1.61 <2";
13
12
  /** Playwright install target: which `playwright` *this* process resolved. */
14
- interface PlaywrightInstallTarget {
13
+ export interface PlaywrightInstallTarget {
15
14
  version: string;
16
15
  /** Directory of the resolved `playwright` package — the identity the reporter of #112 could not see. */
17
16
  packageDir: string;
@@ -42,10 +41,10 @@ declare function resolvePlaywrightInstallTarget(): PlaywrightInstallTarget | nul
42
41
  * `chromium`: `playwright install chromium` fetches the headless shell as well
43
42
  * (verified against the 1.61.1 CLI, which lists both under that one name).
44
43
  */
45
- declare function playwrightEngineFromLaunchError(message: string): "chromium" | "firefox" | "webkit";
44
+ export declare function playwrightEngineFromLaunchError(message: string): "chromium" | "firefox" | "webkit";
46
45
  /** `node <resolved playwright>/cli.js install <engine>` — quoted for a shell. */
47
- declare function playwrightInstallCommand(target: PlaywrightInstallTarget, engine?: "chromium" | "firefox" | "webkit"): string;
48
- declare function formatMissingPlaywrightBrowserError(error: unknown, target?: PlaywrightInstallTarget | null): string | null;
46
+ export declare function playwrightInstallCommand(target: PlaywrightInstallTarget, engine?: "chromium" | "firefox" | "webkit"): string;
47
+ export declare function formatMissingPlaywrightBrowserError(error: unknown, target?: PlaywrightInstallTarget | null): string | null;
49
48
  /**
50
49
  * `playwright` absent entirely, rather than present-but-browserless.
51
50
  *
@@ -57,13 +56,13 @@ declare function formatMissingPlaywrightBrowserError(error: unknown, target?: Pl
57
56
  * the package removed, `vlmkit diff png --help` dies with ERR_MODULE_NOT_FOUND
58
57
  * before printing usage. That raw stack is what this turns into one sentence.
59
58
  */
60
- declare function formatMissingPlaywrightModuleError(error: unknown): string | null;
59
+ export declare function formatMissingPlaywrightModuleError(error: unknown): string | null;
61
60
  /**
62
61
  * Best-effort sanity check used by tests: does the resolved playwright actually
63
62
  * have a `cli.js` to invoke? Kept exported so the happy-path test can assert the
64
63
  * command we print is runnable rather than merely well-formed.
65
64
  */
66
- declare function resolvedPlaywrightHasCli(): boolean;
65
+ export declare function resolvedPlaywrightHasCli(): boolean;
67
66
  /**
68
67
  * The one-line diagnosis for an error, or `null` when there isn't one.
69
68
  *
@@ -78,7 +77,7 @@ declare function resolvedPlaywrightHasCli(): boolean;
78
77
  * reach the developer whole, stack and all. A prettifier that invents a summary
79
78
  * for everything is worse than one that admits it has nothing to add.
80
79
  */
81
- declare function formatCliError(e: unknown): string | null;
82
- declare function handleCliError(e: unknown): never;
80
+ export declare function formatCliError(e: unknown): string | null;
81
+ export declare function handleCliError(e: unknown): never;
83
82
  //#endregion
84
- export { PLAYWRIGHT_PEER_RANGE, PlaywrightInstallTarget, UsageError, formatCliError, formatMissingPlaywrightBrowserError, formatMissingPlaywrightModuleError, handleCliError, playwrightEngineFromLaunchError, playwrightInstallCommand, resolvePlaywrightInstallTarget, resolvedPlaywrightHasCli };
83
+ export { UsageError, resolvePlaywrightInstallTarget };
@@ -14,7 +14,7 @@ import { UsageError } from "@mizchi/vlmkit-judge/errors.ts";
14
14
  * main().catch(handleCliError);
15
15
  *
16
16
  * Every CLI entry must go through it, *including* `scripts/vlmkit-bundled.mjs`
17
- * — that is the one `tsdown.config.ts` builds into the published `bin`. It used
17
+ * — that is the one `vite.config.ts`'s `pack` block builds into the published `bin`. It used
18
18
  * to `console.error(error)` instead, which made everything below dead code in
19
19
  * the shipped CLI while it kept working in the workspace (issue #112, item 2).
20
20
  * `tests/playwright-peer-contract.test.mjs` guards that.