From 615dccd00e7d85a3f4b82e62d6cb6c41f167d8c6 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Wed, 22 Jul 2020 00:46:20 +0530 Subject: [PATCH] feat(compiler-core/internal): add `onContextCreated` option to `generate` (#1672) --- packages/compiler-core/src/codegen.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/compiler-core/src/codegen.ts b/packages/compiler-core/src/codegen.ts index fab88a2f..31fe534c 100644 --- a/packages/compiler-core/src/codegen.ts +++ b/packages/compiler-core/src/codegen.ts @@ -180,9 +180,12 @@ function createCodegenContext( export function generate( ast: RootNode, - options: CodegenOptions = {} + options: CodegenOptions & { + onContextCreated?: (context: CodegenContext) => void + } = {} ): CodegenResult { const context = createCodegenContext(ast, options) + if (options.onContextCreated) options.onContextCreated(context) const { mode, push,