@@ -17,6 +17,8 @@ const NATIVE_IS_SUPPORTED = isNativeSupported();
1717
1818const moduleFileCache = { } ;
1919
20+ const JINJA_SYNTAX = / { % | % } | { { | } } / ig;
21+
2022export class DataSchemaCompiler {
2123 constructor ( repository , options = { } ) {
2224 this . repository = repository ;
@@ -122,7 +124,11 @@ export class DataSchemaCompiler {
122124 }
123125
124126 transpileFile ( file , errorsReport ) {
125- if ( R . endsWith ( '.jinja' , file . fileName ) ) {
127+ if ( R . endsWith ( '.jinja' , file . fileName ) ||
128+ ( R . endsWith ( '.yml' , file . fileName ) || R . endsWith ( '.yaml' , file . fileName ) )
129+ // TODO do Jinja syntax check with jinja compiler
130+ && file . content . match ( JINJA_SYNTAX )
131+ ) {
126132 if ( NATIVE_IS_SUPPORTED !== true ) {
127133 throw new Error (
128134 `Native extension is required to process jinja files. ${ NATIVE_IS_SUPPORTED . reason } . Read more: ` +
@@ -234,7 +240,12 @@ export class DataSchemaCompiler {
234240
235241 if ( R . endsWith ( '.js' , file . fileName ) ) {
236242 this . compileJsFile ( file , errorsReport , cubes , contexts , exports , asyncModules , toCompile , compiledFiles ) ;
237- } else if ( R . endsWith ( '.yml.jinja' , file . fileName ) || R . endsWith ( '.yaml.jinja' , file . fileName ) ) {
243+ } else if ( R . endsWith ( '.yml.jinja' , file . fileName ) || R . endsWith ( '.yaml.jinja' , file . fileName ) ||
244+ (
245+ R . endsWith ( '.yml' , file . fileName ) || R . endsWith ( '.yaml' , file . fileName )
246+ // TODO do Jinja syntax check with jinja compiler
247+ ) && file . content . match ( JINJA_SYNTAX )
248+ ) {
238249 this . yamlCompiler . compileYamlWithJinjaFile (
239250 file ,
240251 errorsReport ,
0 commit comments