@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
223 lines (222 loc) • 5.2 kB
TypeScript
/**
* DtsGenerationConfig
*
* This is the configuration object for the DTS generation process.
*/
export declare interface DtsGenerationConfig {
cwd: string
root: string
entrypoints: string[]
outdir: string
keepComments: boolean
clean: boolean
tsconfigPath: string
verbose: boolean | string[]
outputStructure?: 'mirror' | 'flat'
importOrder?: string[]
dryRun?: boolean
stats?: boolean
continueOnError?: boolean
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
exclude?: string[]
outputFormat?: 'text' | 'json'
progress?: boolean
diff?: boolean
validate?: boolean
watch?: boolean
parallel?: boolean
concurrency?: number
declarationMap?: boolean
plugins?: import('./plugins').Plugin[]
bundle?: boolean
bundleOutput?: string
autoIncludeReExports?: boolean
failOnUnresolvedReExport?: boolean
incremental?: boolean
clearCache?: boolean
indentStyle?: 'spaces' | 'tabs'
indentSize?: number
prettier?: boolean
include?: string[]
isolatedDeclarations?: boolean
typeMappings?: import('./type-mappings').TypeMappingConfig
lineEnding?: 'lf' | 'crlf' | 'auto'
normalizeOutput?: boolean
declarationOrder?: {
kinds?: import('./types').DeclarationKind[]
alphabetize?: boolean
groupExports?: boolean
}
tracking?: TrackingConfig
profiling?: ProfilingConfig
typeInference?: TypeInferenceConfig
typeChecking?: TypeCheckingConfig
typeValidation?: TypeValidationConfig
}
/**
* Tracking configuration for debugging type and import usage
*/
export declare interface TrackingConfig {
types?: boolean
relationships?: boolean
usage?: boolean
imports?: boolean
importUsage?: boolean
importRelationships?: boolean
}
/**
* Profiling configuration for performance analysis
*/
export declare interface ProfilingConfig {
memory?: boolean
memoryLimit?: number
cpu?: boolean
samplingInterval?: number
io?: boolean
trackOperations?: ('read' | 'write')[]
outputFile?: string
}
/**
* Type inference configuration
*/
export declare interface TypeInferenceConfig {
enabled?: boolean
strictness?: 'loose' | 'normal' | 'strict'
inferReturnTypes?: boolean
inferConstTypes?: boolean
}
/**
* Type checking configuration
*/
export declare interface TypeCheckingConfig {
enabled?: boolean
strictness?: 'loose' | 'normal' | 'strict'
warningsAsErrors?: boolean
maxErrors?: number
}
/**
* Type validation configuration
*/
export declare interface TypeValidationConfig {
enabled?: boolean
rules?: {
noAny?: boolean
noUnknown?: boolean
noImplicitAny?: boolean
explicitReturnTypes?: boolean
explicitParameterTypes?: boolean
}
}
/**
* Source location for error reporting
*/
export declare interface SourceLocation {
line: number
column: number
offset?: number
}
/**
* Detailed error information with source location
*/
export declare interface DtsError {
file: string
message: string
code?: string
location?: SourceLocation
stack?: string
suggestion?: string
}
/**
* Generation statistics
*/
export declare interface GenerationStats {
generationMode: 'isolated' | 'semantic'
filesProcessed: number
filesGenerated: number
filesFailed: number
filesValidated: number
validationErrors: number
declarationsFound: number
importsProcessed: number
exportsProcessed: number
durationMs: number
errors: DtsError[]
}
/**
* Declaration
*
* Represents a parsed declaration from TypeScript source
*/
export declare interface Declaration {
kind: DeclarationKind
name: string
text: string
leadingComments?: string[]
isExported: boolean
isDefault?: boolean
typeAnnotation?: string
modifiers?: string[]
generics?: string
extends?: string
implements?: string[]
members?: Declaration[]
parameters?: ParameterDeclaration[]
returnType?: string
value?: unknown
source?: string
specifiers?: ImportSpecifier[]
isTypeOnly?: boolean
isSideEffect?: boolean
isAsync?: boolean
isGenerator?: boolean
overloads?: string[]
start?: number
end?: number
}
/**
* ParameterDeclaration
*/
export declare interface ParameterDeclaration {
name: string
type?: string
optional?: boolean
rest?: boolean
defaultValue?: string
}
/**
* ImportSpecifier
*/
export declare interface ImportSpecifier {
name: string
alias?: string
isType?: boolean
}
/**
* ProcessingContext
*
* Context passed through processing pipeline
*/
export declare interface ProcessingContext {
filePath: string
sourceCode: string
declarations: Declaration[]
imports?: Map<string, Set<string>>
exports?: Set<string>
usedTypes?: Set<string>
}
/**
* DtsGenerationOption
*
* This is the configuration object for the DTS generation process.
*/
export type DtsGenerationOption = Partial<DtsGenerationConfig>;
/**
* DtsGenerationOptions
*
* This is the configuration object for the DTS generation process.
*/
export type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[];
/**
* Declaration kind - all possible declaration types
*/
export type DeclarationKind = 'function' | 'variable' | 'interface' | 'type' | 'class' | 'enum' | 'import' | 'export' | 'module' | 'namespace' | 'unknown';