@pnpm/installing.linking.real-hoist 1100.1.13 → 1100.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pnpm/real-hoist
2
2
 
3
+ ## 1100.1.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Under `nodeLinker: hoisted`, a dependency declared against a peer-resolution variant of a package version is no longer dropped from the installed layout. All variants of a version share one hoisted copy, and edges pointing at any of them now resolve to it, so the depending project keeps the package in its `.package-map.json` and the depending package keeps it in its `node_modules/.bin`.
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/deps.path@1101.0.0
11
+ - @pnpm/error@1100.1.3
12
+ - @pnpm/lockfile.types@1100.0.20
13
+ - @pnpm/lockfile.utils@1102.0.0
14
+
3
15
  ## 1100.1.13
4
16
 
5
17
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { PackageSnapshot } from '@pnpm/lockfile.types';
1
2
  import { type LockfileObject } from '@pnpm/lockfile.utils';
2
3
  import { type HoisterResult } from '@yarnpkg/nm/hoist';
3
4
  /**
@@ -14,6 +15,24 @@ import { type HoisterResult } from '@yarnpkg/nm/hoist';
14
15
  */
15
16
  export type HoistingLimits = 'none' | 'workspaces' | 'dependencies';
16
17
  export type { HoisterResult };
18
+ /**
19
+ * The identity every peer variant of one package version collapses
20
+ * onto.
21
+ *
22
+ * `toTree` maps the id to the first depPath it sees for it and stamps
23
+ * that depPath on every variant as their shared `reference`, so only
24
+ * that one depPath survives into the result. Anything indexing the
25
+ * hoist result by package therefore has to key *and* look up by this
26
+ * id rather than by the depPath an edge declares — otherwise every
27
+ * edge on a collapsed variant finds nothing and drops out of the
28
+ * layout.
29
+ *
30
+ * One id can still cover several directories: nodes are interned per
31
+ * `(alias, depPath)`, so an alias exposing a package under a second
32
+ * name gets a node, and a directory, of its own. An index over the
33
+ * result holds the list and resolves an edge to its first entry.
34
+ */
35
+ export declare function getHoisterPkgId(depPath: string, pkgSnapshot: PackageSnapshot): string;
17
36
  /**
18
37
  * Translate the user-facing {@link HoistingLimits} mode into the
19
38
  * `@yarnpkg/nm` hoister's per-locator border map. A name in a
package/lib/index.js CHANGED
@@ -2,6 +2,27 @@ import * as dp from '@pnpm/deps.path';
2
2
  import { LockfileMissingDependencyError } from '@pnpm/error';
3
3
  import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils';
4
4
  import { hoist as _hoist, HoisterDependencyKind } from '@yarnpkg/nm/hoist';
5
+ /**
6
+ * The identity every peer variant of one package version collapses
7
+ * onto.
8
+ *
9
+ * `toTree` maps the id to the first depPath it sees for it and stamps
10
+ * that depPath on every variant as their shared `reference`, so only
11
+ * that one depPath survives into the result. Anything indexing the
12
+ * hoist result by package therefore has to key *and* look up by this
13
+ * id rather than by the depPath an edge declares — otherwise every
14
+ * edge on a collapsed variant finds nothing and drops out of the
15
+ * layout.
16
+ *
17
+ * One id can still cover several directories: nodes are interned per
18
+ * `(alias, depPath)`, so an alias exposing a package under a second
19
+ * name gets a node, and a directory, of its own. An index over the
20
+ * result holds the list and resolves an edge to its first entry.
21
+ */
22
+ export function getHoisterPkgId(depPath, pkgSnapshot) {
23
+ const { name, version } = nameVerFromPkgSnapshot(depPath, pkgSnapshot);
24
+ return `${name}@${version}`;
25
+ }
5
26
  /**
6
27
  * Translate the user-facing {@link HoistingLimits} mode into the
7
28
  * `@yarnpkg/nm` hoister's per-locator border map. A name in a
@@ -121,8 +142,8 @@ function toTree({ nodes, lockfile, depPathByPkgId, autoInstallPeers }, deps) {
121
142
  if (!pkgSnapshot) {
122
143
  throw new LockfileMissingDependencyError(depPath);
123
144
  }
124
- const { name: pkgName, version } = nameVerFromPkgSnapshot(depPath, pkgSnapshot);
125
- const id = `${pkgName}@${version}`;
145
+ const { name: pkgName } = nameVerFromPkgSnapshot(depPath, pkgSnapshot);
146
+ const id = getHoisterPkgId(depPath, pkgSnapshot);
126
147
  if (!depPathByPkgId.has(id)) {
127
148
  depPathByPkgId.set(id, depPath);
128
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.linking.real-hoist",
3
- "version": "1100.1.13",
3
+ "version": "1100.1.14",
4
4
  "description": "Hoists dependencies in a node_modules created by pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -27,17 +27,18 @@
27
27
  "!*.map"
28
28
  ],
29
29
  "dependencies": {
30
- "@pnpm/deps.path": "1100.1.0",
31
- "@pnpm/error": "1100.1.2",
32
- "@pnpm/lockfile.utils": "1101.1.0",
30
+ "@pnpm/deps.path": "1101.0.0",
31
+ "@pnpm/error": "1100.1.3",
32
+ "@pnpm/lockfile.types": "1100.0.20",
33
+ "@pnpm/lockfile.utils": "1102.0.0",
33
34
  "@yarnpkg/nm": "4.1.1"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@jest/globals": "30.4.1",
37
- "@pnpm/installing.linking.real-hoist": "1100.1.13",
38
- "@pnpm/lockfile.fs": "1100.2.2",
38
+ "@pnpm/installing.linking.real-hoist": "1100.1.14",
39
+ "@pnpm/lockfile.fs": "1100.2.3",
39
40
  "@pnpm/test-fixtures": "1100.0.1",
40
- "@pnpm/types": "1101.9.0"
41
+ "@pnpm/types": "1102.0.0"
41
42
  },
42
43
  "engines": {
43
44
  "node": ">=22.13"