babel-plugin-transform-regenerator
Advanced tools
Comparing version 6.16.1 to 6.20.0
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = function () { | ||
return require("./visit"); | ||
}; | ||
exports.default = require("regenerator-transform"); | ||
module.exports = exports["default"]; |
@@ -5,3 +5,3 @@ { | ||
"description": "Explode async and generator functions into a state machine.", | ||
"version": "6.16.1", | ||
"version": "6.20.0", | ||
"homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", | ||
@@ -11,7 +11,5 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", | ||
"dependencies": { | ||
"babel-types": "^6.16.0", | ||
"babel-runtime": "^6.9.0", | ||
"private": "~0.1.5" | ||
"regenerator-transform": "0.9.8" | ||
}, | ||
"license": "BSD", | ||
"license": "MIT", | ||
"devDependencies": { | ||
@@ -18,0 +16,0 @@ "babel-helper-plugin-test-runner": "^6.8.0" |
# babel-plugin-transform-regenerator | ||
Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator) | ||
> Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator) | ||
## Example | ||
**In** | ||
```javascript | ||
function* a() { | ||
yield 1; | ||
} | ||
``` | ||
**Out** | ||
```javascript | ||
var _marked = [a].map(regeneratorRuntime.mark); | ||
function a() { | ||
return regeneratorRuntime.wrap(function a$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return 1; | ||
case 2: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked[0], this); | ||
} | ||
``` | ||
[Try in REPL](http://babeljs.io/repl/#?evaluate=true&lineWrap=true&presets=es2015%2Ces2015-loose%2Creact&experimental=false&loose=false&spec=false&code=function%20*range(max%2C%20step)%20%7B%0A%20%20var%20count%20%3D%200%3B%0A%20%20step%20%3D%20step%20%7C%7C%201%3B%0A%20%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20max%3B%20i%20%2B%3D%20step)%20%7B%0A%20%20%20%20count%2B%2B%3B%0A%20%20%20%20yield%20i%3B%0A%20%20%7D%0A%20%0A%20%20return%20count%3B%0A%7D%0A%20%0Avar%20gen%20%3D%20range(20%2C%203)%2C%20info%3B%0A%20%0Awhile%20(!(info%20%3D%20gen.next()).done)%20%7B%0A%20%20console.log(info.value)%3B%0A%7D%0A%20%0Aconsole.log(%22steps%20taken%3A%20%22%20%2B%20info.value)%3B&playground=true) | ||
## Installation | ||
```sh | ||
$ npm install babel-plugin-transform-regenerator | ||
npm install --save-dev babel-plugin-transform-regenerator | ||
``` | ||
@@ -26,5 +60,5 @@ | ||
["transform-regenerator", { | ||
asyncGenerators: false, // true by default | ||
generators: false, // true by default | ||
async: false // true by default | ||
asyncGenerators: false, // true by default | ||
generators: false, // true by default | ||
async: false // true by default | ||
}] | ||
@@ -38,3 +72,3 @@ ] | ||
```sh | ||
$ babel --plugins transform-regenerator script.js | ||
babel --plugins transform-regenerator script.js | ||
``` | ||
@@ -41,0 +75,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
1
0
81
2
2663
4
3
+ Addedregenerator-transform@0.9.8
+ Addedregenerator-transform@0.9.8(transitive)
- Removedbabel-runtime@^6.9.0
- Removedbabel-types@^6.16.0
- Removedprivate@~0.1.5