virtual-host.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.dev/license
  7. */
  8. import * as ts from 'typescript';
  9. import { FileSystem } from '../file-system';
  10. declare module 'typescript' {
  11. interface FileSystemEntries {
  12. readonly files: readonly string[];
  13. readonly directories: readonly string[];
  14. }
  15. const matchFiles: undefined | ((path: string, extensions: readonly string[] | undefined, excludes: readonly string[] | undefined, includes: readonly string[] | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string, directoryExists: (path: string) => boolean) => string[]);
  16. }
  17. /**
  18. * Implementation of a TypeScript parse config host that relies fully on
  19. * a given virtual file system.
  20. */
  21. export declare class FileSystemHost implements ts.ParseConfigHost {
  22. private _fileSystem;
  23. useCaseSensitiveFileNames: boolean;
  24. constructor(_fileSystem: FileSystem);
  25. fileExists(path: string): boolean;
  26. readFile(path: string): string | undefined;
  27. readDirectory(rootDir: string, extensions: string[], excludes: string[] | undefined, includes: string[], depth?: number): string[];
  28. private _getFileSystemEntries;
  29. }
  30. /**
  31. * Creates a TypeScript compiler host that fully relies fully on the given
  32. * virtual file system. i.e. no interactions with the working directory.
  33. */
  34. export declare function createFileSystemCompilerHost(options: ts.CompilerOptions, fileSystem: FileSystem): ts.CompilerHost;
  35. /** Creates a format diagnostic host that works with the given file system. */
  36. export declare function createFormatDiagnosticHost(fileSystem: FileSystem): ts.FormatDiagnosticsHost;