@@ -295,11 +295,9 @@ export class DataSchemaCompiler {
295295 }
296296
297297 if ( transpilationNative ) {
298- const nonJsFilesTasks = [ ...jinjaTemplatedFiles , ...yamlFiles ]
299- . map ( f => this . transpileFile ( f , errorsReport , { cubeNames, cubeSymbols, transpilerNames, compilerId } ) ) ;
300-
301298 const jsFiles = originalJsFiles ;
302299 let jsFilesTasks : Promise < ( FileContent | undefined ) [ ] > [ ] = [ ] ;
300+ let yamlFilesTasks : Promise < ( FileContent | undefined ) [ ] > [ ] = [ ] ;
303301
304302 if ( jsFiles . length > 0 ) {
305303 // Warming up swc compiler cache
@@ -311,10 +309,18 @@ export class DataSchemaCompiler {
311309 await this . transpileJsFile ( dummyFile , errorsReport , { cubeNames, cubeSymbols, transpilerNames, contextSymbols : CONTEXT_SYMBOLS , compilerId, stage } ) ;
312310
313311 const jsChunks = splitFilesToChunks ( jsFiles , transpilationNativeThreadsCount ) ;
314- jsFilesTasks = jsChunks . map ( chunk => this . transpileJsFilesBulk ( chunk , errorsReport , { transpilerNames, compilerId } ) ) ;
312+ jsFilesTasks = jsChunks . map ( chunk => this . transpileJsFilesNativeBulk ( chunk , errorsReport , { transpilerNames, compilerId } ) ) ;
313+ }
314+
315+ if ( yamlFiles . length > 0 ) {
316+ const yamlChunks = splitFilesToChunks ( yamlFiles , transpilationNativeThreadsCount ) ;
317+ yamlFilesTasks = yamlChunks . map ( chunk => this . transpileYamlFilesNativeBulk ( chunk , errorsReport , { transpilerNames, compilerId } ) ) ;
315318 }
316319
317- results = ( await Promise . all ( [ ...nonJsFilesTasks , ...jsFilesTasks ] ) ) . flat ( ) ;
320+ const jinjaFilesTasks = jinjaTemplatedFiles
321+ . map ( f => this . transpileJinjaFile ( f , errorsReport , { cubeNames, cubeSymbols, transpilerNames } ) ) ;
322+
323+ results = ( await Promise . all ( [ ...jsFilesTasks , ...yamlFilesTasks , ...jinjaFilesTasks ] ) ) . flat ( ) ;
318324 } else if ( transpilationWorkerThreads ) {
319325 results = await Promise . all ( toCompile . map ( f => this . transpileFile ( f , errorsReport , { cubeNames, cubeSymbols, transpilerNames } ) ) ) ;
320326 } else {
@@ -350,7 +356,7 @@ export class DataSchemaCompiler {
350356 await this . transpileJsFile ( dummyFile , errorsReport , { cubeNames, cubeSymbols, transpilerNames, contextSymbols : CONTEXT_SYMBOLS , compilerId, stage } ) ;
351357
352358 const jsChunks = splitFilesToChunks ( toCompile , transpilationNativeThreadsCount ) ;
353- const jsFilesTasks = jsChunks . map ( chunk => this . transpileJsFilesBulk ( chunk , errorsReport , { transpilerNames, compilerId } ) ) ;
359+ const jsFilesTasks = jsChunks . map ( chunk => this . transpileJsFilesNativeBulk ( chunk , errorsReport , { transpilerNames, compilerId } ) ) ;
354360
355361 results = ( await Promise . all ( jsFilesTasks ) ) . flat ( ) ;
356362 } else if ( transpilationWorkerThreads ) {
@@ -591,11 +597,7 @@ export class DataSchemaCompiler {
591597 }
592598 }
593599
594- /**
595- * Right now it is used only for transpilation in native,
596- * so no checks for transpilation type inside this method
597- */
598- private async transpileJsFilesBulk (
600+ private async transpileJsFilesNativeBulk (
599601 files : FileContent [ ] ,
600602 errorsReport : ErrorReporter ,
601603 { cubeNames, cubeSymbols, contextSymbols, transpilerNames, compilerId, stage } : TranspileOptions
@@ -633,6 +635,33 @@ export class DataSchemaCompiler {
633635 } ) ;
634636 }
635637
638+ private async transpileYamlFilesNativeBulk (
639+ files : FileContent [ ] ,
640+ errorsReport : ErrorReporter ,
641+ { compilerId } : TranspileOptions
642+ ) : Promise < ( FileContent | undefined ) [ ] > {
643+ const reqDataArr = files . map ( file => ( {
644+ fileName : file . fileName ,
645+ fileContent : file . content ,
646+ transpilers : [ ] ,
647+ compilerId : compilerId || '' ,
648+ } ) ) ;
649+ const res = await transpileYaml ( reqDataArr ) ;
650+
651+ return files . map ( ( file , index ) => {
652+ errorsReport . inFile ( file ) ;
653+ if ( ! res [ index ] ) { // This should not happen in theory but just to be safe
654+ errorsReport . error ( `No transpilation result received for the file ${ file . fileName } .` ) ;
655+ return undefined ;
656+ }
657+ errorsReport . addErrors ( res [ index ] . errors ) ;
658+ errorsReport . addWarnings ( res [ index ] . warnings as unknown as SyntaxErrorInterface [ ] ) ;
659+ errorsReport . exitFile ( ) ;
660+
661+ return { ...file , content : res [ index ] . code } ;
662+ } ) ;
663+ }
664+
636665 private async transpileJsFile (
637666 file : FileContent ,
638667 errorsReport : ErrorReporter ,
0 commit comments