@pnpm/fetching.tarball-fetcher 1102.1.2 → 1102.1.4

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,38 @@
1
1
  # @pnpm/tarball-fetcher
2
2
 
3
+ ## 1102.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - `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).
8
+
9
+ - `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).
10
+
11
+ - 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).
12
+
13
+ - Updated dependencies:
14
+ - @pnpm/core-loggers@1101.0.1
15
+ - @pnpm/error@1100.2.0
16
+ - @pnpm/exec.prepare-package@1100.0.38
17
+ - @pnpm/fetching.fetcher-base@1100.2.11
18
+ - @pnpm/fs.graceful-fs@1100.2.3
19
+ - @pnpm/fs.packlist@1100.0.5
20
+ - @pnpm/network.fetch@1100.1.18
21
+ - @pnpm/store.index@1100.3.2
22
+ - @pnpm/types@1102.1.1
23
+
24
+ ## 1102.1.3
25
+
26
+ ### Patch Changes
27
+
28
+ - `pnpm install` now installs git-hosted dependencies without preparing them when their builds are explicitly denied by `allowBuilds`. Dependencies that require preparation still need an explicit allow or deny decision [pnpm/pnpm#10522](https://github.com/pnpm/pnpm/issues/10522).
29
+
30
+ - Updated dependencies:
31
+ - @pnpm/core-loggers@1101.0.0
32
+ - @pnpm/exec.prepare-package@1100.0.37
33
+ - @pnpm/fetching.fetcher-base@1100.2.10
34
+ - @pnpm/fs.graceful-fs@1100.2.2
35
+
3
36
  ## 1102.1.2
4
37
 
5
38
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import type { FetchFunction } from '@pnpm/fetching.fetcher-base';
2
- import type { StoreIndex } from '@pnpm/store.index';
2
+ import { type StoreIndex } from '@pnpm/store.index';
3
3
  export interface CreateGitHostedTarballFetcher {
4
4
  ignoreScripts?: boolean;
5
5
  storeIndex: StoreIndex;
@@ -3,6 +3,7 @@ import util from 'node:util';
3
3
  import { preparePackage } from '@pnpm/exec.prepare-package';
4
4
  import { packlist } from '@pnpm/fs.packlist';
5
5
  import { globalWarn } from '@pnpm/logger';
6
+ import { gitHostedStoreIndexKey } from '@pnpm/store.index';
6
7
  import { addFilesFromDir } from '@pnpm/worker';
7
8
  export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
8
9
  const fetch = async (cafs, resolution, opts) => {
@@ -20,10 +21,12 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
20
21
  globalWarn(`The git-hosted package fetched from "${resolution.tarball}" has to be built but the build scripts were ignored.`);
21
22
  }
22
23
  return {
24
+ filesIndexFile: prepareResult.filesIndexFile,
23
25
  filesMap: prepareResult.filesMap,
24
26
  manifest: prepareResult.manifest ?? manifest,
25
27
  requiresBuild,
26
28
  requiresPrepare: prepareResult.requiresPrepare,
29
+ ignoredBuild: prepareResult.ignoredBuild,
27
30
  // Propagate the raw tarball integrity so the lockfile pins it and
28
31
  // future installs detect a tampered tarball from the git host.
29
32
  integrity,
@@ -35,7 +38,9 @@ export function createGitHostedTarballFetcher(fetchRemoteTarball, fetcherOpts) {
35
38
  throw err;
36
39
  }
37
40
  };
38
- return fetch;
41
+ return Object.assign(fetch, {
42
+ resolutionNeedsFetch: fetchRemoteTarball.resolutionNeedsFetch?.bind(fetchRemoteTarball),
43
+ });
39
44
  }
40
45
  async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndexFile, opts, fetcherOpts, resolution) {
41
46
  const tempLocation = await cafs.tempDir();
@@ -47,33 +52,31 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
47
52
  },
48
53
  force: true,
49
54
  });
50
- const { shouldBeBuilt, pkgDir } = await preparePackage({
55
+ const { shouldBeBuilt, pkgDir, ignoredBuild = false } = await preparePackage({
51
56
  ...opts,
52
57
  allowBuild: fetcherOpts.allowBuild,
53
58
  pkgResolutionId: fetcherOpts.pkgResolutionId ?? createGitHostedTarballPkgResolutionId(resolution),
54
59
  }, tempLocation, resolution.path ?? '');
60
+ if (shouldBeBuilt && ((ignoredBuild && !opts.ignoreScripts) || (!ignoredBuild && filesIndexFile.endsWith('\tnot-built')))) {
61
+ filesIndexFile = gitHostedStoreIndexKey(fetcherOpts.pkgResolutionId ?? createGitHostedTarballPkgResolutionId(resolution), { built: !ignoredBuild });
62
+ }
55
63
  const files = await packlist(pkgDir);
56
64
  const { storeIndex } = opts;
57
65
  if (!resolution.path && files.length === filesMap.size) {
58
- if (!shouldBeBuilt) {
59
- const data = storeIndex.get(rawFilesIndexFile);
60
- if (data) {
61
- data.requiresPrepare = false;
62
- storeIndex.set(filesIndexFile, data);
63
- storeIndex.delete(rawFilesIndexFile);
66
+ if (!shouldBeBuilt || ignoredBuild) {
67
+ if (!ignoredBuild || !opts.ignoreScripts) {
68
+ const data = storeIndex.get(rawFilesIndexFile);
69
+ if (data) {
70
+ data.requiresPrepare = shouldBeBuilt;
71
+ storeIndex.set(filesIndexFile, data);
72
+ }
64
73
  }
65
- return {
66
- filesMap,
67
- ignoredBuild: false,
68
- requiresPrepare: false,
69
- };
70
- }
71
- if (opts.ignoreScripts) {
72
74
  storeIndex.delete(rawFilesIndexFile);
73
75
  return {
76
+ filesIndexFile,
74
77
  filesMap,
75
- ignoredBuild: true,
76
- requiresPrepare: true,
78
+ ignoredBuild,
79
+ requiresPrepare: shouldBeBuilt,
77
80
  };
78
81
  }
79
82
  }
@@ -82,6 +85,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
82
85
  // Even though we have the index of the package,
83
86
  // the linking of files to the store is in progress.
84
87
  return {
88
+ filesIndexFile,
85
89
  ...await addFilesFromDir({
86
90
  storeDir: cafs.storeDir,
87
91
  storeIndex: opts.storeIndex,
@@ -92,7 +96,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
92
96
  readManifest: fetcherOpts.readManifest,
93
97
  requiresPrepare: shouldBeBuilt,
94
98
  }),
95
- ignoredBuild: Boolean(opts.ignoreScripts),
99
+ ignoredBuild,
96
100
  requiresPrepare: shouldBeBuilt,
97
101
  };
98
102
  }
@@ -1,8 +1,9 @@
1
1
  import { isIP } from 'node:net';
2
2
  import util from 'node:util';
3
3
  import { requestRetryLogger } from '@pnpm/core-loggers';
4
- import { FetchError, redactUrlForDisplay } from '@pnpm/error';
4
+ import { FetchError, FetchTimeoutError, isFetchTimeoutError, redactUrlForDisplay } from '@pnpm/error';
5
5
  import { globalWarn } from '@pnpm/logger';
6
+ import { isNonRetryableError } from '@pnpm/network.fetch';
6
7
  import { addFilesFromTarball } from '@pnpm/worker';
7
8
  import * as retry from '@zkochan/retry';
8
9
  import throttle from 'lodash.throttle';
@@ -31,7 +32,8 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
31
32
  error.response?.status === 401 ||
32
33
  error.response?.status === 403 ||
33
34
  error.response?.status === 404 ||
34
- error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE') {
35
+ error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE' ||
36
+ isNonRetryableError(error)) {
35
37
  reject(error);
36
38
  return;
37
39
  }
@@ -152,7 +154,9 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
152
154
  }
153
155
  }
154
156
  catch (err) {
155
- const error = util.types.isNativeError(err) ? err : new Error(String(err), { cause: err });
157
+ const error = isFetchTimeoutError(err)
158
+ ? new FetchTimeoutError('FETCH_TIMEOUT', url, gotOpts.timeout, { cause: err })
159
+ : util.types.isNativeError(err) ? err : new Error(String(err), { cause: err });
156
160
  Object.assign(error, {
157
161
  attempts: currentAttempt,
158
162
  resource: url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fetching.tarball-fetcher",
3
- "version": "1102.1.2",
3
+ "version": "1102.1.4",
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": "1100.3.4",
33
- "@pnpm/error": "1100.1.4",
34
- "@pnpm/exec.prepare-package": "1100.0.36",
35
- "@pnpm/fetching.fetcher-base": "1100.2.9",
32
+ "@pnpm/core-loggers": "1101.0.1",
33
+ "@pnpm/error": "1100.2.0",
34
+ "@pnpm/exec.prepare-package": "1100.0.38",
35
+ "@pnpm/fetching.fetcher-base": "1100.2.11",
36
36
  "@pnpm/fetching.types": "1100.0.3",
37
- "@pnpm/fs.graceful-fs": "1100.2.1",
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.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",
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.2"
48
+ "@pnpm/worker": "^1100.4.4"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@jest/globals": "30.4.1",
51
- "@pnpm/fetching.tarball-fetcher": "1102.1.2",
52
+ "@pnpm/fetching.tarball-fetcher": "1102.1.4",
52
53
  "@pnpm/logger": "1100.0.0",
53
- "@pnpm/network.fetch": "1100.1.16",
54
54
  "@pnpm/store.cafs-types": "1100.1.0",
55
- "@pnpm/store.create-cafs-store": "1100.0.29",
55
+ "@pnpm/store.create-cafs-store": "1100.0.31",
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",