1 | import * as typescript from 'typescript';
|
2 | import { Chalk } from 'chalk';
|
3 | import * as logger from './logger';
|
4 | export interface ErrorInfo {
|
5 | code: number;
|
6 | severity: Severity;
|
7 | content: string;
|
8 | file: string;
|
9 | line: number;
|
10 | character: number;
|
11 | context: string;
|
12 | }
|
13 | export declare type FileLocation = {
|
14 | line: number;
|
15 | character: number;
|
16 | };
|
17 | export interface WebpackError {
|
18 | module?: any;
|
19 | file?: string;
|
20 | message: string;
|
21 | location?: FileLocation;
|
22 | loaderSource: string;
|
23 | }
|
24 | export interface WebpackModule {
|
25 | resource: string;
|
26 | errors: WebpackError[];
|
27 | addWarning(warning: Error): void;
|
28 | addError(error: WebpackError | Error): void;
|
29 | getWarnings(): Iterable<Error> | undefined;
|
30 | getErrors(): Iterable<WebpackError | Error> | undefined;
|
31 | clearWarningsAndErrors(): void;
|
32 | buildMeta: {
|
33 | tsLoaderFileVersion: number;
|
34 | tsLoaderDefinitionFileVersions: string[];
|
35 | };
|
36 | }
|
37 | export declare type ResolveSync = (context: string | undefined, path: string, moduleName: string) => string;
|
38 | export declare type Action = () => void;
|
39 | export interface HostMayBeCacheable {
|
40 | clearCache?: Action;
|
41 | }
|
42 | export interface CacheableHost extends HostMayBeCacheable {
|
43 | fileExists: typescript.ModuleResolutionHost['fileExists'];
|
44 | directoryExists: NonNullable<typescript.ModuleResolutionHost['directoryExists']>;
|
45 | realpath?: typescript.ModuleResolutionHost['realpath'];
|
46 | }
|
47 | export interface ModuleResolutionHostMayBeCacheable extends typescript.ModuleResolutionHost, HostMayBeCacheable {
|
48 | readFile(filePath: string, encoding?: string): string | undefined;
|
49 | trace: NonNullable<typescript.ModuleResolutionHost['trace']>;
|
50 | directoryExists: NonNullable<typescript.ModuleResolutionHost['directoryExists']>;
|
51 | getCurrentDirectory: NonNullable<typescript.ModuleResolutionHost['getCurrentDirectory']>;
|
52 | getDirectories: NonNullable<typescript.ModuleResolutionHost['getDirectories']>;
|
53 | useCaseSensitiveFileNames: NonNullable<typescript.LanguageServiceHost['useCaseSensitiveFileNames']>;
|
54 | getNewLine: NonNullable<typescript.LanguageServiceHost['getNewLine']>;
|
55 | getDefaultLibFileName: NonNullable<typescript.LanguageServiceHost['getDefaultLibFileName']>;
|
56 | readDirectory: NonNullable<typescript.LanguageServiceHost['readDirectory']>;
|
57 | }
|
58 | export interface ServiceHostWhichMayBeCacheable extends typescript.LanguageServiceHost, HostMayBeCacheable {
|
59 | }
|
60 | export interface WatchHost extends typescript.WatchCompilerHostOfFilesAndCompilerOptions<typescript.EmitAndSemanticDiagnosticsBuilderProgram> {
|
61 | invokeFileWatcher: WatchFactory['invokeFileWatcher'];
|
62 | updateRootFileNames(): void;
|
63 | outputFiles: Map<FilePathKey, typescript.OutputFile[]>;
|
64 | tsbuildinfo?: typescript.OutputFile;
|
65 | }
|
66 | export declare type WatchCallbacks<T> = Map<FilePathKey, {
|
67 | fileName: string;
|
68 | callbacks: T[];
|
69 | }>;
|
70 | export interface WatchFactory {
|
71 | watchedFiles: WatchCallbacks<typescript.FileWatcherCallback>;
|
72 | watchedDirectories: WatchCallbacks<typescript.DirectoryWatcherCallback>;
|
73 | watchedDirectoriesRecursive: WatchCallbacks<typescript.DirectoryWatcherCallback>;
|
74 | invokeFileWatcher(fileName: string, eventKind: typescript.FileWatcherEventKind): boolean;
|
75 |
|
76 | watchFile: typescript.WatchHost['watchFile'];
|
77 |
|
78 | watchDirectory: typescript.WatchHost['watchDirectory'];
|
79 | }
|
80 | export interface SolutionDiagnostics {
|
81 | global: typescript.Diagnostic[];
|
82 | perFile: Map<FilePathKey, typescript.Diagnostic[]>;
|
83 | transpileErrors: [FilePathKey | undefined, typescript.Diagnostic[]][];
|
84 | }
|
85 | export declare type FilePathKey = string & {
|
86 | __filePathKeyBrand: any;
|
87 | };
|
88 | export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
|
89 | diagnostics: SolutionDiagnostics;
|
90 | writtenFiles: OutputFile[];
|
91 | configFileInfo: Map<FilePathKey, ConfigFileInfo>;
|
92 | outputAffectingInstanceVersion: Map<FilePathKey, true>;
|
93 | getOutputFileKeyFromReferencedProject(outputFileName: string): FilePathKey | undefined;
|
94 | getOutputFileFromReferencedProject(outputFileName: string): OutputFile | false | undefined;
|
95 | getOutputFileAndKeyFromReferencedProject(oututFileName: string): {
|
96 | key: FilePathKey;
|
97 | outputFile: OutputFile | false;
|
98 | } | undefined;
|
99 | getInputFileNameFromOutput(outputFileName: string): string | undefined;
|
100 | getOutputFilesFromReferencedProjectInput(inputFileName: string): OutputFile[];
|
101 | buildReferences(): void;
|
102 | clearCache(): void;
|
103 | }
|
104 | export interface ConfigFileInfo {
|
105 | config: typescript.ParsedCommandLine | undefined;
|
106 | outputFileNames?: Map<FilePathKey, {
|
107 | inputFileName: string;
|
108 | outputNames: FilePathKey[];
|
109 | }>;
|
110 | tsbuildInfoFile?: string;
|
111 | dtsFiles?: string[];
|
112 | }
|
113 | export interface OutputFile extends typescript.OutputFile {
|
114 | time: Date;
|
115 | version: number;
|
116 | }
|
117 | export interface TSInstance {
|
118 | compiler: typeof typescript;
|
119 | compilerOptions: typescript.CompilerOptions;
|
120 |
|
121 | appendTsTsxSuffixesIfRequired: (filePath: string) => string;
|
122 | loaderOptions: LoaderOptions;
|
123 | rootFileNames: Set<string>;
|
124 | |
125 |
|
126 |
|
127 | files: TSFiles;
|
128 | |
129 |
|
130 |
|
131 | modifiedFiles?: Map<FilePathKey, true>;
|
132 | |
133 |
|
134 |
|
135 |
|
136 |
|
137 | projectsMissingSourceMaps?: Set<string>;
|
138 | servicesHost?: ServiceHostWhichMayBeCacheable;
|
139 | languageService?: typescript.LanguageService | null;
|
140 | version: number;
|
141 | dependencyGraph: DependencyGraph;
|
142 | filesWithErrors?: TSFiles;
|
143 | transformers: typescript.CustomTransformers;
|
144 | colors: Chalk;
|
145 | otherFiles: TSFiles;
|
146 | watchHost?: WatchHost;
|
147 | watchOfFilesAndCompilerOptions?: typescript.WatchOfFilesAndCompilerOptions<typescript.EmitAndSemanticDiagnosticsBuilderProgram>;
|
148 | builderProgram?: typescript.EmitAndSemanticDiagnosticsBuilderProgram;
|
149 | program?: typescript.Program;
|
150 | hasUnaccountedModifiedFiles?: boolean;
|
151 | changedFilesList?: boolean;
|
152 | reportTranspileErrors?: boolean;
|
153 | solutionBuilderHost?: SolutionBuilderWithWatchHost;
|
154 | solutionBuilder?: typescript.SolutionBuilder<typescript.EmitAndSemanticDiagnosticsBuilderProgram>;
|
155 | configFilePath: string | undefined;
|
156 | filePathKeyMapper: (fileName: string) => FilePathKey;
|
157 | initialSetupPending: boolean;
|
158 | configParseResult: typescript.ParsedCommandLine;
|
159 | log: logger.Logger;
|
160 | }
|
161 | export interface LoaderOptionsCache {
|
162 | [name: string]: WeakMap<LoaderOptions, LoaderOptions>;
|
163 | }
|
164 | export interface TSInstances {
|
165 | [name: string]: TSInstance;
|
166 | }
|
167 | export declare type DependencyGraph = Map<FilePathKey, ResolvedModule[]>;
|
168 | export declare type ReverseDependencyGraph = Map<FilePathKey, Map<FilePathKey, true>>;
|
169 | export declare type LogLevel = 'INFO' | 'WARN' | 'ERROR';
|
170 | export declare type ResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost) => typescript.ResolvedModuleWithFailedLookupLocations;
|
171 | export declare type CustomResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: ResolveModuleName) => typescript.ResolvedModuleWithFailedLookupLocations;
|
172 | export declare type CustomResolveTypeReferenceDirective = (typeDirectiveName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: typeof typescript.resolveTypeReferenceDirective) => typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
|
173 | export interface LoaderOptions {
|
174 | silent: boolean;
|
175 | logLevel: LogLevel;
|
176 | logInfoToStdOut: boolean;
|
177 | instance: string;
|
178 | compiler: string;
|
179 | configFile: string;
|
180 | context: string;
|
181 | transpileOnly: boolean;
|
182 | ignoreDiagnostics: number[];
|
183 | reportFiles: string[];
|
184 | errorFormatter: (message: ErrorInfo, colors: Chalk) => string;
|
185 | onlyCompileBundledFiles: boolean;
|
186 | colors: boolean;
|
187 | compilerOptions: typescript.CompilerOptions;
|
188 | appendTsSuffixTo: (RegExp | string)[];
|
189 | appendTsxSuffixTo: (RegExp | string)[];
|
190 | happyPackMode: boolean;
|
191 | getCustomTransformers: string | ((program: typescript.Program) => typescript.CustomTransformers | undefined);
|
192 | experimentalWatchApi: boolean;
|
193 | allowTsInNodeModules: boolean;
|
194 | experimentalFileCaching: boolean;
|
195 | projectReferences: boolean;
|
196 | resolveModuleName: CustomResolveModuleName;
|
197 | resolveTypeReferenceDirective: CustomResolveTypeReferenceDirective;
|
198 | useCaseSensitiveFileNames?: boolean;
|
199 | }
|
200 | export interface TSFile {
|
201 | fileName: string;
|
202 | text?: string;
|
203 | version: number;
|
204 | modifiedTime?: Date;
|
205 | projectReference?: {
|
206 | /**
|
207 | * Undefined here means we’ve already checked and confirmed there is no
|
208 | * project reference for the file. Don’t bother checking again.
|
209 | */
|
210 | project?: typescript.ResolvedProjectReference;
|
211 | outputFileName?: string;
|
212 | };
|
213 | }
|
214 | /** where key is filepath */
|
215 | export declare type TSFiles = Map<FilePathKey, TSFile>;
|
216 | export interface ResolvedModule {
|
217 | originalFileName: string;
|
218 | resolvedFileName: string;
|
219 | resolvedModule?: ResolvedModule;
|
220 | isExternalLibraryImport?: boolean;
|
221 | }
|
222 | export declare type Severity = 'error' | 'warning';
|
223 | //# sourceMappingURL=interfaces.d.ts.map |
\ | No newline at end of file |