Socket
Socket
Sign inDemoInstall

@babel/core

Package Overview
Dependencies
0
Maintainers
5
Versions
187
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @babel/core

A placeholder package that bridges @babel/core to babel-core.


Version published
Weekly downloads
49M
decreased by-1.14%
Maintainers
5
Created
Weekly downloads
 

Package description

What is @babel/core?

@babel/core is the core library of the Babel JavaScript compiler. It is primarily used for transforming ES6+ code into backwards compatible JavaScript that can be run by older JavaScript engines. Babel is widely used for its ability to transpile new JavaScript syntax, JSX, TypeScript, and for its plugin system that allows developers to use experimental features and customize the build process.

What are @babel/core's main functionalities?

Syntax Transformation

Transforms modern JavaScript syntax into a backwards compatible version. For example, it can convert ES6 arrow functions into regular ES5 functions.

require('@babel/core').transform('code', { presets: ['@babel/preset-env'] });

Plugin/Preset Application

Applies Babel plugins or presets to the code to enable specific transformations or sets of transformations.

require('@babel/core').transform('code', { plugins: ['@babel/plugin-transform-arrow-functions'] });

Source Map Generation

Generates source maps which help in debugging the original source code after it has been transformed by Babel.

require('@babel/core').transform('code', { sourceMaps: true });

Code Generation

Generates code from an Abstract Syntax Tree (AST). This is useful when you want to transform the AST directly or manipulate it before generating code.

require('@babel/core').transformFromAst(ast, 'code', { presets: ['@babel/preset-env'] });

Other packages similar to @babel/core

Readme

Source

babel-bridge

This repo holds what we're calling a "bridge" package that is meant to ease the transition for libraries that use "@babel/core" as a peer dependency for Babel 7, but still want to allow users to opt into Babel 6.

The issue with Babel 7's transition to scopes is that if a package depends on Babel 6, they may want to add support for Babel 7 alongside. Because Babel 7 will be released as @babel/core instead of babel-core, maintainers have no way to do that transition without making a breaking change. e.g.

peerDependencies: {
  "babel-core": "6.x"
}

cannot change to

peerDependencies: {
  "@babel/core": "6.x"
}

without it being a breaking change.

Solution

To address this, we're releasing this bridge package, to allow users to do

peerDependencies: {
  "@babel/core": "6 | ^7.0.0-0"
}

then where users of this package would originally have done

npm i some-package @babel/core

to install Babel 7, they could now do

npm i some-package @babel/core@^6.0.0-0 babel-core

to install the bridge package, and install Babel 6's core to be loaded via a peed dependency.

FAQs

Last updated on 24 Aug 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc