File tree Expand file tree Collapse file tree 4 files changed +26
-31
lines changed Expand file tree Collapse file tree 4 files changed +26
-31
lines changed Original file line number Diff line number Diff line change 75
75
"prepublishOnly" : " pnpm run build"
76
76
},
77
77
"dependencies" : {
78
- "@rollup/pluginutils" : " ^5.0.2" ,
79
- "@vue-macros/common" : " ^1.1.1" ,
78
+ "@vue-macros/common" : " ^1.1.4" ,
80
79
"change-case" : " ^4.1.2" ,
81
- "magic-string" : " ^0.30.0" ,
82
80
"unplugin" : " ^1.3.1"
83
81
},
84
82
"devDependencies" : {
Original file line number Diff line number Diff line change 1
- import type { FilterPattern } from '@rollup/pluginutils'
2
-
3
- export interface Options {
4
- include ?: FilterPattern
5
- exclude ?: FilterPattern
1
+ import { type BaseOptions } from '@vue-macros/common'
6
2
3
+ export interface Options extends Pick < BaseOptions , 'include' | 'exclude' > {
7
4
resolveName ?( id : string ) : string | Promise < string >
8
5
}
9
6
10
- export type OptionsResolved = Omit <
11
- Required < Options > ,
12
- 'exclude' | 'resolveName'
13
- > & {
14
- exclude ?: Options [ 'exclude' ]
15
- resolveName ?: Options [ 'resolveName' ]
16
- }
7
+ export type OptionsResolved = Pick < Required < Options > , 'include' > &
8
+ Pick < Options , 'exclude' | 'resolveName' >
17
9
18
10
export function resolveOption ( options : Options ) : OptionsResolved {
19
11
return {
20
- include : options . include || [ / \. v u e $ / ] ,
21
- exclude : options . exclude ,
22
- resolveName : options . resolveName
12
+ include : [ / \. v u e $ / ] ,
13
+ ...options ,
23
14
}
24
15
}
Original file line number Diff line number Diff line change 1
1
import path from 'node:path'
2
2
import { createUnplugin } from 'unplugin'
3
- import { createFilter } from '@rollup/pluginutils'
4
3
import { camelCase } from 'change-case'
5
4
import {
6
- MagicString ,
5
+ MagicStringBase ,
7
6
babelParse ,
7
+ createFilter ,
8
8
getLang ,
9
9
getTransformResult ,
10
10
} from '@vue-macros/common'
@@ -25,7 +25,7 @@ function getNodeStart(node: Node) {
25
25
26
26
export default createUnplugin < Options | undefined > ( ( rawOptions = { } ) => {
27
27
const options = resolveOption ( rawOptions )
28
- const filter = createFilter ( options . include , options . exclude )
28
+ const filter = createFilter ( options )
29
29
30
30
const name = 'unplugin-vue-named-export'
31
31
return {
@@ -48,7 +48,7 @@ export default createUnplugin<Options | undefined>((rawOptions = {}) => {
48
48
)
49
49
if ( ! defaultExport ) return
50
50
51
- const s = new MagicString ( code )
51
+ const s = new MagicStringBase ( code )
52
52
const resolvedName = ( options . resolveName || resolveName ) ( id )
53
53
54
54
s . overwrite (
You can’t perform that action at this time.
0 commit comments