Join GitHub today
Create InterpreterDirective AST node type and use to replace babel/core File's 'shebang' handling #7928
Both of these bugs were essentially because of the way we removed the shebang up front, meaning it was totally separated from the normal babel-generator codegen process.
This is another divergence from ESTree, but we've also got https://github.com/bmeck/proposal-hashbang as an active proposal anyway, so it seems like adding an AST node for this isn't too unreasonable.
I was considering adding a Babylon plugin and auto-enabling it in babel-core, but then I realized Babylon was already parsing shebangs and sticking it in a comment, which I think is even weirder. So this essentially means that any third-parties using Babylon directly and not through Babel will see changed behavior, but no-one using Babel.