histoire
Version:
A fast story book powered by Vite
23 lines • 1.2 kB
TypeScript
import type { Context } from '../context.js';
/**
* Builds a getter for the ids under which the current story files can appear as
* a Vite importer.
*
* Deliberately a getter and not a frozen set: the dev watcher keeps discovering
* story files after server start, and a set frozen at startup would hand
* late-added files the node-oriented `vitest` entry (which breaks in the
* browser) whenever their name does not match the `.story.*` fallback (custom
* storyMatch patterns). Only consulted when an importer requests the bare
* `vitest` id, so the rebuild cost is negligible.
* @param ctx The histoire context.
*/
export declare function createStoryImporterIdsGetter(ctx: Context): () => Set<string>;
/**
* Matches story importers across raw file paths, root-relative ids, and Vite's
* normalized `/@fs/...?vue` Vue SFC submodule ids.
* @param importer The importer id reported by Vite.
* @param storyImporterIds Known story ids (see {@link createStoryImporterIdsGetter}).
* @param root The project root.
*/
export declare function isStoryVitestImporter(importer: string | undefined, storyImporterIds: Set<string>, root: string): boolean;
//# sourceMappingURL=story-importer.d.ts.map