Skip to content

feat: add .pnp.cjs to file dependencies on PnP load#193

Merged
stormslowly merged 2 commits into
mainfrom
feat/pnp-file-dependencies
Apr 3, 2026
Merged

feat: add .pnp.cjs to file dependencies on PnP load#193
stormslowly merged 2 commits into
mainfrom
feat/pnp-file-dependencies

Conversation

@stormslowly
Copy link
Copy Markdown
Collaborator

Summary

  • When Yarn PnP is enabled and .pnp.cjs is successfully loaded, record its path in ResolveContext.file_dependencies
  • Store the manifest path alongside the parsed manifest in the cache ((PathBuf, pnp::Manifest) tuple) so the path is available on subsequent cached lookups
  • Add test pnp_file_dependencies verifying .pnp.cjs appears in file dependencies after resolving a PnP package

Test plan

  • cargo test pnp — all 8 PnP tests pass
  • cargo test — full test suite passes (130 tests)
  • Pre-commit hooks (fmt + clippy) pass

When Yarn PnP is enabled and the .pnp.cjs manifest is successfully
loaded, record its path in the resolve context's file_dependencies.
This allows build tools to watch the manifest for changes and
invalidate cached resolutions accordingly.
Copilot AI review requested due to automatic review settings April 2, 2026 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Yarn Plug’n’Play (PnP) resolution tracking by ensuring the loaded .pnp.cjs manifest path is recorded in ResolveContext.file_dependencies, including when the manifest is reused from the resolver’s internal cache.

Changes:

  • Cache the PnP manifest together with its filesystem path ((PathBuf, pnp::Manifest)) so the path is available on subsequent cached lookups.
  • Add the .pnp.cjs manifest path to ResolveContext.file_dependencies when PnP is used during resolution.
  • Add a regression test verifying .pnp.cjs appears in file dependencies after resolving a PnP package.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/lib.rs Store manifest path alongside manifest and record .pnp.cjs as a file dependency during PnP resolution.
src/tests/pnp.rs Add pnp_file_dependencies test covering .pnp.cjs dependency recording via resolve_with_context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 2, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing feat/pnp-file-dependencies (3136d33) with main (1970f68)

Open in CodSpeed

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stormslowly stormslowly merged commit 2d2ebf0 into main Apr 3, 2026
21 checks passed
@stormslowly stormslowly deleted the feat/pnp-file-dependencies branch April 3, 2026 02:41
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.

3 participants