GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Avoid validating visitors produced by `traverse.visitors.merge` by nicolo-ribaudo · Pull Request #16699 · babel/babel Conversation
Member
This PR marks as "already validated" all visitors produced by With this change I can get the example from #16689 (comment) to build, even if then fails with "regeneratorRuntime is not defined" (which is a completely separate problem, probably a bug in my setup)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57541 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!process.env.BABEL_8_BREAKING) { | ||
| // For compatibility with old Babel versions, we must hide _verified and _exploded. | ||
| // Otherwise, old versions of the validator will throw sayng that `true` is not | ||
| // a function, because it tries to validate it as a visitor. | ||
| Object.defineProperty(mergedVisitor, "_exploded", { enumerable: false }); | ||
| Object.defineProperty(mergedVisitor, "_verified", { enumerable: false }); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised they would fail for enumerable _exploded but still work for non-enumerable _exploded.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
They do Object.keys :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I have some concerns that visitors will still be revalidated on these versions. (I'm not sure how older versions did it)
Since they throw on _exploded, that means they probably don't follow _exploded and validate again.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
They check visitor._verified, so it works even if it's non-enumerable.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
traverse.visitors.mergetraverse.visitors.merge
|
I'll release once we land #16700 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug]: Something tricky with the latest babel/traverse
There was an error while loading. Please reload this page.