feat: support extractComments in swcMinify#665
Open
kdy1 wants to merge 4 commits intowebpack:mainfrom
Open
Conversation
Author
|
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. |
Member
|
@kdy1 could you sign the CLA? |
Member
|
@kdy1 feel free to ping when it was ready and we will make a release |
Author
|
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. |
Author
|
@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 125 -1
=======================================
Hits 329 329
Misses 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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