typescript-exports.ts

Module-level export analysis: resolve every export of a TypeScript source file into a DeclarationAnalysis, including re-export classification.

Builds on the per-declaration extractors in typescript-extract-*.ts by adding the orchestration layer — alias chain walking, namespace classification, JSDoc routing for re-exports, default-slot handling.

@see typescript-program.ts for IsExternalFile and program construction @see typescript-extract-*.ts for the per-declaration extractors

Declarations
#

4 declarations

view source

analyzeDeclaration
#

typescript-exports.ts view source

(symbol: Symbol, sourceFile: SourceFile, checker: TypeChecker, diagnostics: ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | ... 12 more ... | { ...; })[], isExternalFile: IsExternalFile): DeclarationAnalysis

Analyze a TypeScript symbol and extract rich metadata.

This is a high-level function that combines TSDoc parsing with TypeScript type analysis to produce complete declaration metadata. Suitable for use in documentation generators, IDE integrations, and other tooling.

symbol

the TypeScript symbol to analyze

type Symbol

sourceFile

the source file containing the symbol

type SourceFile

checker

the TypeScript type checker

type TypeChecker

diagnostics

diagnostics collector for non-fatal issues

type ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]

isExternalFile

predicate for determining whether a source file is external to the project

returns

DeclarationAnalysis

complete declaration metadata including docs, types, and parameters, plus nodocs flag

analyzeExports
#

typescript-exports.ts view source

(sourceFile: SourceFile, checker: TypeChecker, options: ModuleSourceOptions, diagnostics: ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | ... 12 more ... | { ...; })[]): ModuleExportsAnalysis

Analyze all exports from a TypeScript source file.

Extracts the module-level comment via extractModuleComment, star exports via extractStarExports, and all exported declarations with complete metadata. Handles re-exports by: - Same-name re-exports: tracked in reExports for alsoExportedFrom building - Renamed re-exports: included as new declarations with aliasOf metadata - Star exports (export * from): tracked in starExports for namespace-level info

This is a mid-level function (above the individual extract* helpers, below analyze) suitable for building documentation, API explorers, or analysis tools. For standard SvelteKit library layouts, use createSourceOptions(process.cwd()).

sourceFile

the TypeScript source file to analyze

type SourceFile

checker

the TypeScript type checker

type TypeChecker

options

module source options for path extraction in re-exports

diagnostics

diagnostics collector for non-fatal issues

type ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]

returns

ModuleExportsAnalysis

module comment, declarations, re-exports, and star exports

analyzeTypescriptModule
#

typescript-exports.ts view source

(sourceFileInfo: SourceFileInfo & { dependents?: readonly string[] | undefined; }, tsSourceFile: SourceFile, modulePath: string, checker: TypeChecker, options: ModuleSourceOptions, diagnostics: ({ ...; } | ... 12 more ... | { ...; })[]): ModuleAnalysis

Analyze a TypeScript file and extract module metadata.

Wraps analyzeExports and adds dependency information via extractDependencies from the source file info if available.

This is a high-level function suitable for building documentation or library metadata. For lower-level analysis, use analyzeExports directly.

sourceFileInfo

the source file info (from file system, build pipeline, or other source)

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

tsSourceFile

TypeScript source file from the program

type SourceFile

modulePath

the module path (relative to source root)

type string

checker

TypeScript type checker

type TypeChecker

options

module source options for path extraction

diagnostics

diagnostics collector for non-fatal issues

type ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]

returns

ModuleAnalysis

module metadata and re-export information

extractModuleComment
#

Depends on
#

Imported by
#