@pnpm/fs.indexed-pkg-importer 1100.0.27 → 1100.0.29

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,23 @@
1
1
  # @pnpm/fs.indexed-pkg-importer
2
2
 
3
+ ## 1100.0.29
4
+
5
+ ### Patch Changes
6
+
7
+ - Installs in different projects that share a global virtual store no longer fail on Windows with `Access is denied` while repairing the same slot [#15114](https://github.com/pnpm/pnpm/issues/15114).
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/core-loggers@1101.0.0
11
+ - @pnpm/fs.graceful-fs@1100.2.2
12
+ - @pnpm/store.controller-types@1101.3.0
13
+
14
+ ## 1100.0.28
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies:
19
+ - @pnpm/fs.graceful-fs@1100.2.1
20
+
3
21
  ## 1100.0.27
4
22
 
5
23
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import util from 'node:util';
4
- import gfs, { renameFileWithRetry } from '@pnpm/fs.graceful-fs';
4
+ import gfs, { lstatWithRetry, renameFileWithRetry, unlinkWithRetry } from '@pnpm/fs.graceful-fs';
5
5
  import { globalInfo, globalWarn, logger } from '@pnpm/logger';
6
6
  import { rimrafSync } from '@zkochan/rimraf';
7
7
  import fsx from 'fs-extra';
@@ -165,12 +165,32 @@ function replaceFileIfDifferent(importFile, src, dest) {
165
165
  throw err;
166
166
  }
167
167
  }
168
+ // Whether a package directory can go at `dir` now: nothing is there, or
169
+ // what is there is already a directory.
170
+ //
171
+ // A failed removal is not a failed clearing when this holds. The installers
172
+ // healing a slot together race over these paths, and one that finishes the
173
+ // same work first leaves exactly what the removal was for, whether it merely
174
+ // unlinked the blocker or replaced it outright. The inspection retries for
175
+ // the same reason the others here do.
176
+ function dirFitsAt(dir) {
177
+ try {
178
+ return lstatWithRetry(dir).isDirectory();
179
+ }
180
+ catch (err) {
181
+ return util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT';
182
+ }
183
+ }
168
184
  // A rename cannot put a file where a directory is (EISDIR), so one standing in
169
185
  // the way has to go first. Only a damaged tree has one.
186
+ //
187
+ // The inspection retries, because installs in different projects heal one
188
+ // shared slot at the same time and Windows reports a dirent one of them has
189
+ // just unlinked as inaccessible until the unlink lands.
170
190
  function clearDirBlockingFile(dest) {
171
191
  let stats;
172
192
  try {
173
- stats = fs.lstatSync(dest);
193
+ stats = lstatWithRetry(dest);
174
194
  }
175
195
  catch (err) {
176
196
  if (util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT')
@@ -191,7 +211,7 @@ function clearDirentBlockingDir(newDir, relativeDir) {
191
211
  dir = path.join(dir, segment);
192
212
  let stats;
193
213
  try {
194
- stats = fs.lstatSync(dir);
214
+ stats = lstatWithRetry(dir);
195
215
  }
196
216
  catch (err) {
197
217
  if (util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT')
@@ -200,7 +220,13 @@ function clearDirentBlockingDir(newDir, relativeDir) {
200
220
  }
201
221
  if (stats.isDirectory())
202
222
  continue;
203
- fs.unlinkSync(dir);
223
+ try {
224
+ unlinkWithRetry(dir);
225
+ }
226
+ catch (err) {
227
+ if (!dirFitsAt(dir))
228
+ throw err;
229
+ }
204
230
  return;
205
231
  }
206
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fs.indexed-pkg-importer",
3
- "version": "1100.0.27",
3
+ "version": "1100.0.29",
4
4
  "description": "Replicates indexed directories using hard links, copies, or cloning",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -37,14 +37,14 @@
37
37
  "test": "test"
38
38
  },
39
39
  "dependencies": {
40
- "@pnpm/core-loggers": "1100.3.4",
41
- "@pnpm/fs.graceful-fs": "1100.2.0",
42
- "@pnpm/store.controller-types": "1101.2.0",
40
+ "@pnpm/core-loggers": "1101.0.0",
41
+ "@pnpm/fs.graceful-fs": "1100.2.2",
42
+ "@pnpm/store.controller-types": "1101.3.0",
43
43
  "@reflink/reflink": "0.1.19",
44
44
  "@zkochan/rimraf": "^4.0.0",
45
45
  "fs-extra": "^11.4.0",
46
46
  "make-empty-dir": "^4.0.0",
47
- "p-limit": "^7.3.1",
47
+ "p-limit": "^7.3.3",
48
48
  "path-temp": "^3.0.0",
49
49
  "rename-overwrite": "^7.0.1",
50
50
  "sanitize-filename": "^1.6.4"
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@jest/globals": "30.4.1",
57
- "@pnpm/fs.indexed-pkg-importer": "1100.0.27",
57
+ "@pnpm/fs.indexed-pkg-importer": "1100.0.29",
58
58
  "@pnpm/logger": "1100.0.0",
59
- "@pnpm/prepare": "1100.0.28",
59
+ "@pnpm/prepare": "1100.0.31",
60
60
  "@types/fs-extra": "^11.0.4"
61
61
  },
62
62
  "engines": {