Skip to content

feat: add export replacement capabilities to hooks - #292

Draft
BridgeAR wants to merge 2 commits into
mainfrom
BridgeAR/2026-09-09-iitm-export-capability
Draft

feat: add export replacement capabilities to hooks#292
BridgeAR wants to merge 2 commits into
mainfrom
BridgeAR/2026-09-09-iitm-export-capability

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Sep 9, 2026

Copy link
Copy Markdown
Member

Hooks that only mutate nested module values currently force IITM to create and synchronize a local cell for every export. This breaks delayed live bindings such as class Sub extends Late and adds startup work for export-heavy ESM modules.

This adds replaceExports: omitted keeps wildcard legacy behavior, an empty list preserves source live bindings, and named entries limit replacement to those bindings. The empty-list ESM fast path uses native re-exports and avoids per-export wrapper state; on 40 ESM modules with 251 exports it reduced import time 61–64% with sync hooks and 48–51% with async hooks across repeated trimmed trials. CommonJS, builtins, and named replacement sets retain the existing compatibility path.

Refs: #280

Hooks that only mutate nested module values currently force IITM to create and synchronize a local cell for every export. This breaks delayed live bindings such as `class Sub extends Late` and adds startup work for export-heavy ESM modules.

This adds `replaceExports`: omitted keeps wildcard legacy behavior, an empty list preserves source live bindings, and named entries limit replacement to those bindings. The empty-list ESM fast path uses native re-exports and avoids per-export wrapper state; on 40 ESM modules with 251 exports it reduced import time 61–64% with sync hooks and 48–51% with async hooks across repeated trimmed trials. CommonJS, builtins, and named replacement sets retain the existing compatibility path.

Refs: #280
Node can expose CommonJS properties that are absent from a builtin's fixed ESM facade. Derived re-exports then fail during wrapper instantiation.

A distinct wrapper URL keeps native passthrough bindings live without resolving them back to the wrapper.
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