Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bump regenerator and add tests #15194

Merged
merged 3 commits into from Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-helpers/package.json
Expand Up @@ -23,7 +23,7 @@
"@babel/generator": "workspace:^",
"@babel/helper-plugin-test-runner": "workspace:^",
"@babel/parser": "workspace:^",
"regenerator-runtime": "^0.13.10",
"regenerator-runtime": "^0.13.11",
"terser": "^5.9.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-helpers/src/helpers-generated.ts

Large diffs are not rendered by default.

35 changes: 19 additions & 16 deletions packages/babel-helpers/src/helpers/regeneratorRuntime.js
Expand Up @@ -336,28 +336,31 @@ export default function _regeneratorRuntime() {
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
var methodName = context.method;
var method = delegate.iterator[methodName];
if (method === undefined) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
// method, or a missing .next mehtod, always terminate the
// yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}

// Note: ["return"] must be used for ES3 parsing compatibility.
if (methodName === "throw" && delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
if (methodName !== "return") {
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method",
"The iterator does not provide a '" + methodName + "' method",
);
}
return ContinueSentinel;
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-node/package.json
Expand Up @@ -27,7 +27,7 @@
"commander": "^4.0.1",
"core-js": "^3.26.0",
"node-environment-flags": "^1.0.5",
"regenerator-runtime": "^0.13.10",
"regenerator-runtime": "^0.13.11",
"v8flags": "^3.1.1"
},
"peerDependencies": {
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-regenerator/package.json
Expand Up @@ -12,7 +12,7 @@
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-plugin-utils": "workspace:^",
"regenerator-transform": "^0.15.0"
"regenerator-transform": "^0.15.1"
},
"license": "MIT",
"publishConfig": {
Expand Down

Large diffs are not rendered by default.

@@ -0,0 +1,4 @@
var f = async () => [await 0, , ];
f().then(result => {
expect(result).toStrictEqual([0, , ]);
});
@@ -0,0 +1 @@
async () => [await 0, , ];
@@ -0,0 +1,3 @@
{
"plugins": ["transform-regenerator"]
}
@@ -0,0 +1,17 @@
/*#__PURE__*/babelHelpers.asyncToGenerator( /*#__PURE__*/babelHelpers.regeneratorRuntime().mark(function _callee() {
return babelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return 0;
case 2:
_context.t0 = _context.sent;
return _context.abrupt("return", [_context.t0,,]);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
@@ -0,0 +1,9 @@
expect(() => {
var [x] = {
[Symbol.iterator]: function* () {
yield* {
[Symbol.iterator]: x => [],
};
},
};
}).toThrow(TypeError);
@@ -0,0 +1,7 @@
var [x] = {
[Symbol.iterator]: function* () {
yield* {
[Symbol.iterator]: x => [],
};
},
};
@@ -0,0 +1,6 @@
{
"plugins": [
"transform-destructuring",
"transform-regenerator"
]
}
@@ -0,0 +1,17 @@
var _Symbol$iterator = babelHelpers.defineProperty({}, Symbol.iterator, /*#__PURE__*/babelHelpers.regeneratorRuntime().mark(function _callee() {
return babelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.delegateYield(babelHelpers.defineProperty({}, Symbol.iterator, function (x) {
return [];
}), "t0", 1);
case 1:
case "end":
return _context.stop();
}
}
}, _callee);
})),
_Symbol$iterator2 = babelHelpers.slicedToArray(_Symbol$iterator, 1),
x = _Symbol$iterator2[0];

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/babel-runtime-corejs2/package.json
Expand Up @@ -15,7 +15,7 @@
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"core-js": "^2.6.12",
"regenerator-runtime": "^0.13.10"
"regenerator-runtime": "^0.13.11"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-runtime-corejs3/package.json
Expand Up @@ -14,7 +14,7 @@
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"core-js-pure": "^3.25.1",
"regenerator-runtime": "^0.13.10"
"regenerator-runtime": "^0.13.11"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-runtime/package.json
Expand Up @@ -14,7 +14,7 @@
"homepage": "https://babel.dev/docs/en/next/babel-runtime",
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"regenerator-runtime": "^0.13.10"
"regenerator-runtime": "^0.13.11"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Expand Up @@ -1042,7 +1042,7 @@ __metadata:
"@babel/template": "workspace:^"
"@babel/traverse": "workspace:^"
"@babel/types": "workspace:^"
regenerator-runtime: ^0.13.10
regenerator-runtime: ^0.13.11
terser: ^5.9.0
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -1084,7 +1084,7 @@ __metadata:
fs-readdir-recursive: ^1.0.0
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
node-environment-flags: ^1.0.5
regenerator-runtime: ^0.13.10
regenerator-runtime: ^0.13.11
rimraf: ^3.0.0
v8flags: ^3.1.1
peerDependencies:
Expand Down Expand Up @@ -3054,7 +3054,7 @@ __metadata:
"@babel/core": "workspace:^"
"@babel/helper-plugin-test-runner": "workspace:^"
"@babel/helper-plugin-utils": "workspace:^"
regenerator-transform: ^0.15.0
regenerator-transform: ^0.15.1
peerDependencies:
"@babel/core": ^7.0.0-0
languageName: unknown
Expand Down Expand Up @@ -3601,7 +3601,7 @@ __metadata:
resolution: "@babel/runtime-corejs2@workspace:packages/babel-runtime-corejs2"
dependencies:
core-js: ^2.6.12
regenerator-runtime: ^0.13.10
regenerator-runtime: ^0.13.11
languageName: unknown
linkType: soft

Expand All @@ -3610,7 +3610,7 @@ __metadata:
resolution: "@babel/runtime-corejs3@workspace:packages/babel-runtime-corejs3"
dependencies:
core-js-pure: ^3.25.1
regenerator-runtime: ^0.13.10
regenerator-runtime: ^0.13.11
languageName: unknown
linkType: soft

Expand All @@ -3627,7 +3627,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@babel/runtime@workspace:packages/babel-runtime"
dependencies:
regenerator-runtime: ^0.13.10
regenerator-runtime: ^0.13.11
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -12930,19 +12930,19 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"regenerator-runtime@npm:^0.13.10":
version: 0.13.10
resolution: "regenerator-runtime@npm:0.13.10"
checksum: 09893f5a9e82932642d9a999716b6c626dc53ef2a01307c952ebbf8e011802360163a37c304c18a6c358548be5a72b448e37209954a18696f21e438c81cbb4b9
"regenerator-runtime@npm:^0.13.10, regenerator-runtime@npm:^0.13.11":
version: 0.13.11
resolution: "regenerator-runtime@npm:0.13.11"
checksum: 27481628d22a1c4e3ff551096a683b424242a216fee44685467307f14d58020af1e19660bf2e26064de946bad7eff28950eae9f8209d55723e2d9351e632bbb4
languageName: node
linkType: hard

"regenerator-transform@npm:^0.15.0":
version: 0.15.0
resolution: "regenerator-transform@npm:0.15.0"
"regenerator-transform@npm:^0.15.0, regenerator-transform@npm:^0.15.1":
version: 0.15.1
resolution: "regenerator-transform@npm:0.15.1"
dependencies:
"@babel/runtime": ^7.8.4
checksum: 86e54849ab1167618d28bb56d214c52a983daf29b0d115c976d79840511420049b6b42c9ebdf187defa8e7129bdd74b6dd266420d0d3868c9fa7f793b5d15d49
checksum: 2d15bdeadbbfb1d12c93f5775493d85874dbe1d405bec323da5c61ec6e701bc9eea36167483e1a5e752de9b2df59ab9a2dfff6bf3784f2b28af2279a673d29a4
languageName: node
linkType: hard

Expand Down