(
private rootMatcher: Ignore,
embedded: Array<{ root: string; matcher: Ignore }>,
/**
* Project `codegraph.json` `exclude` patterns (#999), matched against the
* full root-relative path. Wins over everything else — an explicit user
* exclude applies even to tracked files and even inside embedded repos.
*/
private exclude: Ignore | null = null,
/**
* Project `codegraph.json` `include` patterns — first-party source forced
* INTO the index despite `.gitignore`. When a path matches, it is NOT
* ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher`
* — but never `exclude` (checked first) and never a built-in default-ignored
* dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR
* directory of an included subtree still isn't pruned by the directory
* walker/watcher.
*/
private include: Ignore | null = null,
private includeRoots: string[] = [],
/**
* The directories `git ls-files --exclude-standard` reports as ignored
* (see listGitIgnoredDirectories): root-relative, trailing-slashed paths.
* Each names one directory and is matched as a literal path prefix, never
* as a gitignore pattern. As a pattern, `src/` matched every `src/` below
* the root too, hiding a whole Maven monorepo's sources (#2849), and a
* folder named `[draft]` or `a[b` read as a glob (or did not compile).
*/
private gitIgnoredDirs: ReadonlySet<string> = new Set(),
)
| 1049 | private embedded: Array<{ root: string; matcher: Ignore }>; |
| 1050 | private defaults: Ignore = defaultsOnlyIgnore(); |
| 1051 | constructor( |
| 1052 | private rootMatcher: Ignore, |
| 1053 | embedded: Array<{ root: string; matcher: Ignore }>, |
| 1054 | /** |
| 1055 | * Project `codegraph.json` `exclude` patterns (#999), matched against the |
| 1056 | * full root-relative path. Wins over everything else — an explicit user |
| 1057 | * exclude applies even to tracked files and even inside embedded repos. |
| 1058 | */ |
| 1059 | private exclude: Ignore | null = null, |
| 1060 | /** |
| 1061 | * Project `codegraph.json` `include` patterns — first-party source forced |
| 1062 | * INTO the index despite `.gitignore`. When a path matches, it is NOT |
| 1063 | * ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher` |
| 1064 | * — but never `exclude` (checked first) and never a built-in default-ignored |
| 1065 | * dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR |
| 1066 | * directory of an included subtree still isn't pruned by the directory |
| 1067 | * walker/watcher. |
| 1068 | */ |
| 1069 | private include: Ignore | null = null, |
| 1070 | private includeRoots: string[] = [], |
| 1071 | /** |
| 1072 | * The directories `git ls-files --exclude-standard` reports as ignored |
| 1073 | * (see listGitIgnoredDirectories): root-relative, trailing-slashed paths. |
| 1074 | * Each names one directory and is matched as a literal path prefix, never |
| 1075 | * as a gitignore pattern. As a pattern, `src/` matched every `src/` below |
| 1076 | * the root too, hiding a whole Maven monorepo's sources (#2849), and a |
| 1077 | * folder named `[draft]` or `a[b` read as a glob (or did not compile). |
| 1078 | */ |
| 1079 | private gitIgnoredDirs: ReadonlySet<string> = new Set(), |
| 1080 | ) { |
| 1081 | // Longest root first so paths in nested embedded repos hit the innermost matcher. |
| 1082 | this.embedded = [...embedded].sort((a, b) => b.root.length - a.root.length); |
| 1083 | } |
| 1084 | |
| 1085 | /** True when `rel` is one of {@link gitIgnoredDirs} or lies inside one. */ |
| 1086 | private inGitIgnoredDir(rel: string): boolean { |
nothing calls this directly
no outgoing calls
no test coverage detected