fix: Preserve `file:` and `link:` protocol entries in pruned bun lockfile (#12076)
## Summary
- Fixes `turbo prune` corrupting `bun.lock` entries for `file:` and
`link:` protocol dependencies by writing them as 4-element npm-style
arrays instead of their correct 2-element format
Closes #11701
## Root Cause
`write_packages()` in the bun lockfile encoder only had special handling
for workspace packages (2-element) and git/github packages (3-element).
Everything else fell through to the npm registry path which
unconditionally writes 4-element arrays `[ident, registry, info,
checksum]`. For `file:`, `link:`, and `tarball` packages — which should
be 2-element arrays `[ident, info]` — this inserted empty strings for
the missing `registry` and `checksum` fields, producing entries like:
```
["@api/sdk@file:path", "", { deps }, ""]
```
This caused `bun install --frozen-lockfile` to fail with `error:
Expected an object` on pruned lockfiles.
## Testing
To verify the fix, a reviewer can:
1. Run `cargo test -p turborepo-lockfiles --lib bun::` — all 67 tests
pass, including the two new regression tests
(`test_file_protocol_roundtrip` and `test_link_protocol_roundtrip`)
2. The `lockfile-tests/fixtures/bun-file-dep/` fixture exercises the
full prune + frozen-install flow with a `file:` dependency