]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: clean up
authordaiwei <daiwei521@126.com>
Mon, 8 Sep 2025 08:19:25 +0000 (16:19 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 8 Sep 2025 08:19:25 +0000 (16:19 +0800)
packages/compiler-ssr/__tests__/utils.ts
packages/compiler-ssr/src/ssrCodegenTransform.ts
packages/compiler-ssr/src/transforms/ssrTransformComponent.ts
packages/compiler-ssr/src/transforms/ssrVFor.ts
packages/compiler-ssr/src/transforms/ssrVIf.ts
packages/compiler-vapor/src/ir/index.ts
packages/compiler-vapor/src/transform.ts
packages/compiler-vapor/src/transforms/vIf.ts

index 29f193daee6f43ebeb6c8cbfdcc56c6a1d448479..c656517cdb87d0b28874ccf9f0c29a5c0555dfeb 100644 (file)
@@ -1,14 +1,10 @@
-import type { CompilerOptions } from '@vue/compiler-core'
 import { compile } from '../src'
 
-export function getCompiledString(
-  src: string,
-  options?: CompilerOptions,
-): string {
+export function getCompiledString(src: string): string {
   // Wrap src template in a root div so that it doesn't get injected
   // fallthrough attr. This results in less noise in generated snapshots
   // but also means this util can only be used for non-root cases.
-  const { code } = compile(`<div>${src}</div>`, options)
+  const { code } = compile(`<div>${src}</div>`)
   const match = code.match(
     /_push\(\`<div\${\s*_ssrRenderAttrs\(_attrs\)\s*}>([^]*)<\/div>\`\)/,
   )
index fe5b1ee267e281e4e4e878fa70c45871665a56f7..536cbb5c1e97342f7d2aa2d04ddae688e1339736 100644 (file)
@@ -3,7 +3,6 @@ import {
   type CallExpression,
   type CompilerError,
   type CompilerOptions,
-  type ElementNode,
   ElementTypes,
   type IfStatement,
   type JSChildNode,
@@ -162,9 +161,7 @@ export function processChildren(
   if (asFragment) {
     context.pushStringPart(`<!--[-->`)
   }
-
   const { children } = parent
-
   for (let i = 0; i < children.length; i++) {
     const child = children[i]
     switch (child.type) {
@@ -175,7 +172,6 @@ export function processChildren(
             break
           case ElementTypes.COMPONENT:
             ssrProcessComponent(child, context, parent)
-
             break
           case ElementTypes.SLOT:
             ssrProcessSlotOutlet(child, context)
@@ -253,13 +249,3 @@ export function processChildrenAsStatement(
   processChildren(parent, childContext, asFragment)
   return createBlockStatement(childContext.body)
 }
-
-export function isElementWithChildren(
-  node: TemplateChildNode,
-): node is ElementNode {
-  return (
-    node.type === NodeTypes.ELEMENT &&
-    node.tagType === ElementTypes.ELEMENT &&
-    node.children.length > 0
-  )
-}
index 08f78aa561fec571df7296ee58a8232a689921fd..cad1ee8102897beab4c8990b99b43366c5d42655 100644 (file)
@@ -320,7 +320,6 @@ function createVNodeSlotBranch(
   if (vFor) {
     wrapperProps.push(extend({}, vFor))
   }
-
   const wrapperNode: TemplateNode = {
     type: NodeTypes.ELEMENT,
     ns: Namespaces.HTML,
@@ -331,7 +330,6 @@ function createVNodeSlotBranch(
     loc: locStub,
     codegenNode: undefined,
   }
-
   subTransform(wrapperNode, subOptions, parentContext)
   return createReturnStatement(children)
 }
index f1541ce4ab012a14ebfdc6f132553ee3f1819d6b..6537eee82877452eb8a16dab7172ad9528122f4a 100644 (file)
@@ -36,7 +36,6 @@ export function ssrProcessFor(
     context,
     needFragmentWrapper,
   )
-
   // v-for always renders a fragment unless explicitly disabled
   if (!disableNestedFragments) {
     context.pushStringPart(`<!--[-->`)
index 775ad835f2f54418191d3b9cd3100505ac579ebb..0e3880247a16e29b5ecb2b187be71d2ae0478e26 100644 (file)
@@ -74,6 +74,5 @@ function processIfBranch(
     (children.length !== 1 || children[0].type !== NodeTypes.ELEMENT) &&
     // optimize away nested fragments when the only child is a ForNode
     !(children.length === 1 && children[0].type === NodeTypes.FOR)
-
   return processChildrenAsStatement(branch, context, needFragmentWrapper)
 }
index e5f4a1126e33f3f93666a38310dc3cf76479e069..bce00283e3d777c99ba83813ae222d163045e5c2 100644 (file)
@@ -81,7 +81,6 @@ export interface IfIRNode extends BaseIRNode {
   parent?: number
   anchor?: number
   append?: boolean
-  childIndex?: number
 }
 
 export interface IRFor {
@@ -102,7 +101,6 @@ export interface ForIRNode extends BaseIRNode, IRFor {
   parent?: number
   anchor?: number
   append?: boolean
-  childIndex?: number
 }
 
 export interface SetPropIRNode extends BaseIRNode {
@@ -205,7 +203,6 @@ export interface CreateComponentIRNode extends BaseIRNode {
   parent?: number
   anchor?: number
   append?: boolean
-  childIndex?: number
   scopeId?: string | null
 }
 
@@ -224,7 +221,6 @@ export interface SlotOutletIRNode extends BaseIRNode {
   parent?: number
   anchor?: number
   append?: boolean
-  childIndex?: number
 }
 
 export interface GetTextChildIRNode extends BaseIRNode {
@@ -276,7 +272,6 @@ export interface IRDynamicInfo {
   hasDynamicChild?: boolean
   operation?: OperationNode
   needsKey?: boolean
-  isIfBranch?: boolean
 }
 
 export interface IREffect {
index b705f8f4db1eee5605c26160007a2a6dcfc8c3a5..b79152f37b6dd88089ab5df225dc2413f5be1f3d 100644 (file)
@@ -69,7 +69,7 @@ export class TransformContext<T extends AllNode = AllNode> {
 
   block: BlockIRNode = this.ir.block
   options: Required<
-    Omit<TransformOptions, 'vapor' | 'filename' | keyof CompilerCompatOptions>
+    Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>
   >
 
   template: string = ''
index cc135863ece4dfc33c0300237d1fc20952a2ad2a..2426fa0215eeee6a0360b22f67c9562494016d5e 100644 (file)
@@ -57,7 +57,6 @@ export function processIf(
       }
     }
   } else {
-    context.dynamic.isIfBranch = true
     // check the adjacent v-if
     const siblingIf = getSiblingIf(context, true)