rolldown-pnpm-config 0.8.1 → 1.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/bin/rolldown-pnpm-config.js +1 -1
- package/cli/ast.js +54 -0
- package/cli/commands/export.js +14 -33
- package/cli/commands/preview.js +7 -20
- package/cli/commands/upgrade.js +72 -142
- package/cli/diff/build.js +3 -3
- package/cli/diff/render.js +2 -1
- package/cli/discover.js +5 -38
- package/cli/edits.js +40 -28
- package/cli/evaluate.js +2 -24
- package/cli/interop-live.js +5 -13
- package/cli/interop.js +55 -65
- package/cli/load-config.js +40 -0
- package/cli/local-merge.js +7 -8
- package/cli/plan.js +37 -51
- package/cli/release-age.js +3 -4
- package/cli/resolve.js +40 -63
- package/cli/simulated-view.js +1 -3
- package/cli/summary.js +13 -45
- package/cli/ui/Walk.js +3 -12
- package/cli/ui/env.js +3 -5
- package/cli/ui/run-preview.js +6 -7
- package/cli/ui/run-walk.js +7 -4
- package/cli/validate.js +12 -16
- package/cli/walk-plan.js +2 -2
- package/cli/walk-reducer.js +29 -1
- package/cli/workspace-file.js +3 -3
- package/cli/workspace-resolve.js +9 -17
- package/package.json +2 -3
- package/patches/build.js +24 -10
- package/plugin/allowed-versions.js +2 -2
- package/plugin/freeze.js +13 -6
- package/runtime/strategies/arrays.js +2 -1
- package/runtime/strategies/catalogs.js +5 -14
- package/runtime/strategies/overrides.js +11 -4
- package/runtime/strategies/scalar.js +4 -4
- package/runtime/strategies/table.js +1 -1
- package/semver-util.js +29 -0
package/plugin/freeze.js
CHANGED
|
@@ -20,16 +20,23 @@ const WRAPPED_KEYS = /* @__PURE__ */ new Set([
|
|
|
20
20
|
"enforcement",
|
|
21
21
|
"excludeByRepo"
|
|
22
22
|
]);
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
/**
|
|
24
|
+
* True only when `input` is the wrapped `{ value, enforcement?, excludeByRepo? }`
|
|
25
|
+
* form: a `value` key and no foreign keys. This disambiguates from a
|
|
26
|
+
* record-valued field that happens to contain a `value` key (e.g.
|
|
27
|
+
* `overrides: { value: ">=1", lodash: ">=4" }`), which has keys outside the
|
|
28
|
+
* recognized set and is therefore treated as a bare value. The single
|
|
29
|
+
* definition of "wrapped" — the CLI's static readers use it too.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
27
33
|
function isWrappedField(input) {
|
|
34
|
+
if (input === null || typeof input !== "object") return false;
|
|
28
35
|
const keys = Object.keys(input);
|
|
29
36
|
return keys.includes("value") && keys.every((k) => WRAPPED_KEYS.has(k));
|
|
30
37
|
}
|
|
31
38
|
function normalizeField(input) {
|
|
32
|
-
if (
|
|
39
|
+
if (isWrappedField(input)) {
|
|
33
40
|
const o = input;
|
|
34
41
|
return {
|
|
35
42
|
value: o.value,
|
|
@@ -81,4 +88,4 @@ function freeze(config) {
|
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
//#endregion
|
|
84
|
-
export { ConfigError, freeze };
|
|
91
|
+
export { ConfigError, freeze, isWrappedField };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/runtime/strategies/arrays.ts
|
|
2
|
+
/** Union `managed` with `local` (when present), deduped and sorted for a stable render. @internal */
|
|
2
3
|
function unionSort(managed, local) {
|
|
3
4
|
const set = new Set(managed);
|
|
4
5
|
for (const item of local ?? []) set.add(item);
|
|
@@ -34,4 +35,4 @@ const arrayRecordUnion = (base, local) => {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
//#endregion
|
|
37
|
-
export { arrayRecordUnion, arrayUnion };
|
|
38
|
+
export { arrayRecordUnion, arrayUnion, unionSort };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { mergeMapDetect } from "./overrides.js";
|
|
2
|
+
|
|
1
3
|
//#region src/runtime/strategies/catalogs.ts
|
|
2
4
|
/**
|
|
3
5
|
* Merge each named catalog; child wins per package. Emits override divergences
|
|
@@ -11,20 +13,9 @@ const catalogs = (base, local) => {
|
|
|
11
13
|
const divergences = [];
|
|
12
14
|
const merged = { ...child };
|
|
13
15
|
for (const [name, entries] of Object.entries(managed)) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const managedVersion = entries[pkg];
|
|
18
|
-
if (managedVersion !== void 0 && managedVersion !== childVersion) divergences.push({
|
|
19
|
-
setting: `catalogs.${name}.${pkg}`,
|
|
20
|
-
managedValue: managedVersion,
|
|
21
|
-
localValue: childVersion,
|
|
22
|
-
detail: "Local version overrides the managed version.",
|
|
23
|
-
kind: "override"
|
|
24
|
-
});
|
|
25
|
-
out[pkg] = childVersion;
|
|
26
|
-
}
|
|
27
|
-
merged[name] = out;
|
|
16
|
+
const cat = mergeMapDetect(`catalogs.${name}`, entries, child[name] ?? {});
|
|
17
|
+
merged[name] = cat.merged;
|
|
18
|
+
divergences.push(...cat.divergences);
|
|
28
19
|
}
|
|
29
20
|
return {
|
|
30
21
|
merged,
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import { unionSort } from "./arrays.js";
|
|
2
|
+
|
|
1
3
|
//#region src/runtime/strategies/overrides.ts
|
|
4
|
+
/**
|
|
5
|
+
* Child wins per key over a managed string map; any differing key is reported
|
|
6
|
+
* as an override divergence under `<prefix>.<key>`.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
2
10
|
function mergeMapDetect(prefix, managed, child) {
|
|
3
11
|
const merged = { ...managed };
|
|
4
12
|
const divergences = [];
|
|
@@ -42,16 +50,15 @@ const peerDependencyRules = (base, local) => {
|
|
|
42
50
|
const managed = base ?? {};
|
|
43
51
|
const child = local ?? {};
|
|
44
52
|
const av = mergeMapDetect("peerDependencyRules.allowedVersions", managed.allowedVersions ?? {}, child.allowedVersions ?? {});
|
|
45
|
-
const union = (s = [], c = []) => [.../* @__PURE__ */ new Set([...s, ...c])].sort((a, b) => a.localeCompare(b));
|
|
46
53
|
return {
|
|
47
54
|
merged: {
|
|
48
55
|
allowedVersions: av.merged,
|
|
49
|
-
ignoreMissing:
|
|
50
|
-
allowAny:
|
|
56
|
+
ignoreMissing: unionSort(managed.ignoreMissing ?? [], child.ignoreMissing),
|
|
57
|
+
allowAny: unionSort(managed.allowAny ?? [], child.allowAny)
|
|
51
58
|
},
|
|
52
59
|
divergences: av.divergences
|
|
53
60
|
};
|
|
54
61
|
};
|
|
55
62
|
|
|
56
63
|
//#endregion
|
|
57
|
-
export { overrides, peerDependencyRules };
|
|
64
|
+
export { mergeMapDetect, overrides, peerDependencyRules };
|
|
@@ -31,9 +31,9 @@ const securityFlag = (base, local) => {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
* `child ?? base`; flags when child lowers
|
|
35
|
-
* emits `setting: ""`; the
|
|
36
|
-
*
|
|
34
|
+
* `child ?? base`; flags when child lowers a managed numeric floor (e.g. the
|
|
35
|
+
* release-age quarantine). Field-agnostic, so it emits `setting: ""`; the
|
|
36
|
+
* runtime fills the field name.
|
|
37
37
|
*
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
@@ -44,7 +44,7 @@ const securityMin = (base, local) => {
|
|
|
44
44
|
setting: "",
|
|
45
45
|
managedValue: String(base),
|
|
46
46
|
localValue: String(local),
|
|
47
|
-
detail: `
|
|
47
|
+
detail: `Lowers a managed security minimum from ${base} to ${local}.`,
|
|
48
48
|
kind: "security"
|
|
49
49
|
});
|
|
50
50
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { arrayRecordUnion, arrayUnion } from "./arrays.js";
|
|
2
|
+
import { overrides, peerDependencyRules } from "./overrides.js";
|
|
2
3
|
import { catalogs } from "./catalogs.js";
|
|
3
4
|
import { allowBuilds, mapChildWins } from "./maps.js";
|
|
4
|
-
import { overrides, peerDependencyRules } from "./overrides.js";
|
|
5
5
|
import { scalar, securityFlag, securityMin } from "./scalar.js";
|
|
6
6
|
|
|
7
7
|
//#region src/runtime/strategies/table.ts
|
package/semver-util.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Result } from "effect";
|
|
2
|
+
import { Range, SemVer } from "@effected/semver";
|
|
3
|
+
|
|
4
|
+
//#region src/semver-util.ts
|
|
5
|
+
/**
|
|
6
|
+
* Parse a version string synchronously, returning null instead of failing
|
|
7
|
+
* (filters junk dist-tags and unparseable literals). Build-time only.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const parseVersion = (v) => Result.getOrNull(SemVer.parseResult(v));
|
|
12
|
+
/**
|
|
13
|
+
* Parse a range expression synchronously, returning null instead of failing.
|
|
14
|
+
* Build-time only.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
const parseRange = (r) => Result.getOrNull(Range.parseResult(r));
|
|
19
|
+
/**
|
|
20
|
+
* Strip a leading range operator to the bare version digits (e.g. `^3.17.0`
|
|
21
|
+
* → `3.17.0`, `>=1.2.3 <2` → `1.2.3`). The single definition shared by the
|
|
22
|
+
* plugin engine's peer-prefix transform and the CLI's floor derivations.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
const bareVersion = (range) => range.replace(/^[\^~>=<\s]+/, "").split(/\s/)[0] ?? range;
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { bareVersion, parseRange, parseVersion };
|