UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

47 lines 1.49 kB
import path from 'node:path'; import type { AnalyzedComponent, ServerStoryFile, StoryContext } from './types'; /** * Load search index from disk */ export declare function loadSearchIndex(ctx: StoryContext): Promise<PersistedSearchIndex | null>; /** * Save search index to disk */ export declare function saveSearchIndex(ctx: StoryContext, entries: SearchIndexEntry[]): Promise<void>; /** * Build persisted search index from story files */ export declare function buildPersistedSearchIndex(storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>): SearchIndexEntry[]; /** * Check if index is stale (any file modified since index was built) */ export declare function isIndexStale(ctx: StoryContext, index: PersistedSearchIndex): Promise<boolean>; /** * Search the index */ export declare function searchIndex(index: PersistedSearchIndex, query: string): SearchIndexEntry[]; /** * Get or build search index */ export declare function getOrBuildSearchIndex(ctx: StoryContext, storyFiles: ServerStoryFile[], components: Map<string, AnalyzedComponent>, forceRebuild?: any): Promise<SearchIndexEntry[]>; /** * Search index entry */ export declare interface SearchIndexEntry { id: string name: string path: string searchText: string props: string[] tags: string[] mtime: number } /** * Persisted search index */ export declare interface PersistedSearchIndex { version: number created: number updated: number entries: SearchIndexEntry[] }