@pnpm/resolving.resolver-base 1101.1.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 CHANGED
@@ -1,5 +1,14 @@
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
+
3
12
  ## 1101.1.0
4
13
 
5
14
  ### Minor Changes
package/lib/index.d.ts CHANGED
@@ -162,10 +162,10 @@ export interface PlatformSelector {
162
162
  }
163
163
  /**
164
164
  * Resolve a {@link PlatformSelector} from the user's supportedArchitectures config
165
- * and the host's own platform/arch/libc. When `supportedArchitectures.xxx` is set
166
- * and its first entry is not `"current"`, that entry wins; otherwise the host's
167
- * value is used. Additional entries beyond the first are ignored — variant
168
- * selection picks exactly one (os, cpu, libc) triplet per install.
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
169
169
  */
170
170
  export declare function resolvePlatformSelector(supportedArchitectures: SupportedArchitectures | undefined, host: {
171
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. When `supportedArchitectures.xxx` is set
91
- * and its first entry is not `"current"`, that entry wins; otherwise the host's
92
- * value is used. Additional entries beyond the first are ignored — variant
93
- * selection picks exactly one (os, cpu, libc) triplet per install.
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: pickFirstNonCurrent(supportedArchitectures?.os) ?? host.platform,
98
- cpu: pickFirstNonCurrent(supportedArchitectures?.cpu) ?? host.arch,
99
- libc: pickFirstNonCurrent(supportedArchitectures?.libc) ?? host.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 pickFirstNonCurrent(requirements) {
122
- if (requirements?.length && requirements[0] !== 'current') {
123
- return requirements[0];
124
- }
125
- return undefined;
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.1.0",
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": "1101.9.0"
31
+ "@pnpm/types": "1102.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@jest/globals": "30.4.1",
35
- "@pnpm/resolving.resolver-base": "1101.1.0"
35
+ "@pnpm/resolving.resolver-base": "1101.1.1"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=22.13"