@antongolub/lockfile 0.0.0-snapshot.46 → 0.0.0-snapshot.47

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.
Files changed (43) hide show
  1. package/dist/{_npm-flat-types-C3oOIC0o.d.ts → _npm-flat-types-BtjAgSy6.d.ts} +5 -1
  2. package/dist/{_pnpm-flat-core-C5VUToQP.d.ts → _pnpm-flat-core-u9QE3m8R.d.ts} +5 -1
  3. package/dist/{_yarn-berry-core-sjtp6At6.d.ts → _yarn-berry-core-tgctDDH2.d.ts} +1 -1
  4. package/dist/complete.d.ts +1 -1
  5. package/dist/formats/bun-text.d.ts +1 -1
  6. package/dist/formats/bun-text.js +5 -2
  7. package/dist/formats/npm-1.d.ts +1 -1
  8. package/dist/formats/npm-1.js +2 -2
  9. package/dist/formats/npm-2.d.ts +2 -2
  10. package/dist/formats/npm-2.js +234 -12
  11. package/dist/formats/npm-3.d.ts +2 -2
  12. package/dist/formats/npm-3.js +234 -12
  13. package/dist/formats/pnpm-v5.d.ts +1 -1
  14. package/dist/formats/pnpm-v5.js +2 -2
  15. package/dist/formats/pnpm-v6.d.ts +2 -2
  16. package/dist/formats/pnpm-v6.js +156 -82
  17. package/dist/formats/pnpm-v9.d.ts +2 -2
  18. package/dist/formats/pnpm-v9.js +156 -82
  19. package/dist/formats/yarn-berry-v10.d.ts +2 -2
  20. package/dist/formats/yarn-berry-v10.js +54 -8
  21. package/dist/formats/yarn-berry-v4.d.ts +2 -2
  22. package/dist/formats/yarn-berry-v4.js +54 -8
  23. package/dist/formats/yarn-berry-v5.d.ts +2 -2
  24. package/dist/formats/yarn-berry-v5.js +54 -8
  25. package/dist/formats/yarn-berry-v6.d.ts +2 -2
  26. package/dist/formats/yarn-berry-v6.js +54 -8
  27. package/dist/formats/yarn-berry-v7.d.ts +2 -2
  28. package/dist/formats/yarn-berry-v7.js +54 -8
  29. package/dist/formats/yarn-berry-v8.d.ts +2 -2
  30. package/dist/formats/yarn-berry-v8.js +54 -8
  31. package/dist/formats/yarn-berry-v9.d.ts +2 -2
  32. package/dist/formats/yarn-berry-v9.js +54 -8
  33. package/dist/formats/yarn-classic.d.ts +1 -1
  34. package/dist/formats/yarn-classic.js +2 -2
  35. package/dist/{graph-XpDkFSjz.d.ts → graph-DlYNIpXt.d.ts} +48 -1
  36. package/dist/index.d.ts +34 -4
  37. package/dist/index.js +3815 -3424
  38. package/dist/{modify-C4BdPHYO.d.ts → modify-DJj58soJ.d.ts} +4 -3
  39. package/dist/modify.d.ts +2 -2
  40. package/dist/{optimize-Du6S8Ld1.d.ts → optimize-eaNonOKo.d.ts} +1 -1
  41. package/dist/optimize.d.ts +2 -2
  42. package/dist/registry.d.ts +1 -1
  43. package/package.json +1 -1
@@ -1,10 +1,14 @@
1
- import { D as Diagnostic } from './graph-XpDkFSjz.js';
1
+ import { D as Diagnostic, O as OverrideConstraint } from './graph-DlYNIpXt.js';
2
2
 
3
3
  interface NpmFamilyParseOptions {
4
4
  }
5
5
  interface NpmFamilyStringifyOptions {
6
6
  lineEnding?: 'lf' | 'crlf';
7
7
  onDiagnostic?: (diagnostic: Diagnostic) => void;
8
+ /** Caller-declared overrides (ADR-0025 §4) projected into the root entry's
9
+ * `overrides` block at `packages[""]`. npm-1 (no packages block) cannot
10
+ * carry them — a loss diagnostic fires instead. */
11
+ overrides?: OverrideConstraint[];
8
12
  }
9
13
  interface NpmFamilyEnrichOptions {
10
14
  }
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic } from './graph-XpDkFSjz.js';
1
+ import { D as Diagnostic, O as OverrideConstraint } from './graph-DlYNIpXt.js';
2
2
 
3
3
  interface PnpmFamilyParseOptions {
4
4
  /**
@@ -15,6 +15,10 @@ interface PnpmFamilyStringifyOptions {
15
15
  lineEnding?: 'lf' | 'crlf';
16
16
  settings?: PnpmSettings;
17
17
  onDiagnostic?: (diagnostic: Diagnostic) => void;
18
+ /** Caller-declared overrides (ADR-0025 §4) overlaid onto the pnpm
19
+ * `overrides:` block. Caller wins per key; pre-existing `patch:` directives
20
+ * (F2) survive on collision. */
21
+ overrides?: OverrideConstraint[];
18
22
  }
19
23
  interface PnpmManifest {
20
24
  name?: string;
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic } from './graph-XpDkFSjz.js';
1
+ import { D as Diagnostic } from './graph-DlYNIpXt.js';
2
2
 
3
3
  interface YarnBerryFamilyParseOptions {
4
4
  workspaceRoot?: string;
@@ -1,4 +1,4 @@
1
- import { N as NodeId, D as Diagnostic, G as Graph, E as EdgeTriple, a as Node, b as EdgeKind } from './graph-XpDkFSjz.js';
1
+ import { N as NodeId, D as Diagnostic, G as Graph, E as EdgeTriple, a as Node, b as EdgeKind } from './graph-DlYNIpXt.js';
2
2
  import { R as RegistryAdapter } from './types-Ci06KZkZ.js';
3
3
 
4
4
  interface CompletionSeed {
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic, G as Graph } from '../graph-XpDkFSjz.js';
1
+ import { D as Diagnostic, G as Graph } from '../graph-DlYNIpXt.js';
2
2
 
3
3
  interface BunTextParseOptions {
4
4
  }
@@ -225,8 +225,8 @@ function validate(s) {
225
225
  if (!expected.includes(id)) {
226
226
  throw new GraphError("INVARIANT_VIOLATION", `node id ${id} disagrees with derived id ${expected.join(" or ")}`);
227
227
  }
228
- const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => e.dst).sort();
229
- const peerCtx = node.peerContext.slice().sort();
228
+ const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => stripPeerContextFromNodeId(e.dst)).sort();
229
+ const peerCtx = node.peerContext.map(stripPeerContextFromNodeId).sort();
230
230
  if (peerEdgeTargets.length !== peerCtx.length || peerEdgeTargets.some((t, i) => t !== peerCtx[i])) {
231
231
  throw new GraphError("INVARIANT_VIOLATION", `peer edges of ${id} disagree with peerContext`);
232
232
  }
@@ -890,8 +890,11 @@ function parse(input, _options = {}) {
890
890
  if (srcId === void 0) continue;
891
891
  addBlockEdges(builder, diagnostics, srcId, ws.manifest, packageByName, workspaceByPath, peerDeclarations);
892
892
  }
893
+ const emittedSrc = /* @__PURE__ */ new Set();
893
894
  for (const [packagesKey, entry] of entriesByKey) {
894
895
  if (entry.inner === void 0) continue;
896
+ if (emittedSrc.has(entry.id)) continue;
897
+ emittedSrc.add(entry.id);
895
898
  const consumerScope = buildConsumerScope(packagesKey, packages, packageByName);
896
899
  addBlockEdges(builder, diagnostics, entry.id, entry.inner, consumerScope, void 0, peerDeclarations);
897
900
  }
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic, G as Graph } from '../graph-XpDkFSjz.js';
1
+ import { D as Diagnostic, G as Graph } from '../graph-DlYNIpXt.js';
2
2
 
3
3
  interface Npm1ParseOptions {
4
4
  }
@@ -226,8 +226,8 @@ function validate(s) {
226
226
  if (!expected.includes(id)) {
227
227
  throw new GraphError("INVARIANT_VIOLATION", `node id ${id} disagrees with derived id ${expected.join(" or ")}`);
228
228
  }
229
- const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => e.dst).sort();
230
- const peerCtx = node.peerContext.slice().sort();
229
+ const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => stripPeerContextFromNodeId(e.dst)).sort();
230
+ const peerCtx = node.peerContext.map(stripPeerContextFromNodeId).sort();
231
231
  if (peerEdgeTargets.length !== peerCtx.length || peerEdgeTargets.some((t, i) => t !== peerCtx[i])) {
232
232
  throw new GraphError("INVARIANT_VIOLATION", `peer edges of ${id} disagree with peerContext`);
233
233
  }
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-XpDkFSjz.js';
2
- import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-C3oOIC0o.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DlYNIpXt.js';
2
+ import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-BtjAgSy6.js';
3
3
 
4
4
  interface Npm2ParseOptions extends NpmFamilyParseOptions {
5
5
  }
@@ -239,8 +239,8 @@ function validate(s) {
239
239
  if (!expected.includes(id)) {
240
240
  throw new GraphError("INVARIANT_VIOLATION", `node id ${id} disagrees with derived id ${expected.join(" or ")}`);
241
241
  }
242
- const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => e.dst).sort();
243
- const peerCtx = node.peerContext.slice().sort();
242
+ const peerEdgeTargets = (s.outgoing.get(id) ?? []).filter((e) => e.kind === "peer").map((e) => stripPeerContextFromNodeId(e.dst)).sort();
243
+ const peerCtx = node.peerContext.map(stripPeerContextFromNodeId).sort();
244
244
  if (peerEdgeTargets.length !== peerCtx.length || peerEdgeTargets.some((t, i) => t !== peerCtx[i])) {
245
245
  throw new GraphError("INVARIANT_VIOLATION", `peer edges of ${id} disagree with peerContext`);
246
246
  }
@@ -706,6 +706,20 @@ function emitWorkspaceUnresolved(edge, onDiagnostic) {
706
706
  if (onDiagnostic === void 0) return;
707
707
  onDiagnostic(workspaceUnresolvedDiagnostic(edge));
708
708
  }
709
+ function recipeOverrideNormalised(pm, count) {
710
+ return {
711
+ code: "RECIPE_OVERRIDE_NORMALISED",
712
+ severity: "info",
713
+ message: `captured ${count} ${pm} override${count === 1 ? "" : "s"} into canonical form`
714
+ };
715
+ }
716
+ function overrideParentRefDropped(pkg, to) {
717
+ return {
718
+ code: "OVERRIDE_PARENT_REF_DROPPED",
719
+ severity: "warning",
720
+ message: `override ${pkg}=${to}: npm $name self-ref has no yarn/pnpm equivalent; emitted verbatim`
721
+ };
722
+ }
709
723
 
710
724
  // src/main/ts/recipe/resolution.ts
711
725
  var HEX40_RE = /^[0-9a-f]{40}$/i;
@@ -929,6 +943,161 @@ function workspaceRangeOfEdge(edge, dst) {
929
943
  return { specifier: canonicalSpecifier, resolvedVersion: dst.version };
930
944
  }
931
945
 
946
+ // src/main/ts/recipe/overrides.ts
947
+ function splitNameVersion(selector) {
948
+ let depth = 0;
949
+ let lastAt = -1;
950
+ for (let i = 0; i < selector.length; i++) {
951
+ const c = selector[i];
952
+ if (c === "(") depth++;
953
+ else if (c === ")") depth--;
954
+ else if (c === "@" && depth === 0 && i >= 1) lastAt = i;
955
+ }
956
+ if (lastAt <= 0) return { package: selector };
957
+ const name = selector.slice(0, lastAt);
958
+ const version = selector.slice(lastAt + 1);
959
+ if (name.length === 0 || version.length === 0) return { package: selector };
960
+ return { package: name, versionCondition: version };
961
+ }
962
+ function captureOverrides(block, pm, onDiagnostic) {
963
+ if (block === null || typeof block !== "object") {
964
+ return { canonical: [], native: {} };
965
+ }
966
+ let canonical;
967
+ const native = {};
968
+ switch (pm) {
969
+ case "npm": {
970
+ native.npmOverrides = block;
971
+ canonical = captureNpm(block, []);
972
+ break;
973
+ }
974
+ case "yarn": {
975
+ const flat = asStringRecord(block);
976
+ native.yarnResolutions = flat;
977
+ canonical = captureFlat(flat, splitYarnKey);
978
+ break;
979
+ }
980
+ case "pnpm": {
981
+ const flat = asStringRecord(block);
982
+ native.pnpmOverrides = flat;
983
+ canonical = captureFlat(flat, splitPnpmKey);
984
+ break;
985
+ }
986
+ }
987
+ onDiagnostic?.(recipeOverrideNormalised(pm, canonical.length));
988
+ return { canonical, native };
989
+ }
990
+ function captureNpm(block, parentPath) {
991
+ const out = [];
992
+ for (const [key, value] of Object.entries(block)) {
993
+ if (key === ".") {
994
+ if (parentPath.length === 0) continue;
995
+ const pkg2 = parentPath[parentPath.length - 1];
996
+ const ancestors = parentPath.slice(0, -1);
997
+ if (typeof value === "string") out.push(constraint(pkg2, ancestors, value));
998
+ continue;
999
+ }
1000
+ const { package: pkg } = splitNameVersion(key);
1001
+ if (typeof value === "string") {
1002
+ out.push(constraint(pkg, parentPath, value));
1003
+ } else if (value !== null && typeof value === "object") {
1004
+ out.push(...captureNpm(value, [...parentPath, pkg]));
1005
+ }
1006
+ }
1007
+ return out;
1008
+ }
1009
+ function captureFlat(flat, splitKey) {
1010
+ const out = [];
1011
+ for (const [key, to] of Object.entries(flat)) {
1012
+ const { package: pkg, parentPath, versionCondition } = splitKey(key);
1013
+ out.push(constraint(pkg, parentPath, to, versionCondition));
1014
+ }
1015
+ return out;
1016
+ }
1017
+ function splitYarnKey(key) {
1018
+ const segments = splitYarnPathSegments(key);
1019
+ const leaf = segments[segments.length - 1];
1020
+ const { package: pkg, versionCondition } = splitNameVersion(leaf);
1021
+ const parentPath = segments.slice(0, -1).filter((s) => s !== "**");
1022
+ return versionCondition !== void 0 ? { package: pkg, parentPath, versionCondition } : { package: pkg, parentPath };
1023
+ }
1024
+ function splitYarnPathSegments(key) {
1025
+ const raw = key.split("/");
1026
+ const segments = [];
1027
+ for (let i = 0; i < raw.length; i++) {
1028
+ const piece = raw[i];
1029
+ if (piece.startsWith("@") && i + 1 < raw.length) {
1030
+ segments.push(`${piece}/${raw[i + 1]}`);
1031
+ i++;
1032
+ } else {
1033
+ segments.push(piece);
1034
+ }
1035
+ }
1036
+ return segments;
1037
+ }
1038
+ function splitPnpmKey(key) {
1039
+ const segments = key.split(">").filter((s) => s.length > 0);
1040
+ const leaf = segments[segments.length - 1];
1041
+ const { package: pkg, versionCondition } = splitNameVersion(leaf);
1042
+ const parentPath = segments.slice(0, -1).map((s) => splitNameVersion(s).package);
1043
+ return versionCondition !== void 0 ? { package: pkg, parentPath, versionCondition } : { package: pkg, parentPath };
1044
+ }
1045
+ function constraint(pkg, parentPath, to, versionCondition) {
1046
+ const c = { package: pkg, to };
1047
+ if (parentPath.length > 0) c.parentPath = parentPath;
1048
+ if (versionCondition !== void 0 && versionCondition !== "") {
1049
+ c.versionCondition = versionCondition;
1050
+ }
1051
+ if (to.startsWith("$")) c.selfRef = true;
1052
+ return c;
1053
+ }
1054
+ function asStringRecord(block) {
1055
+ const out = {};
1056
+ for (const [k, v] of Object.entries(block)) {
1057
+ if (typeof v === "string") out[k] = v;
1058
+ }
1059
+ return out;
1060
+ }
1061
+ function projectOverrides(canonical, pm, onDiagnostic) {
1062
+ return pm === "npm" ? projectNpm(canonical) : projectPnpm(canonical, onDiagnostic);
1063
+ }
1064
+ function projectNpm(canonical) {
1065
+ const root = {};
1066
+ for (const c of canonical) {
1067
+ const leafKey = c.versionCondition ? `${c.package}@${c.versionCondition}` : c.package;
1068
+ let node = root;
1069
+ for (const seg of c.parentPath ?? []) {
1070
+ const existing = node[seg];
1071
+ if (typeof existing === "object" && existing !== null) {
1072
+ node = existing;
1073
+ } else {
1074
+ const nested = typeof existing === "string" ? { ".": existing } : {};
1075
+ node[seg] = nested;
1076
+ node = nested;
1077
+ }
1078
+ }
1079
+ const existingLeaf = node[leafKey];
1080
+ if (existingLeaf !== null && typeof existingLeaf === "object") {
1081
+ existingLeaf["."] = c.to;
1082
+ } else {
1083
+ node[leafKey] = c.to;
1084
+ }
1085
+ }
1086
+ return root;
1087
+ }
1088
+ function projectPnpm(canonical, onDiagnostic) {
1089
+ const out = {};
1090
+ for (const c of canonical) {
1091
+ const leaf = c.versionCondition ? `${c.package}@${c.versionCondition}` : c.package;
1092
+ const key = c.parentPath && c.parentPath.length > 0 ? `${c.parentPath.join(">")}>${leaf}` : leaf;
1093
+ if (c.selfRef && onDiagnostic !== void 0) {
1094
+ onDiagnostic(overrideParentRefDropped(c.package, c.to));
1095
+ }
1096
+ out[key] = c.to;
1097
+ }
1098
+ return out;
1099
+ }
1100
+
932
1101
  // src/main/ts/formats/_npm-flat-types.ts
933
1102
  var cmpStr2 = (a, b) => a < b ? -1 : a > b ? 1 : 0;
934
1103
  function sortRecord(record) {
@@ -984,10 +1153,15 @@ function parseFamily(input, _options, config) {
984
1153
  const workspaceByPath = /* @__PURE__ */ new Map();
985
1154
  const pathToId = /* @__PURE__ */ new Map();
986
1155
  const idToEntry = /* @__PURE__ */ new Map();
987
- const rootName = rootEntry.name ?? lf.name;
988
- const rootVersion = rootEntry.version ?? lf.version;
989
- if (rootName === void 0 || rootVersion === void 0) {
990
- throw parseFailed(config, "root entry must carry name and version");
1156
+ const rootName = rootEntry.name ?? lf.name ?? ".";
1157
+ const rootVersion = rootEntry.version ?? lf.version ?? "0.0.0";
1158
+ if (rootEntry.version === void 0 && lf.version === void 0) {
1159
+ builder.diagnostic({
1160
+ code: `${config.diagnosticPrefix}_ROOT_VERSION_SYNTHESIZED`,
1161
+ severity: "info",
1162
+ subject: "graph",
1163
+ message: `private root entry carries no version; synthesised '${rootVersion}'`
1164
+ });
991
1165
  }
992
1166
  const rootId = `${rootName}@${rootVersion}`;
993
1167
  pathToId.set("", rootId);
@@ -999,15 +1173,30 @@ function parseFamily(input, _options, config) {
999
1173
  peerContext: [],
1000
1174
  workspacePath: ""
1001
1175
  });
1176
+ const linkNameByPath = /* @__PURE__ */ new Map();
1177
+ for (const [key, entry] of Object.entries(packages)) {
1178
+ if (entry.link !== true || typeof entry.resolved !== "string") continue;
1179
+ const at = key.lastIndexOf("node_modules/");
1180
+ if (at < 0) continue;
1181
+ const linkName = key.slice(at + "node_modules/".length);
1182
+ if (!linkNameByPath.has(entry.resolved)) linkNameByPath.set(entry.resolved, linkName);
1183
+ }
1002
1184
  for (const [path, entry] of Object.entries(packages)) {
1003
1185
  if (path === "" || path.startsWith("node_modules/")) continue;
1004
1186
  if (path.includes("/node_modules/")) continue;
1005
1187
  if (entry.link === true) continue;
1006
- const name = entry.name;
1007
- const version = entry.version;
1008
- if (name === void 0 || version === void 0) {
1009
- throw parseFailed(config, `workspace entry ${JSON.stringify(path)} missing name/version`);
1188
+ const synthName = entry.name ?? linkNameByPath.get(path) ?? path.slice(path.lastIndexOf("/") + 1);
1189
+ const synthVersion = entry.version ?? "0.0.0";
1190
+ if (entry.name === void 0 || entry.version === void 0) {
1191
+ builder.diagnostic({
1192
+ code: `${config.diagnosticPrefix}_WORKSPACE_MEMBER_SYNTHESIZED`,
1193
+ severity: "info",
1194
+ subject: "graph",
1195
+ message: `private workspace member ${JSON.stringify(path)} omits ${entry.name === void 0 ? "name" : ""}${entry.name === void 0 && entry.version === void 0 ? "/" : ""}${entry.version === void 0 ? "version" : ""}; synthesised ${synthName}@${synthVersion}`
1196
+ });
1010
1197
  }
1198
+ const name = synthName;
1199
+ const version = synthVersion;
1011
1200
  const id = `${name}@${version}`;
1012
1201
  if (idToEntry.has(id) && idToEntry.get(id) !== entry) {
1013
1202
  throw new LockfileError({
@@ -1040,6 +1229,9 @@ function parseFamily(input, _options, config) {
1040
1229
  pathToId.set(path, targetId);
1041
1230
  continue;
1042
1231
  }
1232
+ if (entry.version === void 0 && entry.resolved === void 0 && entry.optional === true) {
1233
+ continue;
1234
+ }
1043
1235
  const tailName = nameFromInstallPath(config, path, entry);
1044
1236
  const version = entry.version;
1045
1237
  if (version === void 0) {
@@ -1103,6 +1295,13 @@ function parseFamily(input, _options, config) {
1103
1295
  if (rootEntry.devDependencies !== void 0) rootMeta.devDependencies = { ...rootEntry.devDependencies };
1104
1296
  if (rootEntry.peerDependencies !== void 0) rootMeta.peerDependencies = { ...rootEntry.peerDependencies };
1105
1297
  if (rootEntry.optionalDependencies !== void 0) rootMeta.optionalDependencies = { ...rootEntry.optionalDependencies };
1298
+ if (rootEntry.overrides !== void 0) {
1299
+ const captured = captureOverrides(rootEntry.overrides, "npm", (d) => diagnostics.push(d));
1300
+ if (captured.canonical.length > 0) rootMeta.overrides = captured.canonical;
1301
+ if (captured.native.npmOverrides !== void 0) {
1302
+ rootMeta.nativeOverrides = captured.native.npmOverrides;
1303
+ }
1304
+ }
1106
1305
  for (const sc of nodeSidecar.values()) {
1107
1306
  sc.installPaths = Array.from(new Set(sc.installPaths)).sort(cmpStr2);
1108
1307
  }
@@ -1159,6 +1358,28 @@ function stringifyFamily(graph, config, options = {}) {
1159
1358
  } else {
1160
1359
  packages[""] = { name: rootName, version: rootVersion };
1161
1360
  }
1361
+ let overrideBlock;
1362
+ if (options.overrides !== void 0) {
1363
+ if (options.overrides.length > 0) {
1364
+ overrideBlock = projectOverrides(options.overrides, "npm", emitDiagnostic);
1365
+ }
1366
+ } else if (rootMeta?.nativeOverrides !== void 0) {
1367
+ overrideBlock = rootMeta.nativeOverrides;
1368
+ } else if (rootMeta?.overrides !== void 0 && rootMeta.overrides.length > 0) {
1369
+ overrideBlock = projectOverrides(rootMeta.overrides, "npm", emitDiagnostic);
1370
+ }
1371
+ if (overrideBlock !== void 0) {
1372
+ const rootEntry = packages[""];
1373
+ if (config.lockfileVersion >= 2 && typeof rootEntry === "object" && rootEntry !== null) {
1374
+ rootEntry.overrides = overrideBlock;
1375
+ } else {
1376
+ emitDiagnostic({
1377
+ code: `${config.diagnosticPrefix}_OVERRIDES_UNSUPPORTED`,
1378
+ severity: "warning",
1379
+ message: `lockfileVersion ${config.lockfileVersion} has no packages[""].overrides slot; ${Object.keys(overrideBlock).length} override key(s) not projected`
1380
+ });
1381
+ }
1382
+ }
1162
1383
  const workspaceMembers = [];
1163
1384
  for (const node of graph.nodes()) {
1164
1385
  warnPatchDrop(config, node, warnedPatches, emitDiagnostic);
@@ -1541,8 +1762,9 @@ function deriveInstallPathsForStringify(graph, sidecar, rootNode) {
1541
1762
  for (const edge of edges) {
1542
1763
  const dst = graph.getNode(edge.dst);
1543
1764
  if (dst === void 0 || dst.workspacePath !== void 0) continue;
1544
- if (resolveDepTarget(current.path, dst.name, pathToId) === dst.id) continue;
1545
- const installPath = current.path === "" ? `node_modules/${dst.name}` : `${current.path}/node_modules/${dst.name}`;
1765
+ const segment = edge.attrs?.alias ?? dst.name;
1766
+ if (resolveDepTarget(current.path, segment, pathToId) === dst.id) continue;
1767
+ const installPath = current.path === "" ? `node_modules/${segment}` : `${current.path}/node_modules/${segment}`;
1546
1768
  addPlacement(dst.id, installPath);
1547
1769
  }
1548
1770
  }
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-XpDkFSjz.js';
2
- import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-C3oOIC0o.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DlYNIpXt.js';
2
+ import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-BtjAgSy6.js';
3
3
 
4
4
  interface Npm3ParseOptions extends NpmFamilyParseOptions {
5
5
  }