@pnpm/fs.indexed-pkg-importer 1100.0.35 → 1100.0.37

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,21 @@
1
1
  # @pnpm/fs.indexed-pkg-importer
2
2
 
3
+ ## 1100.0.37
4
+
5
+ ### Patch Changes
6
+
7
+ - `pnpm prune --prod` no longer fails with `ERR_PNPM_EXDEV` when `node_modules` was copied from an earlier Docker build stage [#17424](https://github.com/pnpm/pnpm/issues/17424).
8
+
9
+ ## 1100.0.36
10
+
11
+ ### Patch Changes
12
+
13
+ - `pnpm deploy` now keeps a deployed symlink to a directory inside the project even if the directory is not among the deployed files, such as a link into `node_modules` [#17288](https://github.com/pnpm/pnpm/issues/17288).
14
+
15
+ - Updated dependencies:
16
+ - @pnpm/core-loggers@1101.0.4
17
+ - @pnpm/store.controller-types@1101.3.5
18
+
3
19
  ## 1100.0.35
4
20
 
5
21
  ### Patch Changes
@@ -1,4 +1,5 @@
1
1
  export interface SymlinkDirs {
2
+ symlinkTargets?: 'imported' | 'internal';
2
3
  writtenDir: string;
3
4
  finalDir: string;
4
5
  imported: Set<string>;
@@ -17,7 +17,9 @@ export function copyInternalSymlink(src, dest, links) {
17
17
  if (escapesDir(links.writtenDir, resolved))
18
18
  return false;
19
19
  if (!links.imported.has(path.relative(links.writtenDir, resolved).split(path.sep).join('/'))) {
20
- return isDirectory(src);
20
+ const isDir = isDirectory(src);
21
+ if (links.symlinkTargets !== 'internal' || !isDir)
22
+ return isDir;
21
23
  }
22
24
  if (process.platform !== 'win32') {
23
25
  fs.symlinkSync(target, dest);
@@ -5,6 +5,7 @@ export interface Importer {
5
5
  importFileAtomic: ImportFile;
6
6
  }
7
7
  export interface ImportIndexedDirOptions {
8
+ symlinkTargets?: 'imported' | 'internal';
8
9
  keepModulesDir?: boolean;
9
10
  /**
10
11
  * Whether a target that already holds this package is equivalent to the
@@ -239,7 +239,7 @@ function symlinkDirs(opts, filenames, dirs) {
239
239
  imported.add(entry);
240
240
  }
241
241
  }
242
- return { ...dirs, imported };
242
+ return { ...dirs, imported, symlinkTargets: opts.symlinkTargets };
243
243
  }
244
244
  function importEntry(importFile, src, dest, links) {
245
245
  if (links != null && fs.lstatSync(src).isSymbolicLink() && copyInternalSymlink(src, dest, links))
@@ -85,21 +85,35 @@ function backupAndRemoveTargetAfterFailedDisplace(newDir, aside, err) {
85
85
  switch (err.code) {
86
86
  case 'ENOENT':
87
87
  return undefined;
88
- // Windows refuses to rename a directory a process runs from; copy a
88
+ // Windows refuses to rename a directory a process runs from, and an
89
+ // overlay filesystem refuses to rename one from a lower layer; copy a
89
90
  // backup to `aside` before removing `newDir` in place so a failed
90
91
  // stage rename can still restore the previous package.
91
92
  case 'EPERM':
92
93
  case 'EACCES':
93
94
  case 'EBUSY':
95
+ case 'EXDEV':
94
96
  try {
95
97
  fs.cpSync(newDir, aside, { recursive: true, verbatimSymlinks: true });
96
- rimrafSync(newDir);
97
- return aside;
98
98
  }
99
- catch (fallbackErr) {
99
+ catch (copyErr) {
100
100
  removeQuietly(aside);
101
- throw fallbackErr;
101
+ throw copyErr;
102
+ }
103
+ try {
104
+ rimrafSync(newDir);
105
+ }
106
+ catch (removeErr) {
107
+ // `newDir` may be partly deleted; copy the missing entries back from
108
+ // `aside`, and keep `aside` on disk if even that fails.
109
+ try {
110
+ fs.cpSync(aside, newDir, { recursive: true, verbatimSymlinks: true, force: false });
111
+ removeQuietly(aside);
112
+ }
113
+ catch { }
114
+ throw removeErr;
102
115
  }
116
+ return aside;
103
117
  default:
104
118
  throw err;
105
119
  }
@@ -49,7 +49,7 @@ function removeQuarantineFromChunk(filePaths) {
49
49
  });
50
50
  }
51
51
  catch (err) {
52
- // `xattr -d` exits non-zero when a file simply has no quarantine xattr to
52
+ // `xattr -d` exits non-zero when a file has no quarantine xattr to
53
53
  // remove ("No such xattr"), which is the common, expected case. It also
54
54
  // reports "No such file" for entries the importer legitimately dropped or
55
55
  // renamed (e.g. case-insensitive filename conflicts). Surface only errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fs.indexed-pkg-importer",
3
- "version": "1100.0.35",
3
+ "version": "1100.0.37",
4
4
  "description": "Replicates indexed directories using hard links, copies, or cloning",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -37,10 +37,10 @@
37
37
  "test": "test"
38
38
  },
39
39
  "dependencies": {
40
- "@pnpm/core-loggers": "1101.0.3",
40
+ "@pnpm/core-loggers": "1101.0.4",
41
41
  "@pnpm/error": "1100.2.2",
42
42
  "@pnpm/fs.graceful-fs": "1100.2.5",
43
- "@pnpm/store.controller-types": "1101.3.4",
43
+ "@pnpm/store.controller-types": "1101.3.5",
44
44
  "@pnpm/text.sanitize": "1100.0.1",
45
45
  "@reflink/reflink": "0.1.19",
46
46
  "@zkochan/rimraf": "^4.0.0",
@@ -56,9 +56,9 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@jest/globals": "30.4.1",
59
- "@pnpm/fs.indexed-pkg-importer": "1100.0.35",
59
+ "@pnpm/fs.indexed-pkg-importer": "1100.0.37",
60
60
  "@pnpm/logger": "1100.0.0",
61
- "@pnpm/prepare": "1100.0.38",
61
+ "@pnpm/prepare": "1100.0.39",
62
62
  "@types/fs-extra": "^11.0.4"
63
63
  },
64
64
  "engines": {