/** * Server-side helpers for Astro docs routes. * * `createDocsServer(config)` returns all the functions needed for * a complete docs site: `load` for getting page data, `GET` and `HEAD` * for public reads, `POST` for AI chat, and `MCP` for MCP transport. * * @example * ```ts * // src/lib/docs.server.ts * import { createDocsServer } from "@farming-labs/astro/server"; * import config from "./docs.config"; * * const contentFiles = import.meta.glob(["/docs/**\/*.{md,mdx}", "/AGENTS.md", "/skill.md"], { * query: "?raw", import: "default", eager: true, * }) as Record; * * export const { load, GET, HEAD, POST, MCP } = createDocsServer({ * ...config, * _preloadedContent: contentFiles, * }); * ``` * * ```ts * // src/pages/docs/[...slug].astro * import { load } from "../../lib/docs.server"; * const data = await load(Astro.url.pathname); * ``` */ import type { DocsMcpHttpHandlers } from "@farming-labs/docs/server"; import { loadDocsNavTree } from "./content.js"; import type { PageNode } from "./content.js"; export { createAstroApiReference } from "./api-reference.js"; export interface DocsServer { load: (pathname: string) => Promise<{ tree: ReturnType; flatPages: PageNode[]; url: string; title: string; description?: string; html: string; rawMarkdown?: string; readingTime?: number | null; readingTimeFormat?: "long" | "short"; entry?: string; locale?: string; slug?: string; previousPage: PageNode | null; nextPage: PageNode | null; editOnGithub?: string; lastModified: string; structuredData: string; }>; GET: (context: { request: Request; }) => Promise; HEAD: (context: { request: Request; }) => Promise; POST: (context: { request: Request; }) => Promise; MCP: DocsMcpHttpHandlers; } /** * Create all server-side functions needed for an Astro docs site. * * @param config - The `DocsConfig` object (from `defineDocs()` in `docs.config.ts`). * * Pass `_preloadedContent` (from `import.meta.glob`) to bundle markdown files * at build time — required for serverless deployments (Vercel, Netlify, etc.) * where the filesystem is not available at runtime. */ export declare function createDocsServer(config?: Record): DocsServer; //# sourceMappingURL=server.d.ts.map