Skip to content

Commit

Permalink
chore: remove deprecated splitChunksPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng committed Jan 3, 2024
1 parent 64939a7 commit c206f3e
Show file tree
Hide file tree
Showing 22 changed files with 1 addition and 1,785 deletions.
15 changes: 0 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export const enum BuiltinPluginName {
WebWorkerTemplatePlugin = 'WebWorkerTemplatePlugin',
MergeDuplicateChunksPlugin = 'MergeDuplicateChunksPlugin',
SplitChunksPlugin = 'SplitChunksPlugin',
OldSplitChunksPlugin = 'OldSplitChunksPlugin',
ShareRuntimePlugin = 'ShareRuntimePlugin',
ContainerPlugin = 'ContainerPlugin',
ContainerReferencePlugin = 'ContainerReferencePlugin',
Expand Down
1 change: 0 additions & 1 deletion crates/rspack_binding_options/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ rspack_plugin_real_content_hash = { path = "../rspack_plugin_real_conten
rspack_plugin_remove_empty_chunks = { path = "../rspack_plugin_remove_empty_chunks" }
rspack_plugin_runtime = { path = "../rspack_plugin_runtime" }
rspack_plugin_schemes = { path = "../rspack_plugin_schemes" }
rspack_plugin_split_chunks = { path = "../rspack_plugin_split_chunks" }
rspack_plugin_split_chunks_new = { path = "../rspack_plugin_split_chunks_new" }
rspack_plugin_swc_css_minimizer = { path = "../rspack_plugin_swc_css_minimizer" }
rspack_plugin_swc_js_minimizer = { path = "../rspack_plugin_swc_js_minimizer" }
Expand Down
6 changes: 0 additions & 6 deletions crates/rspack_binding_options/src/options/raw_builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ pub enum BuiltinPluginName {
WebWorkerTemplatePlugin,
MergeDuplicateChunksPlugin,
SplitChunksPlugin,
OldSplitChunksPlugin,
ShareRuntimePlugin,
ContainerPlugin,
ContainerReferencePlugin,
Expand Down Expand Up @@ -237,11 +236,6 @@ impl BuiltinPlugin {
let options = downcast_into::<RawSplitChunksOptions>(self.options)?.into();
plugins.push(SplitChunksPlugin::new(options).boxed());
}
BuiltinPluginName::OldSplitChunksPlugin => {
use rspack_plugin_split_chunks::SplitChunksPlugin;
let options = downcast_into::<RawSplitChunksOptions>(self.options)?.into();
plugins.push(SplitChunksPlugin::new(options).boxed());
}
BuiltinPluginName::ShareRuntimePlugin => {
plugins.push(ShareRuntimePlugin::new(downcast_into::<bool>(self.options)?).boxed())
}
Expand Down
64 changes: 0 additions & 64 deletions crates/rspack_binding_options/src/options/raw_split_chunks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod raw_split_chunk_name;
use std::sync::Arc;

use derivative::Derivative;
use napi::bindgen_prelude::Either3;
use napi::{Either, JsString};
use napi_derive::napi;
use raw_split_chunk_name::normalize_raw_chunk_name;
Expand Down Expand Up @@ -55,69 +54,6 @@ pub struct RawSplitChunksOptions {
pub max_initial_size: Option<f64>,
}

impl From<RawSplitChunksOptions> for rspack_plugin_split_chunks::SplitChunksOptions {
fn from(value: RawSplitChunksOptions) -> Self {
use rspack_plugin_split_chunks::{CacheGroupOptions, ChunkType, SplitChunksOptions, TestFn};

let mut defaults = SplitChunksOptions {
max_async_requests: value.max_async_requests,
max_initial_requests: value.max_initial_requests,
min_chunks: value.min_chunks,
min_size: value.min_size,
enforce_size_threshold: value.enforce_size_threshold,
min_remaining_size: value.min_remaining_size,
automatic_name_delimiter: Some(DEFAULT_DELIMITER.to_string()),
chunks: value.chunks.map(|chunks| {
let Either3::B(chunks) = chunks else {
panic!("expected string")
};
let chunks = chunks.into_string();
match chunks.as_str() {
"initial" => ChunkType::Initial,
"async" => ChunkType::Async,
"all" => ChunkType::All,
_ => panic!("Invalid chunk type: {chunks}"),
}
}),
..Default::default()
};

defaults
.cache_groups
.extend(value.cache_groups.unwrap_or_default().into_iter().map(|v| {
(
v.key,
CacheGroupOptions {
// FIXME: since old split chunk will not used so I use `None` here
automatic_name_delimiter: Some(DEFAULT_DELIMITER.to_string()),
name: None,
priority: v.priority,
reuse_existing_chunk: Some(false),
test: v.test.map(|_| {
let f: TestFn = Arc::new(move |_| false);
f // FIXME: since old split chunk will not used so I use `|| -> false` here
}),
chunks: v.chunks.map(|chunks| {
let Either3::B(chunks) = chunks else {
panic!("expected string")
};
let chunks = chunks.into_string();
match chunks.as_str() {
"initial" => ChunkType::Initial,
"async" => ChunkType::Async,
"all" => ChunkType::All,
_ => panic!("Invalid chunk type: {chunks}"),
}
}),
min_chunks: v.min_chunks,
..Default::default()
},
)
}));
defaults
}
}

#[derive(Derivative, Deserialize)]
#[serde(rename_all = "camelCase")]
#[napi(object)]
Expand Down
1 change: 0 additions & 1 deletion crates/rspack_binding_values/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ rspack_plugin_real_content_hash = { path = "../rspack_plugin_real_conten
rspack_plugin_remove_empty_chunks = { path = "../rspack_plugin_remove_empty_chunks" }
rspack_plugin_runtime = { path = "../rspack_plugin_runtime" }
rspack_plugin_schemes = { path = "../rspack_plugin_schemes" }
rspack_plugin_split_chunks = { path = "../rspack_plugin_split_chunks" }
rspack_plugin_split_chunks_new = { path = "../rspack_plugin_split_chunks_new" }
rspack_plugin_swc_css_minimizer = { path = "../rspack_plugin_swc_css_minimizer" }
rspack_plugin_swc_js_minimizer = { path = "../rspack_plugin_swc_js_minimizer" }
Expand Down
17 changes: 0 additions & 17 deletions crates/rspack_plugin_split_chunks/Cargo.toml

This file was deleted.

22 changes: 0 additions & 22 deletions crates/rspack_plugin_split_chunks/LICENSE

This file was deleted.

34 changes: 0 additions & 34 deletions crates/rspack_plugin_split_chunks/src/cache_group.rs

This file was deleted.

36 changes: 0 additions & 36 deletions crates/rspack_plugin_split_chunks/src/cache_group_source.rs

This file was deleted.

33 changes: 0 additions & 33 deletions crates/rspack_plugin_split_chunks/src/chunks_info_item.rs

This file was deleted.

35 changes: 0 additions & 35 deletions crates/rspack_plugin_split_chunks/src/lib.rs

This file was deleted.

9 changes: 0 additions & 9 deletions crates/rspack_plugin_split_chunks/src/max_size_queue_item.rs

This file was deleted.

This file was deleted.

Loading

0 comments on commit c206f3e

Please sign in to comment.