Skip to main content

rspack_plugin_split_chunks/options/
cache_group_test.rs

1use std::sync::Arc;
2
3use futures::future::BoxFuture;
4use rspack_core::{Compilation, Module};
5use rspack_error::Result;
6
7pub struct CacheGroupTestFnCtx<'a> {
8  pub compilation: &'a Compilation,
9  pub module: &'a dyn Module,
10}
11
12type CacheGroupTestFn =
13  Arc<dyn Fn(CacheGroupTestFnCtx<'_>) -> BoxFuture<'static, Result<Option<bool>>> + Send + Sync>;
14
15#[derive(Clone)]
16pub enum CacheGroupTest {
17  String(String),
18  Fn(CacheGroupTestFn),
19  RegExp(rspack_regex::RspackRegex),
20  Enabled,
21}