File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ export default defineNuxtConfig({
24
24
] ,
25
25
26
26
componentMeta : {
27
- debug : 2
27
+ debug : 2 ,
28
+ exclude : [ / t e s t / i, ( component : any ) => {
29
+ return component . global
30
+ } ]
28
31
} ,
29
32
30
33
pinceau : {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export interface ModuleOptions {
8
8
debug ?: boolean | 2
9
9
componentDirs : ( string | ComponentsDir ) [ ]
10
10
components ?: ComponentsOptions [ ]
11
- exclude ?: string [ ]
11
+ exclude ?: ( string | RegExp | ( ( component : any ) => boolean ) ) [ ]
12
12
checkerOptions ?: MetaCheckerOptions
13
13
transformers ?: ( ( component : any , code : string ) => ( { component : any ; code : string } ) ) [ ]
14
14
}
Original file line number Diff line number Diff line change @@ -23,14 +23,29 @@ export function useComponentMetaParser (
23
23
24
24
const outputPath = join ( outputDir , 'component-meta' )
25
25
26
+ const isExcluded = ( component : any ) => {
27
+ return exclude . find ( ( excludeRule ) => {
28
+ switch ( typeof excludeRule ) {
29
+ case 'string' :
30
+ return component . filePath . includes ( excludeRule )
31
+ case 'object' :
32
+ return excludeRule instanceof RegExp ? excludeRule . test ( component . filePath ) : false
33
+ case 'function' :
34
+ return excludeRule ( component )
35
+ default :
36
+ return false
37
+ }
38
+ } )
39
+ }
40
+
26
41
/**
27
42
* Initialize component data object from components
28
43
*/
29
44
const components = {
30
45
...( _components || [ ] ) . reduce (
31
46
( acc : any , component : any ) => {
32
47
// Locally support exclude as it seem broken from createComponentMetaCheckerByJsonConfig
33
- if ( exclude . find ( excludePath => component . filePath . includes ( excludePath ) ) ) { return acc }
48
+ if ( isExcluded ( component ) ) { return acc }
34
49
35
50
if ( ! component . filePath || ! component . pascalName ) { return acc }
36
51
You can’t perform that action at this time.
0 commit comments