Fix readmes to use @babel/ [skip ci] (#6569)
This commit is contained in:
parent
e5e7f5bf79
commit
476ec5ed8f
@ -173,7 +173,7 @@ For example, in [`babel-plugin-transform-exponentiation-operator/test`](https://
|
||||
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
|
||||
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
|
||||
- There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
|
||||
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["transform-exponentiation-operator"] }`.
|
||||
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/transform-exponentiation-operator"] }`.
|
||||
- If necessary, you can have an `options.json` with different options in each subfolder.
|
||||
|
||||
- In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix)
|
||||
@ -208,8 +208,8 @@ If you need to check for an error that is thrown you can add to the `options.jso
|
||||
```js
|
||||
// options.json example
|
||||
{
|
||||
"plugins": [["transform-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
|
||||
"throws": "transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
|
||||
"plugins": [["@babel/transform-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
|
||||
"throws": "@babel/transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
@ -37,21 +36,21 @@ npm install --save-dev @babel/plugin-codemod-optional-catch-binding
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["codemod-optional-catch-binding"]
|
||||
"plugins": ["@babel/codemod-optional-catch-binding"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins codemod-optional-catch-binding script.js
|
||||
babel --plugins @babel/codemod-optional-catch-binding script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["codemod-optional-catch-binding"]
|
||||
plugins: ["@babel/codemod-optional-catch-binding"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ And add them in this structure:
|
||||
|
||||
```js
|
||||
// es2016
|
||||
"transform-exponentiation-operator": {
|
||||
"@babel/transform-exponentiation-operator": {
|
||||
features: [
|
||||
"exponentiation (**) operator",
|
||||
],
|
||||
|
||||
@ -10,7 +10,7 @@ Without any configuration options, @babel/preset-env behaves exactly the same as
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"]
|
||||
"presets": ["@babel/env"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -21,7 +21,7 @@ This example only includes the polyfills and code transforms needed for the last
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
}
|
||||
@ -35,7 +35,7 @@ Similarly, if you're targeting Node.js instead of the browser, you can configure
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"node": "6.10"
|
||||
}
|
||||
@ -49,7 +49,7 @@ For convenience, you can use `"node": "current"` to only include the necessary p
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
@ -117,7 +117,7 @@ For example, to enable only the polyfills and plugins needed for a project targe
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
@ -167,7 +167,7 @@ The default behavior without options runs all transforms (behaves the same as [@
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"]
|
||||
"presets": ["@babel/env"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -342,7 +342,7 @@ Don't add polyfills automatically per file, or transform `import "@babel/polyfil
|
||||
```js
|
||||
module.exports = {
|
||||
presets: [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
targets: {
|
||||
chrome: 59,
|
||||
edge: 13,
|
||||
@ -419,7 +419,7 @@ export class A {}
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
}
|
||||
@ -442,7 +442,7 @@ exports.A = A;
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
@ -466,7 +466,7 @@ export class A {}
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"chrome": 52,
|
||||
"browsers": ["last 2 versions", "safari 7"]
|
||||
@ -491,7 +491,7 @@ export var A = function A() {
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
@ -514,7 +514,7 @@ exports.A = A;
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
[ "env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"safari": 10
|
||||
},
|
||||
@ -556,12 +556,12 @@ Using polyfills:
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
},
|
||||
"include": ["transform-es2015-arrow-functions", "es6.map"],
|
||||
"exclude": ["transform-regenerator", "es6.set"]
|
||||
"include": ["@babel/transform-es2015-arrow-functions", "es6.map"],
|
||||
"exclude": ["@babel/transform-regenerator", "es6.set"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
@ -35,21 +35,21 @@ npm install --save-dev @babel/plugin-check-es2015-constants
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["check-es2015-constants"]
|
||||
"plugins": ["@babel/check-es2015-constants"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins check-es2015-constants script.js
|
||||
babel --plugins @babel/check-es2015-constants script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["check-es2015-constants"]
|
||||
plugins: ["@babel/check-es2015-constants"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -14,20 +14,20 @@ npm install --save-dev @babel/plugin-external-helpers
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["external-helpers"]
|
||||
"plugins": ["@babel/external-helpers"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins external-helpers script.js
|
||||
babel --plugins @babel/external-helpers script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["external-helpers"]
|
||||
plugins: ["@babel/external-helpers"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,21 +34,21 @@ npm install --save-dev @babel/plugin-syntax-async-generators
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-async-generators"]
|
||||
"plugins": ["@babel/syntax-async-generators"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-async-generators script.js
|
||||
babel --plugins @babel/syntax-async-generators script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-async-generators"]
|
||||
plugins: ["@babel/syntax-async-generators"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-class-properties
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-class-properties"]
|
||||
"plugins": ["@babel/syntax-class-properties"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-class-properties script.js
|
||||
babel --plugins @babel/syntax-class-properties script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-class-properties"]
|
||||
plugins: ["@babel/syntax-class-properties"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-decorators
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-decorators"]
|
||||
"plugins": ["@babel/syntax-decorators"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-decorators script.js
|
||||
babel --plugins @babel/syntax-decorators script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-decorators"]
|
||||
plugins: ["@babel/syntax-decorators"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-do-expressions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-do-expressions"]
|
||||
"plugins": ["@babel/syntax-do-expressions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-do-expressions script.js
|
||||
babel --plugins @babel/syntax-do-expressions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-do-expressions"]
|
||||
plugins: ["@babel/syntax-do-expressions"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-dynamic-import
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-dynamic-import"]
|
||||
"plugins": ["@babel/syntax-dynamic-import"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-dynamic-import script.js
|
||||
babel --plugins @babel/syntax-dynamic-import script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-dynamic-import"]
|
||||
plugins: ["@babel/syntax-dynamic-import"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-export-extensions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-export-extensions"]
|
||||
"plugins": ["@babel/syntax-export-extensions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-export-extensions script.js
|
||||
babel --plugins @babel/syntax-export-extensions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-export-extensions"]
|
||||
plugins: ["@babel/syntax-export-extensions"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-flow
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-flow"]
|
||||
"plugins": ["@babel/syntax-flow"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-flow script.js
|
||||
babel --plugins @babel/syntax-flow script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-flow"]
|
||||
plugins: ["@babel/syntax-flow"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-function-bind
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-function-bind"]
|
||||
"plugins": ["@babel/syntax-function-bind"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-function-bind script.js
|
||||
babel --plugins @babel/syntax-function-bind script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-function-bind"]
|
||||
plugins: ["@babel/syntax-function-bind"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-function-sent
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-function-sent"]
|
||||
"plugins": ["@babel/syntax-function-sent"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-function-sent script.js
|
||||
babel --plugins @babel/syntax-function-sent script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-function-sent"]
|
||||
plugins: ["@babel/syntax-function-sent"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-jsx
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-jsx"]
|
||||
"plugins": ["@babel/syntax-jsx"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-jsx script.js
|
||||
babel --plugins @babel/syntax-jsx script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-jsx"]
|
||||
plugins: ["@babel/syntax-jsx"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-nullish-coalescing-operator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-nullish-coalescing-operator"]
|
||||
"plugins": ["@babel/syntax-nullish-coalescing-operator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-nullish-coalescing-operator script.js
|
||||
babel --plugins @babel/syntax-nullish-coalescing-operator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-nullish-coalescing-operator"]
|
||||
plugins: ["@babel/syntax-nullish-coalescing-operator"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -17,20 +17,20 @@ npm install --save-dev @babel/plugin-syntax-numeric-separator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-numeric-separator"]
|
||||
"plugins": ["@babel/syntax-numeric-separator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-numeric-separator script.js
|
||||
babel --plugins @babel/syntax-numeric-separator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-numeric-separator"]
|
||||
plugins: ["@babel/syntax-numeric-separator"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-object-rest-spread
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-object-rest-spread"]
|
||||
"plugins": ["@babel/syntax-object-rest-spread"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-object-rest-spread script.js
|
||||
babel --plugins @babel/syntax-object-rest-spread script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-object-rest-spread"]
|
||||
plugins: ["@babel/syntax-object-rest-spread"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -29,21 +29,21 @@ npm install --save-dev @babel/plugin-syntax-optional-catch-binding
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-optional-catch-binding"]
|
||||
"plugins": ["@babel/syntax-optional-catch-binding"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-optional-catch-binding script.js
|
||||
babel --plugins @babel/syntax-optional-catch-binding script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-optional-catch-binding"]
|
||||
plugins: ["@babel/syntax-optional-catch-binding"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/plugin-syntax-optional-chaining
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-optional-chaining"]
|
||||
"plugins": ["@babel/syntax-optional-chaining"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-optional-chaining script.js
|
||||
babel --plugins @babel/syntax-optional-chaining script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-optional-chaining"]
|
||||
plugins: ["@babel/syntax-optional-chaining"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ $ npm install @babel/plugin-syntax-pipeline-operator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-pipeline-operator"]
|
||||
"plugins": ["@babel/syntax-pipeline-operator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins syntax-pipeline-operator script.js
|
||||
$ babel --plugins @babel/syntax-pipeline-operator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-pipeline-operator"]
|
||||
plugins: ["@babel/syntax-pipeline-operator"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -23,20 +23,20 @@ npm install --save-dev @babel/plugin-syntax-throw-expressions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-throw-expressions"]
|
||||
"plugins": ["@babel/syntax-throw-expressions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-throw-expressions script.js
|
||||
babel --plugins @babel/syntax-throw-expressions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-throw-expressions"]
|
||||
plugins: ["@babel/syntax-throw-expressions"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -14,20 +14,20 @@ npm install --save-dev @babel/plugin-syntax-typescript
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["syntax-typescript"]
|
||||
"plugins": ["@babel/syntax-typescript"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins syntax-typescript script.js
|
||||
babel --plugins @babel/syntax-typescript script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["syntax-typescript"]
|
||||
plugins: ["@babel/syntax-typescript"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -84,21 +84,21 @@ npm install --save-dev @babel/plugin-transform-async-generator-functions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-async-generator-functions"]
|
||||
"plugins": ["@babel/transform-async-generator-functions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-async-generator-functions script.js
|
||||
babel --plugins @babel/transform-async-generator-functions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-async-generator-functions"]
|
||||
plugins: ["@babel/transform-async-generator-functions"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -37,21 +37,21 @@ npm install --save-dev @babel/plugin-transform-async-to-generator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-async-to-generator"]
|
||||
"plugins": ["@babel/transform-async-to-generator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-async-to-generator script.js
|
||||
babel --plugins @babel/transform-async-to-generator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-async-to-generator"]
|
||||
plugins: ["@babel/transform-async-to-generator"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-async-to-module-method"]
|
||||
"plugins": ["@babel/transform-async-to-module-method"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -47,7 +47,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-async-to-module-method", {
|
||||
["@babel/transform-async-to-module-method", {
|
||||
"module": "bluebird",
|
||||
"method": "coroutine"
|
||||
}]
|
||||
@ -58,13 +58,13 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-async-to-module-method script.js
|
||||
babel --plugins @babel/transform-async-to-module-method script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-async-to-module-method"]
|
||||
plugins: ["@babel/transform-async-to-module-method"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-class-properties"]
|
||||
"plugins": ["@babel/transform-class-properties"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -59,7 +59,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-class-properties", { "loose": true }]
|
||||
["@babel/transform-class-properties", { "loose": true }]
|
||||
]
|
||||
}
|
||||
```
|
||||
@ -67,14 +67,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-class-properties script.js
|
||||
babel --plugins @babel/transform-class-properties script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-class-properties"]
|
||||
plugins: ["@babel/transform-class-properties"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ Add the following line to your .babelrc file:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-decorators"]
|
||||
"plugins": ["@babel/transform-decorators"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -73,8 +73,8 @@ Wrong:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"transform-class-properties",
|
||||
"transform-decorators"
|
||||
"@babel/transform-class-properties",
|
||||
"@babel/transform-decorators"
|
||||
]
|
||||
}
|
||||
```
|
||||
@ -84,8 +84,8 @@ Right:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"transform-decorators",
|
||||
["transform-class-properties", { "loose" : true }]
|
||||
"@babel/transform-decorators",
|
||||
["@babel/transform-class-properties", { "loose" : true }]
|
||||
]
|
||||
}
|
||||
```
|
||||
@ -93,14 +93,14 @@ Right:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-decorators script.js
|
||||
babel --plugins @babel/transform-decorators script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-decorators"]
|
||||
plugins: ["@babel/transform-decorators"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -94,21 +94,21 @@ npm install --save-dev @babel/plugin-transform-do-expressions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-do-expressions"]
|
||||
"plugins": ["@babel/transform-do-expressions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-do-expressions script.js
|
||||
babel --plugins @babel/transform-do-expressions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-do-expressions"]
|
||||
plugins: ["@babel/transform-do-expressions"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-arrow-functions"]
|
||||
"plugins": ["@babel/transform-es2015-arrow-functions"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -76,7 +76,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-arrow-functions", { "spec": true }]
|
||||
["@babel/transform-es2015-arrow-functions", { "spec": true }]
|
||||
]
|
||||
}
|
||||
```
|
||||
@ -84,14 +84,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-arrow-functions script.js
|
||||
babel --plugins @babel/transform-es2015-arrow-functions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-arrow-functions"]
|
||||
plugins: ["@babel/transform-es2015-arrow-functions"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -42,20 +42,20 @@ npm install --save-dev @babel/plugin-transform-es2015-block-scoped-functions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-block-scoped-functions"]
|
||||
"plugins": ["@babel/transform-es2015-block-scoped-functions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-block-scoped-functions script.js
|
||||
babel --plugins @babel/transform-es2015-block-scoped-functions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-block-scoped-functions"]
|
||||
plugins: ["@babel/transform-es2015-block-scoped-functions"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -40,7 +40,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-block-scoping"]
|
||||
"plugins": ["@babel/transform-es2015-block-scoping"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -49,7 +49,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-block-scoping", {
|
||||
["@babel/transform-es2015-block-scoping", {
|
||||
"throwIfClosureRequired": true
|
||||
}]
|
||||
]
|
||||
@ -59,14 +59,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-block-scoping script.js
|
||||
babel --plugins @babel/transform-es2015-block-scoping script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-block-scoping"]
|
||||
plugins: ["@babel/transform-es2015-block-scoping"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -59,13 +59,13 @@ npm install --save-dev @babel/plugin-transform-es2015-classes
|
||||
```js
|
||||
// without options
|
||||
{
|
||||
"plugins": ["transform-es2015-classes"]
|
||||
"plugins": ["@babel/transform-es2015-classes"]
|
||||
}
|
||||
|
||||
// with options
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-classes", {
|
||||
["@babel/transform-es2015-classes", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
@ -75,14 +75,14 @@ npm install --save-dev @babel/plugin-transform-es2015-classes
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-classes script.js
|
||||
babel --plugins @babel/transform-es2015-classes script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-classes"]
|
||||
plugins: ["@babel/transform-es2015-classes"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-computed-properties"]
|
||||
"plugins": ["@babel/transform-es2015-computed-properties"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -70,7 +70,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-computed-properties", {
|
||||
["@babel/transform-es2015-computed-properties", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
@ -80,14 +80,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-computed-properties script.js
|
||||
babel --plugins @babel/transform-es2015-computed-properties script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-computed-properties"]
|
||||
plugins: ["@babel/transform-es2015-computed-properties"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/plugin-transform-es2015-destructuring
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-destructuring"]
|
||||
"plugins": ["@babel/transform-es2015-destructuring"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-destructuring script.js
|
||||
babel --plugins @babel/transform-es2015-destructuring script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-destructuring"]
|
||||
plugins: ["@babel/transform-es2015-destructuring"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -42,20 +42,20 @@ npm install --save-dev @babel/plugin-transform-es2015-duplicate-keys
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-duplicate-keys"]
|
||||
"plugins": ["@babel/transform-es2015-duplicate-keys"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-duplicate-keys script.js
|
||||
babel --plugins @babel/transform-es2015-duplicate-keys script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-duplicate-keys"]
|
||||
plugins: ["@babel/transform-es2015-duplicate-keys"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ Without options:
|
||||
|
||||
```js
|
||||
{
|
||||
"plugins": ["transform-es2015-for-of"]
|
||||
"plugins": ["@babel/transform-es2015-for-of"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -62,7 +62,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-for-of", {
|
||||
["@babel/transform-es2015-for-of", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
@ -72,14 +72,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-for-of script.js
|
||||
babel --plugins @babel/transform-es2015-for-of script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-for-of"]
|
||||
plugins: ["@babel/transform-es2015-for-of"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -32,20 +32,20 @@ npm install --save-dev @babel/plugin-transform-es2015-function-name
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-function-name"]
|
||||
"plugins": ["@babel/transform-es2015-function-name"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-function-name script.js
|
||||
babel --plugins @babel/transform-es2015-function-name script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-function-name"]
|
||||
plugins: ["@babel/transform-es2015-function-name"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -14,20 +14,20 @@ npm install --save-dev @babel/plugin-transform-es2015-instanceof
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-instanceof"]
|
||||
"plugins": ["@babel/transform-es2015-instanceof"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-instanceof script.js
|
||||
babel --plugins @babel/transform-es2015-instanceof script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-instanceof"]
|
||||
plugins: ["@babel/transform-es2015-instanceof"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/plugin-transform-es2015-literals
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-literals"]
|
||||
"plugins": ["@babel/transform-es2015-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-literals script.js
|
||||
babel --plugins @babel/transform-es2015-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-literals"]
|
||||
plugins: ["@babel/transform-es2015-literals"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -38,21 +38,21 @@ npm install --save-dev @babel/plugin-transform-es2015-modules-amd
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-modules-amd"]
|
||||
"plugins": ["@babel/transform-es2015-modules-amd"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-modules-amd script.js
|
||||
babel --plugins @babel/transform-es2015-modules-amd script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-modules-amd"]
|
||||
plugins: ["@babel/transform-es2015-modules-amd"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -35,13 +35,13 @@ npm install --save-dev @babel/plugin-transform-es2015-modules-commonjs
|
||||
```js
|
||||
// without options
|
||||
{
|
||||
"plugins": ["transform-es2015-modules-commonjs"]
|
||||
"plugins": ["@babel/transform-es2015-modules-commonjs"]
|
||||
}
|
||||
|
||||
// with options
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-modules-commonjs", {
|
||||
["@babel/transform-es2015-modules-commonjs", {
|
||||
"allowTopLevelThis": true
|
||||
}]
|
||||
]
|
||||
@ -51,14 +51,14 @@ npm install --save-dev @babel/plugin-transform-es2015-modules-commonjs
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-modules-commonjs script.js
|
||||
babel --plugins @babel/transform-es2015-modules-commonjs script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-modules-commonjs"]
|
||||
plugins: ["@babel/transform-es2015-modules-commonjs"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-modules-systemjs"]
|
||||
"plugins": ["@babel/transform-es2015-modules-systemjs"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-modules-systemjs", {
|
||||
["@babel/transform-es2015-modules-systemjs", {
|
||||
// outputs SystemJS.register(...)
|
||||
"systemGlobal": "SystemJS"
|
||||
}]
|
||||
@ -61,13 +61,13 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-modules-systemjs script.js
|
||||
babel --plugins @babel/transform-es2015-modules-systemjs script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-modules-systemjs"]
|
||||
plugins: ["@babel/transform-es2015-modules-systemjs"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ npm install --save-dev @babel/plugin-transform-es2015-modules-umd
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-modules-umd"]
|
||||
"plugins": ["@babel/transform-es2015-modules-umd"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -61,7 +61,7 @@ as `global.Promise` rather than `global.es6Promise`. This can be accommodated by
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-modules-umd", {
|
||||
["@babel/transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"es6-promise": "Promise"
|
||||
}
|
||||
@ -178,7 +178,7 @@ Finally, with the plugin options set to:
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
["transform-es2015-modules-umd", {
|
||||
["@babel/transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"my/custom/module/name": "My.Custom.Module.Name"
|
||||
},
|
||||
@ -202,13 +202,13 @@ global.My.Custom.Module.Name = mod.exports;
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-modules-umd script.js
|
||||
babel --plugins @babel/transform-es2015-modules-umd script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-modules-umd"]
|
||||
plugins: ["@babel/transform-es2015-modules-umd"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -54,20 +54,20 @@ npm install --save-dev @babel/plugin-transform-es2015-object-super
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-object-super"]
|
||||
"plugins": ["@babel/transform-es2015-object-super"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-object-super script.js
|
||||
babel --plugins @babel/transform-es2015-object-super script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-object-super"]
|
||||
plugins: ["@babel/transform-es2015-object-super"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -55,21 +55,21 @@ not supported in your environment then you'll need the
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-parameters"]
|
||||
"plugins": ["@babel/transform-es2015-parameters"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-parameters script.js
|
||||
babel --plugins @babel/transform-es2015-parameters script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-parameters"]
|
||||
plugins: ["@babel/transform-es2015-parameters"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -50,20 +50,20 @@ npm install --save-dev @babel/plugin-transform-es2015-shorthand-properties
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-shorthand-properties"]
|
||||
"plugins": ["@babel/transform-es2015-shorthand-properties"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-shorthand-properties script.js
|
||||
babel --plugins @babel/transform-es2015-shorthand-properties script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-shorthand-properties"]
|
||||
plugins: ["@babel/transform-es2015-shorthand-properties"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,7 +34,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-spread"]
|
||||
"plugins": ["@babel/transform-es2015-spread"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -43,7 +43,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-spread", {
|
||||
["@babel/transform-es2015-spread", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
@ -53,14 +53,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-spread script.js
|
||||
babel --plugins @babel/transform-es2015-spread script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-spread"]
|
||||
plugins: ["@babel/transform-es2015-spread"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -30,20 +30,20 @@ npm install --save-dev @babel/plugin-transform-es2015-sticky-regex
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-sticky-regex"]
|
||||
"plugins": ["@babel/transform-es2015-sticky-regex"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-sticky-regex script.js
|
||||
babel --plugins @babel/transform-es2015-sticky-regex script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-sticky-regex"]
|
||||
plugins: ["@babel/transform-es2015-sticky-regex"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -32,7 +32,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-template-literals"]
|
||||
"plugins": ["@babel/transform-es2015-template-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -41,7 +41,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-es2015-template-literals", {
|
||||
["@babel/transform-es2015-template-literals", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
@ -51,14 +51,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-template-literals script.js
|
||||
babel --plugins @babel/transform-es2015-template-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-template-literals"]
|
||||
plugins: ["@babel/transform-es2015-template-literals"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/plugin-transform-es2015-typeof-symbol
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-typeof-symbol"]
|
||||
"plugins": ["@babel/transform-es2015-typeof-symbol"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-typeof-symbol script.js
|
||||
babel --plugins @babel/transform-es2015-typeof-symbol script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-typeof-symbol"]
|
||||
plugins: ["@babel/transform-es2015-typeof-symbol"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -32,20 +32,20 @@ npm install --save-dev @babel/plugin-transform-es2015-unicode-regex
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es2015-unicode-regex"]
|
||||
"plugins": ["@babel/transform-es2015-unicode-regex"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es2015-unicode-regex script.js
|
||||
babel --plugins @babel/transform-es2015-unicode-regex script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es2015-unicode-regex"]
|
||||
plugins: ["@babel/transform-es2015-unicode-regex"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -30,20 +30,20 @@ npm install --save-dev @babel/plugin-transform-es3-member-expression-literals
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es3-member-expression-literals"]
|
||||
"plugins": ["@babel/transform-es3-member-expression-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es3-member-expression-literals script.js
|
||||
babel --plugins @babel/transform-es3-member-expression-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es3-member-expression-literals"]
|
||||
plugins: ["@babel/transform-es3-member-expression-literals"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/plugin-transform-es3-property-literals
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es3-property-literals"]
|
||||
"plugins": ["@babel/transform-es3-property-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es3-property-literals script.js
|
||||
babel --plugins @babel/transform-es3-property-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es3-property-literals"]
|
||||
plugins: ["@babel/transform-es3-property-literals"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -42,20 +42,20 @@ npm install --save-dev @babel/plugin-transform-es5-property-mutators
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-es5-property-mutators"]
|
||||
"plugins": ["@babel/transform-es5-property-mutators"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-es5-property-mutators script.js
|
||||
babel --plugins @babel/transform-es5-property-mutators script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-es5-property-mutators"]
|
||||
plugins: ["@babel/transform-es5-property-mutators"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -30,20 +30,20 @@ npm install --save-dev @babel/plugin-transform-eval
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-eval"]
|
||||
"plugins": ["@babel/transform-eval"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-eval script.js
|
||||
babel --plugins @babel/transform-eval script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-eval"]
|
||||
plugins: ["@babel/transform-eval"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -39,21 +39,21 @@ npm install --save-dev @babel/plugin-transform-exponentiation-operator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-exponentiation-operator"]
|
||||
"plugins": ["@babel/transform-exponentiation-operator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-exponentiation-operator script.js
|
||||
babel --plugins @babel/transform-exponentiation-operator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-exponentiation-operator"]
|
||||
plugins: ["@babel/transform-exponentiation-operator"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -22,21 +22,21 @@ npm install --save-dev @babel/plugin-transform-export-default
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-export-default"]
|
||||
"plugins": ["@babel/transform-export-default"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-export-default script.js
|
||||
babel --plugins @babel/transform-export-default script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-export-default"]
|
||||
plugins: ["@babel/transform-export-default"]
|
||||
});
|
||||
```
|
||||
## References
|
||||
|
||||
@ -22,21 +22,21 @@ npm install --save-dev @babel/plugin-transform-export-namespace
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-export-namespace"]
|
||||
"plugins": ["@babel/transform-export-namespace"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-export-namespace script.js
|
||||
babel --plugins @babel/transform-export-namespace script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-export-namespace"]
|
||||
plugins: ["@babel/transform-export-namespace"]
|
||||
});
|
||||
```
|
||||
## References
|
||||
|
||||
@ -52,20 +52,20 @@ npm install --save-dev @babel/plugin-transform-flow-comments
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-flow-comments"]
|
||||
"plugins": ["@babel/transform-flow-comments"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-flow-comments script.js
|
||||
babel --plugins @babel/transform-flow-comments script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-flow-comments"]
|
||||
plugins: ["@babel/transform-flow-comments"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -30,21 +30,21 @@ npm install --save-dev @babel/plugin-transform-flow-strip-types
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-flow-strip-types"]
|
||||
"plugins": ["@babel/transform-flow-strip-types"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-flow-strip-types script.js
|
||||
babel --plugins @babel/transform-flow-strip-types script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-flow-strip-types"]
|
||||
plugins: ["@babel/transform-flow-strip-types"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -97,21 +97,21 @@ npm install --save-dev @babel/plugin-transform-function-bind
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-function-bind"]
|
||||
"plugins": ["@babel/transform-function-bind"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-function-bind script.js
|
||||
babel --plugins @babel/transform-function-bind script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-function-bind"]
|
||||
plugins: ["@babel/transform-function-bind"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -43,21 +43,21 @@ npm install --save-dev @babel/plugin-transform-function-sent
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-function-sent"]
|
||||
"plugins": ["@babel/transform-function-sent"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-function-sent script.js
|
||||
babel --plugins @babel/transform-function-sent script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-function-sent"]
|
||||
plugins: ["@babel/transform-function-sent"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -38,20 +38,20 @@ npm install --save-dev @babel/plugin-transform-jscript
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-jscript"]
|
||||
"plugins": ["@babel/transform-jscript"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-jscript script.js
|
||||
babel --plugins @babel/transform-jscript script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-jscript"]
|
||||
plugins: ["@babel/transform-jscript"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -85,20 +85,20 @@ npm install --save-dev @babel/plugin-transform-new-target
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-new-target"]
|
||||
"plugins": ["@babel/transform-new-target"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-new-target script.js
|
||||
babel --plugins @babel/transform-new-target script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-new-target"]
|
||||
plugins: ["@babel/transform-new-target"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -35,21 +35,21 @@ npm install --save-dev @babel/plugin-transform-nullish-coalescing-operator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-nullish-coalescing-operator"]
|
||||
"plugins": ["@babel/transform-nullish-coalescing-operator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-nullish-coalescing-operator script.js
|
||||
babel --plugins @babel/transform-nullish-coalescing-operator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-nullish-coalescing-operator"]
|
||||
plugins: ["@babel/transform-nullish-coalescing-operator"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -71,27 +71,27 @@ npm install --save-dev @babel/plugin-transform-numeric-separator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-numeric-separator"]
|
||||
"plugins": ["@babel/transform-numeric-separator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-numeric-separator script.js
|
||||
babel --plugins @babel/transform-numeric-separator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-numeric-separator"]
|
||||
plugins: ["@babel/transform-numeric-separator"]
|
||||
});
|
||||
```
|
||||
|
||||
## Additional Information
|
||||
|
||||
If you need to further compile ES2015 Decimal, Binary, Hex and Octal number representations to their pre-ES2015 numeric literal form, add the [`"transform-es2015-literals"`](http://babeljs.io/docs/plugins/transform-es2015-literals/) plugin:
|
||||
If you need to further compile ES2015 Decimal, Binary, Hex and Octal number representations to their pre-ES2015 numeric literal form, add the [`"@babel/transform-es2015-literals"`](http://babeljs.io/docs/plugins/transform-es2015-literals/) plugin:
|
||||
|
||||
> `transform-es2015-literals` is already included in [@babel/preset-env](https://github.com/babel/babel/tree/master/experimental/babel-preset-env) and @babel/preset-es2015.
|
||||
|
||||
@ -101,11 +101,11 @@ If you need to further compile ES2015 Decimal, Binary, Hex and Octal number repr
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"],
|
||||
"plugins": ["transform-numeric-separator"]
|
||||
"presets": ["@babel/env"],
|
||||
"plugins": ["@babel/transform-numeric-separator"]
|
||||
}
|
||||
{
|
||||
"plugins": ["transform-numeric-separator", "transform-es2015-literals"]
|
||||
"plugins": ["@babel/transform-numeric-separator", "@babel/transform-es2015-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -41,20 +41,20 @@ npm install --save-dev @babel/plugin-transform-object-assign
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-object-assign"]
|
||||
"plugins": ["@babel/transform-object-assign"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-object-assign script.js
|
||||
babel --plugins @babel/transform-object-assign script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-object-assign"]
|
||||
plugins: ["@babel/transform-object-assign"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,21 +34,21 @@ npm install --save-dev @babel/plugin-transform-object-rest-spread
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-object-rest-spread"]
|
||||
"plugins": ["@babel/transform-object-rest-spread"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-object-rest-spread script.js
|
||||
babel --plugins @babel/transform-object-rest-spread script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-object-rest-spread"]
|
||||
plugins: ["@babel/transform-object-rest-spread"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -65,7 +65,7 @@ By default, this plugin uses Babel's `extends` helper which polyfills `Object.as
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-object-rest-spread", { "useBuiltIns": true }]
|
||||
["@babel/transform-object-rest-spread", { "useBuiltIns": true }]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/plugin-transform-object-set-prototype-of-to-assign
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-object-set-prototype-of-to-assign"]
|
||||
"plugins": ["@babel/transform-object-set-prototype-of-to-assign"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-object-set-prototype-of-to-assign script.js
|
||||
babel --plugins @babel/transform-object-set-prototype-of-to-assign script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-object-set-prototype-of-to-assign"]
|
||||
plugins: ["@babel/transform-object-set-prototype-of-to-assign"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -38,21 +38,21 @@ npm install --save-dev @babel/plugin-transform-optional-catch-binding
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-optional-catch-binding"]
|
||||
"plugins": ["@babel/transform-optional-catch-binding"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-optional-catch-binding script.js
|
||||
babel --plugins @babel/transform-optional-catch-binding script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-optional-catch-binding"]
|
||||
plugins: ["@babel/transform-optional-catch-binding"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -95,21 +95,21 @@ npm install --save-dev @babel/plugin-transform-optional-chaining
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-optional-chaining"]
|
||||
"plugins": ["@babel/transform-optional-chaining"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-optional-chaining script.js
|
||||
babel --plugins @babel/transform-optional-chaining script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-optional-chaining"]
|
||||
plugins: ["@babel/transform-optional-chaining"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -16,20 +16,20 @@ $ npm install @babel/plugin-transform-pipeline-operator
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-pipeline-operator"]
|
||||
"plugins": ["@babel/transform-pipeline-operator"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-pipeline-operator script.js
|
||||
$ babel --plugins @babel/transform-pipeline-operator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-pipeline-operator"]
|
||||
plugins: ["@babel/transform-pipeline-operator"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -57,20 +57,20 @@ npm install --save-dev @babel/plugin-transform-proto-to-assign
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-proto-to-assign"]
|
||||
"plugins": ["@babel/transform-proto-to-assign"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-proto-to-assign script.js
|
||||
babel --plugins @babel/transform-proto-to-assign script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-proto-to-assign"]
|
||||
plugins: ["@babel/transform-proto-to-assign"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -62,7 +62,7 @@ npm install --save-dev @babel/plugin-transform-react-constant-elements
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-constant-elements"]
|
||||
"plugins": ["@babel/transform-react-constant-elements"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -80,7 +80,7 @@ This will skip the `Mutable Properties` deopt.
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-constant-elements", {"allowMutablePropsOnTags": ["FormattedMessage"]}],
|
||||
["@babel/transform-react-constant-elements", {"allowMutablePropsOnTags": ["FormattedMessage"]}],
|
||||
]
|
||||
}
|
||||
|
||||
@ -89,14 +89,14 @@ This will skip the `Mutable Properties` deopt.
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-constant-elements script.js
|
||||
babel --plugins @babel/transform-react-constant-elements script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-constant-elements"]
|
||||
plugins: ["@babel/transform-react-constant-elements"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -36,20 +36,20 @@ npm install --save-dev @babel/plugin-transform-react-display-name
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-display-name"]
|
||||
"plugins": ["@babel/transform-react-display-name"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-display-name script.js
|
||||
babel --plugins @babel/transform-react-display-name script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-display-name"]
|
||||
plugins: ["@babel/transform-react-display-name"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -59,21 +59,21 @@ npm install --save-dev @babel/plugin-transform-react-inline-elements
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-inline-elements"]
|
||||
"plugins": ["@babel/transform-react-inline-elements"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-inline-elements script.js
|
||||
babel --plugins @babel/transform-react-inline-elements script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-inline-elements"]
|
||||
plugins: ["@babel/transform-react-inline-elements"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -36,20 +36,20 @@ npm install --save-dev @babel/plugin-transform-react-jsx-compat
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-jsx-compat"]
|
||||
"plugins": ["@babel/transform-react-jsx-compat"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-jsx-compat script.js
|
||||
babel --plugins @babel/transform-react-jsx-compat script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-jsx-compat"]
|
||||
plugins: ["@babel/transform-react-jsx-compat"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -30,20 +30,20 @@ npm install --save-dev @babel/plugin-transform-react-jsx-self
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-jsx-self"]
|
||||
"plugins": ["@babel/transform-react-jsx-self"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-jsx-self script.js
|
||||
babel --plugins @babel/transform-react-jsx-self script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-jsx-self"]
|
||||
plugins: ["@babel/transform-react-jsx-self"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -30,20 +30,20 @@ npm install --save-dev @babel/plugin-transform-react-jsx-source
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-jsx-source"]
|
||||
"plugins": ["@babel/transform-react-jsx-source"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-jsx-source script.js
|
||||
babel --plugins @babel/transform-react-jsx-source script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-jsx-source"]
|
||||
plugins: ["@babel/transform-react-jsx-source"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -68,7 +68,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-react-jsx"]
|
||||
"plugins": ["@babel/transform-react-jsx"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -77,7 +77,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", {
|
||||
["@babel/transform-react-jsx", {
|
||||
"pragma": "dom" // default pragma is React.createElement
|
||||
}]
|
||||
]
|
||||
@ -87,14 +87,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-react-jsx script.js
|
||||
babel --plugins @babel/transform-react-jsx script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-react-jsx"]
|
||||
plugins: ["@babel/transform-react-jsx"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-regenerator"]
|
||||
"plugins": ["@babel/transform-regenerator"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -63,7 +63,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-regenerator", {
|
||||
["@babel/transform-regenerator", {
|
||||
"asyncGenerators": false,
|
||||
"generators": false,
|
||||
"async": false
|
||||
@ -75,13 +75,13 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-regenerator script.js
|
||||
babel --plugins @babel/transform-regenerator script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-regenerator"]
|
||||
plugins: ["@babel/transform-regenerator"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -44,7 +44,7 @@ Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-runtime"]
|
||||
"plugins": ["@babel/transform-runtime"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ With options:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
["transform-runtime", {
|
||||
["@babel/transform-runtime", {
|
||||
"helpers": false,
|
||||
"polyfill": false,
|
||||
"regenerator": true,
|
||||
@ -66,14 +66,14 @@ With options:
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-runtime script.js
|
||||
babel --plugins @babel/transform-runtime script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-runtime"]
|
||||
plugins: ["@babel/transform-runtime"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ npm install --save-dev @babel/plugin-transform-strict-mode
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-strict-mode"]
|
||||
"plugins": ["@babel/transform-strict-mode"]
|
||||
}
|
||||
```
|
||||
|
||||
@ -45,13 +45,13 @@ npm install --save-dev @babel/plugin-transform-strict-mode
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-strict-mode script.js
|
||||
babel --plugins @babel/transform-strict-mode script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-strict-mode"]
|
||||
plugins: ["@babel/transform-strict-mode"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -24,21 +24,21 @@ npm install --save-dev @babel/plugin-transform-throw-expressions
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-throw-expressions"]
|
||||
"plugins": ["@babel/transform-throw-expressions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-throw-expressions script.js
|
||||
babel --plugins @babel/transform-throw-expressions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-throw-expressions"]
|
||||
plugins: ["@babel/transform-throw-expressions"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -35,20 +35,20 @@ npm install --save-dev @babel/plugin-transform-typescript
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-typescript"]
|
||||
"plugins": ["@babel/transform-typescript"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-typescript script.js
|
||||
babel --plugins @babel/transform-typescript script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-typescript"]
|
||||
plugins: ["@babel/transform-typescript"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -9,7 +9,7 @@ Compile [Unicode property escapes](https://github.com/mathiasbynens/regexpu-core
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install @babel/plugin-transform-unicode-property-regex
|
||||
npm install @babel/plugin-transform-unicode-property-regex
|
||||
```
|
||||
|
||||
## Usage
|
||||
@ -20,30 +20,30 @@ $ npm install @babel/plugin-transform-unicode-property-regex
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-unicode-property-regex"]
|
||||
"plugins": ["@babel/transform-unicode-property-regex"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-unicode-property-regex script.js
|
||||
babel --plugins @babel/@babel/transform-unicode-property-regex script.js
|
||||
```
|
||||
|
||||
### Via Node.js API
|
||||
|
||||
```js
|
||||
require('@babel/core').transform(code, {
|
||||
'plugins': ['transform-unicode-property-regex']
|
||||
require("@babel/core").transform(code, {
|
||||
"plugins": ["@babel/transform-unicode-property-regex"]
|
||||
});
|
||||
```
|
||||
|
||||
To transpile to ES6/ES2015:
|
||||
|
||||
```js
|
||||
require('@babel/core').transform(code, {
|
||||
'plugins': [
|
||||
['transform-unicode-property-regex', { 'useUnicodeFlag': true }]
|
||||
require("@babel/core").transform(code, {
|
||||
"plugins": [
|
||||
["@babel/transform-unicode-property-regex", { "useUnicodeFlag": true }]
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,21 +16,21 @@ npm install --save-dev @babel/preset-es2015
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["es2015"]
|
||||
"presets": ["@babel/es2015"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets es2015
|
||||
babel script.js --presets @babel/es2015
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["es2015"]
|
||||
presets: ["@babel/es2015"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/preset-es2016
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["es2016"]
|
||||
"presets": ["@babel/es2016"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets es2016
|
||||
babel script.js --presets @babel/es2016
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["es2016"]
|
||||
presets: ["@babel/es2016"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/preset-es2017
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["es2017"]
|
||||
"presets": ["@babel/es2017"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets es2017
|
||||
babel script.js --presets @babel/es2017
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["es2017"]
|
||||
presets: ["@babel/es2017"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -34,20 +34,20 @@ npm install --save-dev @babel/preset-flow
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["flow"]
|
||||
"presets": ["@babel/flow"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --presets flow script.js
|
||||
babel --presets @babel/flow script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["flow"]
|
||||
presets: ["@babel/flow"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -15,34 +15,12 @@ And with the `development` option:
|
||||
|
||||
> Note: Flow syntax support is no longer enabled in v7. For that, you will need to add the [Flow preset](https://babeljs.io/docs/plugins/preset-flow/).
|
||||
|
||||
## Install
|
||||
## Installation
|
||||
|
||||
> You can also check out the React [Getting Started page](https://facebook.github.io/react/docs/hello-world.html)
|
||||
|
||||
> For more info, check out the setup page on the [cli](/docs/setup/) and the [usage](/docs/usage/cli/) docs.
|
||||
|
||||
Install the CLI and this preset
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/cli @babel/preset-react
|
||||
```
|
||||
|
||||
Make a .babelrc config file with the preset
|
||||
|
||||
```sh
|
||||
echo '{ "presets": ["react"] }' > .babelrc
|
||||
```
|
||||
|
||||
Create a file to run on
|
||||
|
||||
```sh
|
||||
echo '<h1>Hello, world!</h1>' > index.js
|
||||
```
|
||||
|
||||
View the output
|
||||
|
||||
```sh
|
||||
./node_modules/.bin/babel index.js
|
||||
npm install --save-dev @babel/preset-react
|
||||
```
|
||||
|
||||
## Usage
|
||||
@ -53,21 +31,21 @@ View the output
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["react"]
|
||||
"presets": ["@babel/react"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets react
|
||||
babel --presets @babel/react script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["react"]
|
||||
presets: ["@babel/react"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -86,7 +64,7 @@ This is useful when combined with either a `babelrc.js` or [env option in a .bab
|
||||
```js
|
||||
module.exports = {
|
||||
presets: [
|
||||
["react", {
|
||||
["@babel/react", {
|
||||
development: process.env.BABEL_ENV === "development"
|
||||
}],
|
||||
],
|
||||
@ -99,11 +77,11 @@ module.exports = {
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["react"],
|
||||
"presets": ["@babel/react"],
|
||||
"env": {
|
||||
"development": {
|
||||
"presets": [
|
||||
["react", { "development": true }]
|
||||
["@babel/react", { "development": true }]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,20 +16,20 @@ npm install --save-dev @babel/preset-stage-0
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["stage-0"]
|
||||
"presets": ["@babel/stage-0"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets stage-0
|
||||
babel script.js --presets @babel/stage-0
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["stage-0"]
|
||||
presets: ["@babel/stage-0"]
|
||||
});
|
||||
```
|
||||
|
||||
@ -26,21 +26,21 @@ npm install --save-dev @babel/preset-stage-1
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["stage-1"]
|
||||
"presets": ["@babel/stage-1"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets stage-1
|
||||
babel script.js --presets @babel/stage-1
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["stage-1"]
|
||||
presets: ["@babel/stage-1"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -28,21 +28,21 @@ npm install --save-dev @babel/preset-stage-2
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["stage-2"]
|
||||
"presets": ["@babel/stage-2"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets stage-2
|
||||
babel script.js --presets @babel/stage-2
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["stage-2"]
|
||||
presets: ["@babel/stage-2"]
|
||||
});
|
||||
```
|
||||
## References
|
||||
|
||||
@ -28,21 +28,21 @@ npm install --save-dev @babel/preset-stage-3
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["stage-3"]
|
||||
"presets": ["@babel/stage-3"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel script.js --presets stage-3
|
||||
babel script.js --presets @babel/stage-3
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["stage-3"]
|
||||
presets: ["@babel/stage-3"]
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -36,20 +36,20 @@ npm install --save-dev @babel/preset-typescript
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["typescript"]
|
||||
"presets": ["@babel/typescript"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --presets typescript script.ts
|
||||
babel --presets @babel/typescript script.ts
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
presets: ["typescript"]
|
||||
presets: ["@babel/typescript"]
|
||||
});
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user