-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: newrelic/node-newrelic#1920 <strike>👋 my last "fix" (#43) broke in a new way thanks to the helpful ESM allowance of exporting `default` multiple times. This PR resolves the issue. I suspect there could be further problems with the exports since I have no idea how exporting `default` multiple times is meant to be interpreted, but I suspect any such issues will be an extreme edge case. The only other thing I can think of to do here is to somehow track that we already have a `default` export and munge the names of any subsequent ones.</strike> ----- I have since learned that ESM doesn't actually allow exporting `default` multiple times. Transitive `default` exports get mapped to some other name for the module that has imported them, and only the directly imported `default` gets exported. Still, we have to handle figuring out which `default` is the right one and construct our shim namespace accordingly. ----- 2023-01-03: this can only be supported on Node versions where we parse the modules with an AST parser and interpret the code manually. So I have updated the test suite for this feature to only run on such versions. --------- Co-authored-by: James Sumners <[email protected]>
- Loading branch information
1 parent
8066c39
commit 3a3cd49
Showing
12 changed files
with
279 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default class DefaultClass { | ||
value = 'DefaultClass' | ||
} |
Oops, something went wrong.