@@ -69,7 +69,7 @@ function getAllFilesInDirectory(dirPath: string): string[] {
6969 }
7070 }
7171 } catch {
72- // Ignore directories that can't be read
72+ return ;
7373 }
7474 }
7575
@@ -91,14 +91,13 @@ function findStoriesFiles(componentPath: string): string[] {
9191 const fullPath = path . join ( componentPath , item ) ;
9292 const stat = fs . statSync ( fullPath ) ;
9393
94- // Only look for .stories.ts files directly in the component folder, not in subdirectories
9594 if ( stat . isFile ( ) && item . endsWith ( '.stories.ts' ) ) {
9695 storiesFiles . push ( fullPath ) ;
9796 }
9897 }
9998 }
10099 } catch {
101- // Ignore directories that can't be read
100+ return storiesFiles ;
102101 }
103102
104103 return storiesFiles ;
@@ -113,23 +112,19 @@ export const getDsComponentDataHandler = createHandler<
113112 try {
114113 validateComponentName ( componentName ) ;
115114
116- // Determine which sections to include
117115 const includeAll = sections . includes ( 'all' ) ;
118116 const includeImplementation = includeAll || sections . includes ( 'implementation' ) ;
119117 const includeDocumentation = includeAll || sections . includes ( 'documentation' ) ;
120118 const includeStories = includeAll || sections . includes ( 'stories' ) ;
121119
122- // Get component paths info
123120 const pathsInfo = getComponentPathsInfo ( componentName , uiRoot , cwd ) ;
124121
125- // Get all implementation files in src directory (if requested)
126122 let implementationFiles : string [ ] = [ ] ;
127123 if ( includeImplementation ) {
128124 const srcFiles = getAllFilesInDirectory ( pathsInfo . srcPath ) ;
129125 implementationFiles = srcFiles . map ( ( file ) => `file://${ file } ` ) ;
130126 }
131127
132- // Get documentation paths (if requested)
133128 const documentationFiles : string [ ] = [ ] ;
134129 if ( includeDocumentation ) {
135130 const docsBasePath = resolveCrossPlatformPath ( cwd , storybookDocsRoot ) ;
@@ -143,7 +138,6 @@ export const getDsComponentDataHandler = createHandler<
143138 }
144139 }
145140
146- // Get stories files (if requested)
147141 let storiesFilePaths : string [ ] = [ ] ;
148142 if ( includeStories ) {
149143 const docsBasePath = resolveCrossPlatformPath ( cwd , storybookDocsRoot ) ;
@@ -169,7 +163,6 @@ export const getDsComponentDataHandler = createHandler<
169163 ( result ) => {
170164 const messages : string [ ] = [ ] ;
171165
172- // Implementation section (only show if it has content or was explicitly requested)
173166 if ( result . implementation && result . implementation . length > 0 ) {
174167 messages . push ( 'Implementation' ) ;
175168 messages . push ( '' ) ;
@@ -179,7 +172,6 @@ export const getDsComponentDataHandler = createHandler<
179172 messages . push ( '' ) ;
180173 }
181174
182- // Documentation section (only show if it has content or was explicitly requested)
183175 if ( result . documentation && result . documentation . length > 0 ) {
184176 messages . push ( 'Documentation' ) ;
185177 messages . push ( '' ) ;
@@ -189,7 +181,6 @@ export const getDsComponentDataHandler = createHandler<
189181 messages . push ( '' ) ;
190182 }
191183
192- // Stories section (only show if it has content or was explicitly requested)
193184 if ( result . stories && result . stories . length > 0 ) {
194185 messages . push ( 'Stories' ) ;
195186 messages . push ( '' ) ;
@@ -199,7 +190,6 @@ export const getDsComponentDataHandler = createHandler<
199190 messages . push ( '' ) ;
200191 }
201192
202- // Import path section (always show if available)
203193 if ( result . importPath ) {
204194 messages . push ( 'Import path' ) ;
205195 messages . push ( '' ) ;
0 commit comments