@pnpm/config.version-policy 1100.2.0 → 1100.2.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/CHANGELOG.md +12 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +7 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pnpm/config.version-policy
|
|
2
2
|
|
|
3
|
+
## 1100.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `trustPolicyExclude` and `minimumReleaseAgeExclude` being ignored when set to a single string instead of a list. The value was read one character at a time, so the exclusion never matched the package it named — and a `*` anywhere in it matched every package, silently switching the policy off.
|
|
8
|
+
|
|
9
|
+
- Fixed an inconsistency where `minimumReleaseAgeExclude` (and `trustPolicyExclude`) wildcard/bare-name rules behaved differently in the evaluator and normalizer. A bare rule now consistently evaluates as matching every version, preventing unexpected behavior and silent widening of version policy exemptions when pnpm rewrites the workspace manifest [pnpm/pnpm#13725](https://github.com/pnpm/pnpm/issues/13725).
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/error@1100.1.3
|
|
13
|
+
- @pnpm/types@1102.0.0
|
|
14
|
+
|
|
3
15
|
## 1100.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { PackageVersionPolicy } from '@pnpm/types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `patterns` arrives as a lone string when the setting is written as a YAML
|
|
4
|
+
* scalar or comes from a `PNPM_CONFIG_*` env var.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createPackageVersionPolicy(patterns: string[] | string): PackageVersionPolicy;
|
|
3
7
|
/**
|
|
4
8
|
* Like {@link createPackageVersionPolicy}, but rewraps parser errors with an
|
|
5
9
|
* `INVALID_<KEY>` PnpmError so the message points at the user-facing config key
|
|
6
10
|
* (e.g. `minimumReleaseAgeExclude`) instead of the internal parser code.
|
|
7
11
|
*/
|
|
8
|
-
export declare function createPackageVersionPolicyOrThrow(patterns: string[], key: string): PackageVersionPolicy;
|
|
12
|
+
export declare function createPackageVersionPolicyOrThrow(patterns: string[] | string, key: string): PackageVersionPolicy;
|
|
9
13
|
export interface PublishedByPolicyOptions {
|
|
10
14
|
minimumReleaseAge?: number;
|
|
11
15
|
minimumReleaseAgeExclude?: string[];
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { createMatcher } from '@pnpm/config.matcher';
|
|
2
2
|
import { PnpmError } from '@pnpm/error';
|
|
3
3
|
import semver from 'semver';
|
|
4
|
+
/**
|
|
5
|
+
* `patterns` arrives as a lone string when the setting is written as a YAML
|
|
6
|
+
* scalar or comes from a `PNPM_CONFIG_*` env var.
|
|
7
|
+
*/
|
|
4
8
|
export function createPackageVersionPolicy(patterns) {
|
|
5
9
|
const rules = [];
|
|
6
|
-
|
|
10
|
+
const patternList = typeof patterns === 'string' ? [patterns] : patterns;
|
|
11
|
+
for (const pattern of patternList) {
|
|
7
12
|
const parsed = parseVersionPolicyRule(pattern);
|
|
8
13
|
rules.push({ nameMatcher: createMatcher(parsed.packageName), exactVersions: parsed.exactVersions });
|
|
9
14
|
}
|
|
@@ -91,7 +96,7 @@ function evaluateVersionPolicy(rules, pkgName) {
|
|
|
91
96
|
continue;
|
|
92
97
|
}
|
|
93
98
|
if (exactVersions.length === 0) {
|
|
94
|
-
return
|
|
99
|
+
return true;
|
|
95
100
|
}
|
|
96
101
|
if (matchedVersions == null) {
|
|
97
102
|
matchedVersions = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/config.version-policy",
|
|
3
|
-
"version": "1100.2.
|
|
3
|
+
"version": "1100.2.1",
|
|
4
4
|
"description": "Parses and evaluates package version policy specs and produces package-version matchers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@pnpm/config.matcher": "1100.0.2",
|
|
31
|
-
"@pnpm/error": "1100.1.
|
|
32
|
-
"@pnpm/types": "
|
|
31
|
+
"@pnpm/error": "1100.1.3",
|
|
32
|
+
"@pnpm/types": "1102.0.0",
|
|
33
33
|
"semver": "^7.8.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@jest/globals": "30.4.1",
|
|
37
|
-
"@pnpm/config.version-policy": "1100.2.
|
|
37
|
+
"@pnpm/config.version-policy": "1100.2.1",
|
|
38
38
|
"@types/semver": "7.8.0"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|