ReviewOS

home-lang/home

Port Bun Bake production builds to home build --app

#551
Closed chris opened this 9 days ago ·
9 days ago

Scope

Routing home build through the native Bun-compatible BuildCommand exposes the upstream --app production-build branch. Home has the Bake types and development-server substrate, but bake.production.buildCommand is not ported yet, so the CLI now reports this gap explicitly instead of hiding it behind the old outer build dispatcher.

Acceptance criteria

  • Port Bun's production Bake build command against Home's native runtime.
  • Support the dynamic and static production modes and their client/server build graphs.
  • Preserve the upstream import.meta.env.DEV, PROD, MODE, SSR, and STATIC defines.
  • Add focused tests for home build --app output and failure diagnostics.
  • Remove the temporary BakeProductionBuildNotImplemented boundary once production builds run.

Parent: #66 Discovered while completing: #550

9 days ago

Completed in 5d560ae27a2a189b48f47723a3628a1e02067921 (feat(runtime): enable Bake production builds).

What landed:

  • replaced Home's BakeProductionBuildNotImplemented boundary with the pinned Bun runtime/bake/production.zig pipeline;
  • ported the full Bake framework/config parser from Bun 4982b91e3702094330f3be3883354c52b8c01323, including split client/server/SSR bundler options, router styles, built-in modules, server-components settings, and production/development mode defines;
  • embedded Bun's four bun-framework-react sources;
  • connected the real framework virtual modules, route graph, client/server bundlers, server module loading, prerender callbacks, and output writer;
  • fixed the client-transpiler optional payload initialization that trapped in the Bake browser graph;
  • normalized absolute chunk destinations into dist/_bun and reject parent traversal, so client output cannot escape the production output directory;
  • allowed valid custom frameworks whose bundle has no shared runtime chunk;
  • added an end-to-end test-bake-production build step.

The integration fixture proves:

  • a static / route renders to dist/index.html;
  • a dynamic [slug] route expands through getParams() into /alpha and /beta output;
  • client assets are emitted under dist/_bun with no sibling _bun escape;
  • import.meta.env.DEV, PROD, MODE, SSR, and STATIC evaluate to the pinned Bun production-static values;
  • a missing --app config exits nonzero with the expected resolution diagnostic.

The pinned Bun production command itself selects production_static; the shared port also carries production_dynamic mode/config semantics. Live dynamic serving and HMR are tracked separately in #553.

Verification:

  • zig build test-bake-production -Denable_jsc=true -j1 ...: 18/18 steps succeeded
  • scoped native runtime suite: 1,822 passed, 19 skipped, 0 failed (20/20 build steps)
  • zig build debug -Denable_jsc=false -j1 ...: 5/5 steps succeeded
  • scoped Pickier check: clean
  • git diff --check: clean

Sign in to comment on this issue.