@pnpm/node.fetcher 1000.0.20 → 1001.0.0

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.d.ts CHANGED
@@ -1,8 +1,25 @@
1
1
  import { type FetchFromRegistry, type RetryTimeoutOptions } from '@pnpm/fetching-types';
2
- export interface FetchNodeOptions {
2
+ import { type Cafs } from '@pnpm/cafs-types';
3
+ export interface FetchNodeOptionsToDir {
3
4
  storeDir: string;
4
5
  fetchTimeout?: number;
5
6
  nodeMirrorBaseUrl?: string;
6
7
  retry?: RetryTimeoutOptions;
7
8
  }
8
- export declare function fetchNode(fetch: FetchFromRegistry, version: string, targetDir: string, opts: FetchNodeOptions): Promise<void>;
9
+ export interface FetchNodeOptions {
10
+ cafs: Cafs;
11
+ filesIndexFile: string;
12
+ fetchTimeout?: number;
13
+ nodeMirrorBaseUrl?: string;
14
+ retry?: RetryTimeoutOptions;
15
+ }
16
+ /**
17
+ * Fetches and installs a Node.js version to the specified target directory.
18
+ *
19
+ * @param fetch - Function to fetch resources from registry
20
+ * @param version - Node.js version to install
21
+ * @param targetDir - Directory where Node.js should be installed
22
+ * @param opts - Configuration options for the fetch operation
23
+ * @throws {PnpmError} When system uses MUSL libc, integrity verification fails, or download fails
24
+ */
25
+ export declare function fetchNode(fetch: FetchFromRegistry, version: string, targetDir: string, opts: FetchNodeOptionsToDir): Promise<void>;
package/lib/index.js CHANGED
@@ -4,27 +4,97 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchNode = fetchNode;
7
- const fs_1 = __importDefault(require("fs"));
8
7
  const path_1 = __importDefault(require("path"));
9
8
  const error_1 = require("@pnpm/error");
10
- const pick_fetcher_1 = require("@pnpm/pick-fetcher");
9
+ const crypto_shasums_file_1 = require("@pnpm/crypto.shasums-file");
11
10
  const create_cafs_store_1 = require("@pnpm/create-cafs-store");
12
11
  const tarball_fetcher_1 = require("@pnpm/tarball-fetcher");
13
- const adm_zip_1 = __importDefault(require("adm-zip"));
14
- const rename_overwrite_1 = __importDefault(require("rename-overwrite"));
15
- const tempy_1 = __importDefault(require("tempy"));
12
+ const node_resolver_1 = require("@pnpm/node.resolver");
13
+ const fetching_binary_fetcher_1 = require("@pnpm/fetching.binary-fetcher");
16
14
  const detect_libc_1 = require("detect-libc");
17
- const getNodeTarball_1 = require("./getNodeTarball");
15
+ // Constants
16
+ const DEFAULT_NODE_MIRROR_BASE_URL = 'https://nodejs.org/download/release/';
17
+ /**
18
+ * Fetches and installs a Node.js version to the specified target directory.
19
+ *
20
+ * @param fetch - Function to fetch resources from registry
21
+ * @param version - Node.js version to install
22
+ * @param targetDir - Directory where Node.js should be installed
23
+ * @param opts - Configuration options for the fetch operation
24
+ * @throws {PnpmError} When system uses MUSL libc, integrity verification fails, or download fails
25
+ */
18
26
  async function fetchNode(fetch, version, targetDir, opts) {
27
+ await validateSystemCompatibility();
28
+ const nodeMirrorBaseUrl = opts.nodeMirrorBaseUrl ?? DEFAULT_NODE_MIRROR_BASE_URL;
29
+ const artifactInfo = await getNodeArtifactInfo(fetch, version, { nodeMirrorBaseUrl });
30
+ if (artifactInfo.isZip) {
31
+ await (0, fetching_binary_fetcher_1.downloadAndUnpackZip)(fetch, artifactInfo, targetDir);
32
+ return;
33
+ }
34
+ await downloadAndUnpackTarballToDir(fetch, artifactInfo, targetDir, opts);
35
+ }
36
+ /**
37
+ * Validates that the current system is compatible with Node.js installation.
38
+ *
39
+ * @throws {PnpmError} When system uses MUSL libc
40
+ */
41
+ async function validateSystemCompatibility() {
19
42
  if (await (0, detect_libc_1.isNonGlibcLinux)()) {
20
43
  throw new error_1.PnpmError('MUSL', 'The current system uses the "MUSL" C standard library. Node.js currently has prebuilt artifacts only for the "glibc" libc, so we can install Node.js only for glibc');
21
44
  }
22
- const nodeMirrorBaseUrl = opts.nodeMirrorBaseUrl ?? 'https://nodejs.org/download/release/';
23
- const { tarball, pkgName } = (0, getNodeTarball_1.getNodeTarball)(version, nodeMirrorBaseUrl, process.platform, process.arch);
24
- if (tarball.endsWith('.zip')) {
25
- await downloadAndUnpackZip(fetch, tarball, targetDir, pkgName);
26
- return;
27
- }
45
+ }
46
+ /**
47
+ * Gets Node.js artifact information including URL, integrity, and file type.
48
+ *
49
+ * @param fetch - Function to fetch resources from registry
50
+ * @param version - Node.js version
51
+ * @param nodeMirrorBaseUrl - Base URL for Node.js mirror
52
+ * @returns Promise resolving to artifact information
53
+ * @throws {PnpmError} When integrity file cannot be fetched or parsed
54
+ */
55
+ async function getNodeArtifactInfo(fetch, version, opts) {
56
+ const tarball = (0, node_resolver_1.getNodeArtifactAddress)({
57
+ version,
58
+ baseUrl: opts.nodeMirrorBaseUrl,
59
+ platform: process.platform,
60
+ arch: process.arch,
61
+ });
62
+ const tarballFileName = `${tarball.basename}${tarball.extname}`;
63
+ const shasumsFileUrl = `${tarball.dirname}/SHASUMS256.txt`;
64
+ const url = `${tarball.dirname}/${tarballFileName}`;
65
+ const integrity = opts.integrities
66
+ ? opts.integrities[`${process.platform}-${process.arch}`]
67
+ : await loadArtifactIntegrity(fetch, tarballFileName, shasumsFileUrl);
68
+ return {
69
+ url,
70
+ integrity,
71
+ isZip: tarball.extname === '.zip',
72
+ basename: tarball.basename,
73
+ };
74
+ }
75
+ /**
76
+ * Loads and extracts the integrity hash for a specific Node.js artifact.
77
+ *
78
+ * @param fetch - Function to fetch resources from registry
79
+ * @param fileName - Name of the file to find integrity for
80
+ * @param shasumsUrl - URL of the SHASUMS256.txt file
81
+ * @param options - Optional configuration for integrity verification
82
+ * @returns Promise resolving to the integrity hash in base64 format
83
+ * @throws {PnpmError} When integrity file cannot be fetched or parsed
84
+ */
85
+ async function loadArtifactIntegrity(fetch, fileName, shasumsUrl) {
86
+ const body = await (0, crypto_shasums_file_1.fetchShasumsFileRaw)(fetch, shasumsUrl);
87
+ return (0, crypto_shasums_file_1.pickFileChecksumFromShasumsFile)(body, fileName);
88
+ }
89
+ /**
90
+ * Downloads and unpacks a tarball using the tarball fetcher.
91
+ *
92
+ * @param fetch - Function to fetch resources from registry
93
+ * @param artifactInfo - Information about the Node.js artifact
94
+ * @param targetDir - Directory where Node.js should be installed
95
+ * @param opts - Configuration options for the fetch operation
96
+ */
97
+ async function downloadAndUnpackTarballToDir(fetch, artifactInfo, targetDir, opts) {
28
98
  const getAuthHeader = () => undefined;
29
99
  const fetchers = (0, tarball_fetcher_1.createTarballFetcher)(fetch, getAuthHeader, {
30
100
  retry: opts.retry,
@@ -34,9 +104,14 @@ async function fetchNode(fetch, version, targetDir, opts) {
34
104
  unsafePerm: false,
35
105
  });
36
106
  const cafs = (0, create_cafs_store_1.createCafsStore)(opts.storeDir);
37
- const fetchTarball = (0, pick_fetcher_1.pickFetcher)(fetchers, { tarball });
38
- const { filesIndex } = await fetchTarball(cafs, { tarball }, {
39
- filesIndexFile: path_1.default.join(opts.storeDir, encodeURIComponent(tarball)), // TODO: change the name or don't save an index file for node.js tarballs
107
+ // Create a unique index file name for Node.js tarballs
108
+ const indexFileName = `node-${encodeURIComponent(artifactInfo.url)}`;
109
+ const filesIndexFile = path_1.default.join(opts.storeDir, indexFileName);
110
+ const { filesIndex } = await fetchers.remoteTarball(cafs, {
111
+ tarball: artifactInfo.url,
112
+ integrity: artifactInfo.integrity,
113
+ }, {
114
+ filesIndexFile,
40
115
  lockfileDir: process.cwd(),
41
116
  pkg: {},
42
117
  });
@@ -49,17 +124,4 @@ async function fetchNode(fetch, version, targetDir, opts) {
49
124
  force: true,
50
125
  });
51
126
  }
52
- async function downloadAndUnpackZip(fetchFromRegistry, zipUrl, targetDir, pkgName) {
53
- const response = await fetchFromRegistry(zipUrl);
54
- const tmp = path_1.default.join(tempy_1.default.directory(), 'pnpm.zip');
55
- const dest = fs_1.default.createWriteStream(tmp);
56
- await new Promise((resolve, reject) => {
57
- response.body.pipe(dest).on('error', reject).on('close', resolve);
58
- });
59
- const zip = new adm_zip_1.default(tmp);
60
- const nodeDir = path_1.default.dirname(targetDir);
61
- zip.extractAllTo(nodeDir, true);
62
- await (0, rename_overwrite_1.default)(path_1.default.join(nodeDir, pkgName), targetDir);
63
- await fs_1.default.promises.unlink(tmp);
64
- }
65
127
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAuBA,8BAiCC;AAxDD,4CAAmB;AACnB,gDAAuB;AACvB,uCAAuC;AAKvC,qDAAgD;AAChD,+DAAyD;AACzD,2DAA4D;AAC5D,sDAA4B;AAC5B,wEAA8C;AAC9C,kDAAyB;AACzB,6CAA6C;AAC7C,qDAAiD;AAS1C,KAAK,UAAU,SAAS,CAAE,KAAwB,EAAE,OAAe,EAAE,SAAiB,EAAE,IAAsB;IACnH,IAAI,MAAM,IAAA,6BAAe,GAAE,EAAE,CAAC;QAC5B,MAAM,IAAI,iBAAS,CAAC,MAAM,EAAE,qKAAqK,CAAC,CAAA;IACpM,CAAC;IACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,sCAAsC,CAAA;IAC1F,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAA,+BAAc,EAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACvG,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC9D,OAAM;IACR,CAAC;IACD,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,SAAS,CAAA;IACrC,MAAM,QAAQ,GAAG,IAAA,sCAAoB,EAAC,KAAK,EAAE,aAAa,EAAE;QAC1D,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CA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  "description": "Node.js artifacts fetcher",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -15,6 +15,7 @@
15
15
  "bugs": {
16
16
  "url": "https://github.com/pnpm/pnpm/issues"
17
17
  },
18
+ "type": "commonjs",
18
19
  "main": "lib/index.js",
19
20
  "types": "lib/index.d.ts",
20
21
  "exports": {
@@ -25,22 +26,21 @@
25
26
  "!*.map"
26
27
  ],
27
28
  "dependencies": {
28
- "adm-zip": "^0.5.16",
29
29
  "detect-libc": "^2.0.3",
30
- "rename-overwrite": "^6.0.2",
31
- "tempy": "^1.0.1",
32
- "@pnpm/create-cafs-store": "1000.0.15",
33
- "@pnpm/error": "1000.0.2",
34
- "@pnpm/fetching-types": "1000.1.0",
35
- "@pnpm/pick-fetcher": "1000.0.1",
36
- "@pnpm/fetcher-base": "1000.0.12",
37
- "@pnpm/tarball-fetcher": "1001.0.10"
30
+ "@pnpm/create-cafs-store": "1000.0.17",
31
+ "@pnpm/crypto.shasums-file": "1001.0.0",
32
+ "@pnpm/error": "1000.0.4",
33
+ "@pnpm/fetching-types": "1000.2.0",
34
+ "@pnpm/fetching.binary-fetcher": "1000.0.0",
35
+ "@pnpm/node.resolver": "1001.0.0",
36
+ "@pnpm/tarball-fetcher": "1001.0.12"
38
37
  },
39
38
  "devDependencies": {
40
39
  "@types/adm-zip": "^0.5.7",
40
+ "adm-zip": "^0.5.16",
41
41
  "node-fetch": "npm:@pnpm/node-fetch@1.0.0",
42
- "@pnpm/node.fetcher": "1000.0.20",
43
- "@pnpm/prepare": "0.0.121",
42
+ "@pnpm/node.fetcher": "1001.0.0",
43
+ "@pnpm/prepare": "0.0.123",
44
44
  "@pnpm/cafs-types": "1000.0.0"
45
45
  },
46
46
  "engines": {
@@ -1,4 +0,0 @@
1
- export declare function getNodeTarball(nodeVersion: string, nodeMirror: string, processPlatform: string, processArch: string): {
2
- pkgName: string;
3
- tarball: string;
4
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeTarball = getNodeTarball;
4
- const normalizeArch_1 = require("./normalizeArch");
5
- function getNodeTarball(nodeVersion, nodeMirror, processPlatform, processArch) {
6
- const platform = processPlatform === 'win32' ? 'win' : processPlatform;
7
- const arch = (0, normalizeArch_1.getNormalizedArch)(processPlatform, processArch, nodeVersion);
8
- const extension = platform === 'win' ? 'zip' : 'tar.gz';
9
- const pkgName = `node-v${nodeVersion}-${platform}-${arch}`;
10
- return {
11
- pkgName,
12
- tarball: `${nodeMirror}v${nodeVersion}/${pkgName}.${extension}`,
13
- };
14
- }
15
- //# sourceMappingURL=getNodeTarball.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNodeTarball.js","sourceRoot":"","sources":["../src/getNodeTarball.ts"],"names":[],"mappings":";;AAEA,wCAcC;AAhBD,mDAAmD;AAEnD,SAAgB,cAAc,CAC5B,WAAmB,EACnB,UAAkB,EAClB,eAAuB,EACvB,WAAmB;IAEnB,MAAM,QAAQ,GAAG,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAA;IACtE,MAAM,IAAI,GAAG,IAAA,iCAAiB,EAAC,eAAe,EAAE,WAAW,EAAE,WAAW,CAAC,CAAA;IACzE,MAAM,SAAS,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;IACvD,MAAM,OAAO,GAAG,SAAS,WAAW,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAA;IAC1D,OAAO;QACL,OAAO;QACP,OAAO,EAAE,GAAG,UAAU,IAAI,WAAW,IAAI,OAAO,IAAI,SAAS,EAAE;KAChE,CAAA;AACH,CAAC"}
@@ -1 +0,0 @@
1
- export declare function getNormalizedArch(platform: string, arch: string, nodeVersion?: string): string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNormalizedArch = getNormalizedArch;
4
- function getNormalizedArch(platform, arch, nodeVersion) {
5
- if (nodeVersion) {
6
- const nodeMajorVersion = +nodeVersion.split('.')[0];
7
- if ((platform === 'darwin' && arch === 'arm64' && (nodeMajorVersion < 16))) {
8
- return 'x64';
9
- }
10
- }
11
- if (platform === 'win32' && arch === 'ia32') {
12
- return 'x86';
13
- }
14
- if (arch === 'arm') {
15
- return 'armv7l';
16
- }
17
- return arch;
18
- }
19
- //# sourceMappingURL=normalizeArch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeArch.js","sourceRoot":"","sources":["../src/normalizeArch.ts"],"names":[],"mappings":";;AAAA,8CAcC;AAdD,SAAgB,iBAAiB,CAAE,QAAgB,EAAE,IAAY,EAAE,WAAoB;IACrF,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACnD,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YAC3E,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}