From b5eb4e78b8d253ddd35ed4479187e3161bbd4ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Mon, 20 Nov 2023 14:16:36 +0800 Subject: [PATCH] fix: import --- packages/compiler-vapor/src/transform.ts | 12 ++++++------ playground/src/main.ts | 2 +- tsconfig.json | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/compiler-vapor/src/transform.ts b/packages/compiler-vapor/src/transform.ts index 5624b2de3..56795bec5 100644 --- a/packages/compiler-vapor/src/transform.ts +++ b/packages/compiler-vapor/src/transform.ts @@ -5,9 +5,9 @@ import { AttributeNode, SourceLocation, NodeTypes, - InterpolationNode + InterpolationNode, + TransformOptions } from '@vue/compiler-dom' -import { TransformOptions } from 'vite' export const enum IRNodeTypes { ROOT, @@ -53,13 +53,13 @@ export function transform( function transformChildren(children: TemplateChildNode[]) { let template: string = '' - children.forEach((child, i) => walkNode(child, children.length > i + 1)) + children.forEach((child, i) => walkNode(child)) return template - function walkNode(node: TemplateChildNode, hasSibling: boolean) { + function walkNode(node: TemplateChildNode) { switch (node.type) { case 1 satisfies NodeTypes.ELEMENT: { - template += transformElement(node, hasSibling) + template += transformElement(node) break } case 2 satisfies NodeTypes.TEXT: @@ -88,7 +88,7 @@ function transformInterpolation(node: InterpolationNode) { // return `{{${node.content.content}}}` } -function transformElement(node: ElementNode, hasSibling: boolean) { +function transformElement(node: ElementNode) { const { tag, props, children } = node let template = `<${tag}` const propsTemplate = props diff --git a/playground/src/main.ts b/playground/src/main.ts index d81eb1ebb..69485dcbe 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -1,5 +1,5 @@ import { render } from 'vue/vapor' -// @ts-expect-error import App from './App.vue' +// @ts-expect-error render(App.render, '#app') diff --git a/tsconfig.json b/tsconfig.json index 5d7789b08..1864a3e8e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -34,6 +34,7 @@ "packages/*/__tests__", "packages/dts-test", "packages/vue/jsx-runtime", - "scripts/setupVitest.ts" + "scripts/setupVitest.ts", + "playground" ] }