@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
52 lines • 1.57 kB
TypeScript
/**
* Remove leading comments from a declaration
*/
/* eslint-disable regexp/no-super-linear-backtracking */
export declare function removeLeadingComments(text: string): string;
/**
* Extract leading comments from source code before a position
*/
export declare function extractLeadingComments(source: string, position: number): string[];
/**
* Extract trailing comments from a line
*/
export declare function extractTrailingComment(line: string): string | null;
/**
* Format comments for output
*/
export declare function formatComments(comments: string[]): string[];
/**
* Extract balanced content between symbols (e.g., <>, (), {})
*/
export declare function extractBalancedSymbols(text: string, openSymbol: string, closeSymbol: string): { content: string, rest: string } | null;
/**
* Parse a function declaration
*/
export declare function parseFunctionDeclaration(text: string): FunctionSignature | null;
/**
* Check if a line is an export statement
*/
export declare function isExportStatement(line: string): boolean;
/**
* Check if a line is a type-only export
*/
export declare function isTypeOnlyExport(line: string): boolean;
/**
* Extract variable name and type from declaration
*/
export declare function parseVariableDeclaration(text: string): {
name: string
kind: 'const' | 'let' | 'var'
typeAnnotation?: string
value?: string
} | null;
/**
* Extract function signature parts
*/
export declare interface FunctionSignature {
name: string
generics: string
parameters: string
returnType: string
modifiers: string[]
}