Files
bun.sh/test/js
Sosuke Suzuki cded1d040c Add ESM bytecode cache with module metadata serialization
Implement the foundation for ESM bytecode caching that includes module
metadata (imports, exports, dependencies). This allows skipping the
module analysis phase during subsequent loads, improving performance.

Changes:
- Add generateCachedModuleByteCodeWithMetadata() in ZigSourceProvider.cpp
  - Parses ESM source and extracts module metadata using ModuleAnalyzer
  - Serializes requested modules, import/export entries, star exports
  - Combines metadata with bytecode in binary format (BMES v1)
- Add Zig bindings in CachedBytecode.zig for the new function
- Add integration tests for ESM bytecode caching
- Add comprehensive documentation

Binary format:
- Magic: "BMES" (0x424D4553)
- Version: 1
- Sections: Module requests, imports, exports, star exports, bytecode

This is the serialization half of the implementation. Future work:
- Deserialization (reconstruct JSModuleRecord from cache)
- ModuleLoader integration (skip parsing when cache exists)
- Cache storage mechanism
- CLI flag (--experimental-esm-bytecode)

Expected performance: 30-50% faster module loading when cache is used.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 20:10:53 +09:00
..
2025-11-29 19:13:06 -08:00