-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
feat(parser,codegen): print comment #1046
Comments
Is it possible to configure parsing and retain all comments |
I'll need at least the esbuild behaviour to make the transformer a viable Vite plugin! |
Just to weigh in a little to help prioritize -- without comments, the I know this is probably a super annoying and invasive change to make to oxc but as someone who adopted and then had to un-adopt the |
Related: #1046 (comment) Close: #6024
Codegen now prints useful comments such as jsdoc, vite / webpack specials, pure annotations. The remaining issue is print all comments, which is really difficult, I'll revisit them when requirements arises. Close as finished in the meantime. |
Yeah you can get to at least 38m downloads without printing comments 😁 |
Research
After studying babel, esbuild and prettier, I'm leaning towards storing extra data for linking ast node and comments, the data is processed and saved in the parser.
References:
We have the following requirements:
oxc_prettier
needs comment attachment info for printing commentsoxc_codegen
needs to print special comments for bundlers, e.g. webpack / vite special comments and side effect commentsProposal
Trivias
for associating ast nodes, preferably AST node ID (we can use the allocator address API today) to ASTKindThe text was updated successfully, but these errors were encountered: