Docs: update plugin readmes with options [ci skip]
This commit is contained in:
parent
606c8d05fd
commit
5a271b091a
@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-async-to-module-method
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-async-to-module-method"]
|
"plugins": ["transform-async-to-module-method"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-async-to-module-method", {
|
||||||
|
"module": "bluebird",
|
||||||
|
"method": "coroutine"
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,18 @@ $ npm install babel-plugin-transform-es2015-arrow-functions
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-arrow-functions"]
|
"plugins": ["transform-es2015-arrow-functions"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-arrow-functions", { "spec": true }]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-classes
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-classes"]
|
"plugins": ["transform-es2015-classes"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-classes", {
|
||||||
|
"loose": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-computed-properties
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-computed-properties"]
|
"plugins": ["transform-es2015-computed-properties"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-computed-properties", {
|
||||||
|
"loose": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-for-of
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-for-of"]
|
"plugins": ["transform-es2015-for-of"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-for-of", {
|
||||||
|
"loose": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -12,10 +12,20 @@ $ npm install babel-plugin-transform-es2015-modules-commonjs
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-modules-commonjs"]
|
"plugins": ["transform-es2015-modules-commonjs"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-modules-commonjs", {
|
||||||
|
"allowTopLevelThis": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-spread
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-spread"]
|
"plugins": ["transform-es2015-spread"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-spread", {
|
||||||
|
"loose": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-es2015-template-literals
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-es2015-template-literals"]
|
"plugins": ["transform-es2015-template-literals"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-es2015-template-literals", {
|
||||||
|
"loose": true,
|
||||||
|
"spec": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,19 @@ $ npm install babel-plugin-transform-react-jsx
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-react-jsx"]
|
"plugins": ["transform-react-jsx"]
|
||||||
}
|
}
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-react-jsx", {
|
||||||
|
"pragma": "dom" // default pragma is React.createElement
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -1 +1,46 @@
|
|||||||
# babel-plugin-transform-regenerator
|
# babel-plugin-transform-regenerator
|
||||||
|
|
||||||
|
Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install babel-plugin-transform-regenerator
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Via `.babelrc` (Recommended)
|
||||||
|
|
||||||
|
**.babelrc**
|
||||||
|
|
||||||
|
```js
|
||||||
|
// without options
|
||||||
|
{
|
||||||
|
"plugins": ["transform-regenerator"]
|
||||||
|
}
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-regenerator", {
|
||||||
|
asyncGenerators: false, // true by default
|
||||||
|
generators: false, // true by default
|
||||||
|
async: false // true by default
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via CLI
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ babel --plugins transform-regenerator script.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via Node API
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require("babel-core").transform("code", {
|
||||||
|
plugins: ["transform-regenerator"]
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|||||||
@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-runtime
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-runtime"]
|
"plugins": ["transform-runtime"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-runtime", {
|
||||||
|
"polyfill": false,
|
||||||
|
"regenerator": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-strict-mode
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```json
|
```js
|
||||||
|
// without options
|
||||||
{
|
{
|
||||||
"plugins": ["transform-strict-mode"]
|
"plugins": ["transform-strict-mode"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with options
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["transform-strict-mode", {
|
||||||
|
"strict": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user