@@ -78,25 +78,26 @@ export function replaceBootstrap(
7878 let bootstrapImport : ts . ImportDeclaration | undefined ;
7979 let bootstrapNamespace : ts . Identifier | undefined ;
8080 const replacedNodes : ts . Node [ ] = [ ] ;
81+ const nodeFactory = context . factory ;
8182
8283 const visitNode : ts . Visitor = ( node : ts . Node ) => {
8384 if ( ts . isCallExpression ( node ) && ts . isIdentifier ( node . expression ) ) {
8485 const target = node . expression ;
8586 if ( target . text === 'platformBrowserDynamic' ) {
8687 if ( ! bootstrapNamespace ) {
87- bootstrapNamespace = ts . createUniqueName ( '__NgCli_bootstrap_' ) ;
88- bootstrapImport = ts . createImportDeclaration (
88+ bootstrapNamespace = nodeFactory . createUniqueName ( '__NgCli_bootstrap_' ) ;
89+ bootstrapImport = nodeFactory . createImportDeclaration (
8990 undefined ,
9091 undefined ,
91- ts . createImportClause ( undefined , ts . createNamespaceImport ( bootstrapNamespace ) ) ,
92- ts . createLiteral ( '@angular/platform-browser' ) ,
92+ nodeFactory . createImportClause ( false , undefined , nodeFactory . createNamespaceImport ( bootstrapNamespace ) ) ,
93+ nodeFactory . createStringLiteral ( '@angular/platform-browser' ) ,
9394 ) ;
9495 }
9596 replacedNodes . push ( target ) ;
9697
97- return ts . updateCall (
98+ return nodeFactory . updateCallExpression (
9899 node ,
99- ts . createPropertyAccess ( bootstrapNamespace , 'platformBrowser' ) ,
100+ nodeFactory . createPropertyAccessExpression ( bootstrapNamespace , 'platformBrowser' ) ,
100101 node . typeArguments ,
101102 node . arguments ,
102103 ) ;
@@ -126,10 +127,10 @@ export function replaceBootstrap(
126127 }
127128
128129 // Add new platform browser import
129- return ts . updateSourceFileNode (
130+ return nodeFactory . updateSourceFile (
130131 updatedSourceFile ,
131132 ts . setTextRange (
132- ts . createNodeArray ( [ bootstrapImport , ...updatedSourceFile . statements ] ) ,
133+ nodeFactory . createNodeArray ( [ bootstrapImport , ...updatedSourceFile . statements ] ) ,
133134 sourceFile . statements ,
134135 ) ,
135136 ) ;
0 commit comments