Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function babelPluginAllowedInStage1(plugin: PluginItem) {
if (isEmbroiderMacrosPlugin(plugin)) {
// the point of @embroider/macros is that it's allowed to stay in v2
// addon publication format, so it doesn't need to run here in stage1.
// We always run it in stage3.
return false;
}
if (TemplateCompiler.isInlinePrecompilePlugin(plugin)) {
// Similarly, the inline precompile plugin must not run in stage1. We
// want all templates uncompiled. Instead, we will be adding our own
// plugin that only runs custom AST transforms inside inline
// templates.
return false;
}
return true;
}
plugins = plugins.filter(p => {
// even if the app was using @embroider/macros, we drop it from the config
// here in favor of our globally-configured one.
return (
!isEmbroiderMacrosPlugin(p) &&
// similarly, if the app was already using an inline template compiler
// babel plugin, we remove it here because we have our own
// always-installed version of that (v2 addons are allowed to assume it
// will be present in the final app build, the app doesn't get to turn
// that off or configure it.)
!TemplateCompiler.isInlinePrecompilePlugin(p)
);
});
options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));
}
options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));
if (options.plugins.ast.length > 0) {