UNPKG

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