rolldown-pnpm-config 2.5.1 → 3.0.0

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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { PnpmSettingType } from "@effected/pnpm/settings";
1
2
  import "effect";
2
3
  import { Plugin } from "rolldown";
3
4
  /**
@@ -205,12 +206,10 @@ interface PluginConfig {
205
206
  */
206
207
  readonly localPatchesDir?: string;
207
208
  } & { readonly [K in Exclude<keyof PluginConfig, "overridesFromCatalogs">]?: PluginConfig[K] | LocalDirective<PluginConfig[K]>; };
208
- /** Whether pnpm prompts before purging `node_modules`. */
209
- readonly confirmModulesPurge?: FieldInput<boolean>;
210
209
  /** Per-package manifest overrides merged into the dependency graph. */
211
- readonly packageExtensions?: FieldInput<Record<string, unknown>>;
210
+ readonly packageExtensions?: FieldInput<PnpmSettingType<"packageExtensions">>;
212
211
  /** Deprecated versions explicitly allowed, keyed by package. */
213
- readonly allowedDeprecatedVersions?: FieldInput<Record<string, string>>;
212
+ readonly allowedDeprecatedVersions?: FieldInput<PnpmSettingType<"allowedDeprecatedVersions">>;
214
213
  /**
215
214
  * Glob patterns hoisted to the root `node_modules`.
216
215
  *
@@ -232,11 +231,19 @@ interface PluginConfig {
232
231
  readonly excludeByRepo?: Record<string, string[]>;
233
232
  };
234
233
  /** Packages excluded from the minimum-release-age quarantine. */
235
- readonly minimumReleaseAgeExclude?: FieldInput<string[]>;
236
- /** Supported architectures, keyed by axis (`os`/`cpu`/`libc`). */
237
- readonly supportedArchitectures?: FieldInput<Record<string, string[]>>;
238
- /** Audit config exclusions, keyed by axis (`ignoreGhsas`/`ignoreCves`). */
239
- readonly auditConfig?: FieldInput<Record<string, string[]>>;
234
+ readonly minimumReleaseAgeExclude?: FieldInput<PnpmSettingType<"minimumReleaseAgeExclude">>;
235
+ /** Architectures to install optional dependencies for, by axis (`os`, `cpu`, `libc`). */
236
+ readonly supportedArchitectures?: FieldInput<PnpmSettingType<"supportedArchitectures">>;
237
+ /** The GitHub advisory IDs `pnpm audit` ignores (`{ ignoreGhsas }`), the only key pnpm 12 reads. */
238
+ readonly auditConfig?: FieldInput<PnpmSettingType<"auditConfig">>;
239
+ /**
240
+ * The `pnpm audit` section: the minimum `level` to report, the advisories to
241
+ * `ignore`, and `ignorePrune`. Supersedes `auditLevel` and `auditConfig`. A
242
+ * consumer's `ignore` list is unioned with the managed one (deduped, sorted),
243
+ * so a local advisory never drops a managed one; `level` and `ignorePrune`
244
+ * are the consumer's when set.
245
+ */
246
+ readonly audit?: FieldInput<PnpmSettingType<"audit">>;
240
247
  /** Security version overrides, keyed by package selector. */
241
248
  readonly overrides?: FieldInput<Record<string, string>>;
242
249
  /**
@@ -260,123 +267,118 @@ interface PluginConfig {
260
267
  readonly allowedVersionsFromCatalogs?: AllowedVersionsFromCatalogs | readonly AllowedVersionsFromCatalogs[];
261
268
  }>;
262
269
  /** Whether dependency build scripts are blocked unless explicitly allowed. */
263
- readonly strictDepBuilds?: FieldInput<boolean>;
270
+ readonly strictDepBuilds?: FieldInput<PnpmSettingType<"strictDepBuilds">>;
264
271
  /** Whether exotic (non-registry) subdependencies are blocked. */
265
- readonly blockExoticSubdeps?: FieldInput<boolean>;
272
+ readonly blockExoticSubdeps?: FieldInput<PnpmSettingType<"blockExoticSubdeps">>;
266
273
  /** Minimum age (minutes) a release must reach before it is installable. */
267
- readonly minimumReleaseAge?: FieldInput<number>;
274
+ readonly minimumReleaseAge?: FieldInput<PnpmSettingType<"minimumReleaseAge">>;
268
275
  /** Packages whose build scripts are explicitly allowed to run. */
269
- readonly allowBuilds?: FieldInput<Record<string, boolean>>;
276
+ readonly allowBuilds?: FieldInput<PnpmSettingType<"allowBuilds">>;
270
277
  /** Optional dependencies excluded from installation entirely. */
271
- readonly ignoredOptionalDependencies?: FieldInput<string[]>;
278
+ readonly ignoredOptionalDependencies?: FieldInput<PnpmSettingType<"ignoredOptionalDependencies">>;
272
279
  /** Per-dependency update behavior: which packages to ignore during updates. */
273
- readonly updateConfig?: FieldInput<{
274
- ignoreDependencies?: string[];
275
- }>;
280
+ readonly updateConfig?: FieldInput<PnpmSettingType<"updateConfig">>;
281
+ /**
282
+ * The `pnpm update` section: the dependency patterns it skips (`ignoreDeps`),
283
+ * whether it writes a change intent, and whether it updates GitHub Actions.
284
+ * Supersedes `updateConfig`. A consumer's `ignoreDeps` list is unioned with
285
+ * the managed one; the other keys are the consumer's when set.
286
+ */
287
+ readonly update?: FieldInput<PnpmSettingType<"update">>;
276
288
  /** Default version catalog entries merged as a single `default` catalog. */
277
- readonly catalog?: FieldInput<Record<string, string>>;
289
+ readonly catalog?: FieldInput<PnpmSettingType<"catalog">>;
278
290
  /** Whether any resolution fails when a package violates minimum-release-age. */
279
- readonly minimumReleaseAgeStrict?: FieldInput<boolean>;
291
+ readonly minimumReleaseAgeStrict?: FieldInput<PnpmSettingType<"minimumReleaseAgeStrict">>;
280
292
  /** Whether to skip the release-age check when publish-time metadata is absent. */
281
- readonly minimumReleaseAgeIgnoreMissingTime?: FieldInput<boolean>;
293
+ readonly minimumReleaseAgeIgnoreMissingTime?: FieldInput<PnpmSettingType<"minimumReleaseAgeIgnoreMissingTime">>;
282
294
  /** Defines what package integrity verification is enforced on installs. */
283
- readonly trustPolicy?: FieldInput<"off" | "no-downgrade">;
295
+ readonly trustPolicy?: FieldInput<PnpmSettingType<"trustPolicy">>;
284
296
  /** Packages excluded from trust-policy enforcement. */
285
- readonly trustPolicyExclude?: FieldInput<string[]>;
297
+ readonly trustPolicyExclude?: FieldInput<PnpmSettingType<"trustPolicyExclude">>;
286
298
  /** Minutes after installation after which the trust check is skipped. */
287
- readonly trustPolicyIgnoreAfter?: FieldInput<number>;
299
+ readonly trustPolicyIgnoreAfter?: FieldInput<PnpmSettingType<"trustPolicyIgnoreAfter">>;
288
300
  /** Whether the lockfile alone is trusted without re-verifying each package's integrity. */
289
- readonly trustLockfile?: FieldInput<boolean>;
301
+ readonly trustLockfile?: FieldInput<PnpmSettingType<"trustLockfile">>;
290
302
  /** Whether packages are hoisted to the virtual store root node_modules. */
291
- readonly hoist?: FieldInput<boolean>;
303
+ readonly hoist?: FieldInput<PnpmSettingType<"hoist">>;
292
304
  /** Whether workspace packages are hoisted to the root node_modules. */
293
- readonly hoistWorkspacePackages?: FieldInput<boolean>;
305
+ readonly hoistWorkspacePackages?: FieldInput<PnpmSettingType<"hoistWorkspacePackages">>;
294
306
  /** Glob patterns describing which packages are hoisted to the virtual store root. */
295
- readonly hoistPattern?: FieldInput<string[]>;
307
+ readonly hoistPattern?: FieldInput<PnpmSettingType<"hoistPattern">>;
296
308
  /** Whether all packages are hoisted to the root node_modules (shameful flat layout). */
297
- readonly shamefullyHoist?: FieldInput<boolean>;
309
+ readonly shamefullyHoist?: FieldInput<PnpmSettingType<"shamefullyHoist">>;
298
310
  /** Defines the scope to which dependencies are hoisted. */
299
- readonly hoistingLimits?: FieldInput<"none" | "workspaces" | "dependencies">;
311
+ readonly hoistingLimits?: FieldInput<PnpmSettingType<"hoistingLimits">>;
300
312
  /** The directory in which node_modules will be created. */
301
- readonly modulesDir?: FieldInput<string>;
302
- /** Defines which linker is used for installing Node.js packages. */
303
- readonly nodeLinker?: FieldInput<"isolated" | "hoisted" | "pnp">;
313
+ readonly modulesDir?: FieldInput<PnpmSettingType<"modulesDir">>;
314
+ /** Which linker installs packages: `isolated`, `hoisted`, `pnp`, `loaded`, or `{ type: "loaded", excluded }`. */
315
+ readonly nodeLinker?: FieldInput<PnpmSettingType<"nodeLinker">>;
304
316
  /** Whether symlinks are created when linking packages from the store. */
305
- readonly symlink?: FieldInput<boolean>;
317
+ readonly symlink?: FieldInput<PnpmSettingType<"symlink">>;
306
318
  /** Whether the local node_modules directory should be created during install. */
307
- readonly enableModulesDir?: FieldInput<boolean>;
319
+ readonly enableModulesDir?: FieldInput<PnpmSettingType<"enableModulesDir">>;
308
320
  /** The directory with links to the store (default: node_modules/.pnpm). */
309
- readonly virtualStoreDir?: FieldInput<string>;
321
+ readonly virtualStoreDir?: FieldInput<PnpmSettingType<"virtualStoreDir">>;
310
322
  /** Maximum allowed length of directory names inside the virtual store. */
311
- readonly virtualStoreDirMaxLength?: FieldInput<number>;
323
+ readonly virtualStoreDirMaxLength?: FieldInput<PnpmSettingType<"virtualStoreDirMaxLength">>;
312
324
  /** Whether packages are written only to the virtual store without a local modules dir. */
313
- readonly virtualStoreOnly?: FieldInput<boolean>;
325
+ readonly virtualStoreOnly?: FieldInput<PnpmSettingType<"virtualStoreOnly">>;
314
326
  /** Controls how packages are imported from the content-addressable store. */
315
- readonly packageImportMethod?: FieldInput<"auto" | "hardlink" | "copy" | "clone" | "clone-or-copy">;
327
+ readonly packageImportMethod?: FieldInput<PnpmSettingType<"packageImportMethod">>;
316
328
  /** Maximum age (minutes) of unused modules directories before they are pruned. */
317
- readonly modulesCacheMaxAge?: FieldInput<number>;
329
+ readonly modulesCacheMaxAge?: FieldInput<PnpmSettingType<"modulesCacheMaxAge">>;
318
330
  /** Maximum age (minutes) of cached dlx command results before re-fetch. */
319
- readonly dlxCacheMaxAge?: FieldInput<number>;
331
+ readonly dlxCacheMaxAge?: FieldInput<PnpmSettingType<"dlxCacheMaxAge">>;
320
332
  /** Whether integrity checksums in the store are verified before using a package. */
321
- readonly verifyStoreIntegrity?: FieldInput<boolean>;
333
+ readonly verifyStoreIntegrity?: FieldInput<PnpmSettingType<"verifyStoreIntegrity">>;
322
334
  /** Whether store package content checksums are verified strictly on each access. */
323
- readonly strictStorePkgContentCheck?: FieldInput<boolean>;
324
- /** Whether a lockfile is used and generated when running commands that install packages. */
325
- readonly lockfile?: FieldInput<boolean>;
335
+ readonly strictStorePkgContentCheck?: FieldInput<PnpmSettingType<"strictStorePkgContentCheck">>;
336
+ /** `false` to neither read nor write `pnpm-lock.yaml`; the object form keeps it and sets `format`, `integrityTarget` and `includeResolutionSettings`. */
337
+ readonly lockfile?: FieldInput<PnpmSettingType<"lockfile">>;
326
338
  /** If true, pnpm does not generate a lockfile and fails if the lockfile is out of date. */
327
- readonly preferFrozenLockfile?: FieldInput<boolean>;
339
+ readonly preferFrozenLockfile?: FieldInput<PnpmSettingType<"preferFrozenLockfile">>;
328
340
  /** Whether the lockfile includes the full tarball URL for each resolved dependency. */
329
- readonly lockfileIncludeTarballUrl?: FieldInput<boolean>;
341
+ readonly lockfileIncludeTarballUrl?: FieldInput<PnpmSettingType<"lockfileIncludeTarballUrl">>;
330
342
  /** When enabled, the generated lockfile name is based on the current branch name. */
331
- readonly gitBranchLockfile?: FieldInput<boolean>;
343
+ readonly gitBranchLockfile?: FieldInput<PnpmSettingType<"gitBranchLockfile">>;
332
344
  /** Branch name patterns whose lockfiles are merged into the main lockfile on install. */
333
- readonly mergeGitBranchLockfilesBranchPattern?: FieldInput<string[]>;
345
+ readonly mergeGitBranchLockfilesBranchPattern?: FieldInput<PnpmSettingType<"mergeGitBranchLockfilesBranchPattern">>;
334
346
  /** Maximum length of the peers suffix appended to dependency directory names in the virtual store. */
335
- readonly peersSuffixMaxLength?: FieldInput<number>;
347
+ readonly peersSuffixMaxLength?: FieldInput<PnpmSettingType<"peersSuffixMaxLength">>;
336
348
  /** Whether a single shared lockfile is used for all projects in the workspace. */
337
- readonly sharedWorkspaceLockfile?: FieldInput<boolean>;
349
+ readonly sharedWorkspaceLockfile?: FieldInput<PnpmSettingType<"sharedWorkspaceLockfile">>;
338
350
  /** Whether missing peer dependencies are installed automatically. */
339
- readonly autoInstallPeers?: FieldInput<boolean>;
351
+ readonly autoInstallPeers?: FieldInput<PnpmSettingType<"autoInstallPeers">>;
340
352
  /** Whether packages with peer dependencies are deduplicated after peers are resolved. */
341
- readonly dedupePeerDependents?: FieldInput<boolean>;
353
+ readonly dedupePeerDependents?: FieldInput<PnpmSettingType<"dedupePeerDependents">>;
342
354
  /** Whether peer dependencies are deduplicated during resolution. */
343
- readonly dedupePeers?: FieldInput<boolean>;
355
+ readonly dedupePeers?: FieldInput<PnpmSettingType<"dedupePeers">>;
344
356
  /** If true, commands fail when there are missing or invalid peer dependencies. */
345
- readonly strictPeerDependencies?: FieldInput<boolean>;
357
+ readonly strictPeerDependencies?: FieldInput<PnpmSettingType<"strictPeerDependencies">>;
346
358
  /** Whether peer dependencies are resolved using packages installed in the workspace root. */
347
- readonly resolvePeersFromWorkspaceRoot?: FieldInput<boolean>;
348
- /** Packages whose build scripts are allowed to run; others are blocked. */
349
- readonly onlyBuiltDependencies?: FieldInput<string[]>;
350
- /** Path to a JSON file listing packages whose build scripts are allowed. */
351
- readonly onlyBuiltDependenciesFile?: FieldInput<string>;
352
- /** Packages whose build scripts are never executed. */
353
- readonly neverBuiltDependencies?: FieldInput<string[]>;
354
- /** Packages excluded from the list of dependencies to build. */
355
- readonly ignoredBuiltDependencies?: FieldInput<string[]>;
359
+ readonly resolvePeersFromWorkspaceRoot?: FieldInput<PnpmSettingType<"resolvePeersFromWorkspaceRoot">>;
356
360
  /** When true, all build scripts are allowed to run without restriction. */
357
- readonly dangerouslyAllowAllBuilds?: FieldInput<boolean>;
361
+ readonly dangerouslyAllowAllBuilds?: FieldInput<PnpmSettingType<"dangerouslyAllowAllBuilds">>;
358
362
  /** Whether lifecycle scripts of packages in node_modules are not executed. */
359
- readonly ignoreScripts?: FieldInput<boolean>;
360
- /** Whether lifecycle scripts of dependencies are ignored during install. */
361
- readonly ignoreDepScripts?: FieldInput<boolean>;
363
+ readonly ignoreScripts?: FieldInput<PnpmSettingType<"ignoreScripts">>;
362
364
  /** Maximum number of child processes that build scripts can spawn concurrently. */
363
- readonly childConcurrency?: FieldInput<number>;
364
- /** Whether the results of running install scripts are cached. */
365
- readonly sideEffectsCache?: FieldInput<boolean>;
365
+ readonly childConcurrency?: FieldInput<PnpmSettingType<"childConcurrency">>;
366
+ /** Whether install-script results are cached: a boolean, or `{ read, write, remote, exclude }`. */
367
+ readonly sideEffectsCache?: FieldInput<PnpmSettingType<"sideEffectsCache">>;
366
368
  /** Whether the side effects cache is used but never updated. */
367
- readonly sideEffectsCacheReadonly?: FieldInput<boolean>;
369
+ readonly sideEffectsCacheReadonly?: FieldInput<PnpmSettingType<"sideEffectsCacheReadonly">>;
368
370
  /** Options passed to Node.js via NODE_OPTIONS when running scripts. */
369
- readonly nodeOptions?: FieldInput<string>;
371
+ readonly nodeOptions?: FieldInput<PnpmSettingType<"nodeOptions">>;
370
372
  /** Whether pnpm verifies that the install is up to date before running scripts. */
371
- readonly verifyDepsBeforeRun?: FieldInput<"install" | "warn" | "error" | "prompt" | boolean>;
373
+ readonly verifyDepsBeforeRun?: FieldInput<PnpmSettingType<"verifyDepsBeforeRun">>;
372
374
  /** Whether pre/post lifecycle scripts are run automatically alongside the main script. */
373
- readonly enablePrePostScripts?: FieldInput<boolean>;
375
+ readonly enablePrePostScripts?: FieldInput<PnpmSettingType<"enablePrePostScripts">>;
374
376
  /** The shell used to execute scripts. */
375
- readonly scriptShell?: FieldInput<string>;
377
+ readonly scriptShell?: FieldInput<PnpmSettingType<"scriptShell">>;
376
378
  /** Whether a POSIX shell emulator is used when running scripts on Windows. */
377
- readonly shellEmulator?: FieldInput<boolean>;
379
+ readonly shellEmulator?: FieldInput<PnpmSettingType<"shellEmulator">>;
378
380
  /** Scripts that must exist in every project matching the current filter. */
379
- readonly requiredScripts?: FieldInput<string[]>;
381
+ readonly requiredScripts?: FieldInput<PnpmSettingType<"requiredScripts">>;
380
382
  /**
381
383
  * Patches applied to dependencies, keyed by package identifier. Pass a plain
382
384
  * map for explicit control, or `{ strategy: "rewrite" }` (the default when
@@ -387,109 +389,95 @@ interface PluginConfig {
387
389
  readonly strategy: "rewrite";
388
390
  };
389
391
  /** Whether unused patches (patches that apply to no installed package) are allowed. */
390
- readonly allowUnusedPatches?: FieldInput<boolean>;
391
- /** Whether non-applied patches (patches that fail to apply) are allowed. */
392
- readonly allowNonAppliedPatches?: FieldInput<boolean>;
393
- /** Whether patch failures are silently ignored during installation. */
394
- readonly ignorePatchFailures?: FieldInput<boolean>;
392
+ readonly allowUnusedPatches?: FieldInput<PnpmSettingType<"allowUnusedPatches">>;
395
393
  /** Directory where patch files are stored (default: patches). */
396
- readonly patchesDir?: FieldInput<string>;
394
+ readonly patchesDir?: FieldInput<PnpmSettingType<"patchesDir">>;
397
395
  /** Packages installed before other packages so their config scripts can run first. */
398
- readonly configDependencies?: FieldInput<Record<string, string>>;
399
- /** Environment variables applied when running scripts. */
400
- readonly executionEnv?: FieldInput<Record<string, unknown>>;
396
+ readonly configDependencies?: FieldInput<PnpmSettingType<"configDependencies">>;
401
397
  /** Whether local workspace packages are injected instead of symlinked. */
402
- readonly injectWorkspacePackages?: FieldInput<boolean>;
398
+ readonly injectWorkspacePackages?: FieldInput<PnpmSettingType<"injectWorkspacePackages">>;
403
399
  /** Scripts after which injected dependencies are re-synced. */
404
- readonly syncInjectedDepsAfterScripts?: FieldInput<string[]>;
400
+ readonly syncInjectedDepsAfterScripts?: FieldInput<PnpmSettingType<"syncInjectedDepsAfterScripts">>;
405
401
  /** Whether injected workspace packages are deduplicated. */
406
- readonly dedupeInjectedDeps?: FieldInput<boolean>;
407
- /** Whether pnpm enforces use of the package manager specified in packageManager. */
408
- readonly packageManagerStrict?: FieldInput<boolean>;
409
- /** Whether pnpm enforces the exact version of the package manager specified in packageManager. */
410
- readonly packageManagerStrictVersion?: FieldInput<boolean>;
411
- /** Whether pnpm automatically downloads and uses the version of pnpm specified in packageManager. */
412
- readonly managePackageManagerVersions?: FieldInput<boolean>;
402
+ readonly dedupeInjectedDeps?: FieldInput<PnpmSettingType<"dedupeInjectedDeps">>;
413
403
  /** Action taken when the package manager version does not match the packageManager field. */
414
- readonly pmOnFail?: FieldInput<"download" | "error" | "warn" | "ignore">;
404
+ readonly pmOnFail?: FieldInput<PnpmSettingType<"pmOnFail">>;
415
405
  /** Action taken when the Node.js version does not match the engines.node field. */
416
- readonly runtimeOnFail?: FieldInput<"download" | "error" | "warn" | "ignore">;
406
+ readonly runtimeOnFail?: FieldInput<PnpmSettingType<"runtimeOnFail">>;
417
407
  /** The Node.js version to use when checking packages' engines field. */
418
- readonly nodeVersion?: FieldInput<string>;
419
- /** The exact Node.js version that pnpm should use for running scripts. */
420
- readonly useNodeVersion?: FieldInput<string>;
408
+ readonly nodeVersion?: FieldInput<PnpmSettingType<"nodeVersion">>;
421
409
  /** Mirror URLs for downloading Node.js, keyed by distribution name. */
422
- readonly nodeDownloadMirrors?: FieldInput<Record<string, unknown>>;
410
+ readonly nodeDownloadMirrors?: FieldInput<PnpmSettingType<"nodeDownloadMirrors">>;
423
411
  /** Controls how dependencies are resolved against entries defined in the catalogs field. */
424
- readonly catalogMode?: FieldInput<"strict" | "prefer" | "manual">;
412
+ readonly catalogMode?: FieldInput<PnpmSettingType<"catalogMode">>;
425
413
  /** Whether pnpm removes catalog entries that are not used by any project in the workspace. */
426
- readonly cleanupUnusedCatalogs?: FieldInput<boolean>;
414
+ readonly cleanupUnusedCatalogs?: FieldInput<PnpmSettingType<"cleanupUnusedCatalogs">>;
427
415
  /** Whether workspace packages are linked from the workspace, not downloaded from the registry. */
428
- readonly linkWorkspacePackages?: FieldInput<boolean | "deep">;
416
+ readonly linkWorkspacePackages?: FieldInput<PnpmSettingType<"linkWorkspacePackages">>;
429
417
  /** Whether versions of packages from the workspace are preferred over versions from the registry. */
430
- readonly preferWorkspacePackages?: FieldInput<boolean>;
418
+ readonly preferWorkspacePackages?: FieldInput<PnpmSettingType<"preferWorkspacePackages">>;
431
419
  /** Controls whether the workspace: range protocol is used when saving workspace package versions. */
432
- readonly saveWorkspaceProtocol?: FieldInput<boolean | "rolling">;
420
+ readonly saveWorkspaceProtocol?: FieldInput<PnpmSettingType<"saveWorkspaceProtocol">>;
433
421
  /** Whether tasks of the root workspace project are included when executing commands recursively. */
434
- readonly includeWorkspaceRoot?: FieldInput<boolean>;
422
+ readonly includeWorkspaceRoot?: FieldInput<PnpmSettingType<"includeWorkspaceRoot">>;
435
423
  /** Whether workspace dependency cycles are silently ignored. */
436
- readonly ignoreWorkspaceCycles?: FieldInput<boolean>;
424
+ readonly ignoreWorkspaceCycles?: FieldInput<PnpmSettingType<"ignoreWorkspaceCycles">>;
437
425
  /** Whether an error is thrown when a workspace dependency cycle is detected. */
438
- readonly disallowWorkspaceCycles?: FieldInput<boolean>;
426
+ readonly disallowWorkspaceCycles?: FieldInput<PnpmSettingType<"disallowWorkspaceCycles">>;
439
427
  /** Number of projects built in parallel when running commands recursively. */
440
- readonly workspaceConcurrency?: FieldInput<number>;
428
+ readonly workspaceConcurrency?: FieldInput<PnpmSettingType<"workspaceConcurrency">>;
441
429
  /** Minimum severity level for audit reports (low, moderate, high, critical). */
442
- readonly auditLevel?: FieldInput<"low" | "moderate" | "high" | "critical">;
430
+ readonly auditLevel?: FieldInput<PnpmSettingType<"auditLevel">>;
443
431
  /** Algorithm used to resolve dependencies from the registry. */
444
- readonly resolutionMode?: FieldInput<"highest" | "time-based" | "lowest-direct">;
432
+ readonly resolutionMode?: FieldInput<PnpmSettingType<"resolutionMode">>;
445
433
  /** Version prefix prepended to package versions saved in package.json. */
446
- readonly savePrefix?: FieldInput<"^" | "~" | "">;
434
+ readonly savePrefix?: FieldInput<PnpmSettingType<"savePrefix">>;
447
435
  /** Whether packages are saved with an exact version instead of a semver range. */
448
- readonly saveExact?: FieldInput<boolean>;
436
+ readonly saveExact?: FieldInput<PnpmSettingType<"saveExact">>;
449
437
  /** The default tag used when adding packages without a specified version. */
450
- readonly tag?: FieldInput<string>;
438
+ readonly tag?: FieldInput<PnpmSettingType<"tag">>;
451
439
  /** Whether cached data is used without network requests, failing only if data is missing. */
452
- readonly preferOffline?: FieldInput<boolean>;
440
+ readonly preferOffline?: FieldInput<PnpmSettingType<"preferOffline">>;
453
441
  /** Whether direct dependencies are deduplicated when they can be satisfied by an existing dependency. */
454
- readonly dedupeDirectDeps?: FieldInput<boolean>;
442
+ readonly dedupeDirectDeps?: FieldInput<PnpmSettingType<"dedupeDirectDeps">>;
455
443
  /** Whether all files of a deployed package are copied including those in node_modules. */
456
- readonly deployAllFiles?: FieldInput<boolean>;
444
+ readonly deployAllFiles?: FieldInput<PnpmSettingType<"deployAllFiles">>;
457
445
  /** Whether the legacy deployment algorithm (copying files) is used instead of the default. */
458
- readonly forceLegacyDeploy?: FieldInput<boolean>;
446
+ readonly forceLegacyDeploy?: FieldInput<PnpmSettingType<"forceLegacyDeploy">>;
459
447
  /** Whether the NODE_PATH environment variable is set when running scripts. */
460
- readonly extendNodePath?: FieldInput<boolean>;
448
+ readonly extendNodePath?: FieldInput<PnpmSettingType<"extendNodePath">>;
461
449
  /** Whether symlinks to executables are created instead of shell shims on non-Windows systems. */
462
- readonly preferSymlinkedExecutables?: FieldInput<boolean>;
450
+ readonly preferSymlinkedExecutables?: FieldInput<PnpmSettingType<"preferSymlinkedExecutables">>;
463
451
  /** Whether the built-in compatibility database of lifecycle script overrides is ignored. */
464
- readonly ignoreCompatibilityDb?: FieldInput<boolean>;
452
+ readonly ignoreCompatibilityDb?: FieldInput<PnpmSettingType<"ignoreCompatibilityDb">>;
465
453
  /** Whether pnpm skips integrity checks when the lockfile is up to date to speed up repeat installs. */
466
- readonly optimisticRepeatInstall?: FieldInput<boolean>;
454
+ readonly optimisticRepeatInstall?: FieldInput<PnpmSettingType<"optimisticRepeatInstall">>;
467
455
  /** Whether pnpm installs all projects in the workspace when running install in a workspace. */
468
- readonly recursiveInstall?: FieldInput<boolean>;
456
+ readonly recursiveInstall?: FieldInput<PnpmSettingType<"recursiveInstall">>;
469
457
  /** Whether pnpm fails if a dependency's engines field is incompatible with the current Node.js version. */
470
- readonly engineStrict?: FieldInput<boolean>;
458
+ readonly engineStrict?: FieldInput<PnpmSettingType<"engineStrict">>;
471
459
  /** Maximum number of concurrent network requests pnpm is allowed to make. */
472
- readonly networkConcurrency?: FieldInput<number>;
460
+ readonly networkConcurrency?: FieldInput<PnpmSettingType<"networkConcurrency">>;
473
461
  /** Number of times pnpm retries fetching a package from the registry on failure. */
474
- readonly fetchRetries?: FieldInput<number>;
462
+ readonly fetchRetries?: FieldInput<PnpmSettingType<"fetchRetries">>;
475
463
  /** Exponential factor used when calculating retry delays for failed fetches. */
476
- readonly fetchRetryFactor?: FieldInput<number>;
464
+ readonly fetchRetryFactor?: FieldInput<PnpmSettingType<"fetchRetryFactor">>;
477
465
  /** Minimum timeout (ms) for a single fetch retry attempt. */
478
- readonly fetchRetryMintimeout?: FieldInput<number>;
466
+ readonly fetchRetryMintimeout?: FieldInput<PnpmSettingType<"fetchRetryMintimeout">>;
479
467
  /** Maximum timeout (ms) for a single fetch retry attempt. */
480
- readonly fetchRetryMaxtimeout?: FieldInput<number>;
468
+ readonly fetchRetryMaxtimeout?: FieldInput<PnpmSettingType<"fetchRetryMaxtimeout">>;
481
469
  /** Maximum amount of time (ms) to wait for an HTTP response from the registry. */
482
- readonly fetchTimeout?: FieldInput<number>;
470
+ readonly fetchTimeout?: FieldInput<PnpmSettingType<"fetchTimeout">>;
483
471
  /** Hosts from which git-protocol dependencies are cloned using a shallow fetch. */
484
- readonly gitShallowHosts?: FieldInput<string[]>;
472
+ readonly gitShallowHosts?: FieldInput<PnpmSettingType<"gitShallowHosts">>;
485
473
  /** Whether packages are published with provenance attestation when supported by the registry. */
486
- readonly provenance?: FieldInput<boolean>;
474
+ readonly provenance?: FieldInput<PnpmSettingType<"provenance">>;
487
475
  /** Whether pnpm checks that the repository is clean before publishing. */
488
- readonly gitChecks?: FieldInput<boolean>;
476
+ readonly gitChecks?: FieldInput<PnpmSettingType<"gitChecks">>;
489
477
  /** Whether the README file is embedded in the package tarball on publish. */
490
- readonly embedReadme?: FieldInput<boolean>;
478
+ readonly embedReadme?: FieldInput<PnpmSettingType<"embedReadme">>;
491
479
  /** Branch that is allowed to publish packages; publishing from other branches is blocked. */
492
- readonly publishBranch?: FieldInput<string>;
480
+ readonly publishBranch?: FieldInput<PnpmSettingType<"publishBranch">>;
493
481
  }
494
482
  /**
495
483
  * Rolldown plugin that serves the two virtual pnpm-config modules. Pass a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-pnpm-config",
3
- "version": "2.5.1",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "description": "A dogfooding example of our plugin",
6
6
  "repository": {
@@ -36,15 +36,16 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@effect/platform-node": "4.1.4",
39
- "@effected/changesets": "0.5.0",
40
- "@effected/cli-kit": "0.28.2",
39
+ "@effected/changesets": "0.6.0",
40
+ "@effected/cli-kit": "0.29.1",
41
41
  "@effected/env": "0.12.0",
42
42
  "@effected/files": "0.3.0",
43
- "@effected/glob": "0.21.0",
44
- "@effected/npm": "0.34.0",
43
+ "@effected/glob": "0.22.0",
44
+ "@effected/npm": "0.35.0",
45
+ "@effected/pnpm": "0.1.0",
45
46
  "@effected/semver": "0.24.0",
46
- "@effected/walker": "0.28.0",
47
- "@effected/workspaces": "0.47.0",
47
+ "@effected/walker": "0.29.0",
48
+ "@effected/workspaces": "0.48.0",
48
49
  "@effected/yaml": "0.30.0",
49
50
  "effect": "4.1.4",
50
51
  "ink": "^8.0.0",
package/plugin/freeze.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { normalizeCatalogs } from "../catalogs.js";
2
- import { DESCRIPTORS, deriveSchemas } from "../descriptors/index.js";
3
- import { FIELD_REGISTRY } from "../registry.js";
2
+ import { FIELD_REGISTRY, FIELD_SCHEMAS } from "../registry.js";
4
3
  import { resolvePeerDependencyRules } from "./allowed-versions.js";
5
4
  import { pinCatalogs, resolveOverrides } from "./overrides-from-catalogs.js";
6
5
  import { Data, Effect, Predicate, Schema } from "effect";
7
6
  import { Fmt } from "@effected/cli-kit";
7
+ import { PnpmSettingsCatalog } from "@effected/pnpm/settings";
8
8
 
9
9
  // src/plugin/freeze.ts
10
10
  /**
@@ -13,9 +13,60 @@ import { Fmt } from "@effected/cli-kit";
13
13
  * @internal
14
14
  */
15
15
  var ConfigError = class extends Data.TaggedError("ConfigError") {};
16
- /** Per-field value-shape schemas; only declared fields are validated. */
17
- const FIELD_SCHEMAS = deriveSchemas(DESCRIPTORS);
18
16
  const CatalogsSchema = FIELD_SCHEMAS.catalogs;
17
+ /**
18
+ * Validate one field's value through its pnpm settings catalog schema and
19
+ * hand back the plain value pnpm reads.
20
+ *
21
+ * @remarks
22
+ * Decoding refuses keys a closed shape does not declare (`onExcessProperty:
23
+ * "error"`): a typo'd `auditConfig.ignoreCve` must fail the build, not vanish.
24
+ * The decoded value is encoded again so `base` holds plain JSON (a catalog
25
+ * schema may decode to a class instance, such as `PeerDependencyRules`), in
26
+ * the canonical spelling: a word pnpm coerces (`yes`) becomes the boolean pnpm
27
+ * reads.
28
+ */
29
+ function validateField(field, schema, value) {
30
+ return Schema.decodeUnknownEffect(schema)(value, {
31
+ onExcessProperty: "error",
32
+ errors: "all"
33
+ }).pipe(Effect.flatMap((decoded) => Schema.encodeUnknownEffect(schema)(decoded)), Effect.mapError((error) => {
34
+ const hint = SUCCESSOR_HINTS[field];
35
+ return new ConfigError({ message: `Invalid ${field}: ${Fmt.describe(error)}${hint === void 0 ? "" : ` (${hint})`}` });
36
+ }));
37
+ }
38
+ /**
39
+ * Settings earlier releases of this plugin offered that pnpm 12 does not read,
40
+ * each with what to write instead. A config still naming one fails the build:
41
+ * shipping it would change nothing in the consumer's install, silently.
42
+ */
43
+ const REMOVED_SETTINGS = {
44
+ allowNonAppliedPatches: "no pnpm reads it",
45
+ ignorePatchFailures: "no pnpm reads it",
46
+ ignoreDepScripts: "no pnpm reads it; use ignoreScripts or allowBuilds",
47
+ managePackageManagerVersions: "no pnpm reads it; use pmOnFail",
48
+ packageManagerStrict: "no pnpm reads it; use pmOnFail",
49
+ packageManagerStrictVersion: "no pnpm reads it; use pmOnFail",
50
+ useNodeVersion: "no pnpm reads it; declare the runtime in devEngines.runtime",
51
+ onlyBuiltDependencies: "pnpm 12 never applies it; use allowBuilds",
52
+ onlyBuiltDependenciesFile: "pnpm 12 never applies it; use allowBuilds",
53
+ neverBuiltDependencies: "pnpm 12 never applies it; use allowBuilds with false",
54
+ ignoredBuiltDependencies: "pnpm 12 never applies it; use allowBuilds with false",
55
+ executionEnv: "pnpm 12 never applies it; declare the runtime in devEngines.runtime",
56
+ confirmModulesPurge: "a pnpm 11 setting pnpm 12 does not read"
57
+ };
58
+ /** What to write instead when a deprecated spelling refuses a value pnpm 12 reads only under its successor. */
59
+ const SUCCESSOR_HINTS = {
60
+ auditConfig: "auditConfig takes only ignoreGhsas; write the advisories under audit.ignore",
61
+ updateConfig: "updateConfig is the deprecated spelling of update; write update"
62
+ };
63
+ /** Config keys that are not pnpm settings: the plugin's own metadata and directives. */
64
+ const PLUGIN_KEYS = /* @__PURE__ */ new Set([
65
+ "name",
66
+ "catalogs",
67
+ "local",
68
+ "overridesFromCatalogs"
69
+ ]);
19
70
  /** Keys recognized by the wrapped `{ value, enforcement?, excludeByRepo? }` form. */
20
71
  const WRAPPED_KEYS = /* @__PURE__ */ new Set([
21
72
  "value",
@@ -62,12 +113,20 @@ function freeze(config) {
62
113
  try: () => normalizeCatalogs(config.catalogs),
63
114
  catch: (error) => new ConfigError({ message: Fmt.describe(error) })
64
115
  });
65
- base.catalogs = yield* Schema.decodeUnknownEffect(CatalogsSchema)(normalized).pipe(Effect.mapError((error) => new ConfigError({ message: `Invalid catalogs: ${Fmt.describe(error)}` })));
116
+ base.catalogs = yield* validateField("catalogs", CatalogsSchema, normalized);
117
+ const exactCatalogs = Object.entries(config.catalogs).flatMap(([name, decl]) => decl?.exact === true && normalized[`${name}:exact`] !== void 0 ? [name] : []);
66
118
  manifest.catalogs = {
67
119
  strategy: "catalogs",
68
- enforcement: "warn"
120
+ enforcement: "warn",
121
+ ...exactCatalogs.length > 0 ? { options: { exactCatalogs } } : {}
69
122
  };
70
123
  if (typeof config.name !== "string" || config.name.trim() === "") return yield* Effect.fail(new ConfigError({ message: "Config `name` is required and must be a non-empty string" }));
124
+ const declared = config;
125
+ for (const [field, why] of Object.entries(REMOVED_SETTINGS)) if (Object.hasOwn(declared, field) && declared[field] !== void 0) return yield* Effect.fail(new ConfigError({ message: `\`${field}\` is not a pnpm 12 setting: ${why}` }));
126
+ for (const [field, value] of Object.entries(declared)) {
127
+ if (value === void 0 || PLUGIN_KEYS.has(field) || Object.hasOwn(FIELD_REGISTRY, field)) continue;
128
+ if (Object.hasOwn(PnpmSettingsCatalog.entries, field)) return yield* Effect.fail(new ConfigError({ message: `\`${field}\` is a pnpm 12 setting this plugin does not manage` }));
129
+ }
71
130
  const directiveError = (error) => new ConfigError({ message: Fmt.describe(error) });
72
131
  for (const [field, reg] of Object.entries(FIELD_REGISTRY)) {
73
132
  if (field === "catalogs") continue;
@@ -76,14 +135,13 @@ function freeze(config) {
76
135
  if (raw === void 0) continue;
77
136
  const decl = normalizeField(raw);
78
137
  const schema = FIELD_SCHEMAS[field];
79
- const value = field === "peerDependencyRules" ? yield* Effect.try({
138
+ base[field] = yield* validateField(field, schema, field === "peerDependencyRules" ? yield* Effect.try({
80
139
  try: () => resolvePeerDependencyRules(decl.value, config.catalogs),
81
140
  catch: directiveError
82
141
  }) : field === "overrides" ? yield* Effect.try({
83
142
  try: () => resolveOverrides(decl.value, config.overridesFromCatalogs, config.catalogs),
84
143
  catch: directiveError
85
- }) : decl.value;
86
- base[field] = schema ? yield* Schema.decodeUnknownEffect(schema)(value).pipe(Effect.mapError((error) => new ConfigError({ message: `Invalid ${field}: ${Fmt.describe(error)}` }))) : value;
144
+ }) : decl.value);
87
145
  manifest[field] = {
88
146
  strategy: reg.strategy,
89
147
  enforcement: decl.enforcement ?? reg.enforcement,
@@ -1,6 +1,7 @@
1
1
  import { rangeOf } from "../catalogs.js";
2
- import { Glob, Predicate, Result } from "effect";
2
+ import { Glob, Option, Predicate, Result } from "effect";
3
3
  import { VersionSpecifier } from "@effected/semver";
4
+ import { OverrideKey } from "@effected/pnpm";
4
5
 
5
6
  // src/plugin/overrides-from-catalogs.ts
6
7
  /** The simple operators that can pin: an optional `^`, `~`, `>=` or `=` on one version. */
@@ -33,6 +34,22 @@ function compileFilter(entries, members, label, catalog) {
33
34
  });
34
35
  return (name) => globs.some((glob) => Glob.match(glob, name));
35
36
  }
37
+ /** The override selector for `name`, qualified by `range` when given, in pnpm's grammar. */
38
+ function selectorOf(name, range) {
39
+ return OverrideKey.make({ path: [{
40
+ name,
41
+ range: range === void 0 ? Option.none() : Option.some(range)
42
+ }] }).format();
43
+ }
44
+ /**
45
+ * The canonical spelling of an `overrides` key, so `" effect@^4.0.0"` and
46
+ * `"effect@^4.0.0"` are recognised as one selector; a key pnpm cannot parse is
47
+ * kept as written (the settings schema refuses it later).
48
+ */
49
+ function canonicalSelector(key) {
50
+ const parsed = OverrideKey.parseResult(key);
51
+ return Result.isSuccess(parsed) ? parsed.success.format() : key;
52
+ }
36
53
  /** Derive the pins for one directive. Pure; throws when the catalog is absent or a filter entry matches nothing. */
37
54
  function deriveOne(catalogs, { catalog, include, exclude = [], scope = "line" }) {
38
55
  const decl = catalogs[catalog];
@@ -48,7 +65,7 @@ function deriveOne(catalogs, { catalog, include, exclude = [], scope = "line" })
48
65
  if (parsed === null || !PINNABLE_OPERATORS.has(parsed.operator)) continue;
49
66
  const { version } = parsed;
50
67
  if (version.prerelease.length > 0 || version.build.length > 0) continue;
51
- const selector = scope === "any" ? name : `${name}@${releaseLine(version.major, version.minor)}`;
68
+ const selector = scope === "any" ? selectorOf(name) : selectorOf(name, releaseLine(version.major, version.minor));
52
69
  pins.push({
53
70
  catalog,
54
71
  name,
@@ -93,13 +110,13 @@ function exactVersion(value) {
93
110
  */
94
111
  function pinCatalogs(resolved, overrides, directives, catalogs) {
95
112
  if (directives === void 0 || !Predicate.isObject(overrides)) return resolved;
96
- const table = overrides;
113
+ const table = new Map(Object.entries(overrides).map(([key, value]) => [canonicalSelector(key), value]));
97
114
  const out = { ...resolved };
98
115
  for (const { catalog, name, selector } of derivePins(catalogs, directives)) {
99
- const pinned = exactVersion(table[selector]);
116
+ const pinned = exactVersion(table.get(selector));
100
117
  const current = out[catalog];
101
118
  const exact = out[`${catalog}:exact`];
102
- if (pinned === null && exact !== void 0 && name in exact) throw new Error(`overridesFromCatalogs: override "${selector}" wins with ${JSON.stringify(table[selector])}, which is not an exact version, so catalog "${catalog}:exact" cannot name the version it pins; override with an exact version, or set exact: false on "${name}"`);
119
+ if (pinned === null && exact !== void 0 && name in exact) throw new Error(`overridesFromCatalogs: override "${selector}" wins with ${JSON.stringify(table.get(selector))}, which is not an exact version, so catalog "${catalog}:exact" cannot name the version it pins; override with an exact version, or set exact: false on "${name}"`);
103
120
  if (pinned === null || current === void 0 || !(name in current)) continue;
104
121
  out[catalog] = {
105
122
  ...current,
@@ -124,8 +141,9 @@ function resolveOverrides(authored, directives, catalogs) {
124
141
  if (directives === void 0) return authored;
125
142
  const derived = deriveOverrides(catalogs, directives);
126
143
  const manual = Predicate.isObject(authored) ? authored : {};
144
+ const authoredSelectors = new Set(Object.keys(manual).map(canonicalSelector));
127
145
  return {
128
- ...derived,
146
+ ...Object.fromEntries(Object.entries(derived).filter(([key]) => !authoredSelectors.has(key))),
129
147
  ...manual
130
148
  };
131
149
  }