Skip to content

Implement import-bytes module support#2315

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:import-bytes
Mar 6, 2026
Merged

Implement import-bytes module support#2315
lahma merged 1 commit into
sebastienros:mainfrom
lahma:import-bytes

Conversation

@lahma

@lahma lahma commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implement the TC39 import-bytes proposal enabling import data from './file.bin' with { type: 'bytes' } which returns an immutable Uint8Array
  • Add IsBytesModule() extension, BuildBytesModule() factory, and LoadModuleContentsAsBytes() virtual method in the module loading pipeline
  • Override binary loading in DefaultModuleLoader (File.ReadAllBytes) and Test262ModuleLoader (Zio stream)
  • Remove import-bytes from excluded test262 features — all 5 test cases pass
  • Update README with new feature entry

Test plan

  • All 5 import-bytes test262 tests pass (txt, js, json, png, empty)
  • Full test262 suite: 92,215 passed, 0 failures
  • Main test suite: 2,756 passed, 0 failures

🤖 Generated with Claude Code

Add support for the TC39 import-bytes proposal which enables importing
binary files as immutable Uint8Array via import attributes:
`import data from './file.bin' with { type: 'bytes' }`

Extends the module loading pipeline with LoadModuleContentsAsBytes()
virtual method and BuildBytesModule() factory for creating synthetic
modules backed by immutable ArrayBuffers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lahma
lahma enabled auto-merge (squash) March 6, 2026 15:08
@lahma
lahma merged commit 68e89d6 into sebastienros:main Mar 6, 2026
4 checks passed
@lahma
lahma deleted the import-bytes branch March 6, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant