UNPKG

25.8 kBTypeScriptView Raw
1// Type definitions for @babel/core 7.1
2// Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io
3// Definitions by: Troy Gerwien <https://github.com/yortus>
4// Marvin Hagemeister <https://github.com/marvinhagemeister>
5// Melvin Groenhoff <https://github.com/mgroenhoff>
6// Jessica Franco <https://github.com/Jessidhia>
7// Ifiok Jr. <https://github.com/ifiokjr>
8// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9// Minimum TypeScript Version: 3.4
10
11import { GeneratorOptions } from '@babel/generator';
12import traverse, { Visitor, NodePath, Hub, Scope } from '@babel/traverse';
13import template from '@babel/template';
14import * as t from '@babel/types';
15import { ParserOptions } from '@babel/parser';
16
17export { ParserOptions, GeneratorOptions, t as types, template, traverse, NodePath, Visitor };
18
19export type Node = t.Node;
20export type ParseResult = t.File | t.Program;
21export const version: string;
22export const DEFAULT_EXTENSIONS: ['.js', '.jsx', '.es6', '.es', '.mjs'];
23
24export interface TransformOptions {
25 /**
26 * Include the AST in the returned object
27 *
28 * Default: `false`
29 */
30 ast?: boolean | null;
31
32 /**
33 * Attach a comment after all non-user injected code
34 *
35 * Default: `null`
36 */
37 auxiliaryCommentAfter?: string | null;
38
39 /**
40 * Attach a comment before all non-user injected code
41 *
42 * Default: `null`
43 */
44 auxiliaryCommentBefore?: string | null;
45
46 /**
47 * Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.
48 *
49 * Default: `"."`
50 */
51 root?: string | null;
52
53 /**
54 * This option, combined with the "root" value, defines how Babel chooses its project root.
55 * The different modes define different ways that Babel can process the "root" value to get
56 * the final project root.
57 *
58 * @see https://babeljs.io/docs/en/next/options#rootmode
59 */
60 rootMode?: 'root' | 'upward' | 'upward-optional';
61
62 /**
63 * The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
64 *
65 * Default: `undefined`
66 */
67 configFile?: string | boolean | null;
68
69 /**
70 * Specify whether or not to use .babelrc and
71 * .babelignore files.
72 *
73 * Default: `true`
74 */
75 babelrc?: boolean | null;
76
77 /**
78 * Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search
79 * inside of. Defaults to only searching the "root" package.
80 *
81 * Default: `(root)`
82 */
83 babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null;
84
85 /**
86 * Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"`
87 *
88 * Default: env vars
89 */
90 envName?: string;
91
92 /**
93 * If any of patterns match, the current configuration object is considered inactive and is ignored during config processing.
94 */
95 exclude?: MatchPattern | MatchPattern[];
96
97 /**
98 * Enable code generation
99 *
100 * Default: `true`
101 */
102 code?: boolean | null;
103
104 /**
105 * Output comments in generated output
106 *
107 * Default: `true`
108 */
109 comments?: boolean | null;
110
111 /**
112 * Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB
113 *
114 * Default: `"auto"`
115 */
116 compact?: boolean | 'auto' | null;
117
118 /**
119 * The working directory that Babel's programmatic options are loaded relative to.
120 *
121 * Default: `"."`
122 */
123 cwd?: string | null;
124
125 /**
126 * Utilities may pass a caller object to identify themselves to Babel and
127 * pass capability-related flags for use by configs, presets and plugins.
128 *
129 * @see https://babeljs.io/docs/en/next/options#caller
130 */
131 caller?: TransformCaller;
132
133 /**
134 * This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
135 * which will use those options when the `envName` is `production`
136 *
137 * Default: `{}`
138 */
139 env?: { [index: string]: TransformOptions | null | undefined } | null;
140
141 /**
142 * A path to a `.babelrc` file to extend
143 *
144 * Default: `null`
145 */
146 extends?: string | null;
147
148 /**
149 * Filename for use in errors etc
150 *
151 * Default: `"unknown"`
152 */
153 filename?: string | null;
154
155 /**
156 * Filename relative to `sourceRoot`
157 *
158 * Default: `(filename)`
159 */
160 filenameRelative?: string | null;
161
162 /**
163 * An object containing the options to be passed down to the babel code generator, @babel/generator
164 *
165 * Default: `{}`
166 */
167 generatorOpts?: GeneratorOptions | null;
168
169 /**
170 * Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used
171 *
172 * Default: `null`
173 */
174 getModuleId?: ((moduleName: string) => string | null | undefined) | null;
175
176 /**
177 * ANSI highlight syntax error code frames
178 *
179 * Default: `true`
180 */
181 highlightCode?: boolean | null;
182
183 /**
184 * Opposite to the `only` option. `ignore` is disregarded if `only` is specified
185 *
186 * Default: `null`
187 */
188 ignore?: MatchPattern[] | null;
189
190 /**
191 * This option is a synonym for "test"
192 */
193 include?: MatchPattern | MatchPattern[];
194
195 /**
196 * A source map object that the output source map will be based on
197 *
198 * Default: `null`
199 */
200 inputSourceMap?: object | null;
201
202 /**
203 * Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe)
204 *
205 * Default: `false`
206 */
207 minified?: boolean | null;
208
209 /**
210 * Specify a custom name for module ids
211 *
212 * Default: `null`
213 */
214 moduleId?: string | null;
215
216 /**
217 * If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules)
218 *
219 * Default: `false`
220 */
221 moduleIds?: boolean | null;
222
223 /**
224 * Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions
225 *
226 * Default: `(sourceRoot)`
227 */
228 moduleRoot?: string | null;
229
230 /**
231 * A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile
232 * a non-matching file it's returned verbatim
233 *
234 * Default: `null`
235 */
236 only?: MatchPattern[] | null;
237
238 /**
239 * Allows users to provide an array of options that will be merged into the current configuration one at a time.
240 * This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply
241 */
242 overrides?: TransformOptions[];
243
244 /**
245 * An object containing the options to be passed down to the babel parser, @babel/parser
246 *
247 * Default: `{}`
248 */
249 parserOpts?: ParserOptions | null;
250
251 /**
252 * List of plugins to load and use
253 *
254 * Default: `[]`
255 */
256 plugins?: PluginItem[] | null;
257
258 /**
259 * List of presets (a set of plugins) to load and use
260 *
261 * Default: `[]`
262 */
263 presets?: PluginItem[] | null;
264
265 /**
266 * Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns)
267 *
268 * Default: `false`
269 */
270 retainLines?: boolean | null;
271
272 /**
273 * An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used
274 *
275 * Default: `null`
276 */
277 shouldPrintComment?: ((commentContents: string) => boolean) | null;
278
279 /**
280 * Set `sources[0]` on returned source map
281 *
282 * Default: `(filenameRelative)`
283 */
284 sourceFileName?: string | null;
285
286 /**
287 * If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"`
288 * then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**
289 *
290 * Default: `false`
291 */
292 sourceMaps?: boolean | 'inline' | 'both' | null;
293
294 /**
295 * The root from which all sources are relative
296 *
297 * Default: `(moduleRoot)`
298 */
299 sourceRoot?: string | null;
300
301 /**
302 * Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6
303 * `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`.
304 *
305 * Default: `("module")`
306 */
307 sourceType?: 'script' | 'module' | 'unambiguous' | null;
308
309 /**
310 * If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing.
311 */
312 test?: MatchPattern | MatchPattern[];
313
314 /**
315 * An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as
316 * `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
317 */
318 wrapPluginVisitorMethod?:
319 | ((
320 pluginAlias: string,
321 visitorType: 'enter' | 'exit',
322 callback: (path: NodePath, state: any) => void,
323 ) => (path: NodePath, state: any) => void)
324 | null;
325}
326
327export interface TransformCaller {
328 // the only required property
329 name: string;
330 // e.g. set to true by `babel-loader` and false by `babel-jest`
331 supportsStaticESM?: boolean;
332 supportsDynamicImport?: boolean;
333 // augment this with a "declare module '@babel/core' { ... }" if you need more keys
334}
335
336export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
337
338export interface MatchPatternContext {
339 envName: string;
340 dirname: string;
341 caller: TransformCaller | undefined;
342}
343export type MatchPattern = string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean);
344
345/**
346 * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
347 */
348export function transform(code: string, callback: FileResultCallback): void;
349
350/**
351 * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
352 */
353export function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
354
355/**
356 * Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API.
357 */
358export function transform(code: string, opts?: TransformOptions): BabelFileResult | null;
359
360/**
361 * Transforms the passed in code. Returning an object with the generated code, source map, and AST.
362 */
363export function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null;
364
365/**
366 * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
367 */
368export function transformAsync(code: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
369
370/**
371 * Asynchronously transforms the entire contents of a file.
372 */
373export function transformFile(filename: string, callback: FileResultCallback): void;
374
375/**
376 * Asynchronously transforms the entire contents of a file.
377 */
378export function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
379
380/**
381 * Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`.
382 */
383export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null;
384
385/**
386 * Asynchronously transforms the entire contents of a file.
387 */
388export function transformFileAsync(filename: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
389
390/**
391 * Given an AST, transform it.
392 */
393export function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void;
394
395/**
396 * Given an AST, transform it.
397 */
398export function transformFromAst(
399 ast: Node,
400 code: string | undefined,
401 opts: TransformOptions | undefined,
402 callback: FileResultCallback,
403): void;
404
405/**
406 * Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API.
407 */
408export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null;
409
410/**
411 * Given an AST, transform it.
412 */
413export function transformFromAstAsync(
414 ast: Node,
415 code?: string,
416 opts?: TransformOptions,
417): Promise<BabelFileResult | null>;
418
419// A babel plugin is a simple function which must return an object matching
420// the following interface. Babel will throw if it finds unknown properties.
421// The list of allowed plugin keys is here:
422// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71
423export interface PluginObj<S = PluginPass> {
424 name?: string;
425 manipulateOptions?(opts: any, parserOpts: any): void;
426 pre?(this: S, state: S): void;
427 visitor: Visitor<S>;
428 post?(this: S, state: S): void;
429 inherits?: any;
430}
431
432export interface BabelFile {
433 ast: t.File;
434 opts: TransformOptions;
435 hub: Hub;
436 metadata: object;
437 path: NodePath;
438 scope: Scope;
439 inputMap: object | null;
440 code: string;
441}
442
443export interface PluginPass {
444 file: BabelFile;
445 key: string;
446 opts: PluginOptions;
447 cwd: string;
448 filename: string;
449 [key: string]: unknown;
450}
451
452export interface BabelFileResult {
453 ast?: t.File | null;
454 code?: string | null;
455 ignored?: boolean;
456 map?: {
457 version: number;
458 sources: string[];
459 names: string[];
460 sourceRoot?: string;
461 sourcesContent?: string[];
462 mappings: string;
463 file: string;
464 } | null;
465 metadata?: BabelFileMetadata;
466}
467
468export interface BabelFileMetadata {
469 usedHelpers: string[];
470 marked: Array<{
471 type: string;
472 message: string;
473 loc: object;
474 }>;
475 modules: BabelFileModulesMetadata;
476}
477
478export interface BabelFileModulesMetadata {
479 imports: object[];
480 exports: {
481 exported: object[];
482 specifiers: object[];
483 };
484}
485
486export type FileParseCallback = (err: Error | null, result: ParseResult | null) => any;
487
488/**
489 * Given some code, parse it using Babel's standard behavior.
490 * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
491 */
492export function parse(code: string, callback: FileParseCallback): void;
493
494/**
495 * Given some code, parse it using Babel's standard behavior.
496 * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
497 */
498export function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void;
499
500/**
501 * Given some code, parse it using Babel's standard behavior.
502 * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
503 */
504export function parse(code: string, options?: TransformOptions): ParseResult | null;
505
506/**
507 * Given some code, parse it using Babel's standard behavior.
508 * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
509 */
510export function parseSync(code: string, options?: TransformOptions): ParseResult | null;
511
512/**
513 * Given some code, parse it using Babel's standard behavior.
514 * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
515 */
516export function parseAsync(code: string, options?: TransformOptions): Promise<ParseResult | null>;
517
518/**
519 * Resolve Babel's options fully, resulting in an options object where:
520 *
521 * * opts.plugins is a full list of Plugin instances.
522 * * opts.presets is empty and all presets are flattened into opts.
523 * * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel
524 * will not make a second attempt to load config files.
525 *
526 * Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to
527 * use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to
528 * invalidate properly, but it is the best we have at the moment.
529 */
530export function loadOptions(options?: TransformOptions): object | null;
531
532/**
533 * To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and
534 * presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it
535 * as then see fit and pass it back to Babel again.
536 *
537 * * `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
538 * * `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
539 * * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back
540 * to Babel again.
541 * * `plugins: Array<ConfigItem>` - See below.
542 * * `presets: Array<ConfigItem>` - See below.
543 * * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to
544 * Babel will not make a second attempt to load config files.
545 *
546 * `ConfigItem` instances expose properties to introspect the values, but each item should be treated as
547 * immutable. If changes are desired, the item should be removed from the list and replaced with either a normal
548 * Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for
549 * information about `ConfigItem` fields.
550 */
551export function loadPartialConfig(options?: TransformOptions): Readonly<PartialConfig> | null;
552
553export interface PartialConfig {
554 options: TransformOptions;
555 babelrc?: string;
556 babelignore?: string;
557 config?: string;
558 hasFilesystemConfig: () => boolean;
559}
560
561export interface ConfigItem {
562 /**
563 * The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
564 */
565 name?: string;
566
567 /**
568 * The resolved value of the plugin.
569 */
570 value: object | ((...args: any[]) => any);
571
572 /**
573 * The options object passed to the plugin.
574 */
575 options?: object | false;
576
577 /**
578 * The path that the options are relative to.
579 */
580 dirname: string;
581
582 /**
583 * Information about the plugin's file, if Babel knows it.
584 * *
585 */
586 file?: {
587 /**
588 * The file that the user requested, e.g. `"@babel/env"`
589 */
590 request: string;
591
592 /**
593 * The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
594 */
595 resolved: string;
596 } | null;
597}
598
599export type PluginOptions = object | undefined | false;
600
601export type PluginTarget = string | object | ((...args: any[]) => any);
602
603export type PluginItem =
604 | ConfigItem
605 | PluginObj<any>
606 | PluginTarget
607 | [PluginTarget, PluginOptions]
608 | [PluginTarget, PluginOptions, string | undefined];
609
610export function resolvePlugin(name: string, dirname: string): string | null;
611export function resolvePreset(name: string, dirname: string): string | null;
612
613export interface CreateConfigItemOptions {
614 dirname?: string;
615 type?: 'preset' | 'plugin';
616}
617
618/**
619 * Allows build tooling to create and cache config items up front. If this function is called multiple times for a
620 * given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected
621 * plugins and presets to inject, pre-constructing the config items would be recommended.
622 */
623export function createConfigItem(
624 value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined],
625 options?: CreateConfigItemOptions,
626): ConfigItem;
627
628// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
629/**
630 * @see https://babeljs.io/docs/en/next/config-files#config-function-api
631 */
632export interface ConfigAPI {
633 /**
634 * The version string for the Babel version that is loading the config file.
635 *
636 * @see https://babeljs.io/docs/en/next/config-files#apiversion
637 */
638 version: string;
639 /**
640 * @see https://babeljs.io/docs/en/next/config-files#apicache
641 */
642 cache: SimpleCacheConfigurator;
643 /**
644 * @see https://babeljs.io/docs/en/next/config-files#apienv
645 */
646 env: EnvFunction;
647 // undocumented; currently hardcoded to return 'false'
648 // async(): boolean
649 /**
650 * This API is used as a way to access the `caller` data that has been passed to Babel.
651 * Since many instances of Babel may be running in the same process with different `caller` values,
652 * this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
653 *
654 * The `caller` value is available as the first parameter of the callback function.
655 * It is best used with something like this to toggle configuration behavior
656 * based on a specific environment:
657 *
658 * @example
659 * function isBabelRegister(caller?: { name: string }) {
660 * return !!(caller && caller.name === "@babel/register")
661 * }
662 * api.caller(isBabelRegister)
663 *
664 * @see https://babeljs.io/docs/en/next/config-files#apicallercb
665 */
666 caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions['caller']) => T): T;
667 /**
668 * While `api.version` can be useful in general, it's sometimes nice to just declare your version.
669 * This API exposes a simple way to do that with:
670 *
671 * @example
672 * api.assertVersion(7) // major version only
673 * api.assertVersion("^7.2")
674 *
675 * @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
676 */
677 assertVersion(versionRange: number | string): boolean;
678 // NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
679 // tokTypes: typeof tokTypes
680}
681
682/**
683 * JS configs are great because they can compute a config on the fly,
684 * but the downside there is that it makes caching harder.
685 * Babel wants to avoid re-executing the config function every time a file is compiled,
686 * because then it would also need to re-execute any plugin and preset functions
687 * referenced in that config.
688 *
689 * To avoid this, Babel expects users of config functions to tell it how to manage caching
690 * within a config file.
691 *
692 * @see https://babeljs.io/docs/en/next/config-files#apicache
693 */
694export interface SimpleCacheConfigurator {
695 // there is an undocumented call signature that is a shorthand for forever()/never()/using().
696 // (ever: boolean): void
697 // <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
698 /**
699 * Permacache the computed config and never call the function again.
700 */
701 forever(): void;
702 /**
703 * Do not cache this config, and re-execute the function every time.
704 */
705 never(): void;
706 /**
707 * Any time the using callback returns a value other than the one that was expected,
708 * the overall config function will be called again and a new entry will be added to the cache.
709 *
710 * @example
711 * api.cache.using(() => process.env.NODE_ENV)
712 */
713 using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
714 /**
715 * Any time the using callback returns a value other than the one that was expected,
716 * the overall config function will be called again and all entries in the cache will
717 * be replaced with the result.
718 *
719 * @example
720 * api.cache.invalidate(() => process.env.NODE_ENV)
721 */
722 invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
723}
724
725// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
726export type SimpleCacheKey = string | boolean | number | null | undefined;
727export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
728
729/**
730 * Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
731 * meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
732 * was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
733 *
734 * @see https://babeljs.io/docs/en/next/config-files#apienv
735 */
736export interface EnvFunction {
737 /**
738 * @returns the current `envName` string
739 */
740 (): string;
741 /**
742 * @returns `true` if the `envName` is `===` any of the given strings
743 */
744 (envName: string | ReadonlyArray<string>): boolean;
745 // the official documentation is misleading for this one...
746 // this just passes the callback to `cache.using` but with an additional argument.
747 // it returns its result instead of necessarily returning a boolean.
748 <T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions['envName']>) => T): T;
749}
750
751export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
752
753export as namespace babel;