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.
Files changed (100) hide show
  1. package/README.md +403 -148
  2. package/dist/audit.d.ts +2 -2
  3. package/dist/audit.js +4 -4
  4. package/dist/build-only/audit.d.ts +1 -0
  5. package/dist/build-only/audit.js +6 -0
  6. package/dist/build-only/audit.js.map +1 -0
  7. package/dist/build-only/claims.d.ts +1 -0
  8. package/dist/build-only/claims.js +6 -0
  9. package/dist/build-only/claims.js.map +1 -0
  10. package/dist/build-only/config.d.ts +1 -0
  11. package/dist/build-only/config.js +6 -0
  12. package/dist/build-only/config.js.map +1 -0
  13. package/dist/build-only/oxlint.d.ts +1 -0
  14. package/dist/build-only/oxlint.js +6 -0
  15. package/dist/build-only/oxlint.js.map +1 -0
  16. package/dist/build-only/tanstack-start.d.ts +1 -0
  17. package/dist/build-only/tanstack-start.js +6 -0
  18. package/dist/build-only/tanstack-start.js.map +1 -0
  19. package/dist/build-only/vite.d.ts +1 -0
  20. package/dist/build-only/vite.js +6 -0
  21. package/dist/build-only/vite.js.map +1 -0
  22. package/dist/{checks-nk8ZRRIA.js → checks-BS-aDXB_.js} +4 -142
  23. package/dist/checks-BS-aDXB_.js.map +1 -0
  24. package/dist/claims-Bch7Lxlo.d.ts +92 -0
  25. package/dist/claims-Bv7voeEV.js +431 -0
  26. package/dist/claims-Bv7voeEV.js.map +1 -0
  27. package/dist/claims.d.ts +94 -0
  28. package/dist/claims.js +2 -0
  29. package/dist/cli.js +10368 -8485
  30. package/dist/cli.js.map +1 -1
  31. package/dist/config.d.ts +4 -83
  32. package/dist/config.js +3 -122
  33. package/dist/config.js.map +1 -1
  34. package/dist/{content-CB_kHmJ3.js → content-CHd0X4s6.js} +3 -2
  35. package/dist/{content-CB_kHmJ3.js.map → content-CHd0X4s6.js.map} +1 -1
  36. package/dist/{content-DVL2iyGU.d.ts → content-DgNr7apS.d.ts} +5 -130
  37. package/dist/declare-D5o7hwmv.js +9 -0
  38. package/dist/declare-D5o7hwmv.js.map +1 -0
  39. package/dist/document-CztEu3Vd.d.ts +109 -0
  40. package/dist/document-Dvemcv7V.js +379 -0
  41. package/dist/document-Dvemcv7V.js.map +1 -0
  42. package/dist/facts-1OKclPOk.js +115 -0
  43. package/dist/facts-1OKclPOk.js.map +1 -0
  44. package/dist/graph-D1PIndsC.d.ts +12238 -0
  45. package/dist/graph-DMNOLXLu.js +172 -0
  46. package/dist/graph-DMNOLXLu.js.map +1 -0
  47. package/dist/index-C5w9ripz.d.ts +204 -0
  48. package/dist/index.d.ts +6 -196
  49. package/dist/index.js +55 -134
  50. package/dist/index.js.map +1 -1
  51. package/dist/inline-BbS93GAT.js +682 -0
  52. package/dist/inline-BbS93GAT.js.map +1 -0
  53. package/dist/llms-Dhr_5u2O.js +19 -0
  54. package/dist/llms-Dhr_5u2O.js.map +1 -0
  55. package/dist/markdown-C6dRE9zD.js +168 -0
  56. package/dist/markdown-C6dRE9zD.js.map +1 -0
  57. package/dist/markdown-path-lJB9BAVZ.js +6 -0
  58. package/dist/markdown-path-lJB9BAVZ.js.map +1 -0
  59. package/dist/message-CuBjgZ74.js +12 -0
  60. package/dist/message-CuBjgZ74.js.map +1 -0
  61. package/dist/oxlint.d.ts +58 -0
  62. package/dist/oxlint.js +202 -0
  63. package/dist/oxlint.js.map +1 -0
  64. package/dist/page-heads-BfjWQvau.d.ts +108 -0
  65. package/dist/page-heads-BgbaIjj9.js +25 -0
  66. package/dist/page-heads-BgbaIjj9.js.map +1 -0
  67. package/dist/projections-Bk-qOOsR.d.ts +78 -0
  68. package/dist/projections-D0oOFKiY.js +142 -0
  69. package/dist/projections-D0oOFKiY.js.map +1 -0
  70. package/dist/react.d.ts +27 -12051
  71. package/dist/react.js +14 -4
  72. package/dist/react.js.map +1 -1
  73. package/dist/route-config-35ZEzkNC.js +308 -0
  74. package/dist/route-config-35ZEzkNC.js.map +1 -0
  75. package/dist/route-config-wneg6ktn.d.ts +29 -0
  76. package/dist/tanstack-start/index.d.ts +56 -0
  77. package/dist/tanstack-start/index.js +717 -0
  78. package/dist/tanstack-start/index.js.map +1 -0
  79. package/dist/tanstack-start/markdown.d.ts +12 -0
  80. package/dist/tanstack-start/markdown.js +149 -0
  81. package/dist/tanstack-start/markdown.js.map +1 -0
  82. package/dist/tanstack-start/prerender-worker.d.ts +2 -0
  83. package/dist/tanstack-start/prerender-worker.js +7 -0
  84. package/dist/tanstack-start/prerender-worker.js.map +1 -0
  85. package/dist/tanstack-start/react.d.ts +7 -0
  86. package/dist/tanstack-start/react.js +12 -0
  87. package/dist/tanstack-start/react.js.map +1 -0
  88. package/dist/tanstack-start/server.d.ts +20 -0
  89. package/dist/tanstack-start/server.js +77 -0
  90. package/dist/tanstack-start/server.js.map +1 -0
  91. package/dist/vite-graph-loader-CsGiYNWE.js +105 -0
  92. package/dist/vite-graph-loader-CsGiYNWE.js.map +1 -0
  93. package/dist/vite-graph-loader-DZCwejuJ.d.ts +133 -0
  94. package/dist/vite.d.ts +2 -28
  95. package/dist/vite.js +1 -307
  96. package/dist/wire-B4RQMc4e.js +26 -0
  97. package/dist/wire-B4RQMc4e.js.map +1 -0
  98. package/package.json +70 -7
  99. package/dist/checks-nk8ZRRIA.js.map +0 -1
  100. package/dist/vite.js.map +0 -1
@@ -0,0 +1,172 @@
1
+ import { t as applyTitleTemplate } from "./declare-D5o7hwmv.js";
2
+ //#region src/core/graph.ts
3
+ /** Kind for instances whose collection route carries no declaration to inherit. */
4
+ const FALLBACK_KIND = "page";
5
+ /**
6
+ * Join a child's local path onto its parent's computed full path with the same
7
+ * semantics as TanStack's route init (relative segments, index "/" inherits the
8
+ * parent, pathless/group routes are transparent), then normalize trailing slashes.
9
+ */
10
+ function joinPath(parent, seg) {
11
+ if (seg === void 0) return parent;
12
+ if (seg === "/") return parent;
13
+ const trimmed = seg.replace(/^\/+/, "").replace(/\/+$/, "");
14
+ return `${parent === "/" ? "" : parent}/${trimmed}`.replace(/\/{2,}/g, "/");
15
+ }
16
+ /** A route's declared head as graph data: templated title, description, and plain FAQs. */
17
+ function declaredHead(seo) {
18
+ if (seo.head === void 0) return void 0;
19
+ return {
20
+ title: applyTitleTemplate(seo.titleTemplate, seo.head.title),
21
+ description: seo.head.description,
22
+ faqs: seo.head.faqs?.map(({ question, answer }) => ({
23
+ question,
24
+ answer
25
+ }))
26
+ };
27
+ }
28
+ /** Merge a route's declaration into an existing same-path node (deeper route wins). */
29
+ function mergeSeo(base, override) {
30
+ return {
31
+ kind: override.kind,
32
+ crumb: override.crumb ?? base.crumb,
33
+ sitemap: override.sitemap ?? base.sitemap,
34
+ robots: override.robots ?? base.robots,
35
+ related: override.related ?? base.related,
36
+ link: override.link ?? base.link,
37
+ redirectTo: override.redirectTo ?? base.redirectTo,
38
+ modifiedAt: override.modifiedAt ?? base.modifiedAt,
39
+ head: override.head ?? base.head,
40
+ titleTemplate: override.titleTemplate ?? base.titleTemplate
41
+ };
42
+ }
43
+ /**
44
+ * Walk the route tree building structural nodes and crumb-parent edges. `crumbStack`
45
+ * holds the paths of crumb-declaring ancestors so each crumb node links to its nearest
46
+ * crumb ancestor down the real route-parent chain (matching render-time breadcrumbs).
47
+ */
48
+ function walkRoutes(route, parentPath, isRoot, nodes, edges, crumbStack) {
49
+ const path = isRoot ? "/" : joinPath(parentPath, route.options.path);
50
+ const data = route.options.staticData;
51
+ const seo = data?.seo;
52
+ if (seo || data?.markdown !== void 0 || data?.llms !== void 0) {
53
+ const existing = nodes.get(path);
54
+ if (existing) {
55
+ if (seo) existing.policy = mergeSeo(existing.policy, seo);
56
+ existing.kind = existing.policy.kind;
57
+ existing.head = (seo && declaredHead(seo)) ?? existing.head;
58
+ existing.markdown = data?.markdown ?? existing.markdown;
59
+ existing.llms = data?.llms ?? existing.llms;
60
+ } else {
61
+ const policy = seo ?? { kind: FALLBACK_KIND };
62
+ nodes.set(path, {
63
+ path,
64
+ kind: policy.kind,
65
+ source: "route",
66
+ policy: { ...policy },
67
+ head: seo && declaredHead(seo),
68
+ markdown: data?.markdown,
69
+ llms: data?.llms
70
+ });
71
+ }
72
+ const nearestCrumbAncestor = crumbStack[crumbStack.length - 1];
73
+ if (seo?.crumb !== void 0 && nearestCrumbAncestor !== void 0) edges.push({
74
+ from: path,
75
+ to: nearestCrumbAncestor,
76
+ type: "crumb-parent"
77
+ });
78
+ }
79
+ const pushedCrumb = seo?.crumb !== void 0;
80
+ if (pushedCrumb) crumbStack.push(path);
81
+ for (const child of route.children ?? []) walkRoutes(child, path, false, nodes, edges, crumbStack);
82
+ if (pushedCrumb) crumbStack.pop();
83
+ }
84
+ /**
85
+ * Add one collection's instance nodes, inheriting kind + sitemap policy from the
86
+ * collection route's declaration, then append the edges it declares. A path already
87
+ * owned by another node is a collision: the first owner keeps the path and the
88
+ * conflict is reported (the `path-owner-collision` check turns it into a violation).
89
+ */
90
+ function addCollection(nodes, edges, collisions, collection) {
91
+ const collectionNode = nodes.get(collection.route);
92
+ const kind = collectionNode?.kind ?? FALLBACK_KIND;
93
+ const sitemap = collectionNode?.policy.sitemap;
94
+ const titleTemplate = collectionNode?.policy.titleTemplate;
95
+ /**
96
+ * Paths this collection lost to an earlier owner. Their instances never enter
97
+ * the graph, so any edge declared out of them would dangle — and the dead-edge
98
+ * check only validates an edge's `to`, so nothing downstream would catch it.
99
+ */
100
+ const rejected = /* @__PURE__ */ new Set();
101
+ for (const instance of collection.instances) {
102
+ const existing = nodes.get(instance.path);
103
+ if (existing) {
104
+ collisions.push({
105
+ path: instance.path,
106
+ sources: [existing.source, collection.source]
107
+ });
108
+ rejected.add(instance.path);
109
+ continue;
110
+ }
111
+ nodes.set(instance.path, {
112
+ path: instance.path,
113
+ kind,
114
+ source: collection.source,
115
+ markdown: collectionNode?.markdown,
116
+ llms: collectionNode?.llms,
117
+ policy: {
118
+ kind,
119
+ sitemap
120
+ },
121
+ head: {
122
+ title: applyTitleTemplate(titleTemplate, instance.title),
123
+ description: instance.description
124
+ },
125
+ instance: {
126
+ title: instance.title,
127
+ description: instance.description,
128
+ publishedAt: instance.publishedAt,
129
+ modifiedAt: instance.modifiedAt
130
+ }
131
+ });
132
+ }
133
+ for (const edge of collection.edges ?? []) {
134
+ if (rejected.has(edge.from)) continue;
135
+ edges.push(edge);
136
+ }
137
+ }
138
+ /**
139
+ * Build the SEO graph from route declarations and content collections.
140
+ *
141
+ * Synchronous: the caller materializes its collections before calling, so there is
142
+ * no async work here. Callers own the origin.
143
+ */
144
+ function buildSeoGraph(input) {
145
+ const nodes = /* @__PURE__ */ new Map();
146
+ const edges = [];
147
+ const collisions = [];
148
+ walkRoutes(input.routeTree, "/", true, nodes, edges, []);
149
+ for (const collection of input.collections ?? []) addCollection(nodes, edges, collisions, collection);
150
+ for (const node of nodes.values()) {
151
+ if (node.source !== "route") continue;
152
+ for (const to of node.policy.related ?? []) edges.push({
153
+ from: node.path,
154
+ to,
155
+ type: "related"
156
+ });
157
+ if (node.policy.redirectTo !== void 0) edges.push({
158
+ from: node.path,
159
+ to: node.policy.redirectTo,
160
+ type: "redirect"
161
+ });
162
+ }
163
+ return {
164
+ nodes,
165
+ edges,
166
+ collisions
167
+ };
168
+ }
169
+ //#endregion
170
+ export { buildSeoGraph as t };
171
+
172
+ //# sourceMappingURL=graph-DMNOLXLu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-DMNOLXLu.js","names":[],"sources":["../src/core/graph.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 { applyTitleTemplate, type PublicPath, type RouteSeo, type 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 authored-document mode, inherited by collection instances. */\n markdown?: \"rendered\" | \"source\" | undefined;\n /** Group label for llms.txt, inherited by collection instances. */\n llms?: string | undefined;\n /** Route-declared policy, or synthesized (kind + inherited sitemap) for instances. */\n policy: RouteSeo;\n /**\n * The head the page ships: a static route's declared `head`, or an instance's\n * title (through its route's `titleTemplate`) and description. Absent when the\n * route computes its head at request time and no collection supplies it.\n */\n head?: SeoNodeHead | undefined;\n instance?:\n | {\n title: string;\n description?: string | undefined;\n publishedAt?: string | undefined;\n modifiedAt?: string | undefined;\n }\n | undefined;\n}\n\n/**\n * A node's head as graph data: the full title, description, and FAQ text. An\n * instance without a description still carries its title.\n */\nexport interface SeoNodeHead {\n readonly title: string;\n readonly description?: string | undefined;\n readonly faqs?: ReadonlyArray<{ readonly question: string; readonly answer: string }> | 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\n/**\n * The structural route shape the graph walks: a TanStack route tree has it\n * before `init()`, and an adapter can build it from parsed route files.\n */\nexport interface SeoRouteNode {\n readonly options: {\n readonly path?: string | undefined;\n readonly staticData?:\n | {\n readonly seo?: RouteSeo | undefined;\n readonly markdown?: SeoNode[\"markdown\"];\n readonly llms?: SeoNode[\"llms\"];\n }\n | undefined;\n };\n readonly children?: ReadonlyArray<SeoRouteNode> | undefined;\n}\n\nexport interface BuildSeoGraphInput {\n readonly routeTree: AnyRoute | SeoRouteNode;\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\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/** A route's declared head as graph data: templated title, description, and plain FAQs. */\nfunction declaredHead(seo: RouteSeo): SeoNodeHead | undefined {\n if (seo.head === undefined) return undefined;\n return {\n title: applyTitleTemplate(seo.titleTemplate, seo.head.title),\n description: seo.head.description,\n faqs: seo.head.faqs?.map(({ question, answer }) => ({ question, answer })),\n };\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 head: override.head ?? base.head,\n titleTemplate: override.titleTemplate ?? base.titleTemplate,\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: SeoRouteNode,\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 data = route.options.staticData;\n const seo = data?.seo;\n\n if (seo || data?.markdown !== undefined || data?.llms !== undefined) {\n const existing = nodes.get(path);\n if (existing) {\n if (seo) existing.policy = mergeSeo(existing.policy, seo);\n existing.kind = existing.policy.kind;\n // A head renders with its own route's template, never one merged from a layout.\n existing.head = (seo && declaredHead(seo)) ?? existing.head;\n existing.markdown = data?.markdown ?? existing.markdown;\n existing.llms = data?.llms ?? existing.llms;\n } else {\n const policy = seo ?? { kind: FALLBACK_KIND };\n nodes.set(path, {\n path,\n kind: policy.kind,\n source: \"route\",\n policy: { ...policy },\n head: seo && declaredHead(seo),\n markdown: data?.markdown,\n llms: data?.llms,\n });\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 const titleTemplate = collectionNode?.policy.titleTemplate;\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 markdown: collectionNode?.markdown,\n llms: collectionNode?.llms,\n policy: { kind, sitemap },\n head: { title: applyTitleTemplate(titleTemplate, instance.title), description: instance.description },\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 SeoRouteNode, \"/\", 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"],"mappings":"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"}
@@ -0,0 +1,204 @@
1
+ import { a as SeoGraph, h as RouteSeo, n as SeoCollection, o as SeoInstance, p as PublicPath, r as SeoEdge, s as SeoNode, u as SeoSource } from "./graph-D1PIndsC.js";
2
+ import { N as SimpleEdge, w as AnchorRegion } from "./content-DgNr7apS.js";
3
+ import { f as Message, m as SectionDocument, p as PageDocument } from "./page-heads-BfjWQvau.js";
4
+ import "./projections-Bk-qOOsR.js";
5
+ import { AnyRouter } from "@tanstack/react-router";
6
+ //#region src/markdown/hash.d.ts
7
+ declare const contentHash: (value: unknown) => string;
8
+ //#endregion
9
+ //#region src/markdown/markdown.d.ts
10
+ interface MarkdownWriter {
11
+ text(value: Message | string | undefined): string;
12
+ heading(level: number, value: Message | string | undefined): string;
13
+ table(rows: ReadonlyArray<ReadonlyArray<Message | string>>): string;
14
+ }
15
+ interface SectionKind {
16
+ readonly kind: string;
17
+ readonly markdown: (section: SectionDocument, md: MarkdownWriter) => string;
18
+ }
19
+ /** A kind can be passed directly to Section; importing its definition registers its serializer. */
20
+ declare function defineSectionKind<const K extends string>(definition: SectionKind & {
21
+ kind: K;
22
+ }): SectionKind & {
23
+ kind: K;
24
+ };
25
+ declare function sectionMarkdown(section: SectionDocument, options?: {
26
+ includeHumans?: boolean;
27
+ }): string;
28
+ /** One public twin, in authored section order. Human-only messages never enter it. */
29
+ declare function documentMarkdown(document: PageDocument, site: string): string;
30
+ //#endregion
31
+ //#region src/markdown/llms.d.ts
32
+ interface LlmsPage {
33
+ document: Pick<PageDocument, "path" | "title" | "description">;
34
+ llms?: string;
35
+ }
36
+ declare function llmsSection(path: string): string;
37
+ declare function llmsMarkdown(pages: ReadonlyArray<LlmsPage>, site: string): string;
38
+ //#endregion
39
+ //#region src/markdown/lock.d.ts
40
+ /** Stable, reviewable snapshot of document and message hashes with source locations. */
41
+ interface MarkdownLock {
42
+ readonly version: 1;
43
+ readonly pages: Readonly<Record<string, {
44
+ readonly document: string;
45
+ readonly messages: Readonly<Record<string, string>>;
46
+ }>>;
47
+ }
48
+ /** Build the v1 lock without changing document hashes, message hashes, or sources. */
49
+ declare function createMarkdownLock(documents: ReadonlyArray<PageDocument>): MarkdownLock;
50
+ //#endregion
51
+ //#region src/core/collections.d.ts
52
+ /** What a page contributes: its instance metadata plus the paths it links to deliberately. */
53
+ interface ContentEntry extends Omit<SeoInstance, "path"> {
54
+ /** Defaults to the page's `url`. */
55
+ readonly path?: string | undefined;
56
+ /** Deliberate cross-links, emitted as `related` edges from this page. */
57
+ readonly related?: ReadonlyArray<string> | undefined;
58
+ }
59
+ interface ContentCollectionOptions<Page> {
60
+ /** The param route these pages render through, e.g. `/blog/$slug`. */
61
+ readonly route: PublicPath;
62
+ /** The `source` label stamped on every node, e.g. `"blog"`. */
63
+ readonly source: SeoSource;
64
+ readonly pages: ReadonlyArray<Page>;
65
+ /** Map one page to its entry; decode frontmatter here. */
66
+ readonly entry: (page: Page) => ContentEntry;
67
+ /** Edges beyond `related` (crumb parents, collection membership). */
68
+ readonly edges?: ReadonlyArray<SeoEdge> | undefined;
69
+ }
70
+ declare function contentCollection<Page extends {
71
+ readonly url: string;
72
+ }>(options: ContentCollectionOptions<Page>): SeoCollection;
73
+ //#endregion
74
+ //#region src/core/wire.d.ts
75
+ interface SeoGraphJson {
76
+ readonly nodes: ReadonlyArray<SeoNode>;
77
+ readonly edges: ReadonlyArray<SeoEdge>;
78
+ readonly collisions?: ReadonlyArray<{
79
+ readonly path: string;
80
+ readonly sources: ReadonlyArray<SeoSource>;
81
+ }> | undefined;
82
+ }
83
+ declare function graphToJson(graph: SeoGraph): SeoGraphJson;
84
+ declare function graphFromJson(json: SeoGraphJson): SeoGraph;
85
+ //#endregion
86
+ //#region src/core/link-candidates.d.ts
87
+ /** One proposed contextual link, in the direction the link would be authored. */
88
+ interface LinkCandidatePair {
89
+ readonly source: string;
90
+ readonly destination: string;
91
+ /** The cluster the pair shares: a top-level section, or `kind:<kind>`. */
92
+ readonly cluster: string;
93
+ /** Why the pair is plausible, e.g. `same top-level section "/blog"`. */
94
+ readonly reason: string;
95
+ }
96
+ interface LinkCandidateOptions {
97
+ /** Maximum candidates to return after ordering (default 50). */
98
+ readonly limit?: number;
99
+ /** Restrict to these clusters; a filter may be a section or a bare kind. */
100
+ readonly clusters?: ReadonlyArray<string>;
101
+ /** Anchors already served in HTML. Only body-region edges exclude their own direction. */
102
+ readonly renderedEdges?: ReadonlyArray<SimpleEdge & {
103
+ readonly region?: AnchorRegion;
104
+ }>;
105
+ }
106
+ /** One cluster and how many candidate pairs it contributes (before `limit`). */
107
+ interface LinkClusterSummary {
108
+ readonly key: string;
109
+ readonly candidates: number;
110
+ }
111
+ interface LinkCandidateResult {
112
+ readonly candidates: ReadonlyArray<LinkCandidatePair>;
113
+ /** Candidate pairs before `limit` was applied (after cluster filters). */
114
+ readonly total: number;
115
+ readonly truncated: boolean;
116
+ readonly clusters: ReadonlyArray<LinkClusterSummary>;
117
+ }
118
+ /** Directionless pair key, so an edge in either direction means "connected". */
119
+ declare const undirectedEdgeKey: (from: string, to: string) => string;
120
+ /** A `--cluster` filter matches a section by name, or a kind via its bare label. */
121
+ declare const matchesClusterFilter: (cluster: string, filter: string) => boolean;
122
+ /** Human reason string for a candidate's source page, used when handing a plan to Jev. */
123
+ declare const candidateSourceText: (node: SeoNode) => string;
124
+ /**
125
+ * Enumerate reviewable contextual-link candidates from the declared graph.
126
+ *
127
+ * Excluded: self-pairs, pages that are not sitemap-eligible, pairs already
128
+ * declared as a `related` edge, and — when {@link LinkCandidateOptions.renderedEdges}
129
+ * is supplied — pairs already rendered as an anchor. Queries, hashes, and
130
+ * trailing slashes are normalized so both sides compare by the graph's path key.
131
+ */
132
+ declare const generateLinkCandidates: (graph: SeoGraph, options?: LinkCandidateOptions) => LinkCandidateResult;
133
+ /**
134
+ * Decode a rendered-edge dump supplied to the CLI: either a bare array of
135
+ * `{ from, to }` edges, or an object carrying `edges` (or `internalEdges`).
136
+ * Throws on any other shape — this is user input, not a provider payload.
137
+ */
138
+ declare const decodeRenderedEdges: (input: unknown) => ReadonlyArray<SimpleEdge & {
139
+ readonly region?: AnchorRegion;
140
+ }>;
141
+ //#endregion
142
+ //#region src/core/inspect-html.d.ts
143
+ /**
144
+ * Read a rendered `<head>` and validate it: title, meta
145
+ * (description/robots/og/twitter), canonical link, and `application/ld+json`
146
+ * blocks, with a minimal per-type JSON-LD check.
147
+ *
148
+ * This is the pure half of `pagegraph inspect --live` — the half worth having on its
149
+ * own. The CLI fetches a URL and hands the body here; a test suite can render a
150
+ * page and hand *that* here, asserting the head it actually ships. Both get the
151
+ * same verdict, because it is the same function.
152
+ *
153
+ * No HTML-parsing dependency, by design: a `<head>` is small and well-formed, so
154
+ * string/regex scanning is enough, and the package's core stays zero-dependency
155
+ * (which is also why the object guard below is hand-rolled — `effect/Predicate`
156
+ * is not reachable from this entry). It is honest about its limits: it does not
157
+ * build a DOM, so exotic markup (commented-out tags, CDATA, attributes spanning
158
+ * constructs) is out of scope. This validates *rendered output*, not arbitrary
159
+ * HTML.
160
+ *
161
+ * `issues` are blocking: a non-empty list makes `pagegraph inspect --live` exit 1.
162
+ * Required tags are `<title>`, `meta[name=description]`, and
163
+ * `link[rel=canonical]`; any JSON-LD that fails to parse or fails its minimal
164
+ * schema is also blocking.
165
+ */
166
+ interface JsonLdReport {
167
+ type: string;
168
+ valid: boolean;
169
+ errors: Array<string>;
170
+ }
171
+ interface LiveHeadReport {
172
+ url: string;
173
+ status: number;
174
+ title?: string | undefined;
175
+ description?: string | undefined;
176
+ canonical?: string | undefined;
177
+ robots?: string | undefined;
178
+ og: Record<string, string>;
179
+ twitter: Record<string, string>;
180
+ jsonLd: Array<JsonLdReport>;
181
+ issues: Array<string>;
182
+ }
183
+ /** Parse a rendered HTML document's `<head>` into a report. Pure. */
184
+ declare const inspectHtml: (url: string, status: number, html: string) => LiveHeadReport;
185
+ /** A non-empty `issues` list fails `pagegraph inspect --live` (exit 1). */
186
+ declare const hasBlockingIssues: (report: LiveHeadReport) => boolean;
187
+ //#endregion
188
+ //#region src/core/resolve-route-link.d.ts
189
+ /**
190
+ * Resolve a route's declared `seo.link` card (title + description) by its full
191
+ * path.
192
+ *
193
+ * `useRouter()` returns a Router typed to this app's exact route tree, so
194
+ * `routesByPath` is keyed by the literal `FileRouteTypes["fullPaths"]` union —
195
+ * but callers here (declared `related` targets) hold arbitrary runtime path
196
+ * strings, not that literal type. `routesByPath` and `routesById` are plain
197
+ * Records on every Router instance regardless of which route tree it's
198
+ * parameterized over, so this narrows to that structural shape once, at this
199
+ * boundary, instead of threading an `AnyRoute` cast through every call site.
200
+ */
201
+ declare function resolveRouteLink(router: AnyRouter, path: string): RouteSeo["link"];
202
+ //#endregion
203
+ export { sectionMarkdown as A, LlmsPage as C, SectionKind as D, MarkdownWriter as E, defineSectionKind as O, createMarkdownLock as S, llmsSection as T, graphToJson as _, inspectHtml as a, contentCollection as b, LinkCandidateResult as c, decodeRenderedEdges as d, generateLinkCandidates as f, graphFromJson as g, SeoGraphJson as h, hasBlockingIssues as i, contentHash as j, documentMarkdown as k, LinkClusterSummary as l, undirectedEdgeKey as m, JsonLdReport as n, LinkCandidateOptions as o, matchesClusterFilter as p, LiveHeadReport as r, LinkCandidatePair as s, resolveRouteLink as t, candidateSourceText as u, ContentCollectionOptions as v, llmsMarkdown as w, MarkdownLock as x, ContentEntry as y };
204
+ //# sourceMappingURL=index-C5w9ripz.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,196 +1,6 @@
1
- import { $ as PublicPath, A as RenderedEdgeFailure, B as FreshnessEntry, C as Anchor, D as RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, E as LinkGraphDiff, F as decodeRenderedEdgeArtifact, G as SeoCollection, H as FreshnessReport, I as diffLinkGraph, J as SeoGraph, K as SeoEdge, L as extractAnchors, M as RenderedPage, N as SimpleEdge, O as RenderedEdgeArtifact, P as buildRenderedGraph, Q as buildSeoGraph, R as normalizePath, S as hasStructuralViolations, T as LinkEdge, U as freshnessReport, V as FreshnessPolicy, W as BuildSeoGraphInput, X as SeoNode, Y as SeoInstance, Z as SeoSource, _ as Violation, a as Heading, b as checkGraph, c as RenderedDocument, d as checkRenderedContent, et as Register, f as extractPageContent, g as Severity, h as CoverageRule, i as ContentRuleName, j as RenderedGraph, k as RenderedEdgeArtifactCrawl, l as WordCountRule, m as CheckGraphOptions, n as ContentFinding, nt as SeoKind, o as JsonLdNode, p as renderedCheckTargets, q as SeoEdgeType, r as ContentPolicy, rt as SitemapPolicy, s as PageContent, t as ContentCheckOptions, tt as RouteSeo, u as checkPageContent, v as checkCoverage, w as AnchorRegion, x as checkRenderedCoverage, y as checkFreshness, z as renderedGraphFromEdges } from "./content-DVL2iyGU.js";
2
- import { AnyRouter } from "@tanstack/react-router";
3
- //#region src/core/projections.d.ts
4
- interface ProjectionConfig {
5
- origin: string;
6
- indexable: boolean;
7
- }
8
- interface RobotsConfig extends ProjectionConfig {
9
- /** Path prefixes to disallow on an indexable host (e.g. the app-only groups). */
10
- disallow: ReadonlyArray<string>;
11
- /**
12
- * Origin-wide Content-Signal preferences
13
- * (https://contentsignals.org/), emitted as `Content-Signal: <value>` under
14
- * `User-agent: *` on an indexable host. Omit for none. The plugin never
15
- * invents a default — pass the policy you want, e.g.
16
- * `"search=yes, ai-input=yes, ai-train=yes"`.
17
- */
18
- contentSignal?: string | undefined;
19
- /**
20
- * Extra full lines in the indexable `User-agent: *` group, after
21
- * Content-Signal (if any) and before Allow/Disallow. Use for directives the
22
- * plugin does not model, or to compose {@link contentSignal} yourself.
23
- */
24
- directives?: ReadonlyArray<string> | undefined;
25
- /**
26
- * Last-mile override: receives the rendered robots.txt and returns the file
27
- * to emit. Runs for indexable and preview hosts. Use when you need to wrap
28
- * or replace the default body rather than add group lines.
29
- */
30
- transform?: ((robots: string) => string) | undefined;
31
- }
32
- interface NodeReport {
33
- node: SeoNode;
34
- inSitemap: boolean;
35
- incoming: Array<SeoEdge>;
36
- outgoing: Array<SeoEdge>;
37
- }
38
- /**
39
- * A node belongs in the sitemap when it declares a positive sitemap policy, is not
40
- * a redirect, is not robots-noindexed, and is not a param template (a route whose
41
- * path still contains a `$` segment — those exist only so their instances inherit).
42
- */
43
- declare function isSitemapEligible(node: SeoNode): boolean;
44
- /**
45
- * The date a node's content last changed, as declared: an instance's
46
- * `modifiedAt`, else its `publishedAt`; a route's own `modifiedAt`. A node with
47
- * no date (a docs page without frontmatter dates, an undated route) returns
48
- * undefined, and the sitemap omits its `<lastmod>`.
49
- */
50
- declare function lastModified(node: SeoNode): string | undefined;
51
- /**
52
- * Render sitemap.xml from the graph. Each entry's `<lastmod>` is its
53
- * {@link lastModified} date: frontmatter for content instances, the declared
54
- * `modifiedAt` for routes. Route entries are sorted by path, then instances follow in collection order.
55
- * `indexable` is intentionally unused — the sitemap body is host-independent;
56
- * robots.txt is what gates crawling.
57
- */
58
- declare function renderSitemap(graph: SeoGraph, cfg: ProjectionConfig): string;
59
- /** Format a Content-Signal robots.txt directive from the preference list. */
60
- declare function contentSignal(value: string): string;
61
- /**
62
- * Render robots.txt. A non-indexable host (previews) gets a disallow-all
63
- * with no Sitemap line; an indexable host disallows exactly the prefixes the caller
64
- * passes. Pages that declare `robots: noindex` are intentionally NOT added as
65
- * Disallow entries — a Disallow would stop crawlers reaching the page to read its
66
- * `noindex, follow` meta, so the graph's per-node robots policy never feeds this
67
- * list. `graph` is unused — kept for signature parity with the other projections,
68
- * which callers load the graph once for and pass to each.
69
- *
70
- * Origin-wide group directives (`contentSignal`, `directives`) are indexable-host
71
- * only. {@link RobotsConfig.transform} always runs last so a consumer can override
72
- * the whole file.
73
- */
74
- declare function renderRobots(_graph: SeoGraph, cfg: RobotsConfig): string;
75
- /** Inspect a single node: its declaration, sitemap eligibility, and edges. */
76
- declare function inspectNode(graph: SeoGraph, path: string): NodeReport | undefined;
77
- //#endregion
78
- //#region src/core/link-candidates.d.ts
79
- /** One proposed contextual link, in the direction the link would be authored. */
80
- interface LinkCandidatePair {
81
- readonly source: string;
82
- readonly destination: string;
83
- /** The cluster the pair shares: a top-level section, or `kind:<kind>`. */
84
- readonly cluster: string;
85
- /** Why the pair is plausible, e.g. `same top-level section "/blog"`. */
86
- readonly reason: string;
87
- }
88
- interface LinkCandidateOptions {
89
- /** Maximum candidates to return after ordering (default 50). */
90
- readonly limit?: number;
91
- /** Restrict to these clusters; a filter may be a section or a bare kind. */
92
- readonly clusters?: ReadonlyArray<string>;
93
- /** Anchors already served in HTML. Only body-region edges exclude their own direction. */
94
- readonly renderedEdges?: ReadonlyArray<SimpleEdge & {
95
- readonly region?: AnchorRegion;
96
- }>;
97
- }
98
- /** One cluster and how many candidate pairs it contributes (before `limit`). */
99
- interface LinkClusterSummary {
100
- readonly key: string;
101
- readonly candidates: number;
102
- }
103
- interface LinkCandidateResult {
104
- readonly candidates: ReadonlyArray<LinkCandidatePair>;
105
- /** Candidate pairs before `limit` was applied (after cluster filters). */
106
- readonly total: number;
107
- readonly truncated: boolean;
108
- readonly clusters: ReadonlyArray<LinkClusterSummary>;
109
- }
110
- /** Directionless pair key, so an edge in either direction means "connected". */
111
- declare const undirectedEdgeKey: (from: string, to: string) => string;
112
- /** A `--cluster` filter matches a section by name, or a kind via its bare label. */
113
- declare const matchesClusterFilter: (cluster: string, filter: string) => boolean;
114
- /** Human reason string for a candidate's source page, used when handing a plan to Jev. */
115
- declare const candidateSourceText: (node: SeoNode) => string;
116
- /**
117
- * Enumerate reviewable contextual-link candidates from the declared graph.
118
- *
119
- * Excluded: self-pairs, pages that are not sitemap-eligible, pairs already
120
- * declared as a `related` edge, and — when {@link LinkCandidateOptions.renderedEdges}
121
- * is supplied — pairs already rendered as an anchor. Queries, hashes, and
122
- * trailing slashes are normalized so both sides compare by the graph's path key.
123
- */
124
- declare const generateLinkCandidates: (graph: SeoGraph, options?: LinkCandidateOptions) => LinkCandidateResult;
125
- /**
126
- * Decode a rendered-edge dump supplied to the CLI: either a bare array of
127
- * `{ from, to }` edges, or an object carrying `edges` (or `internalEdges`).
128
- * Throws on any other shape — this is user input, not a provider payload.
129
- */
130
- declare const decodeRenderedEdges: (input: unknown) => ReadonlyArray<SimpleEdge & {
131
- readonly region?: AnchorRegion;
132
- }>;
133
- //#endregion
134
- //#region src/core/inspect-html.d.ts
135
- /**
136
- * Read a rendered `<head>` and validate it: title, meta
137
- * (description/robots/og/twitter), canonical link, and `application/ld+json`
138
- * blocks, with a minimal per-type JSON-LD check.
139
- *
140
- * This is the pure half of `pagegraph inspect --live` — the half worth having on its
141
- * own. The CLI fetches a URL and hands the body here; a test suite can render a
142
- * page and hand *that* here, asserting the head it actually ships. Both get the
143
- * same verdict, because it is the same function.
144
- *
145
- * No HTML-parsing dependency, by design: a `<head>` is small and well-formed, so
146
- * string/regex scanning is enough, and the package's core stays zero-dependency
147
- * (which is also why the object guard below is hand-rolled — `effect/Predicate`
148
- * is not reachable from this entry). It is honest about its limits: it does not
149
- * build a DOM, so exotic markup (commented-out tags, CDATA, attributes spanning
150
- * constructs) is out of scope. This validates *rendered output*, not arbitrary
151
- * HTML.
152
- *
153
- * `issues` are blocking: a non-empty list makes `pagegraph inspect --live` exit 1.
154
- * Required tags are `<title>`, `meta[name=description]`, and
155
- * `link[rel=canonical]`; any JSON-LD that fails to parse or fails its minimal
156
- * schema is also blocking.
157
- */
158
- interface JsonLdReport {
159
- type: string;
160
- valid: boolean;
161
- errors: Array<string>;
162
- }
163
- interface LiveHeadReport {
164
- url: string;
165
- status: number;
166
- title?: string | undefined;
167
- description?: string | undefined;
168
- canonical?: string | undefined;
169
- robots?: string | undefined;
170
- og: Record<string, string>;
171
- twitter: Record<string, string>;
172
- jsonLd: Array<JsonLdReport>;
173
- issues: Array<string>;
174
- }
175
- /** Parse a rendered HTML document's `<head>` into a report. Pure. */
176
- declare const inspectHtml: (url: string, status: number, html: string) => LiveHeadReport;
177
- /** A non-empty `issues` list fails `pagegraph inspect --live` (exit 1). */
178
- declare const hasBlockingIssues: (report: LiveHeadReport) => boolean;
179
- //#endregion
180
- //#region src/core/resolve-route-link.d.ts
181
- /**
182
- * Resolve a route's declared `seo.link` card (title + description) by its full
183
- * path.
184
- *
185
- * `useRouter()` returns a Router typed to this app's exact route tree, so
186
- * `routesByPath` is keyed by the literal `FileRouteTypes["fullPaths"]` union —
187
- * but callers here (declared `related` targets) hold arbitrary runtime path
188
- * strings, not that literal type. `routesByPath` and `routesById` are plain
189
- * Records on every Router instance regardless of which route tree it's
190
- * parameterized over, so this narrows to that structural shape once, at this
191
- * boundary, instead of threading an `AnyRoute` cast through every call site.
192
- */
193
- declare function resolveRouteLink(router: AnyRouter, path: string): RouteSeo["link"];
194
- //#endregion
195
- export { type Anchor, type AnchorRegion, type BuildSeoGraphInput, type CheckGraphOptions, type ContentCheckOptions, type ContentFinding, type ContentPolicy, type ContentRuleName, type CoverageRule, type FreshnessEntry, type FreshnessPolicy, type FreshnessReport, type Heading, type JsonLdNode, type JsonLdReport, type LinkCandidateOptions, type LinkCandidatePair, type LinkCandidateResult, type LinkClusterSummary, type LinkEdge, type LinkGraphDiff, type LiveHeadReport, type NodeReport, type PageContent, type ProjectionConfig, type PublicPath, RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, type Register, type RenderedDocument, type RenderedEdgeArtifact, type RenderedEdgeArtifactCrawl, type RenderedEdgeFailure, type RenderedGraph, type RenderedPage, type RobotsConfig, type RouteSeo, type SeoCollection, type SeoEdge, type SeoEdgeType, type SeoGraph, type SeoInstance, type SeoKind, type SeoNode, type SeoSource, type Severity, type SimpleEdge, type SitemapPolicy, type Violation, type WordCountRule, buildRenderedGraph, buildSeoGraph, candidateSourceText, checkCoverage, checkFreshness, checkGraph, checkPageContent, checkRenderedContent, checkRenderedCoverage, contentSignal, decodeRenderedEdgeArtifact, decodeRenderedEdges, diffLinkGraph, extractAnchors, extractPageContent, freshnessReport, generateLinkCandidates, hasBlockingIssues, hasStructuralViolations, inspectHtml, inspectNode, isSitemapEligible, lastModified, matchesClusterFilter, normalizePath, renderRobots, renderSitemap, renderedCheckTargets, renderedGraphFromEdges, resolveRouteLink, undirectedEdgeKey };
196
- //# sourceMappingURL=index.d.ts.map
1
+ import { _ as SeoKind, a as SeoGraph, b as applyTitleTemplate, c as SeoNodeHead, d as buildSeoGraph, f as JsonLdDocument, g as SeoFaq, h as RouteSeo, i as SeoEdgeType, l as SeoRouteNode, m as Register, n as SeoCollection, o as SeoInstance, p as PublicPath, r as SeoEdge, s as SeoNode, t as BuildSeoGraphInput, u as SeoSource, v as SeoPageHead, y as SitemapPolicy } from "./graph-D1PIndsC.js";
2
+ import { A as RenderedEdgeFailure, B as FreshnessEntry, C as Anchor, D as RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, E as LinkGraphDiff, F as decodeRenderedEdgeArtifact, H as FreshnessReport, I as diffLinkGraph, L as extractAnchors, M as RenderedPage, N as SimpleEdge, O as RenderedEdgeArtifact, P as buildRenderedGraph, R as normalizePath, S as hasStructuralViolations, T as LinkEdge, U as freshnessReport, V as FreshnessPolicy, _ as Violation, a as Heading, b as checkGraph, c as RenderedDocument, d as checkRenderedContent, f as extractPageContent, g as Severity, h as CoverageRule, i as ContentRuleName, j as RenderedGraph, k as RenderedEdgeArtifactCrawl, l as WordCountRule, m as CheckGraphOptions, n as ContentFinding, o as JsonLdNode, p as renderedCheckTargets, r as ContentPolicy, s as PageContent, t as ContentCheckOptions, u as checkPageContent, v as checkCoverage, w as AnchorRegion, x as checkRenderedCoverage, y as checkFreshness, z as renderedGraphFromEdges } from "./content-DgNr7apS.js";
3
+ import { _ as hashDocument, a as FactDefinition, c as fact, d as InlineNode, f as Message, g as VisualDocument, h as SectionItem, i as selectPageHeadNodes, l as resolveFact, m as SectionDocument, n as PageHeadsOptions, o as Facts, p as PageDocument, r as pageHeads, s as defineFacts, t as PageHead, u as BodyEntry } from "./page-heads-BfjWQvau.js";
4
+ import { A as sectionMarkdown, C as LlmsPage, D as SectionKind, E as MarkdownWriter, O as defineSectionKind, S as createMarkdownLock, T as llmsSection, _ as graphToJson, a as inspectHtml, b as contentCollection, c as LinkCandidateResult, d as decodeRenderedEdges, f as generateLinkCandidates, g as graphFromJson, h as SeoGraphJson, i as hasBlockingIssues, j as contentHash, k as documentMarkdown, l as LinkClusterSummary, m as undirectedEdgeKey, n as JsonLdReport, o as LinkCandidateOptions, p as matchesClusterFilter, r as LiveHeadReport, s as LinkCandidatePair, t as resolveRouteLink, u as candidateSourceText, v as ContentCollectionOptions, w as llmsMarkdown, x as MarkdownLock, y as ContentEntry } from "./index-C5w9ripz.js";
5
+ import { a as inspectNode, c as renderRobots, i as contentSignal, l as renderSitemap, n as ProjectionConfig, o as isSitemapEligible, r as RobotsConfig, s as lastModified, t as NodeReport } from "./projections-Bk-qOOsR.js";
6
+ export { type Anchor, type AnchorRegion, type BodyEntry, type BuildSeoGraphInput, type CheckGraphOptions, type ContentCheckOptions, type ContentCollectionOptions, type ContentEntry, type ContentFinding, type ContentPolicy, type ContentRuleName, type CoverageRule, type FactDefinition, type Facts, type FreshnessEntry, type FreshnessPolicy, type FreshnessReport, type Heading, type InlineNode, type JsonLdDocument, type JsonLdNode, type JsonLdReport, type LinkCandidateOptions, type LinkCandidatePair, type LinkCandidateResult, type LinkClusterSummary, type LinkEdge, type LinkGraphDiff, type LiveHeadReport, type LlmsPage, type MarkdownLock, type MarkdownWriter, type Message, type NodeReport, type PageContent, type PageDocument, type PageHead, type PageHeadsOptions, type ProjectionConfig, type PublicPath, RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, type Register, type RenderedDocument, type RenderedEdgeArtifact, type RenderedEdgeArtifactCrawl, type RenderedEdgeFailure, type RenderedGraph, type RenderedPage, type RobotsConfig, type RouteSeo, type SectionDocument, type SectionItem, type SectionKind, type SeoCollection, type SeoEdge, type SeoEdgeType, type SeoFaq, type SeoGraph, type SeoGraphJson, type SeoInstance, type SeoKind, type SeoNode, type SeoNodeHead, type SeoPageHead, type SeoRouteNode, type SeoSource, type Severity, type SimpleEdge, type SitemapPolicy, type Violation, type VisualDocument, type WordCountRule, 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 };