@qrcommunication/gigapdf-lib 0.40.0 → 0.42.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 +53 -0
- package/dist/index.cjs +31 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,59 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
|
|
|
4
4
|
The format follows [Keep a Changelog](https://keepachangelog.com/) and the
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.42.0] - 2026-06-18
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Cryptography now uses audited RustCrypto crates** (`rsa`, `sha2`, `aes`,
|
|
12
|
+
`cbc`, `des`, `rc2`, `hmac`, `x509-cert`, `cms`) instead of hand-rolled
|
|
13
|
+
primitives — for PDF signing (RSA/X.509/CMS) and the standard security handler
|
|
14
|
+
(AES/RC4/3DES/RC2). The public ABI and SDK are unchanged.
|
|
15
|
+
- **The HTML→PDF inline-`<script>` engine is now Boa** (`boa_engine`), replacing
|
|
16
|
+
the hand-written interpreter. `js::run_inline_scripts` / `js::eval` keep their
|
|
17
|
+
signatures; Boa is a full ES2021+ engine, so generators, `async`/`await`,
|
|
18
|
+
`RegExp`, `Map`/`Set` and the rest behave per spec. ~14k lines of the former
|
|
19
|
+
engine were removed.
|
|
20
|
+
- The wasm engine stays **`wasm-bindgen`-free**. Entropy (RSA blinding, Boa
|
|
21
|
+
`Math.random`) is drawn through a single host import, **`env.gp_host_random`**,
|
|
22
|
+
which the SDK's `load()` fills from `crypto.getRandomValues`. **Hosts that
|
|
23
|
+
instantiate the `.wasm` directly must now provide this import** (the import
|
|
24
|
+
object was previously empty). Dropping the `wasm_js` getrandom backend also
|
|
25
|
+
removed the transitive `wasm-bindgen`/`js-sys` dependency tree.
|
|
26
|
+
|
|
27
|
+
> Rationale: rolling your own cryptography (timing/oracle side-channels, eIDAS
|
|
28
|
+
> non-conformance) and maintaining a JS engine are liabilities better delegated
|
|
29
|
+
> to audited, wasm-compatible crates. The "no third-party PDF/Office/image
|
|
30
|
+
> library" invariant is unchanged — see `THIRD-PARTY-LICENSES.md`.
|
|
31
|
+
|
|
32
|
+
## [0.41.0] - 2026-06-17
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- **AVIF: mixed 2D transforms (ADST/DCT) used the wrong row vs column axis.**
|
|
37
|
+
The inverse transform applied the *vertical* 1D type to the rows and the
|
|
38
|
+
*horizontal* one to the columns, so `ADST_DCT` (and every other mixed type)
|
|
39
|
+
ran its ADST across the rows instead of down the columns. The symmetric types
|
|
40
|
+
(DCT_DCT, ADST_ADST, FLIPADST_FLIPADST, IDTX) are swap-invariant, which hid
|
|
41
|
+
the bug until a still used a mixed type — the common case for real-world
|
|
42
|
+
AVIFs, whose intra residual leans heavily on ADST. The reconstruction is now
|
|
43
|
+
bit-exact vs dav1d. Versions before this corrupted most photographic AVIFs.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **AVIF: multi-strength CDEF (`cdef_bits > 0`).** The CDEF stage now reads the
|
|
48
|
+
per-64×64 `cdef_idx` from the tile stream (once per filter unit, after the
|
|
49
|
+
skip flag) and selects the matching primary/secondary strength pair per plane,
|
|
50
|
+
rather than assuming a single strength set. Bit-exact against dav1d on
|
|
51
|
+
single-strength fixtures; the multi-strength read position is verified
|
|
52
|
+
sync-correct (with-read vs no-read divergence proof).
|
|
53
|
+
- **AVIF: directional intra real-neighbour edges.** Directional predictors
|
|
54
|
+
(Z1/Z2/Z3) gather the true top-right / bottom-left samples via a
|
|
55
|
+
`BlockDecoded` availability grid instead of repeating the last edge sample.
|
|
56
|
+
Together with the transform fix above, the whole AVIF intra path — mixed
|
|
57
|
+
transforms, Z1/Z2/Z3 directional, palette, CDEF and deblocking in a single
|
|
58
|
+
frame — is now validated bit-exact vs dav1d on a 64×64 noise still.
|
|
59
|
+
|
|
7
60
|
## [0.40.0] - 2026-06-17
|
|
8
61
|
|
|
9
62
|
### Changed
|
package/dist/index.cjs
CHANGED
|
@@ -60,11 +60,28 @@ var GigaPdfEngine = class _GigaPdfEngine {
|
|
|
60
60
|
} else {
|
|
61
61
|
bytes = source;
|
|
62
62
|
}
|
|
63
|
+
let ex;
|
|
63
64
|
const { instance } = await WebAssembly.instantiate(
|
|
64
65
|
bytes instanceof Uint8Array ? bytes.slice().buffer : bytes,
|
|
65
|
-
{
|
|
66
|
+
{
|
|
67
|
+
env: {
|
|
68
|
+
gp_host_random: (ptr, len) => {
|
|
69
|
+
const c = globalThis.crypto;
|
|
70
|
+
if (!c?.getRandomValues) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"gigapdf: wasm entropy needs Web Crypto (globalThis.crypto.getRandomValues)"
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const mem = new Uint8Array(ex.memory.buffer, ptr, len);
|
|
76
|
+
for (let off = 0; off < len; off += 65536) {
|
|
77
|
+
c.getRandomValues(mem.subarray(off, Math.min(off + 65536, len)));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
66
82
|
);
|
|
67
|
-
|
|
83
|
+
ex = instance.exports;
|
|
84
|
+
return new _GigaPdfEngine(ex);
|
|
68
85
|
}
|
|
69
86
|
/**
|
|
70
87
|
* Convenience loader for Node: instantiate from the `gigapdf.wasm` shipped
|
|
@@ -346,15 +363,24 @@ var GigaPdfEngine = class _GigaPdfEngine {
|
|
|
346
363
|
);
|
|
347
364
|
}
|
|
348
365
|
/**
|
|
349
|
-
* Decode a
|
|
350
|
-
*
|
|
366
|
+
* Decode a WebP to `{ width, height, rgba }`, or `null`. Handles both
|
|
367
|
+
* **lossless** (VP8L) and **lossy** (VP8 keyframe) WebP with the engine's
|
|
368
|
+
* native decoder — no third-party image library. Extended/animated WebP
|
|
369
|
+
* (`VP8X`) is not handled (returns `null`).
|
|
351
370
|
*/
|
|
352
371
|
decodeWebp(webp) {
|
|
353
372
|
return this._decodeFramed(webp, (p, l, o) => this.ex.gp_decode_webp(p, l, o));
|
|
354
373
|
}
|
|
355
374
|
/**
|
|
356
375
|
* Decode a still **AVIF** (AV1 intra) to `{ width, height, rgba }`, or `null`.
|
|
357
|
-
*
|
|
376
|
+
* Pure-Rust AV1 decoder — no third-party library. Supports lossy + lossless
|
|
377
|
+
* transforms, in-loop deblocking (AV1 §7.14) and CDEF (§7.15, including the
|
|
378
|
+
* multi-strength `cdef_bits > 0` path), screen-content **palette** mode
|
|
379
|
+
* (§5.11.46-50), and both `reduced_still_picture_header` and the full
|
|
380
|
+
* streaming sequence/frame headers — all validated bit-exact against dav1d.
|
|
381
|
+
* Not yet covered: animated AVIF, film grain, loop restoration (§7.17), the
|
|
382
|
+
* fully bit-exact directional top-right/bottom-left intra edge, and the
|
|
383
|
+
* lossless WHT path at very-high quality (`q ≤ 20`).
|
|
358
384
|
*/
|
|
359
385
|
decodeAvif(avif) {
|
|
360
386
|
return this._decodeFramed(avif, (p, l, o) => this.ex.gp_decode_avif(p, l, o));
|