-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use swc to expose an AST to the runtime #3983
Comments
This APIs should be helpful for No need to rely on node.js But I think it might be better to expose the typescript APIs typescript provides a series of AST operations |
But the AST is not serializeable (see: microsoft/TypeScript#33502)... it is highly self referential and it is not really that easy to work with compared to things like estree like ASTs. I don't know what sort of AST swc generates, but it is worth looking at. If it is easy to serialize to JSON, then it will be better, and longer term Ry and I have talked about taking that AST and feeding it to the compiler, because the parsing is orders of magnitude faster than the compiler. So starting to work with it in the runtime helps us all start to move that direction. |
We include the swc crate as part of the dprint crate in order to power
deno fmt
. We should consider exposing swc to provide a runtime AST for JavaScript and TypeScript files. While we can't use the AST (yet) to drive the compiler, it would be a useful API to have in runtime to enable innovative solutions, like AST manipulation.The text was updated successfully, but these errors were encountered: