/** * @license MIT * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { Tree } from '@angular-devkit/schematics'; import ts from 'typescript'; export interface ProgramOptions { host: ts.CompilerHost; options: ts.CompilerOptions; rootNames: string[]; } type FakeReadFileFunction = (fileName: string) => string | undefined; /** * Creates a TypeScript program instance for a TypeScript project within the virtual file system tree. * @param tree Virtual file system tree that contains the source files. * @param tsconfigPath Virtual file system path that resolves to the TypeScript project. * @param basePath Base path for the virtual file system tree. * @param fakeFileRead Optional file reader function. Can be used to overwrite files in the TypeScript program, or to * add in-memory files (e.g. to add global types). * @param additionalFiles Additional file paths that should be added to the program. * @returns The program instance */ export declare function createMigrationProgram(tree: Tree, tsconfigPath: string, basePath: string, fakeFileRead?: FakeReadFileFunction, additionalFiles?: string[]): ts.Program; /** * Creates the options necessary to instantiate a TypeScript program. * @param tree Virtual file system tree that contains the source files. * @param tsconfigPath Virtual file system path that resolves to the TypeScript project. * @param basePath Base path for the virtual file system tree. * @param fakeFileRead Optional file reader function. Can be used to overwrite files in the TypeScript program, or to * add in-memory files (e.g. to add global types). * @param additionalFiles Additional file paths that should be added to the program. * @param optionOverrides Overrides of the parsed compiler options. * @returns The option */ export declare function createProgramOptions(tree: Tree, tsconfigPath: string, basePath: string, fakeFileRead?: FakeReadFileFunction, additionalFiles?: string[], optionOverrides?: ts.CompilerOptions): ProgramOptions; /** * Checks whether a file can be migrated by our automated migrations. * @param basePath Absolute path to the project. * @param sourceFile File being checked. * @param program Program that includes the source file. * @returns If the file can be migrated */ export declare function canMigrateFile(basePath: string, sourceFile: ts.SourceFile, program: ts.Program): boolean; export {};