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
5757 * @returns component meta
5858 */
5959function _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+
6081 const checker = createCheckerByJson (
6182 opts . rootDir ,
6283 {
6384 extends : `${ opts . rootDir } /tsconfig.json` ,
6485 skipLibCheck : true ,
65- include : [ fullPath ] ,
86+ include : [ resolvedPath ] ,
6687 exclude : [ ]
67- } ,
68- )
88+ }
89+ ) ;
6990 return refineMeta (
70- checker . getComponentMeta ( fullPath )
91+ checker . getComponentMeta ( resolvedPath )
7192 )
7293}
You can’t perform that action at this time.
0 commit comments