Skip to content

Commit

Permalink
fix: import
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 20, 2023
1 parent 2f5f767 commit b5eb4e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions packages/compiler-vapor/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
AttributeNode,
SourceLocation,
NodeTypes,
InterpolationNode
InterpolationNode,
TransformOptions
} from '@vue/compiler-dom'
import { TransformOptions } from 'vite'

export const enum IRNodeTypes {
ROOT,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from 'vue/vapor'
// @ts-expect-error
import App from './App.vue'

// @ts-expect-error
render(App.render, '#app')
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"packages/*/__tests__",
"packages/dts-test",
"packages/vue/jsx-runtime",
"scripts/setupVitest.ts"
"scripts/setupVitest.ts",
"playground"
]
}

0 comments on commit b5eb4e7

Please sign in to comment.