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

Pass Promise as a parameter to regeneratorRuntime.async() #383

Merged
merged 4 commits into from Feb 20, 2020

Conversation

nicolo-ribaudo
Copy link
Contributor

@nicolo-ribaudo nicolo-ribaudo commented Jan 13, 2020

This makes it possible to run @babel/plugin-transform-runtime and @babel/preset-env's useBuiltIns on regenerator's output to provide a Promise polyfill in old browsers.

Fixes babel/babel#10678, babel/babel#10830

This makes it possible to run @babel/plugin-transform-runtime on
regenerator's output to provide a Promise polyfill in old browsers.
Copy link
Collaborator

@benjamn benjamn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together @nicolo-ribaudo! I honestly wish native async functions could have their Promise implementation reconfigured like this.

packages/regenerator-runtime/runtime.js Outdated Show resolved Hide resolved
@benjamn
Copy link
Collaborator

benjamn commented Feb 19, 2020

@nicolo-ribaudo Do you think this should be a minor version bump for regenerator-runtime and/or regenerator-transform, or is it fully backwards compatible?

Co-Authored-By: Ben Newman <ben@benjamn.com>
@nicolo-ribaudo
Copy link
Contributor Author

nicolo-ribaudo commented Feb 19, 2020

This is fully backwards compatible.

It could only break if someone did already pass a fifth parameter to regeneratorRuntime.async, but since no one calls it directly (it's only called by the generated code), it shouldn't be a problem in practice.

@benjamn benjamn merged commit 491714f into facebook:master Feb 20, 2020
@nicolo-ribaudo
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using @babel/runtime-corejs* still uses the global Promise for generators/async-fns
3 participants