ReviewOS

home-lang/home

Route Bun-compatible build flags through the native runtime CLI

#550
Closed chris opened this 10 days ago ·
10 days ago

Scope

Home's outer compiler dispatcher currently owns home build, so Bun-compatible JS/TS build flags such as --compile, --bytecode, --format, --outfile, and --compile-exec-argv do not reach the ported runtime BuildCommand.

The standalone runtime itself is now functional through Bun.build({ compile: ... }) after #549, including embedded bytecode cache hits, CJS/ESM loading, user argument passthrough, compile-time execArgv, and BUN_OPTIONS. This issue tracks the distinct CLI routing layer needed for the equivalent Bun command surface.

Acceptance criteria

  • JS/TS home build invocations route Bun-compatible bundler/compile flags through the native runtime build command without delegating to an external Bun binary.
  • --compile --bytecode output uses the same StandaloneModuleGraph writer and startup path as the verified Bun.build() API.
  • --compile-exec-argv, user argument passthrough, autoload flags, and BUN_BE_BUN match the pinned Bun behavior.
  • Relevant pinned Bun CLI compile tests run against Home without harness substitutions.

Parent: #66 Follow-up to: #549

10 days ago

Implemented and pushed in 2f842a7e317a352e7dc0e84a48042fd62f919065 (integrated on main by 07be01228e5d5c677475d3d4083d23d4b00a0fc6).

home build now sends JS/TS entry points through the native ported BuildCommand, including the full Bun argument parser, while .home/.hm entry points and --kernel continue through Home's compiler. Routing uses parsed entry points, so an output path such as --outfile output.home does not select the wrong compiler.

This also activated and forward-ported the required Zig 0.17 filesystem, timestamp, output-file, watch-sleep, import-meta define, and elapsed-output paths that had remained dormant behind the old dispatcher.

Verification:

  • JSC debug build: 18/18 steps succeeded.
  • Scoped home_rt suite: 1,841 total; 1,822 passed, 19 skipped, 0 failed.
  • Single-entry TS bundle executes correctly.
  • Multiple TS entry points emit through --outdir.
  • CJS and ESM --compile --bytecode executables both run with JSC disk-cache hits.
  • User argv, compile-time exec argv, and BUN_OPTIONS preserve the expected ordering.
  • Representative native flags (--target, --format, --minify, external sourcemaps, metafile, banner, footer, outfile/outdir) reach the Bun build command and emit the expected artifacts.
  • Home source still builds natively, and TypeScript can emit to an output.home filename.
  • Zig format, staged diff checks, and changed-file Pickier checks pass. The repository-wide Pickier invocation stops at its 100,000-file safety limit because generated/cache directories raise the scan to 186,102 files.

The now-visible experimental --app branch has a distinct missing production Bake implementation; tracked separately in #551 rather than leaving it implicit here.

Sign in to comment on this issue.