@antongolub/lockfile 0.0.0-snapshot.64 → 0.0.0-snapshot.65

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.
@@ -763,7 +763,7 @@ function parseInner(protocol, spec, raw, options) {
763
763
  if (bindSuffix !== void 0) {
764
764
  const archiveUrl = archiveUrlOfBind(bindSuffix);
765
765
  if (archiveUrl !== void 0) {
766
- return { type: "tarball", url: archiveUrl };
766
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
767
767
  }
768
768
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
769
769
  }
@@ -981,6 +981,9 @@ function canonicalSourceStringOf(resolution) {
981
981
  function sha256Prefix16(input) {
982
982
  return createHash("sha256").update(input, "utf8").digest("hex").slice(0, 16);
983
983
  }
984
+ function isYarnBerryLocator(s) {
985
+ return s.includes("::") || /^[^:\s]+@(?:npm|patch|workspace|portal|link|exec|virtual):/.test(s);
986
+ }
984
987
  function stringifyForNpm(can) {
985
988
  switch (can.type) {
986
989
  case "tarball":
@@ -1572,8 +1575,9 @@ function buildEntry(node, installPath, graph, sidecar, treeByParent) {
1572
1575
  const entry = { version: node.version };
1573
1576
  const nodeSide = sidecar == null ? void 0 : sidecar.nodes.get(node.id);
1574
1577
  const tarball = graph.tarballOf(node.id);
1575
- const resolutionStr = (tarball == null ? void 0 : tarball.nativeResolution) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
1576
- if (resolutionStr !== void 0) {
1578
+ const native = tarball == null ? void 0 : tarball.nativeResolution;
1579
+ const resolutionStr = (native !== void 0 && !isYarnBerryLocator(native) ? native : void 0) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
1580
+ if (resolutionStr !== void 0 && !isYarnBerryLocator(resolutionStr)) {
1577
1581
  if (/^(git[+:]|github:)/.test(resolutionStr)) {
1578
1582
  entry.version = resolutionStr;
1579
1583
  } else if (isHttpUrl(resolutionStr) && isHttpUrl(node.version)) {
@@ -817,7 +817,7 @@ function parseInner(protocol, spec, raw, options) {
817
817
  if (bindSuffix !== void 0) {
818
818
  const archiveUrl = archiveUrlOfBind(bindSuffix);
819
819
  if (archiveUrl !== void 0) {
820
- return { type: "tarball", url: archiveUrl };
820
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
821
821
  }
822
822
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
823
823
  }
@@ -1035,6 +1035,9 @@ function canonicalSourceStringOf(resolution) {
1035
1035
  function sha256Prefix16(input) {
1036
1036
  return createHash("sha256").update(input, "utf8").digest("hex").slice(0, 16);
1037
1037
  }
1038
+ function isYarnBerryLocator(s) {
1039
+ return s.includes("::") || /^[^:\s]+@(?:npm|patch|workspace|portal|link|exec|virtual):/.test(s);
1040
+ }
1038
1041
  function stringifyForNpm(can) {
1039
1042
  switch (can.type) {
1040
1043
  case "tarball":
@@ -2002,7 +2005,11 @@ function buildNodeModulesEntry(graph, node, nodeSide, config, emitDiagnostic = (
2002
2005
  }
2003
2006
  body.version = node.version;
2004
2007
  const tarball = graph.tarballOf(node.id);
2005
- const resolved = (tarball == null ? void 0 : tarball.nativeResolution) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2008
+ const native = tarball == null ? void 0 : tarball.nativeResolution;
2009
+ let resolved = (native !== void 0 && !isYarnBerryLocator(native) ? native : void 0) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2010
+ if (resolved !== void 0 && isYarnBerryLocator(resolved)) {
2011
+ resolved = void 0;
2012
+ }
2006
2013
  if (resolved !== void 0) body.resolved = resolved;
2007
2014
  if ((tarball == null ? void 0 : tarball.integrity) !== void 0) {
2008
2015
  const sri = emitSri(tarball.integrity);
@@ -2300,7 +2307,7 @@ function buildLegacyNodeEntry(ctx, node, parentInstallPrefix) {
2300
2307
  const tarball = ctx.graph.tarballOf(node.id);
2301
2308
  const native = tarball == null ? void 0 : tarball.nativeResolution;
2302
2309
  const sourceResolved = sidecarResolvedFor(ctx, node) ?? deriveLegacyResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2303
- if (native !== void 0) {
2310
+ if (native !== void 0 && !isYarnBerryLocator(native)) {
2304
2311
  const looksLikeGit = /^git[+@]/.test(native);
2305
2312
  if (looksLikeGit) {
2306
2313
  entry.version = native;
@@ -2309,7 +2316,7 @@ function buildLegacyNodeEntry(ctx, node, parentInstallPrefix) {
2309
2316
  } else {
2310
2317
  entry.resolved = native;
2311
2318
  }
2312
- } else if (sourceResolved !== void 0) {
2319
+ } else if (sourceResolved !== void 0 && !isYarnBerryLocator(sourceResolved)) {
2313
2320
  const looksLikeGit = /^git[+@]/.test(sourceResolved);
2314
2321
  if (looksLikeGit) {
2315
2322
  entry.version = sourceResolved;
@@ -817,7 +817,7 @@ function parseInner(protocol, spec, raw, options) {
817
817
  if (bindSuffix !== void 0) {
818
818
  const archiveUrl = archiveUrlOfBind(bindSuffix);
819
819
  if (archiveUrl !== void 0) {
820
- return { type: "tarball", url: archiveUrl };
820
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
821
821
  }
822
822
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
823
823
  }
@@ -1035,6 +1035,9 @@ function canonicalSourceStringOf(resolution) {
1035
1035
  function sha256Prefix16(input) {
1036
1036
  return createHash("sha256").update(input, "utf8").digest("hex").slice(0, 16);
1037
1037
  }
1038
+ function isYarnBerryLocator(s) {
1039
+ return s.includes("::") || /^[^:\s]+@(?:npm|patch|workspace|portal|link|exec|virtual):/.test(s);
1040
+ }
1038
1041
  function stringifyForNpm(can) {
1039
1042
  switch (can.type) {
1040
1043
  case "tarball":
@@ -2002,7 +2005,11 @@ function buildNodeModulesEntry(graph, node, nodeSide, config, emitDiagnostic = (
2002
2005
  }
2003
2006
  body.version = node.version;
2004
2007
  const tarball = graph.tarballOf(node.id);
2005
- const resolved = (tarball == null ? void 0 : tarball.nativeResolution) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2008
+ const native = tarball == null ? void 0 : tarball.nativeResolution;
2009
+ let resolved = (native !== void 0 && !isYarnBerryLocator(native) ? native : void 0) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2010
+ if (resolved !== void 0 && isYarnBerryLocator(resolved)) {
2011
+ resolved = void 0;
2012
+ }
2006
2013
  if (resolved !== void 0) body.resolved = resolved;
2007
2014
  if ((tarball == null ? void 0 : tarball.integrity) !== void 0) {
2008
2015
  const sri = emitSri(tarball.integrity);
@@ -783,7 +783,7 @@ function parseInner(protocol, spec, raw, options) {
783
783
  if (bindSuffix !== void 0) {
784
784
  const archiveUrl = archiveUrlOfBind(bindSuffix);
785
785
  if (archiveUrl !== void 0) {
786
- return { type: "tarball", url: archiveUrl };
786
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
787
787
  }
788
788
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
789
789
  }
@@ -842,7 +842,7 @@ function parseInner(protocol, spec, raw, options) {
842
842
  if (bindSuffix !== void 0) {
843
843
  const archiveUrl = archiveUrlOfBind(bindSuffix);
844
844
  if (archiveUrl !== void 0) {
845
- return { type: "tarball", url: archiveUrl };
845
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
846
846
  }
847
847
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
848
848
  }
@@ -842,7 +842,7 @@ function parseInner(protocol, spec, raw, options) {
842
842
  if (bindSuffix !== void 0) {
843
843
  const archiveUrl = archiveUrlOfBind(bindSuffix);
844
844
  if (archiveUrl !== void 0) {
845
- return { type: "tarball", url: archiveUrl };
845
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
846
846
  }
847
847
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
848
848
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2398,6 +2399,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2398
2399
  }
2399
2400
  return entry;
2400
2401
  }
2402
+ function isBerryLocatorOfNode(native, name) {
2403
+ return native.startsWith(`${name}@`);
2404
+ }
2405
+ function synthesisedBerryTarballLocator(node, canonical) {
2406
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2407
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2408
+ return `${node.name}@npm:${node.version}`;
2409
+ }
2410
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2411
+ return `${node.name}@npm:${node.version}::${bind}`;
2412
+ }
2401
2413
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2402
2414
  if (node.patch !== void 0) {
2403
2415
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2413,10 +2425,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2413
2425
  emitDiagnostic
2414
2426
  );
2415
2427
  }
2416
- if (native !== void 0) return native;
2428
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2417
2429
  if (node.workspacePath !== void 0) {
2418
2430
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2419
2431
  }
2432
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2433
+ if (synthesised !== void 0) return synthesised;
2434
+ if (native !== void 0) return native;
2420
2435
  if (canonical !== void 0) {
2421
2436
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2422
2437
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -1140,7 +1140,7 @@ function parseInner(protocol, spec, raw, options) {
1140
1140
  if (bindSuffix !== void 0) {
1141
1141
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1142
1142
  if (archiveUrl !== void 0) {
1143
- return { type: "tarball", url: archiveUrl };
1143
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1144
1144
  }
1145
1145
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
1146
1146
  }
@@ -2276,12 +2276,13 @@ function validateMetadata(ast, config) {
2276
2276
  return Object.keys(extras).length > 0 ? extras : void 0;
2277
2277
  }
2278
2278
  function entryKeyOfNode(graph, node) {
2279
- var _a, _b, _c, _d;
2279
+ var _a, _b, _c;
2280
2280
  const verbatim = (_b = (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
2281
2281
  if (verbatim !== void 0 && verbatim.length > 0) {
2282
2282
  return verbatim.join(", ");
2283
2283
  }
2284
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
2284
+ const payload = graph.tarballOf(node.id);
2285
+ const native = payload == null ? void 0 : payload.nativeResolution;
2285
2286
  const self = selfDescriptorOfNode(node, native);
2286
2287
  const specs = /* @__PURE__ */ new Set();
2287
2288
  if (self !== void 0) specs.add(self);
@@ -2289,7 +2290,7 @@ function entryKeyOfNode(graph, node) {
2289
2290
  if (patchBase !== void 0) specs.add(patchBase);
2290
2291
  for (const edge of graph.in(node.id)) {
2291
2292
  if (edge.kind === "peer") continue;
2292
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
2293
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
2293
2294
  const specName = edge.attrs.alias ?? node.name;
2294
2295
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
2295
2296
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -2298,7 +2299,7 @@ function entryKeyOfNode(graph, node) {
2298
2299
  }
2299
2300
  }
2300
2301
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
2301
- specs.add(`${node.name}@npm:${node.version}`);
2302
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
2302
2303
  }
2303
2304
  return Array.from(specs).sort(cmpStr3).join(", ");
2304
2305
  }
@@ -2330,7 +2331,7 @@ function baseSpecOfPatchLocator(locator) {
2330
2331
  return void 0;
2331
2332
  }
2332
2333
  }
2333
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
2334
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
2334
2335
  function linkTypeOfResolution(resolution) {
2335
2336
  if (resolution === void 0) return "hard";
2336
2337
  let part;
@@ -2393,6 +2394,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
2393
2394
  }
2394
2395
  return entry;
2395
2396
  }
2397
+ function isBerryLocatorOfNode(native, name) {
2398
+ return native.startsWith(`${name}@`);
2399
+ }
2400
+ function synthesisedBerryTarballLocator(node, canonical) {
2401
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
2402
+ if (sourceDiscriminatorOf(canonical) === void 0) {
2403
+ return `${node.name}@npm:${node.version}`;
2404
+ }
2405
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
2406
+ return `${node.name}@npm:${node.version}::${bind}`;
2407
+ }
2396
2408
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2397
2409
  if (node.patch !== void 0) {
2398
2410
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -2408,10 +2420,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
2408
2420
  emitDiagnostic
2409
2421
  );
2410
2422
  }
2411
- if (native !== void 0) return native;
2423
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
2412
2424
  if (node.workspacePath !== void 0) {
2413
2425
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
2414
2426
  }
2427
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
2428
+ if (synthesised !== void 0) return synthesised;
2429
+ if (native !== void 0) return native;
2415
2430
  if (canonical !== void 0) {
2416
2431
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
2417
2432
  }
@@ -886,7 +886,7 @@ function parseInner(protocol, spec, raw, options) {
886
886
  if (bindSuffix !== void 0) {
887
887
  const archiveUrl = archiveUrlOfBind(bindSuffix);
888
888
  if (archiveUrl !== void 0) {
889
- return { type: "tarball", url: archiveUrl };
889
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
890
890
  }
891
891
  return { type: "tarball", url: deriveRegistryUrl(options.name, version), bind: bindSuffix };
892
892
  }
@@ -1350,19 +1350,19 @@ function stringify(graph, options = {}) {
1350
1350
  const sortedNodes = Array.from(graph.nodes()).sort(
1351
1351
  (a, b) => cmpUtf16(a.id, b.id) || (a.patch === void 0 ? 0 : 1) - (b.patch === void 0 ? 0 : 1)
1352
1352
  );
1353
- const emittedNameVersion = /* @__PURE__ */ new Set();
1353
+ const emittedIdentity = /* @__PURE__ */ new Set();
1354
1354
  const dedupedNodes = [];
1355
1355
  for (const node of sortedNodes) {
1356
1356
  if (node.workspacePath !== void 0) {
1357
1357
  dedupedNodes.push(node);
1358
1358
  continue;
1359
1359
  }
1360
- const nameVersion = `${node.name}@${node.version}`;
1361
- if (emittedNameVersion.has(nameVersion)) {
1360
+ const identity = node.source === void 0 ? `${node.name}@${node.version}` : `${node.name}@${node.version}+src=${node.source}`;
1361
+ if (emittedIdentity.has(identity)) {
1362
1362
  warnPatchDrop(node, warnedPatches, emitDiagnostic);
1363
1363
  continue;
1364
1364
  }
1365
- emittedNameVersion.add(nameVersion);
1365
+ emittedIdentity.add(identity);
1366
1366
  dedupedNodes.push(node);
1367
1367
  }
1368
1368
  const emitSidecar = sidecarByGraph.get(graph);
package/dist/index.js CHANGED
@@ -1106,7 +1106,7 @@ function parseInner(protocol, spec, raw, options) {
1106
1106
  if (bindSuffix !== void 0) {
1107
1107
  const archiveUrl = archiveUrlOfBind(bindSuffix);
1108
1108
  if (archiveUrl !== void 0) {
1109
- return { type: "tarball", url: archiveUrl };
1109
+ return { type: "tarball", url: archiveUrl, bind: bindSuffix };
1110
1110
  }
1111
1111
  return { type: "tarball", url: deriveRegistryUrl(options.name, version3), bind: bindSuffix };
1112
1112
  }
@@ -1356,6 +1356,9 @@ function stringifyForYarnClassic(can, hints = {}) {
1356
1356
  return can.raw;
1357
1357
  }
1358
1358
  }
1359
+ function isYarnBerryLocator(s) {
1360
+ return s.includes("::") || /^[^:\s]+@(?:npm|patch|workspace|portal|link|exec|virtual):/.test(s);
1361
+ }
1359
1362
  function stringifyForNpm(can) {
1360
1363
  switch (can.type) {
1361
1364
  case "tarball":
@@ -2045,7 +2048,11 @@ function buildNodeModulesEntry(graph, node, nodeSide, config, emitDiagnostic = (
2045
2048
  }
2046
2049
  body.version = node.version;
2047
2050
  const tarball = graph.tarballOf(node.id);
2048
- const resolved = (tarball == null ? void 0 : tarball.nativeResolution) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2051
+ const native = tarball == null ? void 0 : tarball.nativeResolution;
2052
+ let resolved = (native !== void 0 && !isYarnBerryLocator(native) ? native : void 0) ?? ((_b = (_a = config.hooks) == null ? void 0 : _a.recoverResolvedForNode) == null ? void 0 : _b.call(_a, graph, node)) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
2053
+ if (resolved !== void 0 && isYarnBerryLocator(resolved)) {
2054
+ resolved = void 0;
2055
+ }
2049
2056
  if (resolved !== void 0) body.resolved = resolved;
2050
2057
  if ((tarball == null ? void 0 : tarball.integrity) !== void 0) {
2051
2058
  const sri = emitSri(tarball.integrity);
@@ -5055,8 +5062,9 @@ function buildEntry(node, installPath, graph, sidecar, treeByParent) {
5055
5062
  const entry = { version: node.version };
5056
5063
  const nodeSide = sidecar == null ? void 0 : sidecar.nodes.get(node.id);
5057
5064
  const tarball = graph.tarballOf(node.id);
5058
- const resolutionStr = (tarball == null ? void 0 : tarball.nativeResolution) ?? deriveResolvedFromCanonical2(tarball == null ? void 0 : tarball.resolution);
5059
- if (resolutionStr !== void 0) {
5065
+ const native = tarball == null ? void 0 : tarball.nativeResolution;
5066
+ const resolutionStr = (native !== void 0 && !isYarnBerryLocator(native) ? native : void 0) ?? deriveResolvedFromCanonical2(tarball == null ? void 0 : tarball.resolution);
5067
+ if (resolutionStr !== void 0 && !isYarnBerryLocator(resolutionStr)) {
5060
5068
  if (/^(git[+:]|github:)/.test(resolutionStr)) {
5061
5069
  entry.version = resolutionStr;
5062
5070
  } else if (isHttpUrl(resolutionStr) && isHttpUrl(node.version)) {
@@ -5350,7 +5358,7 @@ function buildLegacyNodeEntry(ctx, node, parentInstallPrefix) {
5350
5358
  const tarball = ctx.graph.tarballOf(node.id);
5351
5359
  const native = tarball == null ? void 0 : tarball.nativeResolution;
5352
5360
  const sourceResolved = sidecarResolvedFor(ctx, node) ?? deriveLegacyResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
5353
- if (native !== void 0) {
5361
+ if (native !== void 0 && !isYarnBerryLocator(native)) {
5354
5362
  const looksLikeGit = /^git[+@]/.test(native);
5355
5363
  if (looksLikeGit) {
5356
5364
  entry.version = native;
@@ -5359,7 +5367,7 @@ function buildLegacyNodeEntry(ctx, node, parentInstallPrefix) {
5359
5367
  } else {
5360
5368
  entry.resolved = native;
5361
5369
  }
5362
- } else if (sourceResolved !== void 0) {
5370
+ } else if (sourceResolved !== void 0 && !isYarnBerryLocator(sourceResolved)) {
5363
5371
  const looksLikeGit = /^git[+@]/.test(sourceResolved);
5364
5372
  if (looksLikeGit) {
5365
5373
  entry.version = sourceResolved;
@@ -6885,12 +6893,13 @@ function validateMetadata(ast, config) {
6885
6893
  return Object.keys(extras).length > 0 ? extras : void 0;
6886
6894
  }
6887
6895
  function entryKeyOfNode(graph, node) {
6888
- var _a, _b, _c, _d;
6896
+ var _a, _b, _c;
6889
6897
  const verbatim = (_b = (_a = sidecarByGraph6.get(graph)) == null ? void 0 : _a.entryKeyDescriptors) == null ? void 0 : _b.get(node.id);
6890
6898
  if (verbatim !== void 0 && verbatim.length > 0) {
6891
6899
  return verbatim.join(", ");
6892
6900
  }
6893
- const native = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.nativeResolution;
6901
+ const payload = graph.tarballOf(node.id);
6902
+ const native = payload == null ? void 0 : payload.nativeResolution;
6894
6903
  const self = selfDescriptorOfNode(node, native);
6895
6904
  const specs = /* @__PURE__ */ new Set();
6896
6905
  if (self !== void 0) specs.add(self);
@@ -6898,7 +6907,7 @@ function entryKeyOfNode(graph, node) {
6898
6907
  if (patchBase !== void 0) specs.add(patchBase);
6899
6908
  for (const edge of graph.in(node.id)) {
6900
6909
  if (edge.kind === "peer") continue;
6901
- if (((_d = edge.attrs) == null ? void 0 : _d.range) !== void 0) {
6910
+ if (((_c = edge.attrs) == null ? void 0 : _c.range) !== void 0) {
6902
6911
  const specName = edge.attrs.alias ?? node.name;
6903
6912
  const secondary = `${specName}@${entryKeyRangeOf(edge.attrs.range)}`;
6904
6913
  if (self === void 0 || !isLocatorQualifiedPrefix(self, secondary)) {
@@ -6907,7 +6916,7 @@ function entryKeyOfNode(graph, node) {
6907
6916
  }
6908
6917
  }
6909
6918
  if (!Array.from(specs).some((spec) => spec.startsWith(`${node.name}@`))) {
6910
- specs.add(`${node.name}@npm:${node.version}`);
6919
+ specs.add(synthesisedBerryTarballLocator(node, payload == null ? void 0 : payload.resolution) ?? `${node.name}@npm:${node.version}`);
6911
6920
  }
6912
6921
  return Array.from(specs).sort(cmpStr5).join(", ");
6913
6922
  }
@@ -6939,7 +6948,7 @@ function baseSpecOfPatchLocator(locator) {
6939
6948
  return void 0;
6940
6949
  }
6941
6950
  }
6942
- var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?])/i;
6951
+ var ARCHIVE_PATH_RE = /\.(?:tgz|tar\.gz|tar)(?:$|[#?:])/i;
6943
6952
  function linkTypeOfResolution(resolution) {
6944
6953
  if (resolution === void 0) return "hard";
6945
6954
  let part;
@@ -7009,6 +7018,17 @@ function entryOfNode(graph, node, config, emitDiagnostic, cacheKey) {
7009
7018
  }
7010
7019
  return entry;
7011
7020
  }
7021
+ function isBerryLocatorOfNode(native, name) {
7022
+ return native.startsWith(`${name}@`);
7023
+ }
7024
+ function synthesisedBerryTarballLocator(node, canonical) {
7025
+ if (canonical === void 0 || canonical.type !== "tarball") return void 0;
7026
+ if (sourceDiscriminatorOf(canonical) === void 0) {
7027
+ return `${node.name}@npm:${node.version}`;
7028
+ }
7029
+ const bind = canonical.bind ?? `__archiveUrl=${encodeURIComponent(canonical.url)}`;
7030
+ return `${node.name}@npm:${node.version}::${bind}`;
7031
+ }
7012
7032
  function resolutionOfNode(node, canonical, native, emitDiagnostic) {
7013
7033
  if (node.patch !== void 0) {
7014
7034
  if (native !== void 0 && patchLocatorOfResolution(native) !== void 0) {
@@ -7024,10 +7044,13 @@ function resolutionOfNode(node, canonical, native, emitDiagnostic) {
7024
7044
  emitDiagnostic
7025
7045
  );
7026
7046
  }
7027
- if (native !== void 0) return native;
7047
+ if (native !== void 0 && isBerryLocatorOfNode(native, node.name)) return native;
7028
7048
  if (node.workspacePath !== void 0) {
7029
7049
  return `${node.name}@workspace:${node.workspacePath === "" ? "." : node.workspacePath}`;
7030
7050
  }
7051
+ const synthesised = synthesisedBerryTarballLocator(node, canonical);
7052
+ if (synthesised !== void 0) return synthesised;
7053
+ if (native !== void 0) return native;
7031
7054
  if (canonical !== void 0) {
7032
7055
  return stringifyForYarnBerry(canonical, { name: node.name, version: node.version });
7033
7056
  }
@@ -7899,19 +7922,19 @@ function stringify16(graph, options = {}) {
7899
7922
  const sortedNodes = Array.from(graph.nodes()).sort(
7900
7923
  (a, b) => cmpUtf16(a.id, b.id) || (a.patch === void 0 ? 0 : 1) - (b.patch === void 0 ? 0 : 1)
7901
7924
  );
7902
- const emittedNameVersion = /* @__PURE__ */ new Set();
7925
+ const emittedIdentity = /* @__PURE__ */ new Set();
7903
7926
  const dedupedNodes = [];
7904
7927
  for (const node of sortedNodes) {
7905
7928
  if (node.workspacePath !== void 0) {
7906
7929
  dedupedNodes.push(node);
7907
7930
  continue;
7908
7931
  }
7909
- const nameVersion = `${node.name}@${node.version}`;
7910
- if (emittedNameVersion.has(nameVersion)) {
7932
+ const identity = node.source === void 0 ? `${node.name}@${node.version}` : `${node.name}@${node.version}+src=${node.source}`;
7933
+ if (emittedIdentity.has(identity)) {
7911
7934
  warnPatchDrop4(node, warnedPatches, emitDiagnostic);
7912
7935
  continue;
7913
7936
  }
7914
- emittedNameVersion.add(nameVersion);
7937
+ emittedIdentity.add(identity);
7915
7938
  dedupedNodes.push(node);
7916
7939
  }
7917
7940
  const emitSidecar = sidecarByGraph7.get(graph);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antongolub/lockfile",
3
- "version": "0.0.0-snapshot.64",
3
+ "version": "0.0.0-snapshot.65",
4
4
  "private": false,
5
5
  "description": "Universal lockfile model and converter for npm, yarn, pnpm, bun",
6
6
  "type": "module",