Skip to content

Commit

Permalink
fix: Bump regenerator and add tests (#15841)
Browse files Browse the repository at this point in the history
* fix: Bump `regenerator` and add tests

* Regenerate output.js

* Regenerate output.js
  • Loading branch information
SuperSodaSea authored Aug 5, 2023
1 parent a8f041b commit f7b472c
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/babel-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@babel/generator": "workspace:^",
"@babel/helper-plugin-test-runner": "workspace:^",
"@babel/parser": "workspace:^",
"regenerator-runtime": "^0.13.11",
"regenerator-runtime": "^0.14.0",
"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.

8 changes: 2 additions & 6 deletions packages/babel-helpers/src/helpers/regeneratorRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export default function _regeneratorRuntime() {
};
};
function values(iterable) {
if (iterable) {
if (iterable || iterable === "") {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
Expand All @@ -508,11 +508,7 @@ export default function _regeneratorRuntime() {
return (next.next = next);
}
}

// Return an iterator with no values.
return {
next: doneResult,
};
throw new TypeError(typeof iterable + " is not iterable");
}
exports.values = values;
function doneResult() {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"commander": "^4.0.1",
"core-js": "^3.30.2",
"node-environment-flags": "^1.0.5",
"regenerator-runtime": "^0.13.11",
"regenerator-runtime": "^0.14.0",
"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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-plugin-utils": "workspace:^",
"regenerator-transform": "^0.15.1"
"regenerator-transform": "^0.15.2"
},
"license": "MIT",
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function* f(x) {
yield* x;
};

expect(() => f(undefined).next()).toThrow(TypeError);
expect(() => f(null).next()).toThrow(TypeError);
expect(() => f(false).next()).toThrow(TypeError);
expect(() => f(true).next()).toThrow(TypeError);
expect(() => f(0).next()).toThrow(TypeError);
expect(() => f(1).next()).toThrow(TypeError);
expect(() => f({}).next()).toThrow(TypeError);

// #15172
expect(() => {
var [x] = {
[Symbol.iterator]: function* () {
yield* 0;
},
};
}).toThrow(TypeError);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// #15172
var [x] = {
[Symbol.iterator]: function* () {
yield* 0;
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
"transform-destructuring",
"transform-regenerator"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// #15172
var _Symbol$iterator = {
[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(0, "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.

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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"core-js": "^2.6.12",
"regenerator-runtime": "^0.13.11"
"regenerator-runtime": "^0.14.0"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-runtime-corejs3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"core-js-pure": "^3.30.2",
"regenerator-runtime": "^0.13.11"
"regenerator-runtime": "^0.14.0"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-runtime/package.json
Original file line number Diff line number Diff line change
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.11"
"regenerator-runtime": "^0.14.0"
},
"exports": {
"./helpers/AsyncGenerator": [
Expand Down
27 changes: 17 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ __metadata:
"@babel/template": "workspace:^"
"@babel/traverse": "workspace:^"
"@babel/types": "workspace:^"
regenerator-runtime: ^0.13.11
regenerator-runtime: ^0.14.0
terser: ^5.9.0
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -1094,7 +1094,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.11
regenerator-runtime: ^0.14.0
rimraf: ^3.0.0
v8flags: ^3.1.1
peerDependencies:
Expand Down Expand Up @@ -3263,7 +3263,7 @@ __metadata:
"@babel/core": "workspace:^"
"@babel/helper-plugin-test-runner": "workspace:^"
"@babel/helper-plugin-utils": "workspace:^"
regenerator-transform: ^0.15.1
regenerator-transform: ^0.15.2
peerDependencies:
"@babel/core": ^7.0.0-0
languageName: unknown
Expand Down Expand Up @@ -3894,7 +3894,7 @@ __metadata:
resolution: "@babel/runtime-corejs2@workspace:packages/babel-runtime-corejs2"
dependencies:
core-js: ^2.6.12
regenerator-runtime: ^0.13.11
regenerator-runtime: ^0.14.0
languageName: unknown
linkType: soft

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

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

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

"regenerator-transform@npm:^0.15.1":
version: 0.15.1
resolution: "regenerator-transform@npm:0.15.1"
"regenerator-runtime@npm:^0.14.0":
version: 0.14.0
resolution: "regenerator-runtime@npm:0.14.0"
checksum: 1c977ad82a82a4412e4f639d65d22be376d3ebdd30da2c003eeafdaaacd03fc00c2320f18120007ee700900979284fc78a9f00da7fb593f6e6eeebc673fba9a3
languageName: node
linkType: hard

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

Expand Down

0 comments on commit f7b472c

Please sign in to comment.