UNPKG

2.21 kBTypeScriptView Raw
1export interface Options {
2 targets?: TargetsOptions | undefined;
3 bugfixes?: boolean | undefined;
4 spec?: boolean | undefined;
5 loose?: boolean | undefined;
6 modules?: ModuleOption | undefined;
7 debug?: boolean | undefined;
8 include?: PluginList | undefined;
9 exclude?: PluginList | undefined;
10 useBuiltIns?: UseBuiltInsOption | undefined;
11 corejs?: CorejsOption | undefined;
12 forceAllTransforms?: boolean | undefined;
13 configPath?: string | undefined;
14 ignoreBrowserslistConfig?: boolean | undefined;
15 shippedProposals?: boolean | undefined;
16}
17
18/**
19 * "targets" config option:
20 * https://babeljs.io/docs/en/babel-preset-env#targets
21 */
22export type TargetsOptions =
23 | BrowserslistQuery
24 | readonly BrowserslistQuery[]
25 | { [key in Target]?: string }
26 | { esmodules: true }
27 | { node: string | "current" | true }
28 | { safari: string | "tp" }
29 | { browsers: string | readonly string[] };
30
31export type BrowserslistQuery = string;
32
33/**
34 * List of supported Browserslist targets:
35 * Source: https://github.com/browserslist/browserslist#browsers
36 */
37export type Target =
38 | "Android"
39 | "Baidu"
40 | "BlackBerry"
41 | "bb"
42 | "Chrome"
43 | "ChromeAndroid"
44 | "and_chr"
45 | "Edge"
46 | "Electron"
47 | "Explorer"
48 | "ie"
49 | "ExplorerMobile"
50 | "ie_mob"
51 | "Firefox"
52 | "ff"
53 | "FirefoxAndroid"
54 | "and_ff"
55 | "iOS"
56 | "ios_saf"
57 | "Node"
58 | "Opera"
59 | "OperaMini"
60 | "op_mini"
61 | "OperaMobile"
62 | "op_mob"
63 | "QQAndroid"
64 | "and_qq"
65 | "Safari"
66 | "Samsung"
67 | "UCAndroid"
68 | "and_uc"
69 | "kaios";
70
71/**
72 * https://babeljs.io/docs/en/babel-preset-env#modules
73 */
74export type ModuleOption =
75 | "amd"
76 | "umd"
77 | "systemjs"
78 | "commonjs"
79 | "cjs"
80 | "auto"
81 | false;
82
83export type PluginList = readonly PluginListItem[];
84export type PluginListItem = string | RegExp;
85
86export type UseBuiltInsOption =
87 | "usage"
88 | "entry"
89 | false;
90
91export type CorejsOption =
92 | CorejsVersion
93 | { version: CorejsVersion; proposals: boolean };
94
95/**
96 * https://babeljs.io/docs/babel-preset-env#corejs
97 */
98export type CorejsVersion = 2 | 3 | string;