@pnpm/fetching.tarball-fetcher 1102.1.3 → 1102.1.5

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 CHANGED
@@ -1,5 +1,45 @@
1
1
  # @pnpm/tarball-fetcher
2
2
 
3
+ ## 1102.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 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).
8
+
9
+ - 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).
10
+
11
+ - `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).
12
+
13
+ - Updated dependencies:
14
+ - @pnpm/error@1100.2.1
15
+ - @pnpm/exec.prepare-package@1100.0.39
16
+ - @pnpm/fetching.fetcher-base@1100.2.12
17
+ - @pnpm/fs.graceful-fs@1100.2.4
18
+ - @pnpm/fs.packlist@1100.0.6
19
+ - @pnpm/network.fetch@1100.1.19
20
+ - @pnpm/store.index@1100.3.3
21
+
22
+ ## 1102.1.4
23
+
24
+ ### Patch Changes
25
+
26
+ - `pnpm install` now fails at once when a registry or tarball server presents a TLS certificate that fails verification, such as a self-signed or expired one. The error names the certificate problem. Such requests were retried for more than a minute [#9134](https://github.com/pnpm/pnpm/issues/9134).
27
+
28
+ - `pnpm import` and fresh resolutions now record `integrity` for git-hosted tarballs, such as `codeload.github.com` URLs, even when the tarball is already in the store [#13338](https://github.com/pnpm/pnpm/issues/13338).
29
+
30
+ - When the registry stops sending data for longer than `fetchTimeout`, pnpm now reports that the metadata or tarball request timed out. Previously the error did not mention the timeout [#3646](https://github.com/pnpm/pnpm/issues/3646).
31
+
32
+ - Updated dependencies:
33
+ - @pnpm/core-loggers@1101.0.1
34
+ - @pnpm/error@1100.2.0
35
+ - @pnpm/exec.prepare-package@1100.0.38
36
+ - @pnpm/fetching.fetcher-base@1100.2.11
37
+ - @pnpm/fs.graceful-fs@1100.2.3
38
+ - @pnpm/fs.packlist@1100.0.5
39
+ - @pnpm/network.fetch@1100.1.18
40
+ - @pnpm/store.index@1100.3.2
41
+ - @pnpm/types@1102.1.1
42
+
3
43
  ## 1102.1.3
4
44
 
5
45
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert';
2
- import util from 'node:util';
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,12 +35,14 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
33
35
  };
34
36
  }
35
37
  catch (err) {
36
- assert(util.types.isNativeError(err));
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
  }
40
42
  };
41
- return fetch;
43
+ return Object.assign(fetch, {
44
+ resolutionNeedsFetch: fetchRemoteTarball.resolutionNeedsFetch?.bind(fetchRemoteTarball),
45
+ });
42
46
  }
43
47
  async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndexFile, opts, fetcherOpts, resolution) {
44
48
  const tempLocation = await cafs.tempDir();
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
- return addFilesFromTarball({
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,8 +1,8 @@
1
1
  import { isIP } from 'node:net';
2
- import util from 'node:util';
3
2
  import { requestRetryLogger } from '@pnpm/core-loggers';
4
- import { FetchError, redactUrlForDisplay } from '@pnpm/error';
3
+ import { FetchError, FetchTimeoutError, isError, isFetchTimeoutError, redactUrlForDisplay } from '@pnpm/error';
5
4
  import { globalWarn } from '@pnpm/logger';
5
+ import { isNonRetryableError } from '@pnpm/network.fetch';
6
6
  import { addFilesFromTarball } from '@pnpm/worker';
7
7
  import * as retry from '@zkochan/retry';
8
8
  import throttle from 'lodash.throttle';
@@ -31,7 +31,8 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
31
31
  error.response?.status === 401 ||
32
32
  error.response?.status === 403 ||
33
33
  error.response?.status === 404 ||
34
- error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE') {
34
+ error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE' ||
35
+ isNonRetryableError(error)) {
35
36
  reject(error);
36
37
  return;
37
38
  }
@@ -152,7 +153,9 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
152
153
  }
153
154
  }
154
155
  catch (err) {
155
- const error = util.types.isNativeError(err) ? err : new Error(String(err), { cause: err });
156
+ const error = isFetchTimeoutError(err)
157
+ ? new FetchTimeoutError('FETCH_TIMEOUT', url, gotOpts.timeout, { cause: err })
158
+ : isError(err) ? err : new Error(String(err), { cause: err });
156
159
  Object.assign(error, {
157
160
  attempts: currentAttempt,
158
161
  resource: url,
@@ -166,6 +169,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
166
169
  readManifest: opts.readManifest,
167
170
  integrity: opts.integrity,
168
171
  filesIndexFile: opts.filesIndexFile,
172
+ pkgId: opts.pkgId,
169
173
  url,
170
174
  pkg: opts.pkg,
171
175
  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",
3
+ "version": "1102.1.5",
4
4
  "description": "Fetcher for packages hosted as tarballs",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,33 +29,33 @@
29
29
  "!*.map"
30
30
  ],
31
31
  "dependencies": {
32
- "@pnpm/core-loggers": "1101.0.0",
33
- "@pnpm/error": "1100.1.4",
34
- "@pnpm/exec.prepare-package": "1100.0.37",
35
- "@pnpm/fetching.fetcher-base": "1100.2.10",
32
+ "@pnpm/core-loggers": "1101.0.1",
33
+ "@pnpm/error": "1100.2.1",
34
+ "@pnpm/exec.prepare-package": "1100.0.39",
35
+ "@pnpm/fetching.fetcher-base": "1100.2.12",
36
36
  "@pnpm/fetching.types": "1100.0.3",
37
- "@pnpm/fs.graceful-fs": "1100.2.2",
38
- "@pnpm/fs.packlist": "1100.0.4",
39
- "@pnpm/store.index": "1100.3.1",
40
- "@pnpm/types": "1102.1.0",
37
+ "@pnpm/fs.graceful-fs": "1100.2.4",
38
+ "@pnpm/fs.packlist": "1100.0.6",
39
+ "@pnpm/network.fetch": "1100.1.19",
40
+ "@pnpm/store.index": "1100.3.3",
41
+ "@pnpm/types": "1102.1.1",
41
42
  "@zkochan/retry": "^0.2.0",
42
43
  "lodash.throttle": "4.1.1",
43
44
  "ramda": "npm:@pnpm/ramda@0.28.1"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "@pnpm/logger": "^1100.0.0",
47
- "@pnpm/worker": "^1100.4.3"
48
+ "@pnpm/worker": "^1100.4.5"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@jest/globals": "30.4.1",
51
- "@pnpm/fetching.tarball-fetcher": "1102.1.3",
52
+ "@pnpm/fetching.tarball-fetcher": "1102.1.5",
52
53
  "@pnpm/logger": "1100.0.0",
53
- "@pnpm/network.fetch": "1100.1.17",
54
- "@pnpm/store.cafs-types": "1100.1.0",
55
- "@pnpm/store.create-cafs-store": "1100.0.30",
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
- "@pnpm/types": "1102.1.0",
58
+ "@pnpm/types": "1102.1.1",
59
59
  "@types/lodash.throttle": "4.1.9",
60
60
  "@types/ramda": "0.32.0",
61
61
  "@types/retry": "^0.12.5",