Socket
Socket
Sign inDemoInstall

@babel/helper-compilation-targets

Package Overview
Dependencies
12
Maintainers
4
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@babel/helper-compilation-targets

Helper functions on Babel compilation targets

    7.22.15
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
30,310,920
decreased by-16.44%

Weekly downloads

Package description

What is @babel/helper-compilation-targets?

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.

What are @babel/helper-compilation-targets's main functionalities?

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'
});

Other packages similar to @babel/helper-compilation-targets

Changelog

Source

v7.22.15 (2023-09-04)

:bug: Bug Fix
  • babel-core
    • #15923 Only perform config loading re-entrancy check for cjs (@nicolo-ribaudo)
:house: Internal
  • babel-cli, babel-core, babel-generator, babel-helper-builder-binary-assignment-operator-visitor, babel-helper-compilation-targets, babel-helper-create-class-features-plugin, babel-helper-create-regexp-features-plugin, babel-helper-member-expression-to-functions, babel-helper-module-imports, babel-helper-module-transforms, babel-helper-transform-fixture-test-runner, babel-helper-validator-identifier, babel-helper-validator-option, babel-helpers, babel-node, babel-parser, babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression, babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining, babel-plugin-proposal-decorators, babel-plugin-proposal-destructuring-private, babel-plugin-proposal-pipeline-operator, babel-plugin-transform-async-generator-functions, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-plugin-transform-destructuring, babel-plugin-transform-for-of, babel-plugin-transform-modules-commonjs, babel-plugin-transform-object-rest-spread, babel-plugin-transform-optional-chaining, babel-plugin-transform-parameters, babel-plugin-transform-property-mutators, babel-plugin-transform-react-jsx, babel-plugin-transform-runtime, babel-plugin-transform-typescript, babel-preset-env, babel-preset-flow, babel-preset-react, babel-preset-typescript, babel-register, babel-standalone, babel-template, babel-traverse, babel-types

Readme

Source

@babel/helper-compilation-targets

Helper functions on Babel compilation targets

See our website @babel/helper-compilation-targets for more information.

Install

Using npm:

npm install --save @babel/helper-compilation-targets

or using yarn:

yarn add @babel/helper-compilation-targets

Keywords

FAQs

Last updated on 04 Sep 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc