This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
Isaacs/links to root causing unreportable eresolve #259
Closed
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
This causes major problems when moving links and targets between trees. When we move the link from one tree to another, it pulls its target, out, meaning that the target ends up becoming orphaned. Say there is a matching link and target in two different trees, A and B, and we want to replace the link and target in one tree with the link and target in another. If we move the target A to tree B first, then it replaces the target B, and link B is updated to point to it. Then, we move link A to tree B, replacing link B. To do that, we move link B out of tree B, which _takes target B with it_, leaving the ported link A without a target in tree B.
This also corrects an issue where manually updating the package.json file would sometimes not be reified properly, if a new link target matches the one that was formerly reified.
Fixes sorting incorrectly when a dependency is set to an empty string
This is in preparation for the use case where explicitRequests includes edges from nodes other than the project root, so that we can add deps to workspaces.
This is really important for debugging when "have workspaces been loaded yet" is a relevant consideration.
This provides another fail-safe for the CLI to report _something_ useful to the user when an ERESOLVE happens, if by some brokenness in our tree handling we don't have the node in the tree somehow to provide a current or peerConflict.
nlf
approved these changes
Apr 1, 2021
fsParent: null, | ||
root: this.root, | ||
}) | ||
} |
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.
for future reviewers, this is the meat of this fix and it 100% makes sense 🎉
wraithgar
deleted the
isaacs/links-to-root-causing-unreportable-eresolve
branch
April 22, 2021 17:45
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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: npm/cli#2896
This provides the
currentEdge
as a thing that can be reported on in the CLI if somehow thecurrent
andpeerConflict
nodes aren't found.It also fixes the edge case triggered by having a dependency of
file:.
in the root node's package.json which then is in conflict with a peerDependency of another root dependency, which is that the Link creates a target with the same path as theroot
node, but which is not theroot
node, and results in some truly spectacular splintering.Based on #258.