/** * HMR helpers. * * `computeHmrInvalidation` is the pure side: given a changed file path, * the cache, and the config file path, it returns the list of evicted * cache keys (which the dispatching `handleHotUpdate` hook converts to * Vite module ids). * * The hook itself lives in `plugin.ts` — it converts the result of this * function into the array of `ModuleNode` objects Vite expects to * invalidate. */ import type { CompilationCache } from './cache.js'; export interface HmrInvalidationInput { /** Absolute path of the file that just changed. */ changedFile: string; /** Absolute path of the project's `z2f.config.ts` (or undefined if unknown). */ configFile: string | undefined; /** The plugin's compilation cache. */ cache: CompilationCache; } export interface HmrInvalidationResult { /** * `'config'` means the config file changed and the entire cache was * evicted. `'schema'` means a tracked schema file changed and only * entries depending on it were evicted. */ kind: 'config' | 'schema'; /** The cache keys that were evicted. */ evictedKeys: string[]; } /** * Decide what to invalidate when a file changes. * * Returns `null` to signal "fall through to Vite's default HMR behavior" * — the changed file is neither the config nor a tracked schema, so the * plugin has nothing to do. * * Returns a result object when the plugin DID invalidate something. The * caller is responsible for converting the evicted keys back into Vite * module ids (each key has the form `::::`). */ export declare function computeHmrInvalidation(input: HmrInvalidationInput): HmrInvalidationResult | null; //# sourceMappingURL=hmr.d.ts.map