UNPKG

histoire

Version:

A fast story book powered by Vite

59 lines • 3.05 kB
/** Closed dependency graph one story's collected definitions were mounted from. */ export interface CollectionEvidence { /** Eligibility service that proved the graph; another server never vouches for it. */ owner: object; /** Watcher sequence captured before the proof read any module bytes. */ since: number; /** Watched files of the story and setup graphs, including plugin watch files. */ files: ReadonlySet<string>; /** Unwatched leaves (installed packages, plugin virtual modules) mapped to their content fingerprint. */ leaves: ReadonlyMap<string, string>; } /** Whether a path is a source module; shared with the affected-story classifier so both agree on what an independent edit is. */ export declare function isSourceModule(file: string): boolean; /** * Orders watcher events so each story's evidence outlives edits outside its own graph. * * A dependency edit retires only graphs containing that file. Additions, * deletions and edits of non-module files (tsconfig, env, plugin data) can * change resolution or transforms anywhere, so they retire every graph. */ export declare function createDependencyTracker(): { /** Sequence a proof captures before reading any module bytes. */ current: () => number; /** * Records one watcher event. * @param event Chokidar event name. * @param file Absolute changed path. * @param dependency Whether some proved graph contains the file. * @returns `false` when the event cannot affect any proved graph. */ record(event: string, file: string, dependency: boolean): boolean; /** * Whether no event recorded after `since` touches the given graph files. * @param since Sequence captured before the proof. * @param files Watched files of the proved graph. */ unchanged(since: number, files: ReadonlySet<string>): boolean; }; /** * Events outside every proved graph that cannot matter: installed packages and * hidden build/tool directories inside the project (Histoire's own cache, or * another Nuxt process regenerating `.nuxt/`). Graph members are never ignored. * @param root Project root. * @param file Absolute changed path. */ export declare function isIgnoredEvent(root: string, file: string): boolean; /** Installed modules resolve inside `node_modules`, which Vite never watches. */ export declare function isInstalledModule(id: string): boolean; /** * Content fingerprint of a leaf Vite's watcher cannot observe, or `undefined` when unobservable. * * Installed files are compared by size and mtime, which every reinstall * changes. Virtual modules are compared by loaded bytes, and only import-free * ones qualify: their imports would be edges no watcher or fingerprint covers. * @param id Resolved module ID. * @param load Loads a virtual module's code through the client plugin container. */ export declare function fingerprintLeaf(id: string, load: (id: string) => Promise<string | undefined>): Promise<string | undefined>; //# sourceMappingURL=evidence.d.ts.map