feat(codegen): a way to keep legal comments after minification#10689
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
|
@Dunqing can you double check Should these nodes be pure so that pure comments gets printed? |
CodSpeed Instrumentation Performance ReportMerging #10689 will not alter performanceComparing Summary
|
Yes, they should be printed. I don't know why they disappeared before. |
56c8b9f to
29acf1a
Compare
Merge activity
|
2110373 to
344779e
Compare
WalkthroughThis set of changes refactors and expands the handling of code generation options related to comments in the codebase. The previous single boolean flag for printing comments is replaced with three distinct flags: Possibly related issues
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (11)
⏰ Context from checks skipped due to timeout of 90000ms (6)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
344779e to
6928736
Compare
6928736 to
9773a0c
Compare
fixes rolldown/rolldown#4118 fixes #10626 At present, there is no option to keep legal comments when minification is turn on. This PR allows Codegen to set legal comments with minfication turned on, with the following behavior: * Inline: only if the attached code is not removed * Eof: move all legal comments to the end of file, regardless of where they appear * Linked and External: saved into `CodegenReturn::legal_comments` for the caller to use, regardless of where they appear Code gets moved around or removed if minifier is turned on, so some legal comments may disappear from the final output. The recommended legal comment option is Eof. --- For Rolldown to keep legal comments, it should set `LegalComment::Inline` for chunk codegen and `LegalComment::Eof` for minification codegen.
fixes rolldown/rolldown#4118 fixes #10626 At present, there is no option to keep legal comments when minification is turn on. This PR allows Codegen to set legal comments with minfication turned on, with the following behavior: * Inline: only if the attached code is not removed * Eof: move all legal comments to the end of file, regardless of where they appear * Linked and External: saved into `CodegenReturn::legal_comments` for the caller to use, regardless of where they appear Code gets moved around or removed if minifier is turned on, so some legal comments may disappear from the final output. The recommended legal comment option is Eof. --- For Rolldown to keep legal comments, it should set `LegalComment::Inline` for chunk codegen and `LegalComment::Eof` for minification codegen.
9773a0c to
b01cb45
Compare
fixes rolldown/rolldown#4118
fixes #10626
At present, there is no option to keep legal comments when minification is turn on.
This PR allows Codegen to set legal comments with minfication turned on, with the following behavior:
CodegenReturn::legal_commentsfor the caller to use, regardless of where they appearCode gets moved around or removed if minifier is turned on, so some legal comments may disappear from the final output.
The recommended legal comment option is Eof.
For Rolldown to keep legal comments, it should set
LegalComment::Inlinefor chunk codegen andLegalComment::Eoffor minification codegen.