@babel/traverse compatible esquery port
npm install babylon-querybabylon-query queries a Babylon AST using a esquery-style syntax to define syntactic filters, and returning @babel/traverse-ready NodePaths.
Try the demonstration here!
Selector types:
* Type Identifier
Wildcard
* Negation :not(Identifier, ExpressionStatement)
* Matches-Any :is(Identifier, ExpressionStatement)
* Relational :has(> Identifier.id)
* Ancestry CallStatement.body:is(BlockStatement).body.0
* Attribute
* Root path :root
* :nth-child
* nth-child(3n+1)
* first-child
* last-child
* Combinators
* Descendant
* Child >
* Next-sibling +
* Subsequent-sibling ~