Skip to content

Build every committed bundle with one Node builder - #2460

Merged
max-sixty merged 1 commit into
mainfrom
cq-one-node-builder
Oct 12, 2026
Merged

max-sixty merged 1 commit into
mainfrom
cq-one-node-builder

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Every committed browser bundle is now built by one Node builder. build/vendor.py (Python shelling out to esbuild per bundle, copying patched packages into a scratch dir, handing meta.json to shipped.mjs's CLI) and its five per-bundle Node scripts become build/vendor.mjs: one table, a row per bundle, built in-process and returned as an outputs map that build/browser/build.mjs writes and checks alongside the framework, initial renderers and styles. Code-quality survey items F127 and F58.

What changes for a contributor:

  • pnpm run build:browser rebuilds everything (about 2s); pnpm run check:browser, already part of pnpm run check, compares every bundle with the committed bytes without writing, so it works on an uncommitted tree. check:bundles, its CI step and its wt merge block are gone.
  • The layer's vendor/ and every package's vendor/ are owned whole: any file there that no build writes is reported stale (this replaces the git status read).
  • Upstream adaptations go through one adapt esbuild plugin and one seam() count guard (Lit's three included); the floating-ui .patch files apply in memory with jsdiff. An adaptation whose module no longer loads now fails the build. Nothing writes node_modules or a scratch copy.
  • build/registry.mjs is the single generator of registry-derived runtime modules: runtime/syntax-languages.js (was in vendor.py) and runtime/composing/drawing-schema.js (was in build.mjs) are two rows of one table, so a new registry fact is one row.
  • build/lit.mjs (F58) declares the static-html renaming once and derives the export list from lit/static-html.js; lit.js and Web Awesome's bindToVendoredLit binding read the same table, and the binding checks per importer that the package resolves Leaf's Lit.
  • crelt, w3c-keyname, style-mod, @floating-ui/core and @floating-ui/utils leave package.json: they were declared only so the scratch copies could resolve dependencies after the pnpm move. The lock still pins them.

Byte identity. All bundle contents are unchanged. Three chunk file names change (syntax's two shared chunks and Web Awesome's one), along with the lines importing them: esbuild's chunk hash includes input paths relative to the working directory, which was .tmp/vendor-*/ and is now the repository root (confirmed by building from a depth-2 directory, which reproduces the old names). Web Awesome's chunk also carries a theme comment that named build/vendor.py, and the two registry modules' first-line banners now name build/registry.mjs.

Key files: build/vendor.mjs (the table and adapt/seam), build/browser/build.mjs (aggregation, vendor-directory ownership), build/lit.mjs, build/registry.mjs.

Open PRs #2336 and #2249 each touch build/vendor.py (a copied scoped-registry bundle; a snapdom .patch); after this lands they port to a copy row and a patches(...) adaptation respectively.

This was written by Claude Code on behalf of max-sixty

`build/vendor.py` shelled out to esbuild once per bundle, copied patched
packages into a scratch directory, and handed a `meta.json` to
`shipped.mjs`'s CLI; five per-bundle Node scripts sat beside it, and
`check:bundles` rebuilt in place and read `git status`. It is replaced by
`build/vendor.mjs`, one table with a row per bundle, built in-process and
returned as an outputs map that `build/browser/build.mjs` writes and checks
with its own, the way it already did for the initial renderers and styles.

- `pnpm run build:browser` now rebuilds every bundle, and
  `pnpm run check:browser` (part of `pnpm run check`) compares them with
  the committed bytes without writing, so it works on an uncommitted tree.
  `check:bundles`, its CI step and its `wt merge` block are gone. The full
  build takes about 2s.
- The layer's `vendor/` and every package's `vendor/` are owned whole: a
  file there that no build writes is stale, replacing the framework-only
  directory scan and the `git status` read.
- Upstream adaptations edit modules as esbuild loads them through one
  `adapt` plugin and one `seam()` count guard, Lit's three included. The
  floating-ui `.patch` files apply in memory with jsdiff. An adaptation
  whose module no longer loads now fails the build too; nothing writes
  `node_modules` or a scratch copy.
- `build/registry.mjs` is the one generator of registry-derived runtime
  modules: `runtime/syntax-languages.js` (was in vendor.py) and
  `runtime/composing/drawing-schema.js` (was in build.mjs) are rows of one
  table. Their first-line banners now name it.
- `build/lit.mjs` declares the static-html renaming once, deriving the
  export list from `lit/static-html.js`; `lit.js` and Web Awesome's
  binding (`bindToVendoredLit`) read the same table, and the binding checks
  per importer that the package resolves Leaf's Lit.
- `shipped.mjs` loses its CLI, the only caller of which was vendor.py.
- `crelt`, `w3c-keyname`, `style-mod`, `@floating-ui/core` and
  `@floating-ui/utils` leave `package.json`: they were declared only so the
  scratch copies could resolve their dependencies after the pnpm move; the
  lock still pins them.

Bundle contents are byte-identical. Three chunk file names change
(syntax's two shared chunks, Web Awesome's one) with the files that import
them: esbuild's chunk hash includes input paths relative to the working
directory, which was `.tmp/vendor-*/` and is now the repository root. Web
Awesome's chunk also carries a theme comment that named `build/vendor.py`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 3e12682 into main Oct 12, 2026
4 checks passed
@max-sixty
max-sixty deleted the cq-one-node-builder branch October 12, 2026 02:25
max-sixty added a commit that referenced this pull request Oct 12, 2026
The site build compiles the runtime through `build/browser/build.mjs`,
which since #2460 loads `build/vendor.mjs`, `build/lit.mjs`,
`build/registry.mjs` and the bundle entries under `build/`. The
`publish-site` trigger listed two of those files by hand, so a change to
any other one reached main without republishing the site. The trigger
now names the build tree as a whole, so a new build module needs no edit
here.

Found while landing #2460 (code-quality survey, second wave).

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants