/** * AST parsing module - extracts code signatures using TypeScript compiler API * * Note: This module performs static analysis only and never executes code. * The TypeScript compiler API only performs lexical and syntactic analysis, * making pattern-based security checks unnecessary. Any actual security * validation should be performed at execution boundaries, not during parsing. */ import type { FileInfo } from '../types/index.js'; /** * Error class for oversized file warnings */ export declare class FileSizeError extends Error { readonly filePath: string; readonly fileSize: number; constructor(message: string, filePath: string, fileSize: number); } export declare class ASTParser { /** * Parse a TypeScript/JavaScript file and extract code signatures * @param filePath - Absolute path to the file * @returns FileInfo with extracted signatures */ static parseFile(filePath: string): Promise; /** * Parse file content and extract code signatures * @param content - File content as string * @param filePath - File path for error reporting * @returns FileInfo with extracted signatures */ static parseContent(content: string, filePath: string): FileInfo; /** * Get appropriate ScriptKind for file extension * @param ext - File extension * @returns TypeScript ScriptKind */ private static getScriptKind; /** * Visit AST node and extract relevant information * @param node - AST node to visit * @param imports - Array to collect imports * @param functions - Array to collect functions * @param classes - Array to collect classes * @param constants - Array to collect constants * @param sourceFile - Source file for text extraction */ private static visitNode; /** * Extract import declaration information * @param node - Import declaration node * @param imports - Array to add import info to */ private static extractImport; /** * Extract export declaration information * @param node - Export declaration node * @param imports - Array to add export info to */ private static extractExport; /** * Extract dynamic import or require call * @param node - Call expression node * @param imports - Array to add import info to */ private static extractDynamicImport; /** * Extract function declaration information * @param node - Function declaration node * @param functions - Array to add function info to */ private static extractFunction; /** * Extract class declaration information * @param node - Class declaration node * @param classes - Array to add class info to * @param sourceFile - Source file for text extraction */ private static extractClass; /** * Extract constant/variable declarations * @param node - Variable statement node * @param constants - Array to add constant info to */ private static extractConstants; /** * Determine the kind of initializer expression * @param initializer - Initializer expression * @returns Kind of initializer */ private static getInitializerKind; /** * Create an empty FileInfo object for files that exceed limits or fail validation * @returns Empty FileInfo structure */ private static getEmptyFileInfo; /** * Parse basic imports when AST parsing fails due to syntax errors * Uses regex-based parsing for basic import/export detection * @param content - File content as string * @param filePath - File path for error reporting * @returns FileInfo with basic import information */ private static parseBasicImports; } //# sourceMappingURL=ast-parser.d.ts.map