@@ -7,6 +7,9 @@ const { results: cliReporter } = require('pa11y/lib/reporters/cli')
77const  readdirp  =  require ( 'readdirp' ) 
88
99const  EMPTY_ARRAY  =  [ ] 
10+ const  ASTERISK  =  '*' 
11+ const  HTML_EXT  =  '.html' 
12+ const  GLOB_HTML  =  '*.html' 
1013
1114exports . runPa11y  =  async  function  ( {  htmlFilePaths,  pa11yOpts,  build } )  { 
1215	let  issueCount  =  0 
@@ -47,11 +50,17 @@ exports.generateFilePaths = async function ({
4750
4851const  findHtmlFiles  =  async  function  ( fileAndDirPath ,  directoryFilter )  { 
4952	if  ( await  isDirectory ( fileAndDirPath ) )  { 
50- 		const  fileInfos  =  await  readdirp . promise ( fileAndDirPath ,  { 
51- 			fileFilter : '*.html' , 
52- 			directoryFilter : ! ! directoryFilter . length  ? directoryFilter  : '*' , 
53+ 		const  filePaths  =  [ ] 
54+ 		const  stream  =  readdirp ( fileAndDirPath ,  { 
55+ 			fileFilter : GLOB_HTML , 
56+ 			directoryFilter : ! ! directoryFilter . length  ? directoryFilter  : ASTERISK , 
5357		} ) 
54- 		return  fileInfos . map ( ( {  fullPath } )  =>  fullPath ) 
58+ 
59+ 		for  await  ( const  {  fullPath }  of  stream )  { 
60+ 			filePaths . push ( fullPath ) 
61+ 		} 
62+ 
63+ 		return  filePaths 
5564	} 
5665
5766	if  ( ! ( await  isFile ( fileAndDirPath ) ) )  { 
@@ -61,7 +70,7 @@ const findHtmlFiles = async function (fileAndDirPath, directoryFilter) {
6170		return  EMPTY_ARRAY 
6271	} 
6372
64- 	if  ( extname ( fileAndDirPath )  !==  '.html' )  { 
73+ 	if  ( extname ( fileAndDirPath )  !==  HTML_EXT )  { 
6574		return  EMPTY_ARRAY 
6675	} 
6776
0 commit comments