-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
i-typescript-plugin-options.ts
62 lines (50 loc) · 2.01 KB
/
i-typescript-plugin-options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {ParsedCommandLine, CustomTransformers, CompilerOptions} from "typescript";
import {IBabelInputOptions} from "./i-babel-options";
import {CustomTransformersFunction} from "../util/merge-transformers/i-custom-transformer-options";
import {FileSystem} from "../util/file-system/file-system";
export type Transpiler = "typescript" | "babel";
export interface IBrowserslistPathConfig {
path: string;
}
export interface IBrowserslistQueryConfig {
query: string[] | string;
}
export type BrowserslistConfig = IBrowserslistPathConfig | IBrowserslistQueryConfig;
export interface TsConfigResolverWithFileName {
fileName: string;
hook(resolvedOptions: CompilerOptions): CompilerOptions;
}
export type TsConfigResolver = TsConfigResolverWithFileName["hook"];
export type OutputPathKind = "declaration" | "declarationMap";
export type OutputPathHook = (path: string, kind: OutputPathKind) => string | undefined;
export interface HookRecord {
outputPath: OutputPathHook;
}
export interface ITypescriptPluginBaseOptions {
transpiler: Transpiler;
tsconfig?:
| string
| Partial<CompilerOptions>
| Partial<Record<keyof CompilerOptions, string | number | boolean>>
| ParsedCommandLine
| TsConfigResolver
| TsConfigResolverWithFileName;
browserslist?: false | string[] | string | BrowserslistConfig;
cwd: string;
resolveTypescriptLibFrom: string;
transformers?: (CustomTransformers | CustomTransformersFunction)[] | CustomTransformers | CustomTransformersFunction;
include: string[] | string;
exclude: string[] | string;
transpileOnly?: boolean;
fileSystem: FileSystem;
hook: Partial<HookRecord>;
}
export interface ITypescriptPluginTypescriptOptions extends ITypescriptPluginBaseOptions {
transpiler: "typescript";
}
export interface ITypescriptPluginBabelOptions extends ITypescriptPluginBaseOptions {
transpiler: "babel";
noBabelConfigCustomization?: boolean;
babelConfig?: string | Partial<IBabelInputOptions>;
}
export type TypescriptPluginOptions = ITypescriptPluginTypescriptOptions | ITypescriptPluginBabelOptions;