[codex] Prehash resolver path dependencies by hardfist · Pull Request #206 · rstackjs/rspack-resolver · GitHub
Skip to content

[codex] Prehash resolver path dependencies#206

Draft
hardfist wants to merge 4 commits into
mainfrom
codex/prehash-path-dependencies
Draft

[codex] Prehash resolver path dependencies#206
hardfist wants to merge 4 commits into
mainfrom
codex/prehash-path-dependencies

Conversation

@hardfist

@hardfist hardfist commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add PathDependency and ResolvePreHashedContext so callers can consume resolver dependency paths with their precomputed path hash.
  • Reuse the same path hashing helper for the internal path cache and expose the identity hasher needed by the prehashed dependency set.
  • Short-circuit cached path equality by checking the precomputed hash before comparing full paths.
  • Cache each cached directory's package.json path so repeated package-json lookups and dependency recording can reuse the joined path.
  • Clean up the dependency tests so the normal and prehashed dependency expectations share the same collected sets.

Why

Rspack build_module_graph path dependency handling currently hashes dependency paths in the resolver context and then hashes the same paths again when converting them into Rspack prehashed ArcPath sets. This API lets Rspack reuse the resolver-side hash instead of paying for another full Path hash during that conversion.

Validation

  • cargo fmt --check
  • cargo check
  • cargo test tests::dependencies --lib
  • cargo clippy --lib -- -D warnings
  • cargo test package_json
  • Full cargo test was also attempted earlier; 124 tests passed and 6 existing PnP fixture tests failed with NotFound(...), which appears unrelated to this change.

@codspeed-hq

codspeed-hq Bot commented May 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant