@pnpm/fetching.tarball-fetcher 1102.1.4 → 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 +28 -0
- package/lib/gitHostedTarballFetcher.js +4 -2
- package/lib/index.js +1 -0
- package/lib/localTarballFetcher.js +3 -2
- package/lib/remoteTarballFetcher.d.ts +1 -0
- package/lib/remoteTarballFetcher.js +15 -13
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @pnpm/tarball-fetcher
|
|
2
2
|
|
|
3
|
+
## 1102.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @pnpm/exec.prepare-package@1100.0.40
|
|
9
|
+
- @pnpm/network.fetch@1100.1.20
|
|
10
|
+
- @pnpm/store.index@1101.0.0
|
|
11
|
+
|
|
12
|
+
## 1102.1.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- A tarball whose integrity pnpm computed during download is now found in the store on the next install. Before, that install downloaded the tarball again once the lockfile recorded the integrity [#12562](https://github.com/pnpm/pnpm/issues/12562).
|
|
17
|
+
|
|
18
|
+
- Local tarball dependencies using the file protocol are no longer counted as downloaded in the progress banner [pnpm/pnpm#1103](https://github.com/pnpm/pnpm/issues/1103).
|
|
19
|
+
|
|
20
|
+
- `pnpm install` now works in StackBlitz WebContainers on projects without a lockfile. It used to fail there with `ENOENT ... pnpm-lock.yaml`, because pnpm did not recognize the errors that WebContainers return from asynchronous file system calls [#15649](https://github.com/pnpm/pnpm/issues/15649).
|
|
21
|
+
|
|
22
|
+
- Updated dependencies:
|
|
23
|
+
- @pnpm/error@1100.2.1
|
|
24
|
+
- @pnpm/exec.prepare-package@1100.0.39
|
|
25
|
+
- @pnpm/fetching.fetcher-base@1100.2.12
|
|
26
|
+
- @pnpm/fs.graceful-fs@1100.2.4
|
|
27
|
+
- @pnpm/fs.packlist@1100.0.6
|
|
28
|
+
- @pnpm/network.fetch@1100.1.19
|
|
29
|
+
- @pnpm/store.index@1100.3.3
|
|
30
|
+
|
|
3
31
|
## 1102.1.4
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
|
-
import
|
|
2
|
+
import { isError } from '@pnpm/error';
|
|
3
3
|
import { preparePackage } from '@pnpm/exec.prepare-package';
|
|
4
4
|
import { packlist } from '@pnpm/fs.packlist';
|
|
5
5
|
import { globalWarn } from '@pnpm/logger';
|
|
@@ -11,6 +11,8 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
|
|
|
11
11
|
const { filesMap, manifest, requiresBuild, integrity } = await fetchRemoteTarball(cafs, resolution, {
|
|
12
12
|
...opts,
|
|
13
13
|
filesIndexFile: rawFilesIndexFile,
|
|
14
|
+
// The raw archive is not the prepared package, so it must not be indexed under the package's integrity key.
|
|
15
|
+
pkgResolutionId: undefined,
|
|
14
16
|
});
|
|
15
17
|
// Flush any queued store index writes so that the raw files index entry
|
|
16
18
|
// written during tarball extraction is visible to subsequent reads.
|
|
@@ -33,7 +35,7 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
|
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
catch (err) {
|
|
36
|
-
assert(
|
|
38
|
+
assert(isError(err));
|
|
37
39
|
err.message = `Failed to prepare git-hosted package fetched from "${resolution.tarball}": ${err.message}`;
|
|
38
40
|
throw err;
|
|
39
41
|
}
|
package/lib/index.js
CHANGED
|
@@ -46,6 +46,7 @@ async function fetchFromTarball(ctx, cafs, resolution, opts) {
|
|
|
46
46
|
registry: resolution.registry,
|
|
47
47
|
filesIndexFile: opts.filesIndexFile,
|
|
48
48
|
pkg: opts.pkg,
|
|
49
|
+
pkgId: opts.pkgResolutionId,
|
|
49
50
|
redirect: resolution.revision == null ? undefined : 'manual',
|
|
50
51
|
retry: resolution.revision == null ? undefined : { retries: 0 },
|
|
51
52
|
appendManifest: opts.appendManifest,
|
|
@@ -3,10 +3,10 @@ import gfs from '@pnpm/fs.graceful-fs';
|
|
|
3
3
|
import { addFilesFromTarball } from '@pnpm/worker';
|
|
4
4
|
const isAbsolutePath = /^\/|^[A-Z]:/i;
|
|
5
5
|
export function createLocalTarballFetcher(storeIndex) {
|
|
6
|
-
const fetch = (cafs, resolution, opts) => {
|
|
6
|
+
const fetch = async (cafs, resolution, opts) => {
|
|
7
7
|
const tarball = resolvePath(opts.lockfileDir, resolution.tarball.slice(5));
|
|
8
8
|
const buffer = gfs.readFileSync(tarball);
|
|
9
|
-
|
|
9
|
+
const result = await addFilesFromTarball({
|
|
10
10
|
storeDir: cafs.storeDir,
|
|
11
11
|
storeIndex,
|
|
12
12
|
buffer,
|
|
@@ -18,6 +18,7 @@ export function createLocalTarballFetcher(storeIndex) {
|
|
|
18
18
|
appendManifest: opts.appendManifest,
|
|
19
19
|
ignoreFilePattern: opts.ignoreFilePattern,
|
|
20
20
|
});
|
|
21
|
+
return { ...result, local: true };
|
|
21
22
|
};
|
|
22
23
|
return fetch;
|
|
23
24
|
}
|
|
@@ -17,6 +17,7 @@ export type DownloadOptions = {
|
|
|
17
17
|
retry?: Pick<RetryTimeoutOptions, 'retries'>;
|
|
18
18
|
storeIndex: StoreIndex;
|
|
19
19
|
pkg?: FetchOptions['pkg'];
|
|
20
|
+
pkgId?: string;
|
|
20
21
|
} & Pick<FetchOptions, 'appendManifest' | 'readManifest' | 'filesIndexFile' | 'ignoreFilePattern'>;
|
|
21
22
|
export type DownloadFunction = (url: string, opts: DownloadOptions) => Promise<FetchResult>;
|
|
22
23
|
export interface NpmRegistryClient {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isIP } from 'node:net';
|
|
2
|
-
import util from 'node:util';
|
|
3
2
|
import { requestRetryLogger } from '@pnpm/core-loggers';
|
|
4
|
-
import { FetchError, FetchTimeoutError, isFetchTimeoutError, redactUrlForDisplay } from '@pnpm/error';
|
|
3
|
+
import { FetchError, FetchTimeoutError, isError, isFetchTimeoutError, redactUrlForDisplay } from '@pnpm/error';
|
|
5
4
|
import { globalWarn } from '@pnpm/logger';
|
|
6
5
|
import { isNonRetryableError } from '@pnpm/network.fetch';
|
|
7
6
|
import { addFilesFromTarball } from '@pnpm/worker';
|
|
@@ -28,10 +27,12 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
28
27
|
resolve(await fetch(attempt));
|
|
29
28
|
}
|
|
30
29
|
catch (error) { // eslint-disable-line
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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 ||
|
|
35
36
|
error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE' ||
|
|
36
37
|
isNonRetryableError(error)) {
|
|
37
38
|
reject(error);
|
|
@@ -110,8 +111,8 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
110
111
|
// Known size: pre-allocate and copy directly (avoids intermediate array + second copy pass)
|
|
111
112
|
data = Buffer.from(new SharedArrayBuffer(size));
|
|
112
113
|
for await (const chunk of res.body) {
|
|
113
|
-
const
|
|
114
|
-
const nextDownloaded = downloaded +
|
|
114
|
+
const bytes = chunk;
|
|
115
|
+
const nextDownloaded = downloaded + bytes.byteLength;
|
|
115
116
|
if (nextDownloaded > size) {
|
|
116
117
|
throw new BadTarballError({
|
|
117
118
|
expectedSize: size,
|
|
@@ -119,7 +120,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
119
120
|
tarballUrl: url,
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
|
-
data.set(
|
|
123
|
+
data.set(bytes, downloaded);
|
|
123
124
|
downloaded = nextDownloaded;
|
|
124
125
|
onProgress?.(downloaded);
|
|
125
126
|
}
|
|
@@ -134,9 +135,9 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
134
135
|
else {
|
|
135
136
|
const chunks = [];
|
|
136
137
|
for await (const chunk of res.body) {
|
|
137
|
-
const
|
|
138
|
-
chunks.push(
|
|
139
|
-
downloaded +=
|
|
138
|
+
const bytes = chunk;
|
|
139
|
+
chunks.push(bytes);
|
|
140
|
+
downloaded += bytes.byteLength;
|
|
140
141
|
onProgress?.(downloaded);
|
|
141
142
|
}
|
|
142
143
|
data = Buffer.from(new SharedArrayBuffer(downloaded));
|
|
@@ -156,7 +157,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
156
157
|
catch (err) {
|
|
157
158
|
const error = isFetchTimeoutError(err)
|
|
158
159
|
? new FetchTimeoutError('FETCH_TIMEOUT', url, gotOpts.timeout, { cause: err })
|
|
159
|
-
:
|
|
160
|
+
: isError(err) ? err : new Error(String(err), { cause: err });
|
|
160
161
|
Object.assign(error, {
|
|
161
162
|
attempts: currentAttempt,
|
|
162
163
|
resource: url,
|
|
@@ -170,6 +171,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
|
|
|
170
171
|
readManifest: opts.readManifest,
|
|
171
172
|
integrity: opts.integrity,
|
|
172
173
|
filesIndexFile: opts.filesIndexFile,
|
|
174
|
+
pkgId: opts.pkgId,
|
|
173
175
|
url,
|
|
174
176
|
pkg: opts.pkg,
|
|
175
177
|
appendManifest: opts.appendManifest,
|
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",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@pnpm/core-loggers": "1101.0.1",
|
|
33
|
-
"@pnpm/error": "1100.2.
|
|
34
|
-
"@pnpm/exec.prepare-package": "1100.0.
|
|
35
|
-
"@pnpm/fetching.fetcher-base": "1100.2.
|
|
33
|
+
"@pnpm/error": "1100.2.1",
|
|
34
|
+
"@pnpm/exec.prepare-package": "1100.0.40",
|
|
35
|
+
"@pnpm/fetching.fetcher-base": "1100.2.12",
|
|
36
36
|
"@pnpm/fetching.types": "1100.0.3",
|
|
37
|
-
"@pnpm/fs.graceful-fs": "1100.2.
|
|
38
|
-
"@pnpm/fs.packlist": "1100.0.
|
|
39
|
-
"@pnpm/network.fetch": "1100.1.
|
|
40
|
-
"@pnpm/store.index": "
|
|
37
|
+
"@pnpm/fs.graceful-fs": "1100.2.4",
|
|
38
|
+
"@pnpm/fs.packlist": "1100.0.6",
|
|
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,14 +45,14 @@
|
|
|
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
|
-
"@pnpm/store.cafs-types": "1100.1.
|
|
55
|
-
"@pnpm/store.create-cafs-store": "1100.0.
|
|
54
|
+
"@pnpm/store.cafs-types": "1100.1.1",
|
|
55
|
+
"@pnpm/store.create-cafs-store": "1100.0.32",
|
|
56
56
|
"@pnpm/test-fixtures": "1100.0.1",
|
|
57
57
|
"@pnpm/text.ordinal-comparator": "1100.0.0",
|
|
58
58
|
"@pnpm/types": "1102.1.1",
|
|
@@ -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"
|