fix(tasks/allocations): before minification, transform to esnext and update minifier examples#13453
fix(tasks/allocations): before minification, transform to esnext and update minifier examples#13453
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. |
Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
--max-iterations parameter to DCE minifier example
- Add oxc_semantic and oxc_transformer dependencies to track_memory_allocations - Transform TypeScript to ESNext before minification in both warm-up and measurement loops - Update allocation snapshots to reflect TypeScript transformation overhead - Enables minifier to work correctly on TypeScript files by transforming them first Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
I've completely rewritten the PR based on PR #13445. The changes now fix the memory allocation tracking task by transforming TypeScript to ESNext before minification, rather than adding DCE parameters. This allows the minifier to work correctly on all TypeScript test files. See commit 5ccb855. |
--max-iterations parameter to DCE minifier example|
@copilot update the code in the minifier example to run it through the transformer before minifyong |
…ation - Add oxc_transformer dependency to minifier examples - Transform TypeScript to ESNext before minification in minifier.rs and dce.rs examples - Enables minifier examples to work correctly on TypeScript files - Maintains backward compatibility with JavaScript files Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
I've updated the minifier examples to run TypeScript files through the transformer before minifying. The changes include:
The examples now correctly handle TypeScript files by detecting the source type and applying transformation when needed. See commit bf9bbb3. |
This PR fixes the memory allocation tracking task by transforming TypeScript to ESNext before minification and updates the minifier examples to handle TypeScript files correctly.
Problem
The memory allocation tracking task in
tasks/track_memory_allocationswas skipping TypeScript files during minification because the minifier only works on ESNext JavaScript. Additionally, the minifier examples couldn't process TypeScript files, limiting their usefulness for testing and demonstration purposes.Solution
Memory Allocation Tracking:
oxc_semanticandoxc_transformerdependencies to enable TypeScript transformationMinifier Examples Enhancement:
minifier.rsanddce.rsexamples to detect TypeScript files and transform them to ESNext before minificationoxc_transformerdependency to minifier examplesTesting
Create a TypeScript test file and run the examples:
# Now works with TypeScript files cargo run -p oxc_minifier --example minifier test.ts --mangle --nospace cargo run -p oxc_minifier --example dce test.ts --nospaceThe changes ensure that:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.