Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@babel/helper-compilation-targets
Advanced tools
Helper functions on Babel compilation targets
Weekly downloads
Package description
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.
Changelog
v7.20.7 (2022-12-22)
babel-helper-member-expression-to-functions
, babel-helper-replace-supers
, babel-plugin-proposal-class-properties
, babel-plugin-transform-classes
babel-helpers
, babel-plugin-proposal-class-properties
, babel-plugin-transform-classes
, babel-plugin-transform-object-super
babel-parser
, babel-plugin-transform-typescript
babel-traverse
.parentPath
after rename in SwitchCase
(@nicolo-ribaudo)babel-plugin-transform-typescript
, babel-traverse
babel-plugin-transform-block-scoping
babel-plugin-proposal-async-generator-functions
, babel-preset-env
for await
with shadowed variables (@liuxingbaoyu)babel-generator
, babel-plugin-proposal-optional-chaining
(a ?? b) as T
(@liuxingbaoyu)babel-plugin-transform-react-jsx
, babel-types
JSXText
(@liuxingbaoyu)babel-core
, babel-helpers
, babel-plugin-transform-computed-properties
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
babel-helper-member-expression-to-functions
, babel-helper-replace-supers
, babel-plugin-proposal-class-properties
, babel-plugin-transform-classes
babel-generator
TSEnumMember
(@liuxingbaoyu)babel-plugin-transform-block-scoping
, babel-traverse
babel-helper-define-map
, babel-plugin-transform-property-mutators
@babel/helper-define-map
(@nicolo-ribaudo)babel-core
, babel-plugin-proposal-class-properties
, babel-plugin-transform-block-scoping
, babel-plugin-transform-classes
, babel-plugin-transform-destructuring
, babel-plugin-transform-parameters
, babel-plugin-transform-regenerator
, babel-plugin-transform-runtime
, babel-preset-env
, babel-traverse
transform-block-scoping
plugin (@nicolo-ribaudo)babel-helper-compilation-targets
getTargets
(@liuxingbaoyu)Readme
Helper functions on Babel compilation targets
See our website @babel/helper-compilation-targets for more information.
Using npm:
npm install --save @babel/helper-compilation-targets
or using yarn:
yarn add @babel/helper-compilation-targets
FAQs
Helper functions on Babel compilation targets
The npm package @babel/helper-compilation-targets receives a total of 23,032,078 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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.