@antongolub/lockfile 0.0.0-snapshot.72 → 0.0.0-snapshot.74
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 +8 -2
- package/dist/enrich.js +4 -0
- package/dist/formats/yarn-berry-v10.js +11 -0
- package/dist/formats/yarn-berry-v4.js +11 -0
- package/dist/formats/yarn-berry-v5.js +11 -0
- package/dist/formats/yarn-berry-v6.js +11 -0
- package/dist/formats/yarn-berry-v7.js +11 -0
- package/dist/formats/yarn-berry-v8.js +11 -0
- package/dist/formats/yarn-berry-v9.js +11 -0
- package/dist/index.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,11 @@ format-agnostically:
|
|
|
101
101
|
- **`modify`** applies a `Primitive[]` — `replaceVersion`, `pinOverride`,
|
|
102
102
|
`addDependency`, `removeDependency`, `applyPatch`, `filterLicense` — the
|
|
103
103
|
building blocks of audit-fix, override-pinning and license filtering.
|
|
104
|
-
- **`optimize`** runs orphan GC / dedup over the graph
|
|
104
|
+
- **`optimize`** runs orphan GC / dedup over the graph (a production-reachability
|
|
105
|
+
sweep). **`pruneOrphans`** (via `@antongolub/lockfile/optimize`) is the
|
|
106
|
+
reference-count sibling: it retires only nodes that lost their *last* incoming
|
|
107
|
+
edge of any kind — post-bump cleanup that, unlike reachability, never
|
|
108
|
+
over-collects a still-referenced dev/optional/peer dep.
|
|
105
109
|
- **`overridesOf(graph)`** reads the canonical overrides back out.
|
|
106
110
|
|
|
107
111
|
### Options
|
|
@@ -132,7 +136,9 @@ ships as opt-in adapters (see [Sub-imports](#sub-imports)).
|
|
|
132
136
|
|---------|---------------|----------|
|
|
133
137
|
| Root | `@antongolub/lockfile` | `detect`, `check`, `parse`, `stringify`, `convert`, `modify`, `optimize`, `overridesOf`, plus types `Graph`, `FormatId`, `ParseOptions`, `StringifyOptions`, `ConvertOptions`, `Manifest` |
|
|
134
138
|
| Modifiers | `@antongolub/lockfile/modify` | the individual `Primitive` functions behind `modify` (audit-fix, override-pin, license-filter) |
|
|
135
|
-
|
|
|
139
|
+
| Complete | `@antongolub/lockfile/complete` | `completeTransitives` — registry-backed tree completion that wires the transitive deps a modify introduced |
|
|
140
|
+
| Optimize | `@antongolub/lockfile/optimize` | `optimize` (reachability orphan GC) and `pruneOrphans` (reference-count orphan GC) |
|
|
141
|
+
| Enrich | `@antongolub/lockfile/enrich` | `refurbish` — monotone field-fill (e.g. recomputes a yarn-berry zip `checksum` from a tarball source so a patched lock installs without `yarn install`) |
|
|
136
142
|
| Registry | `@antongolub/lockfile/registry` | `frozenRegistry`, `liveRegistry`, `fsCache`, `npmCache`, `pnpmCache` |
|
|
137
143
|
| Per-format | `@antongolub/lockfile/formats/<id>` | a single adapter directly (test surface; not a primary user API) |
|
|
138
144
|
|
package/dist/enrich.js
CHANGED
|
@@ -214,6 +214,10 @@ async function refurbish(graph, format, source, opts = {}) {
|
|
|
214
214
|
if (node.workspacePath !== void 0) continue;
|
|
215
215
|
const payload = graph.tarballOf(node.id) ?? {};
|
|
216
216
|
if (emitBerryChecksum(payload.integrity ?? emptyIntegrity()) !== void 0) continue;
|
|
217
|
+
if (node.patch !== void 0) {
|
|
218
|
+
record(enrichChecksumDeferred(node.id));
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
217
221
|
if (!isStore) {
|
|
218
222
|
record(enrichChecksumDeferred(node.id));
|
|
219
223
|
continue;
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2941,6 +2948,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2941
2948
|
continue;
|
|
2942
2949
|
}
|
|
2943
2950
|
}
|
|
2951
|
+
if (dstId === void 0) {
|
|
2952
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2953
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2954
|
+
}
|
|
2944
2955
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2945
2956
|
const bound = nodeNameVersion(dstId);
|
|
2946
2957
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2945,6 +2952,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2945
2952
|
continue;
|
|
2946
2953
|
}
|
|
2947
2954
|
}
|
|
2955
|
+
if (dstId === void 0) {
|
|
2956
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2957
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2958
|
+
}
|
|
2948
2959
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2949
2960
|
const bound = nodeNameVersion(dstId);
|
|
2950
2961
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2940,6 +2947,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2940
2947
|
continue;
|
|
2941
2948
|
}
|
|
2942
2949
|
}
|
|
2950
|
+
if (dstId === void 0) {
|
|
2951
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2952
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2953
|
+
}
|
|
2943
2954
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2944
2955
|
const bound = nodeNameVersion(dstId);
|
|
2945
2956
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2940,6 +2947,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2940
2947
|
continue;
|
|
2941
2948
|
}
|
|
2942
2949
|
}
|
|
2950
|
+
if (dstId === void 0) {
|
|
2951
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2952
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2953
|
+
}
|
|
2943
2954
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2944
2955
|
const bound = nodeNameVersion(dstId);
|
|
2945
2956
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2940,6 +2947,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2940
2947
|
continue;
|
|
2941
2948
|
}
|
|
2942
2949
|
}
|
|
2950
|
+
if (dstId === void 0) {
|
|
2951
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2952
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2953
|
+
}
|
|
2943
2954
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2944
2955
|
const bound = nodeNameVersion(dstId);
|
|
2945
2956
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2941,6 +2948,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2941
2948
|
continue;
|
|
2942
2949
|
}
|
|
2943
2950
|
}
|
|
2951
|
+
if (dstId === void 0) {
|
|
2952
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2953
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2954
|
+
}
|
|
2944
2955
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2945
2956
|
const bound = nodeNameVersion(dstId);
|
|
2946
2957
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
|
@@ -1487,6 +1487,13 @@ function distTagResolve(range, candidates) {
|
|
|
1487
1487
|
const ids = eligible.map((c) => c.id).sort(cmpStr2);
|
|
1488
1488
|
return { kind: "ambiguous", candidateIds: ids };
|
|
1489
1489
|
}
|
|
1490
|
+
function catalogResolve(range, candidates) {
|
|
1491
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
1492
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
1493
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
1494
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
1495
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr2) };
|
|
1496
|
+
}
|
|
1490
1497
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
1491
1498
|
let best;
|
|
1492
1499
|
let bestScore = -1;
|
|
@@ -2941,6 +2948,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
2941
2948
|
continue;
|
|
2942
2949
|
}
|
|
2943
2950
|
}
|
|
2951
|
+
if (dstId === void 0) {
|
|
2952
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
2953
|
+
if (result.kind === "bound") dstId = result.id;
|
|
2954
|
+
}
|
|
2944
2955
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
2945
2956
|
const bound = nodeNameVersion(dstId);
|
|
2946
2957
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|
package/dist/index.js
CHANGED
|
@@ -6382,6 +6382,13 @@ function distTagResolve(range, candidates) {
|
|
|
6382
6382
|
const ids = eligible.map((c) => c.id).sort(cmpStr4);
|
|
6383
6383
|
return { kind: "ambiguous", candidateIds: ids };
|
|
6384
6384
|
}
|
|
6385
|
+
function catalogResolve(range, candidates) {
|
|
6386
|
+
if (!range.startsWith("catalog:")) return { kind: "none" };
|
|
6387
|
+
const eligible = candidates.filter((c) => c.sourceType === "tarball");
|
|
6388
|
+
if (eligible.length === 0) return { kind: "none" };
|
|
6389
|
+
if (eligible.length === 1) return { kind: "bound", id: eligible[0].id };
|
|
6390
|
+
return { kind: "ambiguous", candidateIds: eligible.map((c) => c.id).sort(cmpStr4) };
|
|
6391
|
+
}
|
|
6385
6392
|
function overrideTargetFor(depName, declaredRange, consumerPath, overrides) {
|
|
6386
6393
|
let best;
|
|
6387
6394
|
let bestScore = -1;
|
|
@@ -7451,6 +7458,10 @@ function addEdgesFromBlock(builder, srcId, block, kind, index, patchDescriptorIn
|
|
|
7451
7458
|
continue;
|
|
7452
7459
|
}
|
|
7453
7460
|
}
|
|
7461
|
+
if (dstId === void 0) {
|
|
7462
|
+
const result = catalogResolve(normalizedRange, ladder.candidatesByName.get(depName) ?? []);
|
|
7463
|
+
if (result.kind === "bound") dstId = result.id;
|
|
7464
|
+
}
|
|
7454
7465
|
if (typeof dstId === "string" && !boundViaOverride && isRegistryRange(normalizedRange)) {
|
|
7455
7466
|
const bound = nodeNameVersion(dstId);
|
|
7456
7467
|
const siblings = bound === void 0 ? void 0 : ladder.patchSiblingsByBase.get(bound);
|