Skip to content

Commit ebae506

Browse files
crisbetopkozlowski-opensource
authored andcommitted
fix(migrations): use import remapper in root component (#49046)
Fixes that in #49022 the component import remapping function was being passed into the standalone migration. PR Close #49046
1 parent 0b725a8 commit ebae506

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/core/schematics/ng-generate/standalone-migration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function standaloneMigration(
108108
} else if (schematicOptions.mode === MigrationMode.standaloneBootstrap) {
109109
pendingChanges = toStandaloneBootstrap(
110110
program, host, basePath, rootNames, sourceFiles, printer, undefined,
111-
referenceLookupExcludedFiles);
111+
referenceLookupExcludedFiles, knownInternalAliasRemapper);
112112
} else {
113113
// This shouldn't happen, but default to `MigrationMode.toStandalone` just in case.
114114
pendingChanges =

packages/core/schematics/ng-generate/standalone-migration/standalone-bootstrap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import ts from 'typescript';
1515
import {getAngularDecorators} from '../../utils/ng_decorators';
1616
import {closestNode} from '../../utils/typescript/nodes';
1717

18-
import {convertNgModuleDeclarationToStandalone, extractDeclarationsFromModule, findTestObjectsToMigrate, migrateTestDeclarations} from './to-standalone';
18+
import {ComponentImportsRemapper, convertNgModuleDeclarationToStandalone, extractDeclarationsFromModule, findTestObjectsToMigrate, migrateTestDeclarations} from './to-standalone';
1919
import {ChangeTracker, findClassDeclaration, findLiteralProperty, getNodeLookup, getRelativeImportPath, ImportRemapper, NamedClassDeclaration, NodeLookup, offsetsToNodes, ReferenceResolver, UniqueItemTracker} from './util';
2020

2121
/** Information extracted from a `bootstrapModule` call necessary to migrate it. */
@@ -35,7 +35,7 @@ interface BootstrapCallAnalysis {
3535
export function toStandaloneBootstrap(
3636
program: NgtscProgram, host: ts.CompilerHost, basePath: string, rootFileNames: string[],
3737
sourceFiles: ts.SourceFile[], printer: ts.Printer, importRemapper?: ImportRemapper,
38-
referenceLookupExcludedFiles?: RegExp) {
38+
referenceLookupExcludedFiles?: RegExp, componentImportRemapper?: ComponentImportsRemapper) {
3939
const tracker = new ChangeTracker(printer, importRemapper);
4040
const typeChecker = program.getTsProgram().getTypeChecker();
4141
const templateTypeChecker = program.compiler.getTemplateTypeChecker();
@@ -71,7 +71,7 @@ export function toStandaloneBootstrap(
7171
// declarations so we have to migrate them now.
7272
for (const declaration of allDeclarations) {
7373
convertNgModuleDeclarationToStandalone(
74-
declaration, allDeclarations, tracker, templateTypeChecker);
74+
declaration, allDeclarations, tracker, templateTypeChecker, componentImportRemapper);
7575
}
7676

7777
migrateTestDeclarations(testObjects, allDeclarations, tracker, templateTypeChecker, typeChecker);

0 commit comments

Comments
 (0)