fix(prune): fix Yarn1 entries getting merged erroneously #9627
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.
Description
Fixes #8849
This is a port of yarnpkg/yarn#9023 our codebase.
Previously, Yarn would collapse all identical entries to share a slot in the lockfile with the keys joined by
,
e.g.next@latest, [email protected]
. We copied that logic which resulted instring-width-cjs@npm:[email protected]
and[email protected]
getting collapsed as they have identical data:This behavior was altered in the PR linked above where now it will no longer group keys for identical entries if they have different package names in the keys. So since
string-width-cjs != string-width
these will have separate slots.This PR intentionally isn't super Rust-y so we're able to better update our behavior to match Yarn in case we need to update.
Testing Instructions
Added a unit test from reproduction to ensure that we no longer merge the problematic entries.