@@ -10,7 +10,7 @@ import { text as stream2text } from "node:stream/consumers";
10
10
import url from "node:url" ;
11
11
import resolveTimeout from "promise-resolve-timeout" ;
12
12
import { exit } from "specialist" ;
13
- import readdir from "tiny-readdir-glob" ;
13
+ import readdir from "tiny-readdir-glob-gitignore " ;
14
14
import zeptomatchEscape from "zeptomatch-escape" ;
15
15
import zeptomatchIsStatic from "zeptomatch-is-static" ;
16
16
import type { ContextOptions , FormatOptions , FunctionMaybe , Key , LogLevel , Options , PrettierConfigWithOverrides , PrettierPlugin } from "./types.js" ;
@@ -87,11 +87,13 @@ async function getFoldersChildrenPaths(foldersPaths: string[]): Promise<string[]
87
87
return childrenPaths ;
88
88
}
89
89
90
- function getGlobPaths ( rootPath : string , globs : string [ ] , withNodeModules : boolean ) {
90
+ function getGlobPaths ( rootPath : string , globs : string [ ] , ignoreFiles : string [ ] , withNodeModules : boolean ) {
91
91
return readdir ( globs , {
92
92
cwd : rootPath ,
93
93
followSymlinks : false ,
94
94
ignore : `**/{.git,.sl,.svn,.hg,.DS_Store,Thumbs.db${ withNodeModules ? "" : ",node_modules" } }` ,
95
+ ignoreFiles,
96
+ ignoreFilesFindAbove : false ,
95
97
} ) ;
96
98
}
97
99
@@ -184,6 +186,7 @@ const getStdin = once(async (): Promise<string | undefined> => {
184
186
async function getTargetsPaths (
185
187
rootPath : string ,
186
188
globs : string [ ] ,
189
+ ignoreFiles : string [ ] ,
187
190
withNodeModules : boolean ,
188
191
) : Promise < [ string [ ] , string [ ] , Record < string , string [ ] > , string [ ] , string [ ] ] > {
189
192
const targetFiles : string [ ] = [ ] ;
@@ -204,7 +207,7 @@ async function getTargetsPaths(
204
207
}
205
208
}
206
209
207
- const result = await getGlobPaths ( rootPath , targetGlobs , withNodeModules ) ;
210
+ const result = await getGlobPaths ( rootPath , targetGlobs , ignoreFiles , withNodeModules ) ;
208
211
const filesPaths = [ ...targetFiles , ...result . files ] ;
209
212
const filesNames = [ ...targetFilesNames , ...result . filesFoundNames ] ;
210
213
const filesNamesToPaths = result . filesFoundNamesToPaths ;
0 commit comments