Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prune): fix Yarn1 entries getting merged erroneously #9627

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

chris-olszewski
Copy link
Member

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 in string-width-cjs@npm:[email protected] and [email protected] getting collapsed as they have identical data:

 version "4.2.0"
  resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5"
  integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==
  dependencies:
    emoji-regex "^8.0.0"
    is-fullwidth-code-point "^3.0.0"
    strip-ansi "^6.0.0"

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.

Copy link

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 11:34pm

@chris-olszewski chris-olszewski merged commit 02ac381 into main Jan 2, 2025
36 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/fix_gh_8849 branch January 2, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turbo prune does not respect yarn v1 lock file protocols split entries
2 participants