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