File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
+ detectVueVersion ,
2
3
REGEX_NODE_MODULES ,
3
4
REGEX_SETUP_SFC ,
4
5
REGEX_SRC_FILE ,
5
- type FilterOptions ,
6
+ type BaseOptions ,
6
7
type MarkRequired ,
7
8
} from '@vue-macros/common'
8
9
9
- export type Options = FilterOptions & {
10
+ export type Options = BaseOptions & {
10
11
lib ?: 'vue' | 'vue/vapor' | ( string & { } )
11
12
defineComponent ?: { alias : string [ ] }
12
13
defineModel ?: { alias : string [ ] }
@@ -17,6 +18,7 @@ export type Options = FilterOptions & {
17
18
export type OptionsResolved = MarkRequired <
18
19
Options ,
19
20
| 'include'
21
+ | 'version'
20
22
| 'lib'
21
23
| 'defineComponent'
22
24
| 'defineModel'
@@ -26,11 +28,13 @@ export type OptionsResolved = MarkRequired<
26
28
>
27
29
28
30
export function resolveOptions ( options : Options ) : OptionsResolved {
31
+ const version = options . version || detectVueVersion ( )
29
32
const lib = options . lib || 'vue/vapor'
30
33
return {
31
34
include : [ REGEX_SRC_FILE ] ,
32
35
exclude : [ REGEX_SETUP_SFC , REGEX_NODE_MODULES ] ,
33
36
...options ,
37
+ version,
34
38
lib,
35
39
defineComponent : {
36
40
alias : options ?. defineComponent ?. alias ?? [
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ describe('fixtures', async () => {
33
33
transformJsxMacros ( code , id , new Map ( ) , {
34
34
lib : 'vue' ,
35
35
include : [ '*.tsx' ] ,
36
+ version : 3.6 ,
36
37
...options ,
37
38
} ) ?. code ,
38
39
)
@@ -45,6 +46,7 @@ describe('vue/vapor fixtures', async () => {
45
46
transformJsxMacros ( code , id , new Map ( ) , {
46
47
lib : 'vue/vapor' ,
47
48
include : [ '*.tsx' ] ,
49
+ version : 3.6 ,
48
50
...options ,
49
51
} ) ?. code ,
50
52
)
You can’t perform that action at this time.
0 commit comments