benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
MIT License
4.99k stars 349 forks source link

Feature request: option to pass our own ast-types fork to recast #1283

Open jedwards1211 opened 1 year ago

jedwards1211 commented 1 year ago

This is something I might try to make a PR for soon...

For astx I have started building my own custom fork of ast-types from metadata in @babel/types so that it never lags behind what babel is able to parse.

However I'm running into #1230 because even if I build my own ast-types fork, I can't make recast use it.

The only long-term solution to issues like #1230 is to be able to do something like

const ast = recast.parse(code, {
  parser: myConfiguredBabelParser,
  types: myConfiguredAstTypes,
})