File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -57,16 +57,37 @@ export function getComponentMeta(component: string, options?: Options): Componen
57
57
* @returns component meta
58
58
*/
59
59
function _getComponentMeta ( fullPath : string , opts : Options ) {
60
+ // Check if the component is in node_modules and adjust configuration accordingly
61
+ const isNodeModule = fullPath . includes ( 'node_modules' )
62
+
63
+ // For node_modules components, try to find the TypeScript declaration file first
64
+ let resolvedPath = fullPath
65
+ if ( isNodeModule && fullPath . endsWith ( '.vue' ) ) {
66
+ // Try different TypeScript declaration file patterns
67
+ const patterns = [
68
+ fullPath . replace ( '.vue' , '.d.vue.ts' ) ,
69
+ fullPath . replace ( '.vue' , '.vue.d.ts' ) ,
70
+ fullPath . replace ( '.vue' , '.d.ts' )
71
+ ]
72
+
73
+ for ( const pattern of patterns ) {
74
+ if ( existsSync ( pattern ) ) {
75
+ resolvedPath = pattern
76
+ break
77
+ }
78
+ }
79
+ }
80
+
60
81
const checker = createCheckerByJson (
61
82
opts . rootDir ,
62
83
{
63
84
extends : `${ opts . rootDir } /tsconfig.json` ,
64
85
skipLibCheck : true ,
65
- include : [ fullPath ] ,
86
+ include : [ resolvedPath ] ,
66
87
exclude : [ ]
67
- } ,
68
- )
88
+ }
89
+ ) ;
69
90
return refineMeta (
70
- checker . getComponentMeta ( fullPath )
91
+ checker . getComponentMeta ( resolvedPath )
71
92
)
72
93
}
You can’t perform that action at this time.
0 commit comments