import type { StxOptions } from './types';
/**
 * Read a file with mtime-based caching.
 * Returns cached content if file hasn't been modified since last read.
 *
 * Race-safe: stats → reads → re-stats. If the mtime moved between the
 * initial stat and the read, the content we just got may not match the
 * mtime we'd cache it under, so we retry up to 3 times. Without this,
 * a writer flushing the file between our stat() and our read() would
 * have us cache the *new* content under the *old* mtime — and the
 * subsequent invalidation never fires because the cached mtime already
 * "matches" the new file mtime on the next cache-hit check.
 */
export declare function readFileCached(filePath: string): Promise<string>;
/**
 * Invalidate a specific file from the content cache.
 * Called by HMR when a file changes.
 */
export declare function invalidateFileCache(filePath: string): void;
/**
 * Invalidate all files matching a pattern from the content cache.
 */
export declare function invalidateFileCacheByDir(dirPath: string): void;
/**
 * Get the signals runtime with module-level caching.
 * The runtime is identical for every page and never changes during a dev session.
 */
export declare function getCachedSignalsRuntime(debug?: boolean): Promise<string>;
/**
 * Get the router script with module-level caching.
 */
export declare function getCachedRouterScript(): Promise<string>;
/**
 * Clear all dev caches. Called during full rebuild or HMR reset.
 */
export declare function clearDevCaches(): void;
/**
 * Check if a cached version of the template is available and valid
 */
export declare function checkCache(filePath: string, options: StxOptions): Promise<string | null>;
/**
 * Cache the processed template
 */
export declare function cacheTemplate(filePath: string, output: string, dependencies: Set<string>, options: StxOptions): Promise<void>;
/**
 * Create a hash of the file path for cache filenames
 *
 * Uses SHA-1 (fast, collision-resistant enough for cache keys) truncated to
 * CACHE_HASH_LENGTH characters. The truncated hash still provides strong
 * uniqueness guarantees for cache file identification.
 *
 * @param filePath - Absolute path to the template file
 * @returns A 16-character hex string suitable for use as a filename
 */
export declare function hashFilePath(filePath: string): string;
// Memory cache for compiled templates
export declare const templateCache: Map<string, CacheEntry>;
/**
 * Cache entry structure
 */
declare interface CacheEntry {
  output: string
  mtime: number
  dependencies: Set<string>
}
