Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private internalTemplateResolver(): CompatResolver {
let resolver = new CompatResolver({
root: this.root,
modulePrefix: this.modulePrefix(),
options: this.options,
activePackageRules: this.activeRules(),
resolvableExtensions: this.resolvableExtensions(),
});
// It's ok that this isn't a fully configured template compiler. We're only
// using it to parse component snippets out of rules.
resolver.astTransformer(
new TemplateCompiler({
compilerPath: resolveSync(this.templateCompilerPath(), { basedir: this.root }),
EmberENV: {},
plugins: {},
})
);
return resolver;
}
private get templateCompiler(): TemplateCompiler | undefined {
let htmlbars = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars');
if (htmlbars) {
let options = htmlbars.htmlbarsOptions() as HTMLBarsOptions;
if (options.plugins && options.plugins.ast) {
// our macros don't run here in stage1
options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));
if (options.plugins.ast.length > 0) {
return new TemplateCompiler({
compilerPath: options.templateCompilerPath,
EmberENV: {},
plugins: options.plugins,
});
}
}
}
}