@wrench/roll-typescript
Version:
plugin for bundling TypeScript with support of modular output and declaration bundle
55 lines (42 loc) • 2.11 kB
TypeScript
import { CompilerHost, CompilerOptions, DocumentRegistry, ModuleResolutionCache, Program, ScriptTarget } from "typescript";
import { EmitHost } from "./emit-host";
import { ResolutionHost } from "./resolution-host";
import { TypeScriptHost } from "./typescript-host";
import { WriteHost } from "./write-host";
export interface ProjectHost extends TypeScriptHost, CompilerHost, EmitHost, ResolutionHost, WriteHost {
/** Compiler options of this host. */
readonly options: CompilerOptions;
/** List of file names to use for compilation. */
readonly fileNames: ReadonlyArray<string>;
/** Current working directory. */
readonly currentDirectory: string;
/** Global registry of source files to use for all programs. */
readonly documentRegistry: DocumentRegistry;
/** @inheritdoc */
readonly moduleResolutionCache: ModuleResolutionCache;
/** @inheritdoc */
writeFile(fileName: string, content: string, writeByteOrderMark?: boolean): void;
/**
* Program to use for TS to JS transformation.
* Create new program instance when state is dirty or program is null.
* @param checkDirty - whether to run {@link checkProgramDirty}.
*/
getProgram(checkDirty?: boolean): Program;
/** Check if program became by scheduling new program creation for next {@link getProgram} call. */
checkProgramDirty(): void;
/** @inheritdoc */
getCurrentDirectory(): string;
/**
* Set root file names to use by program.
* @param fileNames - root file names.
* @param canonical - whether paths are already in canonical format.
*/
setFileNames(fileNames: ReadonlyArray<string>, canonical?: boolean): void;
/**
* Create host inheriting properties from this object.
* @param props - properties to override.
*/
fork(props: Partial<ProjectHost>): this;
}
export declare function getKeyForCompilationSettings(host: ProjectHost, language: ScriptTarget): import("typescript").DocumentRegistryBucketKey;
export declare function addFileNames(host: ProjectHost, fileNames: ReadonlyArray<string>): void;