@@ -366,29 +366,13 @@ function sanitizeUnicode(text: string): string {
366366}
367367
368368async function listFilesRecursive ( dir : string ) : Promise < { path : string , size : number , mtimeMs : number } [ ] > {
369- const result : { path : string , size : number , mtimeMs : number } [ ] = [ ] ;
370- async function walk ( current : string ) {
371- let entries : fs . Dirent [ ] ;
372- try {
373- entries = await fs . promises . readdir ( current , { withFileTypes : true } ) ;
374- } catch {
375- return ;
376- }
377- for ( const entry of entries ) {
378- const full = path . join ( current , entry . name ) ;
379- if ( entry . isDirectory ( ) ) {
380- await walk ( full ) ;
381- } else if ( entry . isFile ( ) ) {
382- try {
383- const stat = await fs . promises . stat ( full ) ;
384- result . push ( { path : full , size : stat . size , mtimeMs : stat . mtimeMs } ) ;
385- } catch {
386- }
387- }
388- }
389- }
390- await walk ( dir ) ;
391- return result ;
369+ const entries = await fs . promises . readdir ( dir , { recursive : true , withFileTypes : true } ) ;
370+ const files = entries . filter ( e => e . isFile ( ) ) ;
371+ return Promise . all ( files . map ( async e => {
372+ const full = path . join ( e . parentPath , e . name ) ;
373+ const { size, mtimeMs } = await fs . promises . stat ( full ) ;
374+ return { path : full , size, mtimeMs } ;
375+ } ) ) ;
392376}
393377
394378function parseSections ( text : string ) : Map < string , string > {
0 commit comments