Here is an example:
npx @nikhilverma/ast-grep '{ meta: { title: "___" }}' src/
Here is an example:
npx @nikhilverma/ast-grep '{ meta: { title: "___" }}' src/
Have been working on something similar, although my use case is more about learning how code has changed across git commits: https://github.com/bugout-dev/locust
For Javascript/Typescript/React support, like you, I hooked into the Babel toolchain. Can't recommend it highly enough.
There's also a newish project called quick-lint-js which seems to have written their own from-scratch AST parser for JS, but I haven't tried it yet: https://github.com/quick-lint/quick-lint-js
Finally, another project that I know in this space is comby (I believe it is owned/maintained by the folks at Sourcegraph): https://comby.dev/
Don't know why I dumped all those links there. Just figured there may be something useful in them for you. Am also just super passionate about building knowledge about code bases by analyzing their ASTs. Nice to meet a fellow enthusiast. :)
const foo = () =>
and "var foo" would just match all values named foo, including functions? I don't know, I feel like there's lots of edge cases that might make this approach fall apart