Skip to content

Commit cf80fa2

Browse files
committed
chore: fix typecheck
1 parent fdbcb7d commit cf80fa2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/macros/src/options.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {
2+
detectVueVersion,
23
REGEX_NODE_MODULES,
34
REGEX_SETUP_SFC,
45
REGEX_SRC_FILE,
5-
type FilterOptions,
6+
type BaseOptions,
67
type MarkRequired,
78
} from '@vue-macros/common'
89

9-
export type Options = FilterOptions & {
10+
export type Options = BaseOptions & {
1011
lib?: 'vue' | 'vue/vapor' | (string & {})
1112
defineComponent?: { alias: string[] }
1213
defineModel?: { alias: string[] }
@@ -17,6 +18,7 @@ export type Options = FilterOptions & {
1718
export type OptionsResolved = MarkRequired<
1819
Options,
1920
| 'include'
21+
| 'version'
2022
| 'lib'
2123
| 'defineComponent'
2224
| 'defineModel'
@@ -26,11 +28,13 @@ export type OptionsResolved = MarkRequired<
2628
>
2729

2830
export function resolveOptions(options: Options): OptionsResolved {
31+
const version = options.version || detectVueVersion()
2932
const lib = options.lib || 'vue/vapor'
3033
return {
3134
include: [REGEX_SRC_FILE],
3235
exclude: [REGEX_SETUP_SFC, REGEX_NODE_MODULES],
3336
...options,
37+
version,
3438
lib,
3539
defineComponent: {
3640
alias: options?.defineComponent?.alias ?? [

packages/macros/tests/fixtures.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('fixtures', async () => {
3333
transformJsxMacros(code, id, new Map(), {
3434
lib: 'vue',
3535
include: ['*.tsx'],
36+
version: 3.6,
3637
...options,
3738
})?.code,
3839
)
@@ -45,6 +46,7 @@ describe('vue/vapor fixtures', async () => {
4546
transformJsxMacros(code, id, new Map(), {
4647
lib: 'vue/vapor',
4748
include: ['*.tsx'],
49+
version: 3.6,
4850
...options,
4951
})?.code,
5052
)

0 commit comments

Comments
 (0)