Skip to content

Adds support for package map generation#7184

Merged
arcanis merged 8 commits into
masterfrom
mael/package-maps
Jun 15, 2026
Merged

Adds support for package map generation#7184
arcanis merged 8 commits into
masterfrom
mael/package-maps

Conversation

@arcanis

@arcanis arcanis commented Jun 14, 2026

Copy link
Copy Markdown
Member

This PR implements support for generating package maps.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit c7ac150 into master Jun 15, 2026
33 checks passed
@arcanis arcanis deleted the mael/package-maps branch June 15, 2026 07:36
@adrian-gierakowski

Copy link
Copy Markdown

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

@arcanis

arcanis commented Jun 15, 2026

Copy link
Copy Markdown
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.

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>
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.

2 participants