@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
46 lines (45 loc) • 1.27 kB
TypeScript
import type { DtsGenerationConfig } from './types';
/**
* Add .dtsx-cache to .gitignore if not already present
*/
export declare function ensureGitignore(cwd: string): void;
/**
* Cache entry for a single file
*/
export declare interface CacheEntry {
sourcePath: string
sourceHash: string
sourceMtime: number
sourceCtime: number
sourceSize: number
dtsContent: string
dtsHash: string
generatedAt: number
configHash: string
}
/**
* Cache manifest containing all cached entries
*/
export declare interface CacheManifest {
version: number
configHash: string
entries: Record<string, CacheEntry>
createdAt: number
updatedAt: number
}
/**
* Incremental build cache manager
*/
export declare class BuildCache {
constructor(config: DtsGenerationConfig);
load(): boolean;
save(): void;
needsRegeneration(filePath: string, cwd: string): boolean;
getCached(filePath: string, cwd: string): string | null;
getCachedIfValid(filePath: string, cwd: string): string | null;
update(filePath: string, sourceContent: string, dtsContent: string, cwd: string): void;
remove(filePath: string, cwd: string): void;
clear(): void;
getStats(): { entries: number, size: number };
prune(existingFiles: Set<string>, cwd: string): number;
}