mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
## Summary During `yarn.lock` migration, OS/CPU package metadata was not being fetched from the npm registry when missing from `yarn.lock`. This caused packages with platform-specific requirements to not be properly marked, potentially leading to incorrect package installation behavior. ## Changes Updated `fetchNecessaryPackageMetadataAfterYarnOrPnpmMigration` to conditionally fetch OS/CPU metadata: - **For yarn.lock migration**: Fetches OS/CPU metadata from npm registry when not present in yarn.lock (`update_os_cpu = true`) - **For pnpm-lock.yaml migration**: Skips OS/CPU fetching since pnpm-lock.yaml already includes this data (`update_os_cpu = false`) ### Files Modified - `src/install/lockfile.zig` - Added comptime `update_os_cpu` parameter and conditional logic to fetch OS/CPU metadata - `src/install/yarn.zig` - Pass `true` to enable OS/CPU fetching for yarn migrations - `src/install/pnpm.zig` - Pass `false` to skip OS/CPU fetching for pnpm migrations (already parsed from lockfile) ## Why This Approach - `yarn.lock` format often doesn't include OS/CPU constraints, requiring us to fetch from npm registry - `pnpm-lock.yaml` already parses OS/CPU during migration (lines 618-621 in pnpm.zig), making additional fetching redundant - Using a comptime parameter allows the compiler to optimize away the unused code path ## Testing - ✅ Debug build compiles successfully - Tested that the function correctly updates `pkg_meta.os` and `pkg_meta.arch` only when: - `update_os_cpu` is `true` (yarn migration) - Current values are `.all` (not already set) - Package metadata is available from npm registry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>