oxc-project / backlog

backlog for collborators only
1 stars 0 forks source link

Expose AST tools as a public crate? #88

Open overlookmotel opened 3 months ago

overlookmotel commented 3 months ago

@rzvxa suggested in a Discord conversation that we might want to consider exposing AST codegen as a public crate, so that consumers of Oxc can generate code for acting on AST that's specific to their use case, but would be laborious to write by hand.

My opinion is:

  1. AST codegen is a very powerful tool, and it may well be a good idea to expose it at some point.
  2. We may not want to do that right now. We don't need to expose it, and as it's fairly new, we may have some API changes to make yet.

If/when we do, I think we'd need to break it up into multiple crates/tasks, along these kind of lines:

I think this is quite a nice separation of concerns, so not such a bad idea. But it would require major refactoring of the codegen (again!), so maybe that's another reason not to do this right now.

Open question: I'm not sure how we'd deal with it if we only do field re-ordering in release mode (due to the Rust Analyser problem). Do we have to generate two schemas for debug mode and release mode?