@pnpm/fetching.tarball-fetcher 1102.0.15 → 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 CHANGED
@@ -1,5 +1,23 @@
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
+
3
21
  ## 1102.0.15
4
22
 
5
23
  ### 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'>;
@@ -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 op = retry.operation(retryOpts);
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 === 401 ||
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: retryOpts.retries,
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fetching.tarball-fetcher",
3
- "version": "1102.0.15",
3
+ "version": "1102.1.0",
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.3",
32
+ "@pnpm/core-loggers": "1100.3.4",
33
33
  "@pnpm/error": "1100.1.3",
34
- "@pnpm/exec.prepare-package": "1100.0.33",
35
- "@pnpm/fetching.fetcher-base": "1100.2.8",
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.1.1",
37
+ "@pnpm/fs.graceful-fs": "1100.2.0",
38
38
  "@pnpm/fs.packlist": "1100.0.4",
39
- "@pnpm/store.index": "1100.2.5",
40
- "@pnpm/types": "1102.0.0",
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
43
  "ramda": "npm:@pnpm/ramda@0.28.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@pnpm/logger": "^1100.0.0",
47
- "@pnpm/worker": "^1100.3.0"
47
+ "@pnpm/worker": "^1100.4.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@jest/globals": "30.4.1",
51
- "@pnpm/fetching.tarball-fetcher": "1102.0.15",
51
+ "@pnpm/fetching.tarball-fetcher": "1102.1.0",
52
52
  "@pnpm/logger": "1100.0.0",
53
- "@pnpm/network.fetch": "1100.1.13",
54
- "@pnpm/store.cafs-types": "1100.0.2",
55
- "@pnpm/store.create-cafs-store": "1100.0.26",
53
+ "@pnpm/network.fetch": "1100.1.14",
54
+ "@pnpm/store.cafs-types": "1100.1.0",
55
+ "@pnpm/store.create-cafs-store": "1100.0.27",
56
56
  "@pnpm/test-fixtures": "1100.0.1",
57
57
  "@pnpm/text.ordinal-comparator": "1100.0.0",
58
- "@pnpm/types": "1102.0.0",
58
+ "@pnpm/types": "1102.1.0",
59
59
  "@types/lodash.throttle": "4.1.9",
60
60
  "@types/ramda": "0.32.0",
61
61
  "@types/retry": "^0.12.5",