code-graph-generator
Version:
Generate Json Object of code that can be used to generate code-graphs for JavaScript/TypeScript/Range projects
38 lines (37 loc) • 1.19 kB
TypeScript
import { CodeGraph, FileGraph, GraphBuilder } from '../types/interfaces';
/**
* IncrementalGraphBuilder builds a code graph incrementally as files are added.
* Optimized for handling large codebases efficiently.
*/
export declare class IncrementalGraphBuilder implements GraphBuilder {
private projectName;
private packageMap;
private fileMap;
private rootDir;
constructor(projectName: string, rootDir?: string);
/**
* Add a file to the graph, creating the package if it doesn't exist.
*/
addFile(fileGraph: FileGraph): void;
/**
* Get the complete code graph.
*/
getGraph(): CodeGraph;
/**
* Write the graph to a stream, useful for large graphs.
*/
writeToStream(writeStream: NodeJS.WritableStream): Promise<void>;
/**
* Find a file in the graph by its path.
* Handles various path formats and extensions.
*/
findFileByPath(filePath: string): FileGraph | undefined;
/**
* Resolve an import path to an absolute path.
*/
private resolveImportPath;
/**
* Analyze dependencies between packages based on file imports.
*/
private analyzePackageDependencies;
}