@@ -13,7 +13,7 @@ import workerpool from 'workerpool';
1313import { LRUCache } from 'lru-cache' ;
1414
1515import { FileContent , getEnv , isNativeSupported , SchemaFileRepository } from '@cubejs-backend/shared' ;
16- import { NativeInstance , PythonCtx , transpileJs } from '@cubejs-backend/native' ;
16+ import { NativeInstance , PythonCtx , transpileJs , transpileYaml } from '@cubejs-backend/native' ;
1717import { UserError } from './UserError' ;
1818import { ErrorReporter , ErrorReporterOptions , SyntaxErrorInterface } from './ErrorReporter' ;
1919import { CONTEXT_SYMBOLS , CubeDefinition , CubeSymbols } from './CubeSymbols' ;
@@ -707,7 +707,7 @@ export class DataSchemaCompiler {
707707 private async transpileYamlFile (
708708 file : FileContent ,
709709 errorsReport : ErrorReporter ,
710- { cubeNames, cubeSymbols, contextSymbols , transpilerNames , compilerId, stage } : TranspileOptions
710+ { cubeNames, cubeSymbols, compilerId } : TranspileOptions
711711 ) : Promise < ( FileContent | undefined ) > {
712712 const cacheKey = crypto . createHash ( 'md5' ) . update ( JSON . stringify ( file . content ) ) . digest ( 'hex' ) ;
713713
@@ -717,9 +717,24 @@ export class DataSchemaCompiler {
717717 return { ...file , content } ;
718718 }
719719
720- /* if (getEnv('transpilationNative')) {
720+ if ( getEnv ( 'transpilationNative' ) ) {
721+ const reqData = {
722+ fileName : file . fileName ,
723+ fileContent : file . content ,
724+ transpilers : [ ] ,
725+ compilerId : compilerId || '' ,
726+ } ;
727+
728+ errorsReport . inFile ( file ) ;
729+ const res = await transpileYaml ( [ reqData ] ) ;
730+ errorsReport . addErrors ( res [ 0 ] . errors ) ;
731+ errorsReport . addWarnings ( res [ 0 ] . warnings as unknown as SyntaxErrorInterface [ ] ) ;
732+ errorsReport . exitFile ( ) ;
733+
734+ this . compiledYamlCache . set ( cacheKey , res [ 0 ] . code ) ;
721735
722- } else */ if ( getEnv ( 'transpilationWorkerThreads' ) ) {
736+ return { ...file , content : res [ 0 ] . code } ;
737+ } else if ( getEnv ( 'transpilationWorkerThreads' ) ) {
723738 const data = {
724739 fileName : file . fileName ,
725740 content : file . content ,
0 commit comments