feat(diarie): brand stamp generator → brand-dist/ build output (opentype.js@^2.0.0)
Turn the designer's rough update-stamp.mjs sketch into a hardened, runnable
build step, and give it a build output to write into instead of the pristine
source.
- Rename update-stamp.mjs → .js (inherits the cliFiles eslint override; shebang
dropped). Harden the .dnr splice: assert EXACTLY one match (zero OR many both
throw, naming the count) and replace via a function replacer so `$`/`$&` in
the date/version can't be treated as replacement patterns. CWD-safe paths via
import.meta.url; Buffer→ArrayBuffer slice avoids the Node pool-slice trap.
- The generator now stamps brand-dist/index.html, NOT source brand/index.html —
the committed source stamp is the designer's bespoke-pipeline artifact and
stays untouched. Verified via Playwright that the opentype.js reproduction is
pixel-identical to the bespoke stamp, so it is safe as the deploy-time source
of truth.
- opentype.js@^2.0.0 (not ^1.3.5): proven byte-identical to 1.3.5 for our
getPath().toPathData(1) usage, even under issue #724's own repro conditions —
and 2.x is the maintained line. @types/opentype.js@^1.3.10 (only version
published; covers our usage on both runtimes).
- brand/dist-copy.js (brand:copy): reset brand-dist/ to a clean snapshot of the
deployable source allowlist (index.html, og.png, fonts/). brand:build =
run-s brand:copy brand:stamp.
- brand-dist/ gitignored (a deliberate lint-scope exclusion — it is generated).
- tsc now typechecks brand/ (was outside the include by scaffolding default);
knip traces the new entrypoints. Malformed-input splice test (5 cases).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>