Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 3b2af22

Browse files
committed
refactor(transformer): add a comment for each transform operation
1 parent aa27588 commit 3b2af22

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

transformers/ns-replace-bootstrap.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,25 @@ export function nsReplaceBootstrap(getNgCompiler: () => AngularCompilerPlugin):
8181
const factoryClassName = entryModule.className + 'NgFactory';
8282
const factoryModulePath = normalizedEntryModulePath + '.ngfactory';
8383
ops.push(
84-
// Replace the entry module import.
84+
// Insert an import of the module factory:
85+
// import * as __NgCli_bootstrap_1 from "./app.module.ngfactory";
8586
...insertStarImport(sourceFile, idNgFactory, factoryModulePath),
87+
88+
// Replace the NgModule nodes with NgModuleFactory nodes
89+
// from 'AppModule' to 'AppModuleNgFactory'
8690
new ReplaceNodeOperation(sourceFile, entryModuleIdentifier,
8791
ts.createPropertyAccess(idNgFactory, ts.createIdentifier(factoryClassName))),
8892

89-
// Replace the platformBrowserDynamic import.
93+
// Insert an import of the {N} Angular static bootstrap module:
94+
// import * as __NgCli_bootstrap_2 from "nativescript-angular/platform-static";
9095
...insertStarImport(sourceFile, idPlatformBrowser, 'nativescript-angular/platform-static'),
96+
97+
// Replace 'platformNativeScriptDynamic' with 'platformNativeScript'
98+
// and elide all imports of 'platformNativeScriptDynamic'
9199
new ReplaceNodeOperation(sourceFile, platformBrowserDynamicIdentifier,
92100
ts.createPropertyAccess(idPlatformBrowser, 'platformNativeScript')),
93101

102+
// Replace the invocation of 'boostrapModule' with 'bootsrapModuleFactory'
94103
new ReplaceNodeOperation(sourceFile, bootstrapModuleIdentifier,
95104
ts.createIdentifier('bootstrapModuleFactory')),
96105
);

0 commit comments

Comments
 (0)