Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-self-defined

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-self-defined

babel-preset-self-defined

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

babel-preset-self-defined

babel-cli

npm install -g babel-cli
babel src/file.js -o build/file.js
babel src -o dist

建议本地安装Babel-cli

npm install --save-dev babel-cli

babel-register

npm install --save-dev babel-register
require('babel-register'); // 将babel注册到nodejs模块系统中,并开始编译其中require的文件。
require('./index.js');
node register.js

babel-node

node cli 的替代品,使用babel-node script.js运行代码

babel-node script.js
./node-module/.bin/babel-node script.js

babel-core

以编程的方式使用babel

npm install babel-core
const babel = require('babel-core');
babel.transform('source code string', options);
babel.transformFile('path/to/file.js', (err, result)=>{{code, map, ast}});
babel.transformFileSync('path/to/file.js');
babel.transformAst(ast, code, options);

options

babel-preset-es2015

npm install --save-dev babel-preset-es2015

babel-preset-stage-x

JavaScript 还有一些提案,正在积极通过 TC39(ECMAScript 标准背后的技术委员会)的流程成为标准的一部分。

这个流程分为 5(0-4)个阶段。 随着提案得到越多的关注就越有可能被标准采纳,于是他们就继续通过各个阶段,最终在阶段 4 被标准正式采纳。

npm install --save-dev babel-preset-stage-0
npm install --save-dev babel-preset-stage-1
npm install --save-dev babel-preset-stage-2
npm install --save-dev babel-preset-stage-3

注意 stage-4 预设是不存在的因为它就是上面的 es2015 预设。

babel-preset-react

npm install --save-deb babel-preset-react

babel-polyfill

polyfill新增的javascript api,使用core.js

babel-runtime

为了实现 ECMAScript 规范的细节,Babel 会使用“助手”方法来保持生成代码的整洁。

由于这些助手方法可能会特别长并且会被添加到每一个文件的顶部,因此你可以把它们统一移动到一个单一的“运行时(runtime)”中去。

通过安装 babel-plugin-transform-runtime 和 babel-runtime 来开始。

npm install --save-dev babel-plugin-transform-runtime
npm install --save babel-runtime

.babelrc

FAQs

Package last updated on 27 Apr 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc