fix: remove implicit dependencies handling#9010
Merged
beyondkmp merged 28 commits intoelectron-userland:masterfrom Apr 10, 2025
Merged
fix: remove implicit dependencies handling#9010beyondkmp merged 28 commits intoelectron-userland:masterfrom
beyondkmp merged 28 commits intoelectron-userland:masterfrom
Conversation
🦋 Changeset detectedLatest commit: c52f08b The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
… and NpmNodeModulesCollector
Contributor
Author
|
The HoistedNodeModuleTest did not run, and there are several others under this category that were also skipped. This might be caused by issues with parallel testing. @mmaietta When you have time, could you help take a look at this? |
…lector and PnpmNodeModulesCollector
beyondkmp
commented
Apr 8, 2025
1fb9db1 to
212eba2
Compare
mmaietta
reviewed
Apr 8, 2025
…dd it back in PnpmNodeModulesCollector
mmaietta
reviewed
Apr 10, 2025
Collaborator
|
Fantastic work on this PR! |
mmaietta
approved these changes
Apr 10, 2025
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.
fix #9000 and #9006
Root Cause
It directly copies
node_modulesinto the app directory and removesdevDependenciesfrompackage.json. This way,npm listcan retrieve all dependencies. However, during the lookup process, if there are duplicate dependency packages, somedependenciesinnpmmay be empty. A previous fix(#8864 ) introduced the concept ofimplicit dependenciesto address this issue, but it only handled the first level ofimplicit dependencies. Ifimplicit dependenciesthemselves contain furtherimplicit dependencies, the problem described in #9000 will occur.How to fix
The current approach directly searches the
parsedTreeand updates the globalthis.productionGraph. If there are cases wheredependenciesare empty, it retrieves the same dependency fromallDependenciesand performs a lookup for sub-dependencies. If the dependency already exists inthis.productionGraph, no further lookup is performed. Additionally, to prevent infinite loops, an empty array is set before searching for sub-dependencies.Now that two tree lookup has been eliminated, there will be a certain improvement in performance.