@pnpm/store.pkg-finder 1100.0.4 → 1100.0.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/lib/index.d.ts CHANGED
@@ -10,10 +10,18 @@ export interface ReadPackageFileMapOptions {
10
10
  * Reads the file index for a package and returns a `Map<string, string>`
11
11
  * mapping filenames to absolute paths on disk.
12
12
  *
13
- * Handles three types of package resolutions:
14
- * - Directory packages: fetches the file list from the local directory
15
- * - Packages with integrity: looks up the index file in the CAFS by integrity hash
16
- * - Tarball packages: looks up the index file by package directory name
13
+ * Picks the store key by resolution shape:
14
+ * - Directory packages: fetches the file list from the local directory.
15
+ * - Git-hosted tarballs (codeload.github.com / gitlab.com / bitbucket.org):
16
+ * keyed by `gitHostedStoreIndexKey(packageId, { built: true })`. The
17
+ * lockfile pins their integrity for security, but the cached payload
18
+ * depends on whether build scripts ran during fetch (preparePackage), so
19
+ * the `built` dimension is part of the key. Folding them under the
20
+ * integrity-only key would collapse that distinction.
21
+ * - npm-registry tarballs with integrity: keyed by
22
+ * `storeIndexKey(integrity, packageId)`.
23
+ * - Other tarball / git resolutions without integrity: keyed by
24
+ * `gitHostedStoreIndexKey(packageId, { built: true })`.
17
25
  *
18
26
  * For CAFS packages, the content-addressed digests are resolved to file
19
27
  * paths upfront, so callers get a uniform map regardless of resolution type.
package/lib/index.js CHANGED
@@ -1,16 +1,23 @@
1
1
  import path from 'node:path';
2
- import { parse } from '@pnpm/deps.path';
3
2
  import { fetchFromDir } from '@pnpm/fetching.directory-fetcher';
4
3
  import { getFilePathByModeInCafs } from '@pnpm/store.cafs';
5
- import { gitHostedStoreIndexKey, storeIndexKey } from '@pnpm/store.index';
4
+ import { pickStoreIndexKey } from '@pnpm/store.index';
6
5
  /**
7
6
  * Reads the file index for a package and returns a `Map<string, string>`
8
7
  * mapping filenames to absolute paths on disk.
9
8
  *
10
- * Handles three types of package resolutions:
11
- * - Directory packages: fetches the file list from the local directory
12
- * - Packages with integrity: looks up the index file in the CAFS by integrity hash
13
- * - Tarball packages: looks up the index file by package directory name
9
+ * Picks the store key by resolution shape:
10
+ * - Directory packages: fetches the file list from the local directory.
11
+ * - Git-hosted tarballs (codeload.github.com / gitlab.com / bitbucket.org):
12
+ * keyed by `gitHostedStoreIndexKey(packageId, { built: true })`. The
13
+ * lockfile pins their integrity for security, but the cached payload
14
+ * depends on whether build scripts ran during fetch (preparePackage), so
15
+ * the `built` dimension is part of the key. Folding them under the
16
+ * integrity-only key would collapse that distinction.
17
+ * - npm-registry tarballs with integrity: keyed by
18
+ * `storeIndexKey(integrity, packageId)`.
19
+ * - Other tarball / git resolutions without integrity: keyed by
20
+ * `gitHostedStoreIndexKey(packageId, { built: true })`.
14
21
  *
15
22
  * For CAFS packages, the content-addressed digests are resolved to file
16
23
  * paths upfront, so callers get a uniform map regardless of resolution type.
@@ -26,17 +33,10 @@ export async function readPackageFileMap(packageResolution, packageId, opts) {
26
33
  const localInfo = await fetchFromDir(path.join(opts.lockfileDir, packageResolution.directory), {});
27
34
  return localInfo.filesMap;
28
35
  }
29
- const isPackageWithIntegrity = 'integrity' in packageResolution;
30
36
  let pkgIndexFilePath;
31
- if (isPackageWithIntegrity) {
32
- const parsedId = parse(packageId);
33
- pkgIndexFilePath = storeIndexKey(packageResolution.integrity, parsedId.nonSemverVersion ?? `${parsedId.name}@${parsedId.version}`);
34
- }
35
- else if (!packageResolution.type && 'tarball' in packageResolution && packageResolution.tarball) {
36
- pkgIndexFilePath = gitHostedStoreIndexKey(packageId, { built: true });
37
- }
38
- else if (packageResolution.type === 'git') {
39
- pkgIndexFilePath = gitHostedStoreIndexKey(packageId, { built: true });
37
+ if ((!packageResolution.type && 'tarball' in packageResolution && packageResolution.tarball) ||
38
+ packageResolution.type === 'git') {
39
+ pkgIndexFilePath = pickStoreIndexKey(packageResolution, packageId, { built: true });
40
40
  }
41
41
  else {
42
42
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/store.pkg-finder",
3
- "version": "1100.0.4",
3
+ "version": "1100.0.6",
4
4
  "description": "Read a package's file map from the content-addressable store",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -24,14 +24,14 @@
24
24
  "!*.map"
25
25
  ],
26
26
  "dependencies": {
27
- "@pnpm/deps.path": "1100.0.1",
28
- "@pnpm/fetching.directory-fetcher": "1100.0.4",
29
- "@pnpm/store.cafs": "1100.1.0",
30
- "@pnpm/resolving.resolver-base": "1100.1.0",
27
+ "@pnpm/fetching.directory-fetcher": "1100.0.6",
28
+ "@pnpm/resolving.resolver-base": "1100.1.2",
29
+ "@pnpm/store.cafs": "1100.1.2",
31
30
  "@pnpm/store.index": "1100.0.0"
32
31
  },
33
32
  "devDependencies": {
34
- "@pnpm/store.pkg-finder": "1100.0.4"
33
+ "@jest/globals": "30.3.0",
34
+ "@pnpm/store.pkg-finder": "1100.0.6"
35
35
  },
36
36
  "engines": {
37
37
  "node": ">=22.13"