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 11import Debug from 'debug'
22import type { ComponentInfo , ComponentResolver } from '../../types'
33import { kebabCase , pascalCase } from '../utils'
4+ import { isExclude } from './_utils'
45
56const debug = Debug ( 'unplugin-vue-components:resolvers:arco' )
67
@@ -168,6 +169,12 @@ export type AllowResolveIconOption = true | { enable: true; iconPrefix?: string
168169export type ResolveIconsOption = DisallowResolveIconOption | AllowResolveIconOption
169170
170171export interface ArcoResolverOptions {
172+ /**
173+ * exclude components that do not require automatic import
174+ *
175+ * @default []
176+ */
177+ exclude ?: string | RegExp | ( string | RegExp ) [ ]
171178 /**
172179 * import style css or less with components
173180 *
@@ -217,7 +224,7 @@ export function ArcoResolver(
217224 }
218225 }
219226 }
220- if ( name . match ( / ^ A [ A - Z ] / ) ) {
227+ if ( name . match ( / ^ A [ A - Z ] / ) && ! isExclude ( name , options . exclude ) ) {
221228 const importStyle = options . importStyle ?? 'css'
222229
223230 const importName = name . slice ( 1 )
Original file line number Diff line number Diff line change 11import { parse } from 'node:path'
2- import { minimatch } from 'minimatch'
2+ import { minimatch } from 'minimatch'
33import resolve from 'resolve'
44import { slash , toArray } from '@antfu/utils'
55import {
You can’t perform that action at this time.
0 commit comments