/** * Server-side helpers for Nuxt docs routes. * * The simplest setup is a single file: * * @example * ```ts * // server/api/docs.ts * import { defineDocsHandler } from "@farming-labs/nuxt/server"; * import config from "../../docs.config"; * export default defineDocsHandler(config); * ``` * * That one handler serves page loads, search, and AI chat. */ import type { DocsMcpHttpHandlers } from "@farming-labs/docs/server"; import { loadDocsNavTree } from "./content.js"; import type { PageNode } from "./content.js"; export { defineApiReferenceHandler } from "./api-reference.js"; export interface DocsServer { load: (pathname: string) => Promise<{ tree: ReturnType; flatPages: PageNode[]; url: string; title: string; description?: string; html: 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 a Nuxt 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; /** * Create a single Nuxt event handler that serves docs pages, search, and AI chat. * * Pass `useStorage` from the Nitro auto-import so the handler can read * docs bundled via `serverAssets`. * * @example * ```ts * // server/api/docs.ts * import { defineDocsHandler } from "@farming-labs/nuxt/server"; * import config from "../../docs.config"; * export default defineDocsHandler(config, useStorage); * ``` * * The handler responds to: * - `GET /api/docs?pathname=/docs/page` → page load * - `GET /api/docs?query=search+term` → search * - `POST /api/docs` → AI chat */ type DocsStorageAccessor = (base: string) => { getKeys(): Promise; getItem(key: string): Promise; }; export declare function defineDocsHandler(config: Record, storage: DocsStorageAccessor): import("h3").EventHandler; flatPages: PageNode[]; url: string; title: string; description?: string; html: 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; }>>; /** * Create a Nuxt event handler for the built-in docs MCP endpoint. * * @example * ```ts * // server/api/docs/mcp.ts * import { defineDocsMcpHandler } from "@farming-labs/nuxt/server"; * import config from "../../docs.config"; * export default defineDocsMcpHandler(config, useStorage); * ``` */ export declare function defineDocsMcpHandler(config: Record, storage: DocsStorageAccessor): import("h3").EventHandler>; /** * Create a Nuxt middleware handler for public docs discovery endpoints. * * Intended for `server/middleware/docs-public.ts`; unmatched routes pass * through to Nuxt. */ export declare function defineDocsPublicHandler(config: Record, storage: DocsStorageAccessor): import("h3").EventHandler>; //# sourceMappingURL=server.d.ts.map