Adds support for package map generation#7184
Merged
Merged
Conversation
|
Does this mean in the future custom .pnp loader will not be necessary? I guess the only missing bit would be loading files from zip archives |
Member
Author
|
Yes, that's what I want to reach. Archived packages are an issue, but we could have a mode where Yarn installs packages in a global store on disk (unpacked). It would have some drawbacks, but the compatibility would still go way up. |
This was referenced Jun 15, 2026
arcanis
added a commit
to yarnpkg/zpm
that referenced
this pull request
Jun 22, 2026
Counterpart of yarnpkg/berry#7184 for the Rust implementation. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches install linking, generated artifacts, and `NODE_OPTIONS` for all scripts; behavior changes module resolution when package maps are enabled, though defaults keep the feature off. > > **Overview** > Adds **Node.js experimental package map** support for `nodeLinker: node-modules` and `nodeLinker: pnpm` (Rust zpm counterpart to Berry #7184). > > New settings **`nodeExperimentalPackageMap`** (inject `--experimental-package-map=…` into `NODE_OPTIONS` when enabled) and **`nodePackageMapType`** (`standard` vs `loose` dependency edges). During link, the **node-modules** and **pnpm** linkers build and write **`node_modules/.package-map.json`** (per-workspace for node-modules islands), tracking installed layout and declared vs hoisted dependencies. **`script` environments** refresh/strip package-map flags alongside PnP loaders, using island-aware map paths when cwd is in a node-modules island. > > Supporting changes: new **`linker/package_map`** module, **`Project::package_map_path`**, PnP linker cleanup removes stale maps, **`Path::without_trailing_separators`**, and acceptance tests for maps, loose mode, and island injection. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 889778e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements support for generating package maps.
Checklist