@types/babel__core

  • Version 7.20.5
  • Published
  • 33 kB
  • 5 dependencies
  • MIT license

Install

npm i @types/babel__core
yarn add @types/babel__core
pnpm add @types/babel__core

Overview

TypeScript definitions for @babel/core

Index

Variables

Functions

Interfaces

Type Aliases

Variables

variable DEFAULT_EXTENSIONS

const DEFAULT_EXTENSIONS: ['.js', '.jsx', '.es6', '.es', '.mjs'];

    variable version

    const version: string;

      Functions

      function createConfigItem

      createConfigItem: (
      value:
      | PluginTarget
      | [PluginTarget, PluginOptions]
      | [PluginTarget, PluginOptions, string | undefined],
      options?: CreateConfigItemOptions
      ) => ConfigItem;
      • Allows build tooling to create and cache config items up front. If this function is called multiple times for a given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected plugins and presets to inject, pre-constructing the config items would be recommended.

      function loadOptions

      loadOptions: (options?: TransformOptions) => object | null;
      • Resolve Babel's options fully, resulting in an options object where:

        * opts.plugins is a full list of Plugin instances. * opts.presets is empty and all presets are flattened into opts. * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel will not make a second attempt to load config files.

        Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to invalidate properly, but it is the best we have at the moment.

      function loadPartialConfig

      loadPartialConfig: (
      options?: TransformOptions
      ) => Readonly<PartialConfig> | null;
      • To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it as then see fit and pass it back to Babel again.

        * babelrc: string | void - The path of the .babelrc file, if there was one. * babelignore: string | void - The path of the .babelignore file, if there was one. * options: ValidatedOptions - The partially resolved options, which can be manipulated and passed back to Babel again. * plugins: Array<ConfigItem> - See below. * presets: Array<ConfigItem> - See below. * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel will not make a second attempt to load config files.

        ConfigItem instances expose properties to introspect the values, but each item should be treated as immutable. If changes are desired, the item should be removed from the list and replaced with either a normal Babel config value, or with a replacement item created by babel.createConfigItem. See that function for information about ConfigItem fields.

      function loadPartialConfigAsync

      loadPartialConfigAsync: (
      options?: TransformOptions
      ) => Promise<Readonly<PartialConfig> | null>;

        function parse

        parse: {
        (code: string, callback: FileParseCallback): void;
        (code: string, options: TransformOptions, callback: FileParseCallback): void;
        (code: string, options?: TransformOptions): any;
        };
        • Given some code, parse it using Babel's standard behavior. Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.

        function parseAsync

        parseAsync: (
        code: string,
        options?: TransformOptions
        ) => Promise<ParseResult | null>;
        • Given some code, parse it using Babel's standard behavior. Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.

        function parseSync

        parseSync: (code: string, options?: TransformOptions) => ParseResult | null;
        • Given some code, parse it using Babel's standard behavior. Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.

        function resolvePlugin

        resolvePlugin: (name: string, dirname: string) => string | null;

          function resolvePreset

          resolvePreset: (name: string, dirname: string) => string | null;

            function transform

            transform: {
            (code: string, callback: FileResultCallback): void;
            (code: string, opts: TransformOptions, callback: FileResultCallback): void;
            (code: string, opts?: TransformOptions): BabelFileResult;
            };
            • Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.

            • Here for backward-compatibility. Ideally use transformSync if you want a synchronous API.

            function transformAsync

            transformAsync: (
            code: string,
            opts?: TransformOptions
            ) => Promise<BabelFileResult | null>;
            • Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.

            function transformFile

            transformFile: {
            (filename: string, callback: FileResultCallback): void;
            (filename: string, opts: TransformOptions, callback: FileResultCallback): void;
            };
            • Asynchronously transforms the entire contents of a file.

            function transformFileAsync

            transformFileAsync: (
            filename: string,
            opts?: TransformOptions
            ) => Promise<BabelFileResult | null>;
            • Asynchronously transforms the entire contents of a file.

            function transformFileSync

            transformFileSync: (
            filename: string,
            opts?: TransformOptions
            ) => BabelFileResult | null;
            • Synchronous version of babel.transformFile. Returns the transformed contents of the filename.

            function transformFromAst

            transformFromAst: {
            (ast: t.Node, code: string | undefined, callback: FileResultCallback): void;
            (
            ast: t.Node,
            code: string,
            opts: TransformOptions,
            callback: FileResultCallback
            ): void;
            };
            • Given an AST, transform it.

            function transformFromAstAsync

            transformFromAstAsync: (
            ast: t.Node,
            code?: string,
            opts?: TransformOptions
            ) => Promise<BabelFileResult | null>;
            • Given an AST, transform it.

            function transformFromAstSync

            transformFromAstSync: (
            ast: t.Node,
            code?: string,
            opts?: TransformOptions
            ) => BabelFileResult | null;
            • Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API.

            function transformSync

            transformSync: (code: string, opts?: TransformOptions) => BabelFileResult | null;
            • Transforms the passed in code. Returning an object with the generated code, source map, and AST.

            Interfaces

            interface BabelFile

            interface BabelFile {}

              property ast

              ast: t.File;

                property code

                code: string;

                  property hub

                  hub: Hub;

                    property inputMap

                    inputMap: object | null;

                      property metadata

                      metadata: object;

                        property opts

                        opts: TransformOptions;

                          property path

                          path: NodePath<t.Program>;

                            property scope

                            scope: Scope;

                              interface BabelFileMetadata

                              interface BabelFileMetadata {}

                                property marked

                                marked: Array<{
                                type: string;
                                message: string;
                                loc: object;
                                }>;

                                  property modules

                                  modules: BabelFileModulesMetadata;

                                    property usedHelpers

                                    usedHelpers: string[];

                                      interface BabelFileModulesMetadata

                                      interface BabelFileModulesMetadata {}

                                        property exports

                                        exports: {
                                        exported: object[];
                                        specifiers: object[];
                                        };

                                          property imports

                                          imports: object[];

                                            interface BabelFileResult

                                            interface BabelFileResult {}

                                              property ast

                                              ast?: t.File | null | undefined;

                                                property code

                                                code?: string | null | undefined;

                                                  property ignored

                                                  ignored?: boolean | undefined;

                                                    property map

                                                    map?:
                                                    | {
                                                    version: number;
                                                    sources: string[];
                                                    names: string[];
                                                    sourceRoot?: string | undefined;
                                                    sourcesContent?: string[] | undefined;
                                                    mappings: string;
                                                    file: string;
                                                    }
                                                    | null
                                                    | undefined;

                                                      property metadata

                                                      metadata?: BabelFileMetadata | undefined;

                                                        interface ConfigAPI

                                                        interface ConfigAPI {}
                                                        • See Also

                                                          • https://babeljs.io/docs/en/next/config-files#config-function-api

                                                        property cache

                                                        cache: SimpleCacheConfigurator;
                                                        • See Also

                                                          • https://babeljs.io/docs/en/next/config-files#apicache

                                                        property env

                                                        env: EnvFunction;
                                                        • See Also

                                                          • https://babeljs.io/docs/en/next/config-files#apienv

                                                        property version

                                                        version: string;
                                                        • The version string for the Babel version that is loading the config file.

                                                          See Also

                                                          • https://babeljs.io/docs/en/next/config-files#apiversion

                                                        method assertVersion

                                                        assertVersion: (versionRange: number | string) => boolean;
                                                        • While api.version can be useful in general, it's sometimes nice to just declare your version. This API exposes a simple way to do that with:

                                                          Example 1

                                                          api.assertVersion(7) // major version only api.assertVersion("^7.2")

                                                          See Also

                                                          • https://babeljs.io/docs/en/next/config-files#apiassertversionrange

                                                        method caller

                                                        caller: <T extends SimpleCacheKey>(
                                                        callerCallback: (caller: TransformOptions['caller']) => T
                                                        ) => T;
                                                        • This API is used as a way to access the caller data that has been passed to Babel. Since many instances of Babel may be running in the same process with different caller values, this API is designed to automatically configure api.cache, the same way api.env() does.

                                                          The caller value is available as the first parameter of the callback function. It is best used with something like this to toggle configuration behavior based on a specific environment:

                                                          Example 1

                                                          function isBabelRegister(caller?: { name: string }) { return !!(caller && caller.name === "@babel/register") } api.caller(isBabelRegister)

                                                          See Also

                                                          • https://babeljs.io/docs/en/next/config-files#apicallercb

                                                        interface ConfigItem

                                                        interface ConfigItem {}

                                                          property dirname

                                                          dirname: string;
                                                          • The path that the options are relative to.

                                                          property file

                                                          file?:
                                                          | {
                                                          /**
                                                          * The file that the user requested, e.g. `"@babel/env"`
                                                          */
                                                          request: string;
                                                          /**
                                                          * The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
                                                          */
                                                          resolved: string;
                                                          }
                                                          | null
                                                          | undefined;
                                                          • Information about the plugin's file, if Babel knows it. *

                                                          property name

                                                          name?: string | undefined;
                                                          • The name that the user gave the plugin instance, e.g. plugins: [ ['env', {}, 'my-env'] ]

                                                          property options

                                                          options?: object | false | undefined;
                                                          • The options object passed to the plugin.

                                                          property value

                                                          value: object | ((...args: any[]) => any);
                                                          • The resolved value of the plugin.

                                                          interface CreateConfigItemOptions

                                                          interface CreateConfigItemOptions {}

                                                            property dirname

                                                            dirname?: string | undefined;

                                                              property type

                                                              type?: 'preset' | 'plugin' | undefined;

                                                                interface EnvFunction

                                                                interface EnvFunction {}
                                                                • Since NODE_ENV is a fairly common way to toggle behavior, Babel also includes an API function meant specifically for that. This API is used as a quick way to check the "envName" that Babel was loaded with, which takes NODE_ENV into account if no other overriding environment is set.

                                                                  See Also

                                                                  • https://babeljs.io/docs/en/next/config-files#apienv

                                                                call signature

                                                                (): string;
                                                                • Returns

                                                                  the current envName string

                                                                call signature

                                                                (envName: string | readonly string[]): boolean;
                                                                • Returns

                                                                  true if the envName is === any of the given strings

                                                                call signature

                                                                <T extends SimpleCacheKey>(
                                                                envCallback: (envName: NonNullable<TransformOptions['envName']>) => T
                                                                ): T;

                                                                  interface MatchPatternContext

                                                                  interface MatchPatternContext {}

                                                                    property caller

                                                                    caller: TransformCaller | undefined;

                                                                      property dirname

                                                                      dirname: string;

                                                                        property envName

                                                                        envName: string;

                                                                          interface PartialConfig

                                                                          interface PartialConfig {}

                                                                            property babelignore

                                                                            babelignore?: string | undefined;

                                                                              property babelrc

                                                                              babelrc?: string | undefined;

                                                                                property config

                                                                                config?: string | undefined;

                                                                                  property hasFilesystemConfig

                                                                                  hasFilesystemConfig: () => boolean;

                                                                                    property options

                                                                                    options: TransformOptions;

                                                                                      interface PluginObj

                                                                                      interface PluginObj<S = PluginPass> {}

                                                                                        property inherits

                                                                                        inherits?: any;

                                                                                          property name

                                                                                          name?: string | undefined;

                                                                                            property visitor

                                                                                            visitor: Visitor<S>;

                                                                                              method manipulateOptions

                                                                                              manipulateOptions: (opts: any, parserOpts: any) => void;

                                                                                                method post

                                                                                                post: (this: S, file: BabelFile) => void;

                                                                                                  method pre

                                                                                                  pre: (this: S, file: BabelFile) => void;

                                                                                                    interface PluginPass

                                                                                                    interface PluginPass {}

                                                                                                      property cwd

                                                                                                      cwd: string;

                                                                                                        property file

                                                                                                        file: BabelFile;

                                                                                                          property filename

                                                                                                          filename: string | undefined;

                                                                                                            property key

                                                                                                            key: string;

                                                                                                              property opts

                                                                                                              opts: object;

                                                                                                                method get

                                                                                                                get: (key: unknown) => any;

                                                                                                                  method set

                                                                                                                  set: (key: unknown, value: unknown) => void;

                                                                                                                    index signature

                                                                                                                    [key: string]: unknown;

                                                                                                                      interface SimpleCacheConfigurator

                                                                                                                      interface SimpleCacheConfigurator {}
                                                                                                                      • JS configs are great because they can compute a config on the fly, but the downside there is that it makes caching harder. Babel wants to avoid re-executing the config function every time a file is compiled, because then it would also need to re-execute any plugin and preset functions referenced in that config.

                                                                                                                        To avoid this, Babel expects users of config functions to tell it how to manage caching within a config file.

                                                                                                                        See Also

                                                                                                                        • https://babeljs.io/docs/en/next/config-files#apicache

                                                                                                                      method forever

                                                                                                                      forever: () => void;
                                                                                                                      • Permacache the computed config and never call the function again.

                                                                                                                      method invalidate

                                                                                                                      invalidate: <T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>) => T;
                                                                                                                      • Any time the using callback returns a value other than the one that was expected, the overall config function will be called again and all entries in the cache will be replaced with the result.

                                                                                                                        Example 1

                                                                                                                        api.cache.invalidate(() => process.env.NODE_ENV)

                                                                                                                      method never

                                                                                                                      never: () => void;
                                                                                                                      • Do not cache this config, and re-execute the function every time.

                                                                                                                      method using

                                                                                                                      using: <T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>) => T;
                                                                                                                      • Any time the using callback returns a value other than the one that was expected, the overall config function will be called again and a new entry will be added to the cache.

                                                                                                                        Example 1

                                                                                                                        api.cache.using(() => process.env.NODE_ENV)

                                                                                                                      interface TransformCaller

                                                                                                                      interface TransformCaller {}

                                                                                                                        property name

                                                                                                                        name: string;

                                                                                                                          property supportsDynamicImport

                                                                                                                          supportsDynamicImport?: boolean | undefined;

                                                                                                                            property supportsExportNamespaceFrom

                                                                                                                            supportsExportNamespaceFrom?: boolean | undefined;

                                                                                                                              property supportsStaticESM

                                                                                                                              supportsStaticESM?: boolean | undefined;

                                                                                                                                property supportsTopLevelAwait

                                                                                                                                supportsTopLevelAwait?: boolean | undefined;

                                                                                                                                  interface TransformOptions

                                                                                                                                  interface TransformOptions {}

                                                                                                                                    property assumptions

                                                                                                                                    assumptions?: { [name: string]: boolean } | null | undefined;
                                                                                                                                    • Specify which assumptions it can make about your code, to better optimize the compilation result. **NOTE**: This replaces the various loose options in plugins in favor of top-level options that can apply to multiple plugins

                                                                                                                                      See Also

                                                                                                                                      • https://babeljs.io/docs/en/assumptions

                                                                                                                                    property ast

                                                                                                                                    ast?: boolean | null | undefined;
                                                                                                                                    • Include the AST in the returned object

                                                                                                                                      Default: false

                                                                                                                                    property auxiliaryCommentAfter

                                                                                                                                    auxiliaryCommentAfter?: string | null | undefined;
                                                                                                                                    • Attach a comment after all non-user injected code

                                                                                                                                      Default: null

                                                                                                                                    property auxiliaryCommentBefore

                                                                                                                                    auxiliaryCommentBefore?: string | null | undefined;
                                                                                                                                    • Attach a comment before all non-user injected code

                                                                                                                                      Default: null

                                                                                                                                    property babelrc

                                                                                                                                    babelrc?: boolean | null | undefined;
                                                                                                                                    • Specify whether or not to use .babelrc and .babelignore files.

                                                                                                                                      Default: true

                                                                                                                                    property babelrcRoots

                                                                                                                                    babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null | undefined;
                                                                                                                                    • 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 inside of. Defaults to only searching the "root" package.

                                                                                                                                      Default: (root)

                                                                                                                                    property browserslistConfigFile

                                                                                                                                    browserslistConfigFile?: boolean | null | undefined;
                                                                                                                                    • Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.

                                                                                                                                      If a string is specified, it must represent the path of a browserslist configuration file. Relative paths are resolved relative to the configuration file which specifies this option, or to cwd when it's passed as part of the programmatic options.

                                                                                                                                      Default: true

                                                                                                                                    property browserslistEnv

                                                                                                                                    browserslistEnv?: string | null | undefined;
                                                                                                                                    • The Browserslist environment to use.

                                                                                                                                      Default: undefined

                                                                                                                                    property caller

                                                                                                                                    caller?: TransformCaller | undefined;
                                                                                                                                    • Utilities may pass a caller object to identify themselves to Babel and pass capability-related flags for use by configs, presets and plugins.

                                                                                                                                      See Also

                                                                                                                                      • https://babeljs.io/docs/en/next/options#caller

                                                                                                                                    property cloneInputAst

                                                                                                                                    cloneInputAst?: boolean | null | undefined;
                                                                                                                                    • By default babel.transformFromAst will clone the input AST to avoid mutations. Specifying cloneInputAst: false can improve parsing performance if the input AST is not used elsewhere.

                                                                                                                                      Default: true

                                                                                                                                    property code

                                                                                                                                    code?: boolean | null | undefined;
                                                                                                                                    • Enable code generation

                                                                                                                                      Default: true

                                                                                                                                    property comments

                                                                                                                                    comments?: boolean | null | undefined;
                                                                                                                                    • Output comments in generated output

                                                                                                                                      Default: true

                                                                                                                                    property compact

                                                                                                                                    compact?: boolean | 'auto' | null | undefined;
                                                                                                                                    • Do not include superfluous whitespace characters and line terminators. When set to "auto" compact is set to true on input sizes of >500KB

                                                                                                                                      Default: "auto"

                                                                                                                                    property configFile

                                                                                                                                    configFile?: string | boolean | null | undefined;
                                                                                                                                    • 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.

                                                                                                                                      Default: undefined

                                                                                                                                    property cwd

                                                                                                                                    cwd?: string | null | undefined;
                                                                                                                                    • The working directory that Babel's programmatic options are loaded relative to.

                                                                                                                                      Default: "."

                                                                                                                                    property env

                                                                                                                                    env?:
                                                                                                                                    | { [index: string]: TransformOptions | null | undefined }
                                                                                                                                    | null
                                                                                                                                    | undefined;
                                                                                                                                    • This is an object of keys that represent different environments. For example, you may have: { env: { production: { \/* specific options *\/ } } } which will use those options when the envName is production

                                                                                                                                      Default: {}

                                                                                                                                    property envName

                                                                                                                                    envName?: string | undefined;
                                                                                                                                    • Defaults to environment variable BABEL_ENV if set, or else NODE_ENV if set, or else it defaults to "development"

                                                                                                                                      Default: env vars

                                                                                                                                    property exclude

                                                                                                                                    exclude?: MatchPattern | MatchPattern[] | undefined;
                                                                                                                                    • If any of patterns match, the current configuration object is considered inactive and is ignored during config processing.

                                                                                                                                    property extends

                                                                                                                                    extends?: string | null | undefined;
                                                                                                                                    • A path to a .babelrc file to extend

                                                                                                                                      Default: null

                                                                                                                                    property filename

                                                                                                                                    filename?: string | null | undefined;
                                                                                                                                    • Filename for use in errors etc

                                                                                                                                      Default: "unknown"

                                                                                                                                    property filenameRelative

                                                                                                                                    filenameRelative?: string | null | undefined;
                                                                                                                                    • Filename relative to sourceRoot

                                                                                                                                      Default: (filename)

                                                                                                                                    property generatorOpts

                                                                                                                                    generatorOpts?: GeneratorOptions | null | undefined;
                                                                                                                                    • An object containing the options to be passed down to the babel code generator, @babel/generator

                                                                                                                                      Default: {}

                                                                                                                                    property getModuleId

                                                                                                                                    getModuleId?:
                                                                                                                                    | ((moduleName: string) => string | null | undefined)
                                                                                                                                    | null
                                                                                                                                    | undefined;
                                                                                                                                    • 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

                                                                                                                                      Default: null

                                                                                                                                    property highlightCode

                                                                                                                                    highlightCode?: boolean | null | undefined;
                                                                                                                                    • ANSI highlight syntax error code frames

                                                                                                                                      Default: true

                                                                                                                                    property ignore

                                                                                                                                    ignore?: MatchPattern[] | null | undefined;
                                                                                                                                    • Opposite to the only option. ignore is disregarded if only is specified

                                                                                                                                      Default: null

                                                                                                                                    property include

                                                                                                                                    include?: MatchPattern | MatchPattern[] | undefined;
                                                                                                                                    • This option is a synonym for "test"

                                                                                                                                    property inputSourceMap

                                                                                                                                    inputSourceMap?: InputSourceMap | null | undefined;
                                                                                                                                    • A source map object that the output source map will be based on

                                                                                                                                      Default: null

                                                                                                                                    property minified

                                                                                                                                    minified?: boolean | null | undefined;
                                                                                                                                    • Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping () from new when safe)

                                                                                                                                      Default: false

                                                                                                                                    property moduleId

                                                                                                                                    moduleId?: string | null | undefined;
                                                                                                                                    • Specify a custom name for module ids

                                                                                                                                      Default: null

                                                                                                                                    property moduleIds

                                                                                                                                    moduleIds?: boolean | null | undefined;
                                                                                                                                    • If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for common modules)

                                                                                                                                      Default: false

                                                                                                                                    property moduleRoot

                                                                                                                                    moduleRoot?: string | null | undefined;
                                                                                                                                    • Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions

                                                                                                                                      Default: (sourceRoot)

                                                                                                                                    property only

                                                                                                                                    only?: MatchPattern[] | null | undefined;
                                                                                                                                    • 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 a non-matching file it's returned verbatim

                                                                                                                                      Default: null

                                                                                                                                    property overrides

                                                                                                                                    overrides?: TransformOptions[] | undefined;
                                                                                                                                    • Allows users to provide an array of options that will be merged into the current configuration one at a time. This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply

                                                                                                                                    property parserOpts

                                                                                                                                    parserOpts?: ParserOptions | null | undefined;
                                                                                                                                    • An object containing the options to be passed down to the babel parser, @babel/parser

                                                                                                                                      Default: {}

                                                                                                                                    property plugins

                                                                                                                                    plugins?: PluginItem[] | null | undefined;
                                                                                                                                    • List of plugins to load and use

                                                                                                                                      Default: []

                                                                                                                                    property presets

                                                                                                                                    presets?: PluginItem[] | null | undefined;
                                                                                                                                    • List of presets (a set of plugins) to load and use

                                                                                                                                      Default: []

                                                                                                                                    property retainLines

                                                                                                                                    retainLines?: boolean | null | undefined;
                                                                                                                                    • 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)

                                                                                                                                      Default: false

                                                                                                                                    property root

                                                                                                                                    root?: string | null | undefined;
                                                                                                                                    • Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow .babelrc files inside of.

                                                                                                                                      Default: "."

                                                                                                                                    property rootMode

                                                                                                                                    rootMode?: 'root' | 'upward' | 'upward-optional' | undefined;
                                                                                                                                    • This option, combined with the "root" value, defines how Babel chooses its project root. The different modes define different ways that Babel can process the "root" value to get the final project root.

                                                                                                                                      See Also

                                                                                                                                      • https://babeljs.io/docs/en/next/options#rootmode

                                                                                                                                    property shouldPrintComment

                                                                                                                                    shouldPrintComment?: ((commentContents: string) => boolean) | null | undefined;
                                                                                                                                    • 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

                                                                                                                                      Default: null

                                                                                                                                    property sourceFileName

                                                                                                                                    sourceFileName?: string | null | undefined;
                                                                                                                                    • Set sources[0] on returned source map

                                                                                                                                      Default: (filenameRelative)

                                                                                                                                    property sourceMaps

                                                                                                                                    sourceMaps?: boolean | 'inline' | 'both' | null | undefined;
                                                                                                                                    • 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" then a map property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**

                                                                                                                                      Default: false

                                                                                                                                    property sourceRoot

                                                                                                                                    sourceRoot?: string | null | undefined;
                                                                                                                                    • The root from which all sources are relative

                                                                                                                                      Default: (moduleRoot)

                                                                                                                                    property sourceType

                                                                                                                                    sourceType?: 'script' | 'module' | 'unambiguous' | null | undefined;
                                                                                                                                    • 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 import or export statements. Files with ES6 imports and exports are considered "module" and are otherwise "script".

                                                                                                                                      Default: ("module")

                                                                                                                                    property targets

                                                                                                                                    targets?:
                                                                                                                                    | string
                                                                                                                                    | string[]
                                                                                                                                    | {
                                                                                                                                    esmodules?: boolean;
                                                                                                                                    node?: Omit<string, 'current'> | 'current' | true;
                                                                                                                                    safari?: Omit<string, 'tp'> | 'tp';
                                                                                                                                    browsers?: string | string[];
                                                                                                                                    android?: string;
                                                                                                                                    chrome?: string;
                                                                                                                                    deno?: string;
                                                                                                                                    edge?: string;
                                                                                                                                    electron?: string;
                                                                                                                                    firefox?: string;
                                                                                                                                    ie?: string;
                                                                                                                                    ios?: string;
                                                                                                                                    opera?: string;
                                                                                                                                    rhino?: string;
                                                                                                                                    samsung?: string;
                                                                                                                                    };
                                                                                                                                    • Describes the environments you support/target for your project. This can either be a [browserslist-compatible](https://github.com/ai/browserslist) query (with [caveats](https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries))

                                                                                                                                      Default: {}

                                                                                                                                    property test

                                                                                                                                    test?: MatchPattern | MatchPattern[] | undefined;
                                                                                                                                    • If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing.

                                                                                                                                    property wrapPluginVisitorMethod

                                                                                                                                    wrapPluginVisitorMethod?:
                                                                                                                                    | ((
                                                                                                                                    pluginAlias: string,
                                                                                                                                    visitorType: 'enter' | 'exit',
                                                                                                                                    callback: (path: NodePath, state: any) => void
                                                                                                                                    ) => (path: NodePath, state: any) => void)
                                                                                                                                    | null
                                                                                                                                    | undefined;
                                                                                                                                    • 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 wrapPluginVisitorMethod(pluginAlias, visitorType, callback).

                                                                                                                                    Type Aliases

                                                                                                                                    type ConfigFunction

                                                                                                                                    type ConfigFunction = (api: ConfigAPI) => TransformOptions;

                                                                                                                                      type FileParseCallback

                                                                                                                                      type FileParseCallback = (err: Error | null, result: ParseResult | null) => any;

                                                                                                                                        type FileResultCallback

                                                                                                                                        type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;

                                                                                                                                          type MatchPattern

                                                                                                                                          type MatchPattern =
                                                                                                                                          | string
                                                                                                                                          | RegExp
                                                                                                                                          | ((filename: string | undefined, context: MatchPatternContext) => boolean);

                                                                                                                                            type Node

                                                                                                                                            type Node = t.Node;

                                                                                                                                              type ParseResult

                                                                                                                                              type ParseResult = ReturnType<typeof import('@babel/parser').parse>;

                                                                                                                                                type PluginItem

                                                                                                                                                type PluginItem =
                                                                                                                                                | ConfigItem
                                                                                                                                                | PluginObj<any>
                                                                                                                                                | PluginTarget
                                                                                                                                                | [PluginTarget, PluginOptions]
                                                                                                                                                | [PluginTarget, PluginOptions, string | undefined];

                                                                                                                                                  type PluginOptions

                                                                                                                                                  type PluginOptions = object | undefined | false;

                                                                                                                                                    type PluginTarget

                                                                                                                                                    type PluginTarget = string | object | ((...args: any[]) => any);

                                                                                                                                                      type SimpleCacheCallback

                                                                                                                                                      type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;

                                                                                                                                                        type SimpleCacheKey

                                                                                                                                                        type SimpleCacheKey = string | boolean | number | null | undefined;

                                                                                                                                                          Package Files (1)

                                                                                                                                                          Dependencies (5)

                                                                                                                                                          Dev Dependencies (0)

                                                                                                                                                          No dev dependencies.

                                                                                                                                                          Peer Dependencies (0)

                                                                                                                                                          No peer dependencies.

                                                                                                                                                          Badge

                                                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/babel__core.

                                                                                                                                                          • Markdown
                                                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/babel__core)
                                                                                                                                                          • HTML
                                                                                                                                                            <a href="https://www.jsdocs.io/package/@types/babel__core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>