@ts-ast-parser/core
Version:
Reflects a simplified version of the TypeScript AST for generating documentation
127 lines • 3.75 kB
TypeScript
import type { AnalyserSystem } from './analyser-system.js';
/**
* System interface to interact with an in memory file system.
*
* All interaction of the TypeScript compiler with the operating system goes
* through a System interface.
*
* This is a very simplistic approach. For complex use cases,
* this may not be enough.
*/
export declare class InMemorySystem implements AnalyserSystem {
readonly newLine = "\n";
readonly useCaseSensitiveFileNames = false;
readonly args: string[];
private readonly _fs;
private constructor();
static create(files?: Map<string, string>): Promise<InMemorySystem>;
/**
* This method is not implemented and calling it, will throw
* an exception
*
* @param _content
*/
write(_content: string): void;
/**
* Reads the data encoded inside a file
*
* @param path
*/
readFile(path: string): string | undefined;
writeFile(path: string, data: string): void;
resolvePath(path: string): string;
/**
* Checks whether the file exists
*
* @param path
* @returns True if the file exists, otherwise false
*/
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
createDirectory(path: string): void;
/**
* This method is not implemented and calling it, will throw
* an exception
*/
getExecutingFilePath(): string;
/**
* The root directory name
*/
getCurrentDirectory(): string;
/**
* Returns the directory names (not the absolute path)
*
* @param path - The path from where to search
*/
getDirectories(path: string): string[];
readDirectory(path: string, extensions?: readonly string[]): string[];
deleteFile(path: string): void;
/**
* This method is not implemented and calling it, will throw
* an exception
*/
exit(): void;
/**
* Normalizes the path based on the OS and makes it
* relative to the current working directory.
*
* @param path
*/
normalizePath(path: string): string;
/**
* Returns the path of the directory
*
* @param path
*/
getDirectoryName(path: string): string;
/**
* Returns a string with the filename portion of the path
*
* @param path
*/
getBaseName(path: string): string;
/**
* Joins the segments using the path separator of the OS/Browser
*
* @param segments
*/
join(...segments: string[]): string;
/**
* Checks if the path is an absolute path. An absolute
* path is a path that starts with the ROOT directory.
*
* @param path
* @returns True if the path is absolute
*/
isAbsolute(path: string): boolean;
realpath(path: string): string;
/**
* Transforms the path to an absolute path.
*
* It imposes some restrictions about how path are handled to simplify things.
*
* The following restrictions will apply:
*
* - No directories with only dots in its name
* - Paths are converted to lowercase
* - In the name of the file you can have dots
*
* A few examples to show how the functions transforms the path:
*
* - "./foo.js" -> "<ROOT_DIR>/foo.js"
* - "." -> "<ROOT_DIR>"
* - "/foo.js" -> "<ROOT_DIR>/foo.js"
* - "foo.js" -> "<ROOT_DIR>/foo.js"
* - "Bar/foo.js" or "./Bar/foo.js" -> "<ROOT_DIR>/bar/foo.js"
*
* @param path
*/
getAbsolutePath(path: string): string;
private _writeLibFilesFromNodeModules;
private _writeLibFilesFromCDN;
private _get;
private _setFile;
private _setDirectory;
private _getPath;
}
//# sourceMappingURL=in-memory-system.d.ts.map