@pnpm/store.create-cafs-store 1100.0.30 → 1100.0.32

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,37 @@
1
1
  # @pnpm/create-cafs-store
2
2
 
3
+ ## 1100.0.32
4
+
5
+ ### Patch Changes
6
+
7
+ - `pnpm deploy` with a shared lockfile now copies workspace dependencies into the deploy directory, even when `packageImportMethod` is set to `hardlink`. Previously, their files were hard-linked to the workspace sources, so editing a source file also changed the deployed copy [pnpm/pnpm#12176](https://github.com/pnpm/pnpm/issues/12176).
8
+
9
+ - `pnpm install` no longer fails for an injected workspace dependency whose package publishes from a `publishConfig.directory` that its own `prepare` script builds. The injected copy now picks up that directory once `prepare` finishes building it. `pnpm install --frozen-lockfile` no longer reports the dependency as outdated while the directory has not been built yet. [pnpm/pnpm#7811](https://github.com/pnpm/pnpm/issues/7811)
10
+
11
+ - The side-effects cache now restores the symlinks that a build script creates inside a package. A warm install used to replace each of them with a copy of its target [#12859](https://github.com/pnpm/pnpm/issues/12859).
12
+
13
+ After upgrading, every package with a build script is built once more.
14
+
15
+ - Updated dependencies:
16
+ - @pnpm/building.pkg-requires-build@1100.0.19
17
+ - @pnpm/fetching.fetcher-base@1100.2.12
18
+ - @pnpm/fs.indexed-pkg-importer@1100.0.31
19
+ - @pnpm/store.cafs@1100.3.5
20
+ - @pnpm/store.controller-types@1101.3.2
21
+
22
+ ## 1100.0.31
23
+
24
+ ### Patch Changes
25
+
26
+ - `pnpm deploy` now respects `--package-import-method` passed on the command line and reports the package import method correctly [pnpm/pnpm#7593](https://github.com/pnpm/pnpm/issues/7593).
27
+
28
+ - Updated dependencies:
29
+ - @pnpm/building.pkg-requires-build@1100.0.18
30
+ - @pnpm/fetching.fetcher-base@1100.2.11
31
+ - @pnpm/fs.indexed-pkg-importer@1100.0.30
32
+ - @pnpm/store.cafs@1100.3.4
33
+ - @pnpm/store.controller-types@1101.3.1
34
+
3
35
  ## 1100.0.30
4
36
 
5
37
  ### Patch Changes
package/lib/index.js CHANGED
@@ -11,11 +11,12 @@ export function createPackageImporterAsync(opts) {
11
11
  const packageImportMethod = opts.packageImportMethod;
12
12
  const gfm = getFlatMap.bind(null, opts.storeDir);
13
13
  return async (to, opts) => {
14
- const { filesMap, isBuilt } = gfm(opts.filesResponse, opts.sideEffectsCacheKey);
15
- const willBeBuilt = !isBuilt && opts.requiresBuild;
16
- const pkgImportMethod = willBeBuilt
17
- ? 'clone-or-copy'
18
- : (opts.filesResponse.packageImportMethod ?? packageImportMethod);
14
+ const { filesMap, isBuilt, symlinks } = gfm(opts.filesResponse, opts.sideEffectsCacheKey);
15
+ const pkgImportMethod = needsPrivateFiles(opts.filesResponse, !isBuilt && opts.requiresBuild === true)
16
+ ? (packageImportMethod === 'copy' ? 'copy' : 'clone-or-copy')
17
+ : (packageImportMethod && packageImportMethod !== 'auto'
18
+ ? packageImportMethod
19
+ : (opts.filesResponse.packageImportMethod ?? packageImportMethod));
19
20
  const impPkg = cachedImporterCreator(pkgImportMethod);
20
21
  const importMethod = await impPkg(to, {
21
22
  disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
@@ -24,6 +25,8 @@ export function createPackageImporterAsync(opts) {
24
25
  force: opts.force,
25
26
  keepModulesDir: Boolean(opts.keepModulesDir),
26
27
  safeToSkip: opts.safeToSkip,
28
+ sourceExists: opts.filesResponse.sourceExists,
29
+ symlinks,
27
30
  });
28
31
  return { importMethod, isBuilt };
29
32
  };
@@ -35,11 +38,12 @@ function createPackageImporter(opts) {
35
38
  const packageImportMethod = opts.packageImportMethod;
36
39
  const gfm = getFlatMap.bind(null, opts.storeDir);
37
40
  return (to, opts) => {
38
- const { filesMap, isBuilt } = gfm(opts.filesResponse, opts.sideEffectsCacheKey);
39
- const willBeBuilt = !isBuilt && opts.requiresBuild;
40
- const pkgImportMethod = willBeBuilt
41
- ? 'clone-or-copy'
42
- : (opts.filesResponse.packageImportMethod ?? packageImportMethod);
41
+ const { filesMap, isBuilt, symlinks } = gfm(opts.filesResponse, opts.sideEffectsCacheKey);
42
+ const pkgImportMethod = needsPrivateFiles(opts.filesResponse, !isBuilt && opts.requiresBuild === true)
43
+ ? (packageImportMethod === 'copy' ? 'copy' : 'clone-or-copy')
44
+ : (packageImportMethod && packageImportMethod !== 'auto'
45
+ ? packageImportMethod
46
+ : (opts.filesResponse.packageImportMethod ?? packageImportMethod));
43
47
  const impPkg = cachedImporterCreator(pkgImportMethod);
44
48
  const importMethod = impPkg(to, {
45
49
  disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
@@ -48,10 +52,19 @@ function createPackageImporter(opts) {
48
52
  force: opts.force,
49
53
  keepModulesDir: Boolean(opts.keepModulesDir),
50
54
  safeToSkip: opts.safeToSkip,
55
+ sourceExists: opts.filesResponse.sourceExists,
56
+ symlinks,
51
57
  });
52
58
  return { importMethod, isBuilt };
53
59
  };
54
60
  }
61
+ // A package that a build will still write to must not share inodes with its
62
+ // source. Neither may a local directory whose fetcher asked for private copies
63
+ // (`pnpm deploy`), even when a global `packageImportMethod` asks for hard links.
64
+ function needsPrivateFiles(filesResponse, willBeBuilt) {
65
+ return willBeBuilt ||
66
+ (filesResponse.resolvedFrom === 'local-dir' && filesResponse.packageImportMethod === 'clone-or-copy');
67
+ }
55
68
  function getFlatMap(storeDir, filesResponse, targetEngine) {
56
69
  if (targetEngine && filesResponse.sideEffectsMaps?.has(targetEngine)) {
57
70
  const sideEffectMap = filesResponse.sideEffectsMaps.get(targetEngine);
@@ -59,6 +72,7 @@ function getFlatMap(storeDir, filesResponse, targetEngine) {
59
72
  return {
60
73
  filesMap,
61
74
  isBuilt: true,
75
+ symlinks: sideEffectMap.symlinks,
62
76
  };
63
77
  }
64
78
  return {
@@ -67,7 +81,7 @@ function getFlatMap(storeDir, filesResponse, targetEngine) {
67
81
  };
68
82
  }
69
83
  // Apply side effects when we already have file location maps (fast path)
70
- function applySideEffectsDiffWithMaps(baseFiles, { added, deleted }) {
84
+ function applySideEffectsDiffWithMaps(baseFiles, { added, deleted, symlinks }) {
71
85
  const filesWithSideEffects = new Map();
72
86
  // Add side effect files (already have file paths)
73
87
  if (added) {
@@ -75,9 +89,9 @@ function applySideEffectsDiffWithMaps(baseFiles, { added, deleted }) {
75
89
  filesWithSideEffects.set(name, filePath);
76
90
  }
77
91
  }
78
- // Add base files that weren't deleted
92
+ // Add base files that weren't deleted or replaced by a symlink
79
93
  for (const [fileName, filePath] of baseFiles) {
80
- if (!deleted?.includes(fileName) && !filesWithSideEffects.has(fileName)) {
94
+ if (!deleted?.includes(fileName) && !filesWithSideEffects.has(fileName) && !symlinks?.has(fileName)) {
81
95
  filesWithSideEffects.set(fileName, filePath);
82
96
  }
83
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/store.create-cafs-store",
3
- "version": "1100.0.30",
3
+ "version": "1100.0.32",
4
4
  "description": "Create a CAFS store controller",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -37,11 +37,11 @@
37
37
  "test": "test"
38
38
  },
39
39
  "dependencies": {
40
- "@pnpm/building.pkg-requires-build": "1100.0.17",
41
- "@pnpm/fetching.fetcher-base": "1100.2.10",
42
- "@pnpm/fs.indexed-pkg-importer": "1100.0.29",
43
- "@pnpm/store.cafs": "1100.3.3",
44
- "@pnpm/store.controller-types": "1101.3.0",
40
+ "@pnpm/building.pkg-requires-build": "1100.0.19",
41
+ "@pnpm/fetching.fetcher-base": "1100.2.12",
42
+ "@pnpm/fs.indexed-pkg-importer": "1100.0.31",
43
+ "@pnpm/store.cafs": "1100.3.5",
44
+ "@pnpm/store.controller-types": "1101.3.2",
45
45
  "memoize": "^11.0.0",
46
46
  "ramda": "npm:@pnpm/ramda@0.28.1"
47
47
  },
@@ -50,9 +50,9 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@pnpm/logger": "1100.0.0",
53
- "@pnpm/prepare": "1100.0.31",
54
- "@pnpm/store.cafs-types": "1100.1.0",
55
- "@pnpm/store.create-cafs-store": "1100.0.30",
53
+ "@pnpm/prepare": "1100.0.33",
54
+ "@pnpm/store.cafs-types": "1100.1.1",
55
+ "@pnpm/store.create-cafs-store": "1100.0.32",
56
56
  "@types/ramda": "0.32.0"
57
57
  },
58
58
  "engines": {