@@ -78,25 +78,26 @@ export function replaceBootstrap(
78
78
let bootstrapImport : ts . ImportDeclaration | undefined ;
79
79
let bootstrapNamespace : ts . Identifier | undefined ;
80
80
const replacedNodes : ts . Node [ ] = [ ] ;
81
+ const nodeFactory = context . factory ;
81
82
82
83
const visitNode : ts . Visitor = ( node : ts . Node ) => {
83
84
if ( ts . isCallExpression ( node ) && ts . isIdentifier ( node . expression ) ) {
84
85
const target = node . expression ;
85
86
if ( target . text === 'platformBrowserDynamic' ) {
86
87
if ( ! bootstrapNamespace ) {
87
- bootstrapNamespace = ts . createUniqueName ( '__NgCli_bootstrap_' ) ;
88
- bootstrapImport = ts . createImportDeclaration (
88
+ bootstrapNamespace = nodeFactory . createUniqueName ( '__NgCli_bootstrap_' ) ;
89
+ bootstrapImport = nodeFactory . createImportDeclaration (
89
90
undefined ,
90
91
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' ) ,
93
94
) ;
94
95
}
95
96
replacedNodes . push ( target ) ;
96
97
97
- return ts . updateCall (
98
+ return nodeFactory . updateCallExpression (
98
99
node ,
99
- ts . createPropertyAccess ( bootstrapNamespace , 'platformBrowser' ) ,
100
+ nodeFactory . createPropertyAccessExpression ( bootstrapNamespace , 'platformBrowser' ) ,
100
101
node . typeArguments ,
101
102
node . arguments ,
102
103
) ;
@@ -126,10 +127,10 @@ export function replaceBootstrap(
126
127
}
127
128
128
129
// Add new platform browser import
129
- return ts . updateSourceFileNode (
130
+ return nodeFactory . updateSourceFile (
130
131
updatedSourceFile ,
131
132
ts . setTextRange (
132
- ts . createNodeArray ( [ bootstrapImport , ...updatedSourceFile . statements ] ) ,
133
+ nodeFactory . createNodeArray ( [ bootstrapImport , ...updatedSourceFile . statements ] ) ,
133
134
sourceFile . statements ,
134
135
) ,
135
136
) ;
0 commit comments