Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@babel/helper-compilation-targets
Advanced tools
The @babel/helper-compilation-targets package is a helper utility used by Babel to determine which JavaScript language features need to be transformed based on the specified compilation targets, such as browsers or Node.js versions. It helps in generating the most efficient and compatible code for the specified environments.
Determining necessary plugins/presets
This feature allows you to determine which Babel plugins or presets are necessary to transform your code based on the specified target environments, such as the last two versions of all browsers or Safari versions greater than 7.
const { default: getTargets, filterItems } = require('@babel/helper-compilation-targets');
const targets = getTargets({
browsers: ['last 2 versions', 'safari > 7']
});
const plugins = filterItems(
require('@babel/preset-env/data/plugins'),
targets,
{ ignoreBrowserslistConfig: true }
);
Customizing target environments
This feature enables customization of the target environments for which you are compiling your code. For example, you can specify that you want to target environments that support ES modules or the current version of Node.js.
const { default: getTargets } = require('@babel/helper-compilation-targets');
const targets = getTargets({
esmodules: true,
node: 'current'
});
The browserslist package is used to share target browsers and Node.js versions between different front-end tools. It is similar to @babel/helper-compilation-targets in that it helps determine the set of browsers to support for tools like Autoprefixer, eslint-plugin-compat, and stylelint-unsupported-browser-features. However, it is a more general tool and not specific to Babel.
core-js-compat provides information about compatibility and required polyfills for different environments. It is similar to @babel/helper-compilation-targets in that it helps to determine which features need to be polyfilled based on the target environment. However, core-js-compat focuses on polyfills provided by core-js rather than Babel transformations.
Helper functions on Babel compilation targets
See our website @babel/helper-compilation-targets for more information.
Using npm:
npm install @babel/helper-compilation-targets
or using yarn:
yarn add @babel/helper-compilation-targets
v7.15.4 (2021-09-02)
babel-helper-create-class-features-plugin
, babel-helpers
, babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining
, babel-plugin-proposal-async-generator-functions
, babel-plugin-proposal-class-properties
, babel-plugin-proposal-private-methods
, babel-plugin-proposal-private-property-in-object
, babel-preset-env
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
"latest"
as ecmaVersion
(@fisker)babel-traverse
, babel-types
babel-types
babel-helper-compilation-targets
babel-helper-create-class-features-plugin
, babel-plugin-proposal-class-properties
, babel-plugin-proposal-private-property-in-object
babel-plugin-transform-typescript
babel-parser
static
property from class static block for TS (@sosukesuzuki)babel-core
babel-helper-create-class-features-plugin
, babel-plugin-proposal-class-static-block
, babel-plugin-proposal-private-property-in-object
, babel-plugin-syntax-class-static-block
, babel-plugin-syntax-private-property-in-object
, babel-plugin-syntax-top-level-await
, babel-plugin-transform-modules-commonjs
, babel-plugin-transform-modules-systemjs
, babel-preset-env
, babel-standalone
babel-core
, babel-generator
, babel-helper-annotate-as-pure
, babel-helper-builder-binary-assignment-operator-visitor
, babel-helper-builder-react-jsx
, babel-helper-define-map
, babel-helper-explode-assignable-expression
, babel-helper-function-name
, babel-helper-get-function-arity
, babel-helper-hoist-variables
, babel-helper-member-expression-to-functions
, babel-helper-module-imports
, babel-helper-module-transforms
, babel-helper-optimise-call-expression
, babel-helper-remap-async-to-generator
, babel-helper-replace-supers
, babel-helper-simple-access
, babel-helper-skip-transparent-expression-wrappers
, babel-helper-split-export-declaration
, babel-helper-wrap-function
, babel-helpers
, babel-preset-env
, babel-template
, babel-traverse
babel-cli
, babel-helper-define-map
, babel-helpers
, babel-node
, babel-parser
, babel-plugin-proposal-async-generator-functions
, babel-plugin-proposal-decorators
, babel-plugin-transform-classes
, babel-plugin-transform-for-of
, babel-plugin-transform-modules-systemjs
, babel-plugin-transform-parameters
, babel-traverse
, babel-types
FAQs
Helper functions on Babel compilation targets
The npm package @babel/helper-compilation-targets receives a total of 40,841,206 weekly downloads. As such, @babel/helper-compilation-targets popularity was classified as popular.
We found that @babel/helper-compilation-targets demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.