feat(swc_ecma_minifier, swc_config): add Hash/Eq for options and CachedRegex#11775
Merged
kdy1 merged 4 commits intoswc-project:mainfrom Apr 8, 2026
Merged
Conversation
…edRegex - Wrap compress global_defs in GlobalDefs with order-independent Hash (XOR + len) - Derive or implement PartialEq, Eq, Hash for MinifyOptions, CompressOptions, etc. - Implement PartialEq, Eq, Hash for CachedRegex using regex pattern (as_str)
|
|
🦋 Changeset detectedLatest commit: ca53e01 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Binary Sizes
Commit: c98079e |
Member
|
Thank you! I'll publish crates right away |
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.
Description:
I'm a member from utooland, a bundler based on turbopack. I'm working on expanding
MinifyType::Minify { mangle: ... }toMinifyType::Minify(swc_ecma_minifier::option::MinifyOptions)for turbopack.https://github.com/vercel/next.js/blob/38cffffeccbc68e0c256b4fb9aa17e23f3f308f4/turbopack/crates/turbopack-core/src/chunk/chunking_context.rs#L53-L60
But
MinifyOptionsdoesn't implementPartialEq,EqandHashtraits which are required byTaskInputtrait.https://github.com/vercel/next.js/blob/38cffffeccbc68e0c256b4fb9aa17e23f3f308f4/turbopack/crates/turbo-tasks/src/task/task_input.rs#L83-L85
So I implement required traits for
MinifyOptions.BREAKING CHANGE:
In order to implement
Hashtrait forCompressOptions::global_defstyped asFxHashMap, I added a newtype wrapper withFrom<FxHashMap<Box<Expr>, Box<Expr>>>,FromIterator<(Box<Expr>, Box<Expr>)>,DerefandDerefMutto ease migration, but this may still be a breaking change for code that depended on the field type beingFxHashMapdirectly.Related issue (if exists):
utooland/utoo#2741