@pnpm/fetching.tarball-fetcher 1102.0.14 → 1102.1.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/CHANGELOG.md +32 -0
- package/lib/gitHostedTarballFetcher.js +7 -1
- package/lib/index.js +2 -0
- package/lib/remoteTarballFetcher.d.ts +3 -1
- package/lib/remoteTarballFetcher.js +8 -5
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @pnpm/tarball-fetcher
|
|
2
2
|
|
|
3
|
+
## 1102.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added support for registry replacement tarballs using standard integrity values, explicit revision fields, registry routing from the `registries` setting, non-redirecting integrity-addressed URLs, canonical safe-integer revision numbers, and pnpr proxying for immutable upstream revision artifacts.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Enforce `allowBuilds` when a prepared git dependency is reused from the shared store, and use the lockfile's canonical git resolution ID in approval suggestions.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies:
|
|
14
|
+
- @pnpm/core-loggers@1100.3.4
|
|
15
|
+
- @pnpm/exec.prepare-package@1100.0.34
|
|
16
|
+
- @pnpm/fetching.fetcher-base@1100.2.9
|
|
17
|
+
- @pnpm/fs.graceful-fs@1100.2.0
|
|
18
|
+
- @pnpm/store.index@1100.3.0
|
|
19
|
+
- @pnpm/types@1102.1.0
|
|
20
|
+
|
|
21
|
+
## 1102.0.15
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Added `fetchWarnTimeoutMs` and `fetchMinSpeedKiBps` to the Rust pnpm CLI and its N-API bindings. Slow registry metadata requests and tarball downloads now emit pnpm-compatible warnings without exposing URL credentials, query parameters, fragments, or control characters [pnpm/pnpm#12042](https://github.com/pnpm/pnpm/issues/12042).
|
|
26
|
+
|
|
27
|
+
- Updated dependencies:
|
|
28
|
+
- @pnpm/core-loggers@1100.3.3
|
|
29
|
+
- @pnpm/error@1100.1.3
|
|
30
|
+
- @pnpm/exec.prepare-package@1100.0.33
|
|
31
|
+
- @pnpm/fetching.fetcher-base@1100.2.8
|
|
32
|
+
- @pnpm/store.index@1100.2.5
|
|
33
|
+
- @pnpm/types@1102.0.0
|
|
34
|
+
|
|
3
35
|
## 1102.0.14
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -23,6 +23,7 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
|
|
|
23
23
|
filesMap: prepareResult.filesMap,
|
|
24
24
|
manifest: prepareResult.manifest ?? manifest,
|
|
25
25
|
requiresBuild,
|
|
26
|
+
requiresPrepare: prepareResult.requiresPrepare,
|
|
26
27
|
// Propagate the raw tarball integrity so the lockfile pins it and
|
|
27
28
|
// future installs detect a tampered tarball from the git host.
|
|
28
29
|
integrity,
|
|
@@ -49,7 +50,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
|
|
|
49
50
|
const { shouldBeBuilt, pkgDir } = await preparePackage({
|
|
50
51
|
...opts,
|
|
51
52
|
allowBuild: fetcherOpts.allowBuild,
|
|
52
|
-
pkgResolutionId: createGitHostedTarballPkgResolutionId(resolution),
|
|
53
|
+
pkgResolutionId: fetcherOpts.pkgResolutionId ?? createGitHostedTarballPkgResolutionId(resolution),
|
|
53
54
|
}, tempLocation, resolution.path ?? '');
|
|
54
55
|
const files = await packlist(pkgDir);
|
|
55
56
|
const { storeIndex } = opts;
|
|
@@ -57,12 +58,14 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
|
|
|
57
58
|
if (!shouldBeBuilt) {
|
|
58
59
|
const data = storeIndex.get(rawFilesIndexFile);
|
|
59
60
|
if (data) {
|
|
61
|
+
data.requiresPrepare = false;
|
|
60
62
|
storeIndex.set(filesIndexFile, data);
|
|
61
63
|
storeIndex.delete(rawFilesIndexFile);
|
|
62
64
|
}
|
|
63
65
|
return {
|
|
64
66
|
filesMap,
|
|
65
67
|
ignoredBuild: false,
|
|
68
|
+
requiresPrepare: false,
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
71
|
if (opts.ignoreScripts) {
|
|
@@ -70,6 +73,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
|
|
|
70
73
|
return {
|
|
71
74
|
filesMap,
|
|
72
75
|
ignoredBuild: true,
|
|
76
|
+
requiresPrepare: true,
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
}
|
|
@@ -86,8 +90,10 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
|
|
|
86
90
|
filesIndexFile,
|
|
87
91
|
pkg: fetcherOpts.pkg,
|
|
88
92
|
readManifest: fetcherOpts.readManifest,
|
|
93
|
+
requiresPrepare: shouldBeBuilt,
|
|
89
94
|
}),
|
|
90
95
|
ignoredBuild: Boolean(opts.ignoreScripts),
|
|
96
|
+
requiresPrepare: shouldBeBuilt,
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
function createGitHostedTarballPkgResolutionId(resolution) {
|
package/lib/index.js
CHANGED
|
@@ -46,6 +46,8 @@ async function fetchFromTarball(ctx, cafs, resolution, opts) {
|
|
|
46
46
|
registry: resolution.registry,
|
|
47
47
|
filesIndexFile: opts.filesIndexFile,
|
|
48
48
|
pkg: opts.pkg,
|
|
49
|
+
redirect: resolution.revision == null ? undefined : 'manual',
|
|
50
|
+
retry: resolution.revision == null ? undefined : { retries: 0 },
|
|
49
51
|
appendManifest: opts.appendManifest,
|
|
50
52
|
ignoreFilePattern: opts.ignoreFilePattern,
|
|
51
53
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'node:http';
|
|
2
2
|
import type { FetchOptions, FetchResult } from '@pnpm/fetching.fetcher-base';
|
|
3
|
-
import type { FetchFromRegistry, GetAuthHeader } from '@pnpm/fetching.types';
|
|
3
|
+
import type { FetchFromRegistry, GetAuthHeader, RetryTimeoutOptions } from '@pnpm/fetching.types';
|
|
4
4
|
import type { Cafs } from '@pnpm/store.cafs-types';
|
|
5
5
|
import type { StoreIndex } from '@pnpm/store.index';
|
|
6
6
|
export interface HttpResponse {
|
|
@@ -13,6 +13,8 @@ export type DownloadOptions = {
|
|
|
13
13
|
onStart?: (totalSize: number | null, attempt: number) => void;
|
|
14
14
|
onProgress?: (downloaded: number) => void;
|
|
15
15
|
integrity?: string;
|
|
16
|
+
redirect?: RequestRedirect;
|
|
17
|
+
retry?: Pick<RetryTimeoutOptions, 'retries'>;
|
|
16
18
|
storeIndex: StoreIndex;
|
|
17
19
|
pkg?: FetchOptions['pkg'];
|
|
18
20
|
} & Pick<FetchOptions, 'appendManifest' | 'readManifest' | 'filesIndexFile' | 'ignoreFilePattern'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
2
|
import { requestRetryLogger } from '@pnpm/core-loggers';
|
|
3
|
-
import { FetchError } from '@pnpm/error';
|
|
3
|
+
import { FetchError, redactUrlForDisplay } from '@pnpm/error';
|
|
4
4
|
import { globalWarn } from '@pnpm/logger';
|
|
5
5
|
import { addFilesFromTarball } from '@pnpm/worker';
|
|
6
6
|
import * as retry from '@zkochan/retry';
|
|
@@ -18,14 +18,16 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
18
18
|
const fetchMinSpeedKiBps = gotOpts.fetchMinSpeedKiBps ?? 50; // 50 KiB/s
|
|
19
19
|
return async function download(url, opts) {
|
|
20
20
|
const authHeaderValue = opts.getAuthHeaderByURI(url, { pkgName: opts.pkg?.name });
|
|
21
|
-
const
|
|
21
|
+
const downloadRetryOpts = { ...retryOpts, ...opts.retry };
|
|
22
|
+
const op = retry.operation(downloadRetryOpts);
|
|
22
23
|
return new Promise((resolve, reject) => {
|
|
23
24
|
op.attempt(async (attempt) => {
|
|
24
25
|
try {
|
|
25
26
|
resolve(await fetch(attempt));
|
|
26
27
|
}
|
|
27
28
|
catch (error) { // eslint-disable-line
|
|
28
|
-
if (error.response?.status
|
|
29
|
+
if ((opts.redirect === 'manual' && error.response?.status >= 300 && error.response.status < 400) ||
|
|
30
|
+
error.response?.status === 401 ||
|
|
29
31
|
error.response?.status === 403 ||
|
|
30
32
|
error.response?.status === 404 ||
|
|
31
33
|
error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE') {
|
|
@@ -56,7 +58,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
56
58
|
requestRetryLogger.debug({
|
|
57
59
|
attempt,
|
|
58
60
|
error: errorInfo,
|
|
59
|
-
maxRetries:
|
|
61
|
+
maxRetries: downloadRetryOpts.retries,
|
|
60
62
|
method: 'GET',
|
|
61
63
|
timeout,
|
|
62
64
|
url,
|
|
@@ -79,6 +81,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
79
81
|
// Hence, we tell fetch to not retry,
|
|
80
82
|
// and we perform the retries from this function instead.
|
|
81
83
|
retry: { retries: 0 },
|
|
84
|
+
redirect: opts.redirect,
|
|
82
85
|
timeout: gotOpts.timeout,
|
|
83
86
|
});
|
|
84
87
|
if (res.status !== 200) {
|
|
@@ -144,7 +147,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
144
147
|
const avgKiBps = Math.floor((downloaded / elapsedSec) / 1024);
|
|
145
148
|
if (downloaded > 0 && elapsedSec > 1 && avgKiBps < fetchMinSpeedKiBps) {
|
|
146
149
|
const sizeKb = Math.floor(downloaded / 1024);
|
|
147
|
-
globalWarn(`Tarball download average speed ${avgKiBps} KiB/s (size ${sizeKb} KiB) is below ${fetchMinSpeedKiBps} KiB/s: ${url} (GET)`);
|
|
150
|
+
globalWarn(`Tarball download average speed ${avgKiBps} KiB/s (size ${sizeKb} KiB) is below ${fetchMinSpeedKiBps} KiB/s: ${redactUrlForDisplay(url)} (GET)`);
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fetching.tarball-fetcher",
|
|
3
|
-
"version": "1102.0
|
|
3
|
+
"version": "1102.1.0",
|
|
4
4
|
"description": "Fetcher for packages hosted as tarballs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -29,34 +29,33 @@
|
|
|
29
29
|
"!*.map"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pnpm/core-loggers": "1100.3.
|
|
33
|
-
"@pnpm/error": "1100.1.
|
|
34
|
-
"@pnpm/exec.prepare-package": "1100.0.
|
|
35
|
-
"@pnpm/fetching.fetcher-base": "1100.2.
|
|
32
|
+
"@pnpm/core-loggers": "1100.3.4",
|
|
33
|
+
"@pnpm/error": "1100.1.3",
|
|
34
|
+
"@pnpm/exec.prepare-package": "1100.0.34",
|
|
35
|
+
"@pnpm/fetching.fetcher-base": "1100.2.9",
|
|
36
36
|
"@pnpm/fetching.types": "1100.0.3",
|
|
37
|
-
"@pnpm/fs.graceful-fs": "1100.
|
|
37
|
+
"@pnpm/fs.graceful-fs": "1100.2.0",
|
|
38
38
|
"@pnpm/fs.packlist": "1100.0.4",
|
|
39
|
-
"@pnpm/store.index": "1100.
|
|
40
|
-
"@pnpm/types": "
|
|
39
|
+
"@pnpm/store.index": "1100.3.0",
|
|
40
|
+
"@pnpm/types": "1102.1.0",
|
|
41
41
|
"@zkochan/retry": "^0.2.0",
|
|
42
42
|
"lodash.throttle": "4.1.1",
|
|
43
|
-
"p-map-values": "^0.1.0",
|
|
44
43
|
"ramda": "npm:@pnpm/ramda@0.28.1"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"@pnpm/logger": "^1100.0.0",
|
|
48
|
-
"@pnpm/worker": "^1100.
|
|
47
|
+
"@pnpm/worker": "^1100.4.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@jest/globals": "30.4.1",
|
|
52
|
-
"@pnpm/fetching.tarball-fetcher": "1102.0
|
|
51
|
+
"@pnpm/fetching.tarball-fetcher": "1102.1.0",
|
|
53
52
|
"@pnpm/logger": "1100.0.0",
|
|
54
|
-
"@pnpm/network.fetch": "1100.1.
|
|
55
|
-
"@pnpm/store.cafs-types": "1100.0
|
|
56
|
-
"@pnpm/store.create-cafs-store": "1100.0.
|
|
53
|
+
"@pnpm/network.fetch": "1100.1.14",
|
|
54
|
+
"@pnpm/store.cafs-types": "1100.1.0",
|
|
55
|
+
"@pnpm/store.create-cafs-store": "1100.0.27",
|
|
57
56
|
"@pnpm/test-fixtures": "1100.0.1",
|
|
58
57
|
"@pnpm/text.ordinal-comparator": "1100.0.0",
|
|
59
|
-
"@pnpm/types": "
|
|
58
|
+
"@pnpm/types": "1102.1.0",
|
|
60
59
|
"@types/lodash.throttle": "4.1.9",
|
|
61
60
|
"@types/ramda": "0.32.0",
|
|
62
61
|
"@types/retry": "^0.12.5",
|