Jelajahi Sumber

chore: shorten option name

Evan You 6 tahun lalu
induk
melakukan
b61d9652dd

+ 6 - 6
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)
 }

+ 1 - 1
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<TemplateChildNode>())
 }
 

+ 1 - 1
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