Spaces:
Running
Running
File size: 2,851 Bytes
fd8cdf5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /**
* Information about a function extracted from source code.
*/
export interface FunctionInfo {
/** Function name */
name: string;
/** Starting line number (1-indexed) */
startLine: number;
/** Ending line number (1-indexed) */
endLine: number;
/** Parameter names */
params: string[];
/** Whether the function is exported */
isExported: boolean;
}
/**
* Information about a class extracted from source code.
*/
export interface ClassInfo {
/** Class name */
name: string;
/** Starting line number (1-indexed) */
startLine: number;
/** Ending line number (1-indexed) */
endLine: number;
/** Method names defined in the class */
methods: string[];
/** Whether the class is exported */
isExported: boolean;
}
/**
* Information about an import statement.
*/
export interface ImportInfo {
/** Raw import path as written in source */
source: string;
/** Resolved path to a project file (undefined if external dependency) */
resolvedPath?: string;
/** Imported names (named imports, default import name, or namespace) */
names: string[];
}
/**
* Result of parsing a single source file for structural information.
*/
export interface ParseResult {
/** Functions found in the file */
functions: FunctionInfo[];
/** Classes found in the file */
classes: ClassInfo[];
/** Import statements found in the file */
imports: ImportInfo[];
/** Exported names from the file */
exports: string[];
}
/**
* Parse TypeScript/JavaScript content and extract structural information.
*/
export declare function parseTypeScript(content: string): ParseResult;
/**
* Parse Python content and extract structural information.
*/
export declare function parsePython(content: string): ParseResult;
/**
* Parse Go content and extract structural information.
*/
export declare function parseGo(content: string): ParseResult;
/**
* Parse Rust content and extract structural information.
*/
export declare function parseRust(content: string): ParseResult;
/**
* Parse Java content and extract structural information.
*/
export declare function parseJava(content: string): ParseResult;
/**
* Parse generic content (PHP, Ruby, or unknown languages) using common patterns.
* Falls back to empty result if nothing is detected.
*/
export declare function parseGeneric(content: string): ParseResult;
/**
* Parses a source file and extracts structural information using
* regex-based extraction (no tree-sitter dependency).
*
* @param filePath - Absolute path to the file to parse
* @param language - Detected language of the file (e.g., 'typescript', 'python')
* @returns ParseResult with extracted functions, classes, imports, and exports
*/
export declare function parseFile(filePath: string, language: string): ParseResult;
|