fix(interopDefault): skip bind for Symbol.dispose/asyncDispose#444
Open
ruguoba wants to merge 2 commits into
Open
fix(interopDefault): skip bind for Symbol.dispose/asyncDispose#444ruguoba wants to merge 2 commits into
ruguoba wants to merge 2 commits into
Conversation
V8 rejects binding well-known disposal symbols (Symbol.dispose and Symbol.asyncDispose) used by the Explicit Resource Management proposal. This causes errors when interopDefault proxy intercepts access to these symbols on module exports in Node.js 24+ with using/await using syntax. Fixes unjs#441
1.Refactor method binding logic in the interopDefault function: create wrapper functions for Symbol.dispose and Symbol.asyncDispose instead of direct binding 2.Add test cases for the Explicit Resource Management proposal to verify correct default export receiver behavior 3.Format the test matching path array in the Vitest configuration file for improved readability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
V8 rejects binding well-known disposal symbols (
Symbol.disposeandSymbol.asyncDispose) used by the TC39 Explicit Resource Management proposal. This causes errors wheninteropDefaultproxy intercepts access to these symbols on module exports in Node.js 24+ withrequire(esm)syntax.Fixes #441
Solution
Added a check in
interopDefaultto skipReflect.bindforSymbol.disposeandSymbol.asyncDispose, since V8 does not allow binding these well-known symbols.Testing
explicit-resource-managementfixture test passes successfullyRelated