UNPKG

@ts-ast-parser/core

Version:

Reflects a simplified version of the TypeScript AST for generating documentation

101 lines 2.99 kB
import type { AnalyserSystem } from './analyser-system.js'; /** * System interface to interact with the OS in a Node.js environment. * * All interaction of the TypeScript compiler with the operating system goes * through a System interface. * * You can think of it as the Operating Environment (OE). */ export declare class NodeSystem implements AnalyserSystem { get args(): string[]; get newLine(): string; get useCaseSensitiveFileNames(): boolean; /** * Writes the content * * @param content - Content to write to the file */ write(content: string): void; /** * Reads the data encoded inside a file * * @param filePath - The file path * @param encoding - The file econding * * @returns The content of the file */ readFile(filePath: string, encoding?: string): string; writeFile(filePath: string, data: string): void; resolvePath(filePath: string): string; /** * Checks whether the file exists * * @param filePath * @returns True if the file exists, otherwise false */ fileExists(filePath: string): boolean; directoryExists(filePath: string): boolean; createDirectory(filePath: string): void; getExecutingFilePath(): string; /** * The current working directory */ getCurrentDirectory(): string; /** * Returns the directory names (not the absolute path) * * @param filePath - The path from where to search */ getDirectories(filePath: string): string[]; readDirectory(filePath: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[]; exit(exitCode?: number): void; /** * Normalizes the path based on the OS and makes it * relative to the current working directory. * * @param filePath */ normalizePath(filePath: string): string; /** * Returns the directory name * * @param filePath */ getDirectoryName(filePath: string): string; /** * Returns a string with the filename portion of the path * * @param filePath */ getBaseName(filePath: 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 filePath * @returns True if the path is absolute */ isAbsolute(filePath: string): boolean; /** * Resolves symlinks to get the real path * * @param filePath */ realpath(filePath: string): string; /** * Returns the absolute path * * @param filePath */ getAbsolutePath(filePath: string): string; private _ensureDirectoryExistence; private fsRealPathHandlingLongPath; } //# sourceMappingURL=node-system.d.ts.map