]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: update
authordaiwei <daiwei521@126.com>
Mon, 17 Mar 2025 06:47:24 +0000 (14:47 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 17 Mar 2025 06:52:06 +0000 (14:52 +0800)
packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap
packages/compiler-vapor/src/generators/block.ts
packages/compiler-vapor/src/generators/vShow.ts
packages/compiler-vapor/src/ir/index.ts
packages/compiler-vapor/src/transforms/utils.ts
packages/compiler-vapor/src/transforms/vShow.ts

index 37ae42ed4bed6ee955a2328f19a530ce017e3f6b..2cb5c36e41ec1467ec2aafb99c64430e824bf1e7 100644 (file)
@@ -74,18 +74,18 @@ exports[`compiler: transition > v-show + appear 1`] = `
 const t0 = _template("<h1>foo</h1>")
 
 export function render(_ctx) {
-  const lazyApplyVShowFn = []
+  const deferredApplyVShows = []
   const n1 = _createComponent(_VaporTransition, {
     appear: () => (""), 
     persisted: () => ("")
   }, {
     "default": () => {
       const n0 = t0()
-      lazyApplyVShowFn.push(() => _applyVShow(n0, () => (_ctx.show)))
+      deferredApplyVShows.push(() => _applyVShow(n0, () => (_ctx.show)))
       return n0
     }
   }, true)
-  lazyApplyVShowFn.forEach(fn => fn())
+  deferredApplyVShows.forEach(fn => fn())
   return n1
 }"
 `;
index e7f0610ac5bc8cbd6ef121b59dba0a2ece0b6a49..944a5ee3af9e756647fca97413ed278c1d8f15bd 100644 (file)
@@ -44,8 +44,8 @@ export function genBlockContent(
   const { dynamic, effect, operation, returns, key } = block
   const resetBlock = context.enterBlock(block)
 
-  if (block.hasLazyApplyVShow) {
-    push(NEWLINE, `const lazyApplyVShowFn = []`)
+  if (block.hasDeferredVShow) {
+    push(NEWLINE, `const deferredApplyVShows = []`)
   }
 
   if (root) {
@@ -60,8 +60,8 @@ export function genBlockContent(
   push(...genOperations(operation, context))
   push(...genEffects(effect, context))
 
-  if (block.hasLazyApplyVShow) {
-    push(NEWLINE, `lazyApplyVShowFn.forEach(fn => fn())`)
+  if (block.hasDeferredVShow) {
+    push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`)
   }
 
   if (dynamic.needsKey) {
index 701127916b1a8ecd2ed7b1beac5b0442439dacec..5ff6b257dc7f745741aac1f6983ecc23eebacb55 100644 (file)
@@ -7,15 +7,15 @@ export function genVShow(
   oper: DirectiveIRNode,
   context: CodegenContext,
 ): CodeFragment[] {
-  const { lazy, element } = oper
+  const { deferred, element } = oper
   return [
     NEWLINE,
-    lazy ? `lazyApplyVShowFn.push(() => ` : undefined,
+    deferred ? `deferredApplyVShows.push(() => ` : undefined,
     ...genCall(context.helper('applyVShow'), `n${element}`, [
       `() => (`,
       ...genExpression(oper.dir.exp!, context),
       `)`,
     ]),
-    lazy ? `)` : undefined,
+    deferred ? `)` : undefined,
   ]
 }
index 7cd93b015fc3bd8f5e16a88e738a723ae79f9a83..b4126863f11cfc443fa3c008a899f3cd164c5f24 100644 (file)
@@ -56,7 +56,7 @@ export interface BlockIRNode extends BaseIRNode {
   operation: OperationNode[]
   expressions: SimpleExpressionNode[]
   returns: number[]
-  hasLazyApplyVShow: boolean
+  hasDeferredVShow: boolean
 }
 
 export interface RootIRNode {
@@ -188,7 +188,7 @@ export interface DirectiveIRNode extends BaseIRNode {
   builtin?: boolean
   asset?: boolean
   modelType?: 'text' | 'dynamic' | 'radio' | 'checkbox' | 'select'
-  lazy?: boolean
+  deferred?: boolean
 }
 
 export interface CreateComponentIRNode extends BaseIRNode {
index 99056d44c5e72f8830c731bd0a0bf1714e595e92..a42f47eb37d6b3514c183a4427bb47cacb6206d7 100644 (file)
@@ -31,7 +31,7 @@ export const newBlock = (node: BlockIRNode['node']): BlockIRNode => ({
   returns: [],
   expressions: [],
   tempId: 0,
-  hasLazyApplyVShow: false,
+  hasDeferredVShow: false,
 })
 
 export function wrapTemplate(node: ElementNode, dirs: string[]): TemplateNode {
index 3622cf0fff39d6c2b8a716e64c6a7446cc5ba1bc..a60b20a71fabe83a5d890272190cd14525d899f6 100644 (file)
@@ -30,16 +30,16 @@ export const transformVShow: DirectiveTransform = (dir, node, context) => {
   }
 
   // lazy apply vshow if the node is inside a transition with appear
-  let lazyApplyVShow = false
+  let shouldDeferred = false
   const parentNode = context.parent && context.parent.node
   if (parentNode && parentNode.type === NodeTypes.ELEMENT) {
-    lazyApplyVShow = !!(
+    shouldDeferred = !!(
       isTransitionTag(parentNode.tag) &&
       findProp(parentNode, 'appear', false, true)
     )
 
-    if (lazyApplyVShow) {
-      context.parent!.parent!.block.hasLazyApplyVShow = true
+    if (shouldDeferred) {
+      context.parent!.parent!.block.hasDeferredVShow = true
     }
   }
 
@@ -49,6 +49,6 @@ export const transformVShow: DirectiveTransform = (dir, node, context) => {
     dir,
     name: 'show',
     builtin: true,
-    lazy: lazyApplyVShow,
+    deferred: shouldDeferred,
   })
 }