This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
> Turn async generator functions into ES2015 generators
See our website [@babel/plugin-proposal-async-generator-functions](https://babeljs.io/docs/en/next/babel-plugin-proposal-async-generator-functions.html) for more information.
See our website [@babel/plugin-proposal-async-generator-functions](https://babeljs.io/docs/en/babel-plugin-proposal-async-generator-functions) for more information.
## Install
@@ -9,26 +9,22 @@ var _core = require("@babel/core");
const buildForAwait = (0, _core.template)(`
async function wrapper() {
var ITERATOR_COMPLETION = true;
var ITERATOR_ABRUPT_COMPLETION = false;
var ITERATOR_HAD_ERROR_KEY = false;
var ITERATOR_ERROR_KEY;
try {
for (
var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;
(
STEP_KEY = await ITERATOR_KEY.next(),
ITERATOR_COMPLETION = STEP_KEY.done,
STEP_VALUE = await STEP_KEY.value,
!ITERATOR_COMPLETION
);
ITERATOR_COMPLETION = true) {
var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY;
ITERATOR_ABRUPT_COMPLETION = !(STEP_KEY = await ITERATOR_KEY.next()).done;
ITERATOR_ABRUPT_COMPLETION = false
) {
}
} catch (err) {
ITERATOR_HAD_ERROR_KEY = true;
ITERATOR_ERROR_KEY = err;
} finally {
try {
if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {
if (ITERATOR_ABRUPT_COMPLETION && ITERATOR_KEY.return != null) {
await ITERATOR_KEY.return();
}
} finally {
@@ -49,7 +45,9 @@ function _default(path, {
parent
} = path;
const stepKey = scope.generateUidIdentifier("step");
const stepValue = scope.generateUidIdentifier("value");
const stepValue = _core.types.memberExpression(stepKey, _core.types.identifier("value"));
const left = node.left;
let declar;
@@ -61,13 +59,12 @@ function _default(path, {
let template = buildForAwait({
ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
ITERATOR_ABRUPT_COMPLETION: scope.generateUidIdentifier("iteratorAbruptCompletion"),
ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
ITERATOR_KEY: scope.generateUidIdentifier("iterator"),
GET_ITERATOR: getAsyncIterator,
OBJECT: node.right,
STEP_VALUE: stepValue,
STEP_KEY: stepKey
STEP_KEY: _core.types.cloneNode(stepKey)
});
template = template.body.body;
+14 -11
View File
@@ -7,20 +7,21 @@ exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperRemapAsyncToGenerator = _interopRequireDefault(require("@babel/helper-remap-async-to-generator"));
var _helperRemapAsyncToGenerator = require("@babel/helper-remap-async-to-generator");
var _pluginSyntaxAsyncGenerators = _interopRequireDefault(require("@babel/plugin-syntax-async-generators"));
var _pluginSyntaxAsyncGenerators = require("@babel/plugin-syntax-async-generators");
var _core = require("@babel/core");
var _forAwait = _interopRequireDefault(require("./for-await"));
var _forAwait = require("./for-await");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);
const yieldStarVisitor = {
Function(path) {
const yieldStarVisitor = _core.traverse.visitors.merge([{
ArrowFunctionExpression(path) {
path.skip();
},
@@ -32,9 +33,10 @@ var _default = (0, _helperPluginUtils.declare)(api => {
node.argument = _core.types.callExpression(callee, [_core.types.callExpression(state.addHelper("asyncIterator"), [node.argument]), state.addHelper("awaitAsyncGenerator")]);
}
};
const forAwaitVisitor = {
Function(path) {
}, _helperEnvironmentVisitor.default]);
const forAwaitVisitor = _core.traverse.visitors.merge([{
ArrowFunctionExpression(path) {
path.skip();
},
@@ -59,7 +61,7 @@ var _default = (0, _helperPluginUtils.declare)(api => {
block.body.push(declar);
}
block.body = block.body.concat(node.body.body);
block.body.push(...path.node.body.body);
_core.types.inherits(loop, node);
@@ -72,7 +74,8 @@ var _default = (0, _helperPluginUtils.declare)(api => {
}
}
};
}, _helperEnvironmentVisitor.default]);
const visitor = {
Function(path, state) {
if (!path.node.async) return;
+30 -20
View File
@@ -1,53 +1,62 @@
{
"_args": [
[
"@babel/plugin-proposal-async-generator-functions@7.10.4",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
"@babel/plugin-proposal-async-generator-functions@7.18.6",
"/home/node/nuxt"
]
],
"_from": "@babel/plugin-proposal-async-generator-functions@7.10.4",
"_id": "@babel/plugin-proposal-async-generator-functions@7.10.4",
"_from": "@babel/plugin-proposal-async-generator-functions@7.18.6",
"_id": "@babel/plugin-proposal-async-generator-functions@7.18.6",
"_inBundle": false,
"_integrity": "sha512-MJbxGSmejEFVOANAezdO39SObkURO5o/8b6fSH6D1pi9RZQt+ldppKPXfqgUWpSQ9asM6xaSaSJIaeWMDRP0Zg==",
"_integrity": "sha512-WAz4R9bvozx4qwf74M+sfqPMKfSqwM0phxPTR6iJIi8robgzXwkEgmeJG1gEKhm6sDqT/U9aV3lfcqybIpev8w==",
"_location": "/@babel/plugin-proposal-async-generator-functions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@babel/plugin-proposal-async-generator-functions@7.10.4",
"raw": "@babel/plugin-proposal-async-generator-functions@7.18.6",
"name": "@babel/plugin-proposal-async-generator-functions",
"escapedName": "@babel%2fplugin-proposal-async-generator-functions",
"scope": "@babel",
"rawSpec": "7.10.4",
"rawSpec": "7.18.6",
"saveSpec": null,
"fetchSpec": "7.10.4"
"fetchSpec": "7.18.6"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.4.tgz",
"_spec": "7.10.4",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.6.tgz",
"_spec": "7.18.6",
"_where": "/home/node/nuxt",
"author": {
"name": "The Babel Team",
"url": "https://babel.dev/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4",
"@babel/helper-remap-async-to-generator": "^7.10.4",
"@babel/plugin-syntax-async-generators": "^7.8.0"
"@babel/helper-environment-visitor": "^7.18.6",
"@babel/helper-plugin-utils": "^7.18.6",
"@babel/helper-remap-async-to-generator": "^7.18.6",
"@babel/plugin-syntax-async-generators": "^7.8.4"
},
"description": "Turn async generator functions into ES2015 generators",
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/helper-plugin-test-runner": "^7.10.4"
"@babel/core": "^7.18.6",
"@babel/helper-plugin-test-runner": "^7.18.6",
"babel-plugin-polyfill-corejs3": "^0.5.2",
"core-js-pure": "^3.20.2"
},
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
"homepage": "https://github.com/babel/babel#readme",
"engines": {
"node": ">=6.9.0"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-async-generator-functions",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"main": "./lib/index.js",
"name": "@babel/plugin-proposal-async-generator-functions",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
@@ -60,5 +69,6 @@
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-proposal-async-generator-functions"
},
"version": "7.10.4"
"type": "commonjs",
"version": "7.18.6"
}