@antongolub/lockfile 0.0.0-snapshot.60 → 0.0.0-snapshot.62
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 +7 -0
- package/dist/{_npm-flat-types-C6TSaidU.d.ts → _npm-flat-types-CNIJpuMe.d.ts} +1 -1
- package/dist/{_pnpm-flat-core-NEg8x-yf.d.ts → _pnpm-flat-core-Bx_-WTrC.d.ts} +1 -1
- package/dist/{_yarn-berry-core-CLT-3m_j.d.ts → _yarn-berry-core-B56PpQ7F.d.ts} +1 -1
- package/dist/complete.d.ts +2 -2
- package/dist/formats/bun-text.d.ts +19 -2
- package/dist/formats/bun-text.js +214 -7
- package/dist/formats/npm-1.d.ts +1 -1
- package/dist/formats/npm-1.js +2 -2
- package/dist/formats/npm-2.d.ts +2 -2
- package/dist/formats/npm-2.js +6 -5
- package/dist/formats/npm-3.d.ts +2 -2
- package/dist/formats/npm-3.js +1 -1
- package/dist/formats/pnpm-v5.d.ts +1 -1
- package/dist/formats/pnpm-v5.js +5 -9
- package/dist/formats/pnpm-v6.d.ts +2 -2
- package/dist/formats/pnpm-v6.js +6 -10
- package/dist/formats/pnpm-v9.d.ts +2 -2
- package/dist/formats/pnpm-v9.js +6 -10
- package/dist/formats/yarn-berry-v10.d.ts +2 -2
- package/dist/formats/yarn-berry-v10.js +21 -18
- package/dist/formats/yarn-berry-v4.d.ts +2 -2
- package/dist/formats/yarn-berry-v4.js +21 -18
- package/dist/formats/yarn-berry-v5.d.ts +2 -2
- package/dist/formats/yarn-berry-v5.js +21 -18
- package/dist/formats/yarn-berry-v6.d.ts +2 -2
- package/dist/formats/yarn-berry-v6.js +21 -18
- package/dist/formats/yarn-berry-v7.d.ts +2 -2
- package/dist/formats/yarn-berry-v7.js +21 -18
- package/dist/formats/yarn-berry-v8.d.ts +2 -2
- package/dist/formats/yarn-berry-v8.js +21 -18
- package/dist/formats/yarn-berry-v9.d.ts +2 -2
- package/dist/formats/yarn-berry-v9.js +21 -18
- package/dist/formats/yarn-classic.d.ts +1 -1
- package/dist/formats/yarn-classic.js +9 -8
- package/dist/{graph-B_G4OKqF.d.ts → graph-1poNzYjw.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1127 -201
- package/dist/{modify-VjOK9KTg.d.ts → modify-BwXRiMLu.d.ts} +2 -2
- package/dist/modify.d.ts +3 -3
- package/dist/{optimize-cMIkc20f.d.ts → optimize-D3h1vGSq.d.ts} +1 -1
- package/dist/optimize.d.ts +2 -2
- package/dist/registry.d.ts +3 -3
- package/dist/{types-CGeGAM7Z.d.ts → types-DC8j2G_4.d.ts} +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -24,6 +24,13 @@ Published as `0.0.0-snapshot.*` builds — the first stable release is pending.
|
|
|
24
24
|
[SCHEMAS.md](./SCHEMAS.md) maps each format id to the package-manager versions
|
|
25
25
|
that emit it.
|
|
26
26
|
|
|
27
|
+
> **ℹ️ Active R&D — snapshot channel.** While the project is under active research &
|
|
28
|
+
> development, every release ships to the **snapshot channel** (`0.0.0-snapshot.N`,
|
|
29
|
+
> published under the `snapshot` npm dist-tag) rather than `latest`. Install the newest
|
|
30
|
+
> snapshot with `npm i @antongolub/lockfile@snapshot`, or pin an exact build
|
|
31
|
+
> (e.g. `npm i @antongolub/lockfile@0.0.0-snapshot.61`). The first stable `latest`
|
|
32
|
+
> release is pending.
|
|
33
|
+
|
|
27
34
|
| Format | `detect` | `parse` | `stringify` |
|
|
28
35
|
|--------|:-:|:-:|:-:|
|
|
29
36
|
| `npm-1` · `npm-2` · `npm-3` | ✓ | ✓ | ✓ |
|
package/dist/complete.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NodeId, D as Diagnostic, G as Graph, E as EdgeTriple, a as Node, b as EdgeKind } from './graph-
|
|
2
|
-
import { R as RegistryAdapter } from './types-
|
|
1
|
+
import { N as NodeId, D as Diagnostic, G as Graph, E as EdgeTriple, a as Node, b as EdgeKind } from './graph-1poNzYjw.js';
|
|
2
|
+
import { R as RegistryAdapter } from './types-DC8j2G_4.js';
|
|
3
3
|
|
|
4
4
|
interface CompletionSeed {
|
|
5
5
|
/** NodeIds the modifier added in the just-completed mutate phase. */
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { D as Diagnostic, G as Graph } from '../graph-
|
|
1
|
+
import { O as OverrideConstraint, D as Diagnostic, G as Graph } from '../graph-1poNzYjw.js';
|
|
2
2
|
|
|
3
3
|
interface BunTextParseOptions {
|
|
4
4
|
}
|
|
5
5
|
interface BunTextStringifyOptions {
|
|
6
6
|
lineEnding?: 'lf' | 'crlf';
|
|
7
|
+
/**
|
|
8
|
+
* Caller-supplied canonical override constraints (ADR-0025). bun's `overrides`
|
|
9
|
+
* block is npm-shaped, so these project through the npm grammar
|
|
10
|
+
* (`projectOverrides(_, 'npm')`). An explicit `[]` suppresses the verbatim
|
|
11
|
+
* carrier captured at parse; `undefined` falls back to it. This is the
|
|
12
|
+
* audit-fix write path — `pinOverride` results land here as a forced
|
|
13
|
+
* resolution into bun's top-level `overrides`.
|
|
14
|
+
*/
|
|
15
|
+
overrides?: OverrideConstraint[];
|
|
7
16
|
onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
8
17
|
}
|
|
9
18
|
interface BunTextManifest {
|
|
@@ -19,6 +28,14 @@ interface BunTextEnrichOptions {
|
|
|
19
28
|
}
|
|
20
29
|
interface BunTextOptimizeOptions {
|
|
21
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Canonical override constraints captured from a bun-text graph's top-level
|
|
33
|
+
* `overrides` block (ADR-0025 §6, A2). Mirrors `getPnpmOverridesCanonical` /
|
|
34
|
+
* npm's `rootMeta.overrides` so `index.ts` `overridesOf` can fold a bun source's
|
|
35
|
+
* overrides into a cross-PM conversion. Returns undefined when the graph carries
|
|
36
|
+
* no overrides block (or the sidecar was lost to a bare `mutate`).
|
|
37
|
+
*/
|
|
38
|
+
declare function getBunOverridesCanonical(graph: Graph): OverrideConstraint[] | undefined;
|
|
22
39
|
declare function check(input: string): boolean;
|
|
23
40
|
declare function parse(input: string, _options?: BunTextParseOptions): Graph;
|
|
24
41
|
declare function stringify(graph: Graph, options?: BunTextStringifyOptions): string;
|
|
@@ -31,4 +48,4 @@ declare function optimize(graph: Graph, _options?: BunTextOptimizeOptions): {
|
|
|
31
48
|
diagnostics: Diagnostic[];
|
|
32
49
|
};
|
|
33
50
|
|
|
34
|
-
export { type BunTextEnrichOptions, type BunTextManifest, type BunTextOptimizeOptions, type BunTextParseOptions, type BunTextStringifyOptions, check, enrich, optimize, parse, stringify };
|
|
51
|
+
export { type BunTextEnrichOptions, type BunTextManifest, type BunTextOptimizeOptions, type BunTextParseOptions, type BunTextStringifyOptions, check, enrich, getBunOverridesCanonical, optimize, parse, stringify };
|
package/dist/formats/bun-text.js
CHANGED
|
@@ -723,6 +723,13 @@ function emitWorkspaceCollapsed(edge, fromSpecifier, onDiagnostic) {
|
|
|
723
723
|
if (onDiagnostic === void 0) return;
|
|
724
724
|
onDiagnostic(workspaceCollapsedDiagnostic(edge, fromSpecifier));
|
|
725
725
|
}
|
|
726
|
+
function overrideParentRefDropped(pkg, to) {
|
|
727
|
+
return {
|
|
728
|
+
code: "OVERRIDE_PARENT_REF_DROPPED",
|
|
729
|
+
severity: "warning",
|
|
730
|
+
message: `override ${pkg}=${to}: npm $name self-ref has no yarn/pnpm equivalent; emitted verbatim`
|
|
731
|
+
};
|
|
732
|
+
}
|
|
726
733
|
|
|
727
734
|
// src/main/ts/recipe/workspace.ts
|
|
728
735
|
function isWorkspaceSpecifier(s) {
|
|
@@ -771,11 +778,168 @@ function nodeVersionOf(id) {
|
|
|
771
778
|
return paren < 0 ? rest : rest.slice(0, paren);
|
|
772
779
|
}
|
|
773
780
|
|
|
781
|
+
// src/main/ts/recipe/overrides.ts
|
|
782
|
+
function splitNameVersion(selector) {
|
|
783
|
+
let depth = 0;
|
|
784
|
+
let lastAt = -1;
|
|
785
|
+
for (let i = 0; i < selector.length; i++) {
|
|
786
|
+
const c = selector[i];
|
|
787
|
+
if (c === "(") depth++;
|
|
788
|
+
else if (c === ")") depth--;
|
|
789
|
+
else if (c === "@" && depth === 0 && i >= 1) lastAt = i;
|
|
790
|
+
}
|
|
791
|
+
if (lastAt <= 0) return { package: selector };
|
|
792
|
+
const name = selector.slice(0, lastAt);
|
|
793
|
+
const version = selector.slice(lastAt + 1);
|
|
794
|
+
if (name.length === 0 || version.length === 0) return { package: selector };
|
|
795
|
+
return { package: name, versionCondition: version };
|
|
796
|
+
}
|
|
797
|
+
function captureOverrides(block, pm, onDiagnostic) {
|
|
798
|
+
if (block === null || typeof block !== "object") {
|
|
799
|
+
return { canonical: [], native: {} };
|
|
800
|
+
}
|
|
801
|
+
let canonical;
|
|
802
|
+
const native = {};
|
|
803
|
+
switch (pm) {
|
|
804
|
+
case "npm": {
|
|
805
|
+
native.npmOverrides = block;
|
|
806
|
+
canonical = captureNpm(block, []);
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
case "yarn": {
|
|
810
|
+
const flat = asStringRecord(block);
|
|
811
|
+
native.yarnResolutions = flat;
|
|
812
|
+
canonical = captureFlat(flat, splitYarnKey);
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
case "pnpm": {
|
|
816
|
+
const flat = asStringRecord(block);
|
|
817
|
+
native.pnpmOverrides = flat;
|
|
818
|
+
canonical = captureFlat(flat, splitPnpmKey);
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return { canonical, native };
|
|
823
|
+
}
|
|
824
|
+
function captureNpm(block, parentPath) {
|
|
825
|
+
const out = [];
|
|
826
|
+
for (const [key, value] of Object.entries(block)) {
|
|
827
|
+
if (key === ".") {
|
|
828
|
+
if (parentPath.length === 0) continue;
|
|
829
|
+
const pkg2 = parentPath[parentPath.length - 1];
|
|
830
|
+
const ancestors = parentPath.slice(0, -1);
|
|
831
|
+
if (typeof value === "string") out.push(constraint(pkg2, ancestors, value));
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
const { package: pkg } = splitNameVersion(key);
|
|
835
|
+
if (typeof value === "string") {
|
|
836
|
+
out.push(constraint(pkg, parentPath, value));
|
|
837
|
+
} else if (value !== null && typeof value === "object") {
|
|
838
|
+
out.push(...captureNpm(value, [...parentPath, pkg]));
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
return out;
|
|
842
|
+
}
|
|
843
|
+
function captureFlat(flat, splitKey) {
|
|
844
|
+
const out = [];
|
|
845
|
+
for (const [key, to] of Object.entries(flat)) {
|
|
846
|
+
const { package: pkg, parentPath, versionCondition } = splitKey(key);
|
|
847
|
+
out.push(constraint(pkg, parentPath, to, versionCondition));
|
|
848
|
+
}
|
|
849
|
+
return out;
|
|
850
|
+
}
|
|
851
|
+
function splitYarnKey(key) {
|
|
852
|
+
const segments = splitYarnPathSegments(key);
|
|
853
|
+
const leaf = segments[segments.length - 1];
|
|
854
|
+
const { package: pkg, versionCondition } = splitNameVersion(leaf);
|
|
855
|
+
const parentPath = segments.slice(0, -1).filter((s) => s !== "**");
|
|
856
|
+
return versionCondition !== void 0 ? { package: pkg, parentPath, versionCondition } : { package: pkg, parentPath };
|
|
857
|
+
}
|
|
858
|
+
function splitYarnPathSegments(key) {
|
|
859
|
+
const raw = key.split("/");
|
|
860
|
+
const segments = [];
|
|
861
|
+
for (let i = 0; i < raw.length; i++) {
|
|
862
|
+
const piece = raw[i];
|
|
863
|
+
if (piece.startsWith("@") && i + 1 < raw.length) {
|
|
864
|
+
segments.push(`${piece}/${raw[i + 1]}`);
|
|
865
|
+
i++;
|
|
866
|
+
} else {
|
|
867
|
+
segments.push(piece);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return segments;
|
|
871
|
+
}
|
|
872
|
+
function splitPnpmKey(key) {
|
|
873
|
+
const segments = key.split(">").filter((s) => s.length > 0);
|
|
874
|
+
const leaf = segments[segments.length - 1];
|
|
875
|
+
const { package: pkg, versionCondition } = splitNameVersion(leaf);
|
|
876
|
+
const parentPath = segments.slice(0, -1).map((s) => splitNameVersion(s).package);
|
|
877
|
+
return versionCondition !== void 0 ? { package: pkg, parentPath, versionCondition } : { package: pkg, parentPath };
|
|
878
|
+
}
|
|
879
|
+
function constraint(pkg, parentPath, to, versionCondition) {
|
|
880
|
+
const c = { package: pkg, to };
|
|
881
|
+
if (parentPath.length > 0) c.parentPath = parentPath;
|
|
882
|
+
if (versionCondition !== void 0 && versionCondition !== "") {
|
|
883
|
+
c.versionCondition = versionCondition;
|
|
884
|
+
}
|
|
885
|
+
if (to.startsWith("$")) c.selfRef = true;
|
|
886
|
+
return c;
|
|
887
|
+
}
|
|
888
|
+
function asStringRecord(block) {
|
|
889
|
+
const out = {};
|
|
890
|
+
for (const [k, v] of Object.entries(block)) {
|
|
891
|
+
if (typeof v === "string") out[k] = v;
|
|
892
|
+
}
|
|
893
|
+
return out;
|
|
894
|
+
}
|
|
895
|
+
function projectOverrides(canonical, pm, onDiagnostic) {
|
|
896
|
+
return pm === "npm" ? projectNpm(canonical) : projectPnpm(canonical, onDiagnostic);
|
|
897
|
+
}
|
|
898
|
+
function projectNpm(canonical) {
|
|
899
|
+
const root = {};
|
|
900
|
+
for (const c of canonical) {
|
|
901
|
+
const leafKey = c.versionCondition ? `${c.package}@${c.versionCondition}` : c.package;
|
|
902
|
+
let node = root;
|
|
903
|
+
for (const seg of c.parentPath ?? []) {
|
|
904
|
+
const existing = node[seg];
|
|
905
|
+
if (typeof existing === "object" && existing !== null) {
|
|
906
|
+
node = existing;
|
|
907
|
+
} else {
|
|
908
|
+
const nested = typeof existing === "string" ? { ".": existing } : {};
|
|
909
|
+
node[seg] = nested;
|
|
910
|
+
node = nested;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
const existingLeaf = node[leafKey];
|
|
914
|
+
if (existingLeaf !== null && typeof existingLeaf === "object") {
|
|
915
|
+
existingLeaf["."] = c.to;
|
|
916
|
+
} else {
|
|
917
|
+
node[leafKey] = c.to;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return root;
|
|
921
|
+
}
|
|
922
|
+
function projectPnpm(canonical, onDiagnostic) {
|
|
923
|
+
const out = {};
|
|
924
|
+
for (const c of canonical) {
|
|
925
|
+
const leaf = c.versionCondition ? `${c.package}@${c.versionCondition}` : c.package;
|
|
926
|
+
const key = c.parentPath && c.parentPath.length > 0 ? `${c.parentPath.join(">")}>${leaf}` : leaf;
|
|
927
|
+
if (c.selfRef && onDiagnostic !== void 0) {
|
|
928
|
+
onDiagnostic(overrideParentRefDropped(c.package, c.to));
|
|
929
|
+
}
|
|
930
|
+
out[key] = c.to;
|
|
931
|
+
}
|
|
932
|
+
return out;
|
|
933
|
+
}
|
|
934
|
+
|
|
774
935
|
// src/main/ts/formats/bun-text.ts
|
|
775
936
|
var sidecarByGraph = /* @__PURE__ */ new WeakMap();
|
|
776
937
|
function rememberSidecar(graph, sidecar) {
|
|
777
938
|
sidecarByGraph.set(graph, sidecar);
|
|
778
939
|
}
|
|
940
|
+
function getBunOverridesCanonical(graph) {
|
|
941
|
+
return sidecarByGraph.get(graph)?.canonicalOverrides;
|
|
942
|
+
}
|
|
779
943
|
function check(input) {
|
|
780
944
|
if (!/"lockfileVersion"\s*:\s*1\b/.test(input)) return false;
|
|
781
945
|
if (!/"workspaces"\s*:\s*\{/.test(input)) return false;
|
|
@@ -950,6 +1114,17 @@ function parse(input, _options = {}) {
|
|
|
950
1114
|
const consumerScope = buildConsumerScope(packagesKey, packages, packageByName);
|
|
951
1115
|
addBlockEdges(builder, diagnostics, entry.id, entry.inner, consumerScope, void 0, peerDeclarations);
|
|
952
1116
|
}
|
|
1117
|
+
let nativeOverrides;
|
|
1118
|
+
let canonicalOverrides;
|
|
1119
|
+
if (lf.overrides !== void 0 && lf.overrides !== null && typeof lf.overrides === "object") {
|
|
1120
|
+
nativeOverrides = lf.overrides;
|
|
1121
|
+
const captured = captureOverrides(lf.overrides, "npm");
|
|
1122
|
+
if (captured.canonical.length > 0) canonicalOverrides = captured.canonical;
|
|
1123
|
+
}
|
|
1124
|
+
const trustedDependencies = Array.isArray(lf.trustedDependencies) ? lf.trustedDependencies.filter((v) => typeof v === "string") : void 0;
|
|
1125
|
+
const patchedDependencies = lf.patchedDependencies !== void 0 && lf.patchedDependencies !== null && typeof lf.patchedDependencies === "object" ? Object.fromEntries(
|
|
1126
|
+
Object.entries(lf.patchedDependencies).filter((e) => typeof e[1] === "string")
|
|
1127
|
+
) : void 0;
|
|
953
1128
|
for (const diagnostic of diagnostics) {
|
|
954
1129
|
builder.diagnostic(diagnostic);
|
|
955
1130
|
}
|
|
@@ -961,7 +1136,11 @@ function parse(input, _options = {}) {
|
|
|
961
1136
|
workspaces: workspaceSidecar,
|
|
962
1137
|
workspaceByPath,
|
|
963
1138
|
nodes: nodeSidecar,
|
|
964
|
-
peerDeclarations
|
|
1139
|
+
peerDeclarations,
|
|
1140
|
+
nativeOverrides,
|
|
1141
|
+
canonicalOverrides,
|
|
1142
|
+
trustedDependencies,
|
|
1143
|
+
patchedDependencies
|
|
965
1144
|
};
|
|
966
1145
|
rememberSidecar(graph, sidecar);
|
|
967
1146
|
return graph;
|
|
@@ -1013,13 +1192,34 @@ function stringify(graph, options = {}) {
|
|
|
1013
1192
|
const key = chooseNodeEmitKey(node, sidecar, packagesBlock);
|
|
1014
1193
|
packagesBlock[key] = [`${node.name}@${node.version}`, "", inner, integrity];
|
|
1015
1194
|
}
|
|
1016
|
-
const
|
|
1195
|
+
const overridesBlock = resolveOverridesBlock(options.overrides, sidecar, emitDiagnostic);
|
|
1196
|
+
const out = {
|
|
1017
1197
|
lockfileVersion: 1,
|
|
1018
|
-
workspaces: workspacesBlock
|
|
1019
|
-
|
|
1020
|
-
|
|
1198
|
+
workspaces: workspacesBlock
|
|
1199
|
+
};
|
|
1200
|
+
if (overridesBlock !== void 0 && Object.keys(overridesBlock).length > 0) {
|
|
1201
|
+
out.overrides = overridesBlock;
|
|
1202
|
+
}
|
|
1203
|
+
out.packages = packagesBlock;
|
|
1204
|
+
if (sidecar?.patchedDependencies !== void 0 && Object.keys(sidecar.patchedDependencies).length > 0) {
|
|
1205
|
+
out.patchedDependencies = sortRecord(sidecar.patchedDependencies);
|
|
1206
|
+
}
|
|
1207
|
+
if (sidecar?.trustedDependencies !== void 0 && sidecar.trustedDependencies.length > 0) {
|
|
1208
|
+
out.trustedDependencies = [...sidecar.trustedDependencies].sort(cmpStr2);
|
|
1209
|
+
}
|
|
1210
|
+
const json = renderJsonc(out);
|
|
1021
1211
|
return options.lineEnding === "crlf" ? json.replace(/\n/g, "\r\n") : json;
|
|
1022
1212
|
}
|
|
1213
|
+
function resolveOverridesBlock(callerOverrides, sidecar, emitDiagnostic) {
|
|
1214
|
+
if (callerOverrides !== void 0) {
|
|
1215
|
+
return callerOverrides.length > 0 ? projectOverrides(callerOverrides, "npm", emitDiagnostic) : void 0;
|
|
1216
|
+
}
|
|
1217
|
+
if (sidecar?.nativeOverrides !== void 0) return sidecar.nativeOverrides;
|
|
1218
|
+
if (sidecar?.canonicalOverrides !== void 0 && sidecar.canonicalOverrides.length > 0) {
|
|
1219
|
+
return projectOverrides(sidecar.canonicalOverrides, "npm", emitDiagnostic);
|
|
1220
|
+
}
|
|
1221
|
+
return void 0;
|
|
1222
|
+
}
|
|
1023
1223
|
function enrich(graph, options = {}) {
|
|
1024
1224
|
const sidecar = sidecarByGraph.get(graph);
|
|
1025
1225
|
const diagnostics = [];
|
|
@@ -1489,8 +1689,15 @@ function pruneSidecar(sidecar, graph) {
|
|
|
1489
1689
|
const [srcId] = key.split("|");
|
|
1490
1690
|
return srcId !== void 0 && reachableIds.has(srcId);
|
|
1491
1691
|
})
|
|
1492
|
-
)
|
|
1692
|
+
),
|
|
1693
|
+
// Top-level fidelity blocks are project-global (not per-node), so they
|
|
1694
|
+
// survive an orphan-prune verbatim — pruning unreachable nodes never
|
|
1695
|
+
// invalidates a declared override / trusted / patched entry.
|
|
1696
|
+
nativeOverrides: sidecar.nativeOverrides,
|
|
1697
|
+
canonicalOverrides: sidecar.canonicalOverrides,
|
|
1698
|
+
trustedDependencies: sidecar.trustedDependencies,
|
|
1699
|
+
patchedDependencies: sidecar.patchedDependencies
|
|
1493
1700
|
};
|
|
1494
1701
|
}
|
|
1495
1702
|
|
|
1496
|
-
export { check, enrich, optimize, parse, stringify };
|
|
1703
|
+
export { check, enrich, getBunOverridesCanonical, optimize, parse, stringify };
|
package/dist/formats/npm-1.d.ts
CHANGED
package/dist/formats/npm-1.js
CHANGED
|
@@ -1057,7 +1057,6 @@ function parse2(input, _options = {}) {
|
|
|
1057
1057
|
version,
|
|
1058
1058
|
peerContext: []
|
|
1059
1059
|
};
|
|
1060
|
-
if (resolved !== void 0) node.resolution = resolved;
|
|
1061
1060
|
if (source !== void 0) node.source = source;
|
|
1062
1061
|
builder.addNode(node);
|
|
1063
1062
|
const payload = {};
|
|
@@ -1066,6 +1065,7 @@ function parse2(input, _options = {}) {
|
|
|
1066
1065
|
if (!isEmptyIntegrity(integrity)) payload.integrity = integrity;
|
|
1067
1066
|
}
|
|
1068
1067
|
if (resolved !== void 0) {
|
|
1068
|
+
payload.nativeResolution = resolved;
|
|
1069
1069
|
const canonical = parse(resolved, { sourceKind: "npm-resolved" });
|
|
1070
1070
|
if (canonical.type === "unknown") {
|
|
1071
1071
|
diagnostics.push({
|
|
@@ -1521,7 +1521,7 @@ function buildEntry(node, installPath, graph, sidecar, treeByParent) {
|
|
|
1521
1521
|
const entry = { version: node.version };
|
|
1522
1522
|
const nodeSide = sidecar?.nodes.get(node.id);
|
|
1523
1523
|
const tarball = graph.tarballOf(node.id);
|
|
1524
|
-
const resolutionStr =
|
|
1524
|
+
const resolutionStr = tarball?.nativeResolution ?? deriveResolvedFromCanonical(tarball?.resolution);
|
|
1525
1525
|
if (resolutionStr !== void 0) {
|
|
1526
1526
|
if (/^(git[+:]|github:)/.test(resolutionStr)) {
|
|
1527
1527
|
entry.version = resolutionStr;
|
package/dist/formats/npm-2.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, D as Diagnostic } from '../graph-
|
|
2
|
-
import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-
|
|
1
|
+
import { G as Graph, D as Diagnostic } from '../graph-1poNzYjw.js';
|
|
2
|
+
import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-CNIJpuMe.js';
|
|
3
3
|
|
|
4
4
|
interface Npm2ParseOptions extends NpmFamilyParseOptions {
|
|
5
5
|
}
|
package/dist/formats/npm-2.js
CHANGED
|
@@ -1941,7 +1941,7 @@ function buildNodeModulesEntry(graph, node, nodeSide, config, emitDiagnostic = (
|
|
|
1941
1941
|
}
|
|
1942
1942
|
body.version = node.version;
|
|
1943
1943
|
const tarball = graph.tarballOf(node.id);
|
|
1944
|
-
const resolved =
|
|
1944
|
+
const resolved = tarball?.nativeResolution ?? config.hooks?.recoverResolvedForNode?.(graph, node) ?? deriveResolvedFromCanonical(tarball?.resolution);
|
|
1945
1945
|
if (resolved !== void 0) body.resolved = resolved;
|
|
1946
1946
|
if (tarball?.integrity !== void 0) {
|
|
1947
1947
|
const sri = emitSri(tarball.integrity);
|
|
@@ -2233,15 +2233,16 @@ function buildLegacyNodeEntry(ctx, node, parentInstallPrefix) {
|
|
|
2233
2233
|
const entry = {};
|
|
2234
2234
|
if (node.version !== void 0) entry.version = node.version;
|
|
2235
2235
|
const tarball = ctx.graph.tarballOf(node.id);
|
|
2236
|
+
const native = tarball?.nativeResolution;
|
|
2236
2237
|
const sourceResolved = sidecarResolvedFor(ctx, node) ?? deriveLegacyResolvedFromCanonical(tarball?.resolution);
|
|
2237
|
-
if (
|
|
2238
|
-
const looksLikeGit = /^git[+@]/.test(
|
|
2238
|
+
if (native !== void 0) {
|
|
2239
|
+
const looksLikeGit = /^git[+@]/.test(native);
|
|
2239
2240
|
if (looksLikeGit) {
|
|
2240
|
-
entry.version =
|
|
2241
|
+
entry.version = native;
|
|
2241
2242
|
const fromSpec = synthesizeFromSpec(ctx, node);
|
|
2242
2243
|
if (fromSpec !== void 0) entry.from = fromSpec;
|
|
2243
2244
|
} else {
|
|
2244
|
-
entry.resolved =
|
|
2245
|
+
entry.resolved = native;
|
|
2245
2246
|
}
|
|
2246
2247
|
} else if (sourceResolved !== void 0) {
|
|
2247
2248
|
const looksLikeGit = /^git[+@]/.test(sourceResolved);
|
package/dist/formats/npm-3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, D as Diagnostic } from '../graph-
|
|
2
|
-
import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-
|
|
1
|
+
import { G as Graph, D as Diagnostic } from '../graph-1poNzYjw.js';
|
|
2
|
+
import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-CNIJpuMe.js';
|
|
3
3
|
|
|
4
4
|
interface Npm3ParseOptions extends NpmFamilyParseOptions {
|
|
5
5
|
}
|
package/dist/formats/npm-3.js
CHANGED
|
@@ -1941,7 +1941,7 @@ function buildNodeModulesEntry(graph, node, nodeSide, config, emitDiagnostic = (
|
|
|
1941
1941
|
}
|
|
1942
1942
|
body.version = node.version;
|
|
1943
1943
|
const tarball = graph.tarballOf(node.id);
|
|
1944
|
-
const resolved =
|
|
1944
|
+
const resolved = tarball?.nativeResolution ?? config.hooks?.recoverResolvedForNode?.(graph, node) ?? deriveResolvedFromCanonical(tarball?.resolution);
|
|
1945
1945
|
if (resolved !== void 0) body.resolved = resolved;
|
|
1946
1946
|
if (tarball?.integrity !== void 0) {
|
|
1947
1947
|
const sri = emitSri(tarball.integrity);
|
package/dist/formats/pnpm-v5.js
CHANGED
|
@@ -1412,6 +1412,7 @@ function tarballPayloadOf(entry, subject, diagnostics) {
|
|
|
1412
1412
|
}
|
|
1413
1413
|
if (isPlainObject2(resolution)) {
|
|
1414
1414
|
if (typeof resolution.tarball === "string") {
|
|
1415
|
+
payload.nativeResolution = resolution.tarball;
|
|
1415
1416
|
const canonical = parse(resolution.tarball, { sourceKind: "pnpm-tarball" });
|
|
1416
1417
|
if (canonical.type === "unknown") {
|
|
1417
1418
|
diagnostics.push(unknownResolutionDiagnostic(subject, resolution.tarball));
|
|
@@ -2044,12 +2045,6 @@ function addPackageNode(builder, sidecar, name, version, peerContext, nodeId, pk
|
|
|
2044
2045
|
version,
|
|
2045
2046
|
peerContext
|
|
2046
2047
|
};
|
|
2047
|
-
if (isPlainObject2(pkgEntry)) {
|
|
2048
|
-
const resolution = pkgEntry.resolution;
|
|
2049
|
-
if (isPlainObject2(resolution) && typeof resolution.tarball === "string") {
|
|
2050
|
-
node.resolution = resolution.tarball;
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
2048
|
builder.addNode(node);
|
|
2054
2049
|
const payload = tarballPayloadOf(pkgEntry, nodeId, diagnostics);
|
|
2055
2050
|
if (payload !== void 0) {
|
|
@@ -2201,7 +2196,8 @@ function buildImporterEntry(graph, sidecar, node, importerPath) {
|
|
|
2201
2196
|
function buildPackageEntry(graph, sidecar, representative) {
|
|
2202
2197
|
const entry = {};
|
|
2203
2198
|
const tarball = graph.tarballOf(representative.id);
|
|
2204
|
-
const
|
|
2199
|
+
const nativeResolution = tarball?.nativeResolution;
|
|
2200
|
+
const nativeIsPnpmUrl = nativeResolution !== void 0 && (nativeResolution.startsWith("http://") || nativeResolution.startsWith("https://"));
|
|
2205
2201
|
const derivedPnpm = derivePnpmResolutionFromCanonical(tarball?.resolution);
|
|
2206
2202
|
const derivedTarballIsRegistryDefault = tarball?.resolution?.type === "tarball" && tarball.resolution.url === `https://registry.npmjs.org/${representative.name}/-/${tailOfName(representative.name)}-${representative.version}.tgz`;
|
|
2207
2203
|
if (tarball !== void 0) {
|
|
@@ -2210,12 +2206,12 @@ function buildPackageEntry(graph, sidecar, representative) {
|
|
|
2210
2206
|
const integ = emitSri(tarball.integrity);
|
|
2211
2207
|
if (integ !== void 0) resolution.integrity = integ;
|
|
2212
2208
|
}
|
|
2213
|
-
if (nativeIsPnpmUrl) resolution.tarball =
|
|
2209
|
+
if (nativeIsPnpmUrl) resolution.tarball = nativeResolution;
|
|
2214
2210
|
else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) resolution.tarball = derivedPnpm.tarball;
|
|
2215
2211
|
else if (derivedPnpm?.directory !== void 0) resolution.directory = derivedPnpm.directory;
|
|
2216
2212
|
if (Object.keys(resolution).length > 0) entry.resolution = flowMap(resolution);
|
|
2217
2213
|
} else if (nativeIsPnpmUrl) {
|
|
2218
|
-
entry.resolution = flowMap({ tarball:
|
|
2214
|
+
entry.resolution = flowMap({ tarball: nativeResolution });
|
|
2219
2215
|
} else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) {
|
|
2220
2216
|
entry.resolution = flowMap({ tarball: derivedPnpm.tarball });
|
|
2221
2217
|
} else if (derivedPnpm?.directory !== void 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, D as Diagnostic } from '../graph-
|
|
2
|
-
import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-
|
|
1
|
+
import { G as Graph, D as Diagnostic } from '../graph-1poNzYjw.js';
|
|
2
|
+
import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-Bx_-WTrC.js';
|
|
3
3
|
|
|
4
4
|
interface PnpmV6ParseOptions extends PnpmFamilyParseOptions {
|
|
5
5
|
}
|
package/dist/formats/pnpm-v6.js
CHANGED
|
@@ -2318,12 +2318,6 @@ function addPackageNode(builder, sidecar, name, version, peerContext, nodeId, pk
|
|
|
2318
2318
|
version,
|
|
2319
2319
|
peerContext
|
|
2320
2320
|
};
|
|
2321
|
-
if (isPlainObject2(pkgEntry)) {
|
|
2322
|
-
const resolution = pkgEntry.resolution;
|
|
2323
|
-
if (isPlainObject2(resolution) && typeof resolution.tarball === "string") {
|
|
2324
|
-
node.resolution = resolution.tarball;
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
2321
|
if (patch !== void 0) node.patch = patch;
|
|
2328
2322
|
builder.addNode(node);
|
|
2329
2323
|
const payload = tarballPayloadOf(pkgEntry, nodeId, diagnostics);
|
|
@@ -2536,6 +2530,7 @@ function tarballPayloadOf(entry, subject, diagnostics) {
|
|
|
2536
2530
|
}
|
|
2537
2531
|
if (isPlainObject2(resolution)) {
|
|
2538
2532
|
if (typeof resolution.tarball === "string") {
|
|
2533
|
+
payload.nativeResolution = resolution.tarball;
|
|
2539
2534
|
const canonical = parse(resolution.tarball, { sourceKind: "pnpm-tarball" });
|
|
2540
2535
|
if (canonical.type === "unknown") {
|
|
2541
2536
|
diagnostics.push(unknownResolutionDiagnostic(subject, resolution.tarball));
|
|
@@ -2677,7 +2672,8 @@ function relativeImporterPath(importerPath, targetPath) {
|
|
|
2677
2672
|
function buildPackageEntry(graph, sidecar, representative, shape) {
|
|
2678
2673
|
const entry = {};
|
|
2679
2674
|
const tarball = graph.tarballOf(representative.id);
|
|
2680
|
-
const
|
|
2675
|
+
const nativeResolution = tarball?.nativeResolution;
|
|
2676
|
+
const nativeIsPnpmUrl = nativeResolution !== void 0 && (nativeResolution.startsWith("http://") || nativeResolution.startsWith("https://"));
|
|
2681
2677
|
const derivedPnpm = derivePnpmResolutionFromCanonical(tarball?.resolution);
|
|
2682
2678
|
const derivedTarballIsRegistryDefault = tarball?.resolution?.type === "tarball" && isNpmRegistryDefault(tarball.resolution.url, representative.name, representative.version);
|
|
2683
2679
|
if (tarball !== void 0) {
|
|
@@ -2686,12 +2682,12 @@ function buildPackageEntry(graph, sidecar, representative, shape) {
|
|
|
2686
2682
|
const sri = emitSri(tarball.integrity);
|
|
2687
2683
|
if (sri !== void 0) resolution.integrity = sri;
|
|
2688
2684
|
}
|
|
2689
|
-
if (nativeIsPnpmUrl) resolution.tarball =
|
|
2685
|
+
if (nativeIsPnpmUrl) resolution.tarball = nativeResolution;
|
|
2690
2686
|
else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) resolution.tarball = derivedPnpm.tarball;
|
|
2691
2687
|
else if (derivedPnpm?.directory !== void 0) resolution.directory = derivedPnpm.directory;
|
|
2692
2688
|
if (Object.keys(resolution).length > 0) entry.resolution = flowMap(resolution);
|
|
2693
2689
|
} else if (nativeIsPnpmUrl) {
|
|
2694
|
-
entry.resolution = flowMap({ tarball:
|
|
2690
|
+
entry.resolution = flowMap({ tarball: nativeResolution });
|
|
2695
2691
|
} else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) {
|
|
2696
2692
|
entry.resolution = flowMap({ tarball: derivedPnpm.tarball });
|
|
2697
2693
|
} else if (derivedPnpm?.directory !== void 0) {
|
|
@@ -2882,7 +2878,7 @@ function synthesiseOverridePatches(graph, sidecar) {
|
|
|
2882
2878
|
return m !== void 0 && matcherMatches(m, node.name, node.version);
|
|
2883
2879
|
})) continue;
|
|
2884
2880
|
const overrideKey = `${node.name}@npm:${node.version}`;
|
|
2885
|
-
const sourcePath = patchPathOfResolution(node.
|
|
2881
|
+
const sourcePath = patchPathOfResolution(graph.tarballOf(node.id)?.nativeResolution) ?? `./.lockfile-patches/${node.patch}.patch`;
|
|
2886
2882
|
const encodedSpec = `${encodeURIComponent(node.name)}@npm%3A${encodeURIComponent(node.version)}`;
|
|
2887
2883
|
out[overrideKey] = `patch:${encodedSpec}#${sourcePath}`;
|
|
2888
2884
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, D as Diagnostic } from '../graph-
|
|
2
|
-
import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-
|
|
1
|
+
import { G as Graph, D as Diagnostic } from '../graph-1poNzYjw.js';
|
|
2
|
+
import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-Bx_-WTrC.js';
|
|
3
3
|
|
|
4
4
|
interface PnpmV9ParseOptions extends PnpmFamilyParseOptions {
|
|
5
5
|
}
|
package/dist/formats/pnpm-v9.js
CHANGED
|
@@ -2318,12 +2318,6 @@ function addPackageNode(builder, sidecar, name, version, peerContext, nodeId, pk
|
|
|
2318
2318
|
version,
|
|
2319
2319
|
peerContext
|
|
2320
2320
|
};
|
|
2321
|
-
if (isPlainObject2(pkgEntry)) {
|
|
2322
|
-
const resolution = pkgEntry.resolution;
|
|
2323
|
-
if (isPlainObject2(resolution) && typeof resolution.tarball === "string") {
|
|
2324
|
-
node.resolution = resolution.tarball;
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
2321
|
if (patch !== void 0) node.patch = patch;
|
|
2328
2322
|
builder.addNode(node);
|
|
2329
2323
|
const payload = tarballPayloadOf(pkgEntry, nodeId, diagnostics);
|
|
@@ -2536,6 +2530,7 @@ function tarballPayloadOf(entry, subject, diagnostics) {
|
|
|
2536
2530
|
}
|
|
2537
2531
|
if (isPlainObject2(resolution)) {
|
|
2538
2532
|
if (typeof resolution.tarball === "string") {
|
|
2533
|
+
payload.nativeResolution = resolution.tarball;
|
|
2539
2534
|
const canonical = parse(resolution.tarball, { sourceKind: "pnpm-tarball" });
|
|
2540
2535
|
if (canonical.type === "unknown") {
|
|
2541
2536
|
diagnostics.push(unknownResolutionDiagnostic(subject, resolution.tarball));
|
|
@@ -2677,7 +2672,8 @@ function relativeImporterPath(importerPath, targetPath) {
|
|
|
2677
2672
|
function buildPackageEntry(graph, sidecar, representative, shape) {
|
|
2678
2673
|
const entry = {};
|
|
2679
2674
|
const tarball = graph.tarballOf(representative.id);
|
|
2680
|
-
const
|
|
2675
|
+
const nativeResolution = tarball?.nativeResolution;
|
|
2676
|
+
const nativeIsPnpmUrl = nativeResolution !== void 0 && (nativeResolution.startsWith("http://") || nativeResolution.startsWith("https://"));
|
|
2681
2677
|
const derivedPnpm = derivePnpmResolutionFromCanonical(tarball?.resolution);
|
|
2682
2678
|
const derivedTarballIsRegistryDefault = tarball?.resolution?.type === "tarball" && isNpmRegistryDefault(tarball.resolution.url, representative.name, representative.version);
|
|
2683
2679
|
if (tarball !== void 0) {
|
|
@@ -2686,12 +2682,12 @@ function buildPackageEntry(graph, sidecar, representative, shape) {
|
|
|
2686
2682
|
const sri = emitSri(tarball.integrity);
|
|
2687
2683
|
if (sri !== void 0) resolution.integrity = sri;
|
|
2688
2684
|
}
|
|
2689
|
-
if (nativeIsPnpmUrl) resolution.tarball =
|
|
2685
|
+
if (nativeIsPnpmUrl) resolution.tarball = nativeResolution;
|
|
2690
2686
|
else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) resolution.tarball = derivedPnpm.tarball;
|
|
2691
2687
|
else if (derivedPnpm?.directory !== void 0) resolution.directory = derivedPnpm.directory;
|
|
2692
2688
|
if (Object.keys(resolution).length > 0) entry.resolution = flowMap(resolution);
|
|
2693
2689
|
} else if (nativeIsPnpmUrl) {
|
|
2694
|
-
entry.resolution = flowMap({ tarball:
|
|
2690
|
+
entry.resolution = flowMap({ tarball: nativeResolution });
|
|
2695
2691
|
} else if (derivedPnpm?.tarball !== void 0 && !derivedTarballIsRegistryDefault) {
|
|
2696
2692
|
entry.resolution = flowMap({ tarball: derivedPnpm.tarball });
|
|
2697
2693
|
} else if (derivedPnpm?.directory !== void 0) {
|
|
@@ -2882,7 +2878,7 @@ function synthesiseOverridePatches(graph, sidecar) {
|
|
|
2882
2878
|
return m !== void 0 && matcherMatches(m, node.name, node.version);
|
|
2883
2879
|
})) continue;
|
|
2884
2880
|
const overrideKey = `${node.name}@npm:${node.version}`;
|
|
2885
|
-
const sourcePath = patchPathOfResolution(node.
|
|
2881
|
+
const sourcePath = patchPathOfResolution(graph.tarballOf(node.id)?.nativeResolution) ?? `./.lockfile-patches/${node.patch}.patch`;
|
|
2886
2882
|
const encodedSpec = `${encodeURIComponent(node.name)}@npm%3A${encodeURIComponent(node.version)}`;
|
|
2887
2883
|
out[overrideKey] = `patch:${encodedSpec}#${sourcePath}`;
|
|
2888
2884
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Graph, D as Diagnostic } from '../graph-
|
|
2
|
-
import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-
|
|
1
|
+
import { G as Graph, D as Diagnostic } from '../graph-1poNzYjw.js';
|
|
2
|
+
import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-B56PpQ7F.js';
|
|
3
3
|
|
|
4
4
|
interface YarnBerryParseOptions extends YarnBerryFamilyParseOptions {
|
|
5
5
|
}
|