Skip to content

Commit d445284

Browse files
committed
extracted yaml and jinja transpilation in separate functions
1 parent d240ae9 commit d445284

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,9 @@ export class DataSchemaCompiler {
575575
(file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml'))
576576
&& file.content.match(JINJA_SYNTAX)
577577
) {
578-
return this.yamlCompiler.compileYamlWithJinjaFile(
579-
file,
580-
errorsReport,
581-
this.standalone ? {} : this.cloneCompileContextWithGetterAlias(this.compileContext),
582-
this.pythonContext!
583-
);
578+
return this.transpileJinjaFile(file, errorsReport, options);
584579
} else if (file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) {
585-
return this.yamlCompiler.transpileYamlFile(file, errorsReport);
580+
return this.transpileYamlFile(file, errorsReport, options);
586581
} else {
587582
return file;
588583
}
@@ -705,6 +700,39 @@ export class DataSchemaCompiler {
705700
return undefined;
706701
}
707702

703+
private async transpileYamlFile(
704+
file: FileContent,
705+
errorsReport: ErrorReporter,
706+
{ cubeNames, cubeSymbols, contextSymbols, transpilerNames, compilerId, stage }: TranspileOptions
707+
): Promise<(FileContent | undefined)> {
708+
// if (getEnv('transpilationNative')) {
709+
//
710+
// } else if (getEnv('transpilationWorkerThreads')) {
711+
//
712+
// } else {
713+
return this.yamlCompiler.transpileYamlFile(file, errorsReport);
714+
// }
715+
}
716+
717+
private async transpileJinjaFile(
718+
file: FileContent,
719+
errorsReport: ErrorReporter,
720+
{ cubeNames, cubeSymbols, contextSymbols, transpilerNames, compilerId, stage }: TranspileOptions
721+
): Promise<(FileContent | undefined)> {
722+
// if (getEnv('transpilationNative')) {
723+
//
724+
// } else if (getEnv('transpilationWorkerThreads')) {
725+
//
726+
// } else {
727+
return this.yamlCompiler.compileYamlWithJinjaFile(
728+
file,
729+
errorsReport,
730+
this.standalone ? {} : this.cloneCompileContextWithGetterAlias(this.compileContext),
731+
this.pythonContext!
732+
);
733+
// }
734+
}
735+
708736
public withQuery(query, fn) {
709737
const oldQuery = this.currentQuery;
710738
this.currentQuery = query;

0 commit comments

Comments
 (0)