@@ -70,8 +70,11 @@ export class AotCompiler {
7070 // We need to temporarily patch the CodeGenerator until either it's patched or allows us
7171 // to pass in our own ReflectorHost.
7272 patchReflectorHost ( codeGenerator ) ;
73+ Logger . debug ( '[AotCompiler] compile: starting codegen ... ' ) ;
7374 return codeGenerator . codegen ( { transitiveModules : true } ) ;
7475 } ) . then ( ( ) => {
76+ Logger . debug ( '[AotCompiler] compile: starting codegen ... DONE' ) ;
77+ Logger . debug ( '[AotCompiler] compile: Creating and validating new TypeScript Program ...' ) ;
7578 // Create a new Program, based on the old one. This will trigger a resolution of all
7679 // transitive modules, which include files that might just have been generated.
7780 this . program = createProgram ( this . tsConfig . parsed . fileNames , this . tsConfig . parsed . options , this . compilerHost , this . program ) ;
@@ -92,23 +95,29 @@ export class AotCompiler {
9295 }
9396 } )
9497 . then ( ( ) => {
98+ Logger . debug ( '[AotCompiler] compile: Creating and validating new TypeScript Program ... DONE' ) ;
99+ Logger . debug ( '[AotCompiler] compile: The following files are included in the program: ' ) ;
95100 for ( const fileName of this . tsConfig . parsed . fileNames ) {
101+ Logger . debug ( `[AotCompiler] compile: ${ fileName } ` ) ;
96102 const cleanedFileName = normalize ( resolve ( fileName ) ) ;
97103 const content = readFileSync ( cleanedFileName ) . toString ( ) ;
98104 this . context . fileCache . set ( cleanedFileName , { path : cleanedFileName , content : content } ) ;
99105 }
100106 } )
101107 . then ( ( ) => {
108+ Logger . debug ( '[AotCompiler] compile: Starting to process and modify entry point ...' ) ;
102109 const mainFile = this . context . fileCache . get ( this . options . entryPoint ) ;
103110 if ( ! mainFile ) {
104111 throw new BuildError ( new Error ( `Could not find entry point (bootstrap file) ${ this . options . entryPoint } ` ) ) ;
105112 }
106113 const mainSourceFile = getTypescriptSourceFile ( mainFile . path , mainFile . content , ScriptTarget . Latest , false ) ;
114+ Logger . debug ( '[AotCompiler] compile: Resolving NgModule from entry point' ) ;
107115 const AppNgModuleStringAndClassName = resolveAppNgModuleFromMain ( mainSourceFile , this . context . fileCache , this . compilerHost , this . program ) ;
108116 const AppNgModuleTokens = AppNgModuleStringAndClassName . split ( '#' ) ;
109117
110118 let modifiedFileContent : string = null ;
111119 try {
120+ Logger . debug ( '[AotCompiler] compile: Dynamically changing entry point content to AOT mode content' ) ;
112121 modifiedFileContent = replaceBootstrap ( mainFile . path , mainFile . content , AppNgModuleTokens [ 0 ] , AppNgModuleTokens [ 1 ] ) ;
113122 } catch ( ex ) {
114123 Logger . debug ( `Failed to parse bootstrap: ` , ex . message ) ;
@@ -119,9 +128,12 @@ export class AotCompiler {
119128 modifiedFileContent = getFallbackMainContent ( ) ;
120129 }
121130
131+ Logger . debug ( `[AotCompiler] compile: Modified File Content: ${ modifiedFileContent } ` ) ;
122132 this . context . fileCache . set ( this . options . entryPoint , { path : this . options . entryPoint , content : modifiedFileContent } ) ;
123133 } )
124134 . then ( ( ) => {
135+ Logger . debug ( '[AotCompiler] compile: Starting to process and modify entry point ... DONE' ) ;
136+ Logger . debug ( '[AotCompiler] compile: Removing decorators from program files ...' ) ;
125137 const tsFiles = this . context . fileCache . getAll ( ) . filter ( file => extname ( file . path ) === '.ts' && file . path . indexOf ( '.d.ts' ) === - 1 ) ;
126138 for ( const tsFile of tsFiles ) {
127139 const cleanedFileContent = removeDecorators ( tsFile . path , tsFile . content ) ;
@@ -138,6 +150,7 @@ export class AotCompiler {
138150 this . fileSystem . addVirtualFile ( jsFilePath , transpileOutput . outputText ) ;
139151 this . fileSystem . addVirtualFile ( jsFilePath + '.map' , transpileOutput . sourceMapText ) ;
140152 }
153+ Logger . debug ( '[AotCompiler] compile: Removing decorators from program files ... DONE' ) ;
141154 } ) ;
142155 }
143156
0 commit comments