Repository navigation
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 <[email protected]>
ReDrUm
pushed a commit
to ReDrUm/yarn-berry
that referenced
this pull request
Jul 10, 2026
This PR implements support for generating [package maps](https://nodejs.org/download/nightly//v27.0.0-nightly202606134383f67279/docs/api/packages.html#package-maps). ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
3 tasks done
theKashey
reviewed
Jul 15, 2026
| const packageLocations = packageLocationsByNodeModulesPath.get(nodeModulesPath); | ||
|
|
||
| if (typeof packageLocations !== `undefined`) { | ||
| for (const [dependencyName, dependencyLocation] of Array.from(packageLocations).sort(([a], [b]) => compareStrings(a, b))) { |
Contributor
There was a problem hiding this comment.
π Sorry for jumping into merged PR, but is this operation necessary?
For us it takes about 50s
Please see #7223 as potential solution.
pull Bot
pushed a commit
to Hawthorne001/berry
that referenced
this pull request
Jul 17, 2026
## What's the problem this PR addresses? Our tools detected a significant perf regression after updating from 4.13 to 4.17 and I was able to narrow down the impact to yarnpkg#7184 This change removes likely redundant sorting operation, speeding up (in my case) linking step by 97%, from 50s to 2s ## How did you fix it? First I've tried to cache sorting operation, but later challenged its very existence. Tests and snapshots are happy and see no difference. ... ## Checklist - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed.
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