fix(producer): embed font data at build time instead of runtime require.resolve

The CLI bundle uses tsup to inline @hyperframes/producer, but the
deterministicFonts module used require.resolve('@fontsource/*/package.json')
at runtime to find woff2 files on disk. When installed via npx, these
@fontsource packages don't exist, causing "Cannot find module" errors.

Replace runtime filesystem lookups with a build-time generator that reads
all @fontsource woff2 files and produces a TypeScript module with base64
data URIs. The generator runs before both producer and CLI builds, making
the bundle fully self-contained with zero @fontsource runtime dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
James
2026-03-26 20:59:11 +00:00
co-authored by Claude Opus 4.6
parent e1c1c6fb30
commit 7e059e15f9
5 changed files with 154 additions and 57 deletions
+2 -1
View File
@@ -22,7 +22,8 @@
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"build": "bun run --cwd ../.. build:hyperframes-runtime:modular && node build.mjs",
"build": "bun run build:fonts && bun run --cwd ../.. build:hyperframes-runtime:modular && node build.mjs",
"build:fonts": "tsx scripts/generate-font-data.ts",
"typecheck": "tsc --noEmit",
"parity:check": "tsx src/parity-harness.ts",
"parity:fixtures": "tsx src/parity-fixtures.ts",