@pnpm/engine.runtime.node-resolver 1101.1.8 → 1101.1.9
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/lib/index.js +9 -3
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export async function resolveNodeRuntime(ctx, wantedDependency, opts) {
|
|
|
25
25
|
}
|
|
26
26
|
if (ctx.offline)
|
|
27
27
|
throw new PnpmError('NO_OFFLINE_NODEJS_RESOLUTION', 'Offline Node.js resolution is not supported');
|
|
28
|
-
const versionSpec = wantedDependency.bareSpecifier.substring('runtime:'.length);
|
|
28
|
+
const versionSpec = normalizeRuntimeSpec(wantedDependency.bareSpecifier.substring('runtime:'.length));
|
|
29
29
|
const { releaseChannel, versionSpecifier } = parseNodeSpecifier(versionSpec);
|
|
30
30
|
const nodeMirrorBaseUrl = getNodeMirror(ctx.nodeDownloadMirrors, releaseChannel);
|
|
31
31
|
const version = await resolveNodeVersion(ctx.fetchFromRegistry, versionSpecifier, nodeMirrorBaseUrl);
|
|
@@ -53,7 +53,7 @@ export async function resolveLatestNodeRuntime(ctx, query, _opts) {
|
|
|
53
53
|
const manifestSpec = query.wantedDependency.bareSpecifier;
|
|
54
54
|
if (query.wantedDependency.alias !== 'node' || !manifestSpec?.startsWith('runtime:'))
|
|
55
55
|
return undefined;
|
|
56
|
-
const versionSpec = query.compatible ? manifestSpec.substring('runtime:'.length) : 'latest';
|
|
56
|
+
const versionSpec = query.compatible ? normalizeRuntimeSpec(manifestSpec.substring('runtime:'.length)) : 'latest';
|
|
57
57
|
const { releaseChannel, versionSpecifier } = parseNodeSpecifier(versionSpec);
|
|
58
58
|
const nodeMirrorBaseUrl = getNodeMirror(ctx.nodeDownloadMirrors, releaseChannel);
|
|
59
59
|
const version = await resolveNodeVersion(ctx.fetchFromRegistry, versionSpecifier, nodeMirrorBaseUrl);
|
|
@@ -156,6 +156,7 @@ const SEMVER_OPTS = {
|
|
|
156
156
|
};
|
|
157
157
|
export async function resolveNodeVersion(fetch, versionSpec, nodeMirrorBaseUrl) {
|
|
158
158
|
const allVersions = await fetchAllVersions(fetch, nodeMirrorBaseUrl);
|
|
159
|
+
versionSpec = normalizeRuntimeSpec(versionSpec);
|
|
159
160
|
if (versionSpec === 'latest') {
|
|
160
161
|
return allVersions[0].version;
|
|
161
162
|
}
|
|
@@ -164,15 +165,20 @@ export async function resolveNodeVersion(fetch, versionSpec, nodeMirrorBaseUrl)
|
|
|
164
165
|
}
|
|
165
166
|
export async function resolveNodeVersions(fetch, versionSpec, nodeMirrorBaseUrl) {
|
|
166
167
|
const allVersions = await fetchAllVersions(fetch, nodeMirrorBaseUrl);
|
|
167
|
-
if (
|
|
168
|
+
if (versionSpec == null) {
|
|
168
169
|
return allVersions.map(({ version }) => version);
|
|
169
170
|
}
|
|
171
|
+
versionSpec = normalizeRuntimeSpec(versionSpec);
|
|
170
172
|
if (versionSpec === 'latest') {
|
|
171
173
|
return [allVersions[0].version];
|
|
172
174
|
}
|
|
173
175
|
const { versions, versionRange } = filterVersions(allVersions, versionSpec);
|
|
174
176
|
return versions.filter(version => semver.satisfies(version, versionRange, SEMVER_OPTS));
|
|
175
177
|
}
|
|
178
|
+
function normalizeRuntimeSpec(versionSpec) {
|
|
179
|
+
versionSpec = versionSpec.trim();
|
|
180
|
+
return versionSpec === '' ? 'latest' : versionSpec;
|
|
181
|
+
}
|
|
176
182
|
async function fetchAllVersions(fetch, nodeMirrorBaseUrl) {
|
|
177
183
|
const response = await fetch(`${nodeMirrorBaseUrl ?? 'https://nodejs.org/download/release/'}index.json`);
|
|
178
184
|
return (await response.json()).map(({ version, lts }) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/engine.runtime.node-resolver",
|
|
3
|
-
"version": "1101.1.
|
|
3
|
+
"version": "1101.1.9",
|
|
4
4
|
"description": "Resolves a Node.js version specifier to an exact Node.js version",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"funding": "https://opencollective.com/pnpm",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/pnpm/pnpm/tree/main/engine/runtime/node-resolver"
|
|
15
|
+
"url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/engine/runtime/node-resolver"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://github.com/pnpm/pnpm/tree/main/engine/runtime/node-resolver#readme",
|
|
17
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/engine/runtime/node-resolver#readme",
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
20
20
|
},
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"semver": "^7.8.4",
|
|
33
33
|
"version-selector-type": "^3.0.0",
|
|
34
|
-
"@pnpm/
|
|
35
|
-
"@pnpm/
|
|
34
|
+
"@pnpm/error": "1100.0.1",
|
|
35
|
+
"@pnpm/config.reader": "1101.10.1",
|
|
36
36
|
"@pnpm/fetching.types": "1100.0.2",
|
|
37
|
-
"@pnpm/resolving.resolver-base": "1100.
|
|
37
|
+
"@pnpm/resolving.resolver-base": "1100.5.0",
|
|
38
38
|
"@pnpm/types": "1101.3.2",
|
|
39
|
-
"@pnpm/crypto.shasums-file": "1100.1.
|
|
39
|
+
"@pnpm/crypto.shasums-file": "1100.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@jest/globals": "30.4.1",
|
|
43
43
|
"@types/semver": "7.7.1",
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
44
|
+
"@pnpm/network.fetch": "1100.1.4",
|
|
45
|
+
"@pnpm/engine.runtime.node-resolver": "1101.1.9"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=22.13"
|