(dir: string)
| 1006 | } |
| 1007 | |
| 1008 | const loadIgnore = (dir: string): ScopedIgnore | null => { |
| 1009 | const giPath = path.join(dir, '.gitignore'); |
| 1010 | if (!fs.existsSync(giPath)) return null; |
| 1011 | // readGitignorePatterns is defensive: a non-UTF-8 (DLP-encrypted) or |
| 1012 | // uncompilable .gitignore is skipped/filtered with a warning, never thrown |
| 1013 | // (issue #682) — so the per-file `.ignores()` calls below can't crash. |
| 1014 | const patterns = readGitignorePatterns(giPath); |
| 1015 | return patterns ? { dir, ig: ignore().add(patterns) } : null; |
| 1016 | }; |
| 1017 | |
| 1018 | const isIgnored = (fullPath: string, isDir: boolean, matchers: ScopedIgnore[]): boolean => { |
| 1019 | for (const { dir, ig } of matchers) { |
no test coverage detected