Skip to content

Commit bcafe58

Browse files
committed
removed dataSchemaCompiler from YamlCompiler's deps
1 parent bbb7c2c commit bcafe58

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export class DataSchemaCompiler {
172172
this.standalone = options.standalone || false;
173173
this.nativeInstance = options.nativeInstance;
174174
this.yamlCompiler = options.yamlCompiler;
175-
this.yamlCompiler.dataSchemaCompiler = this;
176175
this.pythonContext = null;
177176
this.workerPool = null;
178177
this.compilerId = options.compilerId || 'default';
@@ -671,12 +670,17 @@ export class DataSchemaCompiler {
671670
// TODO do Jinja syntax check with jinja compiler
672671
) && file.content.match(JINJA_SYNTAX)
673672
) {
674-
asyncModules.push(() => this.yamlCompiler.compileYamlWithJinjaFile(
675-
file,
676-
errorsReport,
677-
this.standalone ? {} : this.cloneCompileContextWithGetterAlias(this.compileContext),
678-
this.pythonContext!
679-
));
673+
asyncModules.push(async () => {
674+
const transpiledFile = await this.yamlCompiler.compileYamlWithJinjaFile(
675+
file,
676+
errorsReport,
677+
this.standalone ? {} : this.cloneCompileContextWithGetterAlias(this.compileContext),
678+
this.pythonContext!
679+
);
680+
if (transpiledFile) {
681+
this.compileJsFile(transpiledFile, errorsReport);
682+
}
683+
});
680684
} else if (file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) {
681685
// original yaml file was already transpiled into js
682686
this.compileJsFile(file, errorsReport);

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { getEnv } from '@cubejs-backend/shared';
1111
import { CubePropContextTranspiler, transpiledFields, transpiledFieldsPatterns } from './transpilers';
1212
import { PythonParser } from '../parser/PythonParser';
1313
import { CubeSymbols } from './CubeSymbols';
14-
import { DataSchemaCompiler } from './DataSchemaCompiler';
1514
import { nonStringFields } from './CubeValidator';
1615
import { CubeDictionary } from './CubeDictionary';
1716
import { ErrorReporter } from './ErrorReporter';
@@ -25,8 +24,6 @@ type EscapeStateStack = {
2524
};
2625

2726
export class YamlCompiler {
28-
public dataSchemaCompiler: DataSchemaCompiler | null = null;
29-
3027
protected jinjaEngine: JinjaEngine | null = null;
3128

3229
public constructor(
@@ -68,16 +65,10 @@ export class YamlCompiler {
6865
errorsReport: ErrorReporter,
6966
compileContext,
7067
pythonContext: PythonCtx
71-
) {
68+
): Promise<FileContent | undefined> {
7269
const renderedFile = await this.renderTemplate(file, compileContext, pythonContext);
7370

74-
const transpiledFile = this.transpileYamlFile(renderedFile, errorsReport);
75-
76-
if (!transpiledFile) {
77-
return;
78-
}
79-
80-
this.dataSchemaCompiler?.compileJsFile(transpiledFile, errorsReport);
71+
return this.transpileYamlFile(renderedFile, errorsReport);
8172
}
8273

8374
public transpileYamlFile(

0 commit comments

Comments
 (0)