pnpm-settings-migrator 0.17.0 → 0.18.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/README.md +27 -8
- package/dist/cli.mjs +96 -4
- package/dist/index.d.mts +48 -3
- package/dist/index.mjs +95 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,7 +202,8 @@ From 11.28.3, non-null `allowBuilds` values must be maps of booleans or strings.
|
|
|
202
202
|
From 11.28.4, non-null `allowUnusedPatches` must be boolean, and non-null
|
|
203
203
|
`ignoredOptionalDependencies` / `requiredScripts` must be string arrays.
|
|
204
204
|
From 11.28.5, `httpProxy` and `httpsProxy` must be strings, including when empty;
|
|
205
|
-
null is incompatible.
|
|
205
|
+
null is incompatible in 11.28.5. From 11.28.6, null is accepted again and leaves
|
|
206
|
+
the proxy unset. Invalid values remain in their sources with diagnostics.
|
|
206
207
|
|
|
207
208
|
For pnpm 12.9.0 and later stable v12 releases, URL-keyed `registries` entries
|
|
208
209
|
can set `networkConcurrency` to a positive safe integer, or null to leave it
|
|
@@ -250,6 +251,23 @@ and URL-keyed `registries` using that exact prefix remain in their sources;
|
|
|
250
251
|
existing workspace declarations block migration. This restriction is
|
|
251
252
|
case-sensitive (`ToOl` remains valid), unlike the existing `pkg` restriction.
|
|
252
253
|
|
|
254
|
+
For pnpm 12.13.0 and later stable v12 releases, `nodePackageMap` accepts
|
|
255
|
+
`mode: off | write-only | load` and `type: standard | loose`. The section and
|
|
256
|
+
its fields may be null to leave them unset. New and legacy
|
|
257
|
+
`nodeExperimentalPackageMap` / `nodePackageMapType` values are preserved so pnpm
|
|
258
|
+
applies the new section's field-level precedence. `storeIndexFormat` accepts
|
|
259
|
+
`sqlite`, `files`, or null; `files` supports stores shared over network filesystems.
|
|
260
|
+
Enum values may use environment placeholders, which are preserved without expansion.
|
|
261
|
+
Older or unconfirmed targets retain these settings in their source.
|
|
262
|
+
|
|
263
|
+
For pnpm 12.14.0 and later stable v12 releases, `sideEffectsCache.exclude`
|
|
264
|
+
accepts package patterns such as `['java', '@native/*', 'example@1']`, an empty
|
|
265
|
+
array, or null. Excluded builds are neither restored nor saved in local or remote
|
|
266
|
+
caches. Cache `read` and `write` values may also use preserved environment
|
|
267
|
+
placeholders. On older targets, the complete cache section stays in its source.
|
|
268
|
+
Invalid nested values and unknown fields also preserve the complete source
|
|
269
|
+
section; existing incompatible workspace values block writes.
|
|
270
|
+
|
|
253
271
|
pnpm v12 reads `filter` and `filterProd` from CLI arguments or `updateConfig`
|
|
254
272
|
hooks, not workspace YAML. These settings remain in their source with
|
|
255
273
|
diagnostics for v12 targets; existing YAML containing them blocks migration.
|
|
@@ -346,15 +364,16 @@ Notes:
|
|
|
346
364
|
- The migrator does not update the `packageManager` version, CI environment variables,
|
|
347
365
|
shell setup, or pnpm commands in scripts. When `packageManager` still pins pnpm 10,
|
|
348
366
|
pass `--compatibility v11` explicitly and update the pin separately.
|
|
349
|
-
- Compatibility checks cover pnpm 11.28.
|
|
350
|
-
11.28.1, 11.28.2, 11.28.3, 11.28.4,
|
|
351
|
-
12.9.0, 12.9.1, 12.10.0, 12.10.1, 12.11.0, 12.11.1, 12.11.2,
|
|
367
|
+
- Compatibility checks cover pnpm 11.28.6 and 12.14.0, including 11.28.0,
|
|
368
|
+
11.28.1, 11.28.2, 11.28.3, 11.28.4, 11.28.5, 12.7.0, 12.8.0, 12.8.1,
|
|
369
|
+
12.8.2, 12.9.0, 12.9.1, 12.10.0, 12.10.1, 12.11.0, 12.11.1, 12.11.2,
|
|
370
|
+
12.12.0, 12.12.1, and 12.13.0.
|
|
352
371
|
Earlier regressions remain at 11.25.0,
|
|
353
372
|
11.26.0, 11.27.1, 12.2.1, 12.3.4, 12.4.0, 12.4.2, 12.5.0, 12.5.1, and 12.6.0.
|
|
354
|
-
As [audited on 2026-10-
|
|
355
|
-
npm `latest`
|
|
356
|
-
`next-12`. The v11 target is 11.28.
|
|
357
|
-
11
|
|
373
|
+
As [audited on 2026-10-17](docs/research/pnpm-settings-bump-2026-10-17.md),
|
|
374
|
+
npm `latest` and the highest confirmed stable release are 12.14.0, also on
|
|
375
|
+
`latest-12` and `next-12`. The v11 target is 11.28.6 on both `latest-11` and
|
|
376
|
+
`next-11`. The project is pinned to 12.14.0. These checks verify the documented
|
|
358
377
|
fixtures, not every setting in every release. v10 has unit regressions and
|
|
359
378
|
source review through 10.34.7; real v10 consumption remains unverified.
|
|
360
379
|
The removed `pnpm install --resolution-only` CLI flag is outside this settings
|
package/dist/cli.mjs
CHANGED
|
@@ -587,6 +587,14 @@ const PNPM_V11_28_5_MINIMUM_VERSION = [
|
|
|
587
587
|
5
|
|
588
588
|
];
|
|
589
589
|
/**
|
|
590
|
+
* Release restoring null proxy values as unset configuration.
|
|
591
|
+
*/
|
|
592
|
+
const PNPM_V11_28_6_MINIMUM_VERSION = [
|
|
593
|
+
11,
|
|
594
|
+
28,
|
|
595
|
+
6
|
|
596
|
+
];
|
|
597
|
+
/**
|
|
590
598
|
* Release adding force, publishing, and reporter settings.
|
|
591
599
|
*/
|
|
592
600
|
const PNPM_V12_7_MINIMUM_VERSION = [
|
|
@@ -643,6 +651,22 @@ const PNPM_V12_12_1_MINIMUM_VERSION = [
|
|
|
643
651
|
1
|
|
644
652
|
];
|
|
645
653
|
/**
|
|
654
|
+
* Release introducing package map options and file-based store indexes.
|
|
655
|
+
*/
|
|
656
|
+
const PNPM_V12_13_MINIMUM_VERSION = [
|
|
657
|
+
12,
|
|
658
|
+
13,
|
|
659
|
+
0
|
|
660
|
+
];
|
|
661
|
+
/**
|
|
662
|
+
* Release introducing side-effects cache exclusions.
|
|
663
|
+
*/
|
|
664
|
+
const PNPM_V12_14_MINIMUM_VERSION = [
|
|
665
|
+
12,
|
|
666
|
+
14,
|
|
667
|
+
0
|
|
668
|
+
];
|
|
669
|
+
/**
|
|
646
670
|
* Workspace settings first consumed by pnpm v12 in 12.11.0.
|
|
647
671
|
*/
|
|
648
672
|
const PNPM_V12_11_WORKSPACE_SETTINGS = [
|
|
@@ -668,6 +692,11 @@ const PNPM_V12_7_WORKSPACE_SETTINGS = [
|
|
|
668
692
|
* @see https://github.com/pnpm/pnpm/blob/v12.4.0/pnpm/crates/config/src/workspace_yaml.rs
|
|
669
693
|
*/
|
|
670
694
|
const PNPM_SETTINGS_CAPABILITIES = [
|
|
695
|
+
{
|
|
696
|
+
minimumVersion: PNPM_V12_13_MINIMUM_VERSION,
|
|
697
|
+
workspaceFields: ["nodePackageMap", "storeIndexFormat"],
|
|
698
|
+
taskFields: []
|
|
699
|
+
},
|
|
671
700
|
{
|
|
672
701
|
minimumVersion: PNPM_V12_12_MINIMUM_VERSION,
|
|
673
702
|
workspaceFields: ["addMissingPeerTypes", "remoteCache"],
|
|
@@ -754,10 +783,10 @@ const PNPM_V12_ONLY_WORKSPACE_SETTINGS = [
|
|
|
754
783
|
"globalShims"
|
|
755
784
|
];
|
|
756
785
|
/**
|
|
757
|
-
* Legacy fields absent from pnpm v12's workspace reader through 12.
|
|
786
|
+
* Legacy fields absent from pnpm v12's workspace reader through 12.14.0.
|
|
758
787
|
* Removed aliases with explicit migration replacements are kept separately.
|
|
759
788
|
*
|
|
760
|
-
* @see https://github.com/pnpm/pnpm/blob/v12.
|
|
789
|
+
* @see https://github.com/pnpm/pnpm/blob/v12.14.0/pnpm/crates/config/src/workspace_yaml/settings.rs
|
|
761
790
|
*/
|
|
762
791
|
const PNPM_V12_IGNORED_WORKSPACE_SETTINGS = [
|
|
763
792
|
"access",
|
|
@@ -1272,6 +1301,65 @@ function hasInvalidPermissionSettings(key, value) {
|
|
|
1272
1301
|
//#endregion
|
|
1273
1302
|
//#region src/features/settings/pnpm-v12-values.ts
|
|
1274
1303
|
/**
|
|
1304
|
+
* Validate the package-map section without dropping future or misspelled keys.
|
|
1305
|
+
*
|
|
1306
|
+
* @param value - Untrusted package-map value
|
|
1307
|
+
*
|
|
1308
|
+
* @returns Whether the section is outside the pnpm 12.13 schema
|
|
1309
|
+
*/
|
|
1310
|
+
function hasInvalidNodePackageMap(value) {
|
|
1311
|
+
if (value === null) return false;
|
|
1312
|
+
if (!value || typeof value !== "object" || isArray(value)) return true;
|
|
1313
|
+
return Object.entries(value).some(([field, entry]) => {
|
|
1314
|
+
let values = [];
|
|
1315
|
+
if (field === "mode") values = [
|
|
1316
|
+
"off",
|
|
1317
|
+
"write-only",
|
|
1318
|
+
"load"
|
|
1319
|
+
];
|
|
1320
|
+
else if (field === "type") values = ["standard", "loose"];
|
|
1321
|
+
return values.length === 0 || entry !== null && (!isString(entry) || !entry.includes("${") && !values.includes(entry));
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Validate cache exclusions and retain their whole section on older targets.
|
|
1326
|
+
*
|
|
1327
|
+
* @param value - Untrusted cache section
|
|
1328
|
+
* @param target - Confirmed release controlling exclusion support
|
|
1329
|
+
*
|
|
1330
|
+
* @returns Whether a section containing exclusions cannot migrate
|
|
1331
|
+
*/
|
|
1332
|
+
function hasInvalidCacheExclusions(value, target) {
|
|
1333
|
+
if (!Object.hasOwn(value, "exclude")) return false;
|
|
1334
|
+
if (!supportsMinimumVersion(target.version, PNPM_V12_14_MINIMUM_VERSION)) return true;
|
|
1335
|
+
return Object.entries(value).some(([field, entry]) => {
|
|
1336
|
+
if (field === "exclude") return entry !== null && (!isArray(entry) || !entry.every(isString));
|
|
1337
|
+
if (field === "read" || field === "write") return entry !== null && !isBoolean(entry) && !(isString(entry) && entry.includes("${"));
|
|
1338
|
+
if (field !== "remote") return true;
|
|
1339
|
+
if (entry === null) return false;
|
|
1340
|
+
if (!entry || typeof entry !== "object" || isArray(entry)) return true;
|
|
1341
|
+
return Object.entries(entry).some(([key, setting]) => {
|
|
1342
|
+
if (key === "org" || key === "organization") return !isString(setting);
|
|
1343
|
+
return key !== "packages" || !isArray(setting) || !setting.every(isString);
|
|
1344
|
+
});
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Check the value expansions introduced by pnpm 12.13 and 12.14.
|
|
1349
|
+
*
|
|
1350
|
+
* @param key - Canonical setting name
|
|
1351
|
+
* @param value - Untrusted setting value
|
|
1352
|
+
* @param target - Confirmed target release
|
|
1353
|
+
*
|
|
1354
|
+
* @returns Whether a package-map, store-index, or cache value is incompatible
|
|
1355
|
+
*/
|
|
1356
|
+
function hasIncompatiblePackageMapOrCache(key, value, target) {
|
|
1357
|
+
if (key === "nodePackageMap") return !supportsMinimumVersion(target.version, PNPM_V12_13_MINIMUM_VERSION) || hasInvalidNodePackageMap(value);
|
|
1358
|
+
if (key === "storeIndexFormat") return !supportsMinimumVersion(target.version, PNPM_V12_13_MINIMUM_VERSION) || value !== null && (!isString(value) || !value.includes("${") && !["sqlite", "files"].includes(value));
|
|
1359
|
+
if (key === "sideEffectsCache" && value && typeof value === "object") return hasInvalidCacheExclusions(value, target);
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1275
1363
|
* Check a loaded linker object without discarding unsupported options.
|
|
1276
1364
|
*
|
|
1277
1365
|
* @param value - Untrusted nodeLinker object
|
|
@@ -1361,6 +1449,7 @@ function hasInvalidLinkerOrLockfileScalarValue(key, value) {
|
|
|
1361
1449
|
* @returns Whether the setting cannot be used by the target release
|
|
1362
1450
|
*/
|
|
1363
1451
|
function hasIncompatibleV12SettingValue(key, value, target) {
|
|
1452
|
+
if (hasIncompatiblePackageMapOrCache(key, value, target)) return true;
|
|
1364
1453
|
const supportsV12_10 = supportsMinimumVersion(target.version, PNPM_V12_10_MINIMUM_VERSION);
|
|
1365
1454
|
if (key === "nodeLinker" && value === "loaded") return !supportsV12_10;
|
|
1366
1455
|
if (key === "failIfNoMatch" && target.compatibility === "v12") return value !== null && !isBoolean(value);
|
|
@@ -1415,7 +1504,10 @@ const MAX_TASK_PRIORITY = 2147483647;
|
|
|
1415
1504
|
* @returns Whether pnpm rejects the value after migration
|
|
1416
1505
|
*/
|
|
1417
1506
|
function hasInvalidV11PatchValue(key, value, target) {
|
|
1418
|
-
if (["httpProxy", "httpsProxy"].includes(key) && supportsMinimumVersion(target.version, PNPM_V11_28_5_MINIMUM_VERSION))
|
|
1507
|
+
if (["httpProxy", "httpsProxy"].includes(key) && supportsMinimumVersion(target.version, PNPM_V11_28_5_MINIMUM_VERSION)) {
|
|
1508
|
+
if (value === null && supportsMinimumVersion(target.version, PNPM_V11_28_6_MINIMUM_VERSION)) return false;
|
|
1509
|
+
return !isString(value);
|
|
1510
|
+
}
|
|
1419
1511
|
if (value === null || value === void 0) return false;
|
|
1420
1512
|
if (key === "allowBuilds" && supportsMinimumVersion(target.version, PNPM_V11_28_3_MINIMUM_VERSION)) return typeof value !== "object" || isArray(value) || Object.values(value).some((entry) => !isBoolean(entry) && !isString(entry));
|
|
1421
1513
|
if (supportsMinimumVersion(target.version, PNPM_V11_28_4_MINIMUM_VERSION)) {
|
|
@@ -3393,7 +3485,7 @@ const bold = getColor("bold");
|
|
|
3393
3485
|
//#endregion
|
|
3394
3486
|
//#region package.json
|
|
3395
3487
|
var name = "pnpm-settings-migrator";
|
|
3396
|
-
var version = "0.
|
|
3488
|
+
var version = "0.18.0";
|
|
3397
3489
|
//#endregion
|
|
3398
3490
|
//#region src/cli/options.ts
|
|
3399
3491
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from "yaml";
|
|
2
|
-
import { PnpmSettings, RegistryDeclaration } from "@pnpm/types";
|
|
2
|
+
import { PnpmSettings, RegistryDeclaration, SideEffectsCacheSettings } from "@pnpm/types";
|
|
3
3
|
//#region src/types/options.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Compatibility target used by the migrator.
|
|
@@ -259,6 +259,18 @@ interface PnpmSkillsSettings {
|
|
|
259
259
|
* Settings supported by pnpm v12, subject to the resolved version capabilities.
|
|
260
260
|
*/
|
|
261
261
|
interface PnpmSettingsV12 {
|
|
262
|
+
/**
|
|
263
|
+
* Package-map generation and loading options (pnpm 12.13+).
|
|
264
|
+
*/
|
|
265
|
+
nodePackageMap?: PnpmNodePackageMapSettings | null;
|
|
266
|
+
/**
|
|
267
|
+
* Store package index backend; files supports network shares (pnpm 12.13+).
|
|
268
|
+
*/
|
|
269
|
+
storeIndexFormat?: 'sqlite' | 'files' | null;
|
|
270
|
+
/**
|
|
271
|
+
* Build cache policy, including exclusions from pnpm 12.14 onward.
|
|
272
|
+
*/
|
|
273
|
+
sideEffectsCache?: boolean | PnpmSideEffectsCacheSettings;
|
|
262
274
|
/**
|
|
263
275
|
* Link available companion @types packages as optional peers (pnpm 12.12+).
|
|
264
276
|
* Null leaves pnpm's default unchanged.
|
|
@@ -362,6 +374,31 @@ interface PnpmSettingsV12 {
|
|
|
362
374
|
*/
|
|
363
375
|
tasks?: Record<string, PnpmTaskSettings>;
|
|
364
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Package-map section introduced in pnpm 12.13. Explicit fields take precedence
|
|
379
|
+
* over nodeExperimentalPackageMap and nodePackageMapType in the same source.
|
|
380
|
+
*/
|
|
381
|
+
interface PnpmNodePackageMapSettings {
|
|
382
|
+
/**
|
|
383
|
+
* Disable the map, write it for tools, or also load it in Node.js scripts.
|
|
384
|
+
* Null leaves the legacy setting or pnpm's default effective.
|
|
385
|
+
*/
|
|
386
|
+
mode?: 'off' | 'write-only' | 'load' | null;
|
|
387
|
+
/**
|
|
388
|
+
* Map format; null leaves the legacy setting or default effective.
|
|
389
|
+
*/
|
|
390
|
+
type?: 'standard' | 'loose' | null;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Structured build cache options with pnpm 12.14 package exclusions.
|
|
394
|
+
*/
|
|
395
|
+
interface PnpmSideEffectsCacheSettings extends SideEffectsCacheSettings {
|
|
396
|
+
/**
|
|
397
|
+
* Package name, scope, or name@version patterns whose builds are neither
|
|
398
|
+
* restored nor saved; null leaves exclusions unset.
|
|
399
|
+
*/
|
|
400
|
+
exclude?: string[] | null;
|
|
401
|
+
}
|
|
365
402
|
/**
|
|
366
403
|
* Remote cache options allowed in project YAML. Server and signing settings
|
|
367
404
|
* belong in trusted global configuration or environment variables.
|
|
@@ -492,6 +529,14 @@ interface PnpmSettingsDeprecated {
|
|
|
492
529
|
* Settings introduced in pnpm v11.
|
|
493
530
|
*/
|
|
494
531
|
interface PnpmSettingsV11 {
|
|
532
|
+
/**
|
|
533
|
+
* HTTP proxy; null leaves the proxy unset except in pnpm 11.28.5.
|
|
534
|
+
*/
|
|
535
|
+
httpProxy?: string | null;
|
|
536
|
+
/**
|
|
537
|
+
* HTTPS proxy; null leaves the proxy unset except in pnpm 11.28.5.
|
|
538
|
+
*/
|
|
539
|
+
httpsProxy?: string | null;
|
|
495
540
|
/**
|
|
496
541
|
* Publish provenance preference. Consumed from workspace configuration by
|
|
497
542
|
* pnpm v11 and pnpm v12 starting with 12.11. Null leaves it unset.
|
|
@@ -541,7 +586,7 @@ interface PnpmSettingsV11 {
|
|
|
541
586
|
/**
|
|
542
587
|
* `pnpm-workspace.yaml` types.
|
|
543
588
|
*/
|
|
544
|
-
type PnpmWorkspace = Omit<PnpmSettings, 'lockfile' | 'nodeLinker' | 'provenance' | 'registries' | 'supportedArchitectures' | 'tasks'> & PnpmSettingsDeprecated & PnpmSettingsV11 & PnpmSettingsV12 & PnpmWorkspaceLegacy;
|
|
589
|
+
type PnpmWorkspace = Omit<PnpmSettings, 'httpProxy' | 'httpsProxy' | 'lockfile' | 'nodeLinker' | 'provenance' | 'registries' | 'sideEffectsCache' | 'supportedArchitectures' | 'tasks'> & PnpmSettingsDeprecated & PnpmSettingsV11 & PnpmSettingsV12 & PnpmWorkspaceLegacy;
|
|
545
590
|
//#endregion
|
|
546
591
|
//#region src/types/package-json.d.ts
|
|
547
592
|
/**
|
|
@@ -749,4 +794,4 @@ export declare function migratePnpmSettings(rawOptions?: Options): Promise<Migra
|
|
|
749
794
|
*/
|
|
750
795
|
export declare function resolveOptions(options?: Options): ResolvedOptions;
|
|
751
796
|
//#endregion
|
|
752
|
-
export type { CompatibilityTarget, GlobalShimPolicy, MergeStrategy, MigrationResult, NpmRC, Options, PackageJson, PackageManagerEngine, PnpmCargoSettings, PnpmLoadedNodeLinkerSettings, PnpmLockfileSettings, PnpmPackagePermissions, PnpmPythonSettings, PnpmRegistryDeclaration, PnpmRemoteCacheSettings, PnpmSettingsDeprecated, PnpmSettingsV11, PnpmSettingsV12, PnpmSkillsSettings, PnpmTaskSettings, PnpmWorkspace, PnpmWorkspaceLegacy, ResolvedOptions, RuntimeEngine, SettingsChange };
|
|
797
|
+
export type { CompatibilityTarget, GlobalShimPolicy, MergeStrategy, MigrationResult, NpmRC, Options, PackageJson, PackageManagerEngine, PnpmCargoSettings, PnpmLoadedNodeLinkerSettings, PnpmLockfileSettings, PnpmNodePackageMapSettings, PnpmPackagePermissions, PnpmPythonSettings, PnpmRegistryDeclaration, PnpmRemoteCacheSettings, PnpmSettingsDeprecated, PnpmSettingsV11, PnpmSettingsV12, PnpmSideEffectsCacheSettings, PnpmSkillsSettings, PnpmTaskSettings, PnpmWorkspace, PnpmWorkspaceLegacy, ResolvedOptions, RuntimeEngine, SettingsChange };
|
package/dist/index.mjs
CHANGED
|
@@ -585,6 +585,14 @@ const PNPM_V11_28_5_MINIMUM_VERSION = [
|
|
|
585
585
|
5
|
|
586
586
|
];
|
|
587
587
|
/**
|
|
588
|
+
* Release restoring null proxy values as unset configuration.
|
|
589
|
+
*/
|
|
590
|
+
const PNPM_V11_28_6_MINIMUM_VERSION = [
|
|
591
|
+
11,
|
|
592
|
+
28,
|
|
593
|
+
6
|
|
594
|
+
];
|
|
595
|
+
/**
|
|
588
596
|
* Release adding force, publishing, and reporter settings.
|
|
589
597
|
*/
|
|
590
598
|
const PNPM_V12_7_MINIMUM_VERSION = [
|
|
@@ -641,6 +649,22 @@ const PNPM_V12_12_1_MINIMUM_VERSION = [
|
|
|
641
649
|
1
|
|
642
650
|
];
|
|
643
651
|
/**
|
|
652
|
+
* Release introducing package map options and file-based store indexes.
|
|
653
|
+
*/
|
|
654
|
+
const PNPM_V12_13_MINIMUM_VERSION = [
|
|
655
|
+
12,
|
|
656
|
+
13,
|
|
657
|
+
0
|
|
658
|
+
];
|
|
659
|
+
/**
|
|
660
|
+
* Release introducing side-effects cache exclusions.
|
|
661
|
+
*/
|
|
662
|
+
const PNPM_V12_14_MINIMUM_VERSION = [
|
|
663
|
+
12,
|
|
664
|
+
14,
|
|
665
|
+
0
|
|
666
|
+
];
|
|
667
|
+
/**
|
|
644
668
|
* Workspace settings first consumed by pnpm v12 in 12.11.0.
|
|
645
669
|
*/
|
|
646
670
|
const PNPM_V12_11_WORKSPACE_SETTINGS = [
|
|
@@ -666,6 +690,11 @@ const PNPM_V12_7_WORKSPACE_SETTINGS = [
|
|
|
666
690
|
* @see https://github.com/pnpm/pnpm/blob/v12.4.0/pnpm/crates/config/src/workspace_yaml.rs
|
|
667
691
|
*/
|
|
668
692
|
const PNPM_SETTINGS_CAPABILITIES = [
|
|
693
|
+
{
|
|
694
|
+
minimumVersion: PNPM_V12_13_MINIMUM_VERSION,
|
|
695
|
+
workspaceFields: ["nodePackageMap", "storeIndexFormat"],
|
|
696
|
+
taskFields: []
|
|
697
|
+
},
|
|
669
698
|
{
|
|
670
699
|
minimumVersion: PNPM_V12_12_MINIMUM_VERSION,
|
|
671
700
|
workspaceFields: ["addMissingPeerTypes", "remoteCache"],
|
|
@@ -752,10 +781,10 @@ const PNPM_V12_ONLY_WORKSPACE_SETTINGS = [
|
|
|
752
781
|
"globalShims"
|
|
753
782
|
];
|
|
754
783
|
/**
|
|
755
|
-
* Legacy fields absent from pnpm v12's workspace reader through 12.
|
|
784
|
+
* Legacy fields absent from pnpm v12's workspace reader through 12.14.0.
|
|
756
785
|
* Removed aliases with explicit migration replacements are kept separately.
|
|
757
786
|
*
|
|
758
|
-
* @see https://github.com/pnpm/pnpm/blob/v12.
|
|
787
|
+
* @see https://github.com/pnpm/pnpm/blob/v12.14.0/pnpm/crates/config/src/workspace_yaml/settings.rs
|
|
759
788
|
*/
|
|
760
789
|
const PNPM_V12_IGNORED_WORKSPACE_SETTINGS = [
|
|
761
790
|
"access",
|
|
@@ -1265,6 +1294,65 @@ function hasInvalidPermissionSettings(key, value) {
|
|
|
1265
1294
|
//#endregion
|
|
1266
1295
|
//#region src/features/settings/pnpm-v12-values.ts
|
|
1267
1296
|
/**
|
|
1297
|
+
* Validate the package-map section without dropping future or misspelled keys.
|
|
1298
|
+
*
|
|
1299
|
+
* @param value - Untrusted package-map value
|
|
1300
|
+
*
|
|
1301
|
+
* @returns Whether the section is outside the pnpm 12.13 schema
|
|
1302
|
+
*/
|
|
1303
|
+
function hasInvalidNodePackageMap(value) {
|
|
1304
|
+
if (value === null) return false;
|
|
1305
|
+
if (!value || typeof value !== "object" || isArray(value)) return true;
|
|
1306
|
+
return Object.entries(value).some(([field, entry]) => {
|
|
1307
|
+
let values = [];
|
|
1308
|
+
if (field === "mode") values = [
|
|
1309
|
+
"off",
|
|
1310
|
+
"write-only",
|
|
1311
|
+
"load"
|
|
1312
|
+
];
|
|
1313
|
+
else if (field === "type") values = ["standard", "loose"];
|
|
1314
|
+
return values.length === 0 || entry !== null && (!isString(entry) || !entry.includes("${") && !values.includes(entry));
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Validate cache exclusions and retain their whole section on older targets.
|
|
1319
|
+
*
|
|
1320
|
+
* @param value - Untrusted cache section
|
|
1321
|
+
* @param target - Confirmed release controlling exclusion support
|
|
1322
|
+
*
|
|
1323
|
+
* @returns Whether a section containing exclusions cannot migrate
|
|
1324
|
+
*/
|
|
1325
|
+
function hasInvalidCacheExclusions(value, target) {
|
|
1326
|
+
if (!Object.hasOwn(value, "exclude")) return false;
|
|
1327
|
+
if (!supportsMinimumVersion(target.version, PNPM_V12_14_MINIMUM_VERSION)) return true;
|
|
1328
|
+
return Object.entries(value).some(([field, entry]) => {
|
|
1329
|
+
if (field === "exclude") return entry !== null && (!isArray(entry) || !entry.every(isString));
|
|
1330
|
+
if (field === "read" || field === "write") return entry !== null && !isBoolean(entry) && !(isString(entry) && entry.includes("${"));
|
|
1331
|
+
if (field !== "remote") return true;
|
|
1332
|
+
if (entry === null) return false;
|
|
1333
|
+
if (!entry || typeof entry !== "object" || isArray(entry)) return true;
|
|
1334
|
+
return Object.entries(entry).some(([key, setting]) => {
|
|
1335
|
+
if (key === "org" || key === "organization") return !isString(setting);
|
|
1336
|
+
return key !== "packages" || !isArray(setting) || !setting.every(isString);
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Check the value expansions introduced by pnpm 12.13 and 12.14.
|
|
1342
|
+
*
|
|
1343
|
+
* @param key - Canonical setting name
|
|
1344
|
+
* @param value - Untrusted setting value
|
|
1345
|
+
* @param target - Confirmed target release
|
|
1346
|
+
*
|
|
1347
|
+
* @returns Whether a package-map, store-index, or cache value is incompatible
|
|
1348
|
+
*/
|
|
1349
|
+
function hasIncompatiblePackageMapOrCache(key, value, target) {
|
|
1350
|
+
if (key === "nodePackageMap") return !supportsMinimumVersion(target.version, PNPM_V12_13_MINIMUM_VERSION) || hasInvalidNodePackageMap(value);
|
|
1351
|
+
if (key === "storeIndexFormat") return !supportsMinimumVersion(target.version, PNPM_V12_13_MINIMUM_VERSION) || value !== null && (!isString(value) || !value.includes("${") && !["sqlite", "files"].includes(value));
|
|
1352
|
+
if (key === "sideEffectsCache" && value && typeof value === "object") return hasInvalidCacheExclusions(value, target);
|
|
1353
|
+
return false;
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1268
1356
|
* Check a loaded linker object without discarding unsupported options.
|
|
1269
1357
|
*
|
|
1270
1358
|
* @param value - Untrusted nodeLinker object
|
|
@@ -1354,6 +1442,7 @@ function hasInvalidLinkerOrLockfileScalarValue(key, value) {
|
|
|
1354
1442
|
* @returns Whether the setting cannot be used by the target release
|
|
1355
1443
|
*/
|
|
1356
1444
|
function hasIncompatibleV12SettingValue(key, value, target) {
|
|
1445
|
+
if (hasIncompatiblePackageMapOrCache(key, value, target)) return true;
|
|
1357
1446
|
const supportsV12_10 = supportsMinimumVersion(target.version, PNPM_V12_10_MINIMUM_VERSION);
|
|
1358
1447
|
if (key === "nodeLinker" && value === "loaded") return !supportsV12_10;
|
|
1359
1448
|
if (key === "failIfNoMatch" && target.compatibility === "v12") return value !== null && !isBoolean(value);
|
|
@@ -1408,7 +1497,10 @@ const MAX_TASK_PRIORITY = 2147483647;
|
|
|
1408
1497
|
* @returns Whether pnpm rejects the value after migration
|
|
1409
1498
|
*/
|
|
1410
1499
|
function hasInvalidV11PatchValue(key, value, target) {
|
|
1411
|
-
if (["httpProxy", "httpsProxy"].includes(key) && supportsMinimumVersion(target.version, PNPM_V11_28_5_MINIMUM_VERSION))
|
|
1500
|
+
if (["httpProxy", "httpsProxy"].includes(key) && supportsMinimumVersion(target.version, PNPM_V11_28_5_MINIMUM_VERSION)) {
|
|
1501
|
+
if (value === null && supportsMinimumVersion(target.version, PNPM_V11_28_6_MINIMUM_VERSION)) return false;
|
|
1502
|
+
return !isString(value);
|
|
1503
|
+
}
|
|
1412
1504
|
if (value === null || value === void 0) return false;
|
|
1413
1505
|
if (key === "allowBuilds" && supportsMinimumVersion(target.version, PNPM_V11_28_3_MINIMUM_VERSION)) return typeof value !== "object" || isArray(value) || Object.values(value).some((entry) => !isBoolean(entry) && !isString(entry));
|
|
1414
1506
|
if (supportsMinimumVersion(target.version, PNPM_V11_28_4_MINIMUM_VERSION)) {
|