Skip to content

Commit

Permalink
feat: do not ignore node_modules by default, instead expose `globsE…
Browse files Browse the repository at this point in the history
…xclude` option

related slidevjs/slidev#2066
  • Loading branch information
antfu committed Feb 18, 2025
1 parent 0bc1b13 commit 8e1f72e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/fs/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/core/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const defaultOptions: Omit<Required<Options>, 'include' | 'exclude' | 'ex
globalNamespaces: [],

resolvers: [],
globsExclude: [],

importPathTransform: v => v,

Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e1f72e

Please sign in to comment.