module: use cjsCache over esm injection#34605
Closed
guybedford wants to merge 3 commits intonodejs:masterfrom
Closed
module: use cjsCache over esm injection#34605guybedford wants to merge 3 commits intonodejs:masterfrom
guybedford wants to merge 3 commits intonodejs:masterfrom
Conversation
Collaborator
Contributor
Author
|
//cc @nodejs/modules-active-members |
Member
|
You could also do a weakmap from the |
Contributor
Author
|
That's a great way to work around the GC issue! I've pushed that up in the latest commit, which should avoid the problem entirely, thanks. |
bmeck
approved these changes
Aug 5, 2020
aduh95
reviewed
Aug 8, 2020
Co-authored-by: Antoine du Hamel <[email protected]>
Collaborator
Contributor
Author
|
I'd like to merge this tomorrow, it would be great to get a few more approvals if possible. |
Trott
approved these changes
Aug 9, 2020
Trott
pushed a commit
that referenced
this pull request
Aug 9, 2020
PR-URL: #34605 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Member
|
Landed in 0f4b4ea |
MylesBorins
pushed a commit
that referenced
this pull request
Aug 17, 2020
PR-URL: #34605 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Merged
BethGriggs
pushed a commit
that referenced
this pull request
Aug 20, 2020
PR-URL: #34605 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Rich Trott <[email protected]>
guybedford
added a commit
to guybedford/node
that referenced
this pull request
Sep 28, 2020
PR-URL: nodejs#34605 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Rich Trott <[email protected]>
codebytere
pushed a commit
that referenced
this pull request
Oct 1, 2020
PR-URL: #34605 Backport-PR-URL: #35385 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Merged
joyeecheung
added a commit
to joyeecheung/node
that referenced
this pull request
Dec 14, 2023
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after nodejs#34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module.
joyeecheung
added a commit
to joyeecheung/node
that referenced
this pull request
Dec 14, 2023
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after nodejs#34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module.
joyeecheung
added a commit
to joyeecheung/node
that referenced
this pull request
Dec 15, 2023
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after nodejs#34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module.
jasnell
pushed a commit
that referenced
this pull request
Dec 22, 2023
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after #34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module. PR-URL: #51157 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
RafaelGSS
pushed a commit
that referenced
this pull request
Jan 2, 2024
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after #34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module. PR-URL: #51157 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
richardlau
pushed a commit
that referenced
this pull request
Mar 25, 2024
This puts it together with the cjsParseCache and reduces the circular dependency on the singleton loader, which is the only place where this cache is stored. Drive-by: remove always-false module status check because there's no longer a local module variable after #34605 which is now invalid leftover code at this point and only doesn't throw because we happen to have a top-level variable called module. PR-URL: #51157 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
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.
This is the replacement for #34467 as an alternative mechanism to ensure that named exports loaders (such as https://github.com/guybedford/cjs-named-exports-loader) are fully possible without issues. Without this PR such loaders cannot work for CJS loaded via
require()before it is loaded viaimport().As discussed, this PR retains the existing CJS snapshotting behaviour so that the
module.exportsvalue is captured for all CommonJS modules and stored in theESMLoader.cjsCachemap. This map is changed to be a weakmap keyed by the module object so that deletions inModule._cacheallow this map to be GC'd.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes