@babel/plugin-transform-async-to-generator
Advanced tools
Comparing version 7.0.0-beta.49 to 7.0.0-beta.50
{ | ||
"name": "@babel/plugin-transform-async-to-generator", | ||
"version": "7.0.0-beta.49", | ||
"version": "7.0.0-beta.50", | ||
"description": "Turn async functions into ES2015 generators", | ||
@@ -12,5 +12,5 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", | ||
"dependencies": { | ||
"@babel/helper-module-imports": "7.0.0-beta.49", | ||
"@babel/helper-plugin-utils": "7.0.0-beta.49", | ||
"@babel/helper-remap-async-to-generator": "7.0.0-beta.49" | ||
"@babel/helper-module-imports": "7.0.0-beta.50", | ||
"@babel/helper-plugin-utils": "7.0.0-beta.50", | ||
"@babel/helper-remap-async-to-generator": "7.0.0-beta.50" | ||
}, | ||
@@ -21,5 +21,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.49", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.49" | ||
"@babel/core": "7.0.0-beta.50", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.50" | ||
} | ||
} |
@@ -5,86 +5,16 @@ # @babel/plugin-transform-async-to-generator | ||
> In Babel 7, `transform-async-to-module-method` was merged into this plugin | ||
See our website [@babel/plugin-transform-async-to-generator](https://new.babeljs.io/docs/en/next/babel-plugin-transform-async-to-generator.html) for more information. | ||
## Example | ||
## Install | ||
**In** | ||
Using npm: | ||
```javascript | ||
async function foo() { | ||
await bar(); | ||
} | ||
``` | ||
**Out** | ||
```javascript | ||
var _asyncToGenerator = function (fn) { | ||
... | ||
}; | ||
var foo = _asyncToGenerator(function* () { | ||
yield bar(); | ||
}); | ||
``` | ||
**Out with options** | ||
> Turn async functions into a Bluebird coroutine | ||
```javascript | ||
var Bluebird = require("bluebird"); | ||
var foo = Bluebird.coroutine(function* () { | ||
yield bar(); | ||
}); | ||
``` | ||
## Installation | ||
```sh | ||
npm install --save-dev @babel/plugin-transform-async-to-generator | ||
npm install --save @babel/plugin-transform-async-to-generator | ||
``` | ||
## Usage | ||
or using yarn: | ||
### Via `.babelrc` (Recommended) | ||
**.babelrc** | ||
Without options: | ||
```json | ||
{ | ||
"plugins": ["@babel/plugin-transform-async-to-generator"] | ||
} | ||
``` | ||
With options: | ||
```json | ||
{ | ||
"plugins": [ | ||
["@babel/plugin-transform-async-to-generator", { | ||
"module": "bluebird", | ||
"method": "coroutine" | ||
}] | ||
] | ||
} | ||
``` | ||
### Via CLI | ||
```sh | ||
babel --plugins @babel/plugin-transform-async-to-generator script.js | ||
yarn add --save @babel/plugin-transform-async-to-generator | ||
``` | ||
### Via Node API | ||
```javascript | ||
require("@babel/core").transform("code", { | ||
plugins: ["@babel/plugin-transform-async-to-generator"] | ||
}); | ||
``` | ||
## References | ||
* [Proposal: Async Functions for ECMAScript](https://github.com/tc39/ecmascript-asyncawait) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3048
3
20
+ Added@babel/helper-annotate-as-pure@7.0.0-beta.50(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.50(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.50(transitive)
+ Added@babel/helper-module-imports@7.0.0-beta.50(transitive)
+ Added@babel/helper-plugin-utils@7.0.0-beta.50(transitive)
+ Added@babel/helper-remap-async-to-generator@7.0.0-beta.50(transitive)
+ Added@babel/helper-wrap-function@7.0.0-beta.50(transitive)
- Removed@babel/helper-annotate-as-pure@7.0.0-beta.49(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.49(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.49(transitive)
- Removed@babel/helper-module-imports@7.0.0-beta.49(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.49(transitive)
- Removed@babel/helper-remap-async-to-generator@7.0.0-beta.49(transitive)
- Removed@babel/helper-wrap-function@7.0.0-beta.49(transitive)