@pnpm/resolving.resolver-base 1101.0.0 → 1101.1.1
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 +70 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +13 -12
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @pnpm/resolver-base
|
|
2
2
|
|
|
3
|
+
## 1101.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A runtime installed through `devEngines.runtime` now matches the host when `supportedArchitectures` lists several platforms. Listing `os: [darwin, linux]` and `cpu: [x64, arm64]` used to install the runtime built for the first entry of each list, so a machine running Linux on arm64 got a macOS x64 Node.js that could not execute [#13898](https://github.com/pnpm/pnpm/issues/13898).
|
|
8
|
+
|
|
9
|
+
- Updated dependencies:
|
|
10
|
+
- @pnpm/types@1102.0.0
|
|
11
|
+
|
|
12
|
+
## 1101.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- **Security fix.** Affects projects using `namedRegistries` on pnpm 11.1.0–11.19.x. It is **semi-breaking** for those projects — see "If you use named registries" below.
|
|
17
|
+
|
|
18
|
+
The lockfile recorded no marker for which registry a package came from. Packages were keyed by `name@version` alone, and entry lookup went through `refToRelative(ref, name)`, so a dependency you declared against one registry could be satisfied by an entry that was actually resolved from another. When two registries served the same name and version, both collapsed onto a single `packages:` entry and whichever resolved first decided the tarball every consumer got.
|
|
19
|
+
|
|
20
|
+
That is a package-substitution risk: a package you expect from your private registry could be installed from a different registry that publishes the same name and version, and the lockfile recorded nothing that would let you tell.
|
|
21
|
+
|
|
22
|
+
Packages resolved from a named registry are now recorded under registry-qualified keys (`<name>@<registryName>:<version>`, e.g. `foo@work:1.0.0`), so each registry gets its own entry and the lockfile pins which one a dependency came from.
|
|
23
|
+
|
|
24
|
+
The lockfile format version is unchanged. Registry-qualified keys appear only for packages resolved from a named registry, so a project that does not use `namedRegistries` sees no difference, and older pnpm versions keep reading the file.
|
|
25
|
+
|
|
26
|
+
### If you use named registries
|
|
27
|
+
|
|
28
|
+
Your next non-frozen install re-keys those entries, which shows up as a lockfile diff. Commit it — that diff is the fix being applied. Review it: an entry that moves to a registry you did not expect is worth investigating.
|
|
29
|
+
|
|
30
|
+
Everyone working on the project should be on this version or newer before you do. An older pnpm reads the re-keyed lockfile fine — frozen installs are unaffected — but it does not produce registry-qualified keys itself, so any install that updates the lockfile writes those entries back to the old shape, and the next install on a current pnpm re-qualifies them. The result is a lockfile that flips back and forth, and while it is in the old shape the project is exposed again. Because the lockfile format version is deliberately unchanged, pnpm cannot detect this and warn you about it.
|
|
31
|
+
|
|
32
|
+
There is no setting to keep the old behavior: the old shape is the vulnerability.
|
|
33
|
+
|
|
34
|
+
Tarball URLs that follow the standard registry layout are no longer written to the lockfile for named-registry packages; they are recomputed from the `namedRegistries` setting on demand.
|
|
35
|
+
|
|
36
|
+
To use named registries, map your aliases in `pnpm-workspace.yaml`:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
namedRegistries:
|
|
40
|
+
work: https://npm.enterprise.example.com/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### New built-in `npmjs:` alias
|
|
44
|
+
|
|
45
|
+
`npmjs:` now resolves to `https://registry.npmjs.org/` with no configuration, alongside the existing `gh:` alias for GitHub Packages. It pins a dependency to the public registry even when `registry` points elsewhere, such as an internal proxy:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{ "dependencies": { "left-pad": "npmjs:^1.3.0" } }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`npm:` cannot do this — it is the alias protocol (`npm:<name>@<range>`) and resolves through whatever `registry` points at.
|
|
52
|
+
|
|
53
|
+
**If you mirror or proxy npmjs, point the alias at your mirror:**
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
namedRegistries:
|
|
57
|
+
npmjs: https://npm.internal.example.com/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Built-in registry URLs are also the prefixes a lockfile's recorded tarball URL is matched against when pnpm verifies a package. Without the override, an entry whose tarball URL is on `registry.npmjs.org` is verified against the public registry rather than your mirror. This only affects lockfiles that record such URLs — a canonical URL for your configured registry is omitted from the lockfile and unaffected — and only when a tarball-URL, `minimumReleaseAge`, or `trustPolicy` check runs. Overriding the alias is the same escape hatch GHES users already have for `gh`.
|
|
61
|
+
|
|
62
|
+
Every alias the lockfile references must stay in `namedRegistries`: reading an entry whose alias is gone fails with `ERR_PNPM_MISSING_NAMED_REGISTRY` rather than silently falling back to the default registry, since that would fetch a different package. Renaming an alias re-resolves the packages that used it.
|
|
63
|
+
|
|
64
|
+
Named registry aliases that shadow a reserved dependency specifier prefix (`file`, `link`, `workspace`, `runtime`, `npm`, `jsr`, ...) are now rejected with `ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME` instead of being silently shadowed by the corresponding resolver.
|
|
65
|
+
|
|
66
|
+
`pnpm licenses` and `pnpm sbom` now keep the two artifacts apart as well: license records carry the registry alias, and SBOM components carry the purl `repository_url` qualifier.
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Updated dependencies:
|
|
71
|
+
- @pnpm/types@1101.9.0
|
|
72
|
+
|
|
3
73
|
## 1101.0.0
|
|
4
74
|
|
|
5
75
|
### Major Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -106,11 +106,16 @@ export interface ResolutionVerifier {
|
|
|
106
106
|
* `name@version`. Verifiers that only police registry entries use it to
|
|
107
107
|
* skip deliberate non-registry deps, which can still carry a semver
|
|
108
108
|
* `version` copied from the resolved manifest.
|
|
109
|
+
*
|
|
110
|
+
* `ctx.registryName` is set when the entry is keyed by a registry-qualified
|
|
111
|
+
* dep path (`<name>@<registryName>:<version>`), so registry-policing
|
|
112
|
+
* verifiers route their metadata lookups to that named registry.
|
|
109
113
|
*/
|
|
110
114
|
verify: (resolution: Resolution, ctx: {
|
|
111
115
|
name: string;
|
|
112
116
|
version: string;
|
|
113
117
|
nonSemverVersion?: string;
|
|
118
|
+
registryName?: string;
|
|
114
119
|
}) => Promise<ResolutionVerification>;
|
|
115
120
|
/**
|
|
116
121
|
* Snapshot of the policy fields this verifier enforces. Merged with
|
|
@@ -157,10 +162,10 @@ export interface PlatformSelector {
|
|
|
157
162
|
}
|
|
158
163
|
/**
|
|
159
164
|
* Resolve a {@link PlatformSelector} from the user's supportedArchitectures config
|
|
160
|
-
* and the host's own platform/arch/libc.
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
165
|
+
* and the host's own platform/arch/libc. Exactly one (os, cpu, libc) triplet is
|
|
166
|
+
* installed, so each axis prefers the host's own value: a variant built for
|
|
167
|
+
* another platform cannot run here.
|
|
168
|
+
* @see https://github.com/pnpm/pnpm/issues/13898
|
|
164
169
|
*/
|
|
165
170
|
export declare function resolvePlatformSelector(supportedArchitectures: SupportedArchitectures | undefined, host: {
|
|
166
171
|
platform: string;
|
package/lib/index.js
CHANGED
|
@@ -87,16 +87,16 @@ export function classifyResolution(resolution) {
|
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Resolve a {@link PlatformSelector} from the user's supportedArchitectures config
|
|
90
|
-
* and the host's own platform/arch/libc.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
90
|
+
* and the host's own platform/arch/libc. Exactly one (os, cpu, libc) triplet is
|
|
91
|
+
* installed, so each axis prefers the host's own value: a variant built for
|
|
92
|
+
* another platform cannot run here.
|
|
93
|
+
* @see https://github.com/pnpm/pnpm/issues/13898
|
|
94
94
|
*/
|
|
95
95
|
export function resolvePlatformSelector(supportedArchitectures, host) {
|
|
96
96
|
return {
|
|
97
|
-
os:
|
|
98
|
-
cpu:
|
|
99
|
-
libc:
|
|
97
|
+
os: pickSupported(supportedArchitectures?.os, host.platform),
|
|
98
|
+
cpu: pickSupported(supportedArchitectures?.cpu, host.arch),
|
|
99
|
+
libc: pickSupported(supportedArchitectures?.libc, host.libc),
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -118,11 +118,12 @@ function libcMatches(variantLibc, requestedLibc) {
|
|
|
118
118
|
}
|
|
119
119
|
return variantLibc === requestedLibc;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
if (requirements?.length
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
function pickSupported(requirements, hostValue) {
|
|
122
|
+
if (!requirements?.length)
|
|
123
|
+
return hostValue;
|
|
124
|
+
if (requirements.some((requirement) => requirement === 'current' || requirement === hostValue))
|
|
125
|
+
return hostValue;
|
|
126
|
+
return requirements[0];
|
|
126
127
|
}
|
|
127
128
|
// This weight is set for selectors that are used on direct dependencies.
|
|
128
129
|
// It is important to give a bigger weight to direct dependencies.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.resolver-base",
|
|
3
|
-
"version": "1101.
|
|
3
|
+
"version": "1101.1.1",
|
|
4
4
|
"description": "Types for pnpm-compatible resolvers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"!*.map"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pnpm/types": "
|
|
31
|
+
"@pnpm/types": "1102.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@jest/globals": "30.4.1",
|
|
35
|
-
"@pnpm/resolving.resolver-base": "1101.
|
|
35
|
+
"@pnpm/resolving.resolver-base": "1101.1.1"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=22.13"
|