Not sure if a lot of people use this, but it could be convenient for simpler transforms. ESLint uses https://github.com/estools/esquery but not sure if we can just use it or we need to change something based on the AST (ideally it would be generic enough). (also found https://github.com/phenomnomnominal/tsquery)
We sorta have something you can do with "virtual ast nodes"/"aliases" but not sure how that works.
Was just sorta thinking if you wanted to target an IIFE for example (give the thing a name, it's not a normal AST node), you could do this (assuming you defined what an IIFE was somewhere):
visitor: {
IIFE(path) {
// code here
}
}
Could certainly add this as a feature but I would just implement this as a babel plugin for people to try out before actually adding it in? Just seems better to do it this way. Would be something like this for the input/output:
Writing down some idea(s):
Not sure if a lot of people use this, but it could be convenient for simpler transforms. ESLint uses https://github.com/estools/esquery but not sure if we can just use it or we need to change something based on the AST (ideally it would be generic enough). (also found https://github.com/phenomnomnominal/tsquery)
We sorta have something you can do with "virtual ast nodes"/"aliases" but not sure how that works.
https://github.com/babel/babel/blob/a3f00896f710a95ed38f2f9fb3a6e048148b0b98/packages/babel-traverse/src/path/lib/virtual-types.js#L80-L84
Was just sorta thinking if you wanted to target an IIFE for example (give the thing a name, it's not a normal AST node), you could do this (assuming you defined what an IIFE was somewhere):
Could certainly add this as a feature but I would just implement this as a babel plugin for people to try out before actually adding it in? Just seems better to do it this way. Would be something like this for the input/output:
I see there's also https://github.com/dfilatov/jspath