pagegraph 0.8.4 → 0.10.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 +158 -6
- package/dist/audit.d.ts +7 -0
- package/dist/audit.js +33 -7
- package/dist/audit.js.map +1 -1
- package/dist/cli.js +3827 -2198
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +14 -1
- package/dist/config.js.map +1 -1
- package/dist/{checks-6noG_xTS.d.ts → content-DVL2iyGU.d.ts} +274 -126
- package/dist/content-DbyJoRpj.js +1384 -0
- package/dist/content-DbyJoRpj.js.map +1 -0
- package/dist/index.d.ts +19 -8
- package/dist/index.js +31 -555
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/links-BFJc-pJ9.js +0 -318
- package/dist/links-BFJc-pJ9.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-DbyJoRpj.js","names":["decodeEntities","decodeEntities"],"sources":["../src/core/projections.ts","../src/core/freshness.ts","../src/core/checks.ts","../src/core/inspect-html.ts","../src/core/links.ts","../src/core/content.ts"],"sourcesContent":["/**\n * Projections of the SEO graph: sitemap.xml, robots.txt, and single-node\n * inspection. Pure functions — the origin, the host's indexability, and the\n * robots disallow list are injected by the caller, never read from the\n * environment or a generated file.\n */\n\nimport type { SeoEdge, SeoGraph, SeoNode } from \"./graph\";\n\nexport interface ProjectionConfig {\n origin: string;\n indexable: boolean;\n}\n\nexport interface RobotsConfig extends ProjectionConfig {\n /** Path prefixes to disallow on an indexable host (e.g. the app-only groups). */\n disallow: ReadonlyArray<string>;\n /**\n * Origin-wide Content-Signal preferences\n * (https://contentsignals.org/), emitted as `Content-Signal: <value>` under\n * `User-agent: *` on an indexable host. Omit for none. The plugin never\n * invents a default — pass the policy you want, e.g.\n * `\"search=yes, ai-input=yes, ai-train=yes\"`.\n */\n contentSignal?: string | undefined;\n /**\n * Extra full lines in the indexable `User-agent: *` group, after\n * Content-Signal (if any) and before Allow/Disallow. Use for directives the\n * plugin does not model, or to compose {@link contentSignal} yourself.\n */\n directives?: ReadonlyArray<string> | undefined;\n /**\n * Last-mile override: receives the rendered robots.txt and returns the file\n * to emit. Runs for indexable and preview hosts. Use when you need to wrap\n * or replace the default body rather than add group lines.\n */\n transform?: ((robots: string) => string) | undefined;\n}\n\nexport interface NodeReport {\n node: SeoNode;\n inSitemap: boolean;\n incoming: Array<SeoEdge>;\n outgoing: Array<SeoEdge>;\n}\n\nconst escapeXml = (value: string): string =>\n value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n\n/**\n * A node belongs in the sitemap when it declares a positive sitemap policy, is not\n * a redirect, is not robots-noindexed, and is not a param template (a route whose\n * path still contains a `$` segment — those exist only so their instances inherit).\n */\nexport function isSitemapEligible(node: SeoNode): boolean {\n if (node.policy.redirectTo !== undefined) return false;\n if (node.policy.robots?.includes(\"noindex\")) return false;\n if (!node.policy.sitemap) return false; // false or absent\n if (node.path.includes(\"$\")) return false;\n return true;\n}\n\n/** Canonical absolute URL for a node under the given origin. */\nfunction urlForNode(origin: string, node: SeoNode): string {\n return node.path === \"/\" ? origin : `${origin}${node.path}`;\n}\n\n/**\n * The date a node's content last changed, as declared: an instance's\n * `modifiedAt`, else its `publishedAt`; a route's own `modifiedAt`. A node with\n * no date (a docs page without frontmatter dates, an undated route) returns\n * undefined, and the sitemap omits its `<lastmod>`.\n */\nexport function lastModified(node: SeoNode): string | undefined {\n if (node.instance) return node.instance.modifiedAt ?? node.instance.publishedAt;\n return node.policy.modifiedAt;\n}\n\n/** An ISO 8601 date, or a date-time that states its offset. */\nconst ISO_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))?$/;\n\n/**\n * Parse a declared date to epoch milliseconds, or undefined when it is not an\n * ISO 8601 date (`2026-09-29`) or offset date-time (`2026-09-29T10:00:00Z`) on a\n * real calendar day. `Date.parse` alone would accept \"Sep 29\" in the host's\n * zone and roll \"2026-02-30\" into March; either would publish a wrong\n * `<lastmod>`. The `invalid-date` check reports the undefined case, so\n * projections that meet one fail loudly.\n */\nexport function parseDeclaredDate(value: string): number | undefined {\n const match = ISO_DATE.exec(value);\n if (match === null) return undefined;\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];\n const calendar = new Date(Date.UTC(year, month - 1, day));\n if (calendar.getUTCMonth() !== month - 1 || calendar.getUTCDate() !== day) return undefined;\n const time = Date.parse(value);\n return Number.isNaN(time) ? undefined : time;\n}\n\nfunction sitemapLastmod(node: SeoNode): string | undefined {\n const date = lastModified(node);\n if (date === undefined) return undefined;\n const time = parseDeclaredDate(date);\n if (time === undefined) {\n throw new Error(`\"${node.path}\" declares an invalid date \"${date}\"; run \\`pagegraph check\\`.`);\n }\n return new Date(time).toISOString();\n}\n\nfunction renderUrlEntry(url: string, lastmod: string | undefined, node: SeoNode): string {\n const sitemap = node.policy.sitemap;\n // isSitemapEligible guarantees a positive policy before this runs.\n const { changeFrequency, priority } = sitemap as { changeFrequency: string; priority: number };\n const lines = [` <url>`, ` <loc>${escapeXml(url)}</loc>`];\n if (lastmod) lines.push(` <lastmod>${lastmod}</lastmod>`);\n lines.push(\n ` <changefreq>${changeFrequency}</changefreq>`,\n ` <priority>${priority.toFixed(1)}</priority>`,\n ` </url>`,\n );\n return lines.join(\"\\n\");\n}\n\n/**\n * Render sitemap.xml from the graph. Each entry's `<lastmod>` is its\n * {@link lastModified} date: frontmatter for content instances, the declared\n * `modifiedAt` for routes. Route entries are sorted by path, then instances follow in collection order.\n * `indexable` is intentionally unused — the sitemap body is host-independent;\n * robots.txt is what gates crawling.\n */\nexport function renderSitemap(graph: SeoGraph, cfg: ProjectionConfig): string {\n const nodes = [...graph.nodes.values()];\n const staticNodes = nodes\n .filter((node) => node.source === \"route\" && isSitemapEligible(node))\n .sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));\n const instanceNodes = nodes.filter((node) => node.source !== \"route\" && isSitemapEligible(node));\n\n const seen = new Set<string>();\n const entries: Array<string> = [];\n for (const node of [...staticNodes, ...instanceNodes]) {\n const url = urlForNode(cfg.origin, node);\n const key = url.toLowerCase().replace(/\\/$/, \"\");\n if (seen.has(key)) continue;\n seen.add(key);\n entries.push(renderUrlEntry(url, sitemapLastmod(node), node));\n }\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\\n${entries.join(\n \"\\n\",\n )}\\n</urlset>\\n`;\n}\n\n/** Format a Content-Signal robots.txt directive from the preference list. */\nexport function contentSignal(value: string): string {\n return `Content-Signal: ${value}`;\n}\n\nconst groupLines = (cfg: RobotsConfig): Array<string> => {\n const lines: Array<string> = [];\n if (cfg.contentSignal !== undefined && cfg.contentSignal !== \"\") {\n lines.push(contentSignal(cfg.contentSignal));\n }\n for (const directive of cfg.directives ?? []) {\n if (directive !== \"\") lines.push(directive);\n }\n return lines;\n};\n\n/**\n * Render robots.txt. A non-indexable host (previews) gets a disallow-all\n * with no Sitemap line; an indexable host disallows exactly the prefixes the caller\n * passes. Pages that declare `robots: noindex` are intentionally NOT added as\n * Disallow entries — a Disallow would stop crawlers reaching the page to read its\n * `noindex, follow` meta, so the graph's per-node robots policy never feeds this\n * list. `graph` is unused — kept for signature parity with the other projections,\n * which callers load the graph once for and pass to each.\n *\n * Origin-wide group directives (`contentSignal`, `directives`) are indexable-host\n * only. {@link RobotsConfig.transform} always runs last so a consumer can override\n * the whole file.\n */\nexport function renderRobots(_graph: SeoGraph, cfg: RobotsConfig): string {\n const rendered = cfg.indexable\n ? [\n \"User-agent: *\",\n ...groupLines(cfg),\n \"Allow: /\",\n ...cfg.disallow.map((path) => `Disallow: ${path}`),\n \"\",\n `Sitemap: ${cfg.origin}/sitemap.xml`,\n `Host: ${cfg.origin}`,\n \"\",\n ].join(\"\\n\")\n : [\"User-agent: *\", \"Disallow: /\", \"\"].join(\"\\n\");\n return cfg.transform === undefined ? rendered : cfg.transform(rendered);\n}\n\n/** Inspect a single node: its declaration, sitemap eligibility, and edges. */\nexport function inspectNode(graph: SeoGraph, path: string): NodeReport | undefined {\n const node = graph.nodes.get(path);\n if (!node) return undefined;\n return {\n node,\n inSitemap: isSitemapEligible(node),\n incoming: graph.edges.filter((edge) => edge.to === path),\n outgoing: graph.edges.filter((edge) => edge.from === path),\n };\n}\n","/**\n * Freshness: how long ago each indexable page last changed, by the dates its\n * declaration carries ({@link lastModified}). Pure — the caller injects `now`,\n * so a test and the CLI read the same verdict from the same graph.\n *\n * Only sitemap-eligible pages are judged: a noindex or redirect page is not a\n * refresh candidate. A page with no date is reported as `undated` rather than\n * stale, because age cannot be inferred; the sitemap omits its `<lastmod>` too.\n */\n\nimport type { SeoKind } from \"./declare\";\nimport type { SeoGraph, SeoSource } from \"./graph\";\nimport { isSitemapEligible, lastModified, parseDeclaredDate } from \"./projections\";\n\n/** Project policy: pages whose last change is older than this are stale. */\nexport interface FreshnessPolicy {\n readonly maxAgeDays: number;\n}\n\nexport interface FreshnessEntry {\n readonly path: string;\n readonly kind: SeoKind;\n readonly source: SeoSource;\n /** The declared date, normalized to ISO 8601. */\n readonly lastModified: string;\n /** Whole days between `lastModified` and the report's `asOf`. */\n readonly ageDays: number;\n}\n\nexport interface FreshnessReport {\n readonly asOf: string;\n readonly maxAgeDays: number;\n /** Pages older than `maxAgeDays`, oldest first: the refresh queue. */\n readonly stale: ReadonlyArray<FreshnessEntry>;\n /** Dated pages within `maxAgeDays`, newest first. */\n readonly fresh: ReadonlyArray<FreshnessEntry>;\n /** Sitemap-eligible pages that declare no date, in graph order. */\n readonly undated: ReadonlyArray<string>;\n /** Sitemap-eligible pages whose date does not parse; `check` fails on each. */\n readonly invalid: ReadonlyArray<string>;\n}\n\nconst DAY_MS = 86_400_000;\n\n/**\n * Split the graph's sitemap-eligible pages into stale, fresh, undated, and\n * invalid. An invalid date cannot be aged, but it is listed so a report never\n * reads as complete while it skipped a page.\n */\nexport function freshnessReport(\n graph: SeoGraph,\n policy: FreshnessPolicy,\n now: Date,\n): FreshnessReport {\n const stale: Array<FreshnessEntry> = [];\n const fresh: Array<FreshnessEntry> = [];\n const undated: Array<string> = [];\n const invalid: Array<string> = [];\n\n for (const node of graph.nodes.values()) {\n if (!isSitemapEligible(node)) continue;\n const declared = lastModified(node);\n if (declared === undefined) {\n undated.push(node.path);\n continue;\n }\n const time = parseDeclaredDate(declared);\n if (time === undefined) {\n invalid.push(node.path);\n continue;\n }\n const entry: FreshnessEntry = {\n path: node.path,\n kind: node.kind,\n source: node.source,\n lastModified: new Date(time).toISOString(),\n ageDays: Math.max(0, Math.floor((now.getTime() - time) / DAY_MS)),\n };\n (entry.ageDays > policy.maxAgeDays ? stale : fresh).push(entry);\n }\n\n stale.sort((a, b) => b.ageDays - a.ageDays || (a.path < b.path ? -1 : 1));\n fresh.sort((a, b) => a.ageDays - b.ageDays || (a.path < b.path ? -1 : 1));\n return {\n asOf: now.toISOString(),\n maxAgeDays: policy.maxAgeDays,\n stale,\n fresh,\n undated,\n invalid,\n };\n}\n","/**\n * The SEO check engine: a set of rules run against the derived {@link SeoGraph}.\n * Pure — no I/O, no `clientEnv`, no React. The CLI's `pagegraph check` command and the\n * vitest suite both call {@link checkGraph}; nothing else derives correctness.\n *\n * Two severities, mapped to the CLI's exit contract:\n * - `structural` — a declaration is internally broken (a link points nowhere, a\n * card would render empty, a page contradicts its own robots/sitemap intent).\n * Any structural violation fails `pagegraph check` (exit 1); these must not ship.\n * - `editorial` — a quality smell (duplicate or mis-sized titles/descriptions).\n * Reported as warnings; `pagegraph check` still exits 0 when only these are present.\n *\n * The graph only knows what declarations and frontmatter carry, so the rules are\n * scoped to that: per-node title/description live only on collection *instances*,\n * never on structural route nodes (whose head tags are composed at render time and\n * are not in the graph). Rules are data-driven and listed once in\n * {@link CHECK_RULES}.\n */\n\nimport type { SitemapPolicy } from \"./declare\";\nimport { freshnessReport, type FreshnessPolicy } from \"./freshness\";\nimport type { SeoGraph, SeoNode } from \"./graph\";\nimport type { LinkEdge } from \"./links\";\nimport { isSitemapEligible, parseDeclaredDate } from \"./projections\";\n\nexport type Severity = \"structural\" | \"editorial\";\n\nexport interface Violation {\n severity: Severity;\n rule: string;\n path?: string | undefined;\n message: string;\n fix?: string | undefined;\n}\n\n/**\n * A contextual-link coverage rule: every sitemap-eligible page matching the\n * `path` glob must have at least `minInbound` incoming contextual links. Unlike\n * the static rules, these come from project policy (a CLI flag or\n * `seo.config.ts`), because \"which pages are money pages\" is app knowledge.\n *\n * The same rule shape is evaluated twice: `checkCoverage` counts declared\n * `related` edges, and `checkRenderedCoverage` counts the contextual anchors a\n * crawl actually served. The target universe is always the declared graph's\n * sitemap-eligible pages — the rendered pass only swaps the edge source.\n */\nexport interface CoverageRule {\n /** Path glob: `*` matches within a segment, `**` matches across segments. */\n readonly path: string;\n /** Minimum incoming contextual links the matched page needs. */\n readonly minInbound: number;\n}\n\n/** A single finding before its rule's `severity`/`rule` name are attached. */\ninterface RawViolation {\n path?: string | undefined;\n message: string;\n fix?: string | undefined;\n}\n\ninterface CheckRule {\n readonly name: string;\n readonly severity: Severity;\n readonly evaluate: (graph: SeoGraph) => ReadonlyArray<RawViolation>;\n}\n\n/** A positive sitemap policy — the author asked for this page to be indexed. */\nconst hasPositiveSitemap = (sitemap: SitemapPolicy | false | undefined): sitemap is SitemapPolicy =>\n sitemap !== undefined && sitemap !== false;\n\n/** Content and manifest instances carry page-level title/description. */\nconst isInstance = (node: SeoNode): boolean => node.source !== \"route\";\n\n/** Group instance nodes by a present, non-empty string field for duplicate detection. */\nconst groupInstancesBy = (\n graph: SeoGraph,\n field: (node: SeoNode) => string | undefined,\n): Map<string, Array<SeoNode>> => {\n const groups = new Map<string, Array<SeoNode>>();\n for (const node of graph.nodes.values()) {\n if (!isInstance(node)) continue;\n const value = field(node)?.trim();\n if (!value) continue;\n const bucket = groups.get(value);\n if (bucket) bucket.push(node);\n else groups.set(value, [node]);\n }\n return groups;\n};\n\nconst DESCRIPTION_MAX = 160;\nconst DESCRIPTION_MIN = 50;\n\n/**\n * Every check, in one place. `checkGraph` runs them in order and stamps each\n * finding with its rule name and severity, so the output is grouped by rule and\n * deterministic (nodes iterate in graph insertion order, edges in array order).\n */\nconst CHECK_RULES: ReadonlyArray<CheckRule> = [\n {\n name: \"path-owner-collision\",\n severity: \"structural\",\n evaluate: (graph) =>\n (graph.collisions ?? []).map((collision) => ({\n path: collision.path,\n message: `Canonical path \"${collision.path}\" is owned by multiple sources: ${collision.sources.join(\", \")}.`,\n fix: \"Give every concrete page one canonical path and one graph owner.\",\n })),\n },\n {\n name: \"canonical-path-collision\",\n severity: \"structural\",\n evaluate: (graph) => {\n const groups = new Map<string, Array<string>>();\n for (const path of graph.nodes.keys()) {\n const canonical = path.toLowerCase().replace(/\\/$/, \"\") || \"/\";\n const paths = groups.get(canonical);\n if (paths) paths.push(path);\n else groups.set(canonical, [path]);\n }\n return [...groups.values()]\n .filter((paths) => paths.length > 1)\n .flatMap((paths) =>\n paths.map((path) => ({\n path,\n message: `Canonical path collides with ${paths.filter((candidate) => candidate !== path).join(\", \")}.`,\n fix: \"Use one lowercase, trailing-slash-normalized canonical path.\",\n })),\n );\n },\n },\n {\n name: \"self-edge\",\n severity: \"structural\",\n evaluate: (graph) =>\n graph.edges\n .filter((edge) => edge.from === edge.to)\n .map((edge) => ({\n path: edge.from,\n message: `${edge.type} edge points back to its own source node.`,\n fix: \"Remove the self-reference from the canonical manifest or route declaration.\",\n })),\n },\n {\n name: \"duplicate-edge\",\n severity: \"structural\",\n evaluate: (graph) => {\n const seen = new Set<string>();\n const duplicates: Array<RawViolation> = [];\n for (const edge of graph.edges) {\n const key = `${edge.from}\\u0000${edge.to}\\u0000${edge.type}`;\n if (seen.has(key)) {\n duplicates.push({\n path: edge.from,\n message: `Duplicate ${edge.type} edge from \"${edge.from}\" to \"${edge.to}\".`,\n fix: \"Declare each graph relationship exactly once.\",\n });\n } else {\n seen.add(key);\n }\n }\n return duplicates;\n },\n },\n {\n // A `related` or `redirect` edge points at a path with no node — the target\n // route/page was renamed or deleted and the declaration wasn't updated.\n name: \"dead-edge\",\n severity: \"structural\",\n evaluate: (graph) =>\n graph.edges\n .filter((edge) => edge.type !== \"crumb-parent\" && !graph.nodes.has(edge.to))\n .map((edge) => ({\n path: edge.from,\n message: `${edge.type} edge from \"${edge.from}\" points at \"${edge.to}\", which is not a node in the graph.`,\n fix: `Update the ${edge.type === \"redirect\" ? \"redirectTo\" : \"related\"} target on the \"${edge.from}\" route, or restore \"${edge.to}\".`,\n })),\n },\n {\n // A content instance with no usable title can't render a legible <title> or card.\n name: \"instance-missing-title\",\n severity: \"structural\",\n evaluate: (graph) =>\n [...graph.nodes.values()]\n .filter((node) => isInstance(node) && !node.instance?.title.trim())\n .map((node) => ({\n path: node.path,\n message: `Content page \"${node.path}\" has no title.`,\n fix: \"Add a `title` to the page frontmatter.\",\n })),\n },\n {\n // The declaration asks for the page to be in the sitemap yet also marks it\n // noindex — contradictory intent. The projection resolves it (noindex wins,\n // excluded), but the declaration should say one thing.\n name: \"sitemap-noindex-contradiction\",\n severity: \"structural\",\n evaluate: (graph) =>\n [...graph.nodes.values()]\n .filter(\n (node) =>\n hasPositiveSitemap(node.policy.sitemap) &&\n node.policy.robots?.toLowerCase().includes(\"noindex\"),\n )\n .map((node) => ({\n path: node.path,\n message: `\"${node.path}\" declares a sitemap policy but its robots value is \"${node.policy.robots}\".`,\n fix: \"Drop the sitemap policy (or set `sitemap: false`) on a noindex page, or remove the noindex robots value.\",\n })),\n },\n {\n // Robots declarations are house-convention lowercase: the sitemap projection\n // matches `includes(\"noindex\")` literally, so a miscased value (\"Noindex\")\n // would silently stay sitemap-eligible. This gate makes that unrepresentable.\n name: \"robots-not-lowercase\",\n severity: \"structural\",\n evaluate: (graph) =>\n [...graph.nodes.values()]\n .filter(\n (node) =>\n node.policy.robots !== undefined &&\n node.policy.robots !== node.policy.robots.toLowerCase(),\n )\n .map((node) => ({\n path: node.path,\n message: `\"${node.path}\" declares robots \"${node.policy.robots}\" — robots values must be lowercase.`,\n fix: 'Lowercase the robots declaration (e.g. \"noindex, follow\").',\n })),\n },\n {\n // A `related` card for a route target renders from that route's `link`\n // metadata; without it the card has no title/description and renders empty.\n // (Content-instance targets render from their frontmatter, so they're exempt.)\n name: \"related-target-missing-link\",\n severity: \"structural\",\n evaluate: (graph) => {\n const linklessTargets = new Set<string>();\n for (const edge of graph.edges) {\n if (edge.type !== \"related\") continue;\n const target = graph.nodes.get(edge.to);\n if (target && target.source === \"route\" && target.policy.link === undefined) {\n linklessTargets.add(edge.to);\n }\n }\n return [...linklessTargets].map((path) => ({\n path,\n message: `Route \"${path}\" is a related-link target but declares no link metadata; its card would render empty.`,\n fix: `Add \\`link: { title, description }\\` to the \"${path}\" route's staticData.seo.`,\n }));\n },\n },\n {\n // A redirect/alias node should never advertise itself in the sitemap.\n name: \"redirect-in-sitemap\",\n severity: \"structural\",\n evaluate: (graph) =>\n [...graph.nodes.values()]\n .filter(\n (node) => node.policy.redirectTo !== undefined && hasPositiveSitemap(node.policy.sitemap),\n )\n .map((node) => ({\n path: node.path,\n message: `Redirect \"${node.path}\" (→ \"${node.policy.redirectTo}\") also declares a sitemap policy.`,\n fix: \"Remove the sitemap policy from the redirect route; only its target belongs in the sitemap.\",\n })),\n },\n {\n // Every declared date feeds the sitemap's `<lastmod>`, and the sitemap\n // projection refuses a date it cannot parse. Catch it here, at the\n // declaration, instead of as a failed sitemap request.\n name: \"invalid-date\",\n severity: \"structural\",\n evaluate: (graph) =>\n [...graph.nodes.values()].flatMap((node) => {\n const dates: Array<[string, string | undefined]> = node.instance\n ? [\n [\"publishedAt\", node.instance.publishedAt],\n [\"modifiedAt\", node.instance.modifiedAt],\n ]\n : [[\"modifiedAt\", node.policy.modifiedAt]];\n return dates.flatMap(([field, value]) =>\n value !== undefined && parseDeclaredDate(value) === undefined\n ? [\n {\n path: node.path,\n message: `${field} \"${value}\" is not an ISO 8601 date on a real calendar day.`,\n fix: `Write ${field} as an ISO 8601 date, e.g. \"2026-09-29\".`,\n },\n ]\n : [],\n );\n }),\n },\n {\n name: \"duplicate-title\",\n severity: \"editorial\",\n evaluate: (graph) =>\n [...groupInstancesBy(graph, (node) => node.instance?.title).entries()]\n .filter(([, nodes]) => nodes.length > 1)\n .flatMap(([title, nodes]) =>\n nodes.map((node) => ({\n path: node.path,\n message: `Title \"${title}\" is shared by ${nodes.length} pages.`,\n fix: \"Give each page a distinct title.\",\n })),\n ),\n },\n {\n name: \"duplicate-description\",\n severity: \"editorial\",\n evaluate: (graph) =>\n [...groupInstancesBy(graph, (node) => node.instance?.description).entries()]\n .filter(([, nodes]) => nodes.length > 1)\n .flatMap(([, nodes]) =>\n nodes.map((node) => ({\n path: node.path,\n message: `Description is shared by ${nodes.length} pages.`,\n fix: \"Write a distinct meta description for each page.\",\n })),\n ),\n },\n {\n // Meta descriptions outside ~50–160 chars either get truncated in SERPs or\n // read as too thin.\n name: \"description-length\",\n severity: \"editorial\",\n evaluate: (graph) =>\n [...graph.nodes.values()].flatMap((node) => {\n if (!isInstance(node)) return [];\n const description = node.instance?.description?.trim();\n if (!description) return [];\n if (description.length > DESCRIPTION_MAX) {\n return [\n {\n path: node.path,\n message: `Description is ${description.length} chars (max ${DESCRIPTION_MAX}); it will be truncated in results.`,\n fix: `Trim the description to ${DESCRIPTION_MAX} characters or fewer.`,\n },\n ];\n }\n if (description.length < DESCRIPTION_MIN) {\n return [\n {\n path: node.path,\n message: `Description is ${description.length} chars (min ${DESCRIPTION_MIN}); it reads as thin.`,\n fix: `Expand the description to at least ${DESCRIPTION_MIN} characters.`,\n },\n ];\n }\n return [];\n }),\n },\n];\n\n/**\n * Options for {@link checkGraph}. Freshness needs a clock, and the engine stays\n * pure, so a freshness policy is only accepted together with the `now` it is\n * judged against.\n */\nexport type CheckGraphOptions = {\n readonly coverage?: ReadonlyArray<CoverageRule> | undefined;\n} & (\n | { readonly freshness: FreshnessPolicy; readonly now: Date }\n | { readonly freshness?: undefined; readonly now?: undefined }\n);\n\n/**\n * Run every static rule against the graph, then any caller-supplied\n * {@link CoverageRule}s and freshness policy, and return the flat list of\n * violations. With no options the result is exactly the static rule set.\n */\nexport function checkGraph(graph: SeoGraph, options: CheckGraphOptions = {}): Array<Violation> {\n const violations: Array<Violation> = CHECK_RULES.flatMap((rule) =>\n rule.evaluate(graph).map((raw): Violation => ({\n severity: rule.severity,\n rule: rule.name,\n path: raw.path,\n message: raw.message,\n fix: raw.fix,\n })),\n );\n const coverage = options.coverage;\n if (coverage !== undefined && coverage.length > 0) {\n violations.push(...checkCoverage(graph, coverage));\n }\n if (options.freshness !== undefined) {\n violations.push(...checkFreshness(graph, options.freshness, options.now));\n }\n return violations;\n}\n\n/**\n * One editorial `stale-page` violation per sitemap-eligible page whose last\n * declared change is older than the policy allows. Undated pages are not\n * violations: see {@link freshnessReport} for the full picture.\n */\nexport function checkFreshness(\n graph: SeoGraph,\n policy: FreshnessPolicy,\n now: Date,\n): Array<Violation> {\n return freshnessReport(graph, policy, now).stale.map((entry) => ({\n severity: \"editorial\",\n rule: \"stale-page\",\n path: entry.path,\n message: `Last changed ${entry.lastModified.slice(0, 10)}, ${entry.ageDays} days ago (limit ${policy.maxAgeDays}).`,\n fix: \"Review the page; when its content changes, update its modifiedAt.\",\n }));\n}\n\n/** Escape a glob for `RegExp`, then expand `**`, `*`, and `?` to path-aware forms. */\nexport const globToRegExp = (glob: string): RegExp => {\n const escaped = glob.replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const source = escaped\n .replace(/\\*\\*/g, \"\\u0000\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/\\?/g, \"[^/]\")\n .replace(/\\u0000/g, \".*\");\n return new RegExp(`^${source}$`);\n};\n\n/**\n * The minimal view a coverage rule needs: which paths exist (for the glob), which\n * of them are sitemap-eligible (the enforced set), and how many contextual links\n * each receives. Declared and rendered coverage differ only in how this surface\n * is built, so the rule engine itself stays single-sourced.\n */\ninterface CoverageSurface {\n readonly paths: ReadonlyArray<string>;\n readonly eligiblePaths: ReadonlyArray<string>;\n readonly inbound: (path: string) => number;\n}\n\n/**\n * Enforce contextual-link coverage rules over an explicit surface.\n *\n * A rule that matches no sitemap-eligible page is itself a violation: a typo or\n * a rule aimed at a noindex page would otherwise pass silently forever.\n */\nconst checkCoverageRules = (\n surface: CoverageSurface,\n rules: ReadonlyArray<CoverageRule>,\n): Array<Violation> => {\n const violations: Array<Violation> = [];\n for (const rule of rules) {\n const matcher = globToRegExp(rule.path);\n const matched = surface.paths.filter((path) => matcher.test(path));\n const eligible = surface.eligiblePaths.filter((path) => matcher.test(path));\n\n if (eligible.length === 0) {\n violations.push({\n severity: \"structural\",\n rule: \"coverage-rule-unmatched\",\n message:\n matched.length === 0\n ? `Coverage rule \"${rule.path}\" matches no page in the graph.`\n : `Coverage rule \"${rule.path}\" matches only pages that are not sitemap-eligible.`,\n fix: \"Point the rule at a sitemap-eligible path, or drop it.\",\n });\n continue;\n }\n\n for (const path of eligible) {\n const inbound = surface.inbound(path);\n if (inbound >= rule.minInbound) continue;\n violations.push({\n severity: \"structural\",\n rule: \"inbound-link-coverage\",\n path,\n message: `\"${path}\" has ${inbound} incoming contextual link(s); the coverage rule requires ${rule.minInbound}.`,\n fix: `Add ${rule.minInbound - inbound} contextual link(s) pointing at \"${path}\".`,\n });\n }\n }\n return violations;\n};\n\n/** The sitemap-eligible path set of a declared graph, in graph insertion order. */\nconst eligiblePathsOf = (graph: SeoGraph): ReadonlyArray<string> =>\n [...graph.nodes.values()].filter(isSitemapEligible).map((node) => node.path);\n\n/**\n * Enforce contextual-link coverage against the *declared* graph: only `related`\n * edges count — breadcrumb ancestry is navigation, not context.\n */\nexport function checkCoverage(\n graph: SeoGraph,\n rules: ReadonlyArray<CoverageRule>,\n): Array<Violation> {\n return checkCoverageRules(\n {\n paths: [...graph.nodes.keys()],\n eligiblePaths: eligiblePathsOf(graph),\n inbound: (path) =>\n graph.edges.filter((edge) => edge.type === \"related\" && edge.to === path).length,\n },\n rules,\n );\n}\n\n/**\n * Enforce contextual-link coverage against the *rendered* graph: only same-origin\n * body-region anchors count. Nav, header, and footer anchors are site chrome, so\n * a page linked solely from them has no contextual inbound link — the same\n * distinction the declared pass draws by counting `related` edges alone.\n *\n * The target universe is the declared graph's sitemap-eligible pages: the globs\n * in `seo.config.ts` are written against declared paths, and the crawl is what\n * supplies the served edges. Pass the crawl's `internalEdges` (each edge carries\n * its `region`).\n */\nexport function checkRenderedCoverage(\n graph: SeoGraph,\n renderedEdges: ReadonlyArray<LinkEdge>,\n rules: ReadonlyArray<CoverageRule>,\n): Array<Violation> {\n const inbound = new Map<string, number>();\n for (const edge of renderedEdges) {\n if (edge.region !== \"body\") continue;\n inbound.set(edge.to, (inbound.get(edge.to) ?? 0) + 1);\n }\n return checkCoverageRules(\n {\n paths: [...graph.nodes.keys()],\n eligiblePaths: eligiblePathsOf(graph),\n inbound: (path) => inbound.get(path) ?? 0,\n },\n rules,\n );\n}\n\n/** Structural violations fail `pagegraph check`; editorial-only stays green. */\nexport const hasStructuralViolations = (violations: ReadonlyArray<Violation>): boolean =>\n violations.some((violation) => violation.severity === \"structural\");\n","/**\n * Read a rendered `<head>` and validate it: title, meta\n * (description/robots/og/twitter), canonical link, and `application/ld+json`\n * blocks, with a minimal per-type JSON-LD check.\n *\n * This is the pure half of `pagegraph inspect --live` — the half worth having on its\n * own. The CLI fetches a URL and hands the body here; a test suite can render a\n * page and hand *that* here, asserting the head it actually ships. Both get the\n * same verdict, because it is the same function.\n *\n * No HTML-parsing dependency, by design: a `<head>` is small and well-formed, so\n * string/regex scanning is enough, and the package's core stays zero-dependency\n * (which is also why the object guard below is hand-rolled — `effect/Predicate`\n * is not reachable from this entry). It is honest about its limits: it does not\n * build a DOM, so exotic markup (commented-out tags, CDATA, attributes spanning\n * constructs) is out of scope. This validates *rendered output*, not arbitrary\n * HTML.\n *\n * `issues` are blocking: a non-empty list makes `pagegraph inspect --live` exit 1.\n * Required tags are `<title>`, `meta[name=description]`, and\n * `link[rel=canonical]`; any JSON-LD that fails to parse or fails its minimal\n * schema is also blocking.\n */\n\nexport interface JsonLdReport {\n type: string;\n valid: boolean;\n errors: Array<string>;\n}\n\nexport interface LiveHeadReport {\n url: string;\n status: number;\n title?: string | undefined;\n description?: string | undefined;\n canonical?: string | undefined;\n robots?: string | undefined;\n og: Record<string, string>;\n twitter: Record<string, string>;\n jsonLd: Array<JsonLdReport>;\n issues: Array<string>;\n}\n\nconst ENTITIES: Record<string, string> = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n \""\": '\"',\n \"'\": \"'\",\n \"'\": \"'\",\n};\n\nconst decodeEntities = (value: string): string =>\n value.replace(/&(?:amp|lt|gt|quot|#39|apos);/g, (match) => ENTITIES[match] ?? match);\n\n/** Pull double/single-quoted attributes off a single tag string. */\nconst parseAttrs = (tag: string): Record<string, string> => {\n const attrs: Record<string, string> = {};\n const re = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/g;\n let match: RegExpExecArray | null;\n while ((match = re.exec(tag)) !== null) {\n attrs[match[1]!.toLowerCase()] = decodeEntities(match[2] ?? match[3] ?? \"\");\n }\n return attrs;\n};\n\n/** Normalize a JSON-LD `@type` (string or array) to a single readable label. */\nconst typeName = (value: unknown): string => {\n if (typeof value === \"string\") return value;\n if (Array.isArray(value))\n return value.filter((v) => typeof v === \"string\").join(\", \") || \"unknown\";\n return \"unknown\";\n};\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n // NOTE: This zero-dependency core entry cannot import Effect; JSON-LD validation happens immediately after this shallow narrowing.\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Flatten a parsed JSON-LD payload (single object, array, or `@graph`) to items. */\nconst collectItems = (parsed: unknown): Array<Record<string, unknown>> => {\n if (Array.isArray(parsed)) return parsed.filter(isObject);\n if (isObject(parsed)) {\n if (Array.isArray(parsed[\"@graph\"])) return parsed[\"@graph\"].filter(isObject);\n return [parsed];\n }\n return [];\n};\n\nconst countQuestions = (mainEntity: unknown): number => {\n if (!Array.isArray(mainEntity)) return 0;\n return mainEntity.filter((entry) => isObject(entry) && typeName(entry[\"@type\"]) === \"Question\")\n .length;\n};\n\nconst validateItemListElements = (value: unknown): Array<string> => {\n if (!Array.isArray(value) || value.length < 1) {\n return [\"ItemList needs at least one `itemListElement` entry.\"];\n }\n const errors: Array<string> = [];\n value.forEach((entry, index) => {\n if (!isObject(entry) || typeName(entry[\"@type\"]) !== \"ListItem\") {\n errors.push(`ItemList entry ${index + 1} is not a ListItem.`);\n return;\n }\n if (entry[\"position\"] !== index + 1) {\n errors.push(`ItemList entry ${index + 1} has an invalid position.`);\n }\n if (!entry[\"name\"] || !entry[\"url\"]) {\n errors.push(`ItemList entry ${index + 1} needs a name and URL.`);\n }\n });\n return errors;\n};\n\n/** Minimal per-type validation — enough to catch an empty or malformed block. */\nconst validateItem = (item: Record<string, unknown>): JsonLdReport => {\n const type = typeName(item[\"@type\"]);\n const errors: Array<string> = [];\n\n if (type === \"Article\" || type === \"NewsArticle\" || type === \"BlogPosting\") {\n if (!item[\"headline\"]) errors.push(\"Article is missing `headline`.\");\n if (!item[\"datePublished\"]) errors.push(\"Article is missing `datePublished`.\");\n } else if (type === \"FAQPage\") {\n if (countQuestions(item[\"mainEntity\"]) < 1) {\n errors.push(\"FAQPage needs at least one Question in `mainEntity`.\");\n }\n } else if (type === \"BreadcrumbList\") {\n const items = item[\"itemListElement\"];\n if (!Array.isArray(items) || items.length < 2) {\n errors.push(\"BreadcrumbList needs at least two `itemListElement` entries.\");\n }\n } else if (type === \"ItemList\") {\n errors.push(...validateItemListElements(item[\"itemListElement\"]));\n const items = item[\"itemListElement\"];\n if (Array.isArray(items) && item[\"numberOfItems\"] !== items.length) {\n errors.push(\"ItemList `numberOfItems` does not match its entries.\");\n }\n }\n\n return { type, valid: errors.length === 0, errors };\n};\n\nconst validateLdJson = (raw: string): Array<JsonLdReport> => {\n let parsed: unknown;\n // NOTE: JSON.parse boundary: converts the native parse throw into an unparseable JsonLdReport value in a pure sync validator\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n return [\n {\n type: \"unparseable\",\n valid: false,\n errors: [`JSON parse error: ${cause instanceof Error ? cause.message : String(cause)}`],\n },\n ];\n }\n const items = collectItems(parsed);\n if (items.length === 0) {\n return [{ type: \"unknown\", valid: false, errors: [\"No JSON-LD object found in block.\"] }];\n }\n return items.map(validateItem);\n};\n\n/** Parse a rendered HTML document's `<head>` into a report. Pure. */\nexport const inspectHtml = (url: string, status: number, html: string): LiveHeadReport => {\n const headMatch = html.match(/<head[^>]*>([\\s\\S]*?)<\\/head>/i);\n const head = headMatch ? headMatch[1]! : html;\n\n const titleMatch = head.match(/<title[^>]*>([\\s\\S]*?)<\\/title>/i);\n const title = titleMatch ? decodeEntities(titleMatch[1]!.trim()) : undefined;\n\n const og: Record<string, string> = {};\n const twitter: Record<string, string> = {};\n let description: string | undefined;\n let robots: string | undefined;\n\n for (const tag of head.match(/<meta\\b[^>]*>/gi) ?? []) {\n const attrs = parseAttrs(tag);\n const content = attrs[\"content\"];\n if (content === undefined) continue;\n const property = attrs[\"property\"];\n const name = attrs[\"name\"];\n if (property?.startsWith(\"og:\")) og[property] = content;\n else if (name?.startsWith(\"twitter:\")) twitter[name] = content;\n else if (name === \"description\") description = content;\n else if (name === \"robots\") robots = content;\n }\n\n let canonical: string | undefined;\n for (const tag of head.match(/<link\\b[^>]*>/gi) ?? []) {\n const attrs = parseAttrs(tag);\n if (attrs[\"rel\"] === \"canonical\") canonical = attrs[\"href\"];\n }\n\n const jsonLd: Array<JsonLdReport> = [];\n const scriptRe = /<script\\b[^>]*type=[\"']application\\/ld\\+json[\"'][^>]*>([\\s\\S]*?)<\\/script>/gi;\n let scriptMatch: RegExpExecArray | null;\n while ((scriptMatch = scriptRe.exec(head)) !== null) {\n jsonLd.push(...validateLdJson(scriptMatch[1]!.trim()));\n }\n\n const issues: Array<string> = [];\n if (status >= 400) issues.push(`Fetch returned HTTP ${status}.`);\n if (!title) issues.push(\"Missing <title>.\");\n if (!description) issues.push(\"Missing meta description.\");\n if (!canonical) issues.push(\"Missing canonical link.\");\n for (const block of jsonLd) {\n if (!block.valid)\n issues.push(...block.errors.map((error) => `JSON-LD (${block.type}): ${error}`));\n }\n\n return { url, status, title, description, canonical, robots, og, twitter, jsonLd, issues };\n};\n\n/** A non-empty `issues` list fails `pagegraph inspect --live` (exit 1). */\nexport const hasBlockingIssues = (report: LiveHeadReport): boolean => report.issues.length > 0;\n","/**\n * Pure link-graph utilities: read anchors out of rendered HTML, model the\n * rendered graph, compute homepage depth, and diff it against the declared\n * graph. Effect- and framework-free so it runs in the CLI, a Worker, or a test\n * on the same data.\n *\n * This is the \"served HTML\" half of the SEO graph: the declared graph describes\n * intent, this describes what a crawler actually receives.\n */\n\n/** Where an anchor sits in the document, coarsely. */\nexport type AnchorRegion = \"nav\" | \"footer\" | \"header\" | \"body\";\n\nexport interface Anchor {\n readonly href: string;\n readonly text: string;\n readonly region: AnchorRegion;\n /** True when the resolved target shares the page's origin. */\n readonly internal: boolean;\n}\n\nexport interface LinkEdge {\n readonly from: string;\n readonly to: string;\n readonly region: AnchorRegion;\n}\n\nexport interface RenderedGraph {\n /** Every same-origin page path the crawl rendered, in first-seen order. */\n readonly nodes: ReadonlyArray<string>;\n readonly edges: ReadonlyArray<LinkEdge>;\n readonly internalEdges: ReadonlyArray<LinkEdge>;\n /** Same-origin body-region edges: the contextual surface. */\n readonly contextualEdges: ReadonlyArray<LinkEdge>;\n /** Same-origin pages with no incoming internal edge (\"reachable only via nav\" is not implied). */\n readonly orphans: ReadonlyArray<string>;\n readonly depthByPath: ReadonlyMap<string, number>;\n readonly maxDepth: number | null;\n}\n\nconst REGION_TAGS = new Set([\"nav\", \"footer\", \"header\"]);\n\nconst TOKEN =\n /<(\\/?)(nav|footer|header)\\b[^>]*>|<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi;\n\n// A real `href` attribute is preceded by whitespace (or the tag's start). The\n// boundary keeps `data-href`, `xhref`, and similar attributes from reading as\n// links, and stops a decoy from winning over a genuine `href`.\nconst HREF = /(?:^|\\s)href\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/i;\n\nconst BASE_TAG = /<base\\b[^>]*>/gi;\n\nconst NON_NAVIGABLE = /^(?:#|mailto:|tel:|javascript:|data:)/i;\n\nconst stripTags = (value: string): string => value.replace(/<[^>]*>/g, \" \");\n\nconst decodeEntities = (value: string): string =>\n value\n .replace(/ /gi, \" \")\n .replace(/&/gi, \"&\")\n .replace(/</gi, \"<\")\n .replace(/>/gi, \">\")\n .replace(/"/gi, \"\\\"\")\n .replace(/'|'/gi, \"'\");\n\nconst anchorText = (value: string): string =>\n decodeEntities(stripTags(value)).replace(/\\s+/g, \" \").trim();\n\n/** Normalize a same-origin URL to the graph's path key (no query/hash; \"/\" preserved). */\nexport const normalizePath = (url: URL): string => {\n const path = url.pathname.replace(/\\/+$/, \"\");\n return path === \"\" ? \"/\" : path;\n};\n\nconst hrefValue = (attributes: string): string | undefined => {\n const match = HREF.exec(attributes);\n if (match === null) return undefined;\n return match[1] ?? match[2] ?? match[3];\n};\n\n/**\n * The document base URL. Browsers use the first `<base>` element that has an\n * `href` attribute and ignore every later one, so a `<base>` carrying only\n * `target` is skipped, but the first `<base href>` wins even when its value is\n * empty (it then resolves to the document URL) or invalid (the base is ignored,\n * resolving to the document URL). With no `<base href>` at all, links resolve\n * against the response URL.\n */\nconst documentBase = (html: string, responseUrl: URL): URL => {\n BASE_TAG.lastIndex = 0;\n let tag: RegExpExecArray | null;\n while ((tag = BASE_TAG.exec(html)) !== null) {\n const href = hrefValue(tag[0]);\n if (href === undefined) continue;\n if (href.length === 0) return responseUrl;\n try {\n return new URL(href, responseUrl);\n } catch {\n return responseUrl;\n }\n }\n return responseUrl;\n};\n\n/**\n * Extract every anchor in document order, tagging each with the region tag it\n * sits inside. Anchor text keeps only its letters and a coarse entity decode;\n * this is a classifier input, not a renderer.\n */\nexport const extractAnchors = (html: string, baseUrl: string): ReadonlyArray<Anchor> => {\n const base = new URL(baseUrl);\n const resolutionBase = documentBase(html, base);\n const regions: Array<AnchorRegion> = [];\n const anchors: Array<Anchor> = [];\n TOKEN.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = TOKEN.exec(html)) !== null) {\n const closing = match[1];\n const regionTag = match[2];\n if (regionTag !== undefined) {\n const region = regionTag.toLowerCase() as AnchorRegion;\n if (closing === \"/\") {\n const index = regions.lastIndexOf(region);\n if (index !== -1) regions.splice(index, 1);\n } else {\n regions.push(region);\n }\n continue;\n }\n const attributes = match[3];\n const raw = hrefValue(attributes);\n if (raw === undefined || raw.length === 0 || NON_NAVIGABLE.test(raw)) continue;\n let resolved: URL;\n try {\n resolved = new URL(raw, resolutionBase);\n } catch {\n continue;\n }\n if (resolved.protocol !== \"http:\" && resolved.protocol !== \"https:\") continue;\n const region = regions.length === 0 ? \"body\" : regions[regions.length - 1]!;\n anchors.push({\n href: resolved.href,\n text: anchorText(match[4] ?? \"\"),\n region,\n internal: resolved.origin === base.origin,\n });\n }\n return anchors;\n};\n\nexport interface RenderedPage {\n readonly url: string;\n readonly anchors: ReadonlyArray<Anchor>;\n}\n\nconst breadthFirstDepth = (\n edges: ReadonlyArray<LinkEdge>,\n root: string,\n): ReadonlyMap<string, number> => {\n const adjacency = new Map<string, Set<string>>();\n for (const edge of edges) {\n const targets = adjacency.get(edge.from) ?? new Set<string>();\n targets.add(edge.to);\n adjacency.set(edge.from, targets);\n }\n const depth = new Map<string, number>([[root, 0]]);\n const queue: Array<string> = [root];\n while (queue.length > 0) {\n const current = queue.shift()!;\n const currentDepth = depth.get(current)!;\n for (const next of adjacency.get(current) ?? []) {\n if (depth.has(next)) continue;\n depth.set(next, currentDepth + 1);\n queue.push(next);\n }\n }\n return depth;\n};\n\n/**\n * Assemble a {@link RenderedGraph} from page/edge sets. Edges are already\n * same-origin and path-keyed by the callers, so this is the shared, pure tail of\n * {@link buildRenderedGraph} and {@link renderedGraphFromEdges}.\n */\nconst graphFromEdges = (\n nodes: Set<string>,\n edges: Array<LinkEdge>,\n root: string,\n): RenderedGraph => {\n const rootKey = root.replace(/\\/+$/, \"\") || \"/\";\n const internalEdges = edges;\n const contextualEdges = edges.filter((edge) => edge.region === \"body\");\n const incoming = new Set(internalEdges.map((edge) => edge.to));\n const orphans = [...nodes].filter((path) => path !== rootKey && !incoming.has(path)).sort();\n const depthByPath = breadthFirstDepth(internalEdges, rootKey);\n let maxDepth: number | null = null;\n for (const value of depthByPath.values()) {\n if (maxDepth === null || value > maxDepth) maxDepth = value;\n }\n return {\n nodes: [...nodes],\n edges,\n internalEdges,\n contextualEdges,\n orphans,\n depthByPath,\n maxDepth,\n };\n};\n\n/**\n * Build the rendered graph from crawled pages. `origin` fixes the graph's\n * same-origin boundary — pages and anchors on another origin are dropped, not\n * silently folded in — and `root` is the normalized path the depth BFS starts\n * from (the seed's final path when the homepage redirected). Every page path is\n * keyed the way the declared graph keys its routes.\n */\nexport const buildRenderedGraph = (\n origin: string,\n pages: ReadonlyArray<RenderedPage>,\n root: string = \"/\",\n): RenderedGraph => {\n const originUrl = new URL(origin);\n const graphOrigin = originUrl.origin;\n const edges: Array<LinkEdge> = [];\n const nodes = new Set<string>();\n for (const page of pages) {\n let pageUrl: URL;\n try {\n pageUrl = new URL(page.url);\n } catch {\n continue;\n }\n if (pageUrl.origin !== graphOrigin) continue;\n const path = normalizePath(pageUrl);\n nodes.add(path);\n for (const anchor of page.anchors) {\n let targetUrl: URL;\n try {\n targetUrl = new URL(anchor.href);\n } catch {\n continue;\n }\n if (targetUrl.origin !== graphOrigin) continue;\n const target = normalizePath(targetUrl);\n if (target === path) continue;\n edges.push({ from: path, to: target, region: anchor.region });\n }\n }\n return graphFromEdges(nodes, edges, root);\n};\n\n/** A URL or an already-normalized graph path key both collapse to the path key. */\nconst pathKeyOf = (value: string): string => {\n try {\n return normalizePath(new URL(value));\n } catch {\n const pathname = value.split(/[?#]/, 1)[0] ?? \"\";\n return pathname.replace(/\\/+$/, \"\") || \"/\";\n }\n};\n\n/**\n * Rebuild a {@link RenderedGraph} from a rendered-edge set alone — the artifact\n * `pagegraph links verify --emit-rendered` writes. Path keys are normalized the\n * same way as a crawl, and `nodes` carries the rendered page paths the artifact\n * recorded, so an edge-less page (a redirect target with no internal links) stays\n * a node and its orphan/depth report survives replay. Without `nodes` the node set\n * falls back to the edge endpoints.\n */\nexport const renderedGraphFromEdges = (\n edges: ReadonlyArray<LinkEdge>,\n root: string = \"/\",\n nodes: ReadonlyArray<string> = [],\n): RenderedGraph => {\n const nodeSet = new Set(nodes.map(pathKeyOf));\n const kept: Array<LinkEdge> = [];\n for (const edge of edges) {\n const from = pathKeyOf(edge.from);\n const to = pathKeyOf(edge.to);\n nodeSet.add(from);\n nodeSet.add(to);\n kept.push({ from, to, region: edge.region });\n }\n return graphFromEdges(nodeSet, kept, root);\n};\n\nexport interface SimpleEdge {\n readonly from: string;\n readonly to: string;\n}\n\nexport interface LinkGraphDiff {\n /** Declared internal edges with no matching rendered anchor. */\n readonly declaredNotRendered: ReadonlyArray<SimpleEdge>;\n /** Rendered contextual edges that no declared edge accounts for. */\n readonly renderedNotDeclared: ReadonlyArray<SimpleEdge>;\n readonly declaredCount: number;\n readonly renderedContextualCount: number;\n}\n\nconst edgeKey = (edge: SimpleEdge): string => `${edge.from}\\u0000${edge.to}`;\n\nconst normalizeEdge = (edge: SimpleEdge): SimpleEdge => ({\n from: edge.from === \"\" ? \"/\" : edge.from.replace(/\\/+$/, \"\") || \"/\",\n to: edge.to === \"\" ? \"/\" : edge.to.replace(/\\/+$/, \"\") || \"/\",\n});\n\n/**\n * Diff rendered contextual edges against declared `related`/`crumb` edges. Both\n * sides are path-keyed; the diff is directional and reports each direction\n * separately because they call for different fixes.\n */\nexport const diffLinkGraph = (\n declared: ReadonlyArray<SimpleEdge>,\n rendered: RenderedGraph,\n): LinkGraphDiff => {\n const declaredNormalized = declared.map(normalizeEdge);\n const declaredKeys = new Set(declaredNormalized.map(edgeKey));\n const renderedKeys = new Set(rendered.contextualEdges.map(edgeKey));\n const declaredNotRendered = declaredNormalized.filter(\n (edge) => !renderedKeys.has(edgeKey(edge)),\n );\n const renderedNotDeclared = rendered.internalEdges\n .filter((edge) => edge.region === \"body\")\n .map((edge) => normalizeEdge(edge))\n .filter((edge) => !declaredKeys.has(edgeKey(edge)));\n return {\n declaredNotRendered,\n renderedNotDeclared,\n declaredCount: declaredNormalized.length,\n renderedContextualCount: rendered.contextualEdges.length,\n };\n};\n\n/** A page the crawl could not render; its outgoing anchors are absent. */\nexport interface RenderedEdgeFailure {\n readonly url: string;\n readonly error: string;\n}\n\n/**\n * Provenance for a rendered-edge artifact: enough to trust the edges and to\n * refuse a gate that would assert on an incomplete crawl. `root` is the seed's\n * normalized final path (its post-redirect path), so depth and orphans rebuild\n * exactly as the crawl computed them.\n */\nexport interface RenderedEdgeArtifactCrawl {\n /** Pages whose HTML was rendered into `edges`. */\n readonly pages: number;\n /** Normalized final path of the seed — the depth BFS root. */\n readonly root: string;\n /** The crawl's page budget (`--limit`). */\n readonly limit: number;\n /** True when discovery outran `limit`; a gate must not assert on this. */\n readonly truncated: boolean;\n /** True when any captured body was cut at `--max-body-bytes`. */\n readonly bodyTruncated: boolean;\n /** URLs whose captured body was cut; anchors past the cutoff are missing. */\n readonly truncatedPages: ReadonlyArray<string>;\n /** Pages that failed to fetch; their outgoing anchors are missing. */\n readonly failures: ReadonlyArray<RenderedEdgeFailure>;\n /** Non-HTML responses from link-only discovery; these do not hide HTML pages. */\n readonly nonHtml?: ReadonlyArray<{ readonly url: string; readonly finalUrl: string; readonly contentType: string }>;\n readonly discoveryFailures?: ReadonlyArray<RenderedEdgeFailure>;\n readonly skipped?: ReadonlyArray<string>;\n readonly sitemapTruncated?: boolean;\n readonly sitemapUsed?: boolean;\n}\n\n/**\n * The stable, `decodeRenderedEdges`-compatible artifact `pagegraph links verify\n * --emit-rendered` writes and `--rendered` reads. It carries the raw served edges\n * (with `region`), the rendered page paths, and the provenance a coverage gate\n * needs to decide whether the crawl is trustworthy, so one crawl can be asserted\n * repeatedly without re-fetching.\n */\nexport interface RenderedEdgeArtifact {\n readonly kind: \"links-rendered\";\n readonly schemaVersion: 1;\n readonly origin: string;\n readonly seed: string;\n readonly crawl: RenderedEdgeArtifactCrawl;\n /** Normalized paths of every rendered page — replay's node set. */\n readonly nodes: ReadonlyArray<string>;\n readonly edges: ReadonlyArray<LinkEdge>;\n}\n\n/** The rendered-edge artifact schema this package writes and accepts. */\nexport const RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION = 1 as const;\n\nconst ARTIFACT_KIND = \"links-rendered\";\n\nconst REGIONS: ReadonlySet<string> = new Set([\"nav\", \"footer\", \"header\", \"body\"]);\n\nconst decodeArtifactEdges = (input: unknown): ReadonlyArray<LinkEdge> => {\n if (!Array.isArray(input)) {\n throw new Error(\"`edges` must be an array of { from, to, region } edges\");\n }\n return input.map((item) => {\n if (item === null || typeof item !== \"object\") {\n throw new Error(\"each artifact 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 artifact edge must have string `from` and `to`\");\n }\n if (region !== undefined && !REGIONS.has(region as string)) {\n throw new Error(\n `artifact edge region must be one of nav, footer, header, body (received ${JSON.stringify(region)})`,\n );\n }\n return { from, to, region: (region as AnchorRegion | undefined) ?? \"body\" };\n });\n};\n\nconst decodeArtifactNodes = (input: unknown): ReadonlyArray<string> => {\n if (input === undefined) return [];\n if (!Array.isArray(input) || !input.every((path) => typeof path === \"string\")) {\n throw new Error(\"rendered-edge artifact `nodes` must be an array of paths\");\n }\n return input;\n};\n\nconst decodeArtifactFailures = (input: unknown): ReadonlyArray<RenderedEdgeFailure> => {\n if (input === undefined) return [];\n if (!Array.isArray(input)) {\n throw new Error(\"rendered-edge artifact `crawl.failures` must be an array\");\n }\n return input.map((item) => {\n if (item === null || typeof item !== \"object\") {\n throw new Error(\"each artifact failure must be an object with string `url` and `error`\");\n }\n const { url, error } = item as { url?: unknown; error?: unknown };\n if (typeof url !== \"string\" || typeof error !== \"string\") {\n throw new Error(\"each artifact failure must have string `url` and `error`\");\n }\n return { url, error };\n });\n};\n\nconst requiredAbsoluteUrl = (value: unknown, field: string): string => {\n if (typeof value !== \"string\" || value === \"\") {\n throw new Error(`rendered-edge artifact must carry a non-empty string \\`${field}\\``);\n }\n try {\n void new URL(value);\n } catch {\n throw new Error(\n `rendered-edge artifact \\`${field}\\` must be an absolute URL (received ${JSON.stringify(value)})`,\n );\n }\n return value;\n};\n\nconst requiredInteger = (value: unknown, field: string, minimum: number): number => {\n if (!Number.isSafeInteger(value) || (value as number) < minimum) {\n throw new Error(\n `rendered-edge artifact \\`${field}\\` must be an integer >= ${minimum} (received ${JSON.stringify(value)})`,\n );\n }\n return value as number;\n};\n\n/**\n * Decode a rendered-edge artifact from user input. Throws on any other shape —\n * this is user input, not a provider payload. `root`, `bodyTruncated`,\n * `truncatedPages`, `failures`, and `nodes` are optional so a hand-written edge\n * dump that only carries provenance can still be replayed.\n */\nexport const decodeRenderedEdgeArtifact = (input: unknown): RenderedEdgeArtifact => {\n if (input === null || typeof input !== \"object\") {\n throw new Error(\"rendered-edge artifact must be an object\");\n }\n const value = input as Record<string, unknown>;\n if (value[\"kind\"] !== ARTIFACT_KIND) {\n throw new Error(\n `rendered-edge artifact \\`kind\\` must be \"${ARTIFACT_KIND}\" (received ${JSON.stringify(value[\"kind\"])})`,\n );\n }\n if (value[\"schemaVersion\"] !== RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION) {\n throw new Error(\n `unsupported rendered-edge artifact schemaVersion: ${JSON.stringify(value[\"schemaVersion\"])}`,\n );\n }\n const origin = requiredAbsoluteUrl(value[\"origin\"], \"origin\");\n const seed = requiredAbsoluteUrl(value[\"seed\"], \"seed\");\n const crawl = value[\"crawl\"];\n if (crawl === null || typeof crawl !== \"object\") {\n throw new Error(\"rendered-edge artifact must carry a `crawl` object\");\n }\n const provenance = crawl as Record<string, unknown>;\n const truncatedPages = provenance[\"truncatedPages\"];\n if (\n truncatedPages !== undefined &&\n (!Array.isArray(truncatedPages) || !truncatedPages.every((url) => typeof url === \"string\"))\n ) {\n throw new Error(\"rendered-edge artifact `truncatedPages` must be an array of URLs\");\n }\n const bodyTruncated = provenance[\"bodyTruncated\"];\n if (bodyTruncated !== undefined && typeof bodyTruncated !== \"boolean\") {\n throw new Error(\"rendered-edge artifact `bodyTruncated` must be a boolean\");\n }\n if (typeof provenance[\"truncated\"] !== \"boolean\") {\n throw new Error(\"rendered-edge artifact `crawl.truncated` must be a boolean\");\n }\n const skipped = provenance[\"skipped\"];\n if (skipped !== undefined && (!Array.isArray(skipped) || !skipped.every((url) => typeof url === \"string\"))) {\n throw new Error(\"rendered-edge artifact `crawl.skipped` must be an array of URLs\");\n }\n const nonHtml = provenance[\"nonHtml\"];\n if (nonHtml !== undefined && (!Array.isArray(nonHtml) || !nonHtml.every((item) =>\n item !== null && typeof item === \"object\" &&\n typeof item.url === \"string\" && typeof item.finalUrl === \"string\" && typeof item.contentType === \"string\"\n ))) {\n throw new Error(\"rendered-edge artifact `crawl.nonHtml` must be an array of { url, finalUrl, contentType }\");\n }\n if (Array.isArray(nonHtml)) {\n for (const item of nonHtml) {\n requiredAbsoluteUrl(item.url, \"crawl.nonHtml.url\");\n requiredAbsoluteUrl(item.finalUrl, \"crawl.nonHtml.finalUrl\");\n }\n }\n for (const field of [\"sitemapTruncated\", \"sitemapUsed\"] as const) {\n if (provenance[field] !== undefined && typeof provenance[field] !== \"boolean\") {\n throw new Error(`rendered-edge artifact \\`crawl.${field}\\` must be a boolean`);\n }\n }\n return {\n kind: ARTIFACT_KIND,\n schemaVersion: RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION,\n origin,\n seed,\n crawl: {\n pages: requiredInteger(provenance[\"pages\"], \"crawl.pages\", 0),\n root: typeof provenance[\"root\"] === \"string\" ? provenance[\"root\"] : pathKeyOf(seed),\n limit: requiredInteger(provenance[\"limit\"], \"crawl.limit\", 1),\n truncated: provenance[\"truncated\"],\n bodyTruncated: bodyTruncated === true,\n truncatedPages: (truncatedPages as ReadonlyArray<string> | undefined) ?? [],\n failures: decodeArtifactFailures(provenance[\"failures\"]),\n ...(nonHtml === undefined ? {} : { nonHtml: nonHtml as ReadonlyArray<{ url: string; finalUrl: string; contentType: string }> }),\n ...(provenance[\"discoveryFailures\"] === undefined ? {} : { discoveryFailures: decodeArtifactFailures(provenance[\"discoveryFailures\"]) }),\n ...(skipped === undefined ? {} : { skipped: skipped as ReadonlyArray<string> }),\n ...(provenance[\"sitemapTruncated\"] === undefined ? {} : { sitemapTruncated: provenance[\"sitemapTruncated\"] as boolean }),\n ...(provenance[\"sitemapUsed\"] === undefined ? {} : { sitemapUsed: provenance[\"sitemapUsed\"] as boolean }),\n },\n nodes: decodeArtifactNodes(value[\"nodes\"]),\n edges: decodeArtifactEdges(value[\"edges\"]),\n };\n};\n","/**\n * Content checks over server-rendered HTML: headings, structured data against\n * visible text, word count, and declared-vs-rendered robots and canonical.\n *\n * These run on rendered documents, not on the route graph, because the facts\n * they judge do not exist in a declaration: headings come from components, JSON-LD\n * and the `<title>` are composed by `head()` at render time, and the visible text\n * is whatever the page's components produce. The graph supplies the other half —\n * which pages are indexable and what their canonical path and robots policy are —\n * so the declared-vs-rendered rules can say \"this page drifted from its\n * declaration\".\n *\n * Like `inspectHtml`, this is pure string scanning of rendered output with no\n * HTML-parsing dependency, and it keeps the core entry zero-dependency. It reads\n * server-rendered markup, which is what a crawler receives before any script runs;\n * text a client inserts after hydration is invisible here, and is reported as such.\n */\n\nimport type { Severity, Violation } from \"./checks\";\nimport { globToRegExp } from \"./checks\";\nimport type { SeoGraph, SeoNode } from \"./graph\";\nimport { inspectHtml } from \"./inspect-html\";\nimport { normalizePath } from \"./links\";\nimport { isSitemapEligible } from \"./projections\";\n\nexport interface Heading {\n readonly level: number;\n readonly text: string;\n}\n\n/** A JSON-LD object that carries an `@type`, found at any depth of any block. */\nexport type JsonLdNode = Readonly<Record<string, unknown>>;\n\n/** What a rendered document says, reduced to the fields the content rules read. */\nexport interface PageContent {\n readonly title: string | undefined;\n readonly description: string | undefined;\n readonly robots: string | undefined;\n readonly canonical: string | undefined;\n /** Every H1 in the body, in document order, by accessible text. */\n readonly h1: ReadonlyArray<string>;\n /** Headings in the main content region (`<main>`, else the body without nav and footer). */\n readonly outline: ReadonlyArray<Heading>;\n /** Words of visible text in the main content region. */\n readonly wordCount: number;\n /** Visible body text with whitespace collapsed; scripts, styles, and templates removed. */\n readonly text: string;\n /** Every typed JSON-LD node on the page, flattened out of arrays, `@graph`, and nesting. */\n readonly jsonLd: ReadonlyArray<JsonLdNode>;\n}\n\nexport type ContentRuleName =\n | \"missing-h1\"\n | \"multiple-h1\"\n | \"empty-h1\"\n | \"heading-level-skip\"\n | \"h1-title-mismatch\"\n | \"faq-not-visible\"\n | \"offer-price-not-visible\"\n | \"webpage-head-mismatch\"\n | \"thin-content\";\n\nexport interface ContentFinding {\n readonly rule: ContentRuleName;\n readonly severity: Severity;\n readonly message: string;\n readonly fix: string;\n}\n\nexport interface ContentCheckOptions {\n /** Minimum words of main-region text; omit to skip the `thin-content` rule. */\n readonly minWords?: number | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Extraction\n// ---------------------------------------------------------------------------\n\nconst NAMED_ENTITIES: Record<string, string> = {\n amp: \"&\",\n lt: \"<\",\n gt: \">\",\n quot: '\"',\n apos: \"'\",\n nbsp: \" \",\n ndash: \"–\",\n mdash: \"—\",\n lsquo: \"‘\",\n rsquo: \"’\",\n ldquo: \"“\",\n rdquo: \"”\",\n hellip: \"…\",\n middot: \"·\",\n bull: \"•\",\n copy: \"©\",\n reg: \"®\",\n trade: \"™\",\n times: \"×\",\n euro: \"€\",\n pound: \"£\",\n};\n\nconst decodeEntities = (value: string): string =>\n value.replace(/&(#x[0-9a-f]+|#\\d+|[a-z]+);/gi, (entity, code: string) => {\n if (code.startsWith(\"#\")) {\n const point =\n code[1] === \"x\" || code[1] === \"X\"\n ? Number.parseInt(code.slice(2), 16)\n : Number.parseInt(code.slice(1), 10);\n return Number.isInteger(point) && point > 0 && point <= 0x10ffff\n ? String.fromCodePoint(point)\n : entity;\n }\n return NAMED_ENTITIES[code.toLowerCase()] ?? entity;\n });\n\n/** Elements whose contents a reader never sees as page text. */\nconst INVISIBLE = /<(script|style|template|noscript|svg)\\b[\\s\\S]*?<\\/\\1\\s*>/gi;\nconst COMMENT = /<!--[\\s\\S]*?-->/g;\n\nconst withoutInvisible = (html: string): string =>\n html.replace(COMMENT, \" \").replace(INVISIBLE, \" \");\n\nconst textOf = (html: string): string =>\n decodeEntities(html.replace(/<[^>]*>/g, \" \"))\n .replace(/\\s+/g, \" \")\n .trim();\n\nconst attributeOf = (tag: string, name: string): string | undefined => {\n const match = new RegExp(`(?:^|\\\\s)${name}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`, \"i\").exec(\n tag,\n );\n const value = match?.[1] ?? match?.[2] ?? match?.[3];\n return value === undefined ? undefined : decodeEntities(value);\n};\n\nconst bodyOf = (html: string): string => {\n const body = /<body\\b[^>]*>([\\s\\S]*)<\\/body>/i.exec(html);\n if (body) return body[1]!;\n return html.replace(/<head\\b[^>]*>[\\s\\S]*?<\\/head>/i, \" \");\n};\n\n/**\n * The main content region: `<main>` when the page has one, otherwise the body\n * without its `<nav>` and `<footer>` blocks. Site chrome repeats on every page,\n * so counting its headings or words would judge the layout, not the page.\n */\nconst mainRegionOf = (body: string): string => {\n const main = /<main\\b[^>]*>([\\s\\S]*?)<\\/main\\s*>/i.exec(body);\n if (main) return main[1]!;\n return body.replace(/<(nav|footer)\\b[\\s\\S]*?<\\/\\1\\s*>/gi, \" \");\n};\n\nconst HEADING = /<h([1-6])\\b([^>]*)>([\\s\\S]*?)<\\/h\\1\\s*>/gi;\n\n/**\n * A heading's accessible text: its content, else its `aria-label`, else the\n * `alt` of images inside it (a logo H1).\n */\nconst headingText = (attributes: string, inner: string): string => {\n const text = textOf(inner);\n if (text !== \"\") return text;\n const label = attributeOf(attributes, \"aria-label\")?.trim();\n if (label) return label;\n return [...inner.matchAll(/<img\\b[^>]*>/gi)]\n .map((image) => attributeOf(image[0], \"alt\")?.trim() ?? \"\")\n .filter(Boolean)\n .join(\" \");\n};\n\nconst headingsOf = (html: string): Array<Heading> =>\n [...html.matchAll(HEADING)].map((match) => ({\n level: Number(match[1]),\n text: headingText(match[2]!, match[3]!),\n }));\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n // NOTE: This zero-dependency core entry cannot import Effect; JSON-LD is untyped input narrowed field by field below.\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** Every object with an `@type`, at any depth — offers nest in products, questions in FAQ pages. */\nconst collectTyped = (value: unknown, into: Array<JsonLdNode>): void => {\n if (Array.isArray(value)) {\n for (const entry of value) collectTyped(entry, into);\n return;\n }\n if (!isRecord(value)) return;\n if (value[\"@type\"] !== undefined) into.push(value);\n for (const child of Object.values(value)) collectTyped(child, into);\n};\n\nconst JSON_LD = /<script\\b[^>]*type\\s*=\\s*[\"']application\\/ld\\+json[\"'][^>]*>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n/** Parse every JSON-LD block. A block that does not parse is `inspectHtml`'s finding, not ours. */\nconst jsonLdOf = (html: string): Array<JsonLdNode> => {\n const nodes: Array<JsonLdNode> = [];\n for (const match of html.matchAll(JSON_LD)) {\n let parsed: unknown;\n // NOTE: JSON.parse boundary: an unparseable block is skipped here; inspectHtml reports it.\n try {\n parsed = JSON.parse(match[1]!.trim());\n } catch {\n continue;\n }\n collectTyped(parsed, nodes);\n }\n return nodes;\n};\n\n/**\n * Text normalized for \"does this appear on the page\" comparisons: Unicode-folded,\n * lowercased, and reduced to runs of letters and digits. Punctuation, quotes,\n * dashes, and markup spacing differ freely between JSON-LD and rendered copy\n * without changing what a reader sees.\n */\nexport const matchText = (value: string): string =>\n value\n .normalize(\"NFKC\")\n .toLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean)\n .join(\" \");\n\nconst countWords = (text: string): number => {\n const normalized = matchText(text);\n return normalized === \"\" ? 0 : normalized.split(\" \").length;\n};\n\n/** Reduce a rendered HTML document to the fields the content rules read. Pure. */\nexport const extractPageContent = (html: string): PageContent => {\n const head = inspectHtml(\"\", 200, html);\n const body = withoutInvisible(bodyOf(html));\n const main = mainRegionOf(body);\n return {\n title: head.title,\n description: head.description,\n robots: head.robots,\n canonical: head.canonical,\n h1: headingsOf(body)\n .filter((heading) => heading.level === 1)\n .map((heading) => heading.text),\n outline: headingsOf(main),\n wordCount: countWords(textOf(main)),\n text: textOf(body),\n jsonLd: jsonLdOf(html),\n };\n};\n\n// ---------------------------------------------------------------------------\n// Rules\n// ---------------------------------------------------------------------------\n\nconst typesOf = (node: JsonLdNode): Array<string> => {\n const type = node[\"@type\"];\n if (typeof type === \"string\") return [type];\n if (Array.isArray(type)) return type.filter((entry): entry is string => typeof entry === \"string\");\n return [];\n};\n\nconst hasType = (node: JsonLdNode, types: ReadonlySet<string>): boolean =>\n typesOf(node).some((type) => types.has(type));\n\nconst stringField = (node: JsonLdNode, field: string): string | undefined => {\n const value = node[field];\n return typeof value === \"string\" && value.trim() !== \"\" ? value : undefined;\n};\n\n/** JSON-LD text may carry the HTML Google allows in answers; compare its text. */\nconst jsonLdText = (value: string): string => textOf(value);\n\nconst isVisible = (visible: string, candidate: string): boolean => {\n const needle = matchText(jsonLdText(candidate));\n return needle === \"\" || ` ${visible} `.includes(` ${needle} `);\n};\n\nconst clip = (value: string, max = 80): string =>\n value.length > max ? `${value.slice(0, max - 1)}…` : value;\n\nconst STOPWORDS = new Set(\n \"a an and are as at be but by can for from get has have how in into is it its more not of on or our per than that the their this to use via vs was what when who why will with you your\".split(\n \" \",\n ),\n);\n\n/**\n * Terms that carry meaning, reduced to a crude stem: stopwords drop, a plural\n * `s` folds, and long words compare by their first six letters, so\n * \"Authentication\" and \"Authenticate\" or \"templates\" and \"template\" agree. The\n * rule only asks whether any term is shared, so a lenient stem errs toward\n * silence, never toward a false warning.\n */\nconst significantTerms = (value: string): Set<string> =>\n new Set(\n matchText(value)\n .split(\" \")\n .filter((term) => term !== \"\" && !STOPWORDS.has(term) && (term.length > 2 || /\\d/.test(term)))\n .map((term) => (term.length > 3 && term.endsWith(\"s\") ? term.slice(0, -1) : term))\n .map((term) => term.slice(0, 6)),\n );\n\n/** schema.org `WebPage` and the subtypes whose `name`/`description` describe the page itself. */\nconst WEB_PAGE_TYPES: ReadonlySet<string> = new Set([\n \"WebPage\",\n \"AboutPage\",\n \"CheckoutPage\",\n \"CollectionPage\",\n \"ContactPage\",\n \"FAQPage\",\n \"ItemPage\",\n \"MedicalWebPage\",\n \"ProfilePage\",\n \"QAPage\",\n \"RealEstateListing\",\n \"SearchResultsPage\",\n]);\n\nconst OFFER_TYPES: ReadonlySet<string> = new Set([\"Offer\", \"AggregateOffer\"]);\nconst FAQ_TYPES: ReadonlySet<string> = new Set([\"FAQPage\"]);\n\nconst asArray = (value: unknown): Array<unknown> =>\n value === undefined ? [] : Array.isArray(value) ? value : [value];\n\n/** Parse a schema.org price (`19`, `\"19.00\"`, `\"1,000\"`); undefined when it is not a number. */\nconst parsePrice = (value: unknown): number | undefined => {\n if (typeof value === \"number\") return Number.isFinite(value) ? value : undefined;\n if (typeof value !== \"string\") return undefined;\n const cleaned = value.replace(/[^\\d.]/g, \"\");\n if (cleaned === \"\" || !/^\\d*\\.?\\d+$/.test(cleaned)) return undefined;\n return Number(cleaned);\n};\n\nconst pricesOf = (offer: JsonLdNode): Array<number> =>\n [\n offer[\"price\"],\n offer[\"lowPrice\"],\n offer[\"highPrice\"],\n ...asArray(offer[\"priceSpecification\"]).flatMap((spec) =>\n isRecord(spec) ? [spec[\"price\"], spec[\"minPrice\"], spec[\"maxPrice\"]] : [],\n ),\n ].flatMap((value) => {\n const price = parsePrice(value);\n return price === undefined ? [] : [price];\n });\n\n/**\n * Whether a price appears as a number in the visible text: `19` matches `$19`,\n * `19.00`, and `19/mo`; `1000` matches `1,000`; `0.5` matches `0.50`. A price of\n * zero also matches the word \"free\".\n */\nexport const priceIsVisible = (price: number, text: string): boolean => {\n if (price === 0 && /\\bfree\\b/i.test(text)) return true;\n const [whole, fraction = \"\"] = String(price).split(\".\");\n const grouped = whole!.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \"[,.\\\\u00a0 ]?\");\n const decimals = fraction === \"\" ? \"(?:[.,]0+)?\" : `[.,]${fraction}0*`;\n return new RegExp(`(?<![\\\\d.,])${grouped}${decimals}(?![\\\\d]|[.,]\\\\d)`).test(text);\n};\n\n/**\n * Whether a JSON-LD `name` agrees with the rendered `<title>`. A title usually\n * wraps the page name in a site-name affix (\"Pricing | Example\"), so either\n * containing the other counts as agreement.\n */\nconst namesAgree = (a: string, b: string): boolean => {\n const left = matchText(a);\n const right = matchText(b);\n if (left === \"\" || right === \"\") return true;\n return ` ${left} `.includes(` ${right} `) || ` ${right} `.includes(` ${left} `);\n};\n\ninterface ContentRule {\n readonly name: ContentRuleName;\n readonly severity: Severity;\n readonly evaluate: (\n content: PageContent,\n options: ContentCheckOptions,\n ) => ReadonlyArray<{ readonly message: string; readonly fix: string }>;\n}\n\n/**\n * Every content rule, in one place. Heading-count and structured-data rules that\n * Google treats as eligibility or policy problems are structural; outline and\n * wording smells are editorial.\n */\nconst CONTENT_RULES: ReadonlyArray<ContentRule> = [\n {\n name: \"missing-h1\",\n severity: \"structural\",\n evaluate: (content) =>\n content.h1.length === 0\n ? [\n {\n message: \"Page has no H1.\",\n fix: \"Render exactly one <h1> that names the page's topic.\",\n },\n ]\n : [],\n },\n {\n name: \"multiple-h1\",\n severity: \"structural\",\n evaluate: (content) =>\n content.h1.length > 1\n ? [\n {\n message: `Page has ${content.h1.length} H1s: ${content.h1.map((text) => `\"${clip(text, 40)}\"`).join(\", \")}.`,\n fix: \"Keep one <h1> for the page topic; demote the others to <h2>.\",\n },\n ]\n : [],\n },\n {\n name: \"empty-h1\",\n severity: \"structural\",\n evaluate: (content) =>\n content.h1.some((text) => text === \"\")\n ? [\n {\n message: \"An H1 has no text, aria-label, or image alt.\",\n fix: \"Give the <h1> visible text that names the page's topic.\",\n },\n ]\n : [],\n },\n {\n // The outline starts under the page's H1, so a first heading of h3 is a\n // skip just as h2 → h4 is. Going back up any number of levels is fine.\n name: \"heading-level-skip\",\n severity: \"editorial\",\n evaluate: (content) => {\n const skips: Array<string> = [];\n let previous = 1;\n for (const heading of content.outline) {\n if (heading.level > previous + 1) {\n skips.push(`h${previous} → h${heading.level} \"${clip(heading.text, 40)}\"`);\n }\n previous = heading.level;\n }\n return skips.length === 0\n ? []\n : [\n {\n message: `Heading levels skip ${skips.length} time(s): ${skips.slice(0, 3).join(\"; \")}${skips.length > 3 ? \"; …\" : \"\"}.`,\n fix: \"Nest headings one level at a time; style a heading with CSS, not by choosing a deeper level.\",\n },\n ];\n },\n },\n {\n name: \"h1-title-mismatch\",\n severity: \"editorial\",\n evaluate: (content) => {\n const [h1] = content.h1;\n if (content.h1.length !== 1 || !h1 || !content.title) return [];\n const title = significantTerms(content.title);\n const shared = [...significantTerms(h1)].some((term) => title.has(term));\n return shared\n ? []\n : [\n {\n message: `H1 \"${clip(h1, 60)}\" shares no significant term with the title \"${clip(content.title, 60)}\".`,\n fix: \"Make the H1 and <title> describe the same topic; a searcher who clicks the title should recognize the page.\",\n },\n ];\n },\n },\n {\n name: \"faq-not-visible\",\n severity: \"structural\",\n evaluate: (content) => {\n const visible = matchText(content.text);\n return content.jsonLd\n .filter((node) => hasType(node, FAQ_TYPES))\n .flatMap((faq) => asArray(faq[\"mainEntity\"]))\n .filter(isRecord)\n .flatMap((question) => {\n const name = stringField(question, \"name\");\n const answers = asArray(question[\"acceptedAnswer\"])\n .filter(isRecord)\n .flatMap((answer) => {\n const text = stringField(answer, \"text\");\n return text === undefined ? [] : [text];\n });\n const missing = [\n ...(name !== undefined && !isVisible(visible, name) ? [\"question\"] : []),\n ...(answers.some((answer) => !isVisible(visible, answer)) ? [\"answer\"] : []),\n ];\n return missing.length === 0\n ? []\n : [\n {\n message: `FAQPage ${missing.join(\" and \")} for \"${clip(name ?? \"(unnamed)\", 70)}\" is not in the rendered page text.`,\n fix: \"Render every FAQ question and answer in the server HTML, or drop the entry from the FAQPage JSON-LD.\",\n },\n ];\n });\n },\n },\n {\n name: \"offer-price-not-visible\",\n severity: \"structural\",\n evaluate: (content) =>\n content.jsonLd\n .filter((node) => hasType(node, OFFER_TYPES))\n .flatMap((offer) => {\n const hidden = pricesOf(offer).filter((price) => !priceIsVisible(price, content.text));\n if (hidden.length === 0) return [];\n const currency = stringField(offer, \"priceCurrency\");\n const label = stringField(offer, \"name\") ?? typesOf(offer).join(\", \");\n return [\n {\n message: `${label} price ${hidden.map((price) => `${price}${currency ? ` ${currency}` : \"\"}`).join(\", \")} does not appear in the rendered page text.`,\n fix: \"Show the offer's price in the server-rendered copy, or correct the JSON-LD price.\",\n },\n ];\n }),\n },\n {\n name: \"webpage-head-mismatch\",\n severity: \"editorial\",\n evaluate: (content) =>\n content.jsonLd\n .filter((node) => hasType(node, WEB_PAGE_TYPES))\n .flatMap((page) => {\n const findings: Array<{ message: string; fix: string }> = [];\n const name = stringField(page, \"name\");\n if (name !== undefined && content.title && !namesAgree(name, content.title)) {\n findings.push({\n message: `${typesOf(page).join(\", \")} name \"${clip(name, 60)}\" does not match the title \"${clip(content.title, 60)}\".`,\n fix: \"Derive the JSON-LD name from the same value as the <title>.\",\n });\n }\n const description = stringField(page, \"description\");\n if (\n description !== undefined &&\n content.description &&\n matchText(description) !== matchText(content.description)\n ) {\n findings.push({\n message: `${typesOf(page).join(\", \")} description differs from the meta description.`,\n fix: \"Derive the JSON-LD description from the same value as the meta description.\",\n });\n }\n return findings;\n }),\n },\n {\n name: \"thin-content\",\n severity: \"editorial\",\n evaluate: (content, options) =>\n options.minWords !== undefined && content.wordCount < options.minWords\n ? [\n {\n message: `Main content has ${content.wordCount} words (min ${options.minWords}).`,\n fix: \"Answer the page's search intent in more depth, or merge it into a stronger page.\",\n },\n ]\n : [],\n },\n];\n\n/** Run every content rule against one rendered page. Graph-independent; pure. */\nexport const checkPageContent = (\n content: PageContent,\n options: ContentCheckOptions = {},\n): Array<ContentFinding> =>\n CONTENT_RULES.flatMap((rule) =>\n rule.evaluate(content, options).map((raw) => ({\n rule: rule.name,\n severity: rule.severity,\n message: raw.message,\n fix: raw.fix,\n })),\n );\n\n// ---------------------------------------------------------------------------\n// Rendered pages against the declared graph\n// ---------------------------------------------------------------------------\n\n/** A word-count floor for sitemap-eligible pages matching a path glob. */\nexport interface WordCountRule {\n /** Path glob: `*` matches within a segment, `**` matches across segments. */\n readonly path: string;\n readonly minWords: number;\n}\n\n/** Project policy for rendered content checks. */\nexport interface ContentPolicy {\n /** Word-count floors; a page matching several rules must meet the highest. */\n readonly minWords?: ReadonlyArray<WordCountRule> | undefined;\n}\n\n/** One declared page as the server rendered it, or why it could not be read. */\nexport type RenderedDocument =\n | {\n readonly path: string;\n readonly ok: true;\n /** Path of the final response URL, after redirects, encoded or not. */\n readonly finalPath: string;\n readonly html: string;\n }\n | { readonly path: string; readonly ok: false; readonly error: string };\n\nconst declaresNoindex = (node: SeoNode): boolean =>\n node.policy.robots?.toLowerCase().includes(\"noindex\") === true;\n\n/**\n * The declared pages a rendered check fetches: every sitemap-eligible page,\n * plus concrete pages that declare `noindex` so the rendered robots meta can be\n * held to that declaration. Param templates and redirects render no page of\n * their own.\n */\nexport const renderedCheckTargets = (graph: SeoGraph): Array<string> =>\n [...graph.nodes.values()]\n .filter(\n (node) =>\n isSitemapEligible(node) ||\n (declaresNoindex(node) &&\n node.policy.redirectTo === undefined &&\n !node.path.includes(\"$\")),\n )\n .map((node) => node.path);\n\nconst PATH_BASE = \"https://pagegraph.invalid\";\n\n/**\n * A path as a URL serializes it (`/café` → `/caf%C3%A9`), trailing slash\n * dropped. Declared paths, response URLs, and canonicals are compared in this\n * one form, or a page with non-ASCII segments would read as redirected.\n */\nconst urlPath = (value: string): string | undefined => {\n try {\n return normalizePath(new URL(value, PATH_BASE));\n } catch {\n return undefined;\n }\n};\n\n/**\n * Judge rendered documents against the declared graph. Every indexable page must\n * render, stay on its path, keep a self-referencing canonical and indexable\n * robots meta, and pass {@link checkPageContent}; a page that declares `noindex`\n * must render a `noindex` robots meta.\n *\n * Robots are read from the `<meta name=\"robots\">` tag only. An `X-Robots-Tag`\n * header is usually host policy (preview hosts noindex everything), so holding\n * pages to it would fail every local run for a reason no declaration controls.\n */\nexport function checkRenderedContent(\n graph: SeoGraph,\n documents: ReadonlyArray<RenderedDocument>,\n policy: ContentPolicy = {},\n): Array<Violation> {\n const violations: Array<Violation> = [];\n const push = (\n rule: string,\n severity: Severity,\n path: string,\n message: string,\n fix: string,\n ): void => {\n violations.push({ rule, severity, path, message, fix });\n };\n\n const wordRules = (policy.minWords ?? []).map((rule) => ({\n rule,\n matcher: globToRegExp(rule.path),\n }));\n const eligible = [...graph.nodes.values()].filter(isSitemapEligible).map((node) => node.path);\n for (const { rule, matcher } of wordRules) {\n if (!eligible.some((path) => matcher.test(path))) {\n violations.push({\n severity: \"structural\",\n rule: \"content-rule-unmatched\",\n message: `Word-count rule \"${rule.path}\" matches no sitemap-eligible page.`,\n fix: \"Point the rule at a sitemap-eligible path, or drop it.\",\n });\n }\n }\n\n for (const document of documents) {\n const node = graph.nodes.get(document.path);\n if (node === undefined) continue;\n const declaredPath = urlPath(document.path);\n if (!document.ok) {\n push(\n \"rendered-page-unavailable\",\n \"structural\",\n document.path,\n `Could not read the rendered page: ${document.error}.`,\n \"Serve the declared page with a 2xx HTML response.\",\n );\n continue;\n }\n if (urlPath(document.finalPath) !== declaredPath) {\n push(\n \"rendered-page-unavailable\",\n \"structural\",\n document.path,\n `Rendered page redirects to \"${document.finalPath}\".`,\n \"Declare the redirect with `redirectTo`, or serve the page at its declared path.\",\n );\n continue;\n }\n\n const content = extractPageContent(document.html);\n const renderedNoindex = content.robots?.toLowerCase().includes(\"noindex\") === true;\n const indexable = isSitemapEligible(node);\n\n if (!indexable) {\n if (!renderedNoindex) {\n push(\n \"rendered-robots-mismatch\",\n \"structural\",\n document.path,\n `Declared robots \"${node.policy.robots}\" but the rendered page has ${content.robots ? `robots \"${content.robots}\"` : \"no robots meta\"}.`,\n \"Render the declared robots value in the page's <meta name=\\\"robots\\\">.\",\n );\n }\n continue;\n }\n\n if (renderedNoindex) {\n push(\n \"rendered-robots-mismatch\",\n \"structural\",\n document.path,\n `Page is in the sitemap but renders robots \"${content.robots}\".`,\n \"Drop the noindex from the rendered head, or declare the page noindex and remove its sitemap policy.\",\n );\n }\n\n const canonical = content.canonical === undefined ? undefined : urlPath(content.canonical);\n if (canonical !== declaredPath) {\n push(\n \"rendered-canonical-mismatch\",\n \"structural\",\n document.path,\n content.canonical === undefined\n ? \"Rendered page has no canonical link.\"\n : `Rendered canonical \"${content.canonical}\" does not point at \"${document.path}\".`,\n \"Render a self-referencing canonical for every indexable page.\",\n );\n }\n\n const floors = wordRules.filter(({ matcher }) => matcher.test(document.path));\n const minWords =\n floors.length === 0 ? undefined : Math.max(...floors.map(({ rule }) => rule.minWords));\n for (const finding of checkPageContent(content, { minWords })) {\n push(finding.rule, finding.severity, document.path, finding.message, finding.fix);\n }\n }\n return violations;\n}\n"],"mappings":";AA8CA,MAAM,aAAa,UACjB,MACG,QAAQ,MAAM,OAAO,CAAC,CACtB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,QAAQ,CAAC,CACvB,QAAQ,MAAM,QAAQ;;;;;;AAO3B,SAAgB,kBAAkB,MAAwB;CACxD,IAAI,KAAK,O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AAU,KAClD,iFACF;GACA;EACF;EAEA,MAAM,UAAU,mBAAmB,SAAS,IAAI;EAChD,MAAM,kBAAkB,QAAQ,QAAQ,YAAY,CAAC,CAAC,SAAS,SAAS,MAAM;EAG9E,IAAI,CAFc,kBAAkB,IAEvB,GAAG;GACd,IAAI,CAAC,iBACH,KACE,4BACA,cACA,SAAS,MACT,oBAAoB,KAAK,OAAO,OAAO,8BAA8B,QAAQ,SAAS,WAAW,QAAQ,OAAO,KAAK,iBAAiB,IACtI,wEACF;GAEF;EACF;EAEA,IAAI,iBACF,KACE,4BACA,cACA,SAAS,MACT,8CAA8C,QAAQ,OAAO,KAC7D,qGACF;EAIF,KADkB,QAAQ,cAAc,KAAA,IAAY,KAAA,IAAY,QAAQ,QAAQ,SAAS,OACvE,cAChB,KACE,+BACA,cACA,SAAS,MACT,QAAQ,cAAc,KAAA,IAClB,yCACA,uBAAuB,QAAQ,UAAU,uBAAuB,SAAS,KAAK,KAClF,+DACF;EAGF,MAAM,SAAS,UAAU,QAAQ,EAAE,cAAc,QAAQ,KAAK,SAAS,IAAI,CAAC;EAC5E,MAAM,WACJ,OAAO,WAAW,IAAI,KAAA,IAAY,KAAK,IAAI,GAAG,OAAO,KAAK,EAAE,WAAW,KAAK,QAAQ,CAAC;EACvF,KAAK,MAAM,WAAW,iBAAiB,SAAS,EAAE,SAAS,CAAC,GAC1D,KAAK,QAAQ,MAAM,QAAQ,UAAU,SAAS,MAAM,QAAQ,SAAS,QAAQ,GAAG;CAEpF;CACA,OAAO;AACT"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
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
2
|
import { AnyRouter } from "@tanstack/react-router";
|
|
3
3
|
//#region src/core/projections.d.ts
|
|
4
4
|
interface ProjectionConfig {
|
|
@@ -42,9 +42,16 @@ interface NodeReport {
|
|
|
42
42
|
*/
|
|
43
43
|
declare function isSitemapEligible(node: SeoNode): boolean;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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.
|
|
48
55
|
* `indexable` is intentionally unused — the sitemap body is host-independent;
|
|
49
56
|
* robots.txt is what gates crawling.
|
|
50
57
|
*/
|
|
@@ -83,8 +90,10 @@ interface LinkCandidateOptions {
|
|
|
83
90
|
readonly limit?: number;
|
|
84
91
|
/** Restrict to these clusters; a filter may be a section or a bare kind. */
|
|
85
92
|
readonly clusters?: ReadonlyArray<string>;
|
|
86
|
-
/** Anchors already served in HTML
|
|
87
|
-
readonly renderedEdges?: ReadonlyArray<SimpleEdge
|
|
93
|
+
/** Anchors already served in HTML. Only body-region edges exclude their own direction. */
|
|
94
|
+
readonly renderedEdges?: ReadonlyArray<SimpleEdge & {
|
|
95
|
+
readonly region?: AnchorRegion;
|
|
96
|
+
}>;
|
|
88
97
|
}
|
|
89
98
|
/** One cluster and how many candidate pairs it contributes (before `limit`). */
|
|
90
99
|
interface LinkClusterSummary {
|
|
@@ -118,7 +127,9 @@ declare const generateLinkCandidates: (graph: SeoGraph, options?: LinkCandidateO
|
|
|
118
127
|
* `{ from, to }` edges, or an object carrying `edges` (or `internalEdges`).
|
|
119
128
|
* Throws on any other shape — this is user input, not a provider payload.
|
|
120
129
|
*/
|
|
121
|
-
declare const decodeRenderedEdges: (input: unknown) => ReadonlyArray<SimpleEdge
|
|
130
|
+
declare const decodeRenderedEdges: (input: unknown) => ReadonlyArray<SimpleEdge & {
|
|
131
|
+
readonly region?: AnchorRegion;
|
|
132
|
+
}>;
|
|
122
133
|
//#endregion
|
|
123
134
|
//#region src/core/inspect-html.d.ts
|
|
124
135
|
/**
|
|
@@ -181,5 +192,5 @@ declare const hasBlockingIssues: (report: LiveHeadReport) => boolean;
|
|
|
181
192
|
*/
|
|
182
193
|
declare function resolveRouteLink(router: AnyRouter, path: string): RouteSeo["link"];
|
|
183
194
|
//#endregion
|
|
184
|
-
export { type Anchor, type AnchorRegion, type BuildSeoGraphInput, type CoverageRule, type JsonLdReport, type LinkCandidateOptions, type LinkCandidatePair, type LinkCandidateResult, type LinkClusterSummary, type LinkEdge, type LinkGraphDiff, type LiveHeadReport, type NodeReport, type ProjectionConfig, type PublicPath, RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION, type Register, 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, buildRenderedGraph, buildSeoGraph, candidateSourceText, checkCoverage, checkGraph, checkRenderedCoverage, contentSignal, decodeRenderedEdgeArtifact, decodeRenderedEdges, diffLinkGraph, extractAnchors, generateLinkCandidates, hasBlockingIssues, hasStructuralViolations, inspectHtml, inspectNode, isSitemapEligible, matchesClusterFilter, normalizePath, renderRobots, renderSitemap, renderedGraphFromEdges, resolveRouteLink, undirectedEdgeKey };
|
|
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 };
|
|
185
196
|
//# sourceMappingURL=index.d.ts.map
|