@barnabask/astro-minisearch
Version:
Utilities to add a static full text index to an Astro project
31 lines (30 loc) • 1.04 kB
TypeScript
import { z } from "zod";
import { GlobResult, PluginOptions, SearchDocument } from "./types.js";
type Page = z.infer<typeof pageValidator>;
declare const pageValidator: z.ZodObject<{
url: z.ZodString;
frontmatter: z.ZodRecord<z.ZodString, z.ZodAny>;
}, "strip", z.ZodTypeAny, {
url: string;
frontmatter: Record<string, any>;
}, {
url: string;
frontmatter: Record<string, any>;
}>;
/**
* Convert a single page to an array of SearchDocuments.
* @ignore
*/
export declare function pageToDocuments(page: Page, contentKey: string): SearchDocument[];
/**
* Converts glob output of static pages to an array of {@link types!SearchDocument}s.
*
* @param pages result of of [`import.meta.glob`](https://vitejs.dev/guide/features.html#glob-import)
* @param options plugin options (optional)
* @example
* ```ts
* pagesGlobToDocuments(import.meta.glob('./**\/*.md*'));
* ```
*/
export declare function pagesGlobToDocuments(pages: GlobResult, options?: Partial<PluginOptions>): Promise<SearchDocument[]>;
export {};