Exposes raw mappings when source map generation is enabled. To avoid the cost of source map generation for consumers of the raw mappings only, `.map` is changed to a getter that generates the source map lazily on first access.
* Use regenerator-transform to implement babel-plugin-transform-regenerator.
Though I believe this is safe to merge, you may want to wait to merge it
until https://github.com/facebook/regenerator/pull/259 is merged. That
pull request also provides more explanation of why I think moving the
implementation of Regenerator back to its original repository is a good
idea. I'm happy to compromise on anything necessary to make this happen.
Note that the regenerator-transform version is pegged to an exact version
(0.9.7). Past experience has taught me that releasing new versions of
Regenerator is almost impossible if client projects are allowed to pull in
new patch versions automatically. I will happily submit a pull request
whenever a new version is released.
* Remove never-used babel-plugin-transform-regenerator/.test directory.
* regenerator-transform to 0.9.8
* Add failing test of function parameter bindings in a catch block.
This test can be run in isolation via the following command:
TEST_GREP='block-scoping.*function in catch' make test-only
This test fails because BlockScoping#getLetReferences accidentally
considers the parameters of the function declaration as let bindings in
the catch scope. When the name of the catch parameter is the same as one
of the function's parameter names, the function declaration will be
unnecessarily wrapped to isolate its parameters from the outer scope.
While the extra wrapping may not seem harmful in this case, this behavior
is a symptom of a deeper problem that causes very subtle bugs in transform
code involving catch parameters and function declarations. This test case
was just the simplest example I could find to demonstrate the problem.
I have a proposed fix for this problem that I will push as soon as the
tests fail for this commit.
* Make BlockScoping#getLetReferences ignore function parameters.
When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
When block scoped variables caused the block to be wrapped in a closure, the variable `bindings` remained in parent function scope, which caused the JSX element to be hoisted out of the closure.