@@ -225,6 +225,11 @@ export class DataSchemaCompiler {
225
225
? files . filter ( f => this . filesToCompile . includes ( f . fileName ) )
226
226
: files ;
227
227
228
+ const toCompileFilesMap = toCompile . reduce ( ( acc , f ) => {
229
+ acc [ f . fileName ] = f ;
230
+ return acc ;
231
+ } , { } as Record < string , FileContent > ) ;
232
+
228
233
const errorsReport = new ErrorReporter ( null , [ ] , this . errorReportOptions ) ;
229
234
this . errorsReporter = errorsReport ;
230
235
@@ -399,7 +404,7 @@ export class DataSchemaCompiler {
399
404
errorsReport ,
400
405
compiledFiles ,
401
406
[ ] ,
402
- [ ] ,
407
+ { } ,
403
408
{ doSyntaxCheck : true }
404
409
) ;
405
410
exports [ foundFile . fileName ] = exports [ foundFile . fileName ] || { } ;
@@ -420,7 +425,7 @@ export class DataSchemaCompiler {
420
425
asyncModules = [ ] ;
421
426
transpiledFiles = await transpile ( stage ) ;
422
427
423
- const res = this . compileCubeFiles ( cubes , contexts , compiledFiles , asyncModules , compilers , transpiledFiles , toCompile , errorsReport ) ;
428
+ const res = this . compileCubeFiles ( cubes , contexts , compiledFiles , asyncModules , compilers , transpiledFiles , toCompileFilesMap , errorsReport ) ;
424
429
compilePhaseTimer . end ( ) ;
425
430
return res ;
426
431
} ;
@@ -661,7 +666,7 @@ export class DataSchemaCompiler {
661
666
asyncModules : CallableFunction [ ] ,
662
667
compilers : CompileCubeFilesCompilers ,
663
668
transpiledFiles : FileContent [ ] ,
664
- toCompile : FileContent [ ] ,
669
+ toCompileFilesMap : Record < string , FileContent > ,
665
670
errorsReport : ErrorReporter
666
671
) {
667
672
transpiledFiles
@@ -671,7 +676,7 @@ export class DataSchemaCompiler {
671
676
errorsReport ,
672
677
compiledFiles ,
673
678
asyncModules ,
674
- toCompile
679
+ toCompileFilesMap
675
680
) ;
676
681
} ) ;
677
682
await asyncModules . reduce ( ( a : Promise < void > , b : CallableFunction ) => a . then ( ( ) => b ( ) ) , Promise . resolve ( ) ) ;
@@ -688,7 +693,7 @@ export class DataSchemaCompiler {
688
693
errorsReport : ErrorReporter ,
689
694
compiledFiles : Record < string , boolean > ,
690
695
asyncModules : CallableFunction [ ] ,
691
- toCompile : FileContent [ ] ,
696
+ toCompileFilesMap : Record < string , FileContent > ,
692
697
{ doSyntaxCheck } = { doSyntaxCheck : false }
693
698
) {
694
699
if ( compiledFiles [ file . fileName ] ) {
@@ -717,7 +722,7 @@ export class DataSchemaCompiler {
717
722
this . pythonContext !
718
723
) ;
719
724
if ( transpiledFile ) {
720
- const originalFile = toCompile . find ( f => f . fileName === file . fileName ) ;
725
+ const originalFile = toCompileFilesMap [ file . fileName ] ;
721
726
originalFile ! . content = transpiledFile . content ;
722
727
originalFile ! . convertedToJs = true ;
723
728
0 commit comments