compiler-host.d.ts 1.2KB

123456789101112131415161718192021222324252627
  1. import { CancellationToken, CompilerHost, CompilerOptions, ScriptTarget, SourceFile } from 'typescript';
  2. import { VirtualFileSystem } from '../util/interfaces';
  3. export interface OnErrorFn {
  4. (message: string): void;
  5. }
  6. export declare class InMemoryCompilerHost implements CompilerHost {
  7. private options;
  8. private fileSystem;
  9. private setParentNodes;
  10. private sourceFileMap;
  11. private diskCompilerHost;
  12. constructor(options: CompilerOptions, fileSystem: VirtualFileSystem, setParentNodes?: boolean);
  13. fileExists(filePath: string): boolean;
  14. readFile(filePath: string): string;
  15. directoryExists(directoryPath: string): boolean;
  16. getFiles(directoryPath: string): string[];
  17. getDirectories(directoryPath: string): string[];
  18. getSourceFile(filePath: string, languageVersion: ScriptTarget, onError?: OnErrorFn): SourceFile;
  19. getCancellationToken(): CancellationToken;
  20. getDefaultLibFileName(options: CompilerOptions): string;
  21. writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: OnErrorFn): void;
  22. getCurrentDirectory(): string;
  23. getCanonicalFileName(fileName: string): string;
  24. useCaseSensitiveFileNames(): boolean;
  25. getNewLine(): string;
  26. }