regenerator icon indicating copy to clipboard operation
regenerator copied to clipboard

[refactor] es modules, no global polution

Open Andarist opened this issue 6 years ago • 2 comments

this would mean breaking change

So basically what I would like to do (I can prepare PRs) is to refactor packages. Changes should be pretty straightforward and would include:

  • including 2 distributions of regenerator-runtime, both commonjs and es
  • stop auto pollution of global object - we can distribute also umd bundle if somebody needs it
  • rewrite regenerator-transform to add an import for regenerator-runtime to the transformed module if needed - we can support old way (using global) with an option to the transform

Benefits:

  • no more weirdo code ;)
  • tree-shakability of the regenerator-runtime - when one uses i.e. only normal generators then parts about async functions could be tree-shaken easily

I think the module is stable and this would make for a great v1 release.

Andarist avatar Jul 21 '17 23:07 Andarist

Please feel free to submit a PR for this!

benjamn avatar Jul 23 '17 15:07 benjamn

Any update on this? With regenerator-runtime auto pollutes the global-scope, there's no way to achieve a 100% pure polyfilling without scope pollution as described in https://github.com/babel/babel-polyfills/issues/59

utrolig avatar Feb 08 '21 15:02 utrolig