renderdiff 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Timur Mashara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,407 @@
1
- # Temporary Holding Version
1
+ # renderdiff
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Screenshot diff between two origins.
4
+
5
+ Give it a list of routes and two base URLs. It screenshots each route on both sides at
6
+ several viewport widths, pixel-diffs the pairs, and writes a scored HTML report with
7
+ left / right / diff side by side, plus `results.json` and crops of the changes, sized to stay
8
+ legible to coding agents.
9
+
10
+ Useful for the "did I break anything?" question a test suite can't answer: a framework
11
+ migration, a CSS refactor, a dependency bump, a staging-vs-production check.
12
+
13
+ ```
14
+ renderdiff http://localhost:3000 https://example.com / /about /pricing
15
+ ```
16
+
17
+ On a terminal it prints a line per shot as it lands, then the worst scores and the paths
18
+ to `report.html` and `results.json`. Piped — to a file, CI or a coding agent — it prints
19
+ one summary at the end instead, listing only what differs:
20
+
21
+ ```
22
+ Routes: 3
23
+ clean: /
24
+ /about clean @1152,896,704,375
25
+ @1440 97.41% h-24 band -24@y196 aligned 100.00% text -"Pricing"
26
+ /pricing
27
+ @1440,1152,896,704,375 99.12%–99.87% 1 reg
28
+ renderdiff: 2 of 3 routes differ (6 of 15 shots), 0 errors, worst 97.41% /about@1440 — /Users/you/site/renderdiff-out/results.json
29
+ ```
30
+
31
+ A row covers the widths that agree on everything but the score (shown as a range): height
32
+ delta (`h`), bands (`+` rows only left has, `-` rows only right has, at `y`; `~` when the
33
+ widths put it in different places), aligned score, region count, unstable pixels and up to
34
+ three text-diff lines (`-"x"` only on the right, `+"x"` only on the left). Errors print in
35
+ full, grouped across the widths that share a message. Clean means not one pixel differs
36
+ and none went unmeasured as unstable; a route with unstable pixels gets its own row. With
37
+ `--threshold`, the verdict line ends `, B below 97.00%`. `--progress` gets the per-shot
38
+ output when piped, `--no-progress` the summary on a terminal.
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ npm install -g renderdiff
44
+ npx playwright install chromium # once, if you don't already have it
45
+ ```
46
+
47
+ Requires Node >= 22.18.
48
+
49
+ ### Agent skill
50
+
51
+ [`skills/renderdiff/SKILL.md`](./skills/renderdiff/SKILL.md) teaches a coding agent to use
52
+ renderdiff without fooling itself: run it with `npx renderdiff@latest`, read the summary
53
+ it prints, then the text diff, the bands and the region crops, and give a verdict that says
54
+ what it looked at — not just a score. The longer reference (triage, rationalizations,
55
+ config, gotchas) sits next to it in `reference.md` and is read only when needed.
56
+
57
+ In Claude Code, as a plugin:
58
+
59
+ ```
60
+ /plugin marketplace add tmashara/renderdiff
61
+ /plugin install renderdiff@renderdiff
62
+ ```
63
+
64
+ For other agents (Codex, Cursor and so on), with [skills](https://skills.sh):
65
+
66
+ ```bash
67
+ npx skills add tmashara/renderdiff
68
+ ```
69
+
70
+ Until renderdiff is on npm, `npx renderdiff@latest` won't resolve; install the CLI with
71
+ `npm install -g github:tmashara/renderdiff`.
72
+
73
+ ## Usage
74
+
75
+ ```
76
+ renderdiff <left-origin> <right-origin> <route…> [options]
77
+ ```
78
+
79
+ | Argument or flag | |
80
+ | --- | --- |
81
+ | `<origin>` | An argument starting with `http://` or `https://`. The first is left, the second right; a third is an error. |
82
+ | `<route>` | A literal path, e.g. `/about`, or a pair `/pricing::/plans` (see below). |
83
+ | `--left <url>` | Left origin, instead of the first positional one. Giving both is an error. |
84
+ | `--right <url>` | Right origin, instead of the second positional one. |
85
+ | `--width <n>` | Viewport width; repeatable. Replaces the defaults. |
86
+ | `--threshold <0..1>` | Exit non-zero if any comparison scores below this. |
87
+ | `--out <dir>` | Output directory, wiped at the start of a run. Default `./renderdiff-out`. A directory holding files renderdiff didn't write is refused. |
88
+ | `--concurrency <n>` | Parallel workers. Default 2. |
89
+ | `--config <path>` | Config file. Default: `renderdiff.config.{ts,mts,js,mjs}` in cwd. |
90
+ | `--selector <sel>` | Compare the one element this Playwright selector matches, on both sides, instead of the whole page. Applies to every route, over the config's per-route `selector`. |
91
+ | `--left-selector <sel>`, `--right-selector <sel>` | That side's selector, over `--selector`. One without the other side (or `--selector`) is an error. |
92
+ | `--dry-run` | Print the URL pairs and exit. No browser. |
93
+ | `--open` | Open the report when the run finishes. |
94
+ | `--progress` | A line per shot as it finishes, then the worst scores. The default on a terminal; piped, renderdiff prints one compact summary at the end. |
95
+ | `--no-progress` | The compact summary even on a terminal. |
96
+ | `-h, --help` / `-v, --version` | |
97
+
98
+ Routes are **literal paths** — there is no route discovery and globs are rejected. Each
99
+ route is loaded on both origins, unless it's a pair.
100
+
101
+ Default widths are `1440, 1152, 896, 704, 375` — one inside each common responsive band
102
+ rather than on a breakpoint boundary, so a layout switch never flaps between captures.
103
+
104
+ Exit codes: `0` all good · `1` a route errored or scored below `--threshold` ·
105
+ `2` bad arguments, bad config, or an origin that isn't responding.
106
+
107
+ ## Comparing different routes or components
108
+
109
+ When a migration moved a page, give the route as a pair: `left::right`.
110
+
111
+ ```
112
+ renderdiff http://localhost:3000 https://example.com /pricing::/plans /about::/company/about
113
+ ```
114
+
115
+ `/pricing::/plans` loads `/pricing` on the left and `/plans` on the right. The split is
116
+ on the first `::` followed by `/`, so `/q?x=std::vector` and `/wiki/Talk:Foo` stay single
117
+ routes, and `pricing::plans` (no slash) is a literal path; `--dry-run` shows how each
118
+ route was read. Each side is normalized on its own, a pair with identical sides is the
119
+ plain route, and an empty side (`/pricing::`) is an error.
120
+
121
+ A pair is named `/pricing::/plans` in stdout, `results.json` (`url`, plus `left` and
122
+ `right`) and the report; its images are `pricing~plans.{width}.*.png`. A mask whose
123
+ `urlPath` is either side's path is painted on both sides. In a config file, a route can
124
+ also be an object, `{ left: "/pricing", right: "/plans" }`, where `right` defaults to
125
+ `left`.
126
+
127
+ To compare one component instead of the whole page, give a selector:
128
+
129
+ ```
130
+ renderdiff http://localhost:3000 https://example.com /pricing --selector "[data-test=plans]"
131
+ renderdiff http://localhost:3000 https://example.com /pricing --left-selector .plans-v2 --right-selector .plans
132
+ ```
133
+
134
+ Any Playwright selector works, `xpath=` and `>>` chains included, and it's never split on
135
+ `::`. It must match **exactly one** element on each side; otherwise the route errors at once
136
+ with the count (`selector ".card" matched 6 elements on left (/pricing), expected 1`). The
137
+ shot, the score, the regions and the text diff are that element's, in its own pixels; a
138
+ mask is painted where it overlaps the element.
139
+
140
+ A CLI selector applies to every route and replaces the config's. In a config file a route
141
+ object takes `selector: ".plans"` or `selector: { left: ".plans-v2", right: ".plans" }`;
142
+ to compare several components of one page, list the route once per selector. Such a route
143
+ is `/pricing [.plans]` in the summary and the report, keeps `/pricing @1440` on a
144
+ `--progress` row with the selector on the line under it, has `selector` in `results.json`
145
+ (`{ left, right }`, or `null` for a whole page), and its images are
146
+ `pricing@_plans.{width}.*.png`.
147
+
148
+ Things to know:
149
+
150
+ - The whole page still loads and settles first, so a component costs about what its page does.
151
+ - It's shot at scroll 0 with the rest of the page, so a fixed or sticky header over it is
152
+ in the shot. Hide it with `hideSelectors`.
153
+ - An element inside a shorter scroll container includes whatever paints below the container.
154
+ - A transformed element is shot at its axis-aligned bounding box.
155
+ - Pseudo-elements (`::before`) are rejected by Playwright; elements inside iframes can't be
156
+ reached. Open shadow roots are pierced.
157
+ - A selector that matches an element with no box (`display: none`) or one off the page is
158
+ an error. The render gate stays page-level: a textless element on a rendered page is fine.
159
+
160
+ ## Config file
161
+
162
+ Flags cover a one-off run. A `renderdiff.config.ts` (or `.mjs`) in the working directory
163
+ covers a repo you diff repeatedly, and expresses the things flags can't: **masks** for
164
+ content that legitimately drifts, extra selectors to hide, extra URLs to block.
165
+
166
+ ```ts
167
+ export default {
168
+ left: "http://localhost:3000",
169
+ right: "https://example.com",
170
+ routes: [
171
+ "/",
172
+ "/about",
173
+ "/pricing::/plans",
174
+ { left: "/blog", right: "/posts" },
175
+ { left: "/pricing", selector: "[data-test=plans]" },
176
+ ],
177
+ widths: [1440, 896, 375],
178
+ threshold: 0.97,
179
+
180
+ hideSelectors: [".site-cookie-banner"],
181
+ blockUrlPatterns: ["**://*.my-tracker.example/**"],
182
+
183
+ masks: [
184
+ { selector: "[data-star-count]", reason: "live star count", urlPath: "/pricing" },
185
+ ],
186
+ };
187
+ ```
188
+
189
+ A mask needs a `reason` and exactly one of `selector` (a Playwright selector) or
190
+ `locate: (page) => Locator`, the escape hatch for what a selector can't say. Without
191
+ `urlPath` it applies to every route.
192
+
193
+ See [`renderdiff.config.example.ts`](./renderdiff.config.example.ts) for every field, annotated.
194
+
195
+ **Precedence: CLI flag > config file > built-in default.**
196
+
197
+ `export default { … }` needs no import. `import type { RenderdiffConfig } from "renderdiff"`
198
+ with `satisfies RenderdiffConfig` is for editor types only; Node erases it, so the file loads
199
+ without renderdiff installed in that project.
200
+
201
+ ## How it reads
202
+
203
+ The score is the share of pixels that match, per route per width. Green above 99.5%,
204
+ amber to 97%, red below. It is a triage signal, not a verdict — open the report and
205
+ look at the diff column.
206
+
207
+ Under each score, `--progress` output and the report card say where to look:
208
+
209
+ ```
210
+ [3/8] 97.14% /pricing @1440 (height -24px)
211
+ band -24px at y=196 (right)
212
+ aligned 100.00%
213
+ text: 0 added, 1 removed
214
+ ```
215
+
216
+ - **Regions** are connected patches of differing pixels, on a 16px grid, largest first. On
217
+ a long page a missing link barely moves the score; it is still a region. Only the area
218
+ both sides cover is searched: padding is reported by the height delta and the bands. With
219
+ bands, regions come from the realigned rows, so content a band only pushed down isn't
220
+ one (above, the band is the whole difference, so there are none). The
221
+ card lists the top five with their pixel counts; up to three crops cover the bands first,
222
+ then the largest regions.
223
+ - **Bands** are rows only one side has, found by aligning the two images row by row. `-24px
224
+ at y=196 (right)` means the right side has 24 rows there that the left lacks — signed like
225
+ the height delta. When rows of identical content repeat, the band's `y` can slide along
226
+ them, so treat it as approximate. `aligned` is the score over the rows the alignment pairs,
227
+ i.e. what the page would score if the bands were cut out; it only shows when there are
228
+ bands. Pages of different heights that share too few identical rows say `rows too
229
+ different to align`. A horizontal shift is never a band. Alignment works on exact row
230
+ matches, so it gives up when the edits total more than 2,000 rows (a single inserted or
231
+ removed block aligns at any height), or when sub-threshold shade noise touches every row.
232
+ - **Text** is a line diff of each side's `document.body.innerText` (the element's, with a
233
+ selector). Left is the changed version: *added* lines are on the left only, *removed* lines on the right only. The card
234
+ lists the first 20. Masked elements are left out. Unmasked text that changes per load
235
+ (a ticker, a clock) shows up here whenever the two sides differed at capture time, even
236
+ when its pixels were painted out as unstable.
237
+
238
+ **Magenta means padding.** When one side is taller or wider, the shorter image is padded
239
+ with magenta, and that padding counts against the score on purpose: a page 400px shorter
240
+ than the one it's compared against has not reached parity. The `height ±Npx` badge on the
241
+ row names the cause.
242
+
243
+ **Errors are not failures.** A route that threw produced no measurement, so it is
244
+ neither a pass nor a fail. It's listed separately in the report — and it still exits 1,
245
+ because an unmeasured route is not a verified one.
246
+
247
+ ## Output
248
+
249
+ Everything lands in the out dir (`./renderdiff-out` by default):
250
+
251
+ - `report.html` — the scored report.
252
+ - `{slug}.{width}.{left,right,diff}.png` — full-page shots and the diff. `/` slugs to
253
+ `index`, `/blog/foo` to `blog-foo`, other characters to `_`, a pair `/a::/b` to `a~b`; a
254
+ clash gets a `-2` suffix.
255
+ - `{slug}.{width}.c{n}.png` — up to three crops per comparison: bands (rows only one side
256
+ has), tallest first, then the largest regions. Each shows left and right at native scale,
257
+ padded by 48px and at least 320px wide, with a 1px red box around the change; on the side
258
+ that lacks a band's rows, a 2px red seam is inserted where they would be, hiding nothing.
259
+ Left is always on top (`stacked`, for wide changes) or on the left (`side`, for tall
260
+ ones). A crop stays within 1,568px on its long edge and 1,568 image tokens
261
+ (⌈w/28⌉·⌈h/28⌉) and is never scaled below 0.75×; a change too big for that keeps its top
262
+ rows (or left columns) and is marked `clipped`. Height padding is never cropped.
263
+ - `results.json` — everything above as data, written on every run, errors included, one
264
+ result per line, scores rounded down to four decimals (so a shot that differs never
265
+ reads as `1`). Its types (`Results` and friends) are exported
266
+ from the package.
267
+
268
+ ```jsonc
269
+ {
270
+ "meta": {
271
+ "tool": "renderdiff", "version": "0.1.0", "generatedAt": "…",
272
+ "left": "http://localhost:3000", "right": "https://example.com",
273
+ "widths": [1440, 375], "threshold": null,
274
+ "clock": "…", // the instant both sides' clocks start at
275
+ "blockUrlPatterns": ["…"], "hideSelectors": ["…"],
276
+ "masks": [{ "urlPath": "/pricing", "reason": "live star count" }] // no urlPath: every route
277
+ },
278
+ "results": [
279
+ {
280
+ "url": "/about", "left": "/about", "right": "/about", // a pair: "/a::/b", "/a", "/b"
281
+ "width": 1440, "status": "compared",
282
+ "score": 0.9714, // share of measured pixels that match
283
+ "alignedScore": 1, // score over the aligned rows; null unless there are bands
284
+ "diffPixels": 33120, "totalPixels": 1158000, "unstablePixels": 0,
285
+ "heightDelta": -24, "widthDelta": 0, // left − right
286
+ "regions": [], // left-page px; with bands, from the realigned rows
287
+ "bands": [{ "side": "right", "y": 196, "h": 24 }], // null: too different to align
288
+ "text": { "added": [], "removed": ["Pricing"] },
289
+ "images": { "left": "about.1440.left.png", "right": "about.1440.right.png", "diff": "about.1440.diff.png" },
290
+ "crops": [{
291
+ "path": "about.1440.c1.png", "kind": "band", // or "region"
292
+ "left": { "x": 256, "y": 196, "w": 68, "h": 0 }, // h 0: where the rows would go
293
+ "right": { "x": 256, "y": 196, "w": 68, "h": 24 },
294
+ "layout": "stacked", "scale": 1, "clipped": false // left on top, or on the left ("side")
295
+ }]
296
+ },
297
+ { "url": "/blank", "left": "/blank", "right": "/blank", "width": 1440, "status": "error", "error": "page did not render …" }
298
+ ],
299
+ "summary": {
300
+ "compared": 1, "errors": 1, "mean": 0.9714,
301
+ "worst": { "url": "/about", "width": 1440, "score": 0.9714 },
302
+ "belowThreshold": 0
303
+ }
304
+ }
305
+ ```
306
+
307
+ Paths are relative to the out dir. Results are in route-then-width order.
308
+
309
+ ## What it does to make two loads comparable
310
+
311
+ - **Refuses to start** unless both origins answer a HEAD request. Two error pages diffed
312
+ against each other score ~100%, which is the likeliest way a tool like this lies to you.
313
+ - **Refuses a shot** it can't trust: an HTTP status of 400 or above on either side is an
314
+ error naming the status. A route where *both* sides look blank — under 200 characters of
315
+ text and no visible images, SVG, canvas, video, iframes or form controls — errors instead
316
+ of quietly scoring as a match. If only one side is blank, the diff shows it.
317
+ - **Blocks analytics, consent and A/B tooling** at the network layer on both sides —
318
+ GTM, GA, Segment, Intercom, Hotjar, LinkedIn, Meta, OneTrust, CookieLaw, VWO. Blocked
319
+ rather than hidden, because A/B tools rewrite arbitrary DOM and CSS can't pre-empt an
320
+ experiment you haven't seen. Blocking must stay symmetric: doing it on one side only
321
+ is itself a diff.
322
+ - **Pins what varies between loads**, identically on both sides: the clock starts at one
323
+ instant per run (floored to the minute) on every load and then runs, `Math.random` is
324
+ seeded, timezone (UTC), locale (en-US), colour scheme
325
+ (light) and `prefers-reduced-motion` are fixed, and videos are paused at frame 0. A clock
326
+ that shows seconds can still tick between the two sides and may need a mask.
327
+ - **Kills animation, transitions and caret blink**, and hides common consent banners and
328
+ dev toolbars.
329
+ - **Settles the page** — makes native lazy images eager, scrolls every viewport-height
330
+ slice a frame at a time so script lazy loaders fire, waits for every image to decode,
331
+ `document.fonts.ready` and up to 3s of network idle, then re-injects the stylesheet to
332
+ catch late-injected chrome.
333
+ - **Shoots until stable** — repeats the screenshot until two in a row match (at most 3; 2
334
+ for tiled pages). Pixels still changing between the last two shots of the same load are
335
+ noise from that origin: they're painted magenta on both sides, reported per comparison
336
+ as `unstable`, and excluded from the measurement — the score is over the remaining
337
+ pixels. A route more than 25% unstable errors as `page did not settle`.
338
+ - **Isolates state** — one browser context per origin, so cookies and localStorage never
339
+ cross. Both sides of a route load at the same time.
340
+ - **Retries once** per shot; a live site can time out on a cold edge.
341
+ - **Stitches tall pages.** Chromium silently truncates a single screenshot past 16,384px,
342
+ so taller pages are captured as tiles through CDP and stitched back together. Masks are
343
+ painted onto the final image from each element's bounding box, so they apply the same
344
+ way on both paths. Past 40,000px it errors — that's a broken layout, not a page.
345
+
346
+ Every run's report ends with a "What was neutralized" section listing the actual block
347
+ patterns, mask reasons and pinned settings in effect, so the report can't drift from the
348
+ config.
349
+
350
+ ## Development
351
+
352
+ ```bash
353
+ npm install # builds via the prepare script
354
+ npm run build # tsc → dist/
355
+ npm run typecheck # src + tests, no emit
356
+ npm install -g . # install this working copy globally
357
+ ```
358
+
359
+ Source is TypeScript in `src/`, compiled to ESM in `dist/`. Import specifiers keep their
360
+ `.ts` extension in source (`rewriteRelativeImportExtensions` rewrites them on emit), so
361
+ `node src/cli.ts` also runs directly.
362
+
363
+ ## Tests
364
+
365
+ ```bash
366
+ npm test # unit tier — no browser, ~4s
367
+ npm run test:visual # drives Chromium over the fixture corpus, ~40s
368
+ npm run test:all
369
+ ```
370
+
371
+ Built on `node:test`, no test dependencies. Running them needs a Chromium for the visual tier:
372
+ `npx playwright install chromium`.
373
+
374
+ The suite is black-box: it spawns `node src/cli.ts` and reads results back from stdout,
375
+ `report.html`, `results.json`, and the written PNGs. Nothing under `src/` is imported at
376
+ runtime (only the `results.json` types), so what is asserted is what a user gets. The output
377
+ formats it depends on are parsed in exactly one place, `tests/helpers/parse.ts`.
378
+
379
+ **`tests/unit/`** — argument parsing, exit codes, route normalization, and config discovery,
380
+ validation and precedence. All of it through `--dry-run`, which exits before the browser.
381
+
382
+ **`tests/visual/`** — real captures against `tests/fixtures/`, a two-origin site served on
383
+ ephemeral ports. Three groups:
384
+
385
+ - *Equivalence* — six pairs of pages that are visually identical but built with different CSS:
386
+ flex against grid, floats against flex, CSS tables against grid, transform-centring against
387
+ `place-items`, inline-block against flex. These assert a **zero-pixel** diff, not a
388
+ threshold. They are the corpus's central claim: the score tracks pixels, not markup, so a
389
+ refactor that changed nothing visible reads as nothing changed.
390
+ - *Controls* — an 8px shift, an extra section, one recoloured box. These must score low.
391
+ Without them a tool that returned 100% unconditionally would pass the suite.
392
+ - *Guard rails* — one per defence above: the blank-page refusal (and a short sign-in page
393
+ that must not be refused), the 18,000px tiled capture with masks in both tiles, animation
394
+ stilling, the shared clock start and seeded randomness, the unstable-pixel check, lazy-image
395
+ settling (native and script-driven, 4,800px below the fold), consent hiding, masks, and
396
+ network blocking. Masks
397
+ and blocking each run twice, with and without their config, so the mechanism is shown doing
398
+ something rather than a page merely happening to match.
399
+
400
+ Fixture authoring rules — integer-pixel geometry above all — are in
401
+ [`tests/fixtures/pages/README.md`](./tests/fixtures/pages/README.md), and
402
+ `tests/unit/fixtures.test.ts` enforces what can be enforced. Read them before adding a pair:
403
+ a fractional box is the difference between a clean comparison and sub-pixel noise.
404
+
405
+ ## License
406
+
407
+ MIT
@@ -0,0 +1,26 @@
1
+ import type { Page } from "playwright";
2
+ import { type ResolvedConfig, type Route } from "./config.ts";
3
+ /** Loads a page, settles it, and screenshots it. */
4
+ export interface Shot {
5
+ png: Buffer;
6
+ /** One byte per pixel of `png`, set where the last two shots of this load disagreed. */
7
+ unstable: Uint8Array | null;
8
+ /** Why this side looks blank, or null. Only an error when both sides do. */
9
+ blank: string | null;
10
+ /**
11
+ * `document.body.innerText` (the element's, with a selector), whitespace collapsed per
12
+ * line, empty lines dropped.
13
+ */
14
+ text: string[];
15
+ }
16
+ /**
17
+ * Install network blocking, the fake clock and seeded randomness. Once per page,
18
+ * before any navigation.
19
+ */
20
+ export declare function prepare(page: Page, cfg: ResolvedConfig, now: number): Promise<void>;
21
+ export declare function capture(page: Page, url: string, route: Route, side: "left" | "right", width: number, cfg: ResolvedConfig, now: number): Promise<Shot>;
22
+ /**
23
+ * Paint every pixel either side found unstable onto both sides, so that noise is left
24
+ * out of the measurement. Rewrites `left.png` / `right.png`; returns the painted pixel count.
25
+ */
26
+ export declare function cancelUnstable(left: Shot, right: Shot): Promise<number>;