feat: support extractComments in swcMinify#665
Conversation
|
Sorry I made a mistake with AI (codex). My intention was to open this after publishing a new version of SWC. I'll undraft this after publishing a new version. |
|
@kdy1 could you sign the CLA? |
|
@kdy1 feel free to ping when it was ready and we will make a release |
|
Sorry for the delay. I'm trying to deploy (again) it with https://github.com/swc-project/swc/actions/runs/24608184505 The previous run failed in a strange way. |
|
@alexander-akait I think this PR is good to go. Thank you for waiting 😄 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
=======================================
Coverage 96.76% 96.76%
=======================================
Files 3 3
Lines 340 340
Branches 126 126
=======================================
Hits 329 329
Misses 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Can someone approve the CI run again? |
|
Done |
|
@kdy1 ignore CI failed, I will finish your PR (today/tomorrow), want to make some types improvement too |
This wires
extractCommentsintoTerserPlugin.swcMinifyfor SWC builds that support comment extraction.What changed:
extractCommentsconditions for SWC (boolean,"some","all", string patterns,RegExpwithout flags, and object conditions that resolve to those forms)extractComments: falseis used withswcMinifyresult.extractedCommentsback to the plugin so existing filename/banner handling keeps workingswcMinifycoverage for default extraction, object{ condition, filename, banner }, disabled extraction, and unsupported function conditions@swc/coreruntime version gate and rely on the installed SWC build to accept or reject the forwarded optionVerification:
npm run buildnpx jest test/minify-option.test.js --runInBandnpm run lint:code -- src/utils.js test/minify-option.test.jsnpx prettier --check README.md src/utils.js test/minify-option.test.js types/utils.d.ts