Babel does not deal well with multiple references to the same node in a single AST. Specifically it can lead to NodePaths not being unique and therefore to incorrect scope analyses - see https://github.com/babel/babel/issues/6375 for pointers to manifestations of this in Babel.
These days, Babel's test suite ensures that Babel's first-party plugins do not emit such duplicates (https://github.com/babel/babel/pull/7149) but there is no such guarantee for third-party plugins.
This PR:
fixes the logic in inline-requires to avoid emitting repeated nodes.
adds tests to all the Babel plugins in this repo asserting that there are no repeated nodes in the resulting ASTs.
Babel does not deal well with multiple references to the same node in a single AST. Specifically it can lead to
NodePath
s not being unique and therefore to incorrect scope analyses - see https://github.com/babel/babel/issues/6375 for pointers to manifestations of this in Babel.These days, Babel's test suite ensures that Babel's first-party plugins do not emit such duplicates (https://github.com/babel/babel/pull/7149) but there is no such guarantee for third-party plugins.
This PR:
inline-requires
to avoid emitting repeated nodes.