UNPKG

@adonisjs/require-ts

Version:
55 lines (54 loc) 1.46 kB
import tsStatic from 'typescript'; import { Transformers } from '../Contracts'; /** * Exposes the API compile source files using the tsc compiler. No * type checking takes place. */ export declare class Compiler { private appRoot; private cacheRoot; private ts; private options; private usesCache; /** * In-memory compiled files cache for source maps to work. */ private memCache; /** * Disk cache */ private cache; /** * Dignostic reporter to print program errors */ private diagnosticsReporter; private transformers; constructor(appRoot: string, cacheRoot: string, ts: typeof tsStatic, options: { compilerOptions: tsStatic.CompilerOptions; transformers?: Transformers; }, usesCache?: boolean); /** * Patch compiler options to make source map work properly */ private patchCompilerOptions; /** * Resolves transformer relative from the app root */ private resolverTransformer; /** * Resolve transformers */ private resolveTransformers; /** * Setup source maps support to read from in-memory cache */ private setupSourceMaps; /** * Compiles the file using the typescript compiler */ private compileFile; /** * Compile typescript source code using the tsc compiler. */ compile(filePath: string, contents: string, virtualFile?: boolean): string; }