Skip to content

Commit 4458f2b

Browse files
committed
docs: document v10.7 changes
1 parent 928a30d commit 4458f2b

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

docs/package_json.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,10 @@ With the above configuration pnpm will not print deprecation warnings about any
548548

549549
## pnpm.patchedDependencies
550550

551-
This field is added/updated automatically when you run [pnpm patch-commit]. It is a dictionary where the key should be the package name and exact version. The value should be a relative path to a patch file.
551+
This field is added/updated automatically when you run [pnpm patch-commit]. It defines patches for dependencies using a dictionary where:
552+
553+
* **Keys**: Package names with an exact version, a version range, or just the name.
554+
* **Values**: Relative paths to patch files.
552555

553556
Example:
554557

@@ -562,7 +565,47 @@ Example:
562565
}
563566
```
564567

565-
## pnpm.allowNonAppliedPatches
568+
Dependencies can be patched by version range. The priority order is:
569+
570+
1. Exact versions (highest priority)
571+
2. Version ranges
572+
3. Name-only patches (applies to all versions unless overridden)
573+
574+
A special case: the version range `*` behaves like a name-only patch but does not ignore patch failures.
575+
576+
Exampe:
577+
578+
```yaml
579+
patchedDependencies:
580+
foo: patches/foo-1.patch
581+
foo@^2.0.0: patches/foo-2.patch
582+
[email protected]: patches/foo-3.patch
583+
```
584+
585+
`patches/foo-3.patch` is applied to `[email protected]`.
586+
• `patches/foo-2.patch` applies to all foo versions matching `^2.0.0`, except `2.1.0`.
587+
• `patches/foo-1.patch` applies to all other foo versions.
588+
589+
Avoid overlapping version ranges. If you need to specialize a sub-range, explicitly exclude it from the broader range.
590+
591+
Example:
592+
593+
```yaml
594+
patchedDependencies:
595+
# Specialized sub-range
596+
"[email protected]": patches/foo.2.2.0-2.8.0.patch
597+
# General patch, excluding the sub-range above
598+
"foo@>=2.0.0 <2.2.0 || >2.8.0": patches/foo.gte2.patch
599+
```
600+
601+
In most cases, defining an exact version is enough to override a broader range.
602+
603+
## pnpm.allowUnusedPatches
604+
605+
Added in: v10.7.0 (Previously named `allowNonAppliedPatches`)
606+
607+
* Default: **false**
608+
* Type: **Boolean**
566609

567610
When `true`, installation won't fail if some of the patches from the `patchedDependencies` field were not applied.
568611

@@ -572,10 +615,27 @@ When `true`, installation won't fail if some of the patches from the `patchedDep
572615
"patchedDependencies": {
573616
574617
},
575-
"allowNonAppliedPatches": true
618+
"allowUnusedPatches": true
576619
}
577620
```
578621

622+
## pnpm.ignorePatchFailures
623+
624+
Added in: v10.7.0
625+
626+
* Default: **undefined**
627+
* Type: **Boolean**, **undefined**
628+
629+
Controls how patch failures are handled.
630+
631+
Behaviour:
632+
633+
* **undefined (default)**:
634+
* Errors out when a patch with an exact version or version range fails.
635+
* Ignores failures from name-only patches.
636+
* **false**: Errors out for any patch failure.
637+
* **true**: Prints a warning instead of failing when any patch cannot be applied.
638+
579639
## pnpm.updateConfig
580640

581641
### pnpm.updateConfig.ignoreDependencies

0 commit comments

Comments
 (0)