diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/babel-plugin-transform-async-to-generator | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) | |
download | wallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/babel-plugin-transform-async-to-generator')
4 files changed, 110 insertions, 0 deletions
diff --git a/node_modules/babel-plugin-transform-async-to-generator/.npmignore b/node_modules/babel-plugin-transform-async-to-generator/.npmignore new file mode 100644 index 000000000..31852902b --- /dev/null +++ b/node_modules/babel-plugin-transform-async-to-generator/.npmignore @@ -0,0 +1,4 @@ +node_modules +*.log +src +test diff --git a/node_modules/babel-plugin-transform-async-to-generator/README.md b/node_modules/babel-plugin-transform-async-to-generator/README.md new file mode 100644 index 000000000..8f50b7a81 --- /dev/null +++ b/node_modules/babel-plugin-transform-async-to-generator/README.md @@ -0,0 +1,60 @@ +# babel-plugin-transform-async-to-generator + +> Turn async functions into ES2015 generators + +## Example + +**In** + +```javascript +async function foo() { + await bar(); +} +``` + +**Out** + +```javascript +var _asyncToGenerator = function (fn) { + ... +}; +var foo = _asyncToGenerator(function* () { + yield bar(); +}); +``` + +## Installation + +```sh +npm install --save-dev babel-plugin-transform-async-to-generator +``` + +## Usage + +### Via `.babelrc` (Recommended) + +**.babelrc** + +```json +{ + "plugins": ["transform-async-to-generator"] +} +``` + +### Via CLI + +```sh +babel --plugins transform-async-to-generator script.js +``` + +### Via Node API + +```javascript +require("babel-core").transform("code", { + plugins: ["transform-async-to-generator"] +}); +``` + +## References + +* [Proposal: Async Functions for ECMAScript](https://github.com/tc39/ecmascript-asyncawait) diff --git a/node_modules/babel-plugin-transform-async-to-generator/lib/index.js b/node_modules/babel-plugin-transform-async-to-generator/lib/index.js new file mode 100644 index 000000000..e9169ccb0 --- /dev/null +++ b/node_modules/babel-plugin-transform-async-to-generator/lib/index.js @@ -0,0 +1,27 @@ +"use strict"; + +exports.__esModule = true; + +exports.default = function () { + return { + inherits: require("babel-plugin-syntax-async-functions"), + + visitor: { + Function: function Function(path, state) { + if (!path.node.async || path.node.generator) return; + + (0, _babelHelperRemapAsyncToGenerator2.default)(path, state.file, { + wrapAsync: state.addHelper("asyncToGenerator") + }); + } + } + }; +}; + +var _babelHelperRemapAsyncToGenerator = require("babel-helper-remap-async-to-generator"); + +var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports["default"];
\ No newline at end of file diff --git a/node_modules/babel-plugin-transform-async-to-generator/package.json b/node_modules/babel-plugin-transform-async-to-generator/package.json new file mode 100644 index 000000000..762003f8a --- /dev/null +++ b/node_modules/babel-plugin-transform-async-to-generator/package.json @@ -0,0 +1,19 @@ +{ + "name": "babel-plugin-transform-async-to-generator", + "version": "6.24.1", + "description": "Turn async functions into ES2015 generators", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", + "license": "MIT", + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + }, + "devDependencies": { + "babel-helper-plugin-test-runner": "^6.24.1" + } +} |