Glob patterns to exclude from analysis, relative to projectRoot; an
absolute pattern inside the root relativizes at normalizeSourceOptions,
an out-of-root one throws.
Applied at both stages of the pipeline:
- Discovery time by globFiles/discoverFromExports, preventing matched files from being loaded.
- Analysis time by
isSource() against relative(projectRoot, absolutePath),
catching files that enter through TypeScript import resolution
(e.g., a source file imports a test helper).
Beneath it, the always-on baseline (node_modules + dot-directories
below a matched source path — see hasBaselineExcludedSegment) applies
independently; overriding exclude can't strip it.
The defaults exclude tests and internal/ directories — the
src/lib/internal/ convention: internal modules ship in the package for
public modules to import (typically paired with an "./internal/*": null
package.json exports entry blocking consumer imports), but aren't part of
the documented surface. The override surfaces accept a
(defaults) => patterns callback (see ExcludeOption) so extending the
defaults doesn't require restating them; this normalized field is always
a plain array.
analyzeFromFiles accepts a top-level exclude shortcut that merges into this field.
Compiled to a matcher once per options object via picomatch and cached by reference;
mutating this array post-isSource-call has no effect — pass through
normalizeSourceOptions (which returns a fresh object) or otherwise build a
new options object to apply changes.