UNPKG

1.73 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as fs from 'fs';
3import * as ts from 'typescript';
4import { Checker } from './checker';
5import { CompilerInfo, LoaderConfig, TsConfig } from './interfaces';
6export interface Instance {
7 id: number;
8 babelImpl?: any;
9 compiledFiles: {
10 [key: string]: boolean;
11 };
12 configFilePath: string;
13 compilerConfig: TsConfig;
14 loaderConfig: LoaderConfig;
15 checker: Checker;
16 cacheIdentifier: any;
17 context: string;
18}
19export interface Compiler {
20 inputFileSystem: typeof fs;
21 _tsInstances: {
22 [key: string]: Instance;
23 };
24 options: {
25 watch: boolean;
26 };
27}
28export interface Loader {
29 _compiler: Compiler;
30 cacheable: () => void;
31 query: string;
32 async: () => (err: Error, source?: string, map?: string) => void;
33 resourcePath: string;
34 resolve: () => void;
35 addDependency: (dep: string) => void;
36 clearDependencies: () => void;
37 emitFile: (fileName: string, text: string) => void;
38 emitWarning: (msg: string) => void;
39 emitError: (msg: string) => void;
40 options: {
41 ts?: LoaderConfig;
42 };
43}
44export declare type QueryOptions = LoaderConfig & ts.CompilerOptions;
45export declare function getRootCompiler(compiler: any): any;
46export declare function ensureInstance(webpack: Loader, query: QueryOptions, options: LoaderConfig, instanceName: string, rootCompiler: any): Instance;
47export declare function setupTs(compiler: string): CompilerInfo;
48export interface Configs {
49 configFilePath: string;
50 compilerConfig: TsConfig;
51 loaderConfig: LoaderConfig;
52}
53export declare function readConfigFile(context: string, query: QueryOptions, options: LoaderConfig, tsImpl: typeof ts): Configs;