@pnpm/fs.graceful-fs 1100.2.3 → 1100.2.4
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 +11 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +10 -5
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @pnpm/fs.graceful-fs
|
|
2
2
|
|
|
3
|
+
## 1100.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed concurrent installs failing when replacing the same stale hoisted dependency link.
|
|
8
|
+
|
|
9
|
+
- `pnpm install` now works in StackBlitz WebContainers on projects without a lockfile. It used to fail there with `ENOENT ... pnpm-lock.yaml`, because pnpm did not recognize the errors that WebContainers return from asynchronous file system calls [#15649](https://github.com/pnpm/pnpm/issues/15649).
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/error@1100.2.1
|
|
13
|
+
|
|
3
14
|
## 1100.2.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -56,3 +56,9 @@ export declare function unlinkWithRetry(target: string): void;
|
|
|
56
56
|
* {@link renameFileWithRetry}.
|
|
57
57
|
*/
|
|
58
58
|
export declare function withFileLockRetry<T>(operation: () => T): T;
|
|
59
|
+
/**
|
|
60
|
+
* Asynchronous {@link withFileLockRetry}, which waits between attempts
|
|
61
|
+
* without blocking the event loop.
|
|
62
|
+
*/
|
|
63
|
+
export declare function withFileLockRetryAsync<T>(operation: () => Promise<T>): Promise<T>;
|
|
64
|
+
export declare function isTransientFileLockError(err: unknown): err is NodeJS.ErrnoException;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import os from 'node:os';
|
|
3
|
-
import
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { isError } from '@pnpm/error';
|
|
4
5
|
import gfs from 'graceful-fs';
|
|
5
6
|
const FILE_LOCK_RETRY_BUDGET_MS = 60_000;
|
|
6
7
|
const PERMISSION_DENIED_RETRY_BUDGET_MS = 1_000;
|
|
@@ -34,7 +35,7 @@ function withEagainRetry(fn, maxRetries = 15) {
|
|
|
34
35
|
return fn(...args);
|
|
35
36
|
}
|
|
36
37
|
catch (err) {
|
|
37
|
-
if (
|
|
38
|
+
if (isError(err) && 'code' in err && err.code === 'EAGAIN' && attempts < maxRetries) {
|
|
38
39
|
attempts++;
|
|
39
40
|
// Exponential backoff: wait 2^attempts milliseconds, max 300ms
|
|
40
41
|
const delay = Math.min(Math.pow(2, attempts), 300);
|
|
@@ -108,7 +109,11 @@ export function withFileLockRetry(operation) {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Asynchronous {@link withFileLockRetry}, which waits between attempts
|
|
114
|
+
* without blocking the event loop.
|
|
115
|
+
*/
|
|
116
|
+
export async function withFileLockRetryAsync(operation) {
|
|
112
117
|
const retry = createFileLockRetry();
|
|
113
118
|
for (;;) {
|
|
114
119
|
try {
|
|
@@ -147,9 +152,9 @@ function createFileLockRetry() {
|
|
|
147
152
|
},
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
|
-
function isTransientFileLockError(err) {
|
|
155
|
+
export function isTransientFileLockError(err) {
|
|
151
156
|
return (process.platform === 'win32' || isWsl()) &&
|
|
152
|
-
|
|
157
|
+
isError(err) &&
|
|
153
158
|
'code' in err &&
|
|
154
159
|
(err.code === 'EPERM' || err.code === 'EACCES' || err.code === 'EBUSY');
|
|
155
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fs.graceful-fs",
|
|
3
|
-
"version": "1100.2.
|
|
3
|
+
"version": "1100.2.4",
|
|
4
4
|
"description": "Promisified graceful-fs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"!*.map"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@pnpm/error": "1100.2.1",
|
|
30
31
|
"graceful-fs": "^4.2.11"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@jest/globals": "30.4.1",
|
|
34
|
-
"@pnpm/fs.graceful-fs": "1100.2.
|
|
35
|
+
"@pnpm/fs.graceful-fs": "1100.2.4",
|
|
35
36
|
"@types/graceful-fs": "^4.1.9"
|
|
36
37
|
},
|
|
37
38
|
"engines": {
|