import { type InferPageType, loader } from "fumadocs-core/source"; import { type GeistdocsConfig, type GeistdocsPageSurface } from "./config.js"; import { type GeistdocsVersionPaths } from "./internal/version-paths.js"; export type { GeistdocsVersionPaths } from "./internal/version-paths.js"; type LoaderOptions = Parameters[0]; export interface FumadocsCollection { toFumadocsSource(): LoaderOptions["source"]; } export interface GeistdocsSourcePageData { badge?: string; canonical?: string; description?: string; excludeFrom?: GeistdocsPageSurface[]; getText(kind: "processed"): Promise; internal?: boolean; keywords?: string[]; lastModified?: Date; navTitle?: string; noindex?: boolean; prerequisites?: string[]; product?: string; related?: string[]; summary?: string; tags?: string[]; title: string; type?: string; } export interface GeistdocsMarkdownContext { page: { data: GeistdocsSourcePageData; path: string; slugs: string[]; url: string; }; } export type GeistdocsMarkdownFrontmatterValue = boolean | Date | number | readonly string[] | string | null | undefined; export type GeistdocsMarkdownFrontmatter = Record; export interface GeistdocsMarkdownOptions { /** Add or override fields in the generated Markdown frontmatter. */ frontmatter?: (defaults: Readonly, context: GeistdocsMarkdownContext) => GeistdocsMarkdownFrontmatter | Promise; transform?: (markdown: string, context: GeistdocsMarkdownContext) => Promise | string; } export interface CreateSourceOptions { baseUrl?: string; config: Pick & Partial>; docs: FumadocsCollection; id?: string; label?: string; markdown?: GeistdocsMarkdownOptions; } export interface GeistdocsSourceDefinition extends Omit { id: string; label?: string; } export interface GeistdocsVersionedSourceDefinition extends GeistdocsSourceDefinition { description?: string; href?: string; routePrefix?: string; } export interface CreateSourcesOptions { config: CreateSourceOptions["config"]; sources: GeistdocsSourceDefinition[]; } export interface CreateVersionedSourcesOptions { config: CreateSourceOptions["config"]; current: string; versions: GeistdocsVersionedSourceDefinition[]; } export declare const createSource: ({ docs, config, baseUrl, id, label, markdown, }: CreateSourceOptions) => { baseUrl: string; routingConfig: { agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined; basePath: string | undefined; defaultLanguage: string | undefined; siteUrl: string | undefined; title: string | undefined; translations: import("./config.js").GeistdocsTranslations | undefined; }; source: import("fumadocs-core/source").LoaderOutput<{ source: import("fumadocs-core/source").SourceConfig; i18n: import("fumadocs-core/i18n").I18nConfig; }>; id: string | undefined; label: string | undefined; getPageImage: (page: InferPageType; }>>) => { segments: string[]; url: string; }; getPageMarkdown: (page: InferPageType; }>>) => Promise; }; export type GeistdocsSourceBundle = ReturnType; export type GeistdocsSourcePage = ReturnType[number]; export declare const isGeistdocsSourceBundle: (source: unknown) => source is GeistdocsSourceBundle; export declare const createSources: ({ config, sources }: CreateSourcesOptions) => { all: { id: string; label: string | undefined; source: { baseUrl: string; routingConfig: { agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined; basePath: string | undefined; defaultLanguage: string | undefined; siteUrl: string | undefined; title: string | undefined; translations: import("./config.js").GeistdocsTranslations | undefined; }; source: import("fumadocs-core/source").LoaderOutput<{ source: import("fumadocs-core/source").SourceConfig; i18n: import("fumadocs-core/i18n").I18nConfig; }>; id: string | undefined; label: string | undefined; getPageImage: (page: InferPageType; }>>) => { segments: string[]; url: string; }; getPageMarkdown: (page: InferPageType; }>>) => Promise; }; }[]; byId: Record; }; export declare const createVersionedSources: ({ config, current, versions, }: CreateVersionedSourcesOptions) => { all: { description: string | undefined; href: string | undefined; id: string; label: string | undefined; routePrefix: string | undefined; source: { baseUrl: string; routingConfig: { agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined; basePath: string | undefined; defaultLanguage: string | undefined; siteUrl: string | undefined; title: string | undefined; translations: import("./config.js").GeistdocsTranslations | undefined; }; source: import("fumadocs-core/source").LoaderOutput<{ source: import("fumadocs-core/source").SourceConfig; i18n: import("fumadocs-core/i18n").I18nConfig; }>; id: string | undefined; label: string | undefined; getPageImage: (page: InferPageType; }>>) => { segments: string[]; url: string; }; getPageMarkdown: (page: InferPageType; }>>) => Promise; }; }[]; byId: Record; }>; id: string | undefined; label: string | undefined; getPageImage: (page: InferPageType; }>>) => { segments: string[]; url: string; }; getPageMarkdown: (page: InferPageType; }>>) => Promise; }>; current: { baseUrl: string; routingConfig: { agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined; basePath: string | undefined; defaultLanguage: string | undefined; siteUrl: string | undefined; title: string | undefined; translations: import("./config.js").GeistdocsTranslations | undefined; }; source: import("fumadocs-core/source").LoaderOutput<{ source: import("fumadocs-core/source").SourceConfig; i18n: import("fumadocs-core/i18n").I18nConfig; }>; id: string | undefined; label: string | undefined; getPageImage: (page: InferPageType; }>>) => { segments: string[]; url: string; }; getPageMarkdown: (page: InferPageType; }>>) => Promise; }; currentVersion: string; }; export interface CollectVersionPathsOptions { /** * Map a page to its public URL when the app rewrites loader URLs at render * time (e.g. `({ page }) => \`/v5${page.url}\``). Defaults to `page.url`. */ getPageUrl?: (context: { page: { slugs: string[]; url: string; }; }) => string; lang?: string; /** The version's public route prefix, stripped from every collected path. */ routePrefix?: string; sources: GeistdocsSourceBundle | GeistdocsSourceBundle[]; } /** * Collect the prefix-relative paths of every page in one version's sources. * Pass the result to the version switcher (via `GeistdocsVersionSelect`'s * `paths` prop) so switching never lands on a page that doesn't exist in the * target version. Handles both URL shapes: loaders whose `baseUrl` already * includes the version prefix, and loaders whose URLs get prefixed at render * time (via `routePrefix` / `getPageUrl`). */ export declare const collectVersionPaths: ({ getPageUrl, lang, routePrefix, sources, }: CollectVersionPathsOptions) => string[]; export interface CollectVersionSwitchPathsOptions { getPageUrl?: CollectVersionPathsOptions["getPageUrl"]; lang?: string; versions: Pick, "all">; } /** * Build the `paths` prop for `GeistdocsVersionSelect` from * `createVersionedSources` output: for each version, the prefix-relative * paths of its pages plus its docs root as the fallback landing page. */ export declare const collectVersionSwitchPaths: ({ getPageUrl, lang, versions, }: CollectVersionSwitchPathsOptions) => Record; //# sourceMappingURL=source.d.ts.map