@fern-api/fdr-sdk 1.2.42-0c024f5b0d → 1.2.42-23647d2912
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/dist/js/navigation/ledger-root-builder.js +134 -30
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +134 -30
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +267 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +306 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +109 -4
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +102 -0
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +256 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +192 -33
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -92,6 +92,17 @@ var VersionIdSchema = z.string();
|
|
|
92
92
|
function VersionId(value) {
|
|
93
93
|
return value;
|
|
94
94
|
}
|
|
95
|
+
var Availability = {
|
|
96
|
+
Alpha: "Alpha",
|
|
97
|
+
Stable: "Stable",
|
|
98
|
+
GenerallyAvailable: "GenerallyAvailable",
|
|
99
|
+
InDevelopment: "InDevelopment",
|
|
100
|
+
PreRelease: "PreRelease",
|
|
101
|
+
Deprecated: "Deprecated",
|
|
102
|
+
Beta: "Beta",
|
|
103
|
+
Preview: "Preview",
|
|
104
|
+
Legacy: "Legacy"
|
|
105
|
+
};
|
|
95
106
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
96
107
|
HttpMethodSchema,
|
|
97
108
|
z.array(z.unknown())
|
|
@@ -888,6 +899,35 @@ function metaStr(metadata, key) {
|
|
|
888
899
|
}
|
|
889
900
|
return void 0;
|
|
890
901
|
}
|
|
902
|
+
var AVAILABILITY_LOOKUP = {
|
|
903
|
+
// V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
|
|
904
|
+
alpha: Availability.Alpha,
|
|
905
|
+
stable: Availability.Stable,
|
|
906
|
+
"generally-available": Availability.GenerallyAvailable,
|
|
907
|
+
"in-development": Availability.InDevelopment,
|
|
908
|
+
"pre-release": Availability.PreRelease,
|
|
909
|
+
deprecated: Availability.Deprecated,
|
|
910
|
+
beta: Availability.Beta,
|
|
911
|
+
preview: Availability.Preview,
|
|
912
|
+
legacy: Availability.Legacy,
|
|
913
|
+
// Latest PascalCase values (pass-through)
|
|
914
|
+
Alpha: Availability.Alpha,
|
|
915
|
+
Stable: Availability.Stable,
|
|
916
|
+
GenerallyAvailable: Availability.GenerallyAvailable,
|
|
917
|
+
InDevelopment: Availability.InDevelopment,
|
|
918
|
+
PreRelease: Availability.PreRelease,
|
|
919
|
+
Deprecated: Availability.Deprecated,
|
|
920
|
+
Beta: Availability.Beta,
|
|
921
|
+
Preview: Availability.Preview,
|
|
922
|
+
Legacy: Availability.Legacy
|
|
923
|
+
};
|
|
924
|
+
function metaAvailability(metadata) {
|
|
925
|
+
const raw = metaStr(metadata, "availability");
|
|
926
|
+
if (raw == null) {
|
|
927
|
+
return void 0;
|
|
928
|
+
}
|
|
929
|
+
return AVAILABILITY_LOOKUP[raw];
|
|
930
|
+
}
|
|
891
931
|
function metaBool(metadata, key) {
|
|
892
932
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
893
933
|
const v = metadata[key];
|
|
@@ -1005,7 +1045,7 @@ function artifactToNode(ctx, route) {
|
|
|
1005
1045
|
}),
|
|
1006
1046
|
pageId: PageId(pageId),
|
|
1007
1047
|
noindex: metaBool(md, "noindex"),
|
|
1008
|
-
availability:
|
|
1048
|
+
availability: metaAvailability(md)
|
|
1009
1049
|
};
|
|
1010
1050
|
return node;
|
|
1011
1051
|
}
|
|
@@ -1070,7 +1110,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1070
1110
|
endpointId: EndpointId(endpointId),
|
|
1071
1111
|
apiDefinitionId,
|
|
1072
1112
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1073
|
-
availability:
|
|
1113
|
+
availability: metaAvailability(md),
|
|
1074
1114
|
playground: void 0
|
|
1075
1115
|
};
|
|
1076
1116
|
}
|
|
@@ -1086,7 +1126,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1086
1126
|
method,
|
|
1087
1127
|
webhookId: WebhookId(webhookId),
|
|
1088
1128
|
apiDefinitionId,
|
|
1089
|
-
availability:
|
|
1129
|
+
availability: metaAvailability(md)
|
|
1090
1130
|
};
|
|
1091
1131
|
}
|
|
1092
1132
|
if (route.type === "asyncapi") {
|
|
@@ -1099,7 +1139,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1099
1139
|
...meta,
|
|
1100
1140
|
webSocketId: WebSocketId(webSocketId),
|
|
1101
1141
|
apiDefinitionId,
|
|
1102
|
-
availability:
|
|
1142
|
+
availability: metaAvailability(md),
|
|
1103
1143
|
playground: void 0
|
|
1104
1144
|
};
|
|
1105
1145
|
}
|
|
@@ -1115,7 +1155,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1115
1155
|
method,
|
|
1116
1156
|
grpcId: GrpcId(grpcId),
|
|
1117
1157
|
apiDefinitionId,
|
|
1118
|
-
availability:
|
|
1158
|
+
availability: metaAvailability(md)
|
|
1119
1159
|
};
|
|
1120
1160
|
}
|
|
1121
1161
|
if (route.type === "graphql") {
|
|
@@ -1131,7 +1171,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1131
1171
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1132
1172
|
graphqlOperationIds: void 0,
|
|
1133
1173
|
apiDefinitionId,
|
|
1134
|
-
availability:
|
|
1174
|
+
availability: metaAvailability(md),
|
|
1135
1175
|
playground: void 0
|
|
1136
1176
|
};
|
|
1137
1177
|
}
|
|
@@ -1260,6 +1300,30 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
1260
1300
|
}
|
|
1261
1301
|
return section;
|
|
1262
1302
|
}
|
|
1303
|
+
function computeDuplicateSiblingSortBoundaries(siblings) {
|
|
1304
|
+
const result = /* @__PURE__ */ new Map();
|
|
1305
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1306
|
+
for (const sibling of siblings) {
|
|
1307
|
+
if (metaStr(sibling.seg.metadata, "type") !== "section") {
|
|
1308
|
+
continue;
|
|
1309
|
+
}
|
|
1310
|
+
const group = byPath.get(sibling.seg.section) ?? [];
|
|
1311
|
+
group.push(sibling);
|
|
1312
|
+
byPath.set(sibling.seg.section, group);
|
|
1313
|
+
}
|
|
1314
|
+
for (const [, group] of byPath) {
|
|
1315
|
+
if (group.length <= 1) {
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
for (let i = 0; i < group.length; i++) {
|
|
1319
|
+
result.set(group[i], {
|
|
1320
|
+
lo: group[i].seg.sortOrder,
|
|
1321
|
+
hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return result;
|
|
1326
|
+
}
|
|
1263
1327
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1264
1328
|
const leafNodes = [];
|
|
1265
1329
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1309,17 +1373,20 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1309
1373
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1310
1374
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1311
1375
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1312
|
-
availability:
|
|
1376
|
+
availability: metaAvailability(seg.metadata),
|
|
1313
1377
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1314
1378
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1315
1379
|
};
|
|
1316
1380
|
}
|
|
1317
|
-
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1381
|
+
function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
1318
1382
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1319
1383
|
return scopeSegs.filter((s) => {
|
|
1320
1384
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1321
1385
|
return false;
|
|
1322
1386
|
}
|
|
1387
|
+
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1323
1390
|
const parent = parentSectionPath(s.seg.section);
|
|
1324
1391
|
if (parent === parentSection) {
|
|
1325
1392
|
return true;
|
|
@@ -1333,7 +1400,7 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1333
1400
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1334
1401
|
const { seg, nav } = scoped;
|
|
1335
1402
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1336
|
-
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1403
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
|
|
1337
1404
|
const packageNodes = childPackages.map((child) => ({
|
|
1338
1405
|
node: apiPackageChildNode(
|
|
1339
1406
|
ctx,
|
|
@@ -1383,7 +1450,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1383
1450
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1384
1451
|
}),
|
|
1385
1452
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1386
|
-
availability:
|
|
1453
|
+
availability: metaAvailability(seg.metadata),
|
|
1387
1454
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1388
1455
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1389
1456
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1471,10 +1538,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1471
1538
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1472
1539
|
}),
|
|
1473
1540
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1474
|
-
availability:
|
|
1541
|
+
availability: metaAvailability(seg.metadata),
|
|
1475
1542
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1476
1543
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1477
|
-
paginated:
|
|
1544
|
+
paginated: metaBool(seg.metadata, "paginated"),
|
|
1478
1545
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1479
1546
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1480
1547
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1492,7 +1559,10 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1492
1559
|
}
|
|
1493
1560
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1494
1561
|
});
|
|
1495
|
-
const
|
|
1562
|
+
const apiReferenceCount = scopeSegs.filter((candidate) => {
|
|
1563
|
+
return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1564
|
+
}).length;
|
|
1565
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
|
|
1496
1566
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1497
1567
|
}
|
|
1498
1568
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1500,12 +1570,13 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1500
1570
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1501
1571
|
return false;
|
|
1502
1572
|
}
|
|
1503
|
-
|
|
1573
|
+
const candidates = scopeSegs.filter((candidate) => {
|
|
1504
1574
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1505
1575
|
return false;
|
|
1506
1576
|
}
|
|
1507
1577
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1508
1578
|
});
|
|
1579
|
+
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1509
1580
|
}
|
|
1510
1581
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1511
1582
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1660,6 +1731,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1660
1731
|
}
|
|
1661
1732
|
return false;
|
|
1662
1733
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1734
|
+
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1663
1735
|
return direct.map((s) => {
|
|
1664
1736
|
const type = metaStr(s.seg.metadata, "type");
|
|
1665
1737
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1669,10 +1741,14 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1669
1741
|
} else if (type === "changelog") {
|
|
1670
1742
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1671
1743
|
} else {
|
|
1744
|
+
const boundary = siblingBoundaries.get(s);
|
|
1745
|
+
const childScopeSegs = boundary != null ? scopeSegs.filter(
|
|
1746
|
+
(candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
|
|
1747
|
+
) : scopeSegs;
|
|
1672
1748
|
node = sectionNode(
|
|
1673
1749
|
ctx,
|
|
1674
1750
|
s,
|
|
1675
|
-
buildSectionTree(ctx,
|
|
1751
|
+
buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1676
1752
|
scopePrefix
|
|
1677
1753
|
);
|
|
1678
1754
|
}
|
|
@@ -1686,7 +1762,11 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1686
1762
|
for (const s of ordered) {
|
|
1687
1763
|
const type = metaStr(s.seg.metadata, "type");
|
|
1688
1764
|
const sec = s.seg.section;
|
|
1689
|
-
if (type !== "section"
|
|
1765
|
+
if (type !== "section") {
|
|
1766
|
+
continue;
|
|
1767
|
+
}
|
|
1768
|
+
if (sec === "") {
|
|
1769
|
+
rootSections.push(s);
|
|
1690
1770
|
continue;
|
|
1691
1771
|
}
|
|
1692
1772
|
const parent = parentSectionPath(sec);
|
|
@@ -1717,8 +1797,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1717
1797
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1718
1798
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1719
1799
|
const annotated = [];
|
|
1720
|
-
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1721
1800
|
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1801
|
+
const hasRootSection = ordered.some(
|
|
1802
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1803
|
+
);
|
|
1722
1804
|
for (const s of ordered) {
|
|
1723
1805
|
const type = metaStr(s.seg.metadata, "type");
|
|
1724
1806
|
const sec = s.seg.section;
|
|
@@ -1737,8 +1819,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1737
1819
|
}
|
|
1738
1820
|
continue;
|
|
1739
1821
|
}
|
|
1740
|
-
if (type === "section" && sec === "") {
|
|
1741
|
-
const
|
|
1822
|
+
if (type === "section" && sec === "" && hasRootSection) {
|
|
1823
|
+
const bounds = siblingBoundaries.get(s);
|
|
1824
|
+
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1825
|
+
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1742
1826
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1743
1827
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1744
1828
|
continue;
|
|
@@ -1757,12 +1841,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1757
1841
|
} else {
|
|
1758
1842
|
const bounds = siblingBoundaries.get(s);
|
|
1759
1843
|
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
|
|
1764
|
-
scopePrefix
|
|
1765
|
-
);
|
|
1844
|
+
const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
|
|
1845
|
+
const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
|
|
1846
|
+
node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1766
1847
|
}
|
|
1767
1848
|
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1768
1849
|
annotated.push({
|
|
@@ -1800,10 +1881,6 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1800
1881
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1801
1882
|
flushRun();
|
|
1802
1883
|
out.push(child);
|
|
1803
|
-
} else if (child.type === "changelog") {
|
|
1804
|
-
flushRun();
|
|
1805
|
-
run.push(child);
|
|
1806
|
-
flushRun();
|
|
1807
1884
|
} else {
|
|
1808
1885
|
run.push(child);
|
|
1809
1886
|
}
|
|
@@ -1918,7 +1995,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1918
1995
|
const variantIndividualSlug = detailSlug(variant);
|
|
1919
1996
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1920
1997
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1921
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1998
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
|
|
1922
1999
|
return {
|
|
1923
2000
|
type: "variant",
|
|
1924
2001
|
...withMetadataDefaults({
|
|
@@ -2320,6 +2397,7 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2320
2397
|
};
|
|
2321
2398
|
return node;
|
|
2322
2399
|
});
|
|
2400
|
+
markCrossProductCanonicalSlugs(children);
|
|
2323
2401
|
return {
|
|
2324
2402
|
type: "productgroup",
|
|
2325
2403
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2331,6 +2409,32 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2331
2409
|
children
|
|
2332
2410
|
};
|
|
2333
2411
|
}
|
|
2412
|
+
function markCrossProductCanonicalSlugs(productNodes) {
|
|
2413
|
+
const pageIdToCanonical = /* @__PURE__ */ new Map();
|
|
2414
|
+
const sorted = [...productNodes].sort((a, b) => {
|
|
2415
|
+
if (a.default !== b.default) {
|
|
2416
|
+
return a.default ? -1 : 1;
|
|
2417
|
+
}
|
|
2418
|
+
return 0;
|
|
2419
|
+
});
|
|
2420
|
+
for (const product of sorted) {
|
|
2421
|
+
traverseDF(product, (child) => {
|
|
2422
|
+
if (hasMetadata(child) && isPage(child)) {
|
|
2423
|
+
const pid = getPageId(child);
|
|
2424
|
+
if (pid == null) {
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
const key = `pid:${pid}`;
|
|
2428
|
+
const canonical = pageIdToCanonical.get(key);
|
|
2429
|
+
if (canonical != null && !product.default) {
|
|
2430
|
+
child.canonicalSlug = canonical;
|
|
2431
|
+
} else if (canonical == null) {
|
|
2432
|
+
pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2334
2438
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2335
2439
|
0 && (module.exports = {
|
|
2336
2440
|
apiLeafNodeFromNavRoute,
|