Bun DCE Feature-Gate Pattern
- Entity ID:
ent-20260419-d6199e5d5b35 - Type:
concept - Scope:
shared - Status:
active - Aliases: Bun dead-code elimination, compile-time feature strip
Description
Architectural pattern: entire subsystems are gated by compile-time constants that Bun's dead-code elimination then strips from the public binary. Public builds retain only type signatures and call sites; full implementations (KAIROS, BUDDY) live only in internal builds. Root cause of what public-source analyses can and cannot see.
Key claims
- Public-binary analysis misses compile-time-stripped subsystems
- Compile-time vs runtime flag asymmetry creates unlock topology
- Claude Code shipped depending on Bun's bundler for compile-time feature stripping
- Production bundle inlines USER_TYPE='external' to DCE internal branches
- .js extensions on .ts imports is a Bun convention
Relations
- Bun DCE Feature-Gate Pattern --[depends_on]--> Bun Runtime
- bun:bundle Runtime Shim --[replaces]--> Bun DCE Feature-Gate Pattern
- Claude Code Feature Flag Catalog --[implements]--> Bun DCE Feature-Gate Pattern
- scripts/build-bundle.ts (esbuild Production Config) --[informed_by]--> Bun DCE Feature-Gate Pattern