UNPKG

ngc-webpack

Version:

A wrapper for the @ngtools/webpack with hooks into the compilation process

32 lines (31 loc) 1.41 kB
import * as ts from 'typescript'; import { WebpackResourceLoader } from '../resource-loader'; export interface OnErrorFn { (message: string): void; } export declare class CliCompilerHost implements ts.CompilerHost { private options; resourceLoader: WebpackResourceLoader; private resourceCache; private host; constructor(options: ts.CompilerOptions, resourceLoader?: WebpackResourceLoader); fileExists(fileName: string): boolean; readFile(fileName: string): string; getDirectories(path: string): string[]; getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, _onError?: OnErrorFn): ts.SourceFile; getCancellationToken(): ts.CancellationToken; getDefaultLibFileName(options: ts.CompilerOptions): string; writeFile(fileName: string, data: string, _writeByteOrderMark: boolean, _onError?: (message: string) => void, _sourceFiles?: ts.SourceFile[]): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; readResource(fileName: string): Promise<string> | string; /** * Returns a cached resource, if the resource is not cached returns undefined. * Will not try to get the resource if it does not exists. * @param {string} fileName * @returns {string} */ getResource(fileName: string): string | undefined; }