@@ -31,6 +31,10 @@ export function useComponentMetaParser (
31
31
) {
32
32
// const logger = consola.withScope('nuxt-component-meta')
33
33
34
+ /**
35
+ * Initialize component data object from components
36
+ */
37
+ let components : NuxtComponentMeta = { ...metaSources }
34
38
const outputPath = join ( outputDir , 'component-meta' )
35
39
36
40
const isExcluded = ( component : any ) => {
@@ -70,26 +74,17 @@ export function useComponentMetaParser (
70
74
{
71
75
extends : `${ rootDir } /tsconfig.json` ,
72
76
skipLibCheck : true ,
73
- include : [
74
- '**/*' ,
75
- ...componentDirs . map ( ( dir ) => {
76
- const path = typeof dir === 'string' ? dir : ( dir ?. path || '' )
77
- if ( path . endsWith ( '.vue' ) ) {
78
- return path
79
- }
80
- return `${ path } /**/*`
81
- } )
82
- ] ,
77
+ include : componentDirs . map ( ( dir ) => {
78
+ const path = typeof dir === 'string' ? dir : ( dir ?. path || '' )
79
+ const ext = path . split ( '.' ) . pop ( ) !
80
+ return [ 'vue' , 'ts' , 'tsx' , 'js' , 'jsx' ] . includes ( ext ) ? path : `${ path } /**/*`
81
+ } ) ,
83
82
exclude : [ ]
84
83
} ,
85
84
checkerOptions
86
85
)
87
86
}
88
87
89
- /**
90
- * Initialize component data object from components
91
- */
92
- const components : NuxtComponentMeta = { ...metaSources }
93
88
const init = async ( ) => {
94
89
const meta = await import ( outputPath + '.mjs' ) . then ( ( m ) => m . default || m ) . catch ( ( ) => null )
95
90
@@ -171,7 +166,7 @@ export function useComponentMetaParser (
171
166
172
167
if ( component . meta . hash && component . fullPath . includes ( '/node_modules/' ) ) {
173
168
// We assume that components from node_modules don't change
174
- return
169
+ return
175
170
}
176
171
177
172
// Read component code
@@ -269,6 +264,13 @@ export function useComponentMetaParser (
269
264
return {
270
265
get checker ( ) { return checker } ,
271
266
get components ( ) { return components } ,
267
+ dispose ( ) {
268
+ checker . clearCache ( )
269
+ // @ts -expect-error - Remove checker
270
+ checker = null
271
+ // Clear components cache
272
+ components = { }
273
+ } ,
272
274
init,
273
275
refreshChecker,
274
276
stubOutput,
0 commit comments