@@ -496,12 +496,12 @@ const IGNORED_FILES = new Set([
496496
497497async function readDirectoryStructure ( dirPath , options = { } ) {
498498 const {
499- maxDepth = 3 ,
499+ maxDepth = Infinity , // Eliminamos la limitación de profundidad
500500 currentDepth = 0 ,
501501 rootPath = null ,
502- lazyLoad = true ,
502+ lazyLoad = false , // Deshabilitamos lazy loading para cargar todo
503503 includeFileStats = false ,
504- maxFiles = 1000
504+ maxFiles = 10000 // Aumentamos el límite de archivos
505505 } = options ;
506506
507507 if ( currentDepth >= maxDepth ) return [ ] ;
@@ -539,22 +539,18 @@ async function readDirectoryStructure(dirPath, options = {}) {
539539 let children = [ ] ;
540540 let hasChildren = false ;
541541
542- if ( lazyLoad && currentDepth >= 1 ) {
543- // Para lazy loading, solo verificar si tiene hijos sin cargarlos
544- try {
545- const subEntries = await fs . promises . readdir ( fullPath , { withFileTypes : true } ) ;
546- hasChildren = subEntries . some ( subEntry => ! shouldIgnoreEntry ( subEntry . name , subEntry . isDirectory ( ) ) ) ;
547- } catch ( error ) {
548- hasChildren = false ;
549- }
550- } else {
551- // Cargar hijos recursivamente solo para los primeros niveles
542+ // Siempre cargar hijos recursivamente para todos los niveles
543+ try {
552544 children = await readDirectoryStructure ( fullPath , {
553545 ...options ,
554546 currentDepth : currentDepth + 1 ,
555547 rootPath : actualRootPath
556548 } ) ;
557549 hasChildren = children . length > 0 ;
550+ } catch ( error ) {
551+ console . warn ( '[WARN] Could not read subdirectory:' , fullPath , error ) ;
552+ children = [ ] ;
553+ hasChildren = false ;
558554 }
559555
560556 structure . push ( {
@@ -564,8 +560,8 @@ async function readDirectoryStructure(dirPath, options = {}) {
564560 fullPath : fullPath ,
565561 children : children ,
566562 hasChildren : hasChildren ,
567- isExpanded : currentDepth < 1 , // Solo auto -expandir el primer nivel
568- isLoaded : ! lazyLoad || currentDepth < 1
563+ isExpanded : true , // Auto -expandir todos los niveles
564+ isLoaded : true // Marcar todos como cargados
569565 } ) ;
570566 }
571567
0 commit comments