Status: done (2026-11-15)
Priority: 3
Size: S
Arch: yardstick
Phase: implement
Design ref: none (code structure). docs/typescript-plan.md (P2); the survey in backlog/VB-055.md.
Goal: build.py inlines every file of src/manifest.json as its own <script> and splices src/page/*.js into a closure in body.html. Replace it with build.js (Node, so one language): one dev dependency, esbuild at an exact version, bundling an entry src/main.js that imports the manifest’s modules in the manifest’s order, for their effects (the VB namespace is still how they meet), into one IIFE inlined in index.html, with the page script spliced as now. index.html stays one self-contained file (PixiJS and the fonts still come from the network), --check is kept, and the build id (a hash of the page’s sources) is kept.
Acceptance criteria:
node build.js writes index.html; node build.js --check fails if it is stale; build.py is deleted; package.json has the dependency at an exact version and a build script; tests/run.js, .github/workflows/checks.yml, AGENTS.md and BACKLOG.md name the new command.tests/smoke.js, tests/browser.js and the other page scripts of npm run verify pass, and node tools/same.js --base REF prints same. Not required: a byte-identical index.html (the wrapper changes).index.html and the build time before and after are in the task file (before: 1,226,620 bytes, python3 build.py --check 0.06 s on 12 November). Source maps are not shipped.// @sys comment lines the module map greps (grep -rn "^// @sys" src reads src/, not the page, so it should not matter).docs/typescript-plan.md, where this task is P2): waits for Kim’s answers to QUESTIONS.md, “VB-055: the move to TypeScript” (the formatter, the bundler, the hook, the width measures, when, the page and the tests, strict), which may change its criteria; the three rules common to these tasks are at the top of the plan.package.json, the workflow and index.html, which every task regenerates, so a rebase takes the generated file.
Notes:QUESTION_ARCHIVE.md, VB-055, 15 Nov). This task runs beside other work; the tooling choices are as proposed there (Deciding without Kim, 12).build.js (Node) replaces build.py; esbuild 0.28.2 (exact, devDependency), npm run build, --check, --stdout. The entry is made in
memory from src/manifest.json (one list, no src/main.js to keep in step); bundled as one IIFE, legalComments: none, no source maps.
tests/lib/page.js, tests/build.js, pages.yml (now sets up node and npm ci), AGENTS.md, README.md and docs/commands.md name node build.js.
tests/run.js and checks.yml never named the build; the BACKLOG.md row is the task’s title, left to the orchestrator.Sim, ArchGen, Culture) were page globals as
separate scripts; inside the IIFE they are local. sim.js and gen.js now end with globalThis.X = X as culture.js already did.index.html: 1,748,841 bytes with build.py (this commit’s parent; 1,226,620 on 12 November), 1,396,205 with build.js (esbuild
drops comments). Build time: build.py --stdout 0.15 s, node build.js 0.28-0.34 s (esbuild bundling).// @sys lines: esbuild drops every comment, so none survive in the page (0 of them in index.html); the module map reads src/, unaffected.npm run verify 110/110, tests/smoke.js, browser, -start, -editor, -speed, -saves pass; node tools/same.js --base HEAD same.
tests/browser-mobile.js fails “the charter has a phrase a custom, 15 !== 14”, also at the parent commit (not this change).