Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-async-generator-functions

Package Overview
Dependencies
58
Maintainers
4
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.19.1 to 7.20.1

12

lib/for-await.js

@@ -7,5 +7,3 @@ "use strict";

exports.default = _default;
var _core = require("@babel/core");
const buildForAwait = (0, _core.template)(`

@@ -39,3 +37,2 @@ async function wrapper() {

`);
function _default(path, {

@@ -50,8 +47,5 @@ getAsyncIterator

const stepKey = scope.generateUidIdentifier("step");
const stepValue = _core.types.memberExpression(stepKey, _core.types.identifier("value"));
const left = node.left;
let declar;
if (_core.types.isIdentifier(left) || _core.types.isPattern(left) || _core.types.isMemberExpression(left)) {

@@ -62,3 +56,2 @@ declar = _core.types.expressionStatement(_core.types.assignmentExpression("=", left, stepValue));

}
let template = buildForAwait({

@@ -73,13 +66,10 @@ ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),

});
template = template.body.body;
const isLabeledParent = _core.types.isLabeledStatement(parent);
const tryBody = template[3].block.body;
const loop = tryBody[0];
if (isLabeledParent) {
tryBody[0] = _core.types.labeledStatement(parent.label, loop);
}
return {

@@ -86,0 +76,0 @@ replaceParent: isLabeledParent,

31

lib/index.js

@@ -7,18 +7,10 @@ "use strict";

exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperRemapAsyncToGenerator = require("@babel/helper-remap-async-to-generator");
var _pluginSyntaxAsyncGenerators = require("@babel/plugin-syntax-async-generators");
var _core = require("@babel/core");
var _forAwait = require("./for-await");
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);
const yieldStarVisitor = _core.traverse.visitors.merge([{

@@ -28,3 +20,2 @@ ArrowFunctionExpression(path) {

},
YieldExpression({

@@ -34,10 +25,6 @@ node

if (!node.delegate) return;
const asyncIter = _core.types.callExpression(state.addHelper("asyncIterator"), [node.argument]);
node.argument = _core.types.callExpression(state.addHelper("asyncGeneratorDelegate"), [asyncIter, state.addHelper("awaitAsyncGenerator")]);
}
}, _helperEnvironmentVisitor.default]);
const forAwaitVisitor = _core.traverse.visitors.merge([{

@@ -47,3 +34,2 @@ ArrowFunctionExpression(path) {

},
ForOfStatement(path, {

@@ -64,2 +50,3 @@ file

const block = loop.body;
path.ensureBlock();

@@ -69,10 +56,10 @@

block.body.push(declar);
if (path.node.body.body.length) {
block.body.push(_core.types.blockStatement(path.node.body.body));
}
} else {
block.body.push(...path.node.body.body);
}
block.body.push(...path.node.body.body);
_core.types.inherits(loop, node);
_core.types.inherits(loop.body, node.body);
if (build.replaceParent) {

@@ -84,5 +71,3 @@ path.parentPath.replaceWithMultiple(build.node);

}
}, _helperEnvironmentVisitor.default]);
const visitor = {

@@ -94,2 +79,3 @@ Function(path, state) {

path.traverse(yieldStarVisitor, state);
(0, _helperRemapAsyncToGenerator.default)(path, {

@@ -100,3 +86,2 @@ wrapAsync: state.addHelper("wrapAsyncGenerator"),

}
};

@@ -110,9 +95,7 @@ return {

}
}
};
});
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-proposal-async-generator-functions",
"version": "7.19.1",
"version": "7.20.1",
"description": "Turn async generator functions into ES2015 generators",

@@ -29,3 +29,3 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/core": "^7.19.6",
"@babel/helper-plugin-test-runner": "^7.18.6",

@@ -32,0 +32,0 @@ "babel-plugin-polyfill-corejs3": "^0.6.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc