Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getCompilers() {
let compilerVersion = (
this.schemaVersion && this.schemaVersion() ||
'default_schema_version'
).toString();
if (this.options.devServer) {
const files = await this.repository.dataSchemaFiles();
compilerVersion += `_${crypto.createHash('md5').update(JSON.stringify(files)).digest("hex")}`;
}
if (!this.compilers || this.compilerVersion !== compilerVersion) {
this.logger(this.compilers ? 'Recompiling schema' : 'Compiling schema', { version: compilerVersion });
// TODO check if saving this promise can produce memory leak?
this.compilers = PrepareCompiler.compile(this.repository, {
allowNodeRequire: this.allowNodeRequire
});
this.compilerVersion = compilerVersion;
}
return this.compilers;
}