-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
module: handle null source from async loader hooks in sync hooks #59929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Review requested:
|
db791a0
to
64e35a5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59929 +/- ##
=======================================
Coverage 88.55% 88.55%
=======================================
Files 704 704
Lines 208081 208127 +46
Branches 40004 40022 +18
=======================================
+ Hits 184265 184310 +45
- Misses 15809 15827 +18
+ Partials 8007 7990 -17
🚀 New features to boost your workflow:
|
64e35a5
to
ea58659
Compare
This is necessary to fix known issues with sync/async loader hook interop. Can I get some reviews please? @nodejs/loaders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I've always disliked this “null means this“ pattern and at least this makes it clearer and more explicit. Maybe when we remove the async hooks we can get rid of this pattern.
ea58659
to
6ea04e7
Compare
This relaxes the validation in sync hooks so that it accepts the quirky nullish source returned by the default step of the async loader when the module being loaded is CommonJS. When there are no customization hooks registered, a saner synchronous default load step is used to use a property instead of a reset nullish source to signify that the module should go through the CJS monkey patching routes and reduce excessive reloading from disk.
6ea04e7
to
b5663af
Compare
b5663af
to
790b5f4
Compare
Addressed the comments and CI is finally green. Can you take a look again? Thanks! @GeoffreyBooth @JakobJingleheimer |
Landed in 170848b |
This relaxes the validation in sync hooks so that it accepts the quirky nullish source returned by the default step of the async loader when the module being loaded is CommonJS. When there are no customization hooks registered, a saner synchronous default load step is used to use a property instead of a reset nullish source to signify that the module should go through the CJS monkey patching routes and reduce excessive reloading from disk.
Fixes: #59384
Fixes: #57327
Refs: #59666
Refs: https://github.com/dygabo/load_module_test