6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+ import { Logger } from '@angular/compiler-cli/ngcc' ;
9
10
import * as ts from 'typescript' ;
10
11
import { InputFileSystem } from 'webpack' ;
11
12
import { time , timeEnd } from './benchmark' ;
@@ -24,11 +25,16 @@ import { workaroundResolve } from './utils';
24
25
export class NgccProcessor {
25
26
private _processedModules = new Set < string > ( ) ;
26
27
28
+ private _logger : NgccLogger ;
29
+
27
30
constructor (
28
31
private readonly ngcc : typeof import ( '@angular/compiler-cli/ngcc' ) ,
29
32
private readonly propertiesToConsider : string [ ] ,
30
33
private readonly inputFileSystem : InputFileSystem ,
34
+ private readonly compilationWarnings : ( Error | string ) [ ] ,
35
+ private readonly compilationErrors : ( Error | string ) [ ] ,
31
36
) {
37
+ this . _logger = new NgccLogger ( this . compilationWarnings , this . compilationErrors ) ;
32
38
}
33
39
34
40
processModule (
@@ -61,6 +67,7 @@ export class NgccProcessor {
61
67
propertiesToConsider : this . propertiesToConsider ,
62
68
compileAllFormats : false ,
63
69
createNewEntryPointFormats : true ,
70
+ logger : this . _logger ,
64
71
} ) ;
65
72
timeEnd ( timeLabel ) ;
66
73
@@ -95,3 +102,23 @@ export class NgccProcessor {
95
102
}
96
103
}
97
104
}
105
+
106
+ class NgccLogger implements Logger {
107
+ constructor (
108
+ private readonly compilationWarnings : ( Error | string ) [ ] ,
109
+ private readonly compilationErrors : ( Error | string ) [ ] ,
110
+ ) {
111
+ }
112
+
113
+ debug ( ..._args : string [ ] ) { }
114
+
115
+ info ( ..._args : string [ ] ) { }
116
+
117
+ warn ( ...args : string [ ] ) {
118
+ this . compilationWarnings . push ( args . join ( ' ' ) ) ;
119
+ }
120
+
121
+ error ( ...args : string [ ] ) {
122
+ this . compilationErrors . push ( new Error ( args . join ( ' ' ) ) ) ;
123
+ }
124
+ }
0 commit comments