@pnpm/fs.indexed-pkg-importer 1100.0.17 → 1100.0.19
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 +699 -0
- package/package.json +8 -8
- package/lib/importIndexedDir.d.ts +0 -9
- package/lib/importIndexedDir.js +0 -284
- package/lib/index.d.ts +0 -5
- package/lib/removeQuarantine.d.ts +0 -23
- package/lib/removeQuarantine.js +0 -90
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
# @pnpm/fs.indexed-pkg-importer
|
|
2
|
+
|
|
3
|
+
## 1100.0.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @pnpm/core-loggers@1100.2.3
|
|
9
|
+
|
|
10
|
+
## 1100.0.18
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies:
|
|
15
|
+
- @pnpm/core-loggers@1100.2.2
|
|
16
|
+
- @pnpm/store.controller-types@1100.1.8
|
|
17
|
+
|
|
18
|
+
## 1100.0.17
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [dcabb78]
|
|
23
|
+
- @pnpm/store.controller-types@1100.1.7
|
|
24
|
+
|
|
25
|
+
## 1100.0.16
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [bae694f]
|
|
30
|
+
- @pnpm/store.controller-types@1100.1.6
|
|
31
|
+
|
|
32
|
+
## 1100.0.15
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 1b02b47: Fix macOS Gatekeeper blocking native binaries (`.node`, `.dylib`, `.so`) by removing the `com.apple.quarantine` extended attribute after importing them from the store.
|
|
37
|
+
|
|
38
|
+
When pnpm imports files from its content-addressable store into `node_modules`, macOS preserves extended attributes, including `com.apple.quarantine`. If this xattr is present on a store blob (e.g. it was first written under a Gatekeeper-enabled app such as a Git client), it propagates to `node_modules`, and Gatekeeper blocks the native binary from loading even though pnpm already verified the file's integrity against the lockfile.
|
|
39
|
+
|
|
40
|
+
After importing a package, pnpm now strips `com.apple.quarantine` from its native binaries, matching Homebrew's behaviour of dropping quarantine from verified downloads. The cleanup is macOS-only, runs in a single batched `xattr` call per package, is restricted to native binaries (other files are untouched), and is non-fatal (it logs a warning on unexpected errors).
|
|
41
|
+
|
|
42
|
+
Fixes #11056
|
|
43
|
+
|
|
44
|
+
## 1100.0.14
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- a31faa7: Updated dependency ranges. Notably:
|
|
49
|
+
|
|
50
|
+
- `@pnpm/logger` peer dependency range moved to `^1100.0.0`.
|
|
51
|
+
- `msgpackr` 1.11.8 → 2.0.4 (store index files remain byte-compatible in both directions).
|
|
52
|
+
- `open` ^7.4.2 → ^11.0.0, `memoize` ^10 → ^11, `cli-truncate` ^5 → ^6, `pidtree` ^0.6 → ^1.
|
|
53
|
+
- `@yarnpkg/core` 4.5.0 → 4.8.0, `@rushstack/worker-pool` 0.7.7 → 0.7.18, `@cyclonedx/cyclonedx-library` 10.0.0 → 10.1.0, `@pnpm/config.nerf-dart` ^1 → ^2, `@pnpm/log.group` 3.0.2 → 4.0.1, `@pnpm/util.lex-comparator` ^3 → ^4.
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [a31faa7]
|
|
56
|
+
- @pnpm/core-loggers@1100.2.1
|
|
57
|
+
- @pnpm/store.controller-types@1100.1.5
|
|
58
|
+
|
|
59
|
+
## 1100.0.13
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [f11b4fc]
|
|
64
|
+
- @pnpm/core-loggers@1100.2.0
|
|
65
|
+
|
|
66
|
+
## 1100.0.12
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- @pnpm/core-loggers@1100.1.4
|
|
71
|
+
- @pnpm/store.controller-types@1100.1.4
|
|
72
|
+
|
|
73
|
+
## 1100.0.11
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- cbfeeef: Fixed packages being materialized into the virtual store without their root-level files (`package.json`, `LICENSE`, README, root entrypoints) when multiple `pnpm install` processes ran against the same store/workspace concurrently. The fast import path used to destructively empty the shared target directory, so a concurrent importer could wipe files another importer had already written; if the surviving files included the `package.json` completion marker, every later install treated the broken directory as complete and never repaired it. The fast path now imports directly only when it can create the target directory exclusively, and otherwise builds the package in a private temp directory and atomically renames it into place [#12197](https://github.com/pnpm/pnpm/issues/12197).
|
|
78
|
+
- @pnpm/core-loggers@1100.1.3
|
|
79
|
+
- @pnpm/store.controller-types@1100.1.3
|
|
80
|
+
|
|
81
|
+
## 1100.0.10
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- @pnpm/core-loggers@1100.1.2
|
|
86
|
+
- @pnpm/store.controller-types@1100.1.2
|
|
87
|
+
|
|
88
|
+
## 1100.0.9
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- @pnpm/store.controller-types@1100.1.1
|
|
93
|
+
- @pnpm/core-loggers@1100.1.1
|
|
94
|
+
|
|
95
|
+
## 1100.0.8
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [4195766]
|
|
100
|
+
- Updated dependencies [4a79336]
|
|
101
|
+
- @pnpm/store.controller-types@1100.1.0
|
|
102
|
+
- @pnpm/core-loggers@1100.1.0
|
|
103
|
+
|
|
104
|
+
## 1100.0.7
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [c2c2890]
|
|
109
|
+
- @pnpm/store.controller-types@1100.0.7
|
|
110
|
+
|
|
111
|
+
## 1100.0.6
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- @pnpm/core-loggers@1100.0.2
|
|
116
|
+
- @pnpm/store.controller-types@1100.0.6
|
|
117
|
+
|
|
118
|
+
## 1100.0.5
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- @pnpm/store.controller-types@1100.0.5
|
|
123
|
+
|
|
124
|
+
## 1100.0.4
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- 184ce26: Fix the package name in README.md.
|
|
129
|
+
- Updated dependencies [184ce26]
|
|
130
|
+
- Updated dependencies [5a901e7]
|
|
131
|
+
- @pnpm/store.controller-types@1100.0.4
|
|
132
|
+
- @pnpm/fs.graceful-fs@1100.1.0
|
|
133
|
+
|
|
134
|
+
## 1100.0.3
|
|
135
|
+
|
|
136
|
+
### Patch Changes
|
|
137
|
+
|
|
138
|
+
- @pnpm/store.controller-types@1100.0.3
|
|
139
|
+
|
|
140
|
+
## 1100.0.2
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- @pnpm/store.controller-types@1100.0.2
|
|
145
|
+
|
|
146
|
+
## 1100.0.1
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- @pnpm/core-loggers@1100.0.1
|
|
151
|
+
- @pnpm/store.controller-types@1100.0.1
|
|
152
|
+
|
|
153
|
+
## 1001.0.0
|
|
154
|
+
|
|
155
|
+
### Major Changes
|
|
156
|
+
|
|
157
|
+
- 491a84f: This package is now pure ESM.
|
|
158
|
+
- 7d2fd48: Node.js v18, 19, 20, and 21 support discontinued.
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- 9b1e5da: Fixed a performance regression on Linux where `auto` import mode would copy every file instead of hardlinking on filesystems without reflink support (e.g. ext4).
|
|
163
|
+
|
|
164
|
+
The clone error fallback in `createClonePkg()` silently converted clone failures to copies, preventing the auto-importer from detecting that cloning is not supported and falling through to hardlinks. This caused a 2-9x slowdown on Linux CI for install operations.
|
|
165
|
+
|
|
166
|
+
- 62f760e: Fixed intermittent failures when multiple `pnpm dlx` calls run concurrently for the same package. When the global virtual store is enabled, the importer now verifies file content before skipping a rename, avoiding destructive swap-renames that break concurrent processes. Also tolerates EPERM during bin creation on Windows and properly propagates `enableGlobalVirtualStore` through the install pipeline.
|
|
167
|
+
- cbb366a: Fixed a race condition when multiple worker threads import the same package to the global virtual store concurrently. The rename operation now tolerates `ENOTEMPTY`/`EEXIST` errors if another thread already completed the import.
|
|
168
|
+
- ee9fe58: Skip the staging directory when importing packages into `node_modules`. This avoids the overhead of creating a temp dir and renaming per package. Falls back to the atomic staging path on error.
|
|
169
|
+
|
|
170
|
+
Packages that lack a `package.json` now get a synthetic empty one added to the store so that `package.json` can serve as a universal completion marker for the importer.
|
|
171
|
+
|
|
172
|
+
- 60b5fd1: Packages that don't have a `package.json` file (like Node.js) should not be reimported from the store on every install. Another file from the package should be checked in order to verify its presence in `node_modules`.
|
|
173
|
+
- Updated dependencies [facdd71]
|
|
174
|
+
- Updated dependencies [491a84f]
|
|
175
|
+
- Updated dependencies [ba065f6]
|
|
176
|
+
- Updated dependencies [7d2fd48]
|
|
177
|
+
- Updated dependencies [56a59df]
|
|
178
|
+
- Updated dependencies [10bc391]
|
|
179
|
+
- Updated dependencies [9d3f00b]
|
|
180
|
+
- Updated dependencies [98a0410]
|
|
181
|
+
- @pnpm/store.controller-types@1005.0.0
|
|
182
|
+
- @pnpm/core-loggers@1002.0.0
|
|
183
|
+
- @pnpm/fs.graceful-fs@1001.0.0
|
|
184
|
+
|
|
185
|
+
## 1000.1.14
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- Updated dependencies [7c1382f]
|
|
190
|
+
- @pnpm/store-controller-types@1004.1.0
|
|
191
|
+
- @pnpm/core-loggers@1001.0.4
|
|
192
|
+
|
|
193
|
+
## 1000.1.13
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- 9b9faa5: Retry filesystem operations on EAGAIN errors [#9959](https://github.com/pnpm/pnpm/pull/9959).
|
|
198
|
+
- Updated dependencies [9b9faa5]
|
|
199
|
+
- @pnpm/graceful-fs@1000.0.1
|
|
200
|
+
|
|
201
|
+
## 1000.1.12
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- @pnpm/core-loggers@1001.0.3
|
|
206
|
+
- @pnpm/store-controller-types@1004.0.2
|
|
207
|
+
|
|
208
|
+
## 1000.1.11
|
|
209
|
+
|
|
210
|
+
### Patch Changes
|
|
211
|
+
|
|
212
|
+
- @pnpm/store-controller-types@1004.0.1
|
|
213
|
+
|
|
214
|
+
## 1000.1.10
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- Updated dependencies [1a07b8f]
|
|
219
|
+
- @pnpm/store-controller-types@1004.0.0
|
|
220
|
+
- @pnpm/core-loggers@1001.0.2
|
|
221
|
+
|
|
222
|
+
## 1000.1.9
|
|
223
|
+
|
|
224
|
+
### Patch Changes
|
|
225
|
+
|
|
226
|
+
- @pnpm/store-controller-types@1003.0.3
|
|
227
|
+
|
|
228
|
+
## 1000.1.8
|
|
229
|
+
|
|
230
|
+
### Patch Changes
|
|
231
|
+
|
|
232
|
+
- Updated dependencies [509948d]
|
|
233
|
+
- @pnpm/store-controller-types@1003.0.2
|
|
234
|
+
|
|
235
|
+
## 1000.1.7
|
|
236
|
+
|
|
237
|
+
### Patch Changes
|
|
238
|
+
|
|
239
|
+
- 09cf46f: Update `@pnpm/logger` in peer dependencies.
|
|
240
|
+
- Updated dependencies [09cf46f]
|
|
241
|
+
- Updated dependencies [c24c66e]
|
|
242
|
+
- @pnpm/core-loggers@1001.0.1
|
|
243
|
+
- @pnpm/store-controller-types@1003.0.1
|
|
244
|
+
|
|
245
|
+
## 1000.1.6
|
|
246
|
+
|
|
247
|
+
### Patch Changes
|
|
248
|
+
|
|
249
|
+
- Updated dependencies [8a9f3a4]
|
|
250
|
+
- Updated dependencies [5b73df1]
|
|
251
|
+
- Updated dependencies [9c3dd03]
|
|
252
|
+
- @pnpm/store-controller-types@1003.0.0
|
|
253
|
+
- @pnpm/core-loggers@1001.0.0
|
|
254
|
+
- @pnpm/logger@1001.0.0
|
|
255
|
+
|
|
256
|
+
## 1000.1.5
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- 032fff8: Update reflink to support macOS
|
|
261
|
+
- @pnpm/store-controller-types@1002.0.1
|
|
262
|
+
|
|
263
|
+
## 1000.1.4
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- Updated dependencies [72cff38]
|
|
268
|
+
- Updated dependencies [750ae7d]
|
|
269
|
+
- @pnpm/store-controller-types@1002.0.0
|
|
270
|
+
- @pnpm/core-loggers@1000.2.0
|
|
271
|
+
|
|
272
|
+
## 1000.1.3
|
|
273
|
+
|
|
274
|
+
### Patch Changes
|
|
275
|
+
|
|
276
|
+
- @pnpm/core-loggers@1000.1.5
|
|
277
|
+
- @pnpm/store-controller-types@1001.0.5
|
|
278
|
+
|
|
279
|
+
## 1000.1.2
|
|
280
|
+
|
|
281
|
+
### Patch Changes
|
|
282
|
+
|
|
283
|
+
- @pnpm/store-controller-types@1001.0.4
|
|
284
|
+
|
|
285
|
+
## 1000.1.1
|
|
286
|
+
|
|
287
|
+
### Patch Changes
|
|
288
|
+
|
|
289
|
+
- @pnpm/core-loggers@1000.1.4
|
|
290
|
+
- @pnpm/store-controller-types@1001.0.3
|
|
291
|
+
|
|
292
|
+
## 1000.1.0
|
|
293
|
+
|
|
294
|
+
### Minor Changes
|
|
295
|
+
|
|
296
|
+
- e32b1a2: Added support for automatically syncing files of injected workspace packages after `pnpm run` [#9081](https://github.com/pnpm/pnpm/issues/9081). Use the `sync-injected-deps-after-scripts` setting to specify which scripts build the workspace package. This tells pnpm when syncing is needed. The setting should be defined in a `.npmrc` file at the root of the workspace. Example:
|
|
297
|
+
|
|
298
|
+
```ini
|
|
299
|
+
sync-injected-deps-after-scripts[]=compile
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Patch Changes
|
|
303
|
+
|
|
304
|
+
- @pnpm/core-loggers@1000.1.3
|
|
305
|
+
- @pnpm/store-controller-types@1001.0.2
|
|
306
|
+
|
|
307
|
+
## 1000.0.5
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- @pnpm/core-loggers@1000.1.2
|
|
312
|
+
- @pnpm/store-controller-types@1001.0.1
|
|
313
|
+
|
|
314
|
+
## 1000.0.4
|
|
315
|
+
|
|
316
|
+
### Patch Changes
|
|
317
|
+
|
|
318
|
+
- Updated dependencies [dde650b]
|
|
319
|
+
- @pnpm/store-controller-types@1001.0.0
|
|
320
|
+
|
|
321
|
+
## 1000.0.3
|
|
322
|
+
|
|
323
|
+
### Patch Changes
|
|
324
|
+
|
|
325
|
+
- @pnpm/core-loggers@1000.1.1
|
|
326
|
+
- @pnpm/store-controller-types@1000.1.1
|
|
327
|
+
|
|
328
|
+
## 1000.0.2
|
|
329
|
+
|
|
330
|
+
### Patch Changes
|
|
331
|
+
|
|
332
|
+
- Updated dependencies [516c4b3]
|
|
333
|
+
- @pnpm/core-loggers@1000.1.0
|
|
334
|
+
|
|
335
|
+
## 1000.0.1
|
|
336
|
+
|
|
337
|
+
### Patch Changes
|
|
338
|
+
|
|
339
|
+
- Updated dependencies [6483b64]
|
|
340
|
+
- @pnpm/store-controller-types@1000.1.0
|
|
341
|
+
|
|
342
|
+
## 6.0.9
|
|
343
|
+
|
|
344
|
+
### Patch Changes
|
|
345
|
+
|
|
346
|
+
- @pnpm/core-loggers@10.0.7
|
|
347
|
+
- @pnpm/store-controller-types@18.1.6
|
|
348
|
+
|
|
349
|
+
## 6.0.8
|
|
350
|
+
|
|
351
|
+
### Patch Changes
|
|
352
|
+
|
|
353
|
+
- @pnpm/core-loggers@10.0.6
|
|
354
|
+
- @pnpm/store-controller-types@18.1.5
|
|
355
|
+
|
|
356
|
+
## 6.0.7
|
|
357
|
+
|
|
358
|
+
### Patch Changes
|
|
359
|
+
|
|
360
|
+
- @pnpm/core-loggers@10.0.5
|
|
361
|
+
- @pnpm/store-controller-types@18.1.4
|
|
362
|
+
|
|
363
|
+
## 6.0.6
|
|
364
|
+
|
|
365
|
+
### Patch Changes
|
|
366
|
+
|
|
367
|
+
- @pnpm/core-loggers@10.0.4
|
|
368
|
+
- @pnpm/store-controller-types@18.1.3
|
|
369
|
+
|
|
370
|
+
## 6.0.5
|
|
371
|
+
|
|
372
|
+
### Patch Changes
|
|
373
|
+
|
|
374
|
+
- afe520d: Update rename-overwrite to v6.
|
|
375
|
+
|
|
376
|
+
## 6.0.4
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- @pnpm/store-controller-types@18.1.2
|
|
381
|
+
- @pnpm/core-loggers@10.0.3
|
|
382
|
+
|
|
383
|
+
## 6.0.3
|
|
384
|
+
|
|
385
|
+
### Patch Changes
|
|
386
|
+
|
|
387
|
+
- @pnpm/core-loggers@10.0.2
|
|
388
|
+
- @pnpm/store-controller-types@18.1.1
|
|
389
|
+
|
|
390
|
+
## 6.0.2
|
|
391
|
+
|
|
392
|
+
### Patch Changes
|
|
393
|
+
|
|
394
|
+
- Updated dependencies [0c08e1c]
|
|
395
|
+
- @pnpm/store-controller-types@18.1.0
|
|
396
|
+
|
|
397
|
+
## 6.0.1
|
|
398
|
+
|
|
399
|
+
### Patch Changes
|
|
400
|
+
|
|
401
|
+
- @pnpm/core-loggers@10.0.1
|
|
402
|
+
- @pnpm/store-controller-types@18.0.1
|
|
403
|
+
|
|
404
|
+
## 6.0.0
|
|
405
|
+
|
|
406
|
+
### Major Changes
|
|
407
|
+
|
|
408
|
+
- 43cdd87: Node.js v16 support dropped. Use at least Node.js v18.12.
|
|
409
|
+
|
|
410
|
+
### Patch Changes
|
|
411
|
+
|
|
412
|
+
- Updated dependencies [43cdd87]
|
|
413
|
+
- @pnpm/store-controller-types@18.0.0
|
|
414
|
+
- @pnpm/core-loggers@10.0.0
|
|
415
|
+
- @pnpm/graceful-fs@4.0.0
|
|
416
|
+
|
|
417
|
+
## 5.0.13
|
|
418
|
+
|
|
419
|
+
### Patch Changes
|
|
420
|
+
|
|
421
|
+
- e2e08b98f: Prefer hard links over reflinks on Windows as they perform better [#7564](https://github.com/pnpm/pnpm/pull/7564).
|
|
422
|
+
- df9b16aa9: Don't fail in Windows CoW if the file already exists [#7554](https://github.com/pnpm/pnpm/issues/7554).
|
|
423
|
+
- Updated dependencies [31054a63e]
|
|
424
|
+
- @pnpm/store-controller-types@17.2.0
|
|
425
|
+
|
|
426
|
+
## 5.0.12
|
|
427
|
+
|
|
428
|
+
### Patch Changes
|
|
429
|
+
|
|
430
|
+
- 19be6b704: Fix copy-on-write on Windows Dev Drives [#7468](https://github.com/pnpm/pnpm/issues/7468).
|
|
431
|
+
|
|
432
|
+
## 5.0.11
|
|
433
|
+
|
|
434
|
+
### Patch Changes
|
|
435
|
+
|
|
436
|
+
- 33313d2fd: Update rename-overwrite to v5.
|
|
437
|
+
- @pnpm/core-loggers@9.0.6
|
|
438
|
+
- @pnpm/store-controller-types@17.1.4
|
|
439
|
+
|
|
440
|
+
## 5.0.10
|
|
441
|
+
|
|
442
|
+
### Patch Changes
|
|
443
|
+
|
|
444
|
+
- @pnpm/core-loggers@9.0.5
|
|
445
|
+
- @pnpm/store-controller-types@17.1.3
|
|
446
|
+
|
|
447
|
+
## 5.0.9
|
|
448
|
+
|
|
449
|
+
### Patch Changes
|
|
450
|
+
|
|
451
|
+
- 418866ac0: Bump version of `@reflink/reflink` that avoids empty cloned files when using Copy-on-Write on Windows Dev Drives. (#7186)
|
|
452
|
+
|
|
453
|
+
## 5.0.8
|
|
454
|
+
|
|
455
|
+
### Patch Changes
|
|
456
|
+
|
|
457
|
+
- Updated dependencies [291607c5a]
|
|
458
|
+
- @pnpm/store-controller-types@17.1.2
|
|
459
|
+
|
|
460
|
+
## 5.0.7
|
|
461
|
+
|
|
462
|
+
### Patch Changes
|
|
463
|
+
|
|
464
|
+
- Updated dependencies [7ea45afbe]
|
|
465
|
+
- @pnpm/store-controller-types@17.1.1
|
|
466
|
+
|
|
467
|
+
## 5.0.6
|
|
468
|
+
|
|
469
|
+
### Patch Changes
|
|
470
|
+
|
|
471
|
+
- Updated dependencies [43ce9e4a6]
|
|
472
|
+
- @pnpm/store-controller-types@17.1.0
|
|
473
|
+
- @pnpm/core-loggers@9.0.4
|
|
474
|
+
|
|
475
|
+
## 5.0.5
|
|
476
|
+
|
|
477
|
+
### Patch Changes
|
|
478
|
+
|
|
479
|
+
- 2ca756fd2: Don't use reflink on Windows [#7186](https://github.com/pnpm/pnpm/issues/7186).
|
|
480
|
+
|
|
481
|
+
## 5.0.4
|
|
482
|
+
|
|
483
|
+
### Patch Changes
|
|
484
|
+
|
|
485
|
+
- 6dfbca86b: Update reflink.
|
|
486
|
+
|
|
487
|
+
## 5.0.3
|
|
488
|
+
|
|
489
|
+
### Patch Changes
|
|
490
|
+
|
|
491
|
+
- e19de6a59: Fix file cloning to `node_modules` on Windows Dev Drives [#7186](https://github.com/pnpm/pnpm/issues/7186). This is a fix to a regression that was shipped with v8.9.0.
|
|
492
|
+
|
|
493
|
+
## 5.0.2
|
|
494
|
+
|
|
495
|
+
### Patch Changes
|
|
496
|
+
|
|
497
|
+
- 6337dcdbc: Don't fail on reflink creation while importing a package, if the target file already exists.
|
|
498
|
+
|
|
499
|
+
## 5.0.1
|
|
500
|
+
|
|
501
|
+
### Patch Changes
|
|
502
|
+
|
|
503
|
+
- ee6e0734e: Use reflinks instead of hard links by default on macOS and Windows Dev Drives [#5001](https://github.com/pnpm/pnpm/issues/5001).
|
|
504
|
+
- @pnpm/core-loggers@9.0.3
|
|
505
|
+
- @pnpm/store-controller-types@17.0.1
|
|
506
|
+
|
|
507
|
+
## 5.0.0
|
|
508
|
+
|
|
509
|
+
### Major Changes
|
|
510
|
+
|
|
511
|
+
- 9caa33d53: `fromStore` replaced with `resolvedFrom`.
|
|
512
|
+
|
|
513
|
+
### Patch Changes
|
|
514
|
+
|
|
515
|
+
- Updated dependencies [9caa33d53]
|
|
516
|
+
- Updated dependencies [9caa33d53]
|
|
517
|
+
- Updated dependencies [9caa33d53]
|
|
518
|
+
- @pnpm/store-controller-types@17.0.0
|
|
519
|
+
- @pnpm/graceful-fs@3.2.0
|
|
520
|
+
|
|
521
|
+
## 4.1.1
|
|
522
|
+
|
|
523
|
+
### Patch Changes
|
|
524
|
+
|
|
525
|
+
- cb6e4212c: Verify the existence of the package in node_modules, when disableRelinkFromStore is set to true.
|
|
526
|
+
|
|
527
|
+
## 4.1.0
|
|
528
|
+
|
|
529
|
+
### Minor Changes
|
|
530
|
+
|
|
531
|
+
- 03cdccc6e: New option added: disableRelinkFromStore.
|
|
532
|
+
|
|
533
|
+
### Patch Changes
|
|
534
|
+
|
|
535
|
+
- Updated dependencies [03cdccc6e]
|
|
536
|
+
- @pnpm/store-controller-types@16.1.0
|
|
537
|
+
|
|
538
|
+
## 4.0.1
|
|
539
|
+
|
|
540
|
+
### Patch Changes
|
|
541
|
+
|
|
542
|
+
- @pnpm/store-controller-types@16.0.1
|
|
543
|
+
|
|
544
|
+
## 4.0.0
|
|
545
|
+
|
|
546
|
+
### Major Changes
|
|
547
|
+
|
|
548
|
+
- f2009d175: Import packages synchronously.
|
|
549
|
+
|
|
550
|
+
### Patch Changes
|
|
551
|
+
|
|
552
|
+
- Updated dependencies [494f87544]
|
|
553
|
+
- Updated dependencies [083bbf590]
|
|
554
|
+
- @pnpm/store-controller-types@16.0.0
|
|
555
|
+
- @pnpm/graceful-fs@3.1.0
|
|
556
|
+
|
|
557
|
+
## 3.0.2
|
|
558
|
+
|
|
559
|
+
### Patch Changes
|
|
560
|
+
|
|
561
|
+
- e958707b2: Improve performance by removing cryptographically generated id from temporary file names.
|
|
562
|
+
- @pnpm/core-loggers@9.0.2
|
|
563
|
+
- @pnpm/store-controller-types@15.0.2
|
|
564
|
+
|
|
565
|
+
## 3.0.1
|
|
566
|
+
|
|
567
|
+
### Patch Changes
|
|
568
|
+
|
|
569
|
+
- @pnpm/core-loggers@9.0.1
|
|
570
|
+
- @pnpm/store-controller-types@15.0.1
|
|
571
|
+
|
|
572
|
+
## 3.0.0
|
|
573
|
+
|
|
574
|
+
### Major Changes
|
|
575
|
+
|
|
576
|
+
- eceaa8b8b: Node.js 14 support dropped.
|
|
577
|
+
|
|
578
|
+
### Patch Changes
|
|
579
|
+
|
|
580
|
+
- Updated dependencies [eceaa8b8b]
|
|
581
|
+
- @pnpm/store-controller-types@15.0.0
|
|
582
|
+
- @pnpm/core-loggers@9.0.0
|
|
583
|
+
- @pnpm/graceful-fs@3.0.0
|
|
584
|
+
|
|
585
|
+
## 2.1.4
|
|
586
|
+
|
|
587
|
+
### Patch Changes
|
|
588
|
+
|
|
589
|
+
- 955874422: Retry copying file on EBUSY error [#6201](https://github.com/pnpm/pnpm/issues/6201).
|
|
590
|
+
- Updated dependencies [955874422]
|
|
591
|
+
- @pnpm/graceful-fs@2.1.0
|
|
592
|
+
|
|
593
|
+
## 2.1.3
|
|
594
|
+
|
|
595
|
+
### Patch Changes
|
|
596
|
+
|
|
597
|
+
- @pnpm/store-controller-types@14.3.1
|
|
598
|
+
|
|
599
|
+
## 2.1.2
|
|
600
|
+
|
|
601
|
+
### Patch Changes
|
|
602
|
+
|
|
603
|
+
- 78d4cf1f7: Fix "cross-device link not permitted" error when `node-linker` is set to `hoisted` [#5992](https://github.com/pnpm/pnpm/issues/5992).
|
|
604
|
+
|
|
605
|
+
## 2.1.1
|
|
606
|
+
|
|
607
|
+
### Patch Changes
|
|
608
|
+
|
|
609
|
+
- Updated dependencies [891a8d763]
|
|
610
|
+
- Updated dependencies [c7b05cd9a]
|
|
611
|
+
- @pnpm/store-controller-types@14.3.0
|
|
612
|
+
|
|
613
|
+
## 2.1.0
|
|
614
|
+
|
|
615
|
+
### Minor Changes
|
|
616
|
+
|
|
617
|
+
- 2458741fa: A new option added to package importer for keeping modules directory: `keepModulesDir`. When this is set to true, if a package already exist at the target location and it has a node_modules directory, then that node_modules directory is moved to the newly imported dependency. This is only needed when node-linker=hoisted is used.
|
|
618
|
+
|
|
619
|
+
### Patch Changes
|
|
620
|
+
|
|
621
|
+
- Updated dependencies [2458741fa]
|
|
622
|
+
- @pnpm/store-controller-types@14.2.0
|
|
623
|
+
- @pnpm/core-loggers@8.0.3
|
|
624
|
+
|
|
625
|
+
## 2.0.2
|
|
626
|
+
|
|
627
|
+
### Patch Changes
|
|
628
|
+
|
|
629
|
+
- @pnpm/core-loggers@8.0.2
|
|
630
|
+
- @pnpm/store-controller-types@14.1.5
|
|
631
|
+
|
|
632
|
+
## 2.0.1
|
|
633
|
+
|
|
634
|
+
### Patch Changes
|
|
635
|
+
|
|
636
|
+
- @pnpm/core-loggers@8.0.1
|
|
637
|
+
- @pnpm/store-controller-types@14.1.4
|
|
638
|
+
|
|
639
|
+
## 2.0.0
|
|
640
|
+
|
|
641
|
+
### Major Changes
|
|
642
|
+
|
|
643
|
+
- f884689e0: Require `@pnpm/logger` v5.
|
|
644
|
+
|
|
645
|
+
### Patch Changes
|
|
646
|
+
|
|
647
|
+
- Updated dependencies [f884689e0]
|
|
648
|
+
- @pnpm/core-loggers@8.0.0
|
|
649
|
+
|
|
650
|
+
## 1.1.4
|
|
651
|
+
|
|
652
|
+
### Patch Changes
|
|
653
|
+
|
|
654
|
+
- Updated dependencies [3ae888c28]
|
|
655
|
+
- @pnpm/core-loggers@7.1.0
|
|
656
|
+
|
|
657
|
+
## 1.1.3
|
|
658
|
+
|
|
659
|
+
### Patch Changes
|
|
660
|
+
|
|
661
|
+
- @pnpm/core-loggers@7.0.8
|
|
662
|
+
- @pnpm/store-controller-types@14.1.3
|
|
663
|
+
|
|
664
|
+
## 1.1.2
|
|
665
|
+
|
|
666
|
+
### Patch Changes
|
|
667
|
+
|
|
668
|
+
- @pnpm/core-loggers@7.0.7
|
|
669
|
+
- @pnpm/store-controller-types@14.1.2
|
|
670
|
+
|
|
671
|
+
## 1.1.1
|
|
672
|
+
|
|
673
|
+
### Patch Changes
|
|
674
|
+
|
|
675
|
+
- Updated dependencies [32915f0e4]
|
|
676
|
+
- @pnpm/store-controller-types@14.1.1
|
|
677
|
+
|
|
678
|
+
## 1.1.0
|
|
679
|
+
|
|
680
|
+
### Minor Changes
|
|
681
|
+
|
|
682
|
+
- 65c4260de: Support a new hook for passing a custom package importer to the store controller.
|
|
683
|
+
|
|
684
|
+
### Patch Changes
|
|
685
|
+
|
|
686
|
+
- Updated dependencies [65c4260de]
|
|
687
|
+
- @pnpm/store-controller-types@14.1.0
|
|
688
|
+
|
|
689
|
+
## 1.0.1
|
|
690
|
+
|
|
691
|
+
### Patch Changes
|
|
692
|
+
|
|
693
|
+
- @pnpm/core-loggers@7.0.6
|
|
694
|
+
|
|
695
|
+
## 1.0.0
|
|
696
|
+
|
|
697
|
+
### Major Changes
|
|
698
|
+
|
|
699
|
+
- 7922d6314: Initial release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fs.indexed-pkg-importer",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.19",
|
|
4
4
|
"description": "Replicates indexed directories using hard links, copies, or cloning",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
"test": "test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@pnpm/core-loggers": "1100.2.3",
|
|
41
|
+
"@pnpm/fs.graceful-fs": "1100.1.0",
|
|
42
|
+
"@pnpm/store.controller-types": "1100.1.8",
|
|
40
43
|
"@reflink/reflink": "0.1.19",
|
|
41
44
|
"@zkochan/rimraf": "^4.0.0",
|
|
42
45
|
"fs-extra": "^11.3.5",
|
|
@@ -44,20 +47,17 @@
|
|
|
44
47
|
"p-limit": "^7.3.0",
|
|
45
48
|
"path-temp": "^3.0.0",
|
|
46
49
|
"rename-overwrite": "^7.0.1",
|
|
47
|
-
"sanitize-filename": "^1.6.4"
|
|
48
|
-
"@pnpm/fs.graceful-fs": "1100.1.0",
|
|
49
|
-
"@pnpm/store.controller-types": "1100.1.7",
|
|
50
|
-
"@pnpm/core-loggers": "1100.2.1"
|
|
50
|
+
"sanitize-filename": "^1.6.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@pnpm/logger": "^1100.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@jest/globals": "30.4.1",
|
|
57
|
-
"@
|
|
58
|
-
"@pnpm/fs.indexed-pkg-importer": "1100.0.17",
|
|
57
|
+
"@pnpm/fs.indexed-pkg-importer": "1100.0.19",
|
|
59
58
|
"@pnpm/logger": "1100.0.0",
|
|
60
|
-
"@pnpm/prepare": "1100.0.
|
|
59
|
+
"@pnpm/prepare": "1100.0.20",
|
|
60
|
+
"@types/fs-extra": "^11.0.4"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=22.13"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type ImportFile = (src: string, dest: string) => void;
|
|
2
|
-
export interface Importer {
|
|
3
|
-
importFile: ImportFile;
|
|
4
|
-
importFileAtomic: ImportFile;
|
|
5
|
-
}
|
|
6
|
-
export declare function importIndexedDir(importer: Importer, newDir: string, filenames: Map<string, string>, opts: {
|
|
7
|
-
keepModulesDir?: boolean;
|
|
8
|
-
safeToSkip?: boolean;
|
|
9
|
-
}): void;
|
package/lib/importIndexedDir.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import util from 'node:util';
|
|
4
|
-
import gfs from '@pnpm/fs.graceful-fs';
|
|
5
|
-
import { globalInfo, globalWarn, logger } from '@pnpm/logger';
|
|
6
|
-
import { rimrafSync } from '@zkochan/rimraf';
|
|
7
|
-
import fsx from 'fs-extra';
|
|
8
|
-
import { makeEmptyDirSync } from 'make-empty-dir';
|
|
9
|
-
import { fastPathTemp as pathTemp } from 'path-temp';
|
|
10
|
-
import { renameOverwriteSync } from 'rename-overwrite';
|
|
11
|
-
import sanitizeFilename from 'sanitize-filename';
|
|
12
|
-
const filenameConflictsLogger = logger('_filename-conflicts');
|
|
13
|
-
export function importIndexedDir(importer, newDir, filenames, opts) {
|
|
14
|
-
// Fast path: import directly without staging. Callers already verified
|
|
15
|
-
// the target package is missing (pkgExistsAtTargetDir / pkgLinkedToStore),
|
|
16
|
-
// so we can write straight into newDir and skip the temp dir + rename.
|
|
17
|
-
// On failure we fall through to the staging path, which has full error
|
|
18
|
-
// handling (EEXIST dedup, ENOENT sanitized-filename retry, etc.) and
|
|
19
|
-
// atomically swaps in a complete directory.
|
|
20
|
-
// keepModulesDir needs the staging path to preserve the existing node_modules.
|
|
21
|
-
if (!opts.keepModulesDir) {
|
|
22
|
-
if (opts.safeToSkip) {
|
|
23
|
-
// Content-addressed target (e.g. global virtual store): the path is
|
|
24
|
-
// shared across projects, so concurrent importers are expected. Use a
|
|
25
|
-
// non-destructive mkdir and let importFile dedup via EEXIST. If another
|
|
26
|
-
// importer already completed the directory, there's nothing to do.
|
|
27
|
-
try {
|
|
28
|
-
fs.mkdirSync(newDir, { recursive: true });
|
|
29
|
-
tryImportIndexedDir(importer, newDir, filenames);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
if (util.types.isNativeError(err) && 'code' in err && err.code === 'EEXIST' && allFilesMatch(newDir, filenames)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else if (tryExclusiveImport(importer, newDir, filenames)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Staging path: create in temp dir, then atomically rename.
|
|
43
|
-
// The dir rename is itself atomic, so individual file atomicity is not
|
|
44
|
-
// needed here — use importFile for everything.
|
|
45
|
-
const stage = pathTemp(newDir);
|
|
46
|
-
try {
|
|
47
|
-
makeEmptyDirSync(stage, { recursive: true });
|
|
48
|
-
tryImportIndexedDir({ importFile: importer.importFile, importFileAtomic: importer.importFile }, stage, filenames);
|
|
49
|
-
if (opts.keepModulesDir) {
|
|
50
|
-
// Keeping node_modules is needed only when the hoisted node linker is used.
|
|
51
|
-
moveOrMergeModulesDirs(path.join(newDir, 'node_modules'), path.join(stage, 'node_modules'));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
try {
|
|
56
|
-
rimrafSync(stage);
|
|
57
|
-
}
|
|
58
|
-
catch { } // eslint-disable-line:no-empty
|
|
59
|
-
if (util.types.isNativeError(err) && 'code' in err && err.code === 'EEXIST') {
|
|
60
|
-
const { uniqueFileMap, conflictingFileNames } = getUniqueFileMap(filenames);
|
|
61
|
-
if (conflictingFileNames.size === 0)
|
|
62
|
-
throw err;
|
|
63
|
-
filenameConflictsLogger.debug({
|
|
64
|
-
conflicts: Object.fromEntries(conflictingFileNames),
|
|
65
|
-
writingTo: newDir,
|
|
66
|
-
});
|
|
67
|
-
globalWarn(`Not all files were linked to "${path.relative(process.cwd(), newDir)}". ` +
|
|
68
|
-
'Some of the files have equal names in different case, ' +
|
|
69
|
-
'which is an issue on case-insensitive filesystems. ' +
|
|
70
|
-
`The conflicting file names are: ${JSON.stringify(Object.fromEntries(conflictingFileNames))}`);
|
|
71
|
-
importIndexedDir(importer, newDir, uniqueFileMap, opts);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT') {
|
|
75
|
-
if (retryWithSanitizedFilenames(importer, newDir, filenames, opts))
|
|
76
|
-
return;
|
|
77
|
-
throw err;
|
|
78
|
-
}
|
|
79
|
-
throw err;
|
|
80
|
-
}
|
|
81
|
-
if (opts.safeToSkip) {
|
|
82
|
-
// Content-addressable target (e.g. global virtual store): if the target
|
|
83
|
-
// already exists and has all expected files, it has the correct content.
|
|
84
|
-
// Skip instead of doing a swap-rename that temporarily removes the target
|
|
85
|
-
// directory — which breaks junctions read by other processes.
|
|
86
|
-
try {
|
|
87
|
-
fs.renameSync(stage, newDir);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
if (util.types.isNativeError(err) && 'code' in err && (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM')) {
|
|
92
|
-
if (allFilesMatch(newDir, filenames)) {
|
|
93
|
-
try {
|
|
94
|
-
rimrafSync(stage);
|
|
95
|
-
}
|
|
96
|
-
catch { } // eslint-disable-line:no-empty
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// Files missing or other error — fall through to renameOverwriteSync
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
renameOverwriteSync(stage, newDir);
|
|
105
|
-
}
|
|
106
|
-
catch (renameErr) {
|
|
107
|
-
try {
|
|
108
|
-
rimrafSync(stage);
|
|
109
|
-
}
|
|
110
|
-
catch { } // eslint-disable-line:no-empty
|
|
111
|
-
throw renameErr;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Fast path for the regular virtual store: write directly into newDir, but
|
|
115
|
-
// only when we can create it exclusively. A successful exclusive mkdir proves
|
|
116
|
-
// no other process is importing the same package concurrently, so the direct
|
|
117
|
-
// (non-atomic) write is safe. If newDir already exists — a concurrent importer
|
|
118
|
-
// or a stale partial directory from an interrupted import — this returns false
|
|
119
|
-
// so the caller falls back to the staging path, which builds a complete
|
|
120
|
-
// directory in a private temp dir and atomically renames it into place.
|
|
121
|
-
//
|
|
122
|
-
// Destructively emptying a directory another process may be populating could
|
|
123
|
-
// otherwise leave a partial package behind: if the surviving files include the
|
|
124
|
-
// package.json completion marker, every later install treats the broken
|
|
125
|
-
// directory as complete and never repairs it.
|
|
126
|
-
function tryExclusiveImport(importer, newDir, filenames) {
|
|
127
|
-
fs.mkdirSync(path.dirname(newDir), { recursive: true });
|
|
128
|
-
try {
|
|
129
|
-
fs.mkdirSync(newDir);
|
|
130
|
-
}
|
|
131
|
-
catch (err) {
|
|
132
|
-
if (util.types.isNativeError(err) && 'code' in err && err.code === 'EEXIST')
|
|
133
|
-
return false;
|
|
134
|
-
throw err;
|
|
135
|
-
}
|
|
136
|
-
// We exclusively created newDir, so no other process writes into it directly
|
|
137
|
-
// (concurrent importers see EEXIST above and take the staging path). The
|
|
138
|
-
// directory is ours: on failure we remove our partial result before falling
|
|
139
|
-
// back to staging, so the next attempt — including this process's own method
|
|
140
|
-
// fallbacks (clone → hardlink → copy) — can fast-path again.
|
|
141
|
-
try {
|
|
142
|
-
tryImportIndexedDir(importer, newDir, filenames);
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
catch {
|
|
146
|
-
try {
|
|
147
|
-
rimrafSync(newDir);
|
|
148
|
-
}
|
|
149
|
-
catch { } // eslint-disable-line:no-empty
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function allFilesMatch(dir, filenames) {
|
|
154
|
-
for (const [f, src] of filenames) {
|
|
155
|
-
const target = path.join(dir, f);
|
|
156
|
-
try {
|
|
157
|
-
const targetStat = gfs.statSync(target);
|
|
158
|
-
const srcStat = gfs.statSync(src);
|
|
159
|
-
// Fast path: hardlinks share the same inode
|
|
160
|
-
if (targetStat.ino === srcStat.ino && targetStat.dev === srcStat.dev)
|
|
161
|
-
continue;
|
|
162
|
-
// Copy path: compare size first, then content
|
|
163
|
-
if (targetStat.size !== srcStat.size) {
|
|
164
|
-
globalInfo(`Re-importing "${dir}" because file "${f}" has a different size`);
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
if (!gfs.readFileSync(target).equals(gfs.readFileSync(src))) {
|
|
168
|
-
globalInfo(`Re-importing "${dir}" because file "${f}" has different content`);
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
globalInfo(`Re-importing "${dir}" because file "${f}" is missing or unreadable`);
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
function retryWithSanitizedFilenames(importer, newDir, filenames, opts) {
|
|
180
|
-
const { sanitizedFilenames, invalidFilenames } = sanitizeFilenames(filenames);
|
|
181
|
-
if (invalidFilenames.length === 0)
|
|
182
|
-
return false;
|
|
183
|
-
globalWarn(`\
|
|
184
|
-
The package linked to "${path.relative(process.cwd(), newDir)}" had \
|
|
185
|
-
files with invalid names: ${invalidFilenames.join(', ')}. \
|
|
186
|
-
They were renamed.`);
|
|
187
|
-
importIndexedDir(importer, newDir, sanitizedFilenames, opts);
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
function sanitizeFilenames(filenames) {
|
|
191
|
-
const sanitizedFilenames = new Map();
|
|
192
|
-
const invalidFilenames = [];
|
|
193
|
-
for (const [filename, src] of filenames) {
|
|
194
|
-
const sanitizedFilename = filename.split('/').map((f) => sanitizeFilename(f)).join('/');
|
|
195
|
-
if (sanitizedFilename !== filename) {
|
|
196
|
-
invalidFilenames.push(filename);
|
|
197
|
-
}
|
|
198
|
-
sanitizedFilenames.set(sanitizedFilename, src);
|
|
199
|
-
}
|
|
200
|
-
return { sanitizedFilenames, invalidFilenames };
|
|
201
|
-
}
|
|
202
|
-
function tryImportIndexedDir({ importFile, importFileAtomic }, newDir, filenames) {
|
|
203
|
-
const allDirs = new Set();
|
|
204
|
-
for (const f of filenames.keys()) {
|
|
205
|
-
const dir = path.dirname(f);
|
|
206
|
-
if (dir === '.')
|
|
207
|
-
continue;
|
|
208
|
-
allDirs.add(dir);
|
|
209
|
-
}
|
|
210
|
-
Array.from(allDirs)
|
|
211
|
-
.sort((d1, d2) => d1.length - d2.length) // from shortest to longest
|
|
212
|
-
.forEach((dir) => fs.mkdirSync(path.join(newDir, dir), { recursive: true }));
|
|
213
|
-
// Write package.json last so it acts as a completion marker.
|
|
214
|
-
// pkgExistsAtTargetDir() checks for package.json to decide if a package
|
|
215
|
-
// is already imported — writing it last ensures a crash mid-import won't
|
|
216
|
-
// leave a partially-populated directory that appears fully imported.
|
|
217
|
-
let packageJsonSrc;
|
|
218
|
-
for (const [f, src] of filenames) {
|
|
219
|
-
if (f === 'package.json') {
|
|
220
|
-
packageJsonSrc = src;
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
importFile(src, path.join(newDir, f));
|
|
224
|
-
}
|
|
225
|
-
if (packageJsonSrc !== undefined) {
|
|
226
|
-
importFileAtomic(packageJsonSrc, path.join(newDir, 'package.json'));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function getUniqueFileMap(fileMap) {
|
|
230
|
-
const lowercaseFiles = new Map();
|
|
231
|
-
const conflictingFileNames = new Map();
|
|
232
|
-
const uniqueFileMap = new Map();
|
|
233
|
-
for (const filename of Array.from(fileMap.keys()).sort()) {
|
|
234
|
-
const lowercaseFilename = filename.toLowerCase();
|
|
235
|
-
if (lowercaseFiles.has(lowercaseFilename)) {
|
|
236
|
-
conflictingFileNames.set(filename, lowercaseFiles.get(lowercaseFilename));
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
lowercaseFiles.set(lowercaseFilename, filename);
|
|
240
|
-
uniqueFileMap.set(filename, fileMap.get(filename));
|
|
241
|
-
}
|
|
242
|
-
return {
|
|
243
|
-
conflictingFileNames,
|
|
244
|
-
uniqueFileMap,
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function moveOrMergeModulesDirs(src, dest) {
|
|
248
|
-
try {
|
|
249
|
-
renameEvenAcrossDevices(src, dest);
|
|
250
|
-
}
|
|
251
|
-
catch (err) {
|
|
252
|
-
switch (util.types.isNativeError(err) && 'code' in err && err.code) {
|
|
253
|
-
case 'ENOENT':
|
|
254
|
-
// If src directory doesn't exist, there is nothing to do
|
|
255
|
-
return;
|
|
256
|
-
case 'ENOTEMPTY':
|
|
257
|
-
case 'EPERM': // This error code is thrown on Windows
|
|
258
|
-
// The newly added dependency might have node_modules if it has bundled dependencies.
|
|
259
|
-
mergeModulesDirs(src, dest);
|
|
260
|
-
return;
|
|
261
|
-
default:
|
|
262
|
-
throw err;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function renameEvenAcrossDevices(src, dest) {
|
|
267
|
-
try {
|
|
268
|
-
gfs.renameSync(src, dest);
|
|
269
|
-
}
|
|
270
|
-
catch (err) {
|
|
271
|
-
if (!(util.types.isNativeError(err) && 'code' in err && err.code === 'EXDEV'))
|
|
272
|
-
throw err;
|
|
273
|
-
fsx.copySync(src, dest);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function mergeModulesDirs(src, dest) {
|
|
277
|
-
const srcFiles = fs.readdirSync(src);
|
|
278
|
-
const destFiles = new Set(fs.readdirSync(dest));
|
|
279
|
-
const filesToMove = srcFiles.filter((file) => !destFiles.has(file));
|
|
280
|
-
for (const file of filesToMove) {
|
|
281
|
-
renameEvenAcrossDevices(path.join(src, file), path.join(dest, file));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
//# sourceMappingURL=importIndexedDir.js.map
|
package/lib/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FilesMap, ImportIndexedPackage, ImportOptions } from '@pnpm/store.controller-types';
|
|
2
|
-
export { type FilesMap, type ImportIndexedPackage, type ImportOptions };
|
|
3
|
-
export type PackageImportMethod = 'auto' | 'hardlink' | 'copy' | 'clone' | 'clone-or-copy';
|
|
4
|
-
export declare function createIndexedPkgImporter(packageImportMethod?: PackageImportMethod): ImportIndexedPackage;
|
|
5
|
-
export declare function copyPkg(to: string, opts: ImportOptions): 'copy' | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native binaries are the only files that macOS Gatekeeper blocks for carrying a
|
|
3
|
-
* quarantine xattr, so removing it from anything else (JavaScript, text, etc.)
|
|
4
|
-
* just wastes a syscall.
|
|
5
|
-
*/
|
|
6
|
-
export declare function isNativeBinary(filePath: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Remove the macOS Gatekeeper quarantine xattr (com.apple.quarantine) from the
|
|
9
|
-
* given files using a single `xattr` invocation.
|
|
10
|
-
*
|
|
11
|
-
* macOS preserves extended attributes when pnpm copies or reflinks files out of
|
|
12
|
-
* its content-addressable store. If a store blob carries com.apple.quarantine
|
|
13
|
-
* (e.g. it was first written under a Gatekeeper-enabled app such as a Git
|
|
14
|
-
* client), the quarantine propagates to node_modules and Gatekeeper blocks the
|
|
15
|
-
* native binary from loading, even though pnpm already verified the file's
|
|
16
|
-
* integrity against the lockfile. This mirrors Homebrew's behaviour of dropping
|
|
17
|
-
* quarantine from verified downloads.
|
|
18
|
-
*
|
|
19
|
-
* File paths are passed as separate arguments rather than interpolated into a
|
|
20
|
-
* shell command, so package-controlled filenames cannot inject shell commands.
|
|
21
|
-
* They are split into chunks that stay under the OS argv limit.
|
|
22
|
-
*/
|
|
23
|
-
export declare function removeQuarantine(filePaths: string[]): void;
|
package/lib/removeQuarantine.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { globalWarn } from '@pnpm/logger';
|
|
4
|
-
const QUARANTINE_ATTR = 'com.apple.quarantine';
|
|
5
|
-
// Quarantine removal only ever runs on macOS, so the set lists the binary
|
|
6
|
-
// formats Gatekeeper guards there (.dll is Windows-only and never matches).
|
|
7
|
-
const NATIVE_BINARY_EXTENSIONS = new Set(['.node', '.dylib', '.so']);
|
|
8
|
-
// Cap the bytes of file-path arguments per `xattr` call so a package with many
|
|
9
|
-
// (or very long) native-binary paths can't blow past the OS argv limit
|
|
10
|
-
// (ARG_MAX, ~1 MB on macOS). Well under the limit to leave room for argv0 and
|
|
11
|
-
// the environment block.
|
|
12
|
-
const MAX_ARG_BYTES = 100_000;
|
|
13
|
-
/**
|
|
14
|
-
* Native binaries are the only files that macOS Gatekeeper blocks for carrying a
|
|
15
|
-
* quarantine xattr, so removing it from anything else (JavaScript, text, etc.)
|
|
16
|
-
* just wastes a syscall.
|
|
17
|
-
*/
|
|
18
|
-
export function isNativeBinary(filePath) {
|
|
19
|
-
return NATIVE_BINARY_EXTENSIONS.has(path.extname(filePath).toLowerCase());
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Remove the macOS Gatekeeper quarantine xattr (com.apple.quarantine) from the
|
|
23
|
-
* given files using a single `xattr` invocation.
|
|
24
|
-
*
|
|
25
|
-
* macOS preserves extended attributes when pnpm copies or reflinks files out of
|
|
26
|
-
* its content-addressable store. If a store blob carries com.apple.quarantine
|
|
27
|
-
* (e.g. it was first written under a Gatekeeper-enabled app such as a Git
|
|
28
|
-
* client), the quarantine propagates to node_modules and Gatekeeper blocks the
|
|
29
|
-
* native binary from loading, even though pnpm already verified the file's
|
|
30
|
-
* integrity against the lockfile. This mirrors Homebrew's behaviour of dropping
|
|
31
|
-
* quarantine from verified downloads.
|
|
32
|
-
*
|
|
33
|
-
* File paths are passed as separate arguments rather than interpolated into a
|
|
34
|
-
* shell command, so package-controlled filenames cannot inject shell commands.
|
|
35
|
-
* They are split into chunks that stay under the OS argv limit.
|
|
36
|
-
*/
|
|
37
|
-
export function removeQuarantine(filePaths) {
|
|
38
|
-
if (process.platform !== 'darwin')
|
|
39
|
-
return;
|
|
40
|
-
for (const chunk of chunkByArgSize(filePaths)) {
|
|
41
|
-
removeQuarantineFromChunk(chunk);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function removeQuarantineFromChunk(filePaths) {
|
|
45
|
-
try {
|
|
46
|
-
execFileSync('/usr/bin/xattr', ['-d', QUARANTINE_ATTR, ...filePaths], {
|
|
47
|
-
stdio: ['ignore', 'ignore', 'pipe'],
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
// `xattr -d` exits non-zero when a file simply has no quarantine xattr to
|
|
52
|
-
// remove ("No such xattr"), which is the common, expected case. It also
|
|
53
|
-
// reports "No such file" for entries the importer legitimately dropped or
|
|
54
|
-
// renamed (e.g. case-insensitive filename conflicts). Surface only errors
|
|
55
|
-
// that are not of those kinds (e.g. permission denied).
|
|
56
|
-
const realErrors = getStderr(err)
|
|
57
|
-
.split('\n')
|
|
58
|
-
.filter((line) => line.trim() !== '' && !line.includes('No such xattr') && !line.includes('No such file'));
|
|
59
|
-
if (realErrors.length > 0) {
|
|
60
|
-
globalWarn(`Failed to remove the macOS quarantine attribute:\n${realErrors.join('\n')}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function chunkByArgSize(filePaths) {
|
|
65
|
-
const chunks = [];
|
|
66
|
-
let chunk = [];
|
|
67
|
-
let chunkBytes = 0;
|
|
68
|
-
for (const filePath of filePaths) {
|
|
69
|
-
const bytes = Buffer.byteLength(filePath) + 1; // +1 for the argv null terminator
|
|
70
|
-
if (chunk.length > 0 && chunkBytes + bytes > MAX_ARG_BYTES) {
|
|
71
|
-
chunks.push(chunk);
|
|
72
|
-
chunk = [];
|
|
73
|
-
chunkBytes = 0;
|
|
74
|
-
}
|
|
75
|
-
chunk.push(filePath);
|
|
76
|
-
chunkBytes += bytes;
|
|
77
|
-
}
|
|
78
|
-
if (chunk.length > 0)
|
|
79
|
-
chunks.push(chunk);
|
|
80
|
-
return chunks;
|
|
81
|
-
}
|
|
82
|
-
function getStderr(err) {
|
|
83
|
-
if (typeof err === 'object' && err !== null && 'stderr' in err) {
|
|
84
|
-
const stderr = err.stderr;
|
|
85
|
-
if (stderr != null)
|
|
86
|
-
return stderr.toString();
|
|
87
|
-
}
|
|
88
|
-
return err instanceof Error ? err.message : String(err);
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=removeQuarantine.js.map
|