@pnpm/fetching.tarball-fetcher 1102.1.5 → 1102.1.6
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 +9 -0
- package/lib/remoteTarballFetcher.js +12 -10
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -27,10 +27,12 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
27
27
|
resolve(await fetch(attempt));
|
|
28
28
|
}
|
|
29
29
|
catch (error) { // eslint-disable-line
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const status = error.response?.status;
|
|
31
|
+
const isManualRedirect = opts.redirect === 'manual' && status >= 300 && status < 400;
|
|
32
|
+
if (isManualRedirect ||
|
|
33
|
+
status === 401 ||
|
|
34
|
+
status === 403 ||
|
|
35
|
+
status === 404 ||
|
|
34
36
|
error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE' ||
|
|
35
37
|
isNonRetryableError(error)) {
|
|
36
38
|
reject(error);
|
|
@@ -109,8 +111,8 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
109
111
|
// Known size: pre-allocate and copy directly (avoids intermediate array + second copy pass)
|
|
110
112
|
data = Buffer.from(new SharedArrayBuffer(size));
|
|
111
113
|
for await (const chunk of res.body) {
|
|
112
|
-
const
|
|
113
|
-
const nextDownloaded = downloaded +
|
|
114
|
+
const bytes = chunk;
|
|
115
|
+
const nextDownloaded = downloaded + bytes.byteLength;
|
|
114
116
|
if (nextDownloaded > size) {
|
|
115
117
|
throw new BadTarballError({
|
|
116
118
|
expectedSize: size,
|
|
@@ -118,7 +120,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
118
120
|
tarballUrl: url,
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
|
-
data.set(
|
|
123
|
+
data.set(bytes, downloaded);
|
|
122
124
|
downloaded = nextDownloaded;
|
|
123
125
|
onProgress?.(downloaded);
|
|
124
126
|
}
|
|
@@ -133,9 +135,9 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
133
135
|
else {
|
|
134
136
|
const chunks = [];
|
|
135
137
|
for await (const chunk of res.body) {
|
|
136
|
-
const
|
|
137
|
-
chunks.push(
|
|
138
|
-
downloaded +=
|
|
138
|
+
const bytes = chunk;
|
|
139
|
+
chunks.push(bytes);
|
|
140
|
+
downloaded += bytes.byteLength;
|
|
139
141
|
onProgress?.(downloaded);
|
|
140
142
|
}
|
|
141
143
|
data = Buffer.from(new SharedArrayBuffer(downloaded));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fetching.tarball-fetcher",
|
|
3
|
-
"version": "1102.1.
|
|
3
|
+
"version": "1102.1.6",
|
|
4
4
|
"description": "Fetcher for packages hosted as tarballs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@pnpm/core-loggers": "1101.0.1",
|
|
33
33
|
"@pnpm/error": "1100.2.1",
|
|
34
|
-
"@pnpm/exec.prepare-package": "1100.0.
|
|
34
|
+
"@pnpm/exec.prepare-package": "1100.0.40",
|
|
35
35
|
"@pnpm/fetching.fetcher-base": "1100.2.12",
|
|
36
36
|
"@pnpm/fetching.types": "1100.0.3",
|
|
37
37
|
"@pnpm/fs.graceful-fs": "1100.2.4",
|
|
38
38
|
"@pnpm/fs.packlist": "1100.0.6",
|
|
39
|
-
"@pnpm/network.fetch": "1100.1.
|
|
40
|
-
"@pnpm/store.index": "
|
|
39
|
+
"@pnpm/network.fetch": "1100.1.20",
|
|
40
|
+
"@pnpm/store.index": "1101.0.0",
|
|
41
41
|
"@pnpm/types": "1102.1.1",
|
|
42
42
|
"@zkochan/retry": "^0.2.0",
|
|
43
43
|
"lodash.throttle": "4.1.1",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@pnpm/logger": "^1100.0.0",
|
|
48
|
-
"@pnpm/worker": "^1100.4.
|
|
48
|
+
"@pnpm/worker": "^1100.4.6"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@jest/globals": "30.4.1",
|
|
52
|
-
"@pnpm/fetching.tarball-fetcher": "1102.1.
|
|
52
|
+
"@pnpm/fetching.tarball-fetcher": "1102.1.6",
|
|
53
53
|
"@pnpm/logger": "1100.0.0",
|
|
54
54
|
"@pnpm/store.cafs-types": "1100.1.1",
|
|
55
55
|
"@pnpm/store.create-cafs-store": "1100.0.32",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/ssri": "^7.1.5",
|
|
63
63
|
"ssri": "13.0.1",
|
|
64
64
|
"tempy": "3.0.0",
|
|
65
|
-
"undici": "^7.29.
|
|
65
|
+
"undici": "^7.29.1"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=22.13"
|