Repository navigation
Conversation
Determining the format of a `.js` or `.ts` module called `getPackageScopeConfig()`, which spread the deserialized package configuration and thereby invoked its lazy `exports` and `imports` getters. Every resolved module parsed those maps again, so load time and memory grew with the number of modules in a package times the size of its `exports` map. Use `getPackageType()` for format detection and only look up the package.json path when warning about a typeless package. Stop spreading the configuration in `getPackageScopeConfig()` so that the maps are parsed only when accessed. Fixes: nodejs#66485 Signed-off-by: Gürgün Dayıoğlu <[email protected]>
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66982 +/- ##
==========================================
- Coverage 92.93% 90.59% -2.35%
==========================================
Files 428 797 +369
Lines 195236 278301 +83065
Branches 30176 53520 +23344
==========================================
+ Hits 181442 252115 +70673
- Misses 13467 16556 +3089
- Partials 327 9630 +9303
🚀 New features to boost your workflow:
|
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.
Determining the format of a
.jsor.tsmodule callsgetPackageScopeConfig(), which spreads the deserialized package configuration and therefore invokes its lazyexportsandimportsgettersEvery resolved module parses those maps again so load time and memory grows with the number of modules in a package times the size of its
exportsmapInstead of crating yet another cache, use
getPackageType()for format detection and only look up the package.json path when warning about a typeless package91c4436Both date-fns and drizzle-orm are affected by this and should improve the same way
Supersedes #65812 and fixes #66485