fix(mangler): mangle non top-level exports variable#14169
fix(mangler): mangle non top-level exports variable#14169graphite-app[bot] merged 1 commit intomainfrom
exports variable#14169Conversation
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 Instrumentation Performance ReportMerging #14169 will not alter performanceComparing Summary
Footnotes
|
33bde9d to
7a090ae
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the mangler to allow mangling non top-level exports variables while preserving global exports references. The change removes the special case protection for exports parameters and local variables, allowing them to be minified for better compression.
- Removes
exportsfrom the list of special names that should never be mangled - Adds test cases to verify that
exportsparameters can be mangled while globalexportsreferences remain unchanged - Updates minsize snapshots showing improved compression across multiple JavaScript libraries
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_mangler/src/lib.rs | Removes "exports" from special names list to enable mangling of non-global exports variables |
| crates/oxc_minifier/tests/mangler/mod.rs | Adds test cases for exports mangling scenarios |
| crates/oxc_minifier/tests/mangler/snapshots/mangler.snap | Updates test snapshots showing mangled exports parameters |
| tasks/minsize/minsize.snap | Updates minsize benchmarks showing improved compression ratios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
```js
var a = function(exports) {
exports.foo = 'foo'
}
a(exports)
```
The `exports` parameter was not mangled. But it is fine to mangle this.
We need to keep the global `exports` variable as-is, but that is handled by keeping the global variable references.
refs #5965
7a090ae to
d02d750
Compare

The
exportsparameter was not mangled. But it is fine to mangle this.We need to keep the global
exportsvariable as-is, but that is handled by keeping the global variable references.refs #5965