Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | /**
* IFileSystem
* Abstraction over file system operations for testability.
*
* This interface allows the Transpiler to be tested with a mock file system
* instead of requiring actual file I/O during unit tests.
*
* Design notes:
* - All methods are synchronous (matching current Node.js fs usage patterns)
* - File deletion (unlink/rmSync) intentionally omitted - not needed for transpilation
* - Add async variants if performance optimization requires it in the future
*/
interface IFileSystem {
/**
* Read a file's contents as UTF-8 string.
* @throws Error if file doesn't exist or can't be read
*/
readFile(path: string): string;
/**
* Write content to a file (creates directories if needed).
*/
writeFile(path: string, content: string): void;
/**
* Check if a path exists (file or directory).
*/
exists(path: string): boolean;
/**
* Check if a path is a directory.
* @returns false if path doesn't exist or is a file
*/
isDirectory(path: string): boolean;
/**
* Check if a path is a file.
* @returns false if path doesn't exist or is a directory
*/
isFile(path: string): boolean;
/**
* Create a directory (and parent directories if recursive is true).
*/
mkdir(path: string, options?: { recursive?: boolean }): void;
/**
* Read directory contents.
* @returns Array of entry names (not full paths)
* @throws Error if directory doesn't exist or can't be read
*/
readdir(path: string): string[];
/**
* Get file stats (for cache key generation).
* @returns Object with at least mtimeMs (modification time in milliseconds)
* @throws Error if file doesn't exist or can't be read
*/
stat(path: string): { mtimeMs: number };
}
export default IFileSystem;
|