@adonisjs/require-ts
Version:
In memory typescript compiler
41 lines (40 loc) • 1.19 kB
TypeScript
import tsStatic from 'typescript';
import { Compiler } from './src/Compiler';
import { Transformers } from './src/Contracts';
/**
* Symbols that can be used to get the global reference of the compiler
*/
export declare const symbols: {
compiler: symbol;
config: symbol;
};
/**
* Returns helpers to along with cache when using a watcher.
*
* - You can check if the tsconfig file inside the cache is stale or not.
* If it is stale, then clear the entire cache
*
* - Clear cache for a given file path.
* - Clear all cache
*/
export declare function getWatcherHelpers(appRoot: string, cachePath?: string): {
clear(filePath?: string): void;
isConfigStale: () => boolean;
};
/**
* Load in-memory typescript compiler
*/
export declare function loadCompiler(appRoot: string, options: {
compilerOptions: tsStatic.CompilerOptions;
transformers?: Transformers;
}): Compiler;
/**
* Register hook to compile typescript files in-memory. When
* caching is enabled, the compiled files will be written
* on the disk
*/
export declare function register(appRoot: string, opts?: {
cache?: boolean;
cachePath?: string;
transformers?: Transformers;
}): void;