11import {
2+ type TransformOptions as BaseTransformOptions ,
23 type CommentNode ,
34 type CompilerCompatOptions ,
45 type SimpleExpressionNode ,
56 defaultOnError ,
67 defaultOnWarn ,
78} from '@vue/compiler-dom'
89import { EMPTY_OBJ , NOOP , extend , isArray } from '@vue/shared'
10+ import { newBlock , newDynamic } from './transforms/utils'
11+ import { isConstantExpression } from './utils'
912import {
13+ type BlockIRNode ,
1014 DynamicFlag ,
15+ type HackOptions ,
1116 type IRDynamicInfo ,
1217 IRNodeTypes ,
1318 type IRSlots ,
1419 type OperationNode ,
20+ type RootIRNode ,
21+ type RootNode ,
1522 type VaporDirectiveNode ,
16- } from '@vue-vapor/compiler-vapor'
17- import { newBlock , newDynamic } from './transforms/utils'
18- import { isConstantExpression } from './utils'
19- import type { CompilerOptions } from './compile'
20- import type { JSXAttribute , JSXElement } from '@babel/types'
21- import type { BlockIRNode , RootIRNode , RootNode } from './ir/index'
23+ } from './ir/index'
24+ import type { JSXElement , JSXFragment } from '@babel/types'
2225
2326export type NodeTransform = (
2427 node : BlockIRNode [ 'node' ] ,
@@ -32,17 +35,16 @@ export type DirectiveTransform = (
3235) => DirectiveTransformResult | void
3336
3437export interface DirectiveTransformResult {
35- key : JSXAttribute [ 'name' ]
36- value : JSXAttribute [ 'value' ]
38+ key : SimpleExpressionNode
39+ value : SimpleExpressionNode
3740 modifier ?: '.' | '^'
3841 runtimeCamelize ?: boolean
3942 handler ?: boolean
4043 model ?: boolean
4144 modelModifiers ?: string [ ]
4245}
4346
44- export type TransformOptions = CompilerOptions
45-
47+ export type TransformOptions = HackOptions < BaseTransformOptions >
4648const defaultOptions = {
4749 filename : '' ,
4850 prefixIdentifiers : false ,
@@ -70,7 +72,7 @@ const defaultOptions = {
7072export class TransformContext <
7173 T extends BlockIRNode [ 'node' ] = BlockIRNode [ 'node' ] ,
7274> {
73- parent : TransformContext < RootNode > | null = null
75+ parent : TransformContext < RootNode | JSXElement | JSXFragment > | null = null
7476 root : TransformContext < RootNode >
7577 index : number = 0
7678
@@ -100,7 +102,7 @@ export class TransformContext<
100102 options : TransformOptions = { } ,
101103 ) {
102104 this . options = extend ( { } , defaultOptions , options )
103- this . root = this as TransformContext < T >
105+ this . root = this as TransformContext < RootNode >
104106 }
105107
106108 enterBlock ( ir : BlockIRNode , isVFor : boolean = false ) : ( ) => void {
0 commit comments