Library Patches
Two third-party libraries are modified in the tree. book/lib/paged.browser.js is a patched copy of paged.js v0.4.3 (MIT); the fast-*.mjs files there are shims applied to pdf-lib’s live exports before each PDF process phase. This section documents each change: the upstream behaviour, why it did not suit the build pipeline, and the fix.
A third library, axe-core, is patched in memory only. The accessibility scan rewrites the bundle as it injects it: SOURCE_PATCHES in scripts/lib/axe-scan.mjs replaces Color2’s six WeakMap-emulated #private fields with plain own properties, which saves about a quarter of the scan’s running time. Nothing under node_modules/ changes, so re-verify the substitution after each axe-core upgrade. Two gates do that: check_axe_patch_equiv.mjs compares the colour values the patched and stock bundles produce, and check_a11y_fingerprint.mjs compares the findings across the whole scan matrix.
Sub-pages
- Paged.js Patches — changes to
book/lib/paged.browser.js: the synchronous execution chain, hook dispatch fast-paths, DOM lookup optimizations, layout correctness fixes, and miscellaneous headless-specific changes. - pdf-lib Patches — the
fast-*.mjsshims andparallel-deflate.mjsthat retune pdf-lib’s parser, object model, and serializer for the process phase.