(dir: string)
| 2000 | } |
| 2001 | |
| 2002 | const loadIgnore = (dir: string): ScopedIgnore | null => { |
| 2003 | const giPath = path.join(dir, '.gitignore'); |
| 2004 | if (!fs.existsSync(giPath)) return null; |
| 2005 | // readGitignorePatterns is defensive: a non-UTF-8 (DLP-encrypted) or |
| 2006 | // uncompilable .gitignore is skipped/filtered with a warning, never thrown |
| 2007 | // (issue #682) — so the per-file `.ignores()` calls below can't crash. |
| 2008 | const patterns = readGitignorePatterns(giPath); |
| 2009 | return patterns ? { dir, ig: ignore().add(patterns) } : null; |
| 2010 | }; |
| 2011 | |
| 2012 | const isIgnored = (fullPath: string, isDir: boolean, matchers: ScopedIgnore[]): boolean => { |
| 2013 | for (const { dir, ig } of matchers) { |
no test coverage detected