Explorar o código

chore: clean up

daiwei hai 7 meses
pai
achega
41509dcc61

+ 2 - 6
packages/compiler-ssr/__tests__/utils.ts

@@ -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>\`\)/,
   )

+ 0 - 14
packages/compiler-ssr/src/ssrCodegenTransform.ts

@@ -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
-  )
-}

+ 0 - 2
packages/compiler-ssr/src/transforms/ssrTransformComponent.ts

@@ -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)
 }

+ 0 - 1
packages/compiler-ssr/src/transforms/ssrVFor.ts

@@ -36,7 +36,6 @@ export function ssrProcessFor(
     context,
     needFragmentWrapper,
   )
-
   // v-for always renders a fragment unless explicitly disabled
   if (!disableNestedFragments) {
     context.pushStringPart(`<!--[-->`)

+ 0 - 1
packages/compiler-ssr/src/transforms/ssrVIf.ts

@@ -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)
 }

+ 0 - 5
packages/compiler-vapor/src/ir/index.ts

@@ -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 {

+ 1 - 1
packages/compiler-vapor/src/transform.ts

@@ -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 = ''

+ 0 - 1
packages/compiler-vapor/src/transforms/vIf.ts

@@ -57,7 +57,6 @@ export function processIf(
       }
     }
   } else {
-    context.dynamic.isIfBranch = true
     // check the adjacent v-if
     const siblingIf = getSiblingIf(context, true)