@pnpm/fetching.tarball-fetcher 1102.1.2 → 1102.1.3

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,17 @@
1
1
  # @pnpm/tarball-fetcher
2
2
 
3
+ ## 1102.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - `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).
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/core-loggers@1101.0.0
11
+ - @pnpm/exec.prepare-package@1100.0.37
12
+ - @pnpm/fetching.fetcher-base@1100.2.10
13
+ - @pnpm/fs.graceful-fs@1100.2.2
14
+
3
15
  ## 1102.1.2
4
16
 
5
17
  ### 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,
@@ -47,33 +50,31 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
47
50
  },
48
51
  force: true,
49
52
  });
50
- const { shouldBeBuilt, pkgDir } = await preparePackage({
53
+ const { shouldBeBuilt, pkgDir, ignoredBuild = false } = await preparePackage({
51
54
  ...opts,
52
55
  allowBuild: fetcherOpts.allowBuild,
53
56
  pkgResolutionId: fetcherOpts.pkgResolutionId ?? createGitHostedTarballPkgResolutionId(resolution),
54
57
  }, tempLocation, resolution.path ?? '');
58
+ if (shouldBeBuilt && ((ignoredBuild && !opts.ignoreScripts) || (!ignoredBuild && filesIndexFile.endsWith('\tnot-built')))) {
59
+ filesIndexFile = gitHostedStoreIndexKey(fetcherOpts.pkgResolutionId ?? createGitHostedTarballPkgResolutionId(resolution), { built: !ignoredBuild });
60
+ }
55
61
  const files = await packlist(pkgDir);
56
62
  const { storeIndex } = opts;
57
63
  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);
64
+ if (!shouldBeBuilt || ignoredBuild) {
65
+ if (!ignoredBuild || !opts.ignoreScripts) {
66
+ const data = storeIndex.get(rawFilesIndexFile);
67
+ if (data) {
68
+ data.requiresPrepare = shouldBeBuilt;
69
+ storeIndex.set(filesIndexFile, data);
70
+ }
64
71
  }
65
- return {
66
- filesMap,
67
- ignoredBuild: false,
68
- requiresPrepare: false,
69
- };
70
- }
71
- if (opts.ignoreScripts) {
72
72
  storeIndex.delete(rawFilesIndexFile);
73
73
  return {
74
+ filesIndexFile,
74
75
  filesMap,
75
- ignoredBuild: true,
76
- requiresPrepare: true,
76
+ ignoredBuild,
77
+ requiresPrepare: shouldBeBuilt,
77
78
  };
78
79
  }
79
80
  }
@@ -82,6 +83,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
82
83
  // Even though we have the index of the package,
83
84
  // the linking of files to the store is in progress.
84
85
  return {
86
+ filesIndexFile,
85
87
  ...await addFilesFromDir({
86
88
  storeDir: cafs.storeDir,
87
89
  storeIndex: opts.storeIndex,
@@ -92,7 +94,7 @@ async function prepareGitHostedPkg(filesMap, cafs, rawFilesIndexFile, filesIndex
92
94
  readManifest: fetcherOpts.readManifest,
93
95
  requiresPrepare: shouldBeBuilt,
94
96
  }),
95
- ignoredBuild: Boolean(opts.ignoreScripts),
97
+ ignoredBuild,
96
98
  requiresPrepare: shouldBeBuilt,
97
99
  };
98
100
  }
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.3",
4
4
  "description": "Fetcher for packages hosted as tarballs",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,12 +29,12 @@
29
29
  "!*.map"
30
30
  ],
31
31
  "dependencies": {
32
- "@pnpm/core-loggers": "1100.3.4",
32
+ "@pnpm/core-loggers": "1101.0.0",
33
33
  "@pnpm/error": "1100.1.4",
34
- "@pnpm/exec.prepare-package": "1100.0.36",
35
- "@pnpm/fetching.fetcher-base": "1100.2.9",
34
+ "@pnpm/exec.prepare-package": "1100.0.37",
35
+ "@pnpm/fetching.fetcher-base": "1100.2.10",
36
36
  "@pnpm/fetching.types": "1100.0.3",
37
- "@pnpm/fs.graceful-fs": "1100.2.1",
37
+ "@pnpm/fs.graceful-fs": "1100.2.2",
38
38
  "@pnpm/fs.packlist": "1100.0.4",
39
39
  "@pnpm/store.index": "1100.3.1",
40
40
  "@pnpm/types": "1102.1.0",
@@ -44,15 +44,15 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@pnpm/logger": "^1100.0.0",
47
- "@pnpm/worker": "^1100.4.2"
47
+ "@pnpm/worker": "^1100.4.3"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@jest/globals": "30.4.1",
51
- "@pnpm/fetching.tarball-fetcher": "1102.1.2",
51
+ "@pnpm/fetching.tarball-fetcher": "1102.1.3",
52
52
  "@pnpm/logger": "1100.0.0",
53
- "@pnpm/network.fetch": "1100.1.16",
53
+ "@pnpm/network.fetch": "1100.1.17",
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.30",
56
56
  "@pnpm/test-fixtures": "1100.0.1",
57
57
  "@pnpm/text.ordinal-comparator": "1100.0.0",
58
58
  "@pnpm/types": "1102.1.0",