@pnpm/fetching.tarball-fetcher 1102.1.4 → 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,24 @@
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
+
3
22
  ## 1102.1.4
4
23
 
5
24
  ### 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,7 +35,7 @@ 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
  }
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,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';
@@ -156,7 +155,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
156
155
  catch (err) {
157
156
  const error = isFetchTimeoutError(err)
158
157
  ? new FetchTimeoutError('FETCH_TIMEOUT', url, gotOpts.timeout, { cause: err })
159
- : util.types.isNativeError(err) ? err : new Error(String(err), { cause: err });
158
+ : isError(err) ? err : new Error(String(err), { cause: err });
160
159
  Object.assign(error, {
161
160
  attempts: currentAttempt,
162
161
  resource: url,
@@ -170,6 +169,7 @@ export function createDownloader(fetchFromRegistry, gotOpts) {
170
169
  readManifest: opts.readManifest,
171
170
  integrity: opts.integrity,
172
171
  filesIndexFile: opts.filesIndexFile,
172
+ pkgId: opts.pkgId,
173
173
  url,
174
174
  pkg: opts.pkg,
175
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.4",
3
+ "version": "1102.1.5",
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.0",
34
- "@pnpm/exec.prepare-package": "1100.0.38",
35
- "@pnpm/fetching.fetcher-base": "1100.2.11",
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.3",
38
- "@pnpm/fs.packlist": "1100.0.5",
39
- "@pnpm/network.fetch": "1100.1.18",
40
- "@pnpm/store.index": "1100.3.2",
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
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.4"
48
+ "@pnpm/worker": "^1100.4.5"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@jest/globals": "30.4.1",
52
- "@pnpm/fetching.tarball-fetcher": "1102.1.4",
52
+ "@pnpm/fetching.tarball-fetcher": "1102.1.5",
53
53
  "@pnpm/logger": "1100.0.0",
54
- "@pnpm/store.cafs-types": "1100.1.0",
55
- "@pnpm/store.create-cafs-store": "1100.0.31",
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",