diff --git a/packages/core/schematics/utils/tsurge/base_migration.ts b/packages/core/schematics/utils/tsurge/base_migration.ts index 3e73833146d..0163fab0c33 100644 --- a/packages/core/schematics/utils/tsurge/base_migration.ts +++ b/packages/core/schematics/utils/tsurge/base_migration.ts @@ -6,13 +6,11 @@ * found in the LICENSE file at https://angular.dev/license */ -import {absoluteFrom, FileSystem} from '@angular/compiler-cli/src/ngtsc/file_system'; import {NgCompilerOptions} from '@angular/compiler-cli/src/ngtsc/core/api'; -import {getRootDirs} from '@angular/compiler-cli/src/ngtsc/util/src/typescript'; -import {isShim} from '@angular/compiler-cli/src/ngtsc/shims'; -import {ProgramInfo} from './program_info'; -import {Serializable} from './helpers/serializable'; +import {FileSystem} from '@angular/compiler-cli/src/ngtsc/file_system'; import {createBaseProgramInfo, getProgramInfoFromBaseInfo} from './helpers/create_program'; +import {Serializable} from './helpers/serializable'; +import {ProgramInfo} from './program_info'; /** Type helper extracting the stats type of a migration. */ export type MigrationStats = diff --git a/packages/core/schematics/utils/tsurge/helpers/create_program.ts b/packages/core/schematics/utils/tsurge/helpers/create_program.ts index 5ba7fe6563a..b5804c68b36 100644 --- a/packages/core/schematics/utils/tsurge/helpers/create_program.ts +++ b/packages/core/schematics/utils/tsurge/helpers/create_program.ts @@ -25,13 +25,13 @@ import {createPlainTsProgram} from './ts_program'; /** Creates the base program info for the given tsconfig path. */ export function createBaseProgramInfo( absoluteTsconfigPath: string, - fs?: FileSystem, + fs: FileSystem, optionOverrides: NgCompilerOptions = {}, ): BaseProgramInfo { - if (fs === undefined) { - fs = new NodeJSFileSystem(); - setFileSystem(fs); - } + // Make sure the FS becomes globally available. Some code paths + // of the Angular compiler, or tsconfig parsing aren't leveraging + // the specified file system. + setFileSystem(fs); const tsconfig = parseTsconfigOrDie(absoluteTsconfigPath, fs); const tsHost = new NgtscCompilerHost(fs, tsconfig.options);