@@ -111,21 +111,27 @@ function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration
111
111
}
112
112
}
113
113
114
- function parseConfiguration ( ) {
115
- const parseConfigurationDiagnostics = [ ] ;
114
+ function getParseConfigFileHost ( ) {
115
+ const parseConfigDiagnostics : ts . Diagnostic [ ] = [ ] ;
116
116
117
117
let parseConfigFileHost : ts . ParseConfigFileHost = {
118
118
...system ,
119
119
onUnRecoverableConfigFileDiagnostic : ( diagnostic ) => {
120
- parseConfigurationDiagnostics . push ( diagnostic ) ;
120
+ parseConfigDiagnostics . push ( diagnostic ) ;
121
121
} ,
122
122
} ;
123
123
124
- extensions . forEach ( ( extension ) => {
124
+ for ( const extension of extensions ) {
125
125
if ( extension . extendParseConfigFileHost ) {
126
126
parseConfigFileHost = extension . extendParseConfigFileHost ( parseConfigFileHost ) ;
127
127
}
128
- } ) ;
128
+ }
129
+
130
+ return [ parseConfigFileHost , parseConfigDiagnostics ] as const ;
131
+ }
132
+
133
+ function parseConfiguration ( ) {
134
+ const [ parseConfigFileHost , parseConfigDiagnostics ] = getParseConfigFileHost ( ) ;
129
135
130
136
const parsedConfiguration = parseTypeScriptConfiguration (
131
137
typescript ,
@@ -136,10 +142,10 @@ function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration
136
142
) ;
137
143
138
144
if ( parsedConfiguration . errors ) {
139
- parseConfigurationDiagnostics . push ( ...parsedConfiguration . errors ) ;
145
+ parseConfigDiagnostics . push ( ...parsedConfiguration . errors ) ;
140
146
}
141
147
142
- return [ parsedConfiguration , parseConfigurationDiagnostics ] as const ;
148
+ return [ parsedConfiguration , parseConfigDiagnostics ] as const ;
143
149
}
144
150
145
151
function parseConfigurationIfNeeded ( ) : ts . ParsedCommandLine {
@@ -153,19 +159,22 @@ function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration
153
159
function getDependencies ( ) : Dependencies {
154
160
parsedConfiguration = parseConfigurationIfNeeded ( ) ;
155
161
156
- const parseConfigFileHost : ts . ParseConfigFileHost = {
157
- ...system ,
158
- onUnRecoverableConfigFileDiagnostic : ( ) => {
159
- // it's handled in a different place
160
- } ,
161
- } ;
162
+ const [ parseConfigFileHost ] = getParseConfigFileHost ( ) ;
162
163
163
- return getDependenciesFromTypeScriptConfiguration (
164
+ let dependencies = getDependenciesFromTypeScriptConfiguration (
164
165
typescript ,
165
166
parsedConfiguration ,
166
167
configuration . context ,
167
168
parseConfigFileHost
168
169
) ;
170
+
171
+ for ( const extension of extensions ) {
172
+ if ( extension . extendDependencies ) {
173
+ dependencies = extension . extendDependencies ( dependencies ) ;
174
+ }
175
+ }
176
+
177
+ return dependencies ;
169
178
}
170
179
171
180
function startProfilingIfNeeded ( ) {
@@ -274,13 +283,6 @@ function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration
274
283
async getDependencies ( ) {
275
284
if ( ! dependencies ) {
276
285
dependencies = getDependencies ( ) ;
277
- for ( const extension of extensions ) {
278
- if ( extension . extendSupportedFileExtensions ) {
279
- dependencies . extensions = extension . extendSupportedFileExtensions (
280
- dependencies . extensions
281
- ) ;
282
- }
283
- }
284
286
}
285
287
286
288
return dependencies ;
0 commit comments