Skip to content

v0.4.0 — code-split bundle support

Choose a tag to compare

@anfreire anfreire released this 25 Aug 02:21
· 14 commits to main since this release

Claude Code 2.1.242 turned on Bun code-splitting: the binary's entrypoint went from carrying the whole ~28 MB app to a ~20 KB argv shim that lazily imports the app across ~1,300 chunk-*.js modules. patch-cc assumed the patchable surface was that one entrypoint module, so on 2.1.242 and 2.1.243 twelve of thirteen patches matched nothing (only --version marking survived). This release fixes that.

What changed

  • The patchable surface is now every JavaScript module the binary declares, discovered off the entrypoint's own loader — not just the entrypoint. find/apply span every module, each edit routes to the module it came from, and a pre-split build is simply the one-module case of the same code. No new behaviour to configure.
  • The syntax gate reads past module-linkage the JS grammar can't model (reserved words as import/export aliases, which the split minifier emits) while still catching any splice that breaks real code.
  • A patched binary is smaller by exactly the modules it changed — the stale bytecode of edited modules is dropped, the rest keeps its fast start (83 MB smaller on 2.1.243).

Compatibility

Fully transparent. Pre-split builds (2.1.241 and earlier) patch byte-identically to before; 2.1.242+ now patch cleanly. If Claude auto-updated you onto 2.1.242 or 2.1.243 and your patches vanished, re-run patch-cc (or patch-cc apply --from-cache).

Validated

patch-cc doctor is green across the whole 2.1.210 → 2.1.243 backup corpus, and a real 2.1.243 apply lands all 13 patches, boots, and runs the edited source.

uvx patch-cc            # or: uv tool install patch-cc && patch-cc