As mentioned on the task https://phabricator.babeljs.io/T7179 having this cache on the AST leads to all sorts of portability and reuse bugs. This moves the cache into a clearable WeakMap which will fix the following: 1. Moving the AST between different babel versions or tools will not lead into sharing potentially outdated cached information 2. `.clear()` can be called on the cache by a plugin to clear potentially outdated information. This is helpful when implementing two seperate pipelines that should not share information. I think the next step (which is harder, I tried) is to isolate cache and make it live on a transform or pipeline level state (like the `hub`). The reason it is hard is because the `babel-traverse` main API -- although requires the state object to be passed -- not many callers do. To fix this we should release a patch version that warns about this and fix all the internal callers. Next couple of releases we can start throwing when no state is passed (or we can create our own state).
The compiler for writing next generation JavaScript.
Looking for support?
For questions and support please visit the discussion forum, Slack community, or StackOverflow.
Want to report a bug or request a feature?
Bugs and feature requests should be posted at phabricator.babeljs.io.
Want to report an issue with babeljs.io?
For documentation and website issues please visit the babel.github.io repo.
Description
Languages
JavaScript
99.5%
Makefile
0.3%
HTML
0.1%