diff --git a/package.json b/package.json index 5baa5164..4516bb9c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unplugin-vue-components", "type": "module", - "version": "28.1.0", + "version": "28.2.0", "packageManager": "pnpm@10.4.0", "description": "Components auto importing for Vue", "author": "antfu ", diff --git a/src/core/fs/glob.ts b/src/core/fs/glob.ts index 9e0720e8..eb917792 100644 --- a/src/core/fs/glob.ts +++ b/src/core/fs/glob.ts @@ -8,7 +8,7 @@ export function searchComponents(ctx: Context) { debug(`started with: [${ctx.options.globs.join(', ')}]`) const root = ctx.root const files = globSync(ctx.options.globs, { - ignore: ['node_modules'], + ignore: ctx.options.globsExclude, onlyFiles: true, cwd: root, absolute: true, diff --git a/src/core/options.ts b/src/core/options.ts index ec2b5fb0..1c3277cd 100644 --- a/src/core/options.ts +++ b/src/core/options.ts @@ -15,6 +15,7 @@ export const defaultOptions: Omit, 'include' | 'exclude' | 'ex globalNamespaces: [], resolvers: [], + globsExclude: [], importPathTransform: v => v, diff --git a/src/types.ts b/src/types.ts index fa8058a8..4fe0adac 100644 --- a/src/types.ts +++ b/src/types.ts @@ -95,6 +95,13 @@ export interface Options { */ globs?: string | string[] + /** + * Negated glob patterns to exclude files from being detected as components. + * + * @default [] + */ + globsExclude?: string | string[] + /** * Search for subdirectories * @default true