babel-helper-remap-async-to-generator
Advanced tools
Comparing version 7.0.0-beta.2 to 7.0.0-beta.3
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = _default; | ||
exports.default = function (path, helpers) { | ||
var t = _interopRequireWildcard(require("babel-types")); | ||
var _babelTemplate = _interopRequireDefault(require("babel-template")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var awaitTemplate = "\n function* wrapper() {\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;\n (\n STEP_KEY = yield AWAIT(ITERATOR_KEY.next()),\n ITERATOR_COMPLETION = STEP_KEY.done,\n STEP_VALUE = yield AWAIT(STEP_KEY.value),\n !ITERATOR_COMPLETION\n );\n ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n yield AWAIT(ITERATOR_KEY.return());\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n"; | ||
var buildForAwait = (0, _babelTemplate.default)(awaitTemplate); | ||
var buildForAwaitWithoutWrapping = (0, _babelTemplate.default)(awaitTemplate.replace(/\bAWAIT\b/g, "")); | ||
function _default(path, helpers) { | ||
var node = path.node, | ||
@@ -12,3 +25,3 @@ scope = path.scope, | ||
var left = node.left; | ||
var declar = void 0; | ||
var declar; | ||
@@ -48,18 +61,2 @@ if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { | ||
}; | ||
}; | ||
var _babelTypes = require("babel-types"); | ||
var t = _interopRequireWildcard(_babelTypes); | ||
var _babelTemplate = require("babel-template"); | ||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var awaitTemplate = "\n function* wrapper() {\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;\n (\n STEP_KEY = yield AWAIT(ITERATOR_KEY.next()),\n ITERATOR_COMPLETION = STEP_KEY.done,\n STEP_VALUE = yield AWAIT(STEP_KEY.value),\n !ITERATOR_COMPLETION\n );\n ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {\n yield AWAIT(ITERATOR_KEY.return());\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n"; | ||
var buildForAwait = (0, _babelTemplate2.default)(awaitTemplate); | ||
var buildForAwaitWithoutWrapping = (0, _babelTemplate2.default)(awaitTemplate.replace(/\bAWAIT\b/g, "")); | ||
} |
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = _default; | ||
exports.default = function (path, file, helpers) { | ||
if (!helpers) { | ||
helpers = { | ||
wrapAsync: file | ||
}; | ||
file = null; | ||
} | ||
var _babelHelperWrapFunction = _interopRequireDefault(require("babel-helper-wrap-function")); | ||
path.traverse(awaitVisitor, { | ||
file: file, | ||
wrapAwait: helpers.wrapAwait | ||
}); | ||
path.node.async = false; | ||
path.node.generator = true; | ||
(0, _babelHelperWrapFunction2.default)(path, helpers.wrapAsync); | ||
}; | ||
var t = _interopRequireWildcard(require("babel-types")); | ||
var _babelHelperWrapFunction = require("babel-helper-wrap-function"); | ||
var _forAwait = _interopRequireDefault(require("./for-await")); | ||
var _babelHelperWrapFunction2 = _interopRequireDefault(_babelHelperWrapFunction); | ||
var _babelTypes = require("babel-types"); | ||
var t = _interopRequireWildcard(_babelTypes); | ||
var _forAwait = require("./for-await"); | ||
var _forAwait2 = _interopRequireDefault(_forAwait); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -56,3 +34,3 @@ | ||
if (!node.await) return; | ||
var build = (0, _forAwait2.default)(path, { | ||
var build = (0, _forAwait.default)(path, { | ||
getAsyncIterator: file.addHelper("asyncIterator"), | ||
@@ -80,2 +58,12 @@ wrapAwait: wrapAwait | ||
} | ||
}; | ||
}; | ||
function _default(path, file, helpers) { | ||
path.traverse(awaitVisitor, { | ||
file: file, | ||
wrapAwait: helpers.wrapAwait | ||
}); | ||
path.node.async = false; | ||
path.node.generator = true; | ||
(0, _babelHelperWrapFunction.default)(path, helpers.wrapAsync); | ||
} |
{ | ||
"name": "babel-helper-remap-async-to-generator", | ||
"version": "7.0.0-beta.2", | ||
"version": "7.0.0-beta.3", | ||
"description": "Helper function to remap async functions to generators", | ||
@@ -9,7 +9,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", | ||
"dependencies": { | ||
"babel-helper-wrap-function": "7.0.0-beta.2", | ||
"babel-template": "7.0.0-beta.2", | ||
"babel-traverse": "7.0.0-beta.2", | ||
"babel-types": "7.0.0-beta.2" | ||
"babel-helper-wrap-function": "7.0.0-beta.3", | ||
"babel-template": "7.0.0-beta.3", | ||
"babel-traverse": "7.0.0-beta.3", | ||
"babel-types": "7.0.0-beta.3" | ||
} | ||
} |
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
5676
104
+ Addedbabel-code-frame@7.0.0-beta.3(transitive)
+ Addedbabel-helper-function-name@7.0.0-beta.3(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-beta.3(transitive)
+ Addedbabel-helper-wrap-function@7.0.0-beta.3(transitive)
+ Addedbabel-template@7.0.0-beta.3(transitive)
+ Addedbabel-traverse@7.0.0-beta.3(transitive)
+ Addedbabel-types@7.0.0-beta.3(transitive)
+ Addedbabylon@7.0.0-beta.27(transitive)
- Removedbabel-code-frame@7.0.0-beta.2(transitive)
- Removedbabel-helper-function-name@7.0.0-beta.2(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-beta.2(transitive)
- Removedbabel-helper-wrap-function@7.0.0-beta.2(transitive)
- Removedbabel-messages@7.0.0-beta.2(transitive)
- Removedbabel-template@7.0.0-beta.2(transitive)
- Removedbabel-traverse@7.0.0-beta.2(transitive)
- Removedbabel-types@7.0.0-beta.2(transitive)
- Removedbabylon@7.0.0-beta.25(transitive)
Updatedbabel-template@7.0.0-beta.3
Updatedbabel-traverse@7.0.0-beta.3
Updatedbabel-types@7.0.0-beta.3