pagegraph 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +403 -148
- package/dist/audit.d.ts +2 -2
- package/dist/audit.js +4 -4
- package/dist/build-only/audit.d.ts +1 -0
- package/dist/build-only/audit.js +6 -0
- package/dist/build-only/audit.js.map +1 -0
- package/dist/build-only/claims.d.ts +1 -0
- package/dist/build-only/claims.js +6 -0
- package/dist/build-only/claims.js.map +1 -0
- package/dist/build-only/config.d.ts +1 -0
- package/dist/build-only/config.js +6 -0
- package/dist/build-only/config.js.map +1 -0
- package/dist/build-only/oxlint.d.ts +1 -0
- package/dist/build-only/oxlint.js +6 -0
- package/dist/build-only/oxlint.js.map +1 -0
- package/dist/build-only/tanstack-start.d.ts +1 -0
- package/dist/build-only/tanstack-start.js +6 -0
- package/dist/build-only/tanstack-start.js.map +1 -0
- package/dist/build-only/vite.d.ts +1 -0
- package/dist/build-only/vite.js +6 -0
- package/dist/build-only/vite.js.map +1 -0
- package/dist/{checks-nk8ZRRIA.js → checks-BS-aDXB_.js} +4 -142
- package/dist/checks-BS-aDXB_.js.map +1 -0
- package/dist/claims-Bch7Lxlo.d.ts +92 -0
- package/dist/claims-Bv7voeEV.js +431 -0
- package/dist/claims-Bv7voeEV.js.map +1 -0
- package/dist/claims.d.ts +94 -0
- package/dist/claims.js +2 -0
- package/dist/cli.js +10368 -8485
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +4 -83
- package/dist/config.js +3 -122
- package/dist/config.js.map +1 -1
- package/dist/{content-CB_kHmJ3.js → content-CHd0X4s6.js} +3 -2
- package/dist/{content-CB_kHmJ3.js.map → content-CHd0X4s6.js.map} +1 -1
- package/dist/{content-DVL2iyGU.d.ts → content-DgNr7apS.d.ts} +5 -130
- package/dist/declare-D5o7hwmv.js +9 -0
- package/dist/declare-D5o7hwmv.js.map +1 -0
- package/dist/document-CztEu3Vd.d.ts +109 -0
- package/dist/document-Dvemcv7V.js +379 -0
- package/dist/document-Dvemcv7V.js.map +1 -0
- package/dist/facts-1OKclPOk.js +115 -0
- package/dist/facts-1OKclPOk.js.map +1 -0
- package/dist/graph-D1PIndsC.d.ts +12238 -0
- package/dist/graph-DMNOLXLu.js +172 -0
- package/dist/graph-DMNOLXLu.js.map +1 -0
- package/dist/index-C5w9ripz.d.ts +204 -0
- package/dist/index.d.ts +6 -196
- package/dist/index.js +55 -134
- package/dist/index.js.map +1 -1
- package/dist/inline-BbS93GAT.js +682 -0
- package/dist/inline-BbS93GAT.js.map +1 -0
- package/dist/llms-Dhr_5u2O.js +19 -0
- package/dist/llms-Dhr_5u2O.js.map +1 -0
- package/dist/markdown-C6dRE9zD.js +168 -0
- package/dist/markdown-C6dRE9zD.js.map +1 -0
- package/dist/markdown-path-lJB9BAVZ.js +6 -0
- package/dist/markdown-path-lJB9BAVZ.js.map +1 -0
- package/dist/message-CuBjgZ74.js +12 -0
- package/dist/message-CuBjgZ74.js.map +1 -0
- package/dist/oxlint.d.ts +58 -0
- package/dist/oxlint.js +202 -0
- package/dist/oxlint.js.map +1 -0
- package/dist/page-heads-BfjWQvau.d.ts +108 -0
- package/dist/page-heads-BgbaIjj9.js +25 -0
- package/dist/page-heads-BgbaIjj9.js.map +1 -0
- package/dist/projections-Bk-qOOsR.d.ts +78 -0
- package/dist/projections-D0oOFKiY.js +142 -0
- package/dist/projections-D0oOFKiY.js.map +1 -0
- package/dist/react.d.ts +27 -12051
- package/dist/react.js +14 -4
- package/dist/react.js.map +1 -1
- package/dist/route-config-35ZEzkNC.js +308 -0
- package/dist/route-config-35ZEzkNC.js.map +1 -0
- package/dist/route-config-wneg6ktn.d.ts +29 -0
- package/dist/tanstack-start/index.d.ts +56 -0
- package/dist/tanstack-start/index.js +717 -0
- package/dist/tanstack-start/index.js.map +1 -0
- package/dist/tanstack-start/markdown.d.ts +12 -0
- package/dist/tanstack-start/markdown.js +149 -0
- package/dist/tanstack-start/markdown.js.map +1 -0
- package/dist/tanstack-start/prerender-worker.d.ts +2 -0
- package/dist/tanstack-start/prerender-worker.js +7 -0
- package/dist/tanstack-start/prerender-worker.js.map +1 -0
- package/dist/tanstack-start/react.d.ts +7 -0
- package/dist/tanstack-start/react.js +12 -0
- package/dist/tanstack-start/react.js.map +1 -0
- package/dist/tanstack-start/server.d.ts +20 -0
- package/dist/tanstack-start/server.js +77 -0
- package/dist/tanstack-start/server.js.map +1 -0
- package/dist/vite-graph-loader-CsGiYNWE.js +105 -0
- package/dist/vite-graph-loader-CsGiYNWE.js.map +1 -0
- package/dist/vite-graph-loader-DZCwejuJ.d.ts +133 -0
- package/dist/vite.d.ts +2 -28
- package/dist/vite.js +1 -307
- package/dist/wire-B4RQMc4e.js +26 -0
- package/dist/wire-B4RQMc4e.js.map +1 -0
- package/package.json +70 -7
- package/dist/checks-nk8ZRRIA.js.map +0 -1
- package/dist/vite.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,139 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { t as applyTitleTemplate } from "./declare-D5o7hwmv.js";
|
|
2
|
+
import { t as buildSeoGraph } from "./graph-DMNOLXLu.js";
|
|
3
|
+
import { n as graphToJson, t as graphFromJson } from "./wire-B4RQMc4e.js";
|
|
4
|
+
import { i as lastModified, n as inspectNode, o as renderRobots, r as isSitemapEligible, s as renderSitemap, t as contentSignal } from "./projections-D0oOFKiY.js";
|
|
5
|
+
import { i as checkRenderedCoverage, n as checkFreshness, o as hasStructuralViolations, r as checkGraph, s as freshnessReport, t as checkCoverage } from "./checks-BS-aDXB_.js";
|
|
6
|
+
import { a as RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, c as diffLinkGraph, d as renderedGraphFromEdges, f as hasBlockingIssues, i as renderedCheckTargets, l as extractAnchors, n as checkRenderedContent, o as buildRenderedGraph, p as inspectHtml, r as extractPageContent, s as decodeRenderedEdgeArtifact, t as checkPageContent, u as normalizePath } from "./content-CHd0X4s6.js";
|
|
7
|
+
import { n as selectPageHeadNodes, t as pageHeads } from "./page-heads-BgbaIjj9.js";
|
|
8
|
+
import { o as hashDocument, s as contentHash } from "./inline-BbS93GAT.js";
|
|
9
|
+
import { i as resolveFact, n as defineFacts, r as fact } from "./facts-1OKclPOk.js";
|
|
10
|
+
import { n as documentMarkdown, r as sectionMarkdown, t as defineSectionKind } from "./markdown-C6dRE9zD.js";
|
|
11
|
+
import { n as llmsSection, t as llmsMarkdown } from "./llms-Dhr_5u2O.js";
|
|
12
|
+
//#region src/core/collections.ts
|
|
13
|
+
function contentCollection(options) {
|
|
14
|
+
const entries = options.pages.map((page) => {
|
|
15
|
+
const entry = options.entry(page);
|
|
16
|
+
return {
|
|
17
|
+
...entry,
|
|
18
|
+
path: entry.path ?? page.url
|
|
19
|
+
};
|
|
20
|
+
});
|
|
19
21
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
link: override.link ?? base.link,
|
|
26
|
-
redirectTo: override.redirectTo ?? base.redirectTo,
|
|
27
|
-
modifiedAt: override.modifiedAt ?? base.modifiedAt
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Walk the route tree building structural nodes and crumb-parent edges. `crumbStack`
|
|
32
|
-
* holds the paths of crumb-declaring ancestors so each crumb node links to its nearest
|
|
33
|
-
* crumb ancestor down the real route-parent chain (matching render-time breadcrumbs).
|
|
34
|
-
*/
|
|
35
|
-
function walkRoutes(route, parentPath, isRoot, nodes, edges, crumbStack) {
|
|
36
|
-
const path = isRoot ? "/" : joinPath(parentPath, route.options.path);
|
|
37
|
-
const seo = route.options.staticData?.seo;
|
|
38
|
-
if (seo) {
|
|
39
|
-
const existing = nodes.get(path);
|
|
40
|
-
if (existing) {
|
|
41
|
-
existing.policy = mergeSeo(existing.policy, seo);
|
|
42
|
-
existing.kind = existing.policy.kind;
|
|
43
|
-
} else nodes.set(path, {
|
|
44
|
-
path,
|
|
45
|
-
kind: seo.kind,
|
|
46
|
-
source: "route",
|
|
47
|
-
policy: { ...seo }
|
|
48
|
-
});
|
|
49
|
-
const nearestCrumbAncestor = crumbStack[crumbStack.length - 1];
|
|
50
|
-
if (seo.crumb !== void 0 && nearestCrumbAncestor !== void 0) edges.push({
|
|
51
|
-
from: path,
|
|
52
|
-
to: nearestCrumbAncestor,
|
|
53
|
-
type: "crumb-parent"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const pushedCrumb = seo?.crumb !== void 0;
|
|
57
|
-
if (pushedCrumb) crumbStack.push(path);
|
|
58
|
-
for (const child of route.children ?? []) walkRoutes(child, path, false, nodes, edges, crumbStack);
|
|
59
|
-
if (pushedCrumb) crumbStack.pop();
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Add one collection's instance nodes, inheriting kind + sitemap policy from the
|
|
63
|
-
* collection route's declaration, then append the edges it declares. A path already
|
|
64
|
-
* owned by another node is a collision: the first owner keeps the path and the
|
|
65
|
-
* conflict is reported (the `path-owner-collision` check turns it into a violation).
|
|
66
|
-
*/
|
|
67
|
-
function addCollection(nodes, edges, collisions, collection) {
|
|
68
|
-
const collectionNode = nodes.get(collection.route);
|
|
69
|
-
const kind = collectionNode?.kind ?? FALLBACK_KIND;
|
|
70
|
-
const sitemap = collectionNode?.policy.sitemap;
|
|
71
|
-
/**
|
|
72
|
-
* Paths this collection lost to an earlier owner. Their instances never enter
|
|
73
|
-
* the graph, so any edge declared out of them would dangle — and the dead-edge
|
|
74
|
-
* check only validates an edge's `to`, so nothing downstream would catch it.
|
|
75
|
-
*/
|
|
76
|
-
const rejected = /* @__PURE__ */ new Set();
|
|
77
|
-
for (const instance of collection.instances) {
|
|
78
|
-
const existing = nodes.get(instance.path);
|
|
79
|
-
if (existing) {
|
|
80
|
-
collisions.push({
|
|
81
|
-
path: instance.path,
|
|
82
|
-
sources: [existing.source, collection.source]
|
|
83
|
-
});
|
|
84
|
-
rejected.add(instance.path);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
nodes.set(instance.path, {
|
|
88
|
-
path: instance.path,
|
|
89
|
-
kind,
|
|
90
|
-
source: collection.source,
|
|
91
|
-
policy: {
|
|
92
|
-
kind,
|
|
93
|
-
sitemap
|
|
94
|
-
},
|
|
95
|
-
instance: {
|
|
96
|
-
title: instance.title,
|
|
97
|
-
description: instance.description,
|
|
98
|
-
publishedAt: instance.publishedAt,
|
|
99
|
-
modifiedAt: instance.modifiedAt
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
for (const edge of collection.edges ?? []) {
|
|
104
|
-
if (rejected.has(edge.from)) continue;
|
|
105
|
-
edges.push(edge);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Build the SEO graph from route declarations and content collections.
|
|
110
|
-
*
|
|
111
|
-
* Synchronous: the caller materializes its collections before calling, so there is
|
|
112
|
-
* no async work here. Callers own the origin.
|
|
113
|
-
*/
|
|
114
|
-
function buildSeoGraph(input) {
|
|
115
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
116
|
-
const edges = [];
|
|
117
|
-
const collisions = [];
|
|
118
|
-
walkRoutes(input.routeTree, "/", true, nodes, edges, []);
|
|
119
|
-
for (const collection of input.collections ?? []) addCollection(nodes, edges, collisions, collection);
|
|
120
|
-
for (const node of nodes.values()) {
|
|
121
|
-
if (node.source !== "route") continue;
|
|
122
|
-
for (const to of node.policy.related ?? []) edges.push({
|
|
123
|
-
from: node.path,
|
|
22
|
+
route: options.route,
|
|
23
|
+
source: options.source,
|
|
24
|
+
instances: entries.map(({ related: _related, ...instance }) => instance),
|
|
25
|
+
edges: [...entries.flatMap((entry) => [...new Set(entry.related ?? [])].map((to) => ({
|
|
26
|
+
from: entry.path,
|
|
124
27
|
to,
|
|
125
28
|
type: "related"
|
|
126
|
-
})
|
|
127
|
-
if (node.policy.redirectTo !== void 0) edges.push({
|
|
128
|
-
from: node.path,
|
|
129
|
-
to: node.policy.redirectTo,
|
|
130
|
-
type: "redirect"
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
nodes,
|
|
135
|
-
edges,
|
|
136
|
-
collisions
|
|
29
|
+
}))), ...options.edges ?? []]
|
|
137
30
|
};
|
|
138
31
|
}
|
|
139
32
|
//#endregion
|
|
@@ -282,6 +175,34 @@ function resolveRouteLink(router, path) {
|
|
|
282
175
|
return Object.values(routesById).find((route) => route.fullPath === path)?.options.staticData?.seo?.link;
|
|
283
176
|
}
|
|
284
177
|
//#endregion
|
|
285
|
-
|
|
178
|
+
//#region src/markdown/lock.ts
|
|
179
|
+
const compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
180
|
+
/** Build the v1 lock without changing document hashes, message hashes, or sources. */
|
|
181
|
+
function createMarkdownLock(documents) {
|
|
182
|
+
const pages = Object.create(null);
|
|
183
|
+
for (const document of [...documents].sort((left, right) => compare(left.path, right.path))) {
|
|
184
|
+
if (Object.hasOwn(pages, document.path)) throw new Error(`Duplicate document page path "${document.path}"`);
|
|
185
|
+
if (!/^[0-9a-f]{64}$/.test(document.hash)) throw new Error(`Invalid document document hash "${document.hash}" on "${document.path}"`);
|
|
186
|
+
const messages = Object.create(null);
|
|
187
|
+
for (const message of [...document.messages].sort((left, right) => compare(left.hash, right.hash) || compare(left.source, right.source))) {
|
|
188
|
+
if (!/^[0-9a-f]{16}$/.test(message.hash)) throw new Error(`Invalid document message hash "${message.hash}" on "${document.path}"`);
|
|
189
|
+
if (!Object.hasOwn(messages, message.hash)) messages[message.hash] = message.source;
|
|
190
|
+
}
|
|
191
|
+
pages[document.path] = {
|
|
192
|
+
document: document.hash,
|
|
193
|
+
messages
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
for (const [path, page] of Object.entries(pages)) {
|
|
197
|
+
if (typeof page.document !== "string") throw new Error(`Expected string\n at ["pages"][${JSON.stringify(path)}]["document"]`);
|
|
198
|
+
for (const [hash, source] of Object.entries(page.messages)) if (typeof source !== "string") throw new Error(`Expected string\n at ["pages"][${JSON.stringify(path)}]["messages"][${JSON.stringify(hash)}]`);
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
version: 1,
|
|
202
|
+
pages
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, applyTitleTemplate, buildRenderedGraph, buildSeoGraph, candidateSourceText, checkCoverage, checkFreshness, checkGraph, checkPageContent, checkRenderedContent, checkRenderedCoverage, contentCollection, contentHash, contentSignal, createMarkdownLock, decodeRenderedEdgeArtifact, decodeRenderedEdges, defineFacts, defineSectionKind, diffLinkGraph, documentMarkdown, extractAnchors, extractPageContent, fact, freshnessReport, generateLinkCandidates, graphFromJson, graphToJson, hasBlockingIssues, hasStructuralViolations, hashDocument, inspectHtml, inspectNode, isSitemapEligible, lastModified, llmsMarkdown, llmsSection, matchesClusterFilter, normalizePath, pageHeads, renderRobots, renderSitemap, renderedCheckTargets, renderedGraphFromEdges, resolveFact, resolveRouteLink, sectionMarkdown, selectPageHeadNodes, undirectedEdgeKey };
|
|
286
207
|
|
|
287
208
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/core/graph.ts","../src/core/link-candidates.ts","../src/core/resolve-route-link.ts"],"sourcesContent":["/**\n * SEO graph — the derived model that projections (sitemap, robots), the CLI, and\n * the check engine all read from. Built from route declarations (`staticData.seo`)\n * plus consumer-supplied content collections. This module is pure: no React, no\n * env, no knowledge of where instances come from. Origins and env-derived values\n * are injected by the callers of the projections, never read here.\n *\n * A node is one of:\n * - a structural route (`source: \"route\"`), keyed by its normalized full path,\n * merging a layout route's declaration (crumb) with its index child's (kind,\n * sitemap policy) when both resolve to the same URL;\n * - a content instance (`source` = the collection's label), keyed by the page URL\n * and carrying page-level metadata.\n *\n * Edges: `crumb-parent` (breadcrumb ancestry), `related` (deliberate cross-links),\n * `collection-member` (membership in a curated set), and `redirect` (route aliases).\n * The route walk emits crumb/related/redirect edges from declarations; a collection\n * may declare any additional edges its instances need.\n */\n\nimport type { AnyRoute } from \"@tanstack/react-router\";\n\nimport type { PublicPath, RouteSeo, SeoKind } from \"./declare\";\n\n/**\n * Where a node came from: `\"route\"` for a structural route declaration, or the\n * `source` label of the collection that produced the instance (e.g. \"blog\").\n */\nexport type SeoSource = string;\n\nexport interface SeoNode {\n /** Canonical path, no origin (e.g. \"/pricing\", \"/blog/my-post\"). */\n path: string;\n kind: SeoKind;\n source: SeoSource;\n /** Route-declared policy, or synthesized (kind + inherited sitemap) for instances. */\n policy: RouteSeo;\n instance?:\n | {\n title: string;\n description?: string | undefined;\n publishedAt?: string | undefined;\n modifiedAt?: string | undefined;\n }\n | undefined;\n}\n\nexport type SeoEdgeType = \"crumb-parent\" | \"related\" | \"redirect\" | \"collection-member\";\n\nexport interface SeoEdge {\n from: string;\n to: string;\n type: SeoEdgeType;\n}\n\nexport interface SeoGraph {\n nodes: Map<string, SeoNode>;\n edges: Array<SeoEdge>;\n /** Exact-path ownership conflicts encountered while assembling graph sources. */\n collisions?: ReadonlyArray<{ path: string; sources: ReadonlyArray<SeoSource> }> | undefined;\n}\n\n/** One concrete page produced by a collection. */\nexport interface SeoInstance {\n /** Canonical path of the page (e.g. \"/blog/my-post\"). */\n readonly path: string;\n readonly title: string;\n readonly description?: string | undefined;\n readonly publishedAt?: string | undefined;\n readonly modifiedAt?: string | undefined;\n}\n\nexport interface SeoCollection {\n /**\n * The param route these instances render through (e.g. \"/blog/$slug\"). Instances\n * inherit this route's declared policy (kind + sitemap) — the graph reads it from\n * the structural node, so declarations stay the single source of truth.\n */\n readonly route: PublicPath;\n /** The `source` stamped on every node this collection produces (e.g. \"blog\"). */\n readonly source: SeoSource;\n readonly instances: ReadonlyArray<SeoInstance>;\n /** Edges the collection declares between its instances and the rest of the graph. */\n readonly edges?: ReadonlyArray<SeoEdge> | undefined;\n}\n\nexport interface BuildSeoGraphInput {\n readonly routeTree: AnyRoute;\n readonly collections?: ReadonlyArray<SeoCollection> | undefined;\n}\n\n/** Kind for instances whose collection route carries no declaration to inherit. */\nconst FALLBACK_KIND: SeoKind = \"page\";\n\n/** Structural view of a route we walk — the fields present before router init(). */\ninterface WalkableRoute {\n readonly options: {\n readonly path?: string | undefined;\n readonly staticData?: { readonly seo?: RouteSeo | undefined } | undefined;\n };\n readonly children?: ReadonlyArray<WalkableRoute> | undefined;\n}\n\n/**\n * Join a child's local path onto its parent's computed full path with the same\n * semantics as TanStack's route init (relative segments, index \"/\" inherits the\n * parent, pathless/group routes are transparent), then normalize trailing slashes.\n */\nfunction joinPath(parent: string, seg: string | undefined): string {\n if (seg === undefined) return parent; // pathless layout / route group\n if (seg === \"/\") return parent; // index route resolves to its parent's URL\n const trimmed = seg.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n const joined = `${parent === \"/\" ? \"\" : parent}/${trimmed}`;\n return joined.replace(/\\/{2,}/g, \"/\");\n}\n\n/** Merge a route's declaration into an existing same-path node (deeper route wins). */\nfunction mergeSeo(base: RouteSeo, override: RouteSeo): RouteSeo {\n return {\n kind: override.kind,\n crumb: override.crumb ?? base.crumb,\n sitemap: override.sitemap ?? base.sitemap,\n robots: override.robots ?? base.robots,\n related: override.related ?? base.related,\n link: override.link ?? base.link,\n redirectTo: override.redirectTo ?? base.redirectTo,\n modifiedAt: override.modifiedAt ?? base.modifiedAt,\n };\n}\n\n/**\n * Walk the route tree building structural nodes and crumb-parent edges. `crumbStack`\n * holds the paths of crumb-declaring ancestors so each crumb node links to its nearest\n * crumb ancestor down the real route-parent chain (matching render-time breadcrumbs).\n */\nfunction walkRoutes(\n route: WalkableRoute,\n parentPath: string,\n isRoot: boolean,\n nodes: Map<string, SeoNode>,\n edges: Array<SeoEdge>,\n crumbStack: Array<string>,\n): void {\n const path = isRoot ? \"/\" : joinPath(parentPath, route.options.path);\n const seo = route.options.staticData?.seo;\n\n if (seo) {\n const existing = nodes.get(path);\n if (existing) {\n existing.policy = mergeSeo(existing.policy, seo);\n existing.kind = existing.policy.kind;\n } else {\n nodes.set(path, { path, kind: seo.kind, source: \"route\", policy: { ...seo } });\n }\n\n const nearestCrumbAncestor = crumbStack[crumbStack.length - 1];\n if (seo.crumb !== undefined && nearestCrumbAncestor !== undefined) {\n edges.push({ from: path, to: nearestCrumbAncestor, type: \"crumb-parent\" });\n }\n }\n\n const pushedCrumb = seo?.crumb !== undefined;\n if (pushedCrumb) crumbStack.push(path);\n for (const child of route.children ?? []) {\n walkRoutes(child, path, false, nodes, edges, crumbStack);\n }\n if (pushedCrumb) crumbStack.pop();\n}\n\n/**\n * Add one collection's instance nodes, inheriting kind + sitemap policy from the\n * collection route's declaration, then append the edges it declares. A path already\n * owned by another node is a collision: the first owner keeps the path and the\n * conflict is reported (the `path-owner-collision` check turns it into a violation).\n */\nfunction addCollection(\n nodes: Map<string, SeoNode>,\n edges: Array<SeoEdge>,\n collisions: Array<{ path: string; sources: ReadonlyArray<SeoSource> }>,\n collection: SeoCollection,\n): void {\n const collectionNode = nodes.get(collection.route);\n const kind = collectionNode?.kind ?? FALLBACK_KIND;\n const sitemap = collectionNode?.policy.sitemap;\n\n /**\n * Paths this collection lost to an earlier owner. Their instances never enter\n * the graph, so any edge declared out of them would dangle — and the dead-edge\n * check only validates an edge's `to`, so nothing downstream would catch it.\n */\n const rejected = new Set<string>();\n\n for (const instance of collection.instances) {\n const existing = nodes.get(instance.path);\n if (existing) {\n collisions.push({ path: instance.path, sources: [existing.source, collection.source] });\n rejected.add(instance.path);\n continue;\n }\n nodes.set(instance.path, {\n path: instance.path,\n kind,\n source: collection.source,\n policy: { kind, sitemap },\n instance: {\n title: instance.title,\n description: instance.description,\n publishedAt: instance.publishedAt,\n modifiedAt: instance.modifiedAt,\n },\n });\n }\n\n for (const edge of collection.edges ?? []) {\n if (rejected.has(edge.from)) continue;\n edges.push(edge);\n }\n}\n\n/**\n * Build the SEO graph from route declarations and content collections.\n *\n * Synchronous: the caller materializes its collections before calling, so there is\n * no async work here. Callers own the origin.\n */\nexport function buildSeoGraph(input: BuildSeoGraphInput): SeoGraph {\n const nodes = new Map<string, SeoNode>();\n const edges: Array<SeoEdge> = [];\n const collisions: Array<{ path: string; sources: ReadonlyArray<SeoSource> }> = [];\n\n walkRoutes(input.routeTree as unknown as WalkableRoute, \"/\", true, nodes, edges, []);\n\n for (const collection of input.collections ?? []) {\n addCollection(nodes, edges, collisions, collection);\n }\n\n for (const node of nodes.values()) {\n if (node.source !== \"route\") continue;\n for (const to of node.policy.related ?? []) {\n edges.push({ from: node.path, to, type: \"related\" });\n }\n if (node.policy.redirectTo !== undefined) {\n edges.push({ from: node.path, to: node.policy.redirectTo, type: \"redirect\" });\n }\n }\n\n return { nodes, edges, collisions };\n}\n","/**\n * Pure candidate generation for contextual cross-links.\n *\n * Given the declared graph, enumerate `(source, destination)` pairs that are\n * *plausible* contextual links and *not already connected*. A pair is plausible\n * when the two pages sit in the same cluster: a shared top-level section (e.g.\n * `/blog/a` and `/blog/b` under `/blog`) or, for root-level pages that share no\n * section, the same `kind`. Only sitemap-eligible pages are candidates — a\n * noindex, redirect, or param template is not a link surface.\n *\n * The plan is a proposal, never an application: nothing here writes a\n * declaration. Effect- and framework-free so it runs in the CLI, a Worker, or a\n * test on the same graph.\n */\n\nimport type { SeoGraph, SeoNode } from \"./graph\";\nimport type { AnchorRegion, SimpleEdge } from \"./links\";\nimport { isSitemapEligible } from \"./projections\";\n\n/** One proposed contextual link, in the direction the link would be authored. */\nexport interface LinkCandidatePair {\n readonly source: string;\n readonly destination: string;\n /** The cluster the pair shares: a top-level section, or `kind:<kind>`. */\n readonly cluster: string;\n /** Why the pair is plausible, e.g. `same top-level section \"/blog\"`. */\n readonly reason: string;\n}\n\nexport interface LinkCandidateOptions {\n /** Maximum candidates to return after ordering (default 50). */\n readonly limit?: number;\n /** Restrict to these clusters; a filter may be a section or a bare kind. */\n readonly clusters?: ReadonlyArray<string>;\n /** Anchors already served in HTML. Only body-region edges exclude their own direction. */\n readonly renderedEdges?: ReadonlyArray<SimpleEdge & { readonly region?: AnchorRegion }>;\n}\n\n/** One cluster and how many candidate pairs it contributes (before `limit`). */\nexport interface LinkClusterSummary {\n readonly key: string;\n readonly candidates: number;\n}\n\nexport interface LinkCandidateResult {\n readonly candidates: ReadonlyArray<LinkCandidatePair>;\n /** Candidate pairs before `limit` was applied (after cluster filters). */\n readonly total: number;\n readonly truncated: boolean;\n readonly clusters: ReadonlyArray<LinkClusterSummary>;\n}\n\n/**\n * Canonical path key: query and hash stripped, trailing slashes removed, \"/\"\n * preserved. This is the same path key the graph and the rendered-link core\n * use, so a served anchor like `/blog/a?ref=nav` still matches the graph pair\n * `/blog/a`.\n */\nconst normalize = (path: string): string => {\n const pathname = path.split(/[?#]/, 1)[0] ?? \"\";\n const trimmed = pathname.replace(/\\/+$/, \"\");\n return trimmed === \"\" ? \"/\" : trimmed;\n};\n\n/** Directionless pair key, so an edge in either direction means \"connected\". */\nexport const undirectedEdgeKey = (from: string, to: string): string => {\n const [a, b] = [normalize(from), normalize(to)].sort();\n return `${a}\\u0000${b}`;\n};\n\nconst directedEdgeKey = (from: string, to: string): string => `${normalize(from)}\\u0000${normalize(to)}`;\n\n/** First path segment, or undefined for the root page. */\nconst topSegment = (path: string): string | undefined => {\n const segment = path.split(\"/\").filter(Boolean)[0];\n return segment === undefined || segment === \"\" ? undefined : segment;\n};\n\n/** A page with no nested segment (`/`, `/pricing`, `/blog`) is root-level. */\nconst isRootLevel = (path: string): boolean => path.split(\"/\").filter(Boolean).length <= 1;\n\n/**\n * The cluster a pair shares, or undefined when they share none. Section-first:\n * a shared top-level section wins. The kind fallback is local to root-level\n * pages, so it never pairs two nested pages from different sections.\n */\nexport const candidateClusterOf = (a: SeoNode, b: SeoNode): { key: string; reason: string } | undefined => {\n const aSegment = topSegment(a.path);\n const bSegment = topSegment(b.path);\n if (aSegment !== undefined && aSegment === bSegment) {\n return { key: aSegment, reason: `same top-level section \"/${aSegment}\"` };\n }\n if (isRootLevel(a.path) && isRootLevel(b.path) && a.kind === b.kind) {\n return { key: `kind:${a.kind}`, reason: `same kind \"${a.kind}\"` };\n }\n return undefined;\n};\n\n/** A `--cluster` filter matches a section by name, or a kind via its bare label. */\nexport const matchesClusterFilter = (cluster: string, filter: string): boolean => {\n const normalized = filter.replace(/^\\/+/, \"\").toLowerCase();\n const key = cluster.toLowerCase();\n return key === normalized || key === `kind:${normalized}`;\n};\n\n/** Human reason string for a candidate's source page, used when handing a plan to Jev. */\nexport const candidateSourceText = (node: SeoNode): string =>\n node.instance?.description?.trim() ||\n node.instance?.title?.trim() ||\n node.policy.link?.description?.trim() ||\n node.policy.link?.title?.trim() ||\n node.path;\n\n/**\n * Enumerate reviewable contextual-link candidates from the declared graph.\n *\n * Excluded: self-pairs, pages that are not sitemap-eligible, pairs already\n * declared as a `related` edge, and — when {@link LinkCandidateOptions.renderedEdges}\n * is supplied — pairs already rendered as an anchor. Queries, hashes, and\n * trailing slashes are normalized so both sides compare by the graph's path key.\n */\nexport const generateLinkCandidates = (\n graph: SeoGraph,\n options: LinkCandidateOptions = {},\n): LinkCandidateResult => {\n const limit = options.limit ?? 50;\n const filters = options.clusters ?? [];\n // Legacy bare edges have no region. Treat them as body links so a v1 edge dump\n // remains conservative; region-aware artifacts retain nav/header/footer edges.\n const rendered = new Set(\n (options.renderedEdges ?? []).filter((edge) => edge.region === undefined || edge.region === \"body\")\n .map((edge) => directedEdgeKey(edge.from, edge.to)),\n );\n const declared = new Set(\n graph.edges\n .filter((edge) => edge.type === \"related\")\n .map((edge) => directedEdgeKey(edge.from, edge.to)),\n );\n\n const eligible = [...graph.nodes.values()].filter(isSitemapEligible);\n\n const all: Array<LinkCandidatePair> = [];\n for (let i = 0; i < eligible.length; i++) {\n for (let j = i + 1; j < eligible.length; j++) {\n const a = eligible[i]!;\n const b = eligible[j]!;\n const cluster = candidateClusterOf(a, b);\n if (cluster === undefined) continue;\n if (filters.length > 0 && !filters.some((filter) => matchesClusterFilter(cluster.key, filter))) {\n continue;\n }\n for (const [source, destination] of [[a.path, b.path], [b.path, a.path]]) {\n const key = directedEdgeKey(source!, destination!);\n if (declared.has(key) || rendered.has(key)) continue;\n all.push({ source: source!, destination: destination!, cluster: cluster.key, reason: cluster.reason });\n }\n }\n }\n\n const compare = (x: LinkCandidatePair, y: LinkCandidatePair): number =>\n x.cluster < y.cluster\n ? -1\n : x.cluster > y.cluster\n ? 1\n : x.source < y.source\n ? -1\n : x.source > y.source\n ? 1\n : x.destination < y.destination\n ? -1\n : x.destination > y.destination\n ? 1\n : 0;\n all.sort(compare);\n\n const counts = new Map<string, number>();\n for (const pair of all) counts.set(pair.cluster, (counts.get(pair.cluster) ?? 0) + 1);\n\n const candidates = all.slice(0, limit);\n return {\n candidates,\n total: all.length,\n truncated: all.length > candidates.length,\n clusters: [...counts.entries()].map(([key, count]) => ({ key, candidates: count })),\n };\n};\n\n/**\n * Decode a rendered-edge dump supplied to the CLI: either a bare array of\n * `{ from, to }` edges, or an object carrying `edges` (or `internalEdges`).\n * Throws on any other shape — this is user input, not a provider payload.\n */\nexport const decodeRenderedEdges = (input: unknown): ReadonlyArray<SimpleEdge & { readonly region?: AnchorRegion }> => {\n const array =\n Array.isArray(input)\n ? input\n : input !== null && typeof input === \"object\" && Array.isArray((input as { edges?: unknown }).edges)\n ? (input as { edges: ReadonlyArray<unknown> }).edges\n : input !== null &&\n typeof input === \"object\" &&\n Array.isArray((input as { internalEdges?: unknown }).internalEdges)\n ? (input as { internalEdges: ReadonlyArray<unknown> }).internalEdges\n : undefined;\n\n if (array === undefined) {\n throw new Error(\n \"expected an array of { from, to } edges, or an object with an `edges` array\",\n );\n }\n\n return array.map((item) => {\n if (item === null || typeof item !== \"object\") {\n throw new Error(\"each rendered edge must be an object with string `from` and `to`\");\n }\n const { from, to, region } = item as { from?: unknown; to?: unknown; region?: unknown };\n if (typeof from !== \"string\" || typeof to !== \"string\") {\n throw new Error(\"each rendered edge must have string `from` and `to`\");\n }\n if (region !== undefined && ![\"nav\", \"header\", \"footer\", \"body\"].includes(region as string)) {\n throw new Error(\"rendered edge region must be nav, header, footer, or body\");\n }\n return region === undefined ? { from, to } : { from, to, region: region as AnchorRegion };\n });\n};\n","import type { AnyRoute, AnyRouter } from \"@tanstack/react-router\";\n\nimport type { RouteSeo } from \"./declare\";\n\ninterface RouteMaps {\n routesByPath: Record<string, AnyRoute | undefined>;\n routesById: Record<string, AnyRoute>;\n}\n\n/**\n * Resolve a route's declared `seo.link` card (title + description) by its full\n * path.\n *\n * `useRouter()` returns a Router typed to this app's exact route tree, so\n * `routesByPath` is keyed by the literal `FileRouteTypes[\"fullPaths\"]` union —\n * but callers here (declared `related` targets) hold arbitrary runtime path\n * strings, not that literal type. `routesByPath` and `routesById` are plain\n * Records on every Router instance regardless of which route tree it's\n * parameterized over, so this narrows to that structural shape once, at this\n * boundary, instead of threading an `AnyRoute` cast through every call site.\n */\nexport function resolveRouteLink(router: AnyRouter, path: string): RouteSeo[\"link\"] {\n const { routesByPath, routesById } = router as unknown as RouteMaps;\n\n const direct = routesByPath[path];\n if (direct) return direct.options.staticData?.seo?.link;\n\n const byFullPath = Object.values(routesById).find((route) => route.fullPath === path);\n return byFullPath?.options.staticData?.seo?.link;\n}\n"],"mappings":";;;;AA4FA,MAAM,gBAAyB;;;;;;AAgB/B,SAAS,SAAS,QAAgB,KAAiC;CACjE,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,IAAI,QAAQ,KAAK,OAAO;CACxB,MAAM,UAAU,IAAI,QAAQ,QAAQ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,OAAO,SAAS,YAAY,OAAO,OAAO,UAC5C,MAAM,IAAI,MAAM,qDAAqD;EAEvE,IAAI,WAAW,KAAA,KAAa,CAAC;GAAC;GAAO;GAAU;GAAU;EAAM,CAAC,CAAC,SAAS,MAAgB,GACxF,MAAM,IAAI,MAAM,2DAA2D;EAE7E,OAAO,WAAW,KAAA,IAAY;GAAE;GAAM;EAAG,IAAI;GAAE;GAAM;GAAY;EAAuB;CAC1F,CAAC;AACH;;;;;;;;;;;;;;;AC1MA,SAAgB,iBAAiB,QAAmB,MAAgC;CAClF,MAAM,EAAE,cAAc,eAAe;CAErC,MAAM,SAAS,aAAa;CAC5B,IAAI,QAAQ,OAAO,OAAO,QAAQ,YAAY,KAAK;CAGnD,OADmB,OAAO,OAAO,UAAU,CAAC,CAAC,MAAM,UAAU,MAAM,aAAa,IAChE,CAAC,EAAE,QAAQ,YAAY,KAAK;AAC9C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/core/collections.ts","../src/core/link-candidates.ts","../src/core/resolve-route-link.ts","../src/markdown/lock.ts"],"sourcesContent":["/**\n * Content collections — pages a param route renders from content (MDX, a CMS,\n * a manifest) — in the shape the graph reads. Works with any source whose\n * pages carry a URL, which covers Fumadocs `loader().getPages()` directly.\n */\n\nimport type { PublicPath } from \"./declare\";\nimport type { SeoCollection, SeoEdge, SeoInstance, SeoSource } from \"./graph\";\n\n/** What a page contributes: its instance metadata plus the paths it links to deliberately. */\nexport interface ContentEntry extends Omit<SeoInstance, \"path\"> {\n /** Defaults to the page's `url`. */\n readonly path?: string | undefined;\n /** Deliberate cross-links, emitted as `related` edges from this page. */\n readonly related?: ReadonlyArray<string> | undefined;\n}\n\nexport interface ContentCollectionOptions<Page> {\n /** The param route these pages render through, e.g. `/blog/$slug`. */\n readonly route: PublicPath;\n /** The `source` label stamped on every node, e.g. `\"blog\"`. */\n readonly source: SeoSource;\n readonly pages: ReadonlyArray<Page>;\n /** Map one page to its entry; decode frontmatter here. */\n readonly entry: (page: Page) => ContentEntry;\n /** Edges beyond `related` (crumb parents, collection membership). */\n readonly edges?: ReadonlyArray<SeoEdge> | undefined;\n}\n\nexport function contentCollection<Page extends { readonly url: string }>(\n options: ContentCollectionOptions<Page>,\n): SeoCollection {\n const entries = options.pages.map((page) => {\n const entry = options.entry(page);\n return { ...entry, path: entry.path ?? page.url };\n });\n return {\n route: options.route,\n source: options.source,\n instances: entries.map(({ related: _related, ...instance }) => instance),\n edges: [\n ...entries.flatMap((entry) =>\n [...new Set(entry.related ?? [])].map((to): SeoEdge => ({ from: entry.path, to, type: \"related\" })),\n ),\n ...(options.edges ?? []),\n ],\n };\n}\n","/**\n * Pure candidate generation for contextual cross-links.\n *\n * Given the declared graph, enumerate `(source, destination)` pairs that are\n * *plausible* contextual links and *not already connected*. A pair is plausible\n * when the two pages sit in the same cluster: a shared top-level section (e.g.\n * `/blog/a` and `/blog/b` under `/blog`) or, for root-level pages that share no\n * section, the same `kind`. Only sitemap-eligible pages are candidates — a\n * noindex, redirect, or param template is not a link surface.\n *\n * The plan is a proposal, never an application: nothing here writes a\n * declaration. Effect- and framework-free so it runs in the CLI, a Worker, or a\n * test on the same graph.\n */\n\nimport type { SeoGraph, SeoNode } from \"./graph\";\nimport type { AnchorRegion, SimpleEdge } from \"./links\";\nimport { isSitemapEligible } from \"./projections\";\n\n/** One proposed contextual link, in the direction the link would be authored. */\nexport interface LinkCandidatePair {\n readonly source: string;\n readonly destination: string;\n /** The cluster the pair shares: a top-level section, or `kind:<kind>`. */\n readonly cluster: string;\n /** Why the pair is plausible, e.g. `same top-level section \"/blog\"`. */\n readonly reason: string;\n}\n\nexport interface LinkCandidateOptions {\n /** Maximum candidates to return after ordering (default 50). */\n readonly limit?: number;\n /** Restrict to these clusters; a filter may be a section or a bare kind. */\n readonly clusters?: ReadonlyArray<string>;\n /** Anchors already served in HTML. Only body-region edges exclude their own direction. */\n readonly renderedEdges?: ReadonlyArray<SimpleEdge & { readonly region?: AnchorRegion }>;\n}\n\n/** One cluster and how many candidate pairs it contributes (before `limit`). */\nexport interface LinkClusterSummary {\n readonly key: string;\n readonly candidates: number;\n}\n\nexport interface LinkCandidateResult {\n readonly candidates: ReadonlyArray<LinkCandidatePair>;\n /** Candidate pairs before `limit` was applied (after cluster filters). */\n readonly total: number;\n readonly truncated: boolean;\n readonly clusters: ReadonlyArray<LinkClusterSummary>;\n}\n\n/**\n * Canonical path key: query and hash stripped, trailing slashes removed, \"/\"\n * preserved. This is the same path key the graph and the rendered-link core\n * use, so a served anchor like `/blog/a?ref=nav` still matches the graph pair\n * `/blog/a`.\n */\nconst normalize = (path: string): string => {\n const pathname = path.split(/[?#]/, 1)[0] ?? \"\";\n const trimmed = pathname.replace(/\\/+$/, \"\");\n return trimmed === \"\" ? \"/\" : trimmed;\n};\n\n/** Directionless pair key, so an edge in either direction means \"connected\". */\nexport const undirectedEdgeKey = (from: string, to: string): string => {\n const [a, b] = [normalize(from), normalize(to)].sort();\n return `${a}\\u0000${b}`;\n};\n\nconst directedEdgeKey = (from: string, to: string): string => `${normalize(from)}\\u0000${normalize(to)}`;\n\n/** First path segment, or undefined for the root page. */\nconst topSegment = (path: string): string | undefined => {\n const segment = path.split(\"/\").filter(Boolean)[0];\n return segment === undefined || segment === \"\" ? undefined : segment;\n};\n\n/** A page with no nested segment (`/`, `/pricing`, `/blog`) is root-level. */\nconst isRootLevel = (path: string): boolean => path.split(\"/\").filter(Boolean).length <= 1;\n\n/**\n * The cluster a pair shares, or undefined when they share none. Section-first:\n * a shared top-level section wins. The kind fallback is local to root-level\n * pages, so it never pairs two nested pages from different sections.\n */\nexport const candidateClusterOf = (a: SeoNode, b: SeoNode): { key: string; reason: string } | undefined => {\n const aSegment = topSegment(a.path);\n const bSegment = topSegment(b.path);\n if (aSegment !== undefined && aSegment === bSegment) {\n return { key: aSegment, reason: `same top-level section \"/${aSegment}\"` };\n }\n if (isRootLevel(a.path) && isRootLevel(b.path) && a.kind === b.kind) {\n return { key: `kind:${a.kind}`, reason: `same kind \"${a.kind}\"` };\n }\n return undefined;\n};\n\n/** A `--cluster` filter matches a section by name, or a kind via its bare label. */\nexport const matchesClusterFilter = (cluster: string, filter: string): boolean => {\n const normalized = filter.replace(/^\\/+/, \"\").toLowerCase();\n const key = cluster.toLowerCase();\n return key === normalized || key === `kind:${normalized}`;\n};\n\n/** Human reason string for a candidate's source page, used when handing a plan to Jev. */\nexport const candidateSourceText = (node: SeoNode): string =>\n node.instance?.description?.trim() ||\n node.instance?.title?.trim() ||\n node.policy.link?.description?.trim() ||\n node.policy.link?.title?.trim() ||\n node.path;\n\n/**\n * Enumerate reviewable contextual-link candidates from the declared graph.\n *\n * Excluded: self-pairs, pages that are not sitemap-eligible, pairs already\n * declared as a `related` edge, and — when {@link LinkCandidateOptions.renderedEdges}\n * is supplied — pairs already rendered as an anchor. Queries, hashes, and\n * trailing slashes are normalized so both sides compare by the graph's path key.\n */\nexport const generateLinkCandidates = (\n graph: SeoGraph,\n options: LinkCandidateOptions = {},\n): LinkCandidateResult => {\n const limit = options.limit ?? 50;\n const filters = options.clusters ?? [];\n // Legacy bare edges have no region. Treat them as body links so a v1 edge dump\n // remains conservative; region-aware artifacts retain nav/header/footer edges.\n const rendered = new Set(\n (options.renderedEdges ?? []).filter((edge) => edge.region === undefined || edge.region === \"body\")\n .map((edge) => directedEdgeKey(edge.from, edge.to)),\n );\n const declared = new Set(\n graph.edges\n .filter((edge) => edge.type === \"related\")\n .map((edge) => directedEdgeKey(edge.from, edge.to)),\n );\n\n const eligible = [...graph.nodes.values()].filter(isSitemapEligible);\n\n const all: Array<LinkCandidatePair> = [];\n for (let i = 0; i < eligible.length; i++) {\n for (let j = i + 1; j < eligible.length; j++) {\n const a = eligible[i]!;\n const b = eligible[j]!;\n const cluster = candidateClusterOf(a, b);\n if (cluster === undefined) continue;\n if (filters.length > 0 && !filters.some((filter) => matchesClusterFilter(cluster.key, filter))) {\n continue;\n }\n for (const [source, destination] of [[a.path, b.path], [b.path, a.path]]) {\n const key = directedEdgeKey(source!, destination!);\n if (declared.has(key) || rendered.has(key)) continue;\n all.push({ source: source!, destination: destination!, cluster: cluster.key, reason: cluster.reason });\n }\n }\n }\n\n const compare = (x: LinkCandidatePair, y: LinkCandidatePair): number =>\n x.cluster < y.cluster\n ? -1\n : x.cluster > y.cluster\n ? 1\n : x.source < y.source\n ? -1\n : x.source > y.source\n ? 1\n : x.destination < y.destination\n ? -1\n : x.destination > y.destination\n ? 1\n : 0;\n all.sort(compare);\n\n const counts = new Map<string, number>();\n for (const pair of all) counts.set(pair.cluster, (counts.get(pair.cluster) ?? 0) + 1);\n\n const candidates = all.slice(0, limit);\n return {\n candidates,\n total: all.length,\n truncated: all.length > candidates.length,\n clusters: [...counts.entries()].map(([key, count]) => ({ key, candidates: count })),\n };\n};\n\n/**\n * Decode a rendered-edge dump supplied to the CLI: either a bare array of\n * `{ from, to }` edges, or an object carrying `edges` (or `internalEdges`).\n * Throws on any other shape — this is user input, not a provider payload.\n */\nexport const decodeRenderedEdges = (input: unknown): ReadonlyArray<SimpleEdge & { readonly region?: AnchorRegion }> => {\n const array =\n Array.isArray(input)\n ? input\n : input !== null && typeof input === \"object\" && Array.isArray((input as { edges?: unknown }).edges)\n ? (input as { edges: ReadonlyArray<unknown> }).edges\n : input !== null &&\n typeof input === \"object\" &&\n Array.isArray((input as { internalEdges?: unknown }).internalEdges)\n ? (input as { internalEdges: ReadonlyArray<unknown> }).internalEdges\n : undefined;\n\n if (array === undefined) {\n throw new Error(\n \"expected an array of { from, to } edges, or an object with an `edges` array\",\n );\n }\n\n return array.map((item) => {\n if (item === null || typeof item !== \"object\") {\n throw new Error(\"each rendered edge must be an object with string `from` and `to`\");\n }\n const { from, to, region } = item as { from?: unknown; to?: unknown; region?: unknown };\n if (typeof from !== \"string\" || typeof to !== \"string\") {\n throw new Error(\"each rendered edge must have string `from` and `to`\");\n }\n if (region !== undefined && ![\"nav\", \"header\", \"footer\", \"body\"].includes(region as string)) {\n throw new Error(\"rendered edge region must be nav, header, footer, or body\");\n }\n return region === undefined ? { from, to } : { from, to, region: region as AnchorRegion };\n });\n};\n","import type { AnyRoute, AnyRouter } from \"@tanstack/react-router\";\n\nimport type { RouteSeo } from \"./declare\";\n\ninterface RouteMaps {\n routesByPath: Record<string, AnyRoute | undefined>;\n routesById: Record<string, AnyRoute>;\n}\n\n/**\n * Resolve a route's declared `seo.link` card (title + description) by its full\n * path.\n *\n * `useRouter()` returns a Router typed to this app's exact route tree, so\n * `routesByPath` is keyed by the literal `FileRouteTypes[\"fullPaths\"]` union —\n * but callers here (declared `related` targets) hold arbitrary runtime path\n * strings, not that literal type. `routesByPath` and `routesById` are plain\n * Records on every Router instance regardless of which route tree it's\n * parameterized over, so this narrows to that structural shape once, at this\n * boundary, instead of threading an `AnyRoute` cast through every call site.\n */\nexport function resolveRouteLink(router: AnyRouter, path: string): RouteSeo[\"link\"] {\n const { routesByPath, routesById } = router as unknown as RouteMaps;\n\n const direct = routesByPath[path];\n if (direct) return direct.options.staticData?.seo?.link;\n\n const byFullPath = Object.values(routesById).find((route) => route.fullPath === path);\n return byFullPath?.options.staticData?.seo?.link;\n}\n","import type { PageDocument } from \"./document\";\n\n/** Stable, reviewable snapshot of document and message hashes with source locations. */\nexport interface MarkdownLock {\n readonly version: 1;\n readonly pages: Readonly<Record<string, {\n readonly document: string;\n readonly messages: Readonly<Record<string, string>>;\n }>>;\n}\n\nconst compare = (left: string, right: string): number => (left < right ? -1 : left > right ? 1 : 0);\n\n/** Build the v1 lock without changing document hashes, message hashes, or sources. */\nexport function createMarkdownLock(documents: ReadonlyArray<PageDocument>): MarkdownLock {\n const pages: Record<string, { document: string; messages: Record<string, string> }> =\n Object.create(null);\n\n for (const document of [...documents].sort((left, right) => compare(left.path, right.path))) {\n if (Object.hasOwn(pages, document.path))\n throw new Error(`Duplicate document page path \"${document.path}\"`);\n if (!/^[0-9a-f]{64}$/.test(document.hash))\n throw new Error(`Invalid document document hash \"${document.hash}\" on \"${document.path}\"`);\n\n const messages: Record<string, string> = Object.create(null);\n for (const message of [...document.messages].sort(\n (left, right) => compare(left.hash, right.hash) || compare(left.source, right.source),\n )) {\n if (!/^[0-9a-f]{16}$/.test(message.hash))\n throw new Error(`Invalid document message hash \"${message.hash}\" on \"${document.path}\"`);\n if (!Object.hasOwn(messages, message.hash)) messages[message.hash] = message.source;\n }\n pages[document.path] = { document: document.hash, messages };\n }\n\n // Typed callers supply strings, but the lock remains a validating runtime boundary.\n for (const [path, page] of Object.entries(pages)) {\n if (typeof page.document !== \"string\")\n throw new Error(`Expected string\\n at [\"pages\"][${JSON.stringify(path)}][\"document\"]`);\n for (const [hash, source] of Object.entries(page.messages)) {\n if (typeof source !== \"string\")\n throw new Error(`Expected string\\n at [\"pages\"][${JSON.stringify(path)}][\"messages\"][${JSON.stringify(hash)}]`);\n }\n }\n return { version: 1, pages };\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,kBACd,SACe;CACf,MAAM,UAAU,QAAQ,MAAM,KAAK,SAAS;EAC1C,MAAM,QAAQ,QAAQ,MAAM,IAAI;EAChC,OAAO;GAAE,GAAG;GAAO,MAAM,MAAM,QAAQ,KAAK;EAAI;CAClD,CAAC;CACD,OAAO;EACL,OAAO,QAAQ;EACf,QAAQ,QAAQ;EAChB,WAAW,QAAQ,KAAK,EAAE,SAAS,UAAU,GAAG,eAAe,QAAQ;EACvE,OAAO,CACL,GAAG,QAAQ,SAAS,UAClB,CAAC,GAAG,IAAI,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAiB;GAAE,MAAM,MAAM;GAAM;GAAI,MAAM;EAAU,EAAE,CACpG,GACA,GAAI,QAAQ,SAAS,CAAC,CACxB;CACF;AACF;;;;;;;;;ACWA,MAAM,aAAa,SAAyB;CAE1C,MAAM,WADW,KAAK,MAAM,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAA,CACpB,QAAQ,QAAQ,EAAE;CAC3C,OAAO,YAAY,KAAK,MAAM;AACh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