import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-DvmltNFH.js"; import { accessSchema, metaSchema, metaSchema as metaSchema$1, pageSchema, pageSchema as frontmatterSchema } from "@hanzo/docs-core/source/schema"; import { Pluggable, Processor, Transformer } from "unified"; import * as Plugins from "@hanzo/docs-core/mdx-plugins"; import { LLMsOptions } from "@hanzo/docs-core/mdx-plugins"; import { VFile } from "vfile"; import { ProcessorOptions } from "@mdx-js/mdx"; import { StandardSchemaV1 } from "@standard-schema/spec"; import { Root } from "mdast"; import { FSWatcher } from "chokidar"; import { MetaData, PageData, Source } from "@hanzo/docs-core/source"; import { StructuredData as StructuredData$1 } from "@hanzo/docs-core/mdx-plugins/remark-structure"; //#region src/config/preset.d.ts type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]); type DefaultMDXOptions = Omit, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & { rehypePlugins?: ResolvePlugins; remarkPlugins?: ResolvePlugins; /** * Properties to export from `vfile.data` */ valueToExport?: string[]; remarkStructureOptions?: Plugins.StructureOptions | false; remarkHeadingOptions?: Plugins.RemarkHeadingOptions; remarkImageOptions?: Plugins.RemarkImageOptions | false; remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | false; remarkNpmOptions?: Plugins.RemarkNpmOptions | false; rehypeCodeOptions?: Plugins.RehypeCodeOptions | false; }; type MDXPresetOptions = ({ preset?: 'hanzo-docs'; } & DefaultMDXOptions) | ({ preset: 'minimal'; } & ProcessorOptions); /** * apply MDX processor presets */ declare function applyMdxPreset(options?: MDXPresetOptions): (environment: BuildEnvironment) => Promise; //#endregion //#region src/loaders/mdx/remark-postprocess.d.ts interface ExtractedReference { href: string; } interface PostprocessOptions { _format: 'md' | 'mdx'; /** * Properties to export from `vfile.data` */ valueToExport?: string[]; /** * stringify MDAST and export via `_markdown`. */ includeProcessedMarkdown?: boolean | LLMsOptions; /** * extract link references, export via `extractedReferences`. */ extractLinkReferences?: boolean; /** * store MDAST and export via `_mdast`. */ includeMDAST?: boolean | { removePosition?: boolean; }; } //#endregion //#region src/config/define.d.ts type CollectionSchema = Schema | ((ctx: Context) => Schema); type AnyCollection = DocsCollection | DocCollection | MetaCollection; interface BaseCollection { /** * Directory to scan */ dir: string; /** * what files to include/exclude (glob patterns) * * Include all files if not specified */ files?: string[]; } interface MetaCollection extends BaseCollection { type: 'meta'; schema?: CollectionSchema; } interface DocCollection extends BaseCollection { type: 'doc'; postprocess?: Partial; /** * By defining a collection-level MDX options, **the default options & plugins will be removed**. * * See [`mdxOptions`](https://docs.hanzo.ai/docs/mdx/collections#mdxoptions) for details. */ mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise); /** * Load files with async */ async?: boolean; /** * Compile files on-demand */ dynamic?: boolean; schema?: CollectionSchema; } interface DocsCollection { type: 'docs'; dir: string; docs: DocCollection; meta: MetaCollection; } interface GlobalConfig { plugins?: PluginOption[]; /** * Configure global MDX options, will be used by all `doc` collections unless collection-level `mdxOptions` is specified. */ mdxOptions?: MDXPresetOptions | (() => Promise); workspaces?: Record; }>; /** * specify a directory to access & store cache (disabled during development mode). * * The cache will never be updated, delete the cache folder to clean. */ experimentalBuildCache?: string; } declare function defineCollections(options: DocCollection): DocCollection; declare function defineCollections(options: MetaCollection): MetaCollection; declare function defineDocs(options: { /** * The content directory to scan files * * @defaultValue 'content/docs' */ dir?: string; docs?: Omit, 'dir' | 'type'>; meta?: Omit, 'dir' | 'type'>; }): DocsCollection; declare function defineConfig(config?: GlobalConfig): GlobalConfig; //#endregion //#region src/config/build.d.ts type BuildEnvironment = 'bundler' | 'runtime'; interface LoadedConfig { collections: Map; global: GlobalConfig; getMDXOptions(collection?: DocCollectionItem, environment?: BuildEnvironment): ProcessorOptions | Promise; workspaces: Record; } type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem; interface PrimitiveCollectionItem { name: string; cwd: string; /** * content directory (absolute) */ dir: string; hasFile: (filePath: string) => boolean; isFileSupported: (filePath: string) => boolean; patterns: string[]; } type MetaCollectionItem = PrimitiveCollectionItem & Omit; type DocCollectionItem = PrimitiveCollectionItem & Omit; interface DocsCollectionItem extends Omit, Omit { meta: MetaCollectionItem; docs: DocCollectionItem; } //#endregion //#region src/loaders/mdx/remark-include.d.ts declare function remarkInclude(this: Processor): Transformer; //#endregion //#region src/runtime/server.d.ts type MetaCollectionEntry = Data & MetaMethods; type DocCollectionEntry = DocData & DocMethods & Frontmatter & TC['DocData'][Name]; interface ToHanzoDocsSourceOptions { /** base directory for virtual file paths */ baseDir?: string; } type AsyncDocCollectionEntry = { load: () => Promise; structuredData: () => Promise; } & DocMethods & Frontmatter; interface DocsCollectionEntry { docs: DocCollectionEntry[]; meta: MetaCollectionEntry[]; toSource: () => Source<{ pageData: DocCollectionEntry; metaData: MetaCollectionEntry; }>; } interface AsyncDocsCollectionEntry { docs: AsyncDocCollectionEntry[]; meta: MetaCollectionEntry[]; toSource: () => Source<{ pageData: AsyncDocCollectionEntry; metaData: MetaCollectionEntry; }>; } type AwaitableGlobEntries = Record Promise)>; type ServerCreate = ReturnType>; interface ServerOptions { doc?: { passthroughs?: string[]; }; } declare function server(options?: ServerOptions): { doc(_name: Name, base: string, glob: AwaitableGlobEntries): Promise | DocsCollection ? DocCollectionEntry, TC>[] : never>; docLazy(_name: Name, base: string, head: AwaitableGlobEntries, body: Record Promise>): Promise | DocsCollection ? AsyncDocCollectionEntry, TC>[] : never>; meta(_name: Name, base: string, glob: AwaitableGlobEntries): Promise | DocsCollection ? MetaCollectionEntry>[] : never>; docs(name: Name, base: string, metaGlob: AwaitableGlobEntries, docGlob: AwaitableGlobEntries): Promise ? StandardSchemaV1.InferOutput extends PageData ? StandardSchemaV1.InferOutput extends MetaData ? DocsCollectionEntry, StandardSchemaV1.InferOutput, TC> : never : never : never>; docsLazy(name: Name, base: string, metaGlob: AwaitableGlobEntries, docHeadGlob: AwaitableGlobEntries, docBodyGlob: Record Promise>): Promise ? StandardSchemaV1.InferOutput extends PageData ? StandardSchemaV1.InferOutput extends MetaData ? AsyncDocsCollectionEntry, StandardSchemaV1.InferOutput, TC> : never : never : never>; }; declare function createSource(pages: Page[], metas: Meta[], options?: ToHanzoDocsSourceOptions): Source<{ pageData: Page; metaData: Meta; }>; //#endregion //#region src/plugins/index-file.d.ts interface IndexFilePluginOptions { target?: 'default' | 'vite'; /** * add `.js` extensions to imports, needed for ESM without bundler resolution */ addJsExtension?: boolean; /** * Generate entry point for browser * @defaultValue true */ browser?: boolean; /** * Generate entry point for dynamic compilation * @defaultValue true */ dynamic?: boolean; } interface IndexFilePlugin { ['index-file']?: { generateTypeConfig?: (this: PluginContext) => string | void; serverOptions?: (this: PluginContext, options: ServerOptions) => void; }; } declare function indexFile(options?: IndexFilePluginOptions): Plugin; //#endregion //#region src/core.d.ts type Awaitable = T | Promise; interface EmitEntry { /** * path relative to output directory */ path: string; content: string; } interface PluginContext { core: Core; } type CompilationContext = PluginContext & TransformOptions; interface TransformOptions { collection: Collection; filePath: string; source: string; } interface Plugin extends IndexFilePlugin { name?: string; /** * on config loaded/updated */ config?: (this: PluginContext, config: LoadedConfig) => Awaitable; /** * Generate files (e.g. types, index file, or JSON schemas) */ emit?: (this: PluginContext) => Awaitable; /** * Configure Hanzo Docs dev server */ configureServer?: (this: PluginContext, server: ServerContext) => Awaitable; meta?: { /** * Transform metadata */ transform?: (this: CompilationContext, data: unknown) => Awaitable; }; doc?: { /** * Transform frontmatter */ frontmatter?: (this: CompilationContext, data: Record) => Awaitable | void>; /** * Transform `vfile` on compilation stage */ vfile?: (this: CompilationContext, file: VFile) => Awaitable; }; } type PluginOption = Awaitable; interface ServerContext { /** * the file watcher, by default all content files are watched, along with other files. * * make sure to filter when listening to events */ watcher?: FSWatcher; } interface CoreOptions { environment: string; configPath: string; outDir: string; plugins?: PluginOption[]; /** * the workspace info if this instance is created as a workspace */ workspace?: { parent: Core; name: string; dir: string; }; } interface EmitOptions { /** * filter the plugins to run emit */ filterPlugin?: (plugin: Plugin) => boolean; /** * filter the workspaces to run emit */ filterWorkspace?: (workspace: string) => boolean; /** * write files */ write?: boolean; } interface EmitOutput { entries: EmitEntry[]; workspaces: Record; } declare function createCore(options: CoreOptions): { /** * Convenient cache store, reset when config changes */ cache: Map; init({ config: newConfig }: { config: Awaitable; }): Promise; getWorkspaces(): Map; getOptions(): CoreOptions; getConfig(): LoadedConfig; /** * The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling) */ getCompiledConfigPath(): string; getPlugins(): Plugin[]; getCollections(): CollectionItem[]; getCollection(name: string): CollectionItem | undefined; getPluginContext(): PluginContext; initServer(server: ServerContext): Promise; emit(emitOptions?: EmitOptions): Promise; transformMeta(options: TransformOptions, data: unknown): Promise; transformFrontmatter(options: TransformOptions, data: Record): Promise>; transformVFile(options: TransformOptions, file: VFile): Promise; }; type Core = ReturnType; //#endregion export { CollectionSchema as A, DefaultMDXOptions as B, server as C, remarkInclude as D, metaSchema$1 as E, defineCollections as F, applyMdxPreset as H, defineConfig as I, defineDocs as L, DocsCollection as M, GlobalConfig as N, AnyCollection as O, MetaCollection as P, ExtractedReference as R, createSource as S, frontmatterSchema as T, MDXPresetOptions as V, DocCollectionEntry as _, EmitOptions as a, ServerCreate as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AsyncDocsCollectionEntry as g, AsyncDocCollectionEntry as h, EmitEntry as i, DocCollection as j, BaseCollection as k, PluginOption as l, indexFile as m, Core as n, EmitOutput as o, IndexFilePluginOptions as p, CoreOptions as r, Plugin as s, CompilationContext as t, ServerContext as u, DocsCollectionEntry as v, accessSchema as w, ServerOptions as x, MetaCollectionEntry as y, PostprocessOptions as z };