|
|
@@ -1,10 +1,4 @@
|
|
|
-import {
|
|
|
- type ElementNode,
|
|
|
- ElementTypes,
|
|
|
- NodeTypes,
|
|
|
- type RootNode,
|
|
|
- type TemplateChildNode,
|
|
|
-} from '@vue/compiler-dom'
|
|
|
+import { type ElementNode, ElementTypes, NodeTypes } from '@vue/compiler-dom'
|
|
|
import {
|
|
|
type NodeTransform,
|
|
|
type TransformContext,
|
|
|
@@ -22,11 +16,7 @@ export const transformChildren: NodeTransform = (node, context) => {
|
|
|
if (!isFragment && node.type !== NodeTypes.ELEMENT) return
|
|
|
|
|
|
for (const [i, child] of node.children.entries()) {
|
|
|
- const childContext = createContext(
|
|
|
- child,
|
|
|
- context as TransformContext<RootNode | ElementNode>,
|
|
|
- i,
|
|
|
- )
|
|
|
+ const childContext = context.create(child, i)
|
|
|
transformNode(childContext)
|
|
|
|
|
|
if (isFragment) {
|
|
|
@@ -96,11 +86,3 @@ function processDynamicChildren(context: TransformContext<ElementNode>) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-function createContext<T extends TemplateChildNode>(
|
|
|
- node: T,
|
|
|
- parent: TransformContext<RootNode | ElementNode>,
|
|
|
- index: number,
|
|
|
-): TransformContext<T> {
|
|
|
- return parent.create(node, index)
|
|
|
-}
|