-
-
Notifications
You must be signed in to change notification settings - Fork 713
feat(minifier): add drop_labels feature
#14634
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(minifier): add drop_labels feature
#14634
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #14634 will not alter performanceComparing Summary
Footnotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Add support for dropping labeled statements during minification via a new drop_labels option, aligning with esbuild/rolldown behavior.
- Introduces CompressOptions.drop_labels (FxHashSet) in oxc_minifier
- Implements removal of matching labeled statements in peephole optimizer
- Adds tests for dropping specific labels; wires default in napi, adds rustc-hash dep there
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| napi/minify/src/options.rs | Imports FxHashSet and sets drop_labels to default when converting to internal options |
| napi/minify/Cargo.toml | Adds rustc-hash workspace dependency |
| crates/oxc_minifier/src/options.rs | Adds drop_labels option to CompressOptions with docs and defaults |
| crates/oxc_minifier/src/peephole/remove_dead_code.rs | Removes labeled statements when label is in drop_labels |
| crates/oxc_minifier/tests/peephole/dead_code_elimination.rs | Adds tests and a helper to verify drop_labels behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
Implemented `drop_labels` feature, which is implemented in [esbuild](https://esbuild.github.io/api/#drop-labels) and [rolldown](https://rolldown.rs/apis/config-options#droplabels). The plan is to use this in Rolldown.
c635d1f to
d09c7ee
Compare

Implemented
drop_labelsfeature, which is implemented in esbuild and rolldown.The plan is to use this in Rolldown.