-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[Backport v14.x] module: add isPreloading indicator #36988
Closed
aduh95
wants to merge
2
commits into
nodejs:v14.x-staging
from
aduh95:backport-module.isPreloading-v14
Closed
[Backport v14.x] module: add isPreloading indicator #36988
aduh95
wants to merge
2
commits into
nodejs:v14.x-staging
from
aduh95:backport-module.isPreloading-v14
Conversation
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
Adds a `module.isPreloading` property that is `true` only during the preload (`-r`) phase of Node.js bootstrap. This provides modules an easy, non-hacky way of knowing if they are being loaded during preload. Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#36263 Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Fixes: nodejs#36775 PR-URL: nodejs#36944 Refs: nodejs#36263 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: James M Snell <[email protected]>
aduh95
added
module
Issues and PRs related to the module subsystem.
semver-minor
PRs that contain new features and should be released in the next minor version.
v14.x
labels
Jan 18, 2021
jasnell
approved these changes
Jan 18, 2021
ExE-Boss
reviewed
Jan 21, 2021
Comment on lines
+223
to
+225
ObjectDefineProperty(Module.prototype, 'isPreloading', { | ||
get() { return isPreloading; } | ||
}); |
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.
It might be a good idea to also backport NativeModule.prototype.isPreloading
:
node/lib/internal/modules/cjs/loader.js
Lines 236 to 238 in e279304
const isPreloadingDesc = { get() { return isPreloading; } }; | |
ObjectDefineProperty(Module.prototype, 'isPreloading', isPreloadingDesc); | |
ObjectDefineProperty(NativeModule.prototype, 'isPreloading', isPreloadingDesc); |
BethGriggs
force-pushed
the
v14.x-staging
branch
from
January 28, 2021 18:10
98f6155
to
9ff73fc
Compare
MylesBorins
force-pushed
the
v14.x-staging
branch
from
April 6, 2021 19:54
11505ad
to
6b115d7
Compare
targos
approved these changes
Apr 24, 2021
targos
pushed a commit
that referenced
this pull request
Apr 25, 2021
Adds a `module.isPreloading` property that is `true` only during the preload (`-r`) phase of Node.js bootstrap. This provides modules an easy, non-hacky way of knowing if they are being loaded during preload. Signed-off-by: James M Snell <[email protected]> PR-URL: #36263 Backport-PR-URL: #36988 Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Rich Trott <[email protected]>
targos
pushed a commit
that referenced
this pull request
Apr 25, 2021
Fixes: #36775 PR-URL: #36944 Backport-PR-URL: #36988 Refs: #36263 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in 36abc18...7c9f3a9 |
This was referenced Jan 13, 2023
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
module
Issues and PRs related to the module subsystem.
semver-minor
PRs that contain new features and should be released in the next minor version.
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.
Backport of #36263 and #36944.
Note that #36944 hasn't been released on a Current line for two weeks, but fixes a documentation bug which should land alongside #36263 IMHO.