(options: DiscoverSourceFilesOptions): Promise<DiscoverSourceFilesResult> Discover source files from a project root.
Used internally by analyzeFromFiles for the discovery step. Standalone consumers can call it directly when they want the discovered file list without running full analysis.
Strategy is selected by discovery:
- 'auto' (default) — try exports first, fall back to glob.
- 'exports' — exports only; throws if exports is missing or
resolves to no source files. Combining with include is a configuration
error and also throws.
- 'glob' — glob only; include parameterizes the search.
Exclusion globs come from sourceOptions.exclude (the single source of
truth, also applied at analysis time by isSource()).
options
discovery configuration
returns
Promise<DiscoverSourceFilesResult> discovered files (content loaded) and any diagnostics from the exports step
throws
Error- in strict `'exports'` mode when `exports` is missing or
examples
const sourceOptions = createSourceOptions(process.cwd());
const {files, diagnostics} = await discoverSourceFiles({sourceOptions});