source-config.ts

Source configuration, path extraction, and file filtering.

Provides ModuleSourceOptions configuration management and functions that operate on source files using those options: path extraction, source detection, dependency filtering, and file collection.

@see source.ts for pure file type predicates (isTypescript, isSvelte, etc.) @see analyze.ts for consumers (analyze, analyzeFromFiles)

view source

Declarations
#

17 declarations

baselineExcludesForBase
#

source-config.ts view source

(base: string): string[] import {baselineExcludesForBase} from 'svelte-docinfo/source-config.js';

Anchor the baseline exclusion globs below a discovery base directory.

Anchoring is what preserves the escape hatch at discovery time: the ignores for base .hidden/src are .hidden/src/**\/node_modules/** etc., which don't match the base's own dot segment. '' anchors at the project root. Used as glob ignore by globFiles (per include-pattern base) and discoverFromExports (below the source dir).

base

type string

returns

string[]

createSourceOptions
#

source-config.ts view source

also exported from index.ts

(projectRoot: string, overrides?: SourceOptionsOverrides | undefined): ModuleSourceOptions import {createSourceOptions} from 'svelte-docinfo/source-config.js';

Create complete, normalized, validated source options from project root and optional overrides.

Merges overrides with DEFAULT_SOURCE_OPTIONS, then normalizes via normalizeSourceOptions — so the returned object always has an absolute projectRoot, slash-stripped path entries, and an explicit sourceRoot (auto-derived for multi-path layouts). Throws on validation failure.

projectRoot

path to project root (typically process.cwd()); resolved to absolute

type string

overrides?

optional overrides for default options

optional

returns

ModuleSourceOptions

throws

  • Error - if validation fails (empty `sourcePaths`, or `sourceRoot` not a prefix of all `sourcePaths`)

examples

// Standard SvelteKit library const options = createSourceOptions(process.cwd());
// Multiple source directories const options = createSourceOptions(process.cwd(), { sourcePaths: ['src/lib', 'src/routes'], sourceRoot: 'src', });
// Extend the default exclusions (callback form — see `ExcludeOption`) const options = createSourceOptions(process.cwd(), { exclude: (defaults) => [...defaults, '**\/*.gen.ts'], });
// Replace the default exclusions wholesale const options = createSourceOptions(process.cwd(), { exclude: ['**\/*.test.ts', '**\/*.internal.ts'], });

createSourceOptionsWithInclude
#

source-config.ts view source

(projectRoot: string, overrides: SourceOptionsOverrides | undefined, include: readonly string[] | undefined, log?: AnalysisLog | undefined): ModuleSourceOptions import {createSourceOptionsWithInclude} from 'svelte-docinfo/source-config.js';

Create source options with include-pattern widening applied.

The include-aware form of createSourceOptions, used by the discovery entry points (analyzeFromFiles, the Vite plugin): builds options from overrides, then unions each include pattern's static base into sourcePaths via widenSourcePathsForInclude so include-discovered files pass the query-time source gate. When the set widens, options are rebuilt from the original overrides so sourceRoot derivation and validation (including the projectRoot-escape throw) see the final set — re-normalizing the first result would bake a derived sourceRoot in as if explicit and fail validation against the widened bases. Owning both steps here keeps that original-overrides requirement an implementation detail instead of a caller contract.

Logs when a pattern contributes the '' base: a root-crossing glob ('**\/*.ts') or a literal root file ('vite.config.ts') scopes the whole project root as source — the baseline exclusions (node_modules, dot-directories) shrink that cliff but don't remove it, so the widening leaves a trace instead of happening silently.

projectRoot

path to project root (typically process.cwd()); resolved to absolute

type string

overrides

optional overrides for default options

type SourceOptionsOverrides | undefined

include

explicit include patterns (absent or empty means plain createSourceOptions); in-root absolute patterns relativize via normalizeIncludePatterns

type readonly string[] | undefined

log?

receives the root-scoping info line

optional

returns

ModuleSourceOptions

throws

  • Error - if validation fails, including a widened base or an absolute

DEFAULT_SOURCE_OPTIONS
#

source-config.ts view source

also exported from index.ts

SourceOptionsDefaults import {DEFAULT_SOURCE_OPTIONS} from 'svelte-docinfo/source-config.js';

Default partial options for standard SvelteKit library structure.

Does not include projectRoot — use createSourceOptions to create complete options with your project root.

exclude is the single source of truth for filtering: globs applied at both discovery time (by globFiles/discoverFromExports) and analysis time (by isSource() against project-root-relative paths).

see also

  • ``createSourceOptions`` for the typical way to build complete options

ExcludeOption
#

source-config.ts view source

also exported from index.ts

ExcludeOption import type {ExcludeOption} from 'svelte-docinfo/source-config.js';

Exclude patterns as accepted by the override surfaces (createSourceOptions, analyzeFromFiles, the Vite plugin — not the CLI, whose --exclude is array-only).

An array replaces DEFAULT_SOURCE_OPTIONS.exclude wholesale; the callback form receives a fresh copy of those defaults and returns the list to use, so extending them doesn't require restating them:

exclude: (defaults) => [...defaults, '**\/*.gen.ts'] // add a pattern exclude: (defaults) => defaults.filter((p) => p !== '**\/internal/**') // drop one

The callback runs at most once per built options object (include-pattern widening rebuilds options from the already-resolved array). Resolved to a plain array before normalization; ModuleSourceOptions.exclude never carries the function form.

extractDependencies
#

source-config.ts view source

(sourceFile: SourceFileInfo & { dependents?: readonly string[] | undefined; }, options: ModuleSourceOptions): { dependencies: string[]; dependents: string[]; } import {extractDependencies} from 'svelte-docinfo/source-config.js';

Extract dependencies and dependents for a module from source file info.

Filters to only include source modules (excludes external packages, node_modules, tests). Returns sorted arrays of module paths (relative to sourceRoot) for deterministic output.

Native paths in sourceFile.dependencies/dependents are accepted — isSource and extractPath posixify their inputs, so direct callers with hand-built input need not pre-normalize.

Accepts SourceFileInfo plus an optional dependents field — the public input type carries only dependencies (caller-supplied opt-in), while dependents is computed downstream by computeDependents and flows through as an enriched shape.

sourceFile

the source file info to extract dependencies from

type SourceFileInfo & { dependents?: readonly string[] | undefined; }

options

module source options for filtering and path extraction

returns

{ dependencies: string[]; dependents: string[]; }

sorted arrays of module paths (relative to sourceRoot) for dependencies and dependents

extractPath
#

source-config.ts view source

(sourceId: string, options: ModuleSourceOptions): string import {extractPath} from 'svelte-docinfo/source-config.js';

Extract module path relative to source root from absolute source ID.

Uses proper path semantics: strips projectRoot/sourceRoot/ prefix.

sourceId

absolute path to the source file

type string

options

module source options for path extraction

returns

string

examples

const options = createSourceOptions('/home/user/project'); extractPath('/home/user/project/src/lib/foo.ts', options) // => 'foo.ts' extractPath('/home/user/project/src/lib/nested/bar.svelte', options) // => 'nested/bar.svelte'
const options = createSourceOptions('/home/user/project', { sourcePaths: ['src/lib', 'src/routes'], sourceRoot: 'src', }); extractPath('/home/user/project/src/lib/foo.ts', options) // => 'lib/foo.ts' extractPath('/home/user/project/src/routes/page.svelte', options) // => 'routes/page.svelte'

getSourceRoot
#

source-config.ts view source

(options: ModuleSourceOptions): string import {getSourceRoot} from 'svelte-docinfo/source-config.js';

Get the effective sourceRoot from options.

Returns sourceRoot if provided, otherwise:

  • Single sourcePath: returns that path
  • Multiple sourcePaths: derives the longest common directory prefix

options

returns

string

the effective source root path

hasBaselineExcludedSegment
#

source-config.ts view source

(relPath: string): boolean import {hasBaselineExcludedSegment} from 'svelte-docinfo/source-config.js';

Whether a base-relative path contains an always-excluded directory segment.

The always-on baseline: node_modules directories and dot-directories (.svelte-kit, .git, .cache, …) are never source. Matched against the path *relative to the matched source path*, not the project root — so an explicit dot-dir source path (sourcePaths: ['.hidden/src']) still works: the dot segment sits in the base, not the remainder. That relativity is the opt-out; there is no flag. Deliberately only these two families — dist/build/coverage are ordinary names a project can legitimately keep source in, and over-excluding fails silently.

Only directory segments are checked; the final segment (the file itself) is not, so a dotfile like .config.ts inside a source dir passes.

Deliberately NOT part of DEFAULT_SOURCE_OPTIONS.exclude: user exclude replaces the defaults wholesale and would silently strip the baseline. baselineExcludesForBase is the discovery-time glob form.

relPath

POSIX path relative to a matched source path / discovery base

type string

returns

boolean

includePatternBase
#

source-config.ts view source

(pattern: string): string | null import {includePatternBase} from 'svelte-docinfo/source-config.js';

Static base directory of a discovery include pattern.

picomatch.scan().base for glob patterns ('src/other/**\/*.ts''src/other'); a literal non-glob pattern names a file, so it contributes its directory ('src/foo.ts''src', a root file → ''); a negated pattern has no base (null). Shared by widenSourcePathsForInclude (scope widening), globFiles (anchoring the baseline exclusions), and createSourceOptionsWithInclude (detecting root-scoping patterns to log).

Patterns are expected projectRoot-relative — the discovery seams (createSourceOptionsWithInclude, discoverSourceFiles) run normalizeIncludePatterns first, which relativizes in-root absolute patterns and throws on out-of-root ones, so no absolute pattern reaches the base scan through the public entry points.

pattern

type string

returns

string | null

isSource
#

source-config.ts view source

(path: string, options: ModuleSourceOptions): boolean import {isSource} from 'svelte-docinfo/source-config.js';

Check if a path is an analyzable source file.

Combines all filtering: source directory paths, the always-on baseline (node_modules + dot-directories below the matched source path — see hasBaselineExcludedSegment), exclude globs, and analyzer availability. This is the single check for whether a file should be included in library analysis.

Uses proper path semantics with startsWith matching against projectRoot/sourcePath/. No heuristics needed — nested directories are correctly excluded by the prefix check.

Order is sourceDir-then-exclude: the prefix check guarantees the path lives under projectRoot before relativization, so relative() always produces a clean glob-shaped string for the matcher. Files outside projectRoot (rare; would require monorepo path mapping) short-circuit at the prefix check before reaching the matcher.

path

full absolute path to check

type string

options

module source options for filtering

returns

boolean

true if the path is an analyzable source file

examples

const options = createSourceOptions('/home/user/project'); isSource('/home/user/project/src/lib/foo.ts', options) // => true isSource('/home/user/project/src/lib/styles.css', options) // => true isSource('/home/user/project/src/lib/data.json', options) // => true isSource('/home/user/project/src/lib/foo.test.ts', options) // => false (excluded) isSource('/home/user/project/src/fixtures/mini/src/lib/bar.ts', options) // => false (wrong prefix)

ModuleSourceOptions
#

source-config.ts view source

also exported from index.ts

ModuleSourceOptions import type {ModuleSourceOptions} from 'svelte-docinfo/source-config.js';

Configuration for module source detection and path extraction.

Uses proper path semantics with projectRoot as the base for all path operations. Paths are matched using startsWith rather than substring search, which correctly handles nested directories without special heuristics.

examples

const options = createSourceOptions(process.cwd(), { sourcePaths: ['src/lib', 'src/routes'], sourceRoot: 'src', });

projectRoot

Path to the project root directory.

All sourcePaths are relative to this. Typically process.cwd(). Normalized (resolved to absolute, posixified to forward slashes, trailing slash stripped) by normalizeSourceOptions, which returns a new options object. Internal callers (isSource, extractPath) assume this is already POSIX form — construct via createSourceOptions / normalizeSourceOptions rather than building ModuleSourceOptions literals by hand on Windows.

type string

'/home/user/my-project'

sourcePaths

Source directory paths to include, relative to projectRoot.

Absolute entries are accepted when they resolve inside projectRoot and are stored root-relative; an entry resolving outside it throws (a root-anchored '/src/lib' is taken as filesystem-absolute, not shorthand — the error hints to drop the slash). Normalized (./.. segments collapsed, trailing slashes stripped) by normalizeSourceOptions, which returns a new options object.

type string[]

['src/lib'] // single source directory
['src/lib', 'src/routes'] // multiple directories

sourceRoot?

Source root for extracting relative module paths, relative to projectRoot.

Normalized like sourcePaths entries (absolute-inside-root accepted and stored root-relative, ./.. collapsed — so '.' becomes '', trailing slashes stripped, out-of-root throws) by normalizeSourceOptions, which returns a new options object.

When omitted:

  • Single sourcePath: defaults to that path
  • Multiple sourcePaths: auto-derived as the longest common directory prefix (or '' when paths share no common prefix — produces project-relative module paths)

type string

'src/lib' // module paths like 'foo.ts', 'utils/bar.ts'
'src' // module paths like 'lib/foo.ts', 'routes/page.svelte'
'' // or '.': module paths stay project-relative, e.g. 'src/lib/foo.ts'

exclude

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.

type string[]

default `['**\/*.test.ts', '**\/*.spec.ts', '**\/internal/**']`

getAnalyzerType

Determine which analyzer to use for a file path.

Called for files in source directories. Return an AnalyzerType or null to skip:

  • 'typescript' — TypeScript/JS files analyzed via TypeScript compiler API
  • 'svelte' — Svelte components analyzed via svelte2tsx + TypeScript compiler API
  • 'css' — CSS files included as modules with no declarations
  • 'json' — JSON files included as modules with no declarations
  • null — skip the file

type (path: string): AnalyzerType | null

path

type string
returns AnalyzerType | null
// Add MDsveX support getAnalyzerType: (path) => (path.endsWith('.svx') ? 'svelte' : getDefaultAnalyzer(path))
// Include .d.ts files (the default excludes them) getAnalyzerType: (path) => (path.endsWith('.d.ts') ? 'typescript' : getDefaultAnalyzer(path))

normalizeIncludePatterns
#

source-config.ts view source

(include: readonly string[], projectRoot: string): readonly string[] import {normalizeIncludePatterns} from 'svelte-docinfo/source-config.js';

Normalize discovery include patterns to projectRoot-relative form.

The include-pattern counterpart of normalizeSourceOptions' absolute-entry handling: in-root absolute patterns relativize, out-of-root ones throw, relative ones pass through (see normalizeGlobPattern; exclude gets the same treatment inside normalizeSourceOptions). Applied by the discovery seams (createSourceOptionsWithInclude, discoverSourceFiles) so widening, the anchored baseline ignores, and the glob itself all see canonical relative patterns; projectRoot must be normalized (absolute POSIX, no trailing slash) — pass ModuleSourceOptions.projectRoot.

include

type readonly string[]

projectRoot

type string

returns

readonly string[]

normalizeSourceOptions
#

source-config.ts view source

(options: ModuleSourceOptions): ModuleSourceOptions import {normalizeSourceOptions} from 'svelte-docinfo/source-config.js';

Normalize and validate ModuleSourceOptions, returning a new options object.

Normalization:

  • projectRoot resolved to absolute via path.resolve (relative paths resolve against cwd)
  • Trailing slash stripped from projectRoot
  • sourcePaths entries and sourceRoot resolved against projectRoot and stored root-relative: ./.. segments collapse (src/../liblib, .''), trailing slashes drop, and absolute entries inside the root relativize (matching loadFile's treatment of path inputs)
  • exclude globs relativized when absolute inside the root (textual prefix strip, since glob metacharacters aren't path segments), so discovery's glob ignore and analysis-time isSource see the same relative pattern

Validation (after normalization):

  1. No sourcePaths entry, sourceRoot, or absolute exclude glob resolves outside projectRoot (out-of-root modules are unrepresentable — module paths and diagnostics are project-root-relative; widened include bases funnel through here too; absolute out-of-root entries get a drop-the-leading-slash hint)
  2. sourcePaths has at least one entry
  3. sourceRoot (if provided and non-empty) is a prefix of all sourcePaths

When sourceRoot is omitted and multiple sourcePaths are provided, sourceRoot is auto-derived as their longest common path prefix. If the paths share no common prefix, the derived root is '' and extractPath produces project-relative module paths.

Returns a fresh object — the input is not mutated. Re-normalization produces a fresh identity, which naturally invalidates the excludeMatcherCache (keyed by options-object identity) without a separate "rebuild a fresh object" rule.

options

returns

ModuleSourceOptions

a new ModuleSourceOptions with normalized fields

throws

  • Error - if validation fails

examples

// Normalization: trailing slash and dot segments collapse, relative projectRoot resolves const normalized = normalizeSourceOptions({projectRoot: '.', sourcePaths: ['src/../src/lib/'], ...}); // normalized.projectRoot is now absolute, normalized.sourcePaths is ['src/lib']

SourceOptionsDefaults
#

source-config.ts view source

also exported from index.ts

SourceOptionsDefaults import type {SourceOptionsDefaults} from 'svelte-docinfo/source-config.js';

Default source options preset (without projectRoot).

Use with createSourceOptions to build complete options. Contains all ModuleSourceOptions fields except projectRoot, which is provided separately as the first argument to createSourceOptions.

sourcePaths

Source directory paths to include, relative to projectRoot.

Absolute entries are accepted when they resolve inside projectRoot and are stored root-relative; an entry resolving outside it throws (a root-anchored '/src/lib' is taken as filesystem-absolute, not shorthand — the error hints to drop the slash). Normalized (./.. segments collapsed, trailing slashes stripped) by normalizeSourceOptions, which returns a new options object.

type string[]

['src/lib'] // single source directory
['src/lib', 'src/routes'] // multiple directories

sourceRoot?

Source root for extracting relative module paths, relative to projectRoot.

Normalized like sourcePaths entries (absolute-inside-root accepted and stored root-relative, ./.. collapsed — so '.' becomes '', trailing slashes stripped, out-of-root throws) by normalizeSourceOptions, which returns a new options object.

When omitted:

  • Single sourcePath: defaults to that path
  • Multiple sourcePaths: auto-derived as the longest common directory prefix (or '' when paths share no common prefix — produces project-relative module paths)

type string

'src/lib' // module paths like 'foo.ts', 'utils/bar.ts'
'src' // module paths like 'lib/foo.ts', 'routes/page.svelte'
'' // or '.': module paths stay project-relative, e.g. 'src/lib/foo.ts'

exclude

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.

type string[]

default `['**\/*.test.ts', '**\/*.spec.ts', '**\/internal/**']`

getAnalyzerType

Determine which analyzer to use for a file path.

Called for files in source directories. Return an AnalyzerType or null to skip:

  • 'typescript' — TypeScript/JS files analyzed via TypeScript compiler API
  • 'svelte' — Svelte components analyzed via svelte2tsx + TypeScript compiler API
  • 'css' — CSS files included as modules with no declarations
  • 'json' — JSON files included as modules with no declarations
  • null — skip the file

type (path: string): AnalyzerType | null

path

type string
returns AnalyzerType | null
// Add MDsveX support getAnalyzerType: (path) => (path.endsWith('.svx') ? 'svelte' : getDefaultAnalyzer(path))
// Include .d.ts files (the default excludes them) getAnalyzerType: (path) => (path.endsWith('.d.ts') ? 'typescript' : getDefaultAnalyzer(path))

SourceOptionsOverrides
#

source-config.ts view source

also exported from index.ts

SourceOptionsOverrides import type {SourceOptionsOverrides} from 'svelte-docinfo/source-config.js';

Override surface for building ModuleSourceOptions: all fields optional, with exclude widened to ExcludeOption so callers can extend the default patterns instead of replacing them. Accepted by createSourceOptions / createSourceOptionsWithInclude and the option types layered on them (AnalyzeFromFilesOptions.sourceOptions, the Vite plugin's sourceOptions).

sourcePaths?

Source directory paths to include, relative to projectRoot.

Absolute entries are accepted when they resolve inside projectRoot and are stored root-relative; an entry resolving outside it throws (a root-anchored '/src/lib' is taken as filesystem-absolute, not shorthand — the error hints to drop the slash). Normalized (./.. segments collapsed, trailing slashes stripped) by normalizeSourceOptions, which returns a new options object.

type string[]

['src/lib'] // single source directory
['src/lib', 'src/routes'] // multiple directories

sourceRoot?

Source root for extracting relative module paths, relative to projectRoot.

Normalized like sourcePaths entries (absolute-inside-root accepted and stored root-relative, ./.. collapsed — so '.' becomes '', trailing slashes stripped, out-of-root throws) by normalizeSourceOptions, which returns a new options object.

When omitted:

  • Single sourcePath: defaults to that path
  • Multiple sourcePaths: auto-derived as the longest common directory prefix (or '' when paths share no common prefix — produces project-relative module paths)

type string

'src/lib' // module paths like 'foo.ts', 'utils/bar.ts'
'src' // module paths like 'lib/foo.ts', 'routes/page.svelte'
'' // or '.': module paths stay project-relative, e.g. 'src/lib/foo.ts'

getAnalyzerType?

Determine which analyzer to use for a file path.

Called for files in source directories. Return an AnalyzerType or null to skip:

  • 'typescript' — TypeScript/JS files analyzed via TypeScript compiler API
  • 'svelte' — Svelte components analyzed via svelte2tsx + TypeScript compiler API
  • 'css' — CSS files included as modules with no declarations
  • 'json' — JSON files included as modules with no declarations
  • null — skip the file

type (path: string): AnalyzerType | null

path

type string
returns AnalyzerType | null
// Add MDsveX support getAnalyzerType: (path) => (path.endsWith('.svx') ? 'svelte' : getDefaultAnalyzer(path))
// Include .d.ts files (the default excludes them) getAnalyzerType: (path) => (path.endsWith('.d.ts') ? 'typescript' : getDefaultAnalyzer(path))

exclude?

type ExcludeOption

widenSourcePathsForInclude
#

source-config.ts view source

(sourcePaths: readonly string[], include: readonly string[]): readonly string[] import {widenSourcePathsForInclude} from 'svelte-docinfo/source-config.js';

Union sourcePaths with the static base directories of explicit include patterns, so include-discovered files count as source at analysis time.

Discovery include globs can reach outside sourcePaths (`--include 'src/other/' under the default ['src/lib']`); without widening, the query-time source gate would drop those modules, and extractPath would have no root to relativize their paths against (its fallback is the absolute path). Each pattern contributes its static base (see includePatternBase). A root-crossing pattern (`'\/*.ts'`) contributes '', which scopes the whole project root as source.

Pure path-set logic — callers re-run createSourceOptions on the widened list so sourceRoot derivation and validation see the final set (an *explicit* sourceRoot that doesn't prefix a widened path fails that validation loudly rather than emitting absolute module paths; an out-of-root base hits the projectRoot-escape throw). Returns the input array identity when nothing widens. createSourceOptionsWithInclude wraps both steps for the common call shape.

sourcePaths

type readonly string[]

include

type readonly string[]

returns

readonly string[]

Depends on
#

Imported by
#