diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts index 01ee0ff2..5577f009 100644 --- a/packages/compiler-core/src/transform.ts +++ b/packages/compiler-core/src/transform.ts @@ -16,7 +16,7 @@ import { isString, isArray } from '@vue/shared' import { CompilerError, defaultOnError } from './errors' import { TO_STRING, COMMENT, CREATE_VNODE, FRAGMENT } from './runtimeConstants' import { isVSlot, createBlockExpression, isSlotOutlet } from './utils' -import { hoistStaticTrees } from './transforms/hoistStatic' +import { hoistStatic } from './transforms/hoistStatic' // There are two types of transforms: // @@ -51,7 +51,7 @@ export interface TransformOptions { nodeTransforms?: NodeTransform[] directiveTransforms?: { [name: string]: DirectiveTransform } prefixIdentifiers?: boolean - hoistStaticTrees?: boolean + hoistStatic?: boolean onError?: (error: CompilerError) => void } @@ -83,7 +83,7 @@ function createTransformContext( root: RootNode, { prefixIdentifiers = false, - hoistStaticTrees = false, + hoistStatic = false, nodeTransforms = [], directiveTransforms = {}, onError = defaultOnError @@ -102,7 +102,7 @@ function createTransformContext( vOnce: 0 }, prefixIdentifiers, - hoistStaticTrees, + hoistStatic, nodeTransforms, directiveTransforms, onError, @@ -204,8 +204,8 @@ function createTransformContext( export function transform(root: RootNode, options: TransformOptions) { const context = createTransformContext(root, options) traverseNode(root, context) - if (options.hoistStaticTrees) { - hoistStaticTrees(root, context) + if (options.hoistStatic) { + hoistStatic(root, context) } finalizeRoot(root, context) } diff --git a/packages/compiler-core/src/transforms/hoistStatic.ts b/packages/compiler-core/src/transforms/hoistStatic.ts index 99594367..b783f945 100644 --- a/packages/compiler-core/src/transforms/hoistStatic.ts +++ b/packages/compiler-core/src/transforms/hoistStatic.ts @@ -9,7 +9,7 @@ import { TransformContext } from '../transform' import { CREATE_VNODE } from '../runtimeConstants' import { PropsExpression } from './transformElement' -export function hoistStaticTrees(root: RootNode, context: TransformContext) { +export function hoistStatic(root: RootNode, context: TransformContext) { walk(root.children, context, new Set()) } diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index 98c4b598..d4604ad9 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -8,7 +8,7 @@ function compileToFunction( options?: CompilerOptions ): RenderFunction { const { code } = compile(template, { - hoistStaticTrees: true, + hoistStatic: true, ...options }) return new Function(code)() as RenderFunction