File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change
1
+ export function isExclude ( name : string , exclude ?: string | RegExp | ( string | RegExp ) [ ] | undefined ) : boolean {
2
+ if ( ! exclude )
3
+ return false
4
+
5
+ if ( typeof exclude === 'string' )
6
+ return name === exclude
7
+
8
+ if ( exclude instanceof RegExp )
9
+ return ! ! name . match ( exclude )
10
+
11
+ if ( Array . isArray ( exclude ) ) {
12
+ for ( const item of exclude ) {
13
+ if ( name === item || name . match ( item ) )
14
+ return true
15
+ }
16
+ }
17
+ return false
18
+ }
Original file line number Diff line number Diff line change 1
1
import Debug from 'debug'
2
2
import type { ComponentInfo , ComponentResolver } from '../../types'
3
3
import { kebabCase , pascalCase } from '../utils'
4
+ import { isExclude } from './_utils'
4
5
5
6
const debug = Debug ( 'unplugin-vue-components:resolvers:arco' )
6
7
@@ -168,6 +169,12 @@ export type AllowResolveIconOption = true | { enable: true; iconPrefix?: string
168
169
export type ResolveIconsOption = DisallowResolveIconOption | AllowResolveIconOption
169
170
170
171
export interface ArcoResolverOptions {
172
+ /**
173
+ * exclude components that do not require automatic import
174
+ *
175
+ * @default []
176
+ */
177
+ exclude ?: string | RegExp | ( string | RegExp ) [ ]
171
178
/**
172
179
* import style css or less with components
173
180
*
@@ -217,7 +224,7 @@ export function ArcoResolver(
217
224
}
218
225
}
219
226
}
220
- if ( name . match ( / ^ A [ A - Z ] / ) ) {
227
+ if ( name . match ( / ^ A [ A - Z ] / ) && ! isExclude ( name , options . exclude ) ) {
221
228
const importStyle = options . importStyle ?? 'css'
222
229
223
230
const importName = name . slice ( 1 )
Original file line number Diff line number Diff line change 1
1
import { parse } from 'node:path'
2
- import { minimatch } from 'minimatch'
2
+ import { minimatch } from 'minimatch'
3
3
import resolve from 'resolve'
4
4
import { slash , toArray } from '@antfu/utils'
5
5
import {
You can’t perform that action at this time.
0 commit comments