这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(bun): deserialize correctly and use optionalPeers #10219

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

Merged

Conversation

camero2734
Copy link
Contributor

@camero2734 camero2734 commented Mar 22, 2025

Description

Resolves #9058 and #7456 (again)

When I tested my previous PR (#10175) on another repo, I discovered an issue with a missing dep in the pruned lockfile

To reproduce this in the with-yarn example repo:
cd apps/web && bun install dd-trace
and
cd apps/docs && bun install @opentelemtry/api

Then run prune for web and try bun install --frozen-lockfile and you'll get this:

error: Failed to resolve peer dependency '@opentelemetry/api' for package '@opentelemetry/core'
    at bun.lock:1:16974
InvalidPackageInfo: failed to parse lockfile: 'bun.lock'

Issue 1 -- Deserialization casing

The underlying error is rather straightforward -- it was deserializing most dependencies (peerDependencies, devDependencies, optionalDependencies) to other 😄
image

This is because it just needed #[serde(rename_all = "camelCase")] since the rust names are snake case. This is why dependencies happened to work -- it's the same in snake and camel case.

By virtue of being in other, all non-dependencies packages were effectively ignored during the pruning process, and don't always end up in the resulting lockfile.

Issue 2 -- optionalPeers

After fixing that, I also stumbled upon another issue:

WARNING  Unable to calculate transitive closures: No lockfile entry found for 'next/@playwright/test'

This is because we weren't accounting for the optionalPeers property. next doesn't actually require you have @playwright/test, it's an optional peer. I fixed this as well.

@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Mar 22, 2025
Copy link

vercel bot commented Mar 22, 2025

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 Mar 31, 2025 0:34am
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 0:34am

Copy link

vercel bot commented Mar 22, 2025

@camero2734 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great find! Thank you for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Prune is not supported for Bun" message when trying to generate files for Docker
2 participants