turbopack: use reverse postorder priority in collect_graph (#100429)
## Summary
`collect_graph` computes per-module entry membership with the same
fixed-point traversal and BFS-depth priority as
`compute_chunk_group_info`. This PR switches it to the reverse-postorder
rank added in the PR below. That removes its own BFS depth pass, and a
module is now visited only after all of its importers (except across
cycles).
`TraversalPriority` has no remaining users, so it is removed.
Stacked on #100428, which introduces
`ModuleGraphSnapshot::reverse_postorder_ranks`.
### Benchmarks
**Setup:**
- Same as the PR below: Turbopack `next build --experimental-build-mode
compile`.
- `next-swc` release builds (LTO disabled, 16 codegen units).
- Binaries interleaved per run, 3 runs each, clean `.next`.
- Time is the depth or rank pass plus the fixed-point traversal,
measured with local-only instrumentation. Values are medians with
min–max ranges.
- "Before" is the PR below, which already includes its entry
deduplication.
| app | before | after |
|---|---|---|
| generated app router app (300 routes, ~12k modules) | 14.5 ms
(14.4–16.5), 12,030 visits | **9.5 ms** (8.3–11.0), 11,938 visits |
| `bench/nested-deps-app-router-many-pages` (~31k modules) | 422 ms
(417–426), 30,869 visits | **197 ms** (193–205), 30,777 visits |
For reference, `collect_graph` on many-pages takes 534 ms (496–546) on
canary.
## Verification
- `cargo test -p turbopack-core --lib`
- `cargo test -p turbopack-tests --test snapshot`: passes with no
snapshot changes.
- `cargo test -p turbopack-tests --test execution -- collect`
(emit/collect execution tests).
<!-- NEXT_JS_LLM -->
<!-- fleet b56269ed-2145-4f30-b0fe-dc9762520521 -->
Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>