Skip to content

Commit af102ad

Browse files
committed
fix(schema-compiler): Skip syntax check for transpiled files
1 parent 8c4566c commit af102ad

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export class DataSchemaCompiler {
337337
}
338338

339339
compileFile(
340-
file, errorsReport, cubes, exports, contexts, toCompile, compiledFiles, asyncModules
340+
file, errorsReport, cubes, exports, contexts, toCompile, compiledFiles, asyncModules, { doSyntaxCheck } = { doSyntaxCheck: false }
341341
) {
342342
if (compiledFiles[file.fileName]) {
343343
return;
@@ -370,10 +370,15 @@ export class DataSchemaCompiler {
370370
}
371371
}
372372

373-
compileJsFile(file, errorsReport, cubes, contexts, exports, asyncModules, toCompile, compiledFiles) {
374-
const err = syntaxCheck(file.content, file.fileName);
375-
if (err) {
376-
errorsReport.error(err.toString());
373+
compileJsFile(file, errorsReport, cubes, contexts, exports, asyncModules, toCompile, compiledFiles, { doSyntaxCheck } = { doSyntaxCheck: false }) {
374+
if (doSyntaxCheck) {
375+
// There is no need to run syntax check for data model files
376+
// because they were checked during transpilation/transformation phase
377+
// Only external files (included modules) might need syntax check
378+
const err = syntaxCheck(file.content, file.fileName);
379+
if (err) {
380+
errorsReport.error(err.toString());
381+
}
377382
}
378383

379384
try {
@@ -424,6 +429,8 @@ export class DataSchemaCompiler {
424429
contexts,
425430
toCompile,
426431
compiledFiles,
432+
[],
433+
{ doSyntaxCheck: true }
427434
);
428435
exports[foundFile.fileName] = exports[foundFile.fileName] || {};
429436
return exports[foundFile.fileName];

0 commit comments

Comments
 (0)