refactor(new_split_chunks): remove unused code and add more comments #2947
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.
Related issue (if exists)
Summary
🤖 Generated by Copilot at b4f70db
This pull request refactors the
rspack_plugin_split_chunks_new
crate, which implements a plugin for therspack
web bundler that splits modules into chunks based on cache groups. It introduces new structsChunk
andMatchedItem
to simplify the logic and data structures of the plugin, and it improves the readability, error handling, and debugging of the code. It also removes some unused and redundant types and fields.Walkthrough
🤖 Generated by Copilot at b4f70db
get_corresponding_chunk
to create or find a chunk for a module group (link)name
field ofModuleGroup
tochunk_name
and move the struct definition tocommon.rs
(link, link)prepare_module_and_chunks_info_map
method toprepare_module_group_map
and change the return type toDashMap<String, ModuleGroup>
(link, link)MatchedItem
to represent a module that meets the requirements of a cache group (link, link)used_chunks
parameter and variable tooriginal_chunks
in themove_modules_to_new_chunk_and_remove_from_old_chunks
method (link, link)new_chunk_ukey
is not equal to theoriginal_chunk
in thesplit_from_original_chunks
method (link)CacheGroupNameGetter
fromcommon.rs
(link)_OverallOptions
and an unused field foroverall
from theSplitChunksPlugin
struct (link, link)iter
variable in thefind_best_module_group
method (link)MatchedItem
struct (link)