This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install: track bundled dependencies in context
Fixes #7552. The npm@<3 installer uses an elaborate data tree built in-memory as the install process runs to track which dependencies have already been seen in the tree. This allows the installer to determine whether a parent dependency satisfies the current semver requirement. However, if one version of a dependency is specified at one level of the tree, and then a child of that level includes that same dependency bundled at a different version, and one of *that dependency's* children depends on this same dependency at yet another version, it will end up matching against the version _above_ the bundled dependency. This can lead anyone trying to figure out what's going on into a phantasmagorical wonderland where nothing is real, and can also produce an inconsistent installed tree. The solution is to ensure that the bundled dependency versions are added to the tree, but in order to do this, we need to know exactly which version got bundled. This requires a call to readInstalled, because the version that was bundled isn't included anywhere in the package metadata. Since readInstalled is slow, installMany will only call it if it knows there are bundledDependencies for the current package.
- Loading branch information
Showing
1 changed file
with
76 additions
and
42 deletions.
There are no files selected for viewing
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