Docs: update plugin readmes with options [ci skip]

This commit is contained in:
Henry Zhu 2016-02-10 09:53:20 -05:00
parent 606c8d05fd
commit 5a271b091a
12 changed files with 166 additions and 11 deletions

View File

@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-async-to-module-method
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-async-to-module-method"]
}
// with options
{
"plugins": [
["transform-async-to-module-method", {
"module": "bluebird",
"method": "coroutine"
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,18 @@ $ npm install babel-plugin-transform-es2015-arrow-functions
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-arrow-functions"]
}
// with options
{
"plugins": [
["transform-es2015-arrow-functions", { "spec": true }]
]
}
```
### Via CLI

View File

@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-classes
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-classes"]
}
// with options
{
"plugins": [
["transform-es2015-classes", {
"loose": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-computed-properties
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-computed-properties"]
}
// with options
{
"plugins": [
["transform-es2015-computed-properties", {
"loose": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-for-of
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-for-of"]
}
// with options
{
"plugins": [
["transform-es2015-for-of", {
"loose": true
}]
]
}
```
### Via CLI

View File

@ -12,10 +12,20 @@ $ npm install babel-plugin-transform-es2015-modules-commonjs
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-modules-commonjs"]
}
// with options
{
"plugins": [
["transform-es2015-modules-commonjs", {
"allowTopLevelThis": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-es2015-spread
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-spread"]
}
// with options
{
"plugins": [
["transform-es2015-spread", {
"loose": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-es2015-template-literals
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-es2015-template-literals"]
}
// with options
{
"plugins": [
["transform-es2015-template-literals", {
"loose": true,
"spec": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,19 @@ $ npm install babel-plugin-transform-react-jsx
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-react-jsx"]
}
// with options
{
"plugins": [
["transform-react-jsx", {
"pragma": "dom" // default pragma is React.createElement
}]
]
}
```
### Via CLI

View File

@ -1 +1,46 @@
# 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"]
});
```

View File

@ -14,10 +14,21 @@ $ npm install babel-plugin-transform-runtime
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-runtime"]
}
// with options
{
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
```
### Via CLI

View File

@ -14,10 +14,20 @@ $ npm install babel-plugin-transform-strict-mode
**.babelrc**
```json
```js
// without options
{
"plugins": ["transform-strict-mode"]
}
// with options
{
"plugins": [
["transform-strict-mode", {
"strict": true
}]
]
}
```
### Via CLI