@pnpm/engine.runtime.node-resolver 1001.0.5 → 1100.0.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/lib/getNodeMirror.d.ts +1 -2
- package/lib/getNodeMirror.js +2 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +15 -2
- package/package.json +12 -13
package/lib/getNodeMirror.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function getNodeMirror(rawConfig: Config['rawConfig'], releaseChannel: string): string;
|
|
1
|
+
export declare function getNodeMirror(nodeDownloadMirrors: Record<string, string> | undefined, releaseChannel: string): string;
|
package/lib/getNodeMirror.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export function getNodeMirror(
|
|
2
|
-
|
|
3
|
-
const configKey = `node-mirror:${releaseChannel}`;
|
|
4
|
-
const nodeMirror = rawConfig[configKey] ?? `https://nodejs.org/download/${releaseChannel}/`;
|
|
1
|
+
export function getNodeMirror(nodeDownloadMirrors, releaseChannel) {
|
|
2
|
+
const nodeMirror = nodeDownloadMirrors?.[releaseChannel] ?? `https://nodejs.org/download/${releaseChannel}/`;
|
|
5
3
|
return normalizeNodeMirror(nodeMirror);
|
|
6
4
|
}
|
|
7
5
|
function normalizeNodeMirror(nodeMirror) {
|
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface NodeRuntimeResolveResult extends ResolveResult {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function resolveNodeRuntime(ctx: {
|
|
14
14
|
fetchFromRegistry: FetchFromRegistry;
|
|
15
|
-
|
|
15
|
+
nodeDownloadMirrors?: Record<string, string>;
|
|
16
16
|
offline?: boolean;
|
|
17
17
|
}, wantedDependency: WantedDependency, opts?: Partial<ResolveOptions>): Promise<NodeRuntimeResolveResult | null>;
|
|
18
18
|
export declare function resolveNodeVersion(fetch: FetchFromRegistry, versionSpec: string, nodeMirrorBaseUrl?: string): Promise<string | null>;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getNodeBinsForCurrentOS } from '@pnpm/constants';
|
|
2
1
|
import { fetchShasumsFile } from '@pnpm/crypto.shasums-file';
|
|
3
2
|
import { PnpmError } from '@pnpm/error';
|
|
4
3
|
import semver from 'semver';
|
|
@@ -23,7 +22,7 @@ export async function resolveNodeRuntime(ctx, wantedDependency, opts) {
|
|
|
23
22
|
throw new PnpmError('NO_OFFLINE_NODEJS_RESOLUTION', 'Offline Node.js resolution is not supported');
|
|
24
23
|
const versionSpec = wantedDependency.bareSpecifier.substring('runtime:'.length);
|
|
25
24
|
const { releaseChannel, versionSpecifier } = parseNodeSpecifier(versionSpec);
|
|
26
|
-
const nodeMirrorBaseUrl = getNodeMirror(ctx.
|
|
25
|
+
const nodeMirrorBaseUrl = getNodeMirror(ctx.nodeDownloadMirrors, releaseChannel);
|
|
27
26
|
const version = await resolveNodeVersion(ctx.fetchFromRegistry, versionSpecifier, nodeMirrorBaseUrl);
|
|
28
27
|
if (!version) {
|
|
29
28
|
throw new PnpmError('NODEJS_VERSION_NOT_FOUND', `Could not find a Node.js version that satisfies ${versionSpec}`);
|
|
@@ -141,6 +140,20 @@ async function fetchAllVersions(fetch, nodeMirrorBaseUrl) {
|
|
|
141
140
|
lts,
|
|
142
141
|
}));
|
|
143
142
|
}
|
|
143
|
+
function getNodeBinsForCurrentOS(platform = process.platform) {
|
|
144
|
+
if (platform === 'win32') {
|
|
145
|
+
return {
|
|
146
|
+
node: 'node.exe',
|
|
147
|
+
npm: 'node_modules/npm/bin/npm-cli.js',
|
|
148
|
+
npx: 'node_modules/npm/bin/npx-cli.js',
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
node: 'bin/node',
|
|
153
|
+
npm: 'lib/node_modules/npm/bin/npm-cli.js',
|
|
154
|
+
npx: 'lib/node_modules/npm/bin/npx-cli.js',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
144
157
|
function filterVersions(versions, versionSelector) {
|
|
145
158
|
if (versionSelector === 'lts') {
|
|
146
159
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/engine.runtime.node-resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.1",
|
|
4
4
|
"description": "Resolves a Node.js version specifier to an exact Node.js version",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,18 +28,17 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"semver": "^7.7.2",
|
|
30
30
|
"version-selector-type": "^3.0.0",
|
|
31
|
-
"@pnpm/config.reader": "
|
|
32
|
-
"@pnpm/
|
|
33
|
-
"@pnpm/
|
|
34
|
-
"@pnpm/
|
|
35
|
-
"@pnpm/fetching.types": "
|
|
36
|
-
"@pnpm/
|
|
37
|
-
"@pnpm/resolving.resolver-base": "1005.1.0"
|
|
31
|
+
"@pnpm/config.reader": "1100.0.1",
|
|
32
|
+
"@pnpm/error": "1100.0.0",
|
|
33
|
+
"@pnpm/resolving.resolver-base": "1100.0.1",
|
|
34
|
+
"@pnpm/types": "1101.0.0",
|
|
35
|
+
"@pnpm/fetching.types": "1100.0.0",
|
|
36
|
+
"@pnpm/crypto.shasums-file": "1100.0.0"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"@types/semver": "7.7.1",
|
|
41
|
-
"@pnpm/engine.runtime.node-resolver": "
|
|
42
|
-
"@pnpm/network.fetch": "
|
|
40
|
+
"@pnpm/engine.runtime.node-resolver": "1100.0.1",
|
|
41
|
+
"@pnpm/network.fetch": "1100.0.1"
|
|
43
42
|
},
|
|
44
43
|
"engines": {
|
|
45
44
|
"node": ">=22.13"
|
|
@@ -49,8 +48,8 @@
|
|
|
49
48
|
},
|
|
50
49
|
"scripts": {
|
|
51
50
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
51
|
+
"test": "pn compile && pn .test",
|
|
52
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
53
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
55
54
|
}
|
|
56
55
|
}
|