feat(compiler-core/internal): add onContextCreated option to generate (#1672)

This commit is contained in:
Rahul Kadyan 2020-07-22 00:46:20 +05:30 committed by GitHub
parent 4951d43526
commit 615dccd00e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,9 +180,12 @@ function createCodegenContext(
export function generate( export function generate(
ast: RootNode, ast: RootNode,
options: CodegenOptions = {} options: CodegenOptions & {
onContextCreated?: (context: CodegenContext) => void
} = {}
): CodegenResult { ): CodegenResult {
const context = createCodegenContext(ast, options) const context = createCodegenContext(ast, options)
if (options.onContextCreated) options.onContextCreated(context)
const { const {
mode, mode,
push, push,