@afixt/screenshot-utils 0.9.0 → 1.0.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/CHANGELOG.md +2 -5
- package/README.md +20 -20
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/types/adapters/cdp.d.ts +28 -0
- package/dist/types/adapters/cdp.d.ts.map +1 -0
- package/dist/types/adapters/index.d.ts +5 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/playwright.d.ts +28 -0
- package/dist/types/adapters/playwright.d.ts.map +1 -0
- package/dist/types/adapters/puppeteer.d.ts +20 -0
- package/dist/types/adapters/puppeteer.d.ts.map +1 -0
- package/dist/types/capture/element.d.ts +20 -0
- package/dist/types/capture/element.d.ts.map +1 -0
- package/dist/types/capture/index.d.ts +8 -0
- package/dist/types/capture/index.d.ts.map +1 -0
- package/dist/types/capture/long-page.d.ts +16 -0
- package/dist/types/capture/long-page.d.ts.map +1 -0
- package/dist/types/capture/page.d.ts +14 -0
- package/dist/types/capture/page.d.ts.map +1 -0
- package/dist/types/capture/responsive.d.ts +20 -0
- package/dist/types/capture/responsive.d.ts.map +1 -0
- package/dist/types/capture/settle.d.ts +14 -0
- package/dist/types/capture/settle.d.ts.map +1 -0
- package/dist/types/capture/viewport.d.ts +14 -0
- package/dist/types/capture/viewport.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +10 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/compose/annotate.d.ts +16 -0
- package/dist/types/compose/annotate.d.ts.map +1 -0
- package/dist/types/compose/diff.d.ts +15 -0
- package/dist/types/compose/diff.d.ts.map +1 -0
- package/dist/types/compose/heatmap.d.ts +17 -0
- package/dist/types/compose/heatmap.d.ts.map +1 -0
- package/dist/types/compose/index.d.ts +6 -0
- package/dist/types/compose/index.d.ts.map +1 -0
- package/dist/types/compose/theme.d.ts +17 -0
- package/dist/types/compose/theme.d.ts.map +1 -0
- package/dist/types/errors/adapter.d.ts +33 -0
- package/dist/types/errors/adapter.d.ts.map +1 -0
- package/dist/types/errors/base.d.ts +37 -0
- package/dist/types/errors/base.d.ts.map +1 -0
- package/dist/types/errors/capture.d.ts +109 -0
- package/dist/types/errors/capture.d.ts.map +1 -0
- package/dist/types/errors/compose.d.ts +35 -0
- package/dist/types/errors/compose.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +29 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/errors/optional.d.ts +23 -0
- package/dist/types/errors/optional.d.ts.map +1 -0
- package/dist/types/errors/redaction.d.ts +21 -0
- package/dist/types/errors/redaction.d.ts.map +1 -0
- package/dist/types/errors/tile.d.ts +29 -0
- package/dist/types/errors/tile.d.ts.map +1 -0
- package/dist/types/errors/transform.d.ts +35 -0
- package/dist/types/errors/transform.d.ts.map +1 -0
- package/dist/types/index.d.ts +58 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/redact/index.d.ts +5 -0
- package/dist/types/redact/index.d.ts.map +1 -0
- package/dist/types/redact/policy.d.ts +29 -0
- package/dist/types/redact/policy.d.ts.map +1 -0
- package/dist/types/redact/redact.d.ts +29 -0
- package/dist/types/redact/redact.d.ts.map +1 -0
- package/dist/types/tile/dzi.d.ts +18 -0
- package/dist/types/tile/dzi.d.ts.map +1 -0
- package/dist/types/tile/index.d.ts +3 -0
- package/dist/types/tile/index.d.ts.map +1 -0
- package/dist/types/transform/convert.d.ts +13 -0
- package/dist/types/transform/convert.d.ts.map +1 -0
- package/dist/types/transform/crop.d.ts +33 -0
- package/dist/types/transform/crop.d.ts.map +1 -0
- package/dist/types/transform/index.d.ts +7 -0
- package/dist/types/transform/index.d.ts.map +1 -0
- package/dist/types/transform/normalize.d.ts +14 -0
- package/dist/types/transform/normalize.d.ts.map +1 -0
- package/dist/types/transform/resize.d.ts +14 -0
- package/dist/types/transform/resize.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/capture/element.js +3 -4
- package/src/capture/settle.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
5
|
+
## [1.0.0](https://github.com/AFixt/screenshot-utils/compare/v0.9.0...v1.0.0) (2026-05-29)
|
|
9
6
|
|
|
10
7
|
## [0.9.0] - 2026-05-22
|
|
11
8
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Screenshot capture, transform, compose, tile, and redact utilities for the AFixt/Revenant accessibility platform.
|
|
4
4
|
|
|
5
|
-
Status: **0.9.0** — Phases 0–4 of [`PLAN.md`](./PLAN.md) are complete; the full public API from [`spec.md`](./spec.md) § 8 is implemented and tested. Pre-1.0 while the v1.0.0 acceptance
|
|
5
|
+
Status: **0.9.0** — Phases 0–4 of [`PLAN.md`](./PLAN.md) are complete; the full public API from [`spec.md`](./spec.md) § 8 is implemented and tested (capture and transform at ≥90% line+branch coverage per § 23). Pre-1.0 while the remaining v1.0.0 acceptance items in `spec.md` § 23 land (a live CDP adapter test and the CI matrix running green). The API is expected to stay stable through to 1.0.0.
|
|
6
6
|
|
|
7
7
|
This package owns **all** screenshot operations for the AFixt/Revenant platform: full-page, viewport, element, long-page strip-stitch, multi-viewport capture; crop / resize / convert / normalize transforms; annotate / heatmap / diff / composite; DZI tile pyramids; and PII redaction. It is being extracted from `@afixt/afixt-engine`; the engine will become a consumer.
|
|
8
8
|
|
|
@@ -40,27 +40,27 @@ Screenshot work was scattered across `afixt-engine`, `mortise`, and ad-hoc consu
|
|
|
40
40
|
|
|
41
41
|
## Install
|
|
42
42
|
|
|
43
|
-
| Dependency | Status | Why you'd want it
|
|
44
|
-
| ------------------- | ---------------------------------------------- |
|
|
45
|
-
| `sharp` | Required runtime dep — installed automatically | All raster operations
|
|
46
|
-
| `puppeteer` >=23 | Optional peer | `fromPuppeteerPage` adapter
|
|
47
|
-
| `playwright` >=1.40 | Optional peer | `fromPlaywrightPage` adapter
|
|
48
|
-
| `pixelmatch` | Optional peer | `diff()` function
|
|
49
|
-
| `pngjs` | Optional peer | `pixelmatch` co-dependency
|
|
50
|
-
| `@napi-rs/canvas` | Deferred to v1.1 | Advanced annotation strokes
|
|
43
|
+
| Dependency | Status | Why you'd want it |
|
|
44
|
+
| ------------------- | ---------------------------------------------- | ---------------------------- |
|
|
45
|
+
| `sharp` | Required runtime dep — installed automatically | All raster operations |
|
|
46
|
+
| `puppeteer` >=23 | Optional peer | `fromPuppeteerPage` adapter |
|
|
47
|
+
| `playwright` >=1.40 | Optional peer | `fromPlaywrightPage` adapter |
|
|
48
|
+
| `pixelmatch` | Optional peer | `diff()` function |
|
|
49
|
+
| `pngjs` | Optional peer | `pixelmatch` co-dependency |
|
|
50
|
+
| `@napi-rs/canvas` | Deferred to v1.1 | Advanced annotation strokes |
|
|
51
51
|
|
|
52
|
-
Node `>=
|
|
52
|
+
Node `>=20.0.0` is required (`engine-strict=true`).
|
|
53
53
|
|
|
54
54
|
## PageAdapter
|
|
55
55
|
|
|
56
56
|
The capture functions never import a browser. Consumers wrap their `Page`-like object:
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
|
-
const { fromPuppeteerPage } = require('@afixt/screenshot-utils
|
|
59
|
+
const { fromPuppeteerPage } = require('@afixt/screenshot-utils');
|
|
60
60
|
const adapter = fromPuppeteerPage(page);
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Anything that satisfies the `PageAdapter` interface works — write your own for CDP-only runtimes. See `docs/adapters.md`
|
|
63
|
+
Anything that satisfies the `PageAdapter` interface works — write your own for CDP-only runtimes. See `docs/adapters.md` for the contract.
|
|
64
64
|
|
|
65
65
|
## Capture functions
|
|
66
66
|
|
|
@@ -77,20 +77,20 @@ Anything that satisfies the `PageAdapter` interface works — write your own for
|
|
|
77
77
|
- `convert(buffer, format, opts)` — re-encode
|
|
78
78
|
- `resize(buffer, opts)` — fit, contain, cover
|
|
79
79
|
- `normalize(buffer, opts)` — strip metadata, fix orientation
|
|
80
|
-
- `annotate(buffer, annotations, opts)` — boxes, labels, severities
|
|
81
|
-
- `heatmap(buffer, points, opts)` — kernel-density overlay
|
|
82
|
-
- `diff(a, b, opts)` — pixelmatch-backed visual diff
|
|
80
|
+
- `annotate(buffer, annotations, opts)` — boxes, labels, severities
|
|
81
|
+
- `heatmap(buffer, points, opts)` — kernel-density overlay
|
|
82
|
+
- `diff(a, b, opts)` — pixelmatch-backed visual diff
|
|
83
83
|
|
|
84
84
|
## Tiling
|
|
85
85
|
|
|
86
|
-
- `tileDzi(buffer, outDir | 'buffers', opts)` — produce a Deep Zoom Image pyramid
|
|
86
|
+
- `tileDzi(buffer, outDir | 'buffers', opts)` — produce a Deep Zoom Image pyramid
|
|
87
87
|
|
|
88
88
|
## Redaction
|
|
89
89
|
|
|
90
|
-
- `redact(buffer, regions, mode, opts)` — blur, mask, or pixelate PII regions
|
|
90
|
+
- `redact(buffer, regions, mode, opts)` — blur, mask, or pixelate PII regions
|
|
91
91
|
- `applyPiiPolicy(buffer, policy)` — apply a policy bundle for repeatable redaction
|
|
92
92
|
|
|
93
|
-
## CLI
|
|
93
|
+
## CLI
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
96
|
npx @afixt/screenshot-utils crop input.png --rect 0,0,400,300 --out thumb.png
|
|
@@ -103,11 +103,11 @@ npx @afixt/screenshot-utils diff before.png after.png --out diff.png
|
|
|
103
103
|
- Pass `encoding: 'stream'` for memory-sensitive pipelines.
|
|
104
104
|
- Use `cropMany` rather than calling `crop` in a loop — internally bounded parallelism is faster and uses less memory.
|
|
105
105
|
- For long pages, prefer `captureLongPage` over a giant viewport — sharp handles strips better than 30 000-px-tall buffers.
|
|
106
|
-
- See `docs/performance.md`
|
|
106
|
+
- See `docs/performance.md` for ceilings.
|
|
107
107
|
|
|
108
108
|
## Errors
|
|
109
109
|
|
|
110
|
-
Every failure is a named class with a stable `code`, a structured `reason` enum, and a `retriable: boolean` hint. Hierarchy in `spec.md` § 14.1. Catalog in `docs/error-codes.md
|
|
110
|
+
Every failure is a named class with a stable `code`, a structured `reason` enum, and a `retriable: boolean` hint. Hierarchy in `spec.md` § 14.1. Catalog in `docs/error-codes.md`.
|
|
111
111
|
|
|
112
112
|
## Versioning & non-goals
|
|
113
113
|
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var require_package = __commonJS({
|
|
|
16
16
|
"package.json"(exports, module) {
|
|
17
17
|
module.exports = {
|
|
18
18
|
name: "@afixt/screenshot-utils",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "1.0.0",
|
|
20
20
|
description: "Screenshot capture, transform, compose, tile, and redact utilities for the AFixt/Revenant accessibility platform",
|
|
21
21
|
type: "commonjs",
|
|
22
22
|
main: "./dist/index.js",
|
|
@@ -99,7 +99,7 @@ var require_package = __commonJS({
|
|
|
99
99
|
access: "restricted"
|
|
100
100
|
},
|
|
101
101
|
engines: {
|
|
102
|
-
node: ">=
|
|
102
|
+
node: ">=20.0.0"
|
|
103
103
|
},
|
|
104
104
|
keywords: [
|
|
105
105
|
"screenshot",
|
|
@@ -148,7 +148,7 @@ var require_package = __commonJS({
|
|
|
148
148
|
"@commitlint/config-conventional": "20.5.3",
|
|
149
149
|
"@eslint/js": "10.0.1",
|
|
150
150
|
"@types/node": "22.19.19",
|
|
151
|
-
"@vitest/coverage-
|
|
151
|
+
"@vitest/coverage-istanbul": "4.1.5",
|
|
152
152
|
"clean-jsdoc-theme": "4.3.2",
|
|
153
153
|
eslint: "10.3.0",
|
|
154
154
|
"eslint-plugin-import-x": "4.16.2",
|
|
@@ -167,6 +167,7 @@ var require_package = __commonJS({
|
|
|
167
167
|
"lint-staged": "17.0.2",
|
|
168
168
|
"markdownlint-cli": "0.48.0",
|
|
169
169
|
"npm-run-all2": "8.0.4",
|
|
170
|
+
openseadragon: "6.0.2",
|
|
170
171
|
pixelmatch: "7.1.0",
|
|
171
172
|
playwright: "1.60.0",
|
|
172
173
|
pngjs: "7.0.0",
|