photoprism/frontend/scripts
Michael Mayer da169dc669 Frontend: Pre-compress static bundle assets at build time #5552
Adds frontend/scripts/precompress.js, a Node script that walks
assets/static/build/ and emits .gz (zlib level 9) and .zst (zlib level
19) siblings for every JS, CSS, JSON, SVG, font, source map, and small
text asset. Already-encoded binaries (woff2, png, jpg, ...) and
no-savings files (smaller than 1 KiB or compressing to >95% of source)
are skipped. Every emitted sibling is round-tripped through
gunzipSync / zstdDecompressSync so a corrupt sibling never reaches
disk.

Wired as the npm `postbuild` hook so `npm run build` produces siblings,
and as `prewatch` (`--clean`) so `npm run watch` removes any stale
siblings from a prior production build before webpack's first emit.

The built-in node:zlib zstd API requires Node 22.15 or later; engines
constraint bumped accordingly and frontend/tests/README.md aligned.
2026-05-03 13:43:44 +00:00
..
precompress.js