pagegraph 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -10434,7 +10434,7 @@ const runWith = (command, config) => {
10434
10434
  };
10435
10435
  //#endregion
10436
10436
  //#region package.json
10437
- var version = "0.15.0";
10437
+ var version = "0.15.1";
10438
10438
  //#endregion
10439
10439
  //#region node_modules/effect/dist/cli/Argument.js
10440
10440
  /**
@@ -431,8 +431,15 @@ const PLUGIN_NAME = "pagegraph";
431
431
  const RESOLVED_RUNTIME_ID = `\0virtual:pagegraph/runtime`;
432
432
  const ENTRY_ID = "virtual:pagegraph/entry";
433
433
  const RESOLVED_ENTRY_ID = `\0${ENTRY_ID}`;
434
- /** The runtime entry imports the virtual module, so dep pre-bundling must leave it to this plugin. */
434
+ /**
435
+ * Entries dep pre-bundling must leave to this plugin. The runtime entries import the virtual
436
+ * module. `pagegraph` and `pagegraph/react` share module state with them (the capture context
437
+ * and the `defineFacts` registry): a pre-bundled copy gives pages a second instance, and a
438
+ * capture then records no sections or resolves no facts.
439
+ */
435
440
  const RUNTIME_ENTRIES = [
441
+ "pagegraph",
442
+ "pagegraph/react",
436
443
  "pagegraph/tanstack-start/server",
437
444
  "pagegraph/tanstack-start/markdown",
438
445
  "pagegraph/tanstack-start/react"
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["PageDocumentSchema","GRAPH_ENVIRONMENT"],"sources":["../../src/tanstack-start/routes.ts","../../src/tanstack-start/graph.ts","../../src/markdown/schema.ts","../../src/tanstack-start/persist-markdown.ts","../../src/tanstack-start/source.ts","../../src/tanstack-start/plugin.ts","../../src/tanstack-start/load.ts"],"sourcesContent":["/**\n * Route discovery for the graph: the router's own generator parses the routes\n * directory (the same parse `routeTree.gen.ts` comes from), into memory only.\n */\n\nimport { resolve } from \"node:path\";\n\nimport { Generator, getConfig, type RouteNode } from \"@tanstack/router-generator\";\n\nimport { inMemoryWriteFs } from \"../vite/route-config\";\n\nexport interface ScannedRoutes {\n /** `__root.tsx`. */\n readonly root: RouteNode;\n /** Top-level route nodes, each with its `children`. */\n readonly tree: ReadonlyArray<RouteNode>;\n /** Every route node, flat. */\n readonly nodes: ReadonlyArray<RouteNode>;\n}\n\nexport async function scanRoutes(root: string, routesDirectory: string): Promise<ScannedRoutes> {\n const cacheDirectory = resolve(root, \"node_modules/.cache/pagegraph\");\n let scanned: ScannedRoutes | undefined;\n const config = getConfig(\n {\n routesDirectory: resolve(root, routesDirectory),\n generatedRouteTree: resolve(cacheDirectory, \"route-tree.gen.ts\"),\n tmpDir: resolve(cacheDirectory, \"tmp\"),\n disableTypes: true,\n enableRouteTreeFormatting: false,\n disableLogging: true,\n plugins: [\n {\n name: \"pagegraph:scan\",\n onRouteTreeChanged({ routeTree, routeNodes, rootRouteNode }) {\n scanned = { root: rootRouteNode, tree: routeTree, nodes: routeNodes };\n },\n },\n ],\n },\n root,\n );\n const memory = inMemoryWriteFs(config.generatedRouteTree);\n await new Generator({ config, root, fs: memory.fs }).run();\n if (scanned === undefined) {\n throw new Error(`pagegraph found no route tree in ${resolve(root, routesDirectory)}`);\n }\n return scanned;\n}\n","/**\n * Build the graph from the app's own modules, evaluated in the `pagegraph`\n * Vite environment: one module per route file that declares `staticData`, plus\n * the app's collections module. Never the route tree, which reaches every\n * route — including app routes that only resolve inside the server runtime.\n */\n\nimport { relative, resolve } from \"node:path\";\n\nimport type { ClaimsOptions } from \"../decide/families/claims\";\n\nimport type { RouteNode } from \"@tanstack/router-generator\";\n\nimport { globToRegExp } from \"../core/checks\";\nimport { buildSeoGraph, type OgImageResolver, type SeoCollection, type SeoGraph, type SeoRouteNode } from \"../core/graph\";\nimport type { RobotsConfig } from \"../core/projections\";\nimport type { SiteRuntime } from \"../config/vite-graph-loader\";\nimport { deriveRouteConfig, resolveOptions, type SeoRouteConfigOptions } from \"../vite/route-config\";\nimport { scanRoutes, type ScannedRoutes } from \"./routes\";\nimport { decodeFacts, type Facts } from \"../markdown/facts\";\n\n/** The robots.txt policy a build serves; `origin` and indexability come from {@link SiteRuntime}. */\nexport type RobotsPolicy = Pick<RobotsConfig, \"disallow\" | \"contentSignal\" | \"directives\">;\n\n/** The graph and the site runtime one evaluation produces. */\nexport interface AppGraph {\n readonly graph: SeoGraph;\n readonly site: SiteRuntime;\n readonly markdown: { readonly origin: string } | null;\n readonly facts: Facts | undefined;\n}\n\nexport type { SiteRuntime };\n\nexport interface PagegraphOptions {\n /** This build's canonical origin, no trailing slash, e.g. `https://example.com`. */\n readonly origin: string;\n /** Fallback social image; use the same resolver in createSeo. */\n readonly ogImage?: OgImageResolver | undefined;\n /**\n * Whether this build's host may be indexed. A non-indexable build serves a\n * disallow-all robots.txt with no Sitemap line. Defaults to `true`.\n */\n readonly indexable?: boolean | undefined;\n readonly robots?:\n | {\n /** Path prefixes disallowed on an indexable host, beyond the route-config exclusions. */\n readonly disallow?: ReadonlyArray<string> | undefined;\n /** `Content-Signal` value for an indexable host, e.g. `\"search=yes, ai-input=yes, ai-train=yes\"`. */\n readonly contentSignal?: string | undefined;\n /** Extra lines in the `User-agent: *` group on an indexable host. */\n readonly directives?: ReadonlyArray<string> | undefined;\n }\n | undefined;\n /**\n * Root-relative module whose `collections` export is a `SeoCollection[]`, or a\n * function returning one (sync or async). It runs in the app's Vite pipeline,\n * so content virtual modules (Fumadocs, MDX) and path aliases resolve.\n */\n readonly collections?: string | undefined;\n /** Canonical origin for rendered documents; serverEntry is relative to the Vite root. */\n readonly markdown?: { readonly origin: string; readonly serverEntry?: string | undefined } | undefined;\n /** Committed claims answers gate the rendered documents and graph heads at build time. */\n readonly claims?: ClaimsOptions | undefined;\n /** Root-relative module exporting the code-owned document facts. */\n readonly facts?: string | undefined;\n /**\n * Route files (globs relative to the routes directory) never evaluated for the\n * graph: app surfaces that declare `staticData` but import server-runtime-only\n * modules. Their paths stay out of the graph.\n */\n readonly exclude?: ReadonlyArray<string> | undefined;\n /** Relative to the Vite root. Defaults to `src/routes`. */\n readonly routesDirectory?: string | undefined;\n /**\n * Generate the route-config module and enforce per-group SEO coverage (the\n * `seoRouteConfig` gate). Its robots exclusions join `robots.disallow`.\n */\n readonly routeConfig?: Omit<SeoRouteConfigOptions, \"routesDirectory\"> | undefined;\n}\n\n/** Imports a module through the `pagegraph` environment's module runner. */\nexport interface GraphModuleRunner {\n import(url: string): Promise<Record<string, unknown>>;\n}\n\n\nconst GRAPH_ROUTE_TYPES = new Set([\"__root\", \"static\", \"layout\", \"pathless_layout\"]);\n\nconst messageOf = (cause: unknown): string => (cause instanceof Error ? cause.message : String(cause));\n\nconst routeStaticData = (module: Record<string, unknown>, file: string): SeoRouteNode[\"options\"][\"staticData\"] => {\n const route = module[\"Route\"] as { options?: SeoRouteNode[\"options\"] } | undefined;\n if (route?.options === undefined) throw new Error(`${file} has no \\`Route\\` export`);\n const data = route.options.staticData;\n return data === undefined ? undefined : { seo: data.seo, markdown: data.markdown, llms: data.llms };\n};\n\nconst loadCollections = async (\n runner: GraphModuleRunner,\n root: string,\n fullPath: string,\n): Promise<ReadonlyArray<SeoCollection>> => {\n const path = relative(root, fullPath);\n const module = await runner.import(fullPath).catch((cause: unknown) => {\n throw new Error(`pagegraph could not evaluate ${path}: ${messageOf(cause)}`, { cause });\n });\n const exported = module[\"collections\"];\n if (exported === undefined) throw new Error(`${path} has no \\`collections\\` export`);\n const collections: unknown = typeof exported === \"function\" ? await (exported as () => unknown)() : exported;\n if (!Array.isArray(collections)) throw new Error(`${path} \\`collections\\` must be an array or return one`);\n return collections as ReadonlyArray<SeoCollection>;\n};\n\n/** What one evaluation loads: the scanned route tree and the modules that feed the graph. */\nexport interface GraphPlan {\n readonly root: string;\n readonly options: PagegraphOptions;\n readonly scan: ScannedRoutes;\n /** Absolute paths of the route files that declare `staticData`, plus `__root`. */\n readonly routeFiles: ReadonlyArray<string>;\n /** Absolute path of the collections module, when configured. */\n readonly collectionsFile: string | undefined;\n readonly factsFile: string | undefined;\n}\n\n/** Scan the routes directory and pick the modules an evaluation loads. */\nexport async function planGraph(root: string, options: PagegraphOptions): Promise<GraphPlan> {\n const scan = await scanRoutes(root, options.routesDirectory ?? \"src/routes\");\n const excluded = (options.exclude ?? []).map(globToRegExp);\n const participates = (node: RouteNode): boolean =>\n GRAPH_ROUTE_TYPES.has(node._fsRouteType) &&\n (node._fsRouteType === \"__root\" || node.createFileRouteProps?.has(\"staticData\") === true) &&\n !excluded.some((pattern) => pattern.test(node.filePath));\n return {\n root,\n options,\n scan,\n routeFiles: [scan.root, ...scan.nodes].filter(participates).map((node) => node.fullPath),\n collectionsFile: options.collections === undefined ? undefined : resolve(root, options.collections),\n factsFile: options.facts === undefined ? undefined : resolve(root, options.facts),\n };\n}\n\n/**\n * A route node's path relative to its parent, as the router matches it: route\n * groups, pathless layouts, and trailing underscores contribute no segment.\n */\nconst publicSegment = (node: RouteNode): string | undefined =>\n node.isNonPath === true || node.cleanedPath === undefined || node.cleanedPath === \"\" ? undefined : node.cleanedPath;\n\n/** Evaluate a plan's modules through `runner`, then build the graph and the site runtime. */\nexport async function evaluateGraph(runner: GraphModuleRunner, plan: GraphPlan): Promise<AppGraph> {\n const { root, options, scan } = plan;\n const staticData = new Map(\n await Promise.all(\n plan.routeFiles.map(async (fullPath) => {\n const file = relative(root, fullPath);\n const routeFile = relative(resolve(root, options.routesDirectory ?? \"src/routes\"), fullPath);\n const module = await runner.import(fullPath).catch((cause: unknown) => {\n throw new Error(\n `pagegraph could not evaluate ${file} in the graph environment: ${messageOf(cause)}\\n` +\n `If it is an app surface rather than a public page, add \"${routeFile}\" to pagegraph({ exclude }).`,\n { cause },\n );\n });\n return [fullPath, routeStaticData(module, file)] as const;\n }),\n ),\n );\n\n const walkable = (node: RouteNode): SeoRouteNode => ({\n options: { path: publicSegment(node), staticData: staticData.get(node.fullPath) },\n children: (node.children ?? []).map(walkable),\n });\n const routeTree: SeoRouteNode = {\n options: { staticData: staticData.get(scan.root.fullPath) },\n children: scan.tree.map(walkable),\n };\n\n const collections =\n plan.collectionsFile === undefined ? [] : await loadCollections(runner, root, plan.collectionsFile);\n const graph = buildSeoGraph({ routeTree, collections, origin: options.origin, ogImage: options.ogImage });\n\n const exclusions =\n options.routeConfig === undefined\n ? []\n : deriveRouteConfig(\n scan.nodes,\n resolveOptions({ ...options.routeConfig, routesDirectory: options.routesDirectory }),\n ).robotsExclusions;\n const site: SiteRuntime = {\n origin: options.origin,\n indexable: options.indexable ?? true,\n robots: {\n disallow: [...new Set([...exclusions, ...(options.robots?.disallow ?? [])])].sort(),\n contentSignal: options.robots?.contentSignal,\n directives: options.robots?.directives,\n },\n };\n let facts: Facts | undefined;\n if (plan.factsFile !== undefined) {\n const path = relative(root, plan.factsFile);\n try {\n const module = await runner.import(plan.factsFile);\n if (module[\"facts\"] === undefined) throw new Error(`${path} has no \\`facts\\` export`);\n facts = decodeFacts(module[\"facts\"]);\n } catch (cause) {\n throw new Error(`pagegraph could not evaluate ${path}: ${messageOf(cause)}`, { cause });\n }\n }\n return { graph, site, markdown: options.markdown === undefined ? null : { origin: options.markdown.origin }, facts };\n}\n","import * as Schema from \"effect/Schema\";\n\nimport type { InlineNode as InlineNodeType, PageDocument as PageDocumentType } from \"./document\";\n\nconst InlineNode: Schema.Codec<InlineNodeType> = Schema.suspend(() => Schema.Union([\n Schema.String,\n Schema.Struct({ fact: Schema.String, text: Schema.String }),\n Schema.Struct({\n tag: Schema.Literals([\"em\", \"strong\", \"a\", \"code\", \"br\"]),\n href: Schema.optionalKey(Schema.String),\n children: Schema.Array(InlineNode),\n }),\n]));\nconst Message = Schema.Struct({\n hash: Schema.String, tree: Schema.Array(InlineNode), text: Schema.String,\n source: Schema.String, facts: Schema.Array(Schema.String),\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n});\nconst BodyEntry = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"message\"), message: Message }),\n Schema.Struct({ type: Schema.Literal(\"visual\"), text: Schema.String, source: Schema.String,\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]) }),\n]);\nexport const PageDocument: Schema.Codec<PageDocumentType> = Schema.Struct({\n path: Schema.String, hash: Schema.String, title: Schema.String, description: Schema.String,\n sections: Schema.Array(Schema.Struct({\n claimsMarkdown: Schema.optionalKey(Schema.String), evidence: Schema.optionalKey(Schema.Boolean),\n kind: Schema.String, id: Schema.String, title: Schema.optionalKey(Message),\n language: Schema.optionalKey(Schema.String), body: Schema.Array(BodyEntry),\n items: Schema.Array(Schema.Struct({\n title: Schema.optionalKey(Message), href: Schema.optionalKey(Schema.String),\n body: Schema.Array(BodyEntry), cells: Schema.Array(Message), source: Schema.String,\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n })), source: Schema.String, audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n })), messages: Schema.Array(Message), facts: Schema.Array(Schema.String),\n});\nexport const CaptureBundle = Schema.Struct({\n origin: Schema.String,\n documents: Schema.Array(PageDocument),\n heads: Schema.Array(Schema.Struct({ path: Schema.String, title: Schema.String, description: Schema.String })),\n});\n","import { mkdir, readdir, readFile, unlink, writeFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\n\nimport * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { replayClaims, type ClaimsOptions } from \"../claims\";\nimport type { Facts } from \"../markdown/facts\";\n\nimport type { PageDocument } from \"../markdown/document\";\nimport { hashDocument } from \"../markdown/document\";\nimport { CaptureBundle, PageDocument as PageDocumentSchema } from \"../markdown/schema\";\nimport { documentMarkdown } from \"../markdown/markdown\";\n\nimport { MARKDOWN_CAPTURE_PATH } from \"./markdown-path\";\n\n/** File names must remain inside the package's capture and the client's output trees. */\nfunction documentName(path: string): string {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\") || /[?#\\\\$\\u0000-\\u001f\\u007f]/.test(path) ||\n (path !== \"/\" && path.endsWith(\"/\")) || path.slice(1).split(\"/\").some((part) => part === \".\" || part === \"..\" || part === \"*\" || (part === \"\" && path !== \"/\"))) {\n throw new Error(`Invalid captured document path \"${path}\"`);\n }\n return path === \"/\" ? \"index\" : path.slice(1);\n}\n\nfunction verifyDocument(document: PageDocument): string {\n const name = documentName(document.path);\n const { hash, ...content } = document;\n if (!/^[0-9a-f]{64}$/.test(hash) || hashDocument(content) !== hash)\n throw new Error(`Invalid captured document hash for \"${document.path}\"`);\n return name;\n}\n\n/** Only valid captures at their derived paths belong to pagegraph; preserve unrelated files. */\nasync function pruneDocuments(directory: string, paths: ReadonlySet<string>): Promise<void> {\n const visit = async (folder: string): Promise<void> => {\n const entries = await readdir(folder, { withFileTypes: true });\n for (const entry of entries) {\n const file = resolve(folder, entry.name);\n if (entry.isDirectory()) { await visit(file); continue; }\n if (!entry.isFile() || !entry.name.endsWith(\".json\")) continue;\n const contents = await readFile(file, \"utf8\");\n let document: PageDocument;\n let name: string;\n try {\n document = Schema.decodeUnknownSync(Schema.fromJsonString(PageDocumentSchema))(contents, { onExcessProperty: \"error\" });\n name = verifyDocument(document);\n } catch { continue; }\n if (file === resolve(directory, `${name}.json`) && !paths.has(document.path)) await unlink(file);\n }\n };\n await visit(directory);\n}\n\n/** Documents, twins, and graph heads are persisted before prerender onSuccess returns. */\nexport async function persistMarkdownCapture(\n html: string, root: string, clientOutDir: string, claims?: ClaimsOptions, facts: Facts = {},\n): Promise<void> {\n const bundle = Schema.decodeUnknownSync(Schema.fromJsonString(CaptureBundle))(html, { onExcessProperty: \"error\" });\n const origin = new URL(bundle.origin);\n if ((origin.protocol !== \"https:\" && origin.protocol !== \"http:\") || origin.origin !== bundle.origin)\n throw new Error(`Invalid captured markdown origin \"${bundle.origin}\"`);\n const active = new Set<string>();\n const destinations = new Set<string>();\n const names = bundle.documents.map((document) => {\n if (active.has(document.path)) throw new Error(`Duplicate captured document path \"${document.path}\"`);\n active.add(document.path);\n const name = verifyDocument(document);\n if (destinations.has(name)) throw new Error(`Captured document paths share the output name \"${name}\"`);\n destinations.add(name);\n return name;\n });\n await unlink(resolve(clientOutDir, MARKDOWN_CAPTURE_PATH.slice(1)));\n const directory = resolve(root, \".pagegraph/documents\");\n await mkdir(directory, { recursive: true });\n for (const [index, document] of bundle.documents.entries()) {\n const name = names[index];\n const destination = resolve(directory, `${name}.json`);\n const twin = resolve(clientOutDir, `${name}.md`);\n await mkdir(dirname(destination), { recursive: true });\n await writeFile(destination, JSON.stringify(document));\n await mkdir(dirname(twin), { recursive: true });\n await writeFile(twin, documentMarkdown(document, bundle.origin));\n }\n await pruneDocuments(directory, active);\n await writeFile(resolve(root, \".pagegraph/heads.json\"), `${JSON.stringify(bundle.heads)}\\n`);\n if (claims !== undefined)\n await Effect.runPromise(replayClaims(root, bundle.documents, bundle.heads, facts, claims));\n}\n","import { relative, resolve, sep } from \"node:path\";\n\nimport * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { parseAst } from \"vite\";\n\ntype Program = ReturnType<typeof parseAst>;\ntype Expression = Extract<Program[\"body\"][number], { type: \"ExpressionStatement\" }>[\"expression\"];\ntype JSXOpeningElement = Extract<Expression, { type: \"JSXElement\" }>[\"openingElement\"];\n\nclass DocumentSourceError extends Schema.TaggedError<DocumentSourceError>()(\"DocumentSourceError\", {\n message: Schema.String,\n}) {}\n\nconst SOURCE_COMPONENTS = new Set([\"T\", \"Title\", \"Section\", \"Visual\", \"ForAgents\", \"ForHumans\"]);\n\nconst parse = Effect.fn(\"DocumentSource.parse\")(function* (code: string, id: string) {\n return yield* Effect.try({\n try: () => parseAst(code, { lang: id.endsWith(\".tsx\") ? \"tsx\" : id.endsWith(\".ts\") ? \"ts\" : id.endsWith(\".jsx\") ? \"jsx\" : \"js\" }, id),\n catch: (cause) => new DocumentSourceError({\n message: `Cannot parse document source ${id}: ${cause instanceof Error ? cause.message : String(cause)}`,\n }),\n });\n});\n\nfunction componentNames(program: Program): {\n named: Set<string>;\n sections: Set<string>;\n namespaces: Set<string>;\n} {\n const named = new Set<string>();\n const sections = new Set<string>();\n const namespaces = new Set<string>();\n for (const node of program.body) {\n if (\n node.type !== \"ImportDeclaration\" ||\n node.source.value !== \"pagegraph/react\" ||\n node.importKind === \"type\"\n )\n continue;\n for (const specifier of node.specifiers) {\n if (specifier.type === \"ImportSpecifier\") {\n if (specifier.importKind === \"type\") continue;\n const imported =\n specifier.imported.type === \"Identifier\"\n ? specifier.imported.name\n : specifier.imported.value;\n if (SOURCE_COMPONENTS.has(imported)) named.add(specifier.local.name);\n if (imported === \"Section\") sections.add(specifier.local.name);\n } else if (specifier.type === \"ImportNamespaceSpecifier\") {\n namespaces.add(specifier.local.name);\n }\n }\n }\n return { named, sections, namespaces };\n}\n\nfunction memberParts(name: JSXOpeningElement[\"name\"]): Array<string> {\n if (name.type === \"JSXIdentifier\") return [name.name];\n if (name.type !== \"JSXMemberExpression\") return [];\n return [...memberParts(name.object), name.property.name];\n}\n\nfunction isSourceComponent(\n name: JSXOpeningElement[\"name\"],\n names: ReturnType<typeof componentNames>,\n): boolean {\n const parts = memberParts(name);\n const [base, ...members] = parts;\n if (base === undefined) return false;\n if (members.length === 0) return names.named.has(base);\n if (names.namespaces.has(base))\n return (\n (members.length === 1 && members[0] !== undefined && SOURCE_COMPONENTS.has(members[0])) ||\n (members.length === 2 && members[0] === \"Section\" && members[1] === \"Item\")\n );\n return names.sections.has(base) && members.length === 1 && members[0] === \"Item\";\n}\n\nfunction walk(value: unknown, visit: (node: JSXOpeningElement) => void): void {\n if (Array.isArray(value)) {\n for (const child of value) walk(child, visit);\n } else if (typeof value === \"object\" && value !== null) {\n if (isOpeningElement(value)) visit(value);\n for (const child of Object.values(value)) walk(child, visit);\n }\n}\n\nfunction isOpeningElement(node: object): node is JSXOpeningElement {\n return \"type\" in node && node.type === \"JSXOpeningElement\";\n}\n\nexport function transformDocumentSource(\n code: string,\n id: string,\n root: string,\n): { code: string } | undefined {\n // oxlint-disable-next-line eslint/no-restricted-properties -- Vite's document transform exposes a synchronous source API.\n const program = Effect.runSync(parse(code, id));\n const names = componentNames(program);\n const edits: Array<{ start: number; end: number; value: string }> = [];\n const file = relative(resolve(root), resolve(id)).split(sep).join(\"/\");\n\n walk(program, (node) => {\n if (!isSourceComponent(node.name, names)) return;\n if (\n node.attributes.some(\n (attribute) =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.type === \"JSXIdentifier\" &&\n attribute.name.name === \"source\",\n )\n )\n return;\n const line = code.slice(0, node.start).split(\"\\n\").length;\n // Generated defaults precede attributes so authored and spread props retain precedence.\n edits.push({\n start: node.name.end,\n end: node.name.end,\n value: ` source=${JSON.stringify(`${file}:${line}`)}`,\n });\n });\n\n if (edits.length === 0) return undefined;\n edits.sort((a, b) => b.start - a.start);\n let transformed = code;\n for (const edit of edits)\n transformed = transformed.slice(0, edit.start) + edit.value + transformed.slice(edit.end);\n return { code: transformed };\n}\n","/**\n * The `pagegraph()` Vite plugin for TanStack Start.\n *\n * The graph is built once per build (and on change in dev) inside the app's own\n * Vite pipeline, then shipped to the server runtime as `virtual:pagegraph/runtime`.\n * The Worker never rebuilds it and never imports build code.\n *\n * Route modules and content collections are evaluated in a dedicated Node\n * environment, `pagegraph`, that shares the app's plugins, aliases, and\n * `define`s. Two settings make that safe:\n * - its `resolve.noExternal` is cleared, so TanStack Start's packages load from\n * node_modules, where their virtual router entry is an inert stub. Bundled (as\n * the app's server bundles them), they would pull in the whole route tree.\n * - only route files that declare `staticData` are evaluated, one by one, never\n * `routeTree.gen.ts`.\n *\n * Dev imports those modules through the environment's module runner and\n * re-evaluates after a change reaches it. A build builds the environment first\n * (a `buildApp` hook that runs before the framework's) with the build's own\n * config and plugins, then imports the output. The CLI and `loadPageHeads` use\n * {@link evaluateAppGraph}, which runs the dev path without a server.\n */\n\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport {\n createRunnableDevEnvironment,\n type BuildEnvironment,\n type Plugin,\n type RunnableDevEnvironment,\n type ViteBuilder,\n type ViteDevServer,\n} from \"vite\";\n\nimport { graphToJson } from \"../core/wire\";\nimport { seoRouteConfig } from \"../vite/route-config\";\nimport { evaluateGraph, planGraph, type AppGraph, type GraphModuleRunner, type GraphPlan, type PagegraphOptions } from \"./graph\";\nimport { MARKDOWN_CAPTURE_PATH } from \"./markdown-path\";\nimport { persistMarkdownCapture } from \"./persist-markdown\";\nimport { transformDocumentSource } from \"./source\";\n\nexport const GRAPH_ENVIRONMENT = \"pagegraph\";\nexport const PLUGIN_NAME = \"pagegraph\";\nconst RUNTIME_ID = \"virtual:pagegraph/runtime\";\nconst RESOLVED_RUNTIME_ID = `\\0${RUNTIME_ID}`;\nconst ENTRY_ID = \"virtual:pagegraph/entry\";\nconst RESOLVED_ENTRY_ID = `\\0${ENTRY_ID}`;\n/** The runtime entry imports the virtual module, so dep pre-bundling must leave it to this plugin. */\nconst RUNTIME_ENTRIES = [\"pagegraph/tanstack-start/server\", \"pagegraph/tanstack-start/markdown\", \"pagegraph/tanstack-start/react\"];\n/** Where a build writes the graph environment's output, relative to the Vite root. */\nconst BUILD_DIRECTORY = \"node_modules/.cache/pagegraph/build\";\n/**\n * Runtime-provided modules (`cloudflare:workers`, `bun:sqlite`) that no plugin\n * resolves stay external in the graph environment, so an unexcluded route that\n * imports one fails at evaluation with its file name rather than as an\n * unresolved import. Plugin-owned schemes (`fumadocs-mdx:`) resolve first.\n */\nconst RUNTIME_SCHEME = /^(?!node:|data:|file:|virtual:)[a-z][a-z0-9+.-]*:/;\n\nconst runtimeModulesPlugin: Plugin = {\n name: \"pagegraph:runtime-modules\",\n enforce: \"post\",\n applyToEnvironment: (environment) => environment.name === GRAPH_ENVIRONMENT,\n resolveId: {\n filter: { id: RUNTIME_SCHEME },\n handler: (id) => ({ id, external: true }),\n },\n};\n\n/** What the plugin exposes to {@link evaluateAppGraph} through `plugin.api`. */\nexport interface PagegraphPluginApi {\n readonly options: PagegraphOptions;\n}\n\nconst runtimeModule = ({ graph, site, markdown, facts }: AppGraph): string =>\n `export const graph = ${JSON.stringify(graphToJson(graph))};\\nexport const site = ${JSON.stringify(site)};\\nexport const markdown = ${JSON.stringify(markdown)};\\nexport const facts = ${JSON.stringify(facts) ?? \"undefined\"};\\n`;\n\n/** The graph environment's build entry: a loader per module the plan evaluates. */\nconst entryModule = (plan: GraphPlan): string => {\n const files = [...plan.routeFiles, ...(plan.collectionsFile === undefined ? [] : [plan.collectionsFile]), ...(plan.factsFile === undefined ? [] : [plan.factsFile])];\n const loaders = files.map((file) => ` ${JSON.stringify(file)}: () => import(${JSON.stringify(file)}),`);\n return `export const modules = {\\n${loaders.join(\"\\n\")}\\n};\\n`;\n};\n\n/** Build the graph environment with the build's config, import its output, and evaluate. */\nconst buildGraph = async (builder: ViteBuilder, environment: BuildEnvironment, plan: GraphPlan): Promise<AppGraph> => {\n await builder.build(environment);\n const entry = join(resolve(environment.config.root, environment.config.build.outDir), \"entry.mjs\");\n const { modules } = (await import(pathToFileURL(entry).href)) as {\n modules: Record<string, () => Promise<Record<string, unknown>>>;\n };\n const runner: GraphModuleRunner = {\n import: (file) => {\n const load = modules[file];\n if (load === undefined) throw new Error(`${file} is not in the graph build`);\n return load();\n },\n };\n return evaluateGraph(runner, plan);\n};\n\n/** Start prerenders this private endpoint once; its callback writes public Markdown twins. */\nexport interface MarkdownPrerenderPage {\n readonly path: string;\n readonly sitemap: { readonly exclude: true };\n readonly prerender: { readonly onSuccess: (result: { html: string }) => Promise<void> };\n}\nexport type PagegraphPlugins = Array<Plugin> & { readonly prerenderPages: Array<MarkdownPrerenderPage> };\n\nexport function pagegraph(options: PagegraphOptions): PagegraphPlugins {\n if (options.claims !== undefined && options.markdown === undefined)\n throw new Error(\"Claims require pagegraph({ markdown: { origin }, claims: { rules, model } }) so the build captures documents.\");\n const api: PagegraphPluginApi = { options };\n let root = process.cwd();\n let clientOutDir = resolve(root, \"dist/client\");\n let server: ViteDevServer | undefined;\n let devEnvironment: RunnableDevEnvironment | undefined;\n /** The plan the graph environment's build entry is generated from. */\n let buildPlan: GraphPlan | undefined;\n let current: Promise<AppGraph> | undefined;\n /** Bumped by every change that reaches the graph; an evaluation that spans one is discarded. */\n let generation = 0;\n\n const evaluateInDev = async (environment: RunnableDevEnvironment): Promise<AppGraph> => {\n for (;;) {\n const started = generation;\n // Re-evaluate from scratch: content and route modules may have changed.\n environment.runner.clearCache();\n const result = await evaluateGraph(environment.runner, await planGraph(root, options));\n if (started === generation) return result;\n }\n };\n\n const graphPlugin: Plugin & { api: PagegraphPluginApi } = {\n name: PLUGIN_NAME,\n api,\n // One instance across a build's environments: the graph built in buildApp\n // is the one every environment's runtime module serves.\n sharedDuringBuild: true,\n config() {\n return {\n environments: {\n [GRAPH_ENVIRONMENT]: {\n consumer: \"server\",\n dev: {\n createEnvironment: (name, environmentConfig) => createRunnableDevEnvironment(name, environmentConfig),\n },\n build: {\n outDir: BUILD_DIRECTORY,\n emptyOutDir: true,\n copyPublicDir: false,\n minify: false,\n rolldownOptions: {\n input: { entry: ENTRY_ID },\n output: { entryFileNames: \"[name].mjs\", chunkFileNames: \"chunks/[name]-[hash].mjs\" },\n },\n },\n },\n },\n };\n },\n configEnvironment(name, environmentConfig) {\n if (name === GRAPH_ENVIRONMENT) {\n environmentConfig.resolve ??= {};\n environmentConfig.resolve.noExternal = [];\n return;\n }\n environmentConfig.optimizeDeps ??= {};\n environmentConfig.optimizeDeps.exclude = [...(environmentConfig.optimizeDeps.exclude ?? []), ...RUNTIME_ENTRIES];\n },\n configResolved(resolved) {\n root = resolved.root;\n clientOutDir = resolve(root, resolved.environments.client?.build.outDir ?? \"dist/client\");\n },\n configureServer: {\n // Cloudflare inspects SSR exports in its server hook, which can import the graph runtime.\n order: \"pre\",\n handler(devServer) {\n server = devServer;\n devEnvironment = devServer.environments[GRAPH_ENVIRONMENT] as RunnableDevEnvironment | undefined;\n },\n },\n // Runs after Vite invalidates the changed file in each environment, so the\n // next evaluation reads fresh modules.\n hotUpdate({ file, modules }) {\n if (this.environment.name !== GRAPH_ENVIRONMENT) return;\n const routesDirectory = resolve(root, options.routesDirectory ?? \"src/routes\");\n if (modules.length === 0 && !file.startsWith(`${routesDirectory}/`)) return;\n generation += 1;\n current = undefined;\n for (const other of Object.values(server?.environments ?? {})) {\n if (other.name === GRAPH_ENVIRONMENT) continue;\n const runtime = other.moduleGraph.getModuleById(RESOLVED_RUNTIME_ID);\n if (runtime !== undefined) void other.reloadModule(runtime);\n }\n },\n buildApp: {\n order: \"pre\",\n async handler(builder) {\n const environment = builder.environments[GRAPH_ENVIRONMENT];\n if (environment === undefined) return;\n buildPlan = await planGraph(environment.config.root, options);\n const built = buildGraph(builder, environment, buildPlan);\n current = built;\n await built;\n // Vite builds every environment when a build's app builder builds none;\n // the graph environment must not count, or a plain app would skip the rest.\n environment.isBuilt = false;\n },\n },\n resolveId: {\n filter: { id: /^virtual:pagegraph\\/(runtime|entry)$/ },\n handler: (id) => `\\0${id}`,\n },\n load: {\n filter: { id: /^\\0virtual:pagegraph\\/(runtime|entry)$/ },\n async handler(id) {\n if (id === RESOLVED_ENTRY_ID) {\n if (buildPlan === undefined) throw new Error(`[${PLUGIN_NAME}] ${ENTRY_ID} is only built by the pagegraph buildApp hook`);\n return entryModule(buildPlan);\n }\n // A page evaluated for the graph may import the runtime; it never serves from it.\n if (this.environment.name === GRAPH_ENVIRONMENT) return \"export const graph = null;\\nexport const site = null;\\nexport const markdown = null;\\nexport const facts = undefined;\\n\";\n if (current === undefined) {\n if (devEnvironment === undefined) {\n throw new Error(\n `[${PLUGIN_NAME}] the graph was not built before ${this.environment.name} imported it; build with Vite's app builder (\\`vite build\\`).`,\n );\n }\n current = evaluateInDev(devEnvironment);\n }\n return runtimeModule(await current);\n },\n },\n };\n\n const markdownPlugin: Plugin = {\n name: \"pagegraph:markdown\",\n enforce: \"pre\",\n applyToEnvironment: (environment) => environment.name !== GRAPH_ENVIRONMENT,\n resolveId: {\n filter: { id: /^virtual:pagegraph\\/prerender-server$/ },\n handler: (id) => `\\0${id}`,\n },\n load: {\n filter: { id: /^\\0virtual:pagegraph\\/prerender-server$/ },\n handler: () => `export { default } from ${JSON.stringify(resolve(root, options.markdown?.serverEntry ?? \"dist/server/index.js\"))};`,\n },\n transform: {\n filter: { id: /\\.[jt]sx?(\\?|$)/, code: /pagegraph\\/react/ },\n handler(code, id) {\n const file = id.split(\"?\")[0];\n if (file === undefined || file.includes(\"/node_modules/\") || file.endsWith(\".gen.ts\") || !file.startsWith(`${root}/`)) return;\n return transformDocumentSource(code, file, root);\n },\n },\n configurePreviewServer(previewServer) {\n // Start reports status only; retain the route/capture diagnostic across the Worker boundary.\n previewServer.middlewares.use((_request, response, next) => {\n response.on(\"finish\", () => {\n const error = response.getHeader(\"x-pagegraph-error\");\n if (typeof error === \"string\") previewServer.config.logger.error(decodeURIComponent(error));\n });\n next();\n });\n },\n };\n\n return Object.assign([\n graphPlugin,\n markdownPlugin,\n runtimeModulesPlugin,\n ...(options.routeConfig === undefined\n ? []\n : [seoRouteConfig({ ...options.routeConfig, routesDirectory: options.routesDirectory })]),\n ], {\n prerenderPages: options.markdown === undefined ? [] : [{\n path: MARKDOWN_CAPTURE_PATH,\n sitemap: { exclude: true as const },\n prerender: { onSuccess: async ({ html }: { html: string }) => {\n if (current === undefined) throw new Error(\"The pagegraph graph must be evaluated before Markdown persistence.\");\n const app = await current;\n await persistMarkdownCapture(html, root, clientOutDir, options.claims, app.facts);\n } },\n }],\n });\n}\n","/**\n * Evaluate an app's graph outside a running dev server — for a build, the\n * CLI (`pagegraph.config.ts`), and build-time head loading — through the same\n * `pagegraph` environment the dev server uses.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { decodeFacts, type Facts } from \"../markdown/facts\";\n\nimport { createRunnableDevEnvironment, resolveConfig, type Plugin, type InlineConfig } from \"vite\";\n\nimport type { LoadedSeoGraph, SeoGraphLoader } from \"../config/vite-graph-loader\";\nimport { withCleanStdout } from \"../config/vite-graph-loader\";\nimport { evaluateGraph, planGraph, type AppGraph } from \"./graph\";\nimport type { PagegraphPluginApi } from \"./plugin\";\n\nconst GRAPH_ENVIRONMENT = \"pagegraph\";\n\nconst cliEnvironmentOverride = (command: \"serve\" | \"build\") =>\n command === \"build\" ? { [GRAPH_ENVIRONMENT]: { isBundled: false } } : undefined;\n\nexport interface EvaluateAppGraphOptions {\n /** Directory used to find the Vite config and as its default root. */\n readonly root: string;\n /** Vite command to evaluate. Graph evaluation defaults to `serve`. */\n readonly command?: \"serve\" | \"build\" | undefined;\n /** The app's Vite config file. Defaults to Vite's lookup from `root`. */\n readonly configFile?: string | undefined;\n /**\n * Vite mode the config is evaluated in. Origins and other build constants come\n * from it, so the CLI defaults to `production` to describe the deployed site.\n */\n readonly mode?: string | undefined;\n}\n\n/** Locate the config without overriding its authored root with an inline root. */\nconst appConfig = (options: EvaluateAppGraphOptions): InlineConfig => ({\n configFile: options.configFile ?? [\"js\", \"mjs\", \"ts\", \"cjs\", \"mts\", \"cts\"]\n .map((extension) => resolve(options.root, `vite.config.${extension}`)).find(existsSync) ?? false,\n logLevel: \"error\",\n plugins: [{\n name: \"pagegraph:loader-root\",\n enforce: \"pre\",\n config(config) { config.root ??= options.root; },\n }],\n});\n\nconst pluginApi = (plugins: ReadonlyArray<Plugin>, configFile: string | undefined): PagegraphPluginApi => {\n const plugin = plugins.find((candidate) => candidate.name === \"pagegraph\") as (Plugin & { api?: PagegraphPluginApi }) | undefined;\n if (plugin?.api === undefined) {\n throw new Error(`${configFile ?? \"The Vite config\"} does not register pagegraph() from \"pagegraph/tanstack-start\".`);\n }\n return plugin.api;\n};\n\n/** Resolve settings, artifact root and facts together without route discovery. */\nexport async function loadPagegraphSettings(options: EvaluateAppGraphOptions): Promise<NonNullable<LoadedSeoGraph[\"pagegraph\"]>> {\n const command = options.command ?? \"build\";\n return withCleanStdout(async () => {\n const config = await resolveConfig(\n {\n ...appConfig(options),\n mode: options.mode ?? \"production\",\n environments: cliEnvironmentOverride(command),\n },\n command,\n );\n const settings = pluginApi(config.plugins, config.configFile).options;\n let facts: Facts = {};\n if (settings.facts !== undefined) {\n const environment = createRunnableDevEnvironment(GRAPH_ENVIRONMENT, config, { hot: false });\n await environment.init();\n try {\n await environment.pluginContainer.buildStart({});\n const module = await environment.runner.import(resolve(config.root, settings.facts));\n facts = decodeFacts(module[\"facts\"]);\n } finally { await environment.close(); }\n }\n return { root: config.root, options: settings, facts };\n });\n}\n\n/**\n * Resolve the app's Vite config, evaluate the graph in its `pagegraph`\n * environment, and release it. The command defaults to `serve`; callers can\n * request `build` to match the deployed site configuration.\n */\nexport async function evaluateAppGraph(options: EvaluateAppGraphOptions): Promise<AppGraph & { readonly pagegraph: NonNullable<LoadedSeoGraph[\"pagegraph\"]> }> {\n const command = options.command ?? \"serve\";\n const config = await resolveConfig(\n {\n ...appConfig(options),\n mode: options.mode,\n environments: cliEnvironmentOverride(command),\n },\n command,\n );\n const api = pluginApi(config.plugins, config.configFile);\n const environment = createRunnableDevEnvironment(GRAPH_ENVIRONMENT, config, { hot: false });\n await environment.init();\n try {\n // Content plugins (Fumadocs, MDX) generate their virtual sources at buildStart.\n await environment.pluginContainer.buildStart({});\n const app = await evaluateGraph(environment.runner, await planGraph(config.root, api.options));\n return { ...app, pagegraph: { root: config.root, options: api.options, facts: app.facts ?? {} } };\n } finally {\n await environment.close();\n }\n}\n\n/**\n * A `pagegraph.config.ts` graph loader for a TanStack Start app. It uses the\n * built site's identity by default; pass `command: \"serve\"` for a dev host.\n *\n * ```ts\n * export default defineSeoConfig({\n * loadGraph: tanstackStartGraph({ root: import.meta.dirname }),\n * });\n * ```\n */\nexport const tanstackStartGraph =\n (options: EvaluateAppGraphOptions): SeoGraphLoader =>\n async (_input, environment): Promise<LoadedSeoGraph> => {\n const { graph, site, pagegraph } = await withCleanStdout(() =>\n evaluateAppGraph({\n ...options,\n command: environment?.command ?? options.command ?? \"build\",\n mode: environment?.mode ?? options.mode ?? \"production\",\n }),\n );\n return { graph, site, pagegraph, dispose: async () => {} };\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,eAAs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AS,aAAa,WAAW,QAAQ,WAAW;EACpD,MAAM,aAAa,QAAQ,QAAQ,QAAQ;CAC7C,CAAC,CACH;CACA,OAAO;EAAE;EAAO;EAAM;EAAW,SAAS,YAAY,CAAC;CAAE;AAC3D"}
1
+ {"version":3,"file":"index.js","names":["PageDocumentSchema","GRAPH_ENVIRONMENT"],"sources":["../../src/tanstack-start/routes.ts","../../src/tanstack-start/graph.ts","../../src/markdown/schema.ts","../../src/tanstack-start/persist-markdown.ts","../../src/tanstack-start/source.ts","../../src/tanstack-start/plugin.ts","../../src/tanstack-start/load.ts"],"sourcesContent":["/**\n * Route discovery for the graph: the router's own generator parses the routes\n * directory (the same parse `routeTree.gen.ts` comes from), into memory only.\n */\n\nimport { resolve } from \"node:path\";\n\nimport { Generator, getConfig, type RouteNode } from \"@tanstack/router-generator\";\n\nimport { inMemoryWriteFs } from \"../vite/route-config\";\n\nexport interface ScannedRoutes {\n /** `__root.tsx`. */\n readonly root: RouteNode;\n /** Top-level route nodes, each with its `children`. */\n readonly tree: ReadonlyArray<RouteNode>;\n /** Every route node, flat. */\n readonly nodes: ReadonlyArray<RouteNode>;\n}\n\nexport async function scanRoutes(root: string, routesDirectory: string): Promise<ScannedRoutes> {\n const cacheDirectory = resolve(root, \"node_modules/.cache/pagegraph\");\n let scanned: ScannedRoutes | undefined;\n const config = getConfig(\n {\n routesDirectory: resolve(root, routesDirectory),\n generatedRouteTree: resolve(cacheDirectory, \"route-tree.gen.ts\"),\n tmpDir: resolve(cacheDirectory, \"tmp\"),\n disableTypes: true,\n enableRouteTreeFormatting: false,\n disableLogging: true,\n plugins: [\n {\n name: \"pagegraph:scan\",\n onRouteTreeChanged({ routeTree, routeNodes, rootRouteNode }) {\n scanned = { root: rootRouteNode, tree: routeTree, nodes: routeNodes };\n },\n },\n ],\n },\n root,\n );\n const memory = inMemoryWriteFs(config.generatedRouteTree);\n await new Generator({ config, root, fs: memory.fs }).run();\n if (scanned === undefined) {\n throw new Error(`pagegraph found no route tree in ${resolve(root, routesDirectory)}`);\n }\n return scanned;\n}\n","/**\n * Build the graph from the app's own modules, evaluated in the `pagegraph`\n * Vite environment: one module per route file that declares `staticData`, plus\n * the app's collections module. Never the route tree, which reaches every\n * route — including app routes that only resolve inside the server runtime.\n */\n\nimport { relative, resolve } from \"node:path\";\n\nimport type { ClaimsOptions } from \"../decide/families/claims\";\n\nimport type { RouteNode } from \"@tanstack/router-generator\";\n\nimport { globToRegExp } from \"../core/checks\";\nimport { buildSeoGraph, type OgImageResolver, type SeoCollection, type SeoGraph, type SeoRouteNode } from \"../core/graph\";\nimport type { RobotsConfig } from \"../core/projections\";\nimport type { SiteRuntime } from \"../config/vite-graph-loader\";\nimport { deriveRouteConfig, resolveOptions, type SeoRouteConfigOptions } from \"../vite/route-config\";\nimport { scanRoutes, type ScannedRoutes } from \"./routes\";\nimport { decodeFacts, type Facts } from \"../markdown/facts\";\n\n/** The robots.txt policy a build serves; `origin` and indexability come from {@link SiteRuntime}. */\nexport type RobotsPolicy = Pick<RobotsConfig, \"disallow\" | \"contentSignal\" | \"directives\">;\n\n/** The graph and the site runtime one evaluation produces. */\nexport interface AppGraph {\n readonly graph: SeoGraph;\n readonly site: SiteRuntime;\n readonly markdown: { readonly origin: string } | null;\n readonly facts: Facts | undefined;\n}\n\nexport type { SiteRuntime };\n\nexport interface PagegraphOptions {\n /** This build's canonical origin, no trailing slash, e.g. `https://example.com`. */\n readonly origin: string;\n /** Fallback social image; use the same resolver in createSeo. */\n readonly ogImage?: OgImageResolver | undefined;\n /**\n * Whether this build's host may be indexed. A non-indexable build serves a\n * disallow-all robots.txt with no Sitemap line. Defaults to `true`.\n */\n readonly indexable?: boolean | undefined;\n readonly robots?:\n | {\n /** Path prefixes disallowed on an indexable host, beyond the route-config exclusions. */\n readonly disallow?: ReadonlyArray<string> | undefined;\n /** `Content-Signal` value for an indexable host, e.g. `\"search=yes, ai-input=yes, ai-train=yes\"`. */\n readonly contentSignal?: string | undefined;\n /** Extra lines in the `User-agent: *` group on an indexable host. */\n readonly directives?: ReadonlyArray<string> | undefined;\n }\n | undefined;\n /**\n * Root-relative module whose `collections` export is a `SeoCollection[]`, or a\n * function returning one (sync or async). It runs in the app's Vite pipeline,\n * so content virtual modules (Fumadocs, MDX) and path aliases resolve.\n */\n readonly collections?: string | undefined;\n /** Canonical origin for rendered documents; serverEntry is relative to the Vite root. */\n readonly markdown?: { readonly origin: string; readonly serverEntry?: string | undefined } | undefined;\n /** Committed claims answers gate the rendered documents and graph heads at build time. */\n readonly claims?: ClaimsOptions | undefined;\n /** Root-relative module exporting the code-owned document facts. */\n readonly facts?: string | undefined;\n /**\n * Route files (globs relative to the routes directory) never evaluated for the\n * graph: app surfaces that declare `staticData` but import server-runtime-only\n * modules. Their paths stay out of the graph.\n */\n readonly exclude?: ReadonlyArray<string> | undefined;\n /** Relative to the Vite root. Defaults to `src/routes`. */\n readonly routesDirectory?: string | undefined;\n /**\n * Generate the route-config module and enforce per-group SEO coverage (the\n * `seoRouteConfig` gate). Its robots exclusions join `robots.disallow`.\n */\n readonly routeConfig?: Omit<SeoRouteConfigOptions, \"routesDirectory\"> | undefined;\n}\n\n/** Imports a module through the `pagegraph` environment's module runner. */\nexport interface GraphModuleRunner {\n import(url: string): Promise<Record<string, unknown>>;\n}\n\n\nconst GRAPH_ROUTE_TYPES = new Set([\"__root\", \"static\", \"layout\", \"pathless_layout\"]);\n\nconst messageOf = (cause: unknown): string => (cause instanceof Error ? cause.message : String(cause));\n\nconst routeStaticData = (module: Record<string, unknown>, file: string): SeoRouteNode[\"options\"][\"staticData\"] => {\n const route = module[\"Route\"] as { options?: SeoRouteNode[\"options\"] } | undefined;\n if (route?.options === undefined) throw new Error(`${file} has no \\`Route\\` export`);\n const data = route.options.staticData;\n return data === undefined ? undefined : { seo: data.seo, markdown: data.markdown, llms: data.llms };\n};\n\nconst loadCollections = async (\n runner: GraphModuleRunner,\n root: string,\n fullPath: string,\n): Promise<ReadonlyArray<SeoCollection>> => {\n const path = relative(root, fullPath);\n const module = await runner.import(fullPath).catch((cause: unknown) => {\n throw new Error(`pagegraph could not evaluate ${path}: ${messageOf(cause)}`, { cause });\n });\n const exported = module[\"collections\"];\n if (exported === undefined) throw new Error(`${path} has no \\`collections\\` export`);\n const collections: unknown = typeof exported === \"function\" ? await (exported as () => unknown)() : exported;\n if (!Array.isArray(collections)) throw new Error(`${path} \\`collections\\` must be an array or return one`);\n return collections as ReadonlyArray<SeoCollection>;\n};\n\n/** What one evaluation loads: the scanned route tree and the modules that feed the graph. */\nexport interface GraphPlan {\n readonly root: string;\n readonly options: PagegraphOptions;\n readonly scan: ScannedRoutes;\n /** Absolute paths of the route files that declare `staticData`, plus `__root`. */\n readonly routeFiles: ReadonlyArray<string>;\n /** Absolute path of the collections module, when configured. */\n readonly collectionsFile: string | undefined;\n readonly factsFile: string | undefined;\n}\n\n/** Scan the routes directory and pick the modules an evaluation loads. */\nexport async function planGraph(root: string, options: PagegraphOptions): Promise<GraphPlan> {\n const scan = await scanRoutes(root, options.routesDirectory ?? \"src/routes\");\n const excluded = (options.exclude ?? []).map(globToRegExp);\n const participates = (node: RouteNode): boolean =>\n GRAPH_ROUTE_TYPES.has(node._fsRouteType) &&\n (node._fsRouteType === \"__root\" || node.createFileRouteProps?.has(\"staticData\") === true) &&\n !excluded.some((pattern) => pattern.test(node.filePath));\n return {\n root,\n options,\n scan,\n routeFiles: [scan.root, ...scan.nodes].filter(participates).map((node) => node.fullPath),\n collectionsFile: options.collections === undefined ? undefined : resolve(root, options.collections),\n factsFile: options.facts === undefined ? undefined : resolve(root, options.facts),\n };\n}\n\n/**\n * A route node's path relative to its parent, as the router matches it: route\n * groups, pathless layouts, and trailing underscores contribute no segment.\n */\nconst publicSegment = (node: RouteNode): string | undefined =>\n node.isNonPath === true || node.cleanedPath === undefined || node.cleanedPath === \"\" ? undefined : node.cleanedPath;\n\n/** Evaluate a plan's modules through `runner`, then build the graph and the site runtime. */\nexport async function evaluateGraph(runner: GraphModuleRunner, plan: GraphPlan): Promise<AppGraph> {\n const { root, options, scan } = plan;\n const staticData = new Map(\n await Promise.all(\n plan.routeFiles.map(async (fullPath) => {\n const file = relative(root, fullPath);\n const routeFile = relative(resolve(root, options.routesDirectory ?? \"src/routes\"), fullPath);\n const module = await runner.import(fullPath).catch((cause: unknown) => {\n throw new Error(\n `pagegraph could not evaluate ${file} in the graph environment: ${messageOf(cause)}\\n` +\n `If it is an app surface rather than a public page, add \"${routeFile}\" to pagegraph({ exclude }).`,\n { cause },\n );\n });\n return [fullPath, routeStaticData(module, file)] as const;\n }),\n ),\n );\n\n const walkable = (node: RouteNode): SeoRouteNode => ({\n options: { path: publicSegment(node), staticData: staticData.get(node.fullPath) },\n children: (node.children ?? []).map(walkable),\n });\n const routeTree: SeoRouteNode = {\n options: { staticData: staticData.get(scan.root.fullPath) },\n children: scan.tree.map(walkable),\n };\n\n const collections =\n plan.collectionsFile === undefined ? [] : await loadCollections(runner, root, plan.collectionsFile);\n const graph = buildSeoGraph({ routeTree, collections, origin: options.origin, ogImage: options.ogImage });\n\n const exclusions =\n options.routeConfig === undefined\n ? []\n : deriveRouteConfig(\n scan.nodes,\n resolveOptions({ ...options.routeConfig, routesDirectory: options.routesDirectory }),\n ).robotsExclusions;\n const site: SiteRuntime = {\n origin: options.origin,\n indexable: options.indexable ?? true,\n robots: {\n disallow: [...new Set([...exclusions, ...(options.robots?.disallow ?? [])])].sort(),\n contentSignal: options.robots?.contentSignal,\n directives: options.robots?.directives,\n },\n };\n let facts: Facts | undefined;\n if (plan.factsFile !== undefined) {\n const path = relative(root, plan.factsFile);\n try {\n const module = await runner.import(plan.factsFile);\n if (module[\"facts\"] === undefined) throw new Error(`${path} has no \\`facts\\` export`);\n facts = decodeFacts(module[\"facts\"]);\n } catch (cause) {\n throw new Error(`pagegraph could not evaluate ${path}: ${messageOf(cause)}`, { cause });\n }\n }\n return { graph, site, markdown: options.markdown === undefined ? null : { origin: options.markdown.origin }, facts };\n}\n","import * as Schema from \"effect/Schema\";\n\nimport type { InlineNode as InlineNodeType, PageDocument as PageDocumentType } from \"./document\";\n\nconst InlineNode: Schema.Codec<InlineNodeType> = Schema.suspend(() => Schema.Union([\n Schema.String,\n Schema.Struct({ fact: Schema.String, text: Schema.String }),\n Schema.Struct({\n tag: Schema.Literals([\"em\", \"strong\", \"a\", \"code\", \"br\"]),\n href: Schema.optionalKey(Schema.String),\n children: Schema.Array(InlineNode),\n }),\n]));\nconst Message = Schema.Struct({\n hash: Schema.String, tree: Schema.Array(InlineNode), text: Schema.String,\n source: Schema.String, facts: Schema.Array(Schema.String),\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n});\nconst BodyEntry = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"message\"), message: Message }),\n Schema.Struct({ type: Schema.Literal(\"visual\"), text: Schema.String, source: Schema.String,\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]) }),\n]);\nexport const PageDocument: Schema.Codec<PageDocumentType> = Schema.Struct({\n path: Schema.String, hash: Schema.String, title: Schema.String, description: Schema.String,\n sections: Schema.Array(Schema.Struct({\n claimsMarkdown: Schema.optionalKey(Schema.String), evidence: Schema.optionalKey(Schema.Boolean),\n kind: Schema.String, id: Schema.String, title: Schema.optionalKey(Message),\n language: Schema.optionalKey(Schema.String), body: Schema.Array(BodyEntry),\n items: Schema.Array(Schema.Struct({\n title: Schema.optionalKey(Message), href: Schema.optionalKey(Schema.String),\n body: Schema.Array(BodyEntry), cells: Schema.Array(Message), source: Schema.String,\n audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n })), source: Schema.String, audience: Schema.Literals([\"all\", \"agents\", \"humans\"]),\n })), messages: Schema.Array(Message), facts: Schema.Array(Schema.String),\n});\nexport const CaptureBundle = Schema.Struct({\n origin: Schema.String,\n documents: Schema.Array(PageDocument),\n heads: Schema.Array(Schema.Struct({ path: Schema.String, title: Schema.String, description: Schema.String })),\n});\n","import { mkdir, readdir, readFile, unlink, writeFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\n\nimport * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { replayClaims, type ClaimsOptions } from \"../claims\";\nimport type { Facts } from \"../markdown/facts\";\n\nimport type { PageDocument } from \"../markdown/document\";\nimport { hashDocument } from \"../markdown/document\";\nimport { CaptureBundle, PageDocument as PageDocumentSchema } from \"../markdown/schema\";\nimport { documentMarkdown } from \"../markdown/markdown\";\n\nimport { MARKDOWN_CAPTURE_PATH } from \"./markdown-path\";\n\n/** File names must remain inside the package's capture and the client's output trees. */\nfunction documentName(path: string): string {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\") || /[?#\\\\$\\u0000-\\u001f\\u007f]/.test(path) ||\n (path !== \"/\" && path.endsWith(\"/\")) || path.slice(1).split(\"/\").some((part) => part === \".\" || part === \"..\" || part === \"*\" || (part === \"\" && path !== \"/\"))) {\n throw new Error(`Invalid captured document path \"${path}\"`);\n }\n return path === \"/\" ? \"index\" : path.slice(1);\n}\n\nfunction verifyDocument(document: PageDocument): string {\n const name = documentName(document.path);\n const { hash, ...content } = document;\n if (!/^[0-9a-f]{64}$/.test(hash) || hashDocument(content) !== hash)\n throw new Error(`Invalid captured document hash for \"${document.path}\"`);\n return name;\n}\n\n/** Only valid captures at their derived paths belong to pagegraph; preserve unrelated files. */\nasync function pruneDocuments(directory: string, paths: ReadonlySet<string>): Promise<void> {\n const visit = async (folder: string): Promise<void> => {\n const entries = await readdir(folder, { withFileTypes: true });\n for (const entry of entries) {\n const file = resolve(folder, entry.name);\n if (entry.isDirectory()) { await visit(file); continue; }\n if (!entry.isFile() || !entry.name.endsWith(\".json\")) continue;\n const contents = await readFile(file, \"utf8\");\n let document: PageDocument;\n let name: string;\n try {\n document = Schema.decodeUnknownSync(Schema.fromJsonString(PageDocumentSchema))(contents, { onExcessProperty: \"error\" });\n name = verifyDocument(document);\n } catch { continue; }\n if (file === resolve(directory, `${name}.json`) && !paths.has(document.path)) await unlink(file);\n }\n };\n await visit(directory);\n}\n\n/** Documents, twins, and graph heads are persisted before prerender onSuccess returns. */\nexport async function persistMarkdownCapture(\n html: string, root: string, clientOutDir: string, claims?: ClaimsOptions, facts: Facts = {},\n): Promise<void> {\n const bundle = Schema.decodeUnknownSync(Schema.fromJsonString(CaptureBundle))(html, { onExcessProperty: \"error\" });\n const origin = new URL(bundle.origin);\n if ((origin.protocol !== \"https:\" && origin.protocol !== \"http:\") || origin.origin !== bundle.origin)\n throw new Error(`Invalid captured markdown origin \"${bundle.origin}\"`);\n const active = new Set<string>();\n const destinations = new Set<string>();\n const names = bundle.documents.map((document) => {\n if (active.has(document.path)) throw new Error(`Duplicate captured document path \"${document.path}\"`);\n active.add(document.path);\n const name = verifyDocument(document);\n if (destinations.has(name)) throw new Error(`Captured document paths share the output name \"${name}\"`);\n destinations.add(name);\n return name;\n });\n await unlink(resolve(clientOutDir, MARKDOWN_CAPTURE_PATH.slice(1)));\n const directory = resolve(root, \".pagegraph/documents\");\n await mkdir(directory, { recursive: true });\n for (const [index, document] of bundle.documents.entries()) {\n const name = names[index];\n const destination = resolve(directory, `${name}.json`);\n const twin = resolve(clientOutDir, `${name}.md`);\n await mkdir(dirname(destination), { recursive: true });\n await writeFile(destination, JSON.stringify(document));\n await mkdir(dirname(twin), { recursive: true });\n await writeFile(twin, documentMarkdown(document, bundle.origin));\n }\n await pruneDocuments(directory, active);\n await writeFile(resolve(root, \".pagegraph/heads.json\"), `${JSON.stringify(bundle.heads)}\\n`);\n if (claims !== undefined)\n await Effect.runPromise(replayClaims(root, bundle.documents, bundle.heads, facts, claims));\n}\n","import { relative, resolve, sep } from \"node:path\";\n\nimport * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { parseAst } from \"vite\";\n\ntype Program = ReturnType<typeof parseAst>;\ntype Expression = Extract<Program[\"body\"][number], { type: \"ExpressionStatement\" }>[\"expression\"];\ntype JSXOpeningElement = Extract<Expression, { type: \"JSXElement\" }>[\"openingElement\"];\n\nclass DocumentSourceError extends Schema.TaggedError<DocumentSourceError>()(\"DocumentSourceError\", {\n message: Schema.String,\n}) {}\n\nconst SOURCE_COMPONENTS = new Set([\"T\", \"Title\", \"Section\", \"Visual\", \"ForAgents\", \"ForHumans\"]);\n\nconst parse = Effect.fn(\"DocumentSource.parse\")(function* (code: string, id: string) {\n return yield* Effect.try({\n try: () => parseAst(code, { lang: id.endsWith(\".tsx\") ? \"tsx\" : id.endsWith(\".ts\") ? \"ts\" : id.endsWith(\".jsx\") ? \"jsx\" : \"js\" }, id),\n catch: (cause) => new DocumentSourceError({\n message: `Cannot parse document source ${id}: ${cause instanceof Error ? cause.message : String(cause)}`,\n }),\n });\n});\n\nfunction componentNames(program: Program): {\n named: Set<string>;\n sections: Set<string>;\n namespaces: Set<string>;\n} {\n const named = new Set<string>();\n const sections = new Set<string>();\n const namespaces = new Set<string>();\n for (const node of program.body) {\n if (\n node.type !== \"ImportDeclaration\" ||\n node.source.value !== \"pagegraph/react\" ||\n node.importKind === \"type\"\n )\n continue;\n for (const specifier of node.specifiers) {\n if (specifier.type === \"ImportSpecifier\") {\n if (specifier.importKind === \"type\") continue;\n const imported =\n specifier.imported.type === \"Identifier\"\n ? specifier.imported.name\n : specifier.imported.value;\n if (SOURCE_COMPONENTS.has(imported)) named.add(specifier.local.name);\n if (imported === \"Section\") sections.add(specifier.local.name);\n } else if (specifier.type === \"ImportNamespaceSpecifier\") {\n namespaces.add(specifier.local.name);\n }\n }\n }\n return { named, sections, namespaces };\n}\n\nfunction memberParts(name: JSXOpeningElement[\"name\"]): Array<string> {\n if (name.type === \"JSXIdentifier\") return [name.name];\n if (name.type !== \"JSXMemberExpression\") return [];\n return [...memberParts(name.object), name.property.name];\n}\n\nfunction isSourceComponent(\n name: JSXOpeningElement[\"name\"],\n names: ReturnType<typeof componentNames>,\n): boolean {\n const parts = memberParts(name);\n const [base, ...members] = parts;\n if (base === undefined) return false;\n if (members.length === 0) return names.named.has(base);\n if (names.namespaces.has(base))\n return (\n (members.length === 1 && members[0] !== undefined && SOURCE_COMPONENTS.has(members[0])) ||\n (members.length === 2 && members[0] === \"Section\" && members[1] === \"Item\")\n );\n return names.sections.has(base) && members.length === 1 && members[0] === \"Item\";\n}\n\nfunction walk(value: unknown, visit: (node: JSXOpeningElement) => void): void {\n if (Array.isArray(value)) {\n for (const child of value) walk(child, visit);\n } else if (typeof value === \"object\" && value !== null) {\n if (isOpeningElement(value)) visit(value);\n for (const child of Object.values(value)) walk(child, visit);\n }\n}\n\nfunction isOpeningElement(node: object): node is JSXOpeningElement {\n return \"type\" in node && node.type === \"JSXOpeningElement\";\n}\n\nexport function transformDocumentSource(\n code: string,\n id: string,\n root: string,\n): { code: string } | undefined {\n // oxlint-disable-next-line eslint/no-restricted-properties -- Vite's document transform exposes a synchronous source API.\n const program = Effect.runSync(parse(code, id));\n const names = componentNames(program);\n const edits: Array<{ start: number; end: number; value: string }> = [];\n const file = relative(resolve(root), resolve(id)).split(sep).join(\"/\");\n\n walk(program, (node) => {\n if (!isSourceComponent(node.name, names)) return;\n if (\n node.attributes.some(\n (attribute) =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.type === \"JSXIdentifier\" &&\n attribute.name.name === \"source\",\n )\n )\n return;\n const line = code.slice(0, node.start).split(\"\\n\").length;\n // Generated defaults precede attributes so authored and spread props retain precedence.\n edits.push({\n start: node.name.end,\n end: node.name.end,\n value: ` source=${JSON.stringify(`${file}:${line}`)}`,\n });\n });\n\n if (edits.length === 0) return undefined;\n edits.sort((a, b) => b.start - a.start);\n let transformed = code;\n for (const edit of edits)\n transformed = transformed.slice(0, edit.start) + edit.value + transformed.slice(edit.end);\n return { code: transformed };\n}\n","/**\n * The `pagegraph()` Vite plugin for TanStack Start.\n *\n * The graph is built once per build (and on change in dev) inside the app's own\n * Vite pipeline, then shipped to the server runtime as `virtual:pagegraph/runtime`.\n * The Worker never rebuilds it and never imports build code.\n *\n * Route modules and content collections are evaluated in a dedicated Node\n * environment, `pagegraph`, that shares the app's plugins, aliases, and\n * `define`s. Two settings make that safe:\n * - its `resolve.noExternal` is cleared, so TanStack Start's packages load from\n * node_modules, where their virtual router entry is an inert stub. Bundled (as\n * the app's server bundles them), they would pull in the whole route tree.\n * - only route files that declare `staticData` are evaluated, one by one, never\n * `routeTree.gen.ts`.\n *\n * Dev imports those modules through the environment's module runner and\n * re-evaluates after a change reaches it. A build builds the environment first\n * (a `buildApp` hook that runs before the framework's) with the build's own\n * config and plugins, then imports the output. The CLI and `loadPageHeads` use\n * {@link evaluateAppGraph}, which runs the dev path without a server.\n */\n\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport {\n createRunnableDevEnvironment,\n type BuildEnvironment,\n type Plugin,\n type RunnableDevEnvironment,\n type ViteBuilder,\n type ViteDevServer,\n} from \"vite\";\n\nimport { graphToJson } from \"../core/wire\";\nimport { seoRouteConfig } from \"../vite/route-config\";\nimport { evaluateGraph, planGraph, type AppGraph, type GraphModuleRunner, type GraphPlan, type PagegraphOptions } from \"./graph\";\nimport { MARKDOWN_CAPTURE_PATH } from \"./markdown-path\";\nimport { persistMarkdownCapture } from \"./persist-markdown\";\nimport { transformDocumentSource } from \"./source\";\n\nexport const GRAPH_ENVIRONMENT = \"pagegraph\";\nexport const PLUGIN_NAME = \"pagegraph\";\nconst RUNTIME_ID = \"virtual:pagegraph/runtime\";\nconst RESOLVED_RUNTIME_ID = `\\0${RUNTIME_ID}`;\nconst ENTRY_ID = \"virtual:pagegraph/entry\";\nconst RESOLVED_ENTRY_ID = `\\0${ENTRY_ID}`;\n/**\n * Entries dep pre-bundling must leave to this plugin. The runtime entries import the virtual\n * module. `pagegraph` and `pagegraph/react` share module state with them (the capture context\n * and the `defineFacts` registry): a pre-bundled copy gives pages a second instance, and a\n * capture then records no sections or resolves no facts.\n */\nconst RUNTIME_ENTRIES = [\n \"pagegraph\",\n \"pagegraph/react\",\n \"pagegraph/tanstack-start/server\",\n \"pagegraph/tanstack-start/markdown\",\n \"pagegraph/tanstack-start/react\",\n];\n/** Where a build writes the graph environment's output, relative to the Vite root. */\nconst BUILD_DIRECTORY = \"node_modules/.cache/pagegraph/build\";\n/**\n * Runtime-provided modules (`cloudflare:workers`, `bun:sqlite`) that no plugin\n * resolves stay external in the graph environment, so an unexcluded route that\n * imports one fails at evaluation with its file name rather than as an\n * unresolved import. Plugin-owned schemes (`fumadocs-mdx:`) resolve first.\n */\nconst RUNTIME_SCHEME = /^(?!node:|data:|file:|virtual:)[a-z][a-z0-9+.-]*:/;\n\nconst runtimeModulesPlugin: Plugin = {\n name: \"pagegraph:runtime-modules\",\n enforce: \"post\",\n applyToEnvironment: (environment) => environment.name === GRAPH_ENVIRONMENT,\n resolveId: {\n filter: { id: RUNTIME_SCHEME },\n handler: (id) => ({ id, external: true }),\n },\n};\n\n/** What the plugin exposes to {@link evaluateAppGraph} through `plugin.api`. */\nexport interface PagegraphPluginApi {\n readonly options: PagegraphOptions;\n}\n\nconst runtimeModule = ({ graph, site, markdown, facts }: AppGraph): string =>\n `export const graph = ${JSON.stringify(graphToJson(graph))};\\nexport const site = ${JSON.stringify(site)};\\nexport const markdown = ${JSON.stringify(markdown)};\\nexport const facts = ${JSON.stringify(facts) ?? \"undefined\"};\\n`;\n\n/** The graph environment's build entry: a loader per module the plan evaluates. */\nconst entryModule = (plan: GraphPlan): string => {\n const files = [...plan.routeFiles, ...(plan.collectionsFile === undefined ? [] : [plan.collectionsFile]), ...(plan.factsFile === undefined ? [] : [plan.factsFile])];\n const loaders = files.map((file) => ` ${JSON.stringify(file)}: () => import(${JSON.stringify(file)}),`);\n return `export const modules = {\\n${loaders.join(\"\\n\")}\\n};\\n`;\n};\n\n/** Build the graph environment with the build's config, import its output, and evaluate. */\nconst buildGraph = async (builder: ViteBuilder, environment: BuildEnvironment, plan: GraphPlan): Promise<AppGraph> => {\n await builder.build(environment);\n const entry = join(resolve(environment.config.root, environment.config.build.outDir), \"entry.mjs\");\n const { modules } = (await import(pathToFileURL(entry).href)) as {\n modules: Record<string, () => Promise<Record<string, unknown>>>;\n };\n const runner: GraphModuleRunner = {\n import: (file) => {\n const load = modules[file];\n if (load === undefined) throw new Error(`${file} is not in the graph build`);\n return load();\n },\n };\n return evaluateGraph(runner, plan);\n};\n\n/** Start prerenders this private endpoint once; its callback writes public Markdown twins. */\nexport interface MarkdownPrerenderPage {\n readonly path: string;\n readonly sitemap: { readonly exclude: true };\n readonly prerender: { readonly onSuccess: (result: { html: string }) => Promise<void> };\n}\nexport type PagegraphPlugins = Array<Plugin> & { readonly prerenderPages: Array<MarkdownPrerenderPage> };\n\nexport function pagegraph(options: PagegraphOptions): PagegraphPlugins {\n if (options.claims !== undefined && options.markdown === undefined)\n throw new Error(\"Claims require pagegraph({ markdown: { origin }, claims: { rules, model } }) so the build captures documents.\");\n const api: PagegraphPluginApi = { options };\n let root = process.cwd();\n let clientOutDir = resolve(root, \"dist/client\");\n let server: ViteDevServer | undefined;\n let devEnvironment: RunnableDevEnvironment | undefined;\n /** The plan the graph environment's build entry is generated from. */\n let buildPlan: GraphPlan | undefined;\n let current: Promise<AppGraph> | undefined;\n /** Bumped by every change that reaches the graph; an evaluation that spans one is discarded. */\n let generation = 0;\n\n const evaluateInDev = async (environment: RunnableDevEnvironment): Promise<AppGraph> => {\n for (;;) {\n const started = generation;\n // Re-evaluate from scratch: content and route modules may have changed.\n environment.runner.clearCache();\n const result = await evaluateGraph(environment.runner, await planGraph(root, options));\n if (started === generation) return result;\n }\n };\n\n const graphPlugin: Plugin & { api: PagegraphPluginApi } = {\n name: PLUGIN_NAME,\n api,\n // One instance across a build's environments: the graph built in buildApp\n // is the one every environment's runtime module serves.\n sharedDuringBuild: true,\n config() {\n return {\n environments: {\n [GRAPH_ENVIRONMENT]: {\n consumer: \"server\",\n dev: {\n createEnvironment: (name, environmentConfig) => createRunnableDevEnvironment(name, environmentConfig),\n },\n build: {\n outDir: BUILD_DIRECTORY,\n emptyOutDir: true,\n copyPublicDir: false,\n minify: false,\n rolldownOptions: {\n input: { entry: ENTRY_ID },\n output: { entryFileNames: \"[name].mjs\", chunkFileNames: \"chunks/[name]-[hash].mjs\" },\n },\n },\n },\n },\n };\n },\n configEnvironment(name, environmentConfig) {\n if (name === GRAPH_ENVIRONMENT) {\n environmentConfig.resolve ??= {};\n environmentConfig.resolve.noExternal = [];\n return;\n }\n environmentConfig.optimizeDeps ??= {};\n environmentConfig.optimizeDeps.exclude = [...(environmentConfig.optimizeDeps.exclude ?? []), ...RUNTIME_ENTRIES];\n },\n configResolved(resolved) {\n root = resolved.root;\n clientOutDir = resolve(root, resolved.environments.client?.build.outDir ?? \"dist/client\");\n },\n configureServer: {\n // Cloudflare inspects SSR exports in its server hook, which can import the graph runtime.\n order: \"pre\",\n handler(devServer) {\n server = devServer;\n devEnvironment = devServer.environments[GRAPH_ENVIRONMENT] as RunnableDevEnvironment | undefined;\n },\n },\n // Runs after Vite invalidates the changed file in each environment, so the\n // next evaluation reads fresh modules.\n hotUpdate({ file, modules }) {\n if (this.environment.name !== GRAPH_ENVIRONMENT) return;\n const routesDirectory = resolve(root, options.routesDirectory ?? \"src/routes\");\n if (modules.length === 0 && !file.startsWith(`${routesDirectory}/`)) return;\n generation += 1;\n current = undefined;\n for (const other of Object.values(server?.environments ?? {})) {\n if (other.name === GRAPH_ENVIRONMENT) continue;\n const runtime = other.moduleGraph.getModuleById(RESOLVED_RUNTIME_ID);\n if (runtime !== undefined) void other.reloadModule(runtime);\n }\n },\n buildApp: {\n order: \"pre\",\n async handler(builder) {\n const environment = builder.environments[GRAPH_ENVIRONMENT];\n if (environment === undefined) return;\n buildPlan = await planGraph(environment.config.root, options);\n const built = buildGraph(builder, environment, buildPlan);\n current = built;\n await built;\n // Vite builds every environment when a build's app builder builds none;\n // the graph environment must not count, or a plain app would skip the rest.\n environment.isBuilt = false;\n },\n },\n resolveId: {\n filter: { id: /^virtual:pagegraph\\/(runtime|entry)$/ },\n handler: (id) => `\\0${id}`,\n },\n load: {\n filter: { id: /^\\0virtual:pagegraph\\/(runtime|entry)$/ },\n async handler(id) {\n if (id === RESOLVED_ENTRY_ID) {\n if (buildPlan === undefined) throw new Error(`[${PLUGIN_NAME}] ${ENTRY_ID} is only built by the pagegraph buildApp hook`);\n return entryModule(buildPlan);\n }\n // A page evaluated for the graph may import the runtime; it never serves from it.\n if (this.environment.name === GRAPH_ENVIRONMENT) return \"export const graph = null;\\nexport const site = null;\\nexport const markdown = null;\\nexport const facts = undefined;\\n\";\n if (current === undefined) {\n if (devEnvironment === undefined) {\n throw new Error(\n `[${PLUGIN_NAME}] the graph was not built before ${this.environment.name} imported it; build with Vite's app builder (\\`vite build\\`).`,\n );\n }\n current = evaluateInDev(devEnvironment);\n }\n return runtimeModule(await current);\n },\n },\n };\n\n const markdownPlugin: Plugin = {\n name: \"pagegraph:markdown\",\n enforce: \"pre\",\n applyToEnvironment: (environment) => environment.name !== GRAPH_ENVIRONMENT,\n resolveId: {\n filter: { id: /^virtual:pagegraph\\/prerender-server$/ },\n handler: (id) => `\\0${id}`,\n },\n load: {\n filter: { id: /^\\0virtual:pagegraph\\/prerender-server$/ },\n handler: () => `export { default } from ${JSON.stringify(resolve(root, options.markdown?.serverEntry ?? \"dist/server/index.js\"))};`,\n },\n transform: {\n filter: { id: /\\.[jt]sx?(\\?|$)/, code: /pagegraph\\/react/ },\n handler(code, id) {\n const file = id.split(\"?\")[0];\n if (file === undefined || file.includes(\"/node_modules/\") || file.endsWith(\".gen.ts\") || !file.startsWith(`${root}/`)) return;\n return transformDocumentSource(code, file, root);\n },\n },\n configurePreviewServer(previewServer) {\n // Start reports status only; retain the route/capture diagnostic across the Worker boundary.\n previewServer.middlewares.use((_request, response, next) => {\n response.on(\"finish\", () => {\n const error = response.getHeader(\"x-pagegraph-error\");\n if (typeof error === \"string\") previewServer.config.logger.error(decodeURIComponent(error));\n });\n next();\n });\n },\n };\n\n return Object.assign([\n graphPlugin,\n markdownPlugin,\n runtimeModulesPlugin,\n ...(options.routeConfig === undefined\n ? []\n : [seoRouteConfig({ ...options.routeConfig, routesDirectory: options.routesDirectory })]),\n ], {\n prerenderPages: options.markdown === undefined ? [] : [{\n path: MARKDOWN_CAPTURE_PATH,\n sitemap: { exclude: true as const },\n prerender: { onSuccess: async ({ html }: { html: string }) => {\n if (current === undefined) throw new Error(\"The pagegraph graph must be evaluated before Markdown persistence.\");\n const app = await current;\n await persistMarkdownCapture(html, root, clientOutDir, options.claims, app.facts);\n } },\n }],\n });\n}\n","/**\n * Evaluate an app's graph outside a running dev server — for a build, the\n * CLI (`pagegraph.config.ts`), and build-time head loading — through the same\n * `pagegraph` environment the dev server uses.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { decodeFacts, type Facts } from \"../markdown/facts\";\n\nimport { createRunnableDevEnvironment, resolveConfig, type Plugin, type InlineConfig } from \"vite\";\n\nimport type { LoadedSeoGraph, SeoGraphLoader } from \"../config/vite-graph-loader\";\nimport { withCleanStdout } from \"../config/vite-graph-loader\";\nimport { evaluateGraph, planGraph, type AppGraph } from \"./graph\";\nimport type { PagegraphPluginApi } from \"./plugin\";\n\nconst GRAPH_ENVIRONMENT = \"pagegraph\";\n\nconst cliEnvironmentOverride = (command: \"serve\" | \"build\") =>\n command === \"build\" ? { [GRAPH_ENVIRONMENT]: { isBundled: false } } : undefined;\n\nexport interface EvaluateAppGraphOptions {\n /** Directory used to find the Vite config and as its default root. */\n readonly root: string;\n /** Vite command to evaluate. Graph evaluation defaults to `serve`. */\n readonly command?: \"serve\" | \"build\" | undefined;\n /** The app's Vite config file. Defaults to Vite's lookup from `root`. */\n readonly configFile?: string | undefined;\n /**\n * Vite mode the config is evaluated in. Origins and other build constants come\n * from it, so the CLI defaults to `production` to describe the deployed site.\n */\n readonly mode?: string | undefined;\n}\n\n/** Locate the config without overriding its authored root with an inline root. */\nconst appConfig = (options: EvaluateAppGraphOptions): InlineConfig => ({\n configFile: options.configFile ?? [\"js\", \"mjs\", \"ts\", \"cjs\", \"mts\", \"cts\"]\n .map((extension) => resolve(options.root, `vite.config.${extension}`)).find(existsSync) ?? false,\n logLevel: \"error\",\n plugins: [{\n name: \"pagegraph:loader-root\",\n enforce: \"pre\",\n config(config) { config.root ??= options.root; },\n }],\n});\n\nconst pluginApi = (plugins: ReadonlyArray<Plugin>, configFile: string | undefined): PagegraphPluginApi => {\n const plugin = plugins.find((candidate) => candidate.name === \"pagegraph\") as (Plugin & { api?: PagegraphPluginApi }) | undefined;\n if (plugin?.api === undefined) {\n throw new Error(`${configFile ?? \"The Vite config\"} does not register pagegraph() from \"pagegraph/tanstack-start\".`);\n }\n return plugin.api;\n};\n\n/** Resolve settings, artifact root and facts together without route discovery. */\nexport async function loadPagegraphSettings(options: EvaluateAppGraphOptions): Promise<NonNullable<LoadedSeoGraph[\"pagegraph\"]>> {\n const command = options.command ?? \"build\";\n return withCleanStdout(async () => {\n const config = await resolveConfig(\n {\n ...appConfig(options),\n mode: options.mode ?? \"production\",\n environments: cliEnvironmentOverride(command),\n },\n command,\n );\n const settings = pluginApi(config.plugins, config.configFile).options;\n let facts: Facts = {};\n if (settings.facts !== undefined) {\n const environment = createRunnableDevEnvironment(GRAPH_ENVIRONMENT, config, { hot: false });\n await environment.init();\n try {\n await environment.pluginContainer.buildStart({});\n const module = await environment.runner.import(resolve(config.root, settings.facts));\n facts = decodeFacts(module[\"facts\"]);\n } finally { await environment.close(); }\n }\n return { root: config.root, options: settings, facts };\n });\n}\n\n/**\n * Resolve the app's Vite config, evaluate the graph in its `pagegraph`\n * environment, and release it. The command defaults to `serve`; callers can\n * request `build` to match the deployed site configuration.\n */\nexport async function evaluateAppGraph(options: EvaluateAppGraphOptions): Promise<AppGraph & { readonly pagegraph: NonNullable<LoadedSeoGraph[\"pagegraph\"]> }> {\n const command = options.command ?? \"serve\";\n const config = await resolveConfig(\n {\n ...appConfig(options),\n mode: options.mode,\n environments: cliEnvironmentOverride(command),\n },\n command,\n );\n const api = pluginApi(config.plugins, config.configFile);\n const environment = createRunnableDevEnvironment(GRAPH_ENVIRONMENT, config, { hot: false });\n await environment.init();\n try {\n // Content plugins (Fumadocs, MDX) generate their virtual sources at buildStart.\n await environment.pluginContainer.buildStart({});\n const app = await evaluateGraph(environment.runner, await planGraph(config.root, api.options));\n return { ...app, pagegraph: { root: config.root, options: api.options, facts: app.facts ?? {} } };\n } finally {\n await environment.close();\n }\n}\n\n/**\n * A `pagegraph.config.ts` graph loader for a TanStack Start app. It uses the\n * built site's identity by default; pass `command: \"serve\"` for a dev host.\n *\n * ```ts\n * export default defineSeoConfig({\n * loadGraph: tanstackStartGraph({ root: import.meta.dirname }),\n * });\n * ```\n */\nexport const tanstackStartGraph =\n (options: EvaluateAppGraphOptions): SeoGraphLoader =>\n async (_input, environment): Promise<LoadedSeoGraph> => {\n const { graph, site, pagegraph } = await withCleanStdout(() =>\n evaluateAppGraph({\n ...options,\n command: environment?.command ?? options.command ?? \"build\",\n mode: environment?.mode ?? options.mode ?? \"production\",\n }),\n );\n return { graph, site, pagegraph, dispose: async () => {} };\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,eAAsB,WAAW,MAAc,iBAAiD;CAC9F,MAAM,iBAAiB,QAAQ,MAAM,+BAA+B;CACpE,IAAI;CACJ,MAAM,SAAS,UACb;EACE,iBAAiB,QAAQ,MAAM,eAAe;EAC9C,oBAAoB,QAAQ,gBAAgB,mBAAmB;EAC/D,QAAQ,QAAQ,gBAAgB,KAAK;EACrC,cAAc;EACd,2BAA2B;EAC3B,gBAAgB;EAChB,SAAS,CACP;GACE,MAAM;GACN,mBAAmB,EAAE,WAAW,YAAY,iBAAiB;IAC3D,UAAU;KAAE,MAAM;KAAe,MAAM;KAAW,OAAO;IAAW;GACtE;EACF,CACF;CACF,GACA,IACF;CACA,MAAM,SAAS,gBAAgB,OAAO,kBAAkB;CACxD,MAAM,IAAI,UAAU;EAAE;EAAQ;EAAM,IAAI,OAAO;CAAG,CAAC,CAAC,CAAC,IAAI;CACzD,IAAI,YAAY,KAAA,GACd,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AM,SAAS,MAAM,cACnB;EACE,GAAG,UAAU,OAAO;EACpB,MAAM,QAAQ;EACd,cAAc,uBAAuB,OAAO;CAC9C,GACA,OACF;CACA,MAAM,MAAM,UAAU,OAAO,SAAS,OAAO,UAAU;CACvD,MAAM,cAAc,6BAA6B,mBAAmB,QAAQ,EAAE,KAAK,MAAM,CAAC;CAC1F,MAAM,YAAY,KAAK;CACvB,IAAI;EAEF,MAAM,YAAY,gBAAgB,WAAW,CAAC,CAAC;EAC/C,MAAM,MAAM,MAAM,cAAc,YAAY,QAAQ,MAAM,UAAU,OAAO,MAAM,IAAI,OAAO,CAAC;EAC7F,OAAO;GAAE,GAAG;GAAK,WAAW;IAAE,MAAM,OAAO;IAAM,SAAS,IAAI;IAAS,OAAO,IAAI,SAAS,CAAC;GAAE;EAAE;CAClG,UAAU;EACR,MAAM,YAAY,MAAM;CAC1B;AACF;;;;;;;;;;;AAYA,MAAa,sBACV,YACD,OAAO,QAAQ,gBAAyC;CACtD,MAAM,EAAE,OAAO,MAAM,cAAc,MAAM,sBACvC,iBAAiB;EACf,GAAG;EACH,SAAS,aAAa,WAAW,QAAQ,WAAW;EACpD,MAAM,aAAa,QAAQ,QAAQ,QAAQ;CAC7C,CAAC,CACH;CACA,OAAO;EAAE;EAAO;EAAM;EAAW,SAAS,YAAY,CAAC;CAAE;AAC3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagegraph",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Route-declared SEO graph, audit, and agentic workflow toolkit for TanStack Start.",
5
5
  "keywords": [
6
6
  "seo",