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 7575 "prepublishOnly" : " pnpm run build"
7676 },
7777 "dependencies" : {
78- "@rollup/pluginutils" : " ^5.0.2" ,
79- "@vue-macros/common" : " ^1.1.1" ,
78+ "@vue-macros/common" : " ^1.1.4" ,
8079 "change-case" : " ^4.1.2" ,
81- "magic-string" : " ^0.30.0" ,
8280 "unplugin" : " ^1.3.1"
8381 },
8482 "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'
62
3+ export interface Options extends Pick < BaseOptions , 'include' | 'exclude' > {
74 resolveName ?( id : string ) : string | Promise < string >
85}
96
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' >
179
1810export function resolveOption ( options : Options ) : OptionsResolved {
1911 return {
20- include : options . include || [ / \. v u e $ / ] ,
21- exclude : options . exclude ,
22- resolveName : options . resolveName
12+ include : [ / \. v u e $ / ] ,
13+ ...options ,
2314 }
2415}
Original file line number Diff line number Diff line change 11import path from 'node:path'
22import { createUnplugin } from 'unplugin'
3- import { createFilter } from '@rollup/pluginutils'
43import { camelCase } from 'change-case'
54import {
6- MagicString ,
5+ MagicStringBase ,
76 babelParse ,
7+ createFilter ,
88 getLang ,
99 getTransformResult ,
1010} from '@vue-macros/common'
@@ -25,7 +25,7 @@ function getNodeStart(node: Node) {
2525
2626export default createUnplugin < Options | undefined > ( ( rawOptions = { } ) => {
2727 const options = resolveOption ( rawOptions )
28- const filter = createFilter ( options . include , options . exclude )
28+ const filter = createFilter ( options )
2929
3030 const name = 'unplugin-vue-named-export'
3131 return {
@@ -48,7 +48,7 @@ export default createUnplugin<Options | undefined>((rawOptions = {}) => {
4848 )
4949 if ( ! defaultExport ) return
5050
51- const s = new MagicString ( code )
51+ const s = new MagicStringBase ( code )
5252 const resolvedName = ( options . resolveName || resolveName ) ( id )
5353
5454 s . overwrite (
You can’t perform that action at this time.
0 commit comments