Commit d1833fa
authored
fix: Use BTreeMap for bundled_deps in bun PackageIndex (#12266)
## Summary
- Switches `bundled_deps` in `PackageIndex` from `HashMap` to `BTreeMap`
for deterministic iteration order in `find_package()`
## Context
Follow-up to #12254. `find_package()` iterates `bundled_deps` and
returns the first match when a package isn't found via workspace-scoped
or top-level lookups. With `HashMap`, the per-process random seed
produces different iteration orders across `turbo` invocations, making
the result non-deterministic when multiple parents bundle the same
dependency name.
This is unlikely to trigger in practice (bundled deps are rare, and
having the same dep bundled by multiple parents is rarer), but it closes
the last remaining `HashMap` iteration on a hash-affecting code path
across all five lockfile implementations.
No performance impact — `bundled_deps` is almost always empty.
Closes #122521 parent 29bf4a5 commit d1833fa
2 files changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | | - | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
0 commit comments