@@ -31,6 +31,10 @@ export function useComponentMetaParser (
3131) {
3232 // const logger = consola.withScope('nuxt-component-meta')
3333
34+ /**
35+ * Initialize component data object from components
36+ */
37+ let components : NuxtComponentMeta = { ...metaSources }
3438 const outputPath = join ( outputDir , 'component-meta' )
3539
3640 const isExcluded = ( component : any ) => {
@@ -70,26 +74,17 @@ export function useComponentMetaParser (
7074 {
7175 extends : `${ rootDir } /tsconfig.json` ,
7276 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+ } ) ,
8382 exclude : [ ]
8483 } ,
8584 checkerOptions
8685 )
8786 }
8887
89- /**
90- * Initialize component data object from components
91- */
92- const components : NuxtComponentMeta = { ...metaSources }
9388 const init = async ( ) => {
9489 const meta = await import ( outputPath + '.mjs' ) . then ( ( m ) => m . default || m ) . catch ( ( ) => null )
9590
@@ -171,7 +166,7 @@ export function useComponentMetaParser (
171166
172167 if ( component . meta . hash && component . fullPath . includes ( '/node_modules/' ) ) {
173168 // We assume that components from node_modules don't change
174- return
169+ return
175170 }
176171
177172 // Read component code
@@ -269,6 +264,13 @@ export function useComponentMetaParser (
269264 return {
270265 get checker ( ) { return checker } ,
271266 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+ } ,
272274 init,
273275 refreshChecker,
274276 stubOutput,
0 commit comments