@@ -70,8 +70,11 @@ export class AotCompiler {
70
70
// We need to temporarily patch the CodeGenerator until either it's patched or allows us
71
71
// to pass in our own ReflectorHost.
72
72
patchReflectorHost ( codeGenerator ) ;
73
+ Logger . debug ( '[AotCompiler] compile: starting codegen ... ' ) ;
73
74
return codeGenerator . codegen ( { transitiveModules : true } ) ;
74
75
} ) . then ( ( ) => {
76
+ Logger . debug ( '[AotCompiler] compile: starting codegen ... DONE' ) ;
77
+ Logger . debug ( '[AotCompiler] compile: Creating and validating new TypeScript Program ...' ) ;
75
78
// Create a new Program, based on the old one. This will trigger a resolution of all
76
79
// transitive modules, which include files that might just have been generated.
77
80
this . program = createProgram ( this . tsConfig . parsed . fileNames , this . tsConfig . parsed . options , this . compilerHost , this . program ) ;
@@ -92,23 +95,29 @@ export class AotCompiler {
92
95
}
93
96
} )
94
97
. 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: ' ) ;
95
100
for ( const fileName of this . tsConfig . parsed . fileNames ) {
101
+ Logger . debug ( `[AotCompiler] compile: ${ fileName } ` ) ;
96
102
const cleanedFileName = normalize ( resolve ( fileName ) ) ;
97
103
const content = readFileSync ( cleanedFileName ) . toString ( ) ;
98
104
this . context . fileCache . set ( cleanedFileName , { path : cleanedFileName , content : content } ) ;
99
105
}
100
106
} )
101
107
. then ( ( ) => {
108
+ Logger . debug ( '[AotCompiler] compile: Starting to process and modify entry point ...' ) ;
102
109
const mainFile = this . context . fileCache . get ( this . options . entryPoint ) ;
103
110
if ( ! mainFile ) {
104
111
throw new BuildError ( new Error ( `Could not find entry point (bootstrap file) ${ this . options . entryPoint } ` ) ) ;
105
112
}
106
113
const mainSourceFile = getTypescriptSourceFile ( mainFile . path , mainFile . content , ScriptTarget . Latest , false ) ;
114
+ Logger . debug ( '[AotCompiler] compile: Resolving NgModule from entry point' ) ;
107
115
const AppNgModuleStringAndClassName = resolveAppNgModuleFromMain ( mainSourceFile , this . context . fileCache , this . compilerHost , this . program ) ;
108
116
const AppNgModuleTokens = AppNgModuleStringAndClassName . split ( '#' ) ;
109
117
110
118
let modifiedFileContent : string = null ;
111
119
try {
120
+ Logger . debug ( '[AotCompiler] compile: Dynamically changing entry point content to AOT mode content' ) ;
112
121
modifiedFileContent = replaceBootstrap ( mainFile . path , mainFile . content , AppNgModuleTokens [ 0 ] , AppNgModuleTokens [ 1 ] ) ;
113
122
} catch ( ex ) {
114
123
Logger . debug ( `Failed to parse bootstrap: ` , ex . message ) ;
@@ -119,9 +128,12 @@ export class AotCompiler {
119
128
modifiedFileContent = getFallbackMainContent ( ) ;
120
129
}
121
130
131
+ Logger . debug ( `[AotCompiler] compile: Modified File Content: ${ modifiedFileContent } ` ) ;
122
132
this . context . fileCache . set ( this . options . entryPoint , { path : this . options . entryPoint , content : modifiedFileContent } ) ;
123
133
} )
124
134
. then ( ( ) => {
135
+ Logger . debug ( '[AotCompiler] compile: Starting to process and modify entry point ... DONE' ) ;
136
+ Logger . debug ( '[AotCompiler] compile: Removing decorators from program files ...' ) ;
125
137
const tsFiles = this . context . fileCache . getAll ( ) . filter ( file => extname ( file . path ) === '.ts' && file . path . indexOf ( '.d.ts' ) === - 1 ) ;
126
138
for ( const tsFile of tsFiles ) {
127
139
const cleanedFileContent = removeDecorators ( tsFile . path , tsFile . content ) ;
@@ -138,6 +150,7 @@ export class AotCompiler {
138
150
this . fileSystem . addVirtualFile ( jsFilePath , transpileOutput . outputText ) ;
139
151
this . fileSystem . addVirtualFile ( jsFilePath + '.map' , transpileOutput . sourceMapText ) ;
140
152
}
153
+ Logger . debug ( '[AotCompiler] compile: Removing decorators from program files ... DONE' ) ;
141
154
} ) ;
142
155
}
143
156
0 commit comments