* Replace lodash 'values' usage with Object.keys => .map(obj[key])
* Block scoping: refactor letReferences, outsideLetReferences as objects of type Map
* Remove lodash dependency from babel-plugin-transform-block-scoping
* Fixup: Add missing Object.keys call
* Fixup: Update remaining property accessors
* Coerce Map.values() iterator results into an array via spread operator
* Fixup: Map.put -> Map.set
* Fixup: undo incorrect variable de-duplication
* Replace array-spread-plus-map combination with Array.from call
* Extract an extendMap function as an attempt to create an optimization boundary
* Experiment: cast objects to string (eliminates one Map/object difference per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )
* Fixup: perform String cast on map keys, not values
* Revert "Fixup: perform String cast on map keys, not values"
This reverts commit abdd147438fa74f51ac50ef1f96bb462810cd3f2.
* Revert "Experiment: cast objects to string (eliminates one Map/object difference per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )"
This reverts commit a4035c885b37bfd6e926a0362bda9dcf5b5a52c2.
* Experiment: filter keys via Object.prototype.hasOwnProperty.call
* Revert "Experiment: filter keys via Object.prototype.hasOwnProperty.call"
This reverts commit 491c093f213c6229815b2e6dc9243245376265b0.
* Migrate back from Map-based reference storage to Object-based storage; access performance appears much improved for Object property access
* Revert "Migrate back from Map-based reference storage to Object-based storage; access performance appears much improved for Object property access"
This reverts commit 2119acc7f0d78ced3b9ad77820b4b72e5ad67475.
* Iterate over a clone of outsideRefs keys
* Revert "Extract an extendMap function as an attempt to create an optimization boundary"
This reverts commit 85689f2bfc180d0b5c0e674e5de7954470c7ec69.
* Fixup: migrate remaining Object property access to Map.get in tdz module
* fix: should not remove let binding even it is wrapped in closure
Fixes#10339
* fix: remove bindings defined in blockScope when wrapped in closure
* Move test assertions to the top level to ensure that they run
* Better tdz tests
- Use jest's expect.toThrow/expect.not.toThrow
- Add input/output tests
* Fix basic tdz (a = 2; let a)
Fixes#6848
* Make _guessExecutionStatusRelativeTo more robust
* Add tests
* Return less "unkown" execution status
* "function" execution status does not exist
* Fix recursive functions
* Update helper version
* "finally" blocks are always executed
* Typo
In https://github.com/babel/babel/issues/9511 (and #9495 is another symptom), @PavelKastornyy reported a node crash becaue the JavaScript heap run out of memory. The problem was that their code was adding enumerable properties to `Object.prototype`: it is something that shouldn't be done, but Babel shouldn't make node crash if someone adds them.
I reduced down the problem to `for...in` loops in `@babel/traverse` that grew the memory consumption exponentially because of that unexpected properties.
* rename colliding let bindings with for loop init
* added complex test case to check if loop init collisions were handled correctly
* updated test files
* Add test case for simple reference in tdz
* Add more examples from old issues as test cases
* Fix two testcases by excluding function declarations from being tdz checked
* Document the option for block-scoping
* Add test cases with destructuring assignments
* Remove failing test cases
* [skip ci] Include type and default value for options
`this.blockPath.get("body")` constructs an array of paths corresponding to each node in `blocks.body` so takes O(n) time if n is that length. We were re-constructing that array on each iteration, so the entire loop was O(n^2).
On files with many statements in a single block (such as Rollup-generated bundles), this takes a large portion of time. In particular, this makes transforming react-dom.development.js about 40% faster. Not that you should be transforming our bundle with Babel.
Test Plan:
Make an HTML file with these three lines and watch it in the Chrome Performance tab to see timings (on my machine: 2.9s before, 1.6s after):
```
<!DOCTYPE html>
<script src="https://unpkg.com/babel-standalone@7.0.0-beta.3/babel.js"></script>
<script type="text/babel" src="https://unpkg.com/react-dom@16.2.0/umd/react-dom.development.js"></script>
```