Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-helper-remap-async-to-generator

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-helper-remap-async-to-generator - npm Package Compare versions

Comparing version 7.0.0-alpha.12 to 7.0.0-alpha.14

30

lib/for-await.js

@@ -22,5 +22,4 @@ "use strict";

var template = buildForAwait();
(0, _babelTraverse2.default)(template, forAwaitVisitor, null, {
var build = helpers.wrapAwait ? buildForAwait : buildForAwaitWithoutWrapping;
var template = build({
ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),

@@ -63,6 +62,2 @@ ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),

var _babelTraverse = require("babel-traverse");
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -72,19 +67,4 @@

var buildForAwait = (0, _babelTemplate2.default)("\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) {\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 forAwaitVisitor = {
noScope: true,
Identifier: function Identifier(path, replacements) {
if (path.node.name in replacements) {
path.replaceInline(replacements[path.node.name]);
}
},
CallExpression: function CallExpression(path, replacements) {
var callee = path.node.callee;
if (t.isIdentifier(callee) && callee.name === "AWAIT" && !replacements.AWAIT) {
path.replaceWith(path.node.arguments[0]);
}
}
};
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) {\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, ""));

@@ -89,3 +89,2 @@ "use strict";

path.parentPath.replaceWithMultiple(build.node);
path.remove();
} else {

@@ -92,0 +91,0 @@ path.replaceWithMultiple(build.node);

10

package.json
{
"name": "babel-helper-remap-async-to-generator",
"version": "7.0.0-alpha.12",
"version": "7.0.0-alpha.14",
"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-function-name": "7.0.0-alpha.12",
"babel-template": "7.0.0-alpha.12",
"babel-traverse": "7.0.0-alpha.12",
"babel-types": "7.0.0-alpha.12"
"babel-helper-function-name": "7.0.0-alpha.14",
"babel-template": "7.0.0-alpha.14",
"babel-traverse": "7.0.0-alpha.14",
"babel-types": "7.0.0-alpha.14"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc