diff --git a/flow/compiler.js b/flow/compiler.js index 734d158752b..fcbf147cb4c 100644 --- a/flow/compiler.js +++ b/flow/compiler.js @@ -21,6 +21,8 @@ declare type CompilerOptions = { // runtime user-configurable delimiters?: [string, string]; // template delimiters + + plugins?: Array; // customizing plugins to process ast }; declare type CompiledResult = { diff --git a/src/compiler/index.js b/src/compiler/index.js index 075917bdc37..9323899f5b9 100644 --- a/src/compiler/index.js +++ b/src/compiler/index.js @@ -14,6 +14,9 @@ export const createCompiler = createCompilerCreator(function baseCompile ( ): CompiledResult { const ast = parse(template.trim(), options) optimize(ast, options) + if (options.plugins) { + options.plugins.forEach(plugin => plugin(ast, options)) + } const code = generate(ast, options) return { ast,