Skip to content

Commit

Permalink
fix(migrations): use import remapper in root component (#49046)
Browse files Browse the repository at this point in the history
Fixes that in #49022 the component import remapping function was being passed into the standalone migration.

PR Close #49046
  • Loading branch information
crisbeto authored and pkozlowski-opensource committed Feb 13, 2023
1 parent 0b725a8 commit ebae506
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function standaloneMigration(
} else if (schematicOptions.mode === MigrationMode.standaloneBootstrap) {
pendingChanges = toStandaloneBootstrap(
program, host, basePath, rootNames, sourceFiles, printer, undefined,
referenceLookupExcludedFiles);
referenceLookupExcludedFiles, knownInternalAliasRemapper);
} else {
// This shouldn't happen, but default to `MigrationMode.toStandalone` just in case.
pendingChanges =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ts from 'typescript';
import {getAngularDecorators} from '../../utils/ng_decorators';
import {closestNode} from '../../utils/typescript/nodes';

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

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

migrateTestDeclarations(testObjects, allDeclarations, tracker, templateTypeChecker, typeChecker);
Expand Down

0 comments on commit ebae506

Please sign in to comment.