Files
bun.sh/test-lib.js
Sosuke Suzuki 1edbed8da4 Add ESM bytecode cache deserialization and validation
Implement deserialization functions to restore module metadata from
binary cache format. This completes the second phase of the ESM
bytecode caching feature.

Changes:
- Add deserializeCachedModuleMetadata() in ZigSourceProvider.cpp
  - Reads BMES binary format
  - Extracts requested modules, imports, exports, star exports
  - Returns DeserializedModuleMetadata structure with bytecode pointer
- Add validateCachedModuleMetadata() for cache validation
  - Checks magic number (0x424D4553 "BMES")
  - Checks version compatibility (currently v1)
- Add Zig binding validateMetadata() in CachedBytecode.zig
- Create test-cache-roundtrip.js for round-trip testing
- Update documentation with progress

Implementation status:
- Phase 1 (Serialization): 100% 
- Phase 2 (Deserialization): 90% 
- Phase 3 (Integration): 0% 

Next steps:
- JSModuleRecord reconstruction from metadata
- ModuleLoader integration
- Cache storage implementation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 02:25:44 +00:00

6 lines
126 B
JavaScript

// Test library for ESM cache
export const greeting = "Hello from cached ESM!";
export function add(a, b) {
return a + b;
}