From: daiwei Date: Mon, 8 Sep 2025 08:19:25 +0000 (+0800) Subject: chore: clean up X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41509dcc61812a77da74181eab75a84cd2183f82;p=thirdparty%2Fvuejs%2Fcore.git chore: clean up --- diff --git a/packages/compiler-ssr/__tests__/utils.ts b/packages/compiler-ssr/__tests__/utils.ts index 29f193daee..c656517cdb 100644 --- a/packages/compiler-ssr/__tests__/utils.ts +++ b/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(`
${src}
`, options) + const { code } = compile(`
${src}
`) const match = code.match( /_push\(\`([^]*)<\/div>\`\)/, ) diff --git a/packages/compiler-ssr/src/ssrCodegenTransform.ts b/packages/compiler-ssr/src/ssrCodegenTransform.ts index fe5b1ee267..536cbb5c1e 100644 --- a/packages/compiler-ssr/src/ssrCodegenTransform.ts +++ b/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 - ) -} diff --git a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts b/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts index 08f78aa561..cad1ee8102 100644 --- a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts +++ b/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) } diff --git a/packages/compiler-ssr/src/transforms/ssrVFor.ts b/packages/compiler-ssr/src/transforms/ssrVFor.ts index f1541ce4ab..6537eee828 100644 --- a/packages/compiler-ssr/src/transforms/ssrVFor.ts +++ b/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(``) diff --git a/packages/compiler-ssr/src/transforms/ssrVIf.ts b/packages/compiler-ssr/src/transforms/ssrVIf.ts index 775ad835f2..0e3880247a 100644 --- a/packages/compiler-ssr/src/transforms/ssrVIf.ts +++ b/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) } diff --git a/packages/compiler-vapor/src/ir/index.ts b/packages/compiler-vapor/src/ir/index.ts index e5f4a1126e..bce00283e3 100644 --- a/packages/compiler-vapor/src/ir/index.ts +++ b/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 { diff --git a/packages/compiler-vapor/src/transform.ts b/packages/compiler-vapor/src/transform.ts index b705f8f4db..b79152f37b 100644 --- a/packages/compiler-vapor/src/transform.ts +++ b/packages/compiler-vapor/src/transform.ts @@ -69,7 +69,7 @@ export class TransformContext { block: BlockIRNode = this.ir.block options: Required< - Omit + Omit > template: string = '' diff --git a/packages/compiler-vapor/src/transforms/vIf.ts b/packages/compiler-vapor/src/transforms/vIf.ts index cc135863ec..2426fa0215 100644 --- a/packages/compiler-vapor/src/transforms/vIf.ts +++ b/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)