@babel/plugin-proposal-function-sent
Advanced tools
Comparing version 7.18.6 to 7.22.5
@@ -7,14 +7,8 @@ "use strict"; | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _pluginSyntaxFunctionSent = require("@babel/plugin-syntax-function-sent"); | ||
var _helperWrapFunction = require("@babel/helper-wrap-function"); | ||
var _core = require("@babel/core"); | ||
var _default = (0, _helperPluginUtils.declare)(api => { | ||
api.assertVersion(7); | ||
const isFunctionSent = node => _core.types.isIdentifier(node.meta, { | ||
@@ -25,7 +19,5 @@ name: "function" | ||
}); | ||
const hasBeenReplaced = (node, sentId) => _core.types.isAssignmentExpression(node) && _core.types.isIdentifier(node.left, { | ||
name: sentId | ||
}); | ||
const yieldVisitor = { | ||
@@ -35,3 +27,2 @@ Function(path) { | ||
}, | ||
YieldExpression(path) { | ||
@@ -42,3 +33,2 @@ if (!hasBeenReplaced(path.parent, this.sentId)) { | ||
}, | ||
MetaProperty(path) { | ||
@@ -49,3 +39,2 @@ if (isFunctionSent(path.node)) { | ||
} | ||
}; | ||
@@ -59,7 +48,5 @@ return { | ||
const fnPath = path.getFunctionParent(); | ||
if (!fnPath.node.generator) { | ||
throw new Error("Parent generator function not found"); | ||
} | ||
const sentId = path.scope.generateUid("function.sent"); | ||
@@ -72,7 +59,7 @@ fnPath.traverse(yieldVisitor, { | ||
} | ||
} | ||
}; | ||
}); | ||
exports.default = _default; | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-proposal-function-sent", | ||
"version": "7.18.6", | ||
"version": "7.22.5", | ||
"description": "Compile the function.sent meta property to valid ES2015 code", | ||
@@ -20,5 +20,5 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.18.6", | ||
"@babel/helper-wrap-function": "^7.18.6", | ||
"@babel/plugin-syntax-function-sent": "^7.18.6" | ||
"@babel/helper-plugin-utils": "^7.22.5", | ||
"@babel/helper-wrap-function": "^7.22.5", | ||
"@babel/plugin-syntax-function-sent": "^7.22.5" | ||
}, | ||
@@ -29,4 +29,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.18.6", | ||
"@babel/helper-plugin-test-runner": "^7.18.6" | ||
"@babel/core": "^7.22.5", | ||
"@babel/helper-plugin-test-runner": "^7.22.5" | ||
}, | ||
@@ -33,0 +33,0 @@ "engines": { |
9210
5
56