rolldown-pnpm-config 2.5.2 → 3.0.1

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/registry.js CHANGED
@@ -1,7 +1,474 @@
1
- import { DESCRIPTORS, deriveRegistry } from "./descriptors/index.js";
1
+ import { PnpmSettingsCatalog } from "@effected/pnpm/settings";
2
2
 
3
3
  // src/registry.ts
4
- /** Maps each known pnpm field to its strategy + default enforcement. Derived from the descriptor table. @internal */
5
- const FIELD_REGISTRY = deriveRegistry(DESCRIPTORS);
4
+ /**
5
+ * Every pnpm setting the plugin manages, with its policy. The facts about each
6
+ * setting (its schema, where pnpm reads it, its documentation) come from
7
+ * `@effected/pnpm/settings`; this table holds only what the plugin decides.
8
+ *
9
+ * @remarks
10
+ * `satisfies` against the catalog's key set makes a setting the catalog does
11
+ * not know (a phantom, or one pnpm 12 stopped reading) a compile error here,
12
+ * so the plugin cannot offer a setting pnpm would ignore.
13
+ *
14
+ * @internal
15
+ */
16
+ const FIELD_REGISTRY = {
17
+ catalogs: {
18
+ strategy: "catalogs",
19
+ enforcement: "warn"
20
+ },
21
+ packageExtensions: {
22
+ strategy: "mapChildWins",
23
+ enforcement: "absent"
24
+ },
25
+ allowedDeprecatedVersions: {
26
+ strategy: "mapChildWins",
27
+ enforcement: "absent"
28
+ },
29
+ publicHoistPattern: {
30
+ strategy: "arrayUnion",
31
+ enforcement: "absent"
32
+ },
33
+ minimumReleaseAgeExclude: {
34
+ strategy: "arrayUnion",
35
+ enforcement: "absent"
36
+ },
37
+ supportedArchitectures: {
38
+ strategy: "arrayRecordUnion",
39
+ enforcement: "absent"
40
+ },
41
+ audit: {
42
+ strategy: "sectionMerge",
43
+ enforcement: "absent"
44
+ },
45
+ auditConfig: {
46
+ strategy: "arrayRecordUnion",
47
+ enforcement: "absent"
48
+ },
49
+ overrides: {
50
+ strategy: "overrides",
51
+ enforcement: "warn"
52
+ },
53
+ peerDependencyRules: {
54
+ strategy: "peerDependencyRules",
55
+ enforcement: "warn"
56
+ },
57
+ strictDepBuilds: {
58
+ strategy: "securityFlag",
59
+ enforcement: "warn"
60
+ },
61
+ blockExoticSubdeps: {
62
+ strategy: "securityFlag",
63
+ enforcement: "warn"
64
+ },
65
+ minimumReleaseAge: {
66
+ strategy: "securityMin",
67
+ enforcement: "warn"
68
+ },
69
+ allowBuilds: {
70
+ strategy: "allowBuilds",
71
+ enforcement: "warn"
72
+ },
73
+ ignoredOptionalDependencies: {
74
+ strategy: "arrayUnion",
75
+ enforcement: "absent"
76
+ },
77
+ update: {
78
+ strategy: "sectionMerge",
79
+ enforcement: "absent"
80
+ },
81
+ updateConfig: {
82
+ strategy: "mapChildWins",
83
+ enforcement: "absent"
84
+ },
85
+ catalog: {
86
+ strategy: "mapChildWins",
87
+ enforcement: "warn"
88
+ },
89
+ minimumReleaseAgeStrict: {
90
+ strategy: "scalar",
91
+ enforcement: "warn"
92
+ },
93
+ minimumReleaseAgeIgnoreMissingTime: {
94
+ strategy: "scalar",
95
+ enforcement: "warn"
96
+ },
97
+ trustPolicy: {
98
+ strategy: "scalar",
99
+ enforcement: "warn"
100
+ },
101
+ trustPolicyExclude: {
102
+ strategy: "arrayUnion",
103
+ enforcement: "warn"
104
+ },
105
+ trustPolicyIgnoreAfter: {
106
+ strategy: "scalar",
107
+ enforcement: "warn"
108
+ },
109
+ trustLockfile: {
110
+ strategy: "scalar",
111
+ enforcement: "warn"
112
+ },
113
+ hoist: {
114
+ strategy: "scalar",
115
+ enforcement: "absent"
116
+ },
117
+ hoistWorkspacePackages: {
118
+ strategy: "scalar",
119
+ enforcement: "absent"
120
+ },
121
+ hoistPattern: {
122
+ strategy: "arrayUnion",
123
+ enforcement: "absent"
124
+ },
125
+ shamefullyHoist: {
126
+ strategy: "scalar",
127
+ enforcement: "absent"
128
+ },
129
+ hoistingLimits: {
130
+ strategy: "scalar",
131
+ enforcement: "absent"
132
+ },
133
+ modulesDir: {
134
+ strategy: "scalar",
135
+ enforcement: "absent"
136
+ },
137
+ nodeLinker: {
138
+ strategy: "scalar",
139
+ enforcement: "absent"
140
+ },
141
+ symlink: {
142
+ strategy: "scalar",
143
+ enforcement: "absent"
144
+ },
145
+ enableModulesDir: {
146
+ strategy: "scalar",
147
+ enforcement: "absent"
148
+ },
149
+ virtualStoreDir: {
150
+ strategy: "scalar",
151
+ enforcement: "absent"
152
+ },
153
+ virtualStoreDirMaxLength: {
154
+ strategy: "scalar",
155
+ enforcement: "absent"
156
+ },
157
+ virtualStoreOnly: {
158
+ strategy: "scalar",
159
+ enforcement: "absent"
160
+ },
161
+ packageImportMethod: {
162
+ strategy: "scalar",
163
+ enforcement: "absent"
164
+ },
165
+ modulesCacheMaxAge: {
166
+ strategy: "scalar",
167
+ enforcement: "absent"
168
+ },
169
+ dlxCacheMaxAge: {
170
+ strategy: "scalar",
171
+ enforcement: "absent"
172
+ },
173
+ verifyStoreIntegrity: {
174
+ strategy: "scalar",
175
+ enforcement: "warn"
176
+ },
177
+ strictStorePkgContentCheck: {
178
+ strategy: "scalar",
179
+ enforcement: "warn"
180
+ },
181
+ lockfile: {
182
+ strategy: "scalar",
183
+ enforcement: "absent"
184
+ },
185
+ preferFrozenLockfile: {
186
+ strategy: "scalar",
187
+ enforcement: "absent"
188
+ },
189
+ lockfileIncludeTarballUrl: {
190
+ strategy: "scalar",
191
+ enforcement: "absent"
192
+ },
193
+ gitBranchLockfile: {
194
+ strategy: "scalar",
195
+ enforcement: "absent"
196
+ },
197
+ mergeGitBranchLockfilesBranchPattern: {
198
+ strategy: "arrayUnion",
199
+ enforcement: "absent"
200
+ },
201
+ peersSuffixMaxLength: {
202
+ strategy: "scalar",
203
+ enforcement: "absent"
204
+ },
205
+ sharedWorkspaceLockfile: {
206
+ strategy: "scalar",
207
+ enforcement: "absent"
208
+ },
209
+ autoInstallPeers: {
210
+ strategy: "scalar",
211
+ enforcement: "absent"
212
+ },
213
+ dedupePeerDependents: {
214
+ strategy: "scalar",
215
+ enforcement: "absent"
216
+ },
217
+ dedupePeers: {
218
+ strategy: "scalar",
219
+ enforcement: "absent"
220
+ },
221
+ strictPeerDependencies: {
222
+ strategy: "scalar",
223
+ enforcement: "absent"
224
+ },
225
+ resolvePeersFromWorkspaceRoot: {
226
+ strategy: "scalar",
227
+ enforcement: "absent"
228
+ },
229
+ dangerouslyAllowAllBuilds: {
230
+ strategy: "scalar",
231
+ enforcement: "warn"
232
+ },
233
+ ignoreScripts: {
234
+ strategy: "scalar",
235
+ enforcement: "absent"
236
+ },
237
+ childConcurrency: {
238
+ strategy: "scalar",
239
+ enforcement: "absent"
240
+ },
241
+ sideEffectsCache: {
242
+ strategy: "scalar",
243
+ enforcement: "absent"
244
+ },
245
+ sideEffectsCacheReadonly: {
246
+ strategy: "scalar",
247
+ enforcement: "absent"
248
+ },
249
+ nodeOptions: {
250
+ strategy: "scalar",
251
+ enforcement: "absent"
252
+ },
253
+ verifyDepsBeforeRun: {
254
+ strategy: "scalar",
255
+ enforcement: "absent"
256
+ },
257
+ enablePrePostScripts: {
258
+ strategy: "scalar",
259
+ enforcement: "absent"
260
+ },
261
+ scriptShell: {
262
+ strategy: "scalar",
263
+ enforcement: "absent"
264
+ },
265
+ shellEmulator: {
266
+ strategy: "scalar",
267
+ enforcement: "absent"
268
+ },
269
+ requiredScripts: {
270
+ strategy: "arrayUnion",
271
+ enforcement: "absent"
272
+ },
273
+ patchedDependencies: {
274
+ strategy: "mapChildWins",
275
+ enforcement: "warn"
276
+ },
277
+ allowUnusedPatches: {
278
+ strategy: "scalar",
279
+ enforcement: "absent"
280
+ },
281
+ patchesDir: {
282
+ strategy: "scalar",
283
+ enforcement: "absent"
284
+ },
285
+ configDependencies: {
286
+ strategy: "mapChildWins",
287
+ enforcement: "absent"
288
+ },
289
+ injectWorkspacePackages: {
290
+ strategy: "scalar",
291
+ enforcement: "absent"
292
+ },
293
+ syncInjectedDepsAfterScripts: {
294
+ strategy: "arrayUnion",
295
+ enforcement: "absent"
296
+ },
297
+ dedupeInjectedDeps: {
298
+ strategy: "scalar",
299
+ enforcement: "absent"
300
+ },
301
+ pmOnFail: {
302
+ strategy: "scalar",
303
+ enforcement: "absent"
304
+ },
305
+ runtimeOnFail: {
306
+ strategy: "scalar",
307
+ enforcement: "absent"
308
+ },
309
+ nodeVersion: {
310
+ strategy: "scalar",
311
+ enforcement: "absent"
312
+ },
313
+ nodeDownloadMirrors: {
314
+ strategy: "mapChildWins",
315
+ enforcement: "absent"
316
+ },
317
+ catalogMode: {
318
+ strategy: "scalar",
319
+ enforcement: "absent"
320
+ },
321
+ cleanupUnusedCatalogs: {
322
+ strategy: "scalar",
323
+ enforcement: "absent"
324
+ },
325
+ linkWorkspacePackages: {
326
+ strategy: "scalar",
327
+ enforcement: "absent"
328
+ },
329
+ preferWorkspacePackages: {
330
+ strategy: "scalar",
331
+ enforcement: "absent"
332
+ },
333
+ saveWorkspaceProtocol: {
334
+ strategy: "scalar",
335
+ enforcement: "absent"
336
+ },
337
+ includeWorkspaceRoot: {
338
+ strategy: "scalar",
339
+ enforcement: "absent"
340
+ },
341
+ ignoreWorkspaceCycles: {
342
+ strategy: "scalar",
343
+ enforcement: "absent"
344
+ },
345
+ disallowWorkspaceCycles: {
346
+ strategy: "scalar",
347
+ enforcement: "absent"
348
+ },
349
+ workspaceConcurrency: {
350
+ strategy: "scalar",
351
+ enforcement: "absent"
352
+ },
353
+ auditLevel: {
354
+ strategy: "scalar",
355
+ enforcement: "absent"
356
+ },
357
+ resolutionMode: {
358
+ strategy: "scalar",
359
+ enforcement: "absent"
360
+ },
361
+ savePrefix: {
362
+ strategy: "scalar",
363
+ enforcement: "absent"
364
+ },
365
+ saveExact: {
366
+ strategy: "scalar",
367
+ enforcement: "absent"
368
+ },
369
+ tag: {
370
+ strategy: "scalar",
371
+ enforcement: "absent"
372
+ },
373
+ preferOffline: {
374
+ strategy: "scalar",
375
+ enforcement: "absent"
376
+ },
377
+ dedupeDirectDeps: {
378
+ strategy: "scalar",
379
+ enforcement: "absent"
380
+ },
381
+ deployAllFiles: {
382
+ strategy: "scalar",
383
+ enforcement: "absent"
384
+ },
385
+ forceLegacyDeploy: {
386
+ strategy: "scalar",
387
+ enforcement: "absent"
388
+ },
389
+ extendNodePath: {
390
+ strategy: "scalar",
391
+ enforcement: "absent"
392
+ },
393
+ preferSymlinkedExecutables: {
394
+ strategy: "scalar",
395
+ enforcement: "absent"
396
+ },
397
+ ignoreCompatibilityDb: {
398
+ strategy: "scalar",
399
+ enforcement: "absent"
400
+ },
401
+ optimisticRepeatInstall: {
402
+ strategy: "scalar",
403
+ enforcement: "absent"
404
+ },
405
+ recursiveInstall: {
406
+ strategy: "scalar",
407
+ enforcement: "absent"
408
+ },
409
+ engineStrict: {
410
+ strategy: "scalar",
411
+ enforcement: "absent"
412
+ },
413
+ networkConcurrency: {
414
+ strategy: "scalar",
415
+ enforcement: "absent"
416
+ },
417
+ fetchRetries: {
418
+ strategy: "scalar",
419
+ enforcement: "absent"
420
+ },
421
+ fetchRetryFactor: {
422
+ strategy: "scalar",
423
+ enforcement: "absent"
424
+ },
425
+ fetchRetryMintimeout: {
426
+ strategy: "scalar",
427
+ enforcement: "absent"
428
+ },
429
+ fetchRetryMaxtimeout: {
430
+ strategy: "scalar",
431
+ enforcement: "absent"
432
+ },
433
+ fetchTimeout: {
434
+ strategy: "scalar",
435
+ enforcement: "absent"
436
+ },
437
+ gitShallowHosts: {
438
+ strategy: "arrayUnion",
439
+ enforcement: "absent"
440
+ },
441
+ provenance: {
442
+ strategy: "scalar",
443
+ enforcement: "absent"
444
+ },
445
+ gitChecks: {
446
+ strategy: "scalar",
447
+ enforcement: "absent"
448
+ },
449
+ embedReadme: {
450
+ strategy: "scalar",
451
+ enforcement: "absent"
452
+ },
453
+ publishBranch: {
454
+ strategy: "scalar",
455
+ enforcement: "absent"
456
+ }
457
+ };
458
+ /** Every managed field, in table order. @internal */
459
+ const MANAGED_FIELDS = Object.keys(FIELD_REGISTRY);
460
+ /**
461
+ * Each managed field's value schema, from the pnpm settings catalog.
462
+ *
463
+ * @internal
464
+ */
465
+ const FIELD_SCHEMAS = Object.fromEntries(MANAGED_FIELDS.map((field) => [field, PnpmSettingsCatalog.entries[field].schema]));
466
+ /**
467
+ * The managed fields that belong in `pnpm-workspace.yaml`: those pnpm 12 reads
468
+ * from that file, per the catalog's `locations`.
469
+ *
470
+ * @internal
471
+ */
472
+ const WORKSPACE_FIELDS = new Set(MANAGED_FIELDS.filter((field) => PnpmSettingsCatalog.entries[field].locations.includes("workspace")));
6
473
 
7
- export { FIELD_REGISTRY };
474
+ export { FIELD_REGISTRY, FIELD_SCHEMAS, MANAGED_FIELDS, WORKSPACE_FIELDS };
@@ -35,5 +35,31 @@ const arrayRecordUnion = (base, local) => {
35
35
  divergences: []
36
36
  };
37
37
  };
38
+ /**
39
+ * A settings section with list and scalar keys (`audit`, `update`): a key whose
40
+ * managed or local value is a string list is unioned like `arrayUnion`, so a
41
+ * consumer's `audit.ignore` adds to the managed advisories instead of replacing
42
+ * them; any other key is `child ?? managed`. Quiet.
43
+ *
44
+ * @internal
45
+ */
46
+ const sectionMerge = (base, local) => {
47
+ const managed = base ?? {};
48
+ const child = local ?? {};
49
+ const result = {};
50
+ for (const key of [.../* @__PURE__ */ new Set([...Object.keys(managed), ...Object.keys(child)])].sort(byCodeUnit)) {
51
+ const m = managed[key];
52
+ const c = child[key];
53
+ if (Array.isArray(m) || Array.isArray(c)) result[key] = unionSort(Array.isArray(m) ? m : [], Array.isArray(c) ? c : void 0);
54
+ else {
55
+ const value = c ?? m;
56
+ if (value !== void 0) result[key] = value;
57
+ }
58
+ }
59
+ return {
60
+ merged: result,
61
+ divergences: []
62
+ };
63
+ };
38
64
 
39
- export { arrayRecordUnion, arrayUnion, unionSort };
65
+ export { arrayRecordUnion, arrayUnion, sectionMerge, unionSort };
@@ -1,4 +1,4 @@
1
- import { arrayRecordUnion, arrayUnion } from "./arrays.js";
1
+ import { arrayRecordUnion, arrayUnion, sectionMerge } from "./arrays.js";
2
2
  import { catalogs } from "./catalogs.js";
3
3
  import { allowBuilds, mapChildWins } from "./maps.js";
4
4
  import { overrides, peerDependencyRules } from "./overrides.js";
@@ -16,6 +16,7 @@ const STRATEGY_TABLE = {
16
16
  mapChildWins,
17
17
  arrayUnion,
18
18
  arrayRecordUnion,
19
+ sectionMerge,
19
20
  overrides,
20
21
  peerDependencyRules,
21
22
  securityFlag,