UNPKG

2.05 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';
6import { Compiler } from 'webpack';
7export 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}
27export interface Compiler {
28 inputFileSystem: typeof fs;
29 _tsInstances: {
30 [key: string]: Instance;
31 };
32 options: {
33 watch: boolean;
34 };
35}
36export 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}
56export declare type QueryOptions = LoaderConfig & ts.CompilerOptions;
57export declare function getRootCompiler(compiler: any): any;
58export declare function ensureInstance(webpack: Loader, query: QueryOptions, options: LoaderConfig, instanceName: string, rootCompiler: any): Instance;
59export declare function setupTs(compiler: string): CompilerInfo;
60export interface Configs {
61 configFilePath: string;
62 compilerConfig: TsConfig;
63 loaderConfig: LoaderConfig;
64}
65export declare function readConfigFile(context: string, query: QueryOptions, options: LoaderConfig, tsImpl: typeof ts): Configs;
66export declare type Dict<T> = {
67 [key: string]: T;
68};