UNPKG

@ts-bridge/cli

Version:

Bridge the gap between ES modules and CommonJS modules with an easy-to-use alternative to `tsc`.

57 lines 2.34 kB
import type { CompilerOptions, System, WriteFileCallback } from 'typescript'; import type { BuildType } from './build-type.js'; /** * Remove the directory and all of its contents. This is similar to `rm -rf`. * * @param path - The path to the directory to remove. * @param baseDirectory - The base directory that the path must be within. */ export declare function removeDirectory(path: string, baseDirectory: string): void; /** * Get the new file name with the given extension. * * @param fileName - The file name to change. * @param extension - The new extension for source files. * @param declarationExtension - The new extension for declaration files. * @returns The new file name. */ export declare function getNewFileName(fileName: string, extension: string, declarationExtension: string): string; /** * Get a function that writes files to the file system, after transforming them. * * This function is called by the TypeScript compiler API to write transformed * files to the file system. * * @param type - The build type to use. * @param compilerOptions - The compiler options to use. * @param system - The system to use for file operations. * @param verbose - Whether to log verbose output. * @returns The function that writes files to the file system. */ export declare function getWriteFileFunction(type: BuildType, compilerOptions: CompilerOptions, system: System, verbose?: boolean): WriteFileCallback; /** * Read a JSON file and return its content as a parsed value. * * @param path - The path to the JSON file. * @param system - The system to use for file operations. * @returns The parsed JSON content or `null` if the file could not be read or * parsed. */ export declare function readJsonFile(path: string, system: System): any; /** * Get the canonical file name for a file. * * @param fileName - The file name. * @param system - The system to use for file operations. * @returns The canonical file name. */ export declare function getCanonicalFileName(fileName: string, system?: System): string; /** * Get the absolute path for the specified path, relative to the current working * directory. * * @param paths - The paths to resolve. * @returns The absolute path. */ export declare function getAbsolutePath(...paths: string[]): string; //# sourceMappingURL=file-system.d.ts.map