Socket
Socket
Sign inDemoInstall

babel-core

Package Overview
Dependencies
49
Maintainers
6
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-core

Babel compiler core.


Version published
Maintainers
6
Install size
5.64 MB
Created

Package description

What is babel-core?

The babel-core package is a part of Babel, a JavaScript compiler that allows developers to use next-generation JavaScript, today. It transforms ES6, ES7, and beyond into backwards compatible versions of JavaScript that can be run on older browsers and environments. It also allows for the use of JSX, Flow, TypeScript, and other features not natively supported in all environments.

What are babel-core's main functionalities?

Code Transformation

Transforms ES6/ES7 code to ES5. This is useful for compatibility with older browsers and environments.

babel.transform('code();', options);

File Transformation

Synchronously transforms the entire contents of a file. Useful for build processes.

babel.transformFileSync('filename.js', options);

AST Generation

Parses code to its Abstract Syntax Tree (AST) representation, which can be used for analysis or modification of the code.

babel.parse('code();', options);

Plugin/Preset Application

Applies Babel plugins and presets to the code, allowing for custom transformations and feature sets.

babel.transform('code();', { plugins: ['plugin-name'], presets: ['preset-name'] });

Other packages similar to babel-core

Readme

Source

babel-core

Babel compiler core.

Install

$ npm install babel-core

Usage

import * as babel from 'babel-core';

const code = `class Example {}`;
const result = babel.transform(code, { /* options */ });

result.code; // Generated code
result.map; // Sourcemap
result.ast; // AST

For more in depth documentation see: http://babeljs.io/docs/usage/api/

Keywords

FAQs

Last updated on 01 Nov 2016

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc