@@ -115,6 +115,11 @@ export class TypeScriptStructureAnalyzer {
115115 }
116116
117117 private findSourceDirectories ( module : ModuleInfo , options : { noDist ?: boolean , srcPatterns ?: string [ ] } = { } ) : string [ ] {
118+ // Handle default srcPatterns if not provided
119+ if ( ! options . srcPatterns || options . srcPatterns . length === 0 ) {
120+ options . srcPatterns = [ '**/*.ts' , '**/*.js' ] ;
121+ }
122+
118123 // Handle srcPatterns if provided
119124 if ( options . srcPatterns && options . srcPatterns . length > 0 ) {
120125 return this . findDirectoriesByPatterns ( module . path , options . srcPatterns , options ) ;
@@ -161,20 +166,32 @@ export class TypeScriptStructureAnalyzer {
161166
162167 private findDirectoriesByPatterns ( modulePath : string , patterns : string [ ] , options : { noDist ?: boolean } ) : string [ ] {
163168 const matchedDirs = new Set < string > ( ) ;
164-
169+ let hasGlobPattern = false ;
170+
165171 for ( const pattern of patterns ) {
172+ if ( pattern . includes ( '*' ) ||
173+ pattern . endsWith ( '.ts' ) || pattern . endsWith ( '.js' ) ||
174+ pattern . endsWith ( '.tsx' ) || pattern . endsWith ( '.jsx' ) ) {
175+ hasGlobPattern = true ;
176+ continue ;
177+ }
178+
166179 // Assuming patterns are relative to modulePath
167180 const fullPath = path . join ( modulePath , pattern ) ;
168-
169181 if ( fs . existsSync ( fullPath ) && fs . statSync ( fullPath ) . isDirectory ( ) ) {
170- // Check if the directory matches the noDist option
171182 if ( options . noDist && path . basename ( fullPath ) === 'dist' ) {
172183 continue ;
173184 }
174-
175185 matchedDirs . add ( fullPath ) ;
176186 }
177187 }
188+
189+ if ( hasGlobPattern ) {
190+ const files = this . findTypeScriptFiles ( modulePath , options ) ;
191+ files . forEach ( file => {
192+ matchedDirs . add ( path . dirname ( file ) ) ;
193+ } ) ;
194+ }
178195
179196 return Array . from ( matchedDirs ) ;
180197 }
0 commit comments