cannabis
Version:
TypeScript AST Query library
29 lines (28 loc) • 1.1 kB
TypeScript
import { ts, tsMorph } from 'ts-simple-ast-extra';
import { ASTNode } from '../node/astNode';
/**
* Creates a new file with given code. If there is a project loaded, the new file won't be associated with any directory.
* If fileName is passed, make sure is unique, if not it will throw.
*/
export declare function getFile(codeOrNode: string | ts.Node | ASTNode, fileName?: string): ASTNode;
/**
* Returns an object representing the project that gives access to the root directories using
* [[getRootDirectories]] which are queriable nodes.
*/
export declare function loadProject(tsConfigFilePath: string): ASTRoot;
/**
* Allows to load an existing ts-morph project instance.
*/
export declare function setProject(project: tsMorph.Project): ASTRoot;
/**
* This represents the project and is not a valid Node. Query on the root directories using
* [[getRootDirectory]].
*/
interface ASTRoot {
getRootDirectory(): ASTNode;
getRootDirectories(): ASTNode[];
getSourceFiles(): ASTNode[];
getDiagnostics(): string[];
}
export declare function getASTRoot(): ASTRoot;
export {};