From 18a4c52a841332d4cc6d641d8cee156a57fc774b Mon Sep 17 00:00:00 2001 From: Fy <1114550440@qq.com> Date: Thu, 15 Aug 2024 16:59:17 +0800 Subject: [PATCH] feat: extract-css-plugin supports layer (#7583) --- Cargo.lock | 1 + crates/node_binding/binding.d.ts | 2 +- .../plugins/css_extract_additional_data.rs | 41 ++++-------------- .../src/compilation/mod.rs | 2 + .../src/compiler/module_executor/execute.rs | 4 +- .../src/compiler/module_executor/mod.rs | 2 + crates/rspack_plugin_extract_css/Cargo.toml | 1 + .../src/css_dependency.rs | 19 +++++--- .../src/css_module.rs | 41 +++++++++++++----- .../src/parser_plugin.rs | 17 ++++---- .../rspack_plugin_extract_css/src/plugin.rs | 43 +++++++++++++------ packages/rspack/etc/api.md | 3 +- .../src/builtin-plugin/css-extract/loader.ts | 16 ++----- packages/rspack/src/config/adapterRuleUse.ts | 2 +- packages/rspack/src/loader-runner/index.ts | 2 + .../cases/at-import-layer/expected/main.css | 2 +- .../cases/at-import-layer/test.filter.js | 2 - ...js.$b470ca82f8ee5c2da18fa687c2178e3d$.css} | 0 ...js.$c468cd1246827e0c2204c1830c235ec4$.css} | 0 ...in.$d4641399bd65817bb933f6126404706d$.css} | 0 ...yA.$89bd96c1999014f578f3919f80e90777$.css} | 0 ...yB.$258372b94aba7cf7773edad684cfb7f4$.css} | 0 ...in.$5dd17a3bf1a2f969ec0edfa5a446d38f$.css} | 0 ...in.$6fa338b85cf3ead72beb9d07663b81a0$.css} | 0 .../cases/issue-6649/expected/main.js | 4 +- .../issue-css-loader-1503-2/test.filter.js | 2 - ....$6801f44433f215d57d5ae0536124eb1e$.2.css} | 0 ....$bbffdf56250bca63f573b437fef250d9$.1.css} | 0 28 files changed, 111 insertions(+), 95 deletions(-) delete mode 100644 tests/plugin-test/css-extract/cases/at-import-layer/test.filter.js rename tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/{one_js.$4b5109fbbb7c7970bd73f145985a8713$.css => one_js.$b470ca82f8ee5c2da18fa687c2178e3d$.css} (100%) rename tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/{two_js.$765cfc26ddecf262088215f69c92da3e$.css => two_js.$c468cd1246827e0c2204c1830c235ec4$.css} (100%) rename tests/plugin-test/css-extract/cases/contenthash-1/expected/{main.$c414a55a331514d313ce34913a677700$.css => main.$d4641399bd65817bb933f6126404706d$.css} (100%) rename tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/{entryA.$5038057b5dc54d459c2090d9455373d6$.css => entryA.$89bd96c1999014f578f3919f80e90777$.css} (100%) rename tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/{entryB.$8ddf1fb367ac73deeba175a1de156238$.css => entryB.$258372b94aba7cf7773edad684cfb7f4$.css} (100%) rename tests/plugin-test/css-extract/cases/contenthash/expected/{1.main.$7a92eedfa1f9813bd6a40e1910d3ecc0$.css => 1.main.$5dd17a3bf1a2f969ec0edfa5a446d38f$.css} (100%) rename tests/plugin-test/css-extract/cases/contenthash/expected/{2.main.$4f43297fc0af2c899c5e56fd341c7258$.css => 2.main.$6fa338b85cf3ead72beb9d07663b81a0$.css} (100%) delete mode 100644 tests/plugin-test/css-extract/cases/issue-css-loader-1503-2/test.filter.js rename tests/plugin-test/css-extract/cases/js-hash/expected/{style.$cdffad3f0b38fa11c50b5a3ca2766a33$.2.css => style.$6801f44433f215d57d5ae0536124eb1e$.2.css} (100%) rename tests/plugin-test/css-extract/cases/js-hash/expected/{style.$33888ee88d16a14ff101cdf362266f8f$.1.css => style.$bbffdf56250bca63f573b437fef250d9$.1.css} (100%) diff --git a/Cargo.lock b/Cargo.lock index ea3a72cbbf1..7d1ab8bd99f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3583,6 +3583,7 @@ dependencies = [ "rspack_plugin_runtime", "rspack_util", "rustc-hash 1.1.0", + "serde", "serde_json", "tracing", "ustr-fxhash", diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index e7557595454..52eeb1868eb 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -114,7 +114,7 @@ export class JsCompilation { addMissingDependencies(deps: Array): void addBuildDependencies(deps: Array): void rebuildModule(moduleIdentifiers: Array, f: (...args: any[]) => any): void - importModule(request: string, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: (...args: any[]) => any): void + importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: (...args: any[]) => any): void get entries(): JsEntries } diff --git a/crates/rspack_binding_options/src/plugins/css_extract_additional_data.rs b/crates/rspack_binding_options/src/plugins/css_extract_additional_data.rs index ed3bcb02995..55a81a368c5 100644 --- a/crates/rspack_binding_options/src/plugins/css_extract_additional_data.rs +++ b/crates/rspack_binding_options/src/plugins/css_extract_additional_data.rs @@ -8,7 +8,7 @@ use rspack_error::Result; use rspack_hook::{plugin, plugin_hook}; use rspack_loader_runner::AdditionalData; use rspack_napi::{threadsafe_js_value_ref::ThreadsafeJsValueRef, JsCallback, NapiResultExt}; -use rspack_plugin_extract_css::{CssExtractJsonData, CssExtractJsonDataList}; +use rspack_plugin_extract_css::CssExtractJsonDataList; use tokio::sync::oneshot; #[plugin] @@ -43,37 +43,14 @@ async fn additional_data(&self, additional_data: &mut AdditionalData) -> Result< && let Ok(data) = data.coerce_to_object() && let Ok(Some(data)) = data.get::<_, String>("css-extract-rspack-plugin") { - let mut list = data.split("__RSPACK_CSS_EXTRACT_SEP__"); - let mut data_list = vec![]; - while let Some(identifier) = list.next() { - #[allow(clippy::unwrap_used)] - { - // parse the css data from js loader - // data: - // [identifier]__RSPACK_CSS_EXTRACT_SEP__ - // [content]__RSPACK_CSS_EXTRACT_SEP__ - // [context]__RSPACK_CSS_EXTRACT_SEP__ - // [media]__RSPACK_CSS_EXTRACT_SEP__ - // [supports]__RSPACK_CSS_EXTRACT_SEP__ - // [sourceMap]__RSPACK_CSS_EXTRACT_SEP__ - // [identifier]__RSPACK_CSS_EXTRACT_SEP__ ... repeated - // [content]__RSPACK_CSS_EXTRACT_SEP__ - data_list.push(CssExtractJsonData { - identifier: identifier.into(), - content: list.next().unwrap().into(), - context: list.next().unwrap().into(), - media: list.next().unwrap().into(), - supports: list.next().unwrap().into(), - source_map: list.next().unwrap().into(), - identifier_index: list - .next() - .unwrap() - .parse() - .expect("Cannot parse identifier_index, this should never happen"), - filepath: list.next().unwrap().into(), - }); - } - } + let data_list: Vec = data + .split("__RSPACK_CSS_EXTRACT_SEP__") + .map(|info| { + serde_json::from_str(info) + .unwrap_or_else(|e| panic!("failed to parse CssExtractJsonData: {}", e)) + }) + .collect(); + old_data.insert(CssExtractJsonDataList(data_list)); }; tx.send(old_data) diff --git a/crates/rspack_binding_values/src/compilation/mod.rs b/crates/rspack_binding_values/src/compilation/mod.rs index 231eb9e3153..e3662a250b6 100644 --- a/crates/rspack_binding_values/src/compilation/mod.rs +++ b/crates/rspack_binding_values/src/compilation/mod.rs @@ -470,6 +470,7 @@ impl JsCompilation { &'static self, env: Env, request: String, + layer: Option, public_path: Option, base_uri: Option, original_module: Option, @@ -485,6 +486,7 @@ impl JsCompilation { let result = module_executor .import_module( request, + layer, public_path.map(|p| p.into()), base_uri, original_module_context.map(rspack_core::Context::from), diff --git a/crates/rspack_core/src/compiler/module_executor/execute.rs b/crates/rspack_core/src/compiler/module_executor/execute.rs index 4c8bf00ee78..db14705659f 100644 --- a/crates/rspack_core/src/compiler/module_executor/execute.rs +++ b/crates/rspack_core/src/compiler/module_executor/execute.rs @@ -45,6 +45,7 @@ pub struct ExecuteModuleResult { #[derive(Debug)] pub struct ExecuteTask { pub entry_dep_id: DependencyId, + pub layer: Option, pub public_path: Option, pub base_uri: Option, pub result_sender: Sender<( @@ -63,6 +64,7 @@ impl Task for ExecuteTask { fn sync_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { let Self { entry_dep_id, + layer, public_path, base_uri, result_sender, @@ -118,7 +120,7 @@ impl Task for ExecuteTask { filename: None, library: None, depend_on: None, - layer: None, + layer, }), }); diff --git a/crates/rspack_core/src/compiler/module_executor/mod.rs b/crates/rspack_core/src/compiler/module_executor/mod.rs index 34292fb6b21..5c4272324e4 100644 --- a/crates/rspack_core/src/compiler/module_executor/mod.rs +++ b/crates/rspack_core/src/compiler/module_executor/mod.rs @@ -167,6 +167,7 @@ impl ModuleExecutor { pub async fn import_module( &self, request: String, + layer: Option, public_path: Option, base_uri: Option, original_module_context: Option, @@ -198,6 +199,7 @@ impl ModuleExecutor { param, ExecuteTask { entry_dep_id: dep_id, + layer, public_path, base_uri, result_sender: tx, diff --git a/crates/rspack_plugin_extract_css/Cargo.toml b/crates/rspack_plugin_extract_css/Cargo.toml index c1cbf25de37..1cb712930e6 100644 --- a/crates/rspack_plugin_extract_css/Cargo.toml +++ b/crates/rspack_plugin_extract_css/Cargo.toml @@ -18,6 +18,7 @@ rspack_plugin_javascript = { version = "0.1.0", path = "../rspack_plugin_javascr rspack_plugin_runtime = { version = "0.1.0", path = "../rspack_plugin_runtime" } rspack_util = { version = "0.1.0", path = "../rspack_util" } rustc-hash = { workspace = true } +serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } tracing = { workspace = true } ustr = { workspace = true } diff --git a/crates/rspack_plugin_extract_css/src/css_dependency.rs b/crates/rspack_plugin_extract_css/src/css_dependency.rs index 548bf41853d..dd0dc0f5ef6 100644 --- a/crates/rspack_plugin_extract_css/src/css_dependency.rs +++ b/crates/rspack_plugin_extract_css/src/css_dependency.rs @@ -15,9 +15,10 @@ pub struct CssDependency { pub(crate) identifier: String, pub(crate) content: String, pub(crate) context: String, - pub(crate) media: String, - pub(crate) supports: String, - pub(crate) source_map: String, + pub(crate) media: Option, + pub(crate) supports: Option, + pub(crate) source_map: Option, + pub(crate) layer: Option, // One module can be split apart by using `@import` in the middle of one module pub(crate) identifier_index: u32, @@ -37,11 +38,12 @@ impl CssDependency { #[allow(clippy::too_many_arguments)] pub(crate) fn new( identifier: String, + layer: Option, content: String, context: String, - media: String, - supports: String, - source_map: String, + media: Option, + supports: Option, + source_map: Option, identifier_index: u32, order_index: u32, cacheable: bool, @@ -55,6 +57,7 @@ impl CssDependency { id: DependencyId::new(), identifier, content, + layer, context, media, supports, @@ -110,6 +113,10 @@ impl Dependency for CssDependency { end: self.order_index + 1, }) } + + fn get_layer(&self) -> Option<&rspack_core::ModuleLayer> { + self.layer.as_ref() + } } impl ModuleDependency for CssDependency { diff --git a/crates/rspack_plugin_extract_css/src/css_module.rs b/crates/rspack_plugin_extract_css/src/css_module.rs index 075b5bec12d..f34aa27c595 100644 --- a/crates/rspack_plugin_extract_css/src/css_module.rs +++ b/crates/rspack_plugin_extract_css/src/css_module.rs @@ -29,9 +29,10 @@ pub(crate) struct CssModule { pub(crate) identifier: String, pub(crate) content: String, pub(crate) _context: String, - pub(crate) media: String, - pub(crate) supports: String, - pub(crate) source_map: String, + pub(crate) media: Option, + pub(crate) supports: Option, + pub(crate) source_map: Option, + pub(crate) layer: Option, pub(crate) identifier_index: u32, factory_meta: Option, @@ -52,14 +53,19 @@ pub(crate) struct CssModule { impl CssModule { pub fn new(dep: CssDependency) -> Self { let identifier__ = format!( - "css|{}|{}|{}|{}}}", - dep.identifier, dep.identifier_index, dep.supports, dep.media, + "css|{}|{}|{}|{}|{}}}", + dep.identifier, + dep.identifier_index, + dep.layer.as_deref().unwrap_or_default(), + dep.supports.as_deref().unwrap_or_default(), + dep.media.as_deref().unwrap_or_default(), ) .into(); Self { identifier: dep.identifier, content: dep.content, + layer: dep.layer.clone(), _context: dep.context, media: dep.media, supports: dep.supports, @@ -84,8 +90,12 @@ impl CssModule { let mut hasher = RspackHash::from(&options.output); self.content.hash(&mut hasher); + if let Some(layer) = &self.layer { + layer.hash(&mut hasher); + } self.supports.hash(&mut hasher); self.media.hash(&mut hasher); + self.source_map.hash(&mut hasher); hasher.digest(&options.output.hash_digest) } @@ -97,22 +107,31 @@ impl Module for CssModule { fn readable_identifier(&self, context: &rspack_core::Context) -> std::borrow::Cow { std::borrow::Cow::Owned(format!( - "css {}{}{}{}", + "css {}{}{}{}{}", context.shorten(&self.identifier), if self.identifier_index > 0 { format!("({})", self.identifier_index) } else { "".into() }, - if self.supports.is_empty() { - "".into() + if let Some(layer) = &self.layer { + format!(" (layer {})", layer) } else { - format!(" (supports {})", self.supports) + "".into() }, - if self.media.is_empty() { + if let Some(supports) = &self.supports + && !supports.is_empty() + { + format!(" (supports {})", supports) + } else { "".into() + }, + if let Some(media) = &self.media + && !media.is_empty() + { + format!(" (media {})", media) } else { - format!(" (media {})", self.media) + "".into() } )) } diff --git a/crates/rspack_plugin_extract_css/src/parser_plugin.rs b/crates/rspack_plugin_extract_css/src/parser_plugin.rs index 19df9f628e2..8d6e5e1c568 100644 --- a/crates/rspack_plugin_extract_css/src/parser_plugin.rs +++ b/crates/rspack_plugin_extract_css/src/parser_plugin.rs @@ -1,21 +1,21 @@ -use std::path::PathBuf; - use rspack_core::BoxDependency; use rspack_plugin_javascript::{visitors::JavascriptParser, JavascriptParserPlugin}; use rspack_util::fx_hash::FxDashMap; +use serde::Deserialize; use crate::css_dependency::CssDependency; -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct CssExtractJsonData { pub identifier: String, pub content: String, pub context: String, - pub media: String, - pub supports: String, - pub source_map: String, + pub media: Option, + pub supports: Option, + pub source_map: Option, pub identifier_index: u32, - pub filepath: PathBuf, + pub layer: Option, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -48,11 +48,12 @@ impl JavascriptParserPlugin for PluginCssExtractParserPlugin { supports, source_map, identifier_index, - .. + layer, }, )| { Box::new(CssDependency::new( identifier.into(), + layer.clone(), content.clone(), context.clone(), media.clone(), diff --git a/crates/rspack_plugin_extract_css/src/plugin.rs b/crates/rspack_plugin_extract_css/src/plugin.rs index 6fb5181f228..6ddcf995ff4 100644 --- a/crates/rspack_plugin_extract_css/src/plugin.rs +++ b/crates/rspack_plugin_extract_css/src/plugin.rs @@ -344,30 +344,39 @@ impl PluginCssExtract { if let Some(header) = header { external_source.add(header); } - if !module.media.is_empty() { + if let Some(media) = &module.media { static MEDIA_RE: LazyLock = LazyLock::new(|| Regex::new(r#";|\s*$"#).expect("should compile")); - let new_content = MEDIA_RE.replace_all(content.as_ref(), &module.media); + let new_content = MEDIA_RE.replace_all(content.as_ref(), media); external_source.add(RawSource::from(new_content.to_string() + "\n")); } else { external_source.add(RawSource::from(content.to_string() + "\n")); } } else { + let mut need_supports = false; + let mut need_media = false; + if let Some(header) = header { source.add(header); } - if !module.supports.is_empty() { - source.add(RawSource::from(format!( - "@supports ({}) {{\n", - &module.supports - ))); + + if let Some(supports) = &module.supports + && !supports.is_empty() + { + need_supports = true; + source.add(RawSource::from(format!("@supports ({}) {{\n", supports))); } - if !module.media.is_empty() { - source.add(RawSource::from(format!("@media {} {{\n", &module.media))); + if let Some(media) = &module.media + && !media.is_empty() + { + need_media = true; + source.add(RawSource::from(format!("@media {} {{\n", media))); } - // TODO: layer support + if let Some(layer) = &module.layer { + source.add(RawSource::from(format!("@layer {} {{\n", layer))); + } let undo_path = get_undo_path( &filename, @@ -391,21 +400,27 @@ impl PluginCssExtract { .unwrap_or(&undo_path), ); - if !module.source_map.is_empty() { + if let Some(source_map) = &module.source_map { source.add(SourceMapSource::new(WithoutOriginalOptions { value: content.to_string(), name: readable_identifier, - source_map: SourceMap::from_json(&module.source_map).expect("invalid sourcemap"), + source_map: SourceMap::from_json(source_map).expect("invalid sourcemap"), })) } else { source.add(RawSource::from(content.to_string())); } source.add(RawSource::from("\n")); - if !module.media.is_empty() { + + if need_media { source.add(RawSource::from("}\n")); } - if !module.supports.is_empty() { + + if need_supports { + source.add(RawSource::from("}\n")); + } + + if module.layer.is_some() { source.add(RawSource::from("}\n")); } } diff --git a/packages/rspack/etc/api.md b/packages/rspack/etc/api.md index 6464b7e4b13..80c9c3e087d 100644 --- a/packages/rspack/etc/api.md +++ b/packages/rspack/etc/api.md @@ -1630,7 +1630,7 @@ export interface CssExtractRspackLoaderOptions { // (undocumented) esModule?: boolean; // (undocumented) - layer?: boolean; + layer?: string; // (undocumented) publicPath?: string | ((resourcePath: string, context: string) => string); } @@ -5825,6 +5825,7 @@ export interface LoaderContext { hot?: boolean; // (undocumented) importModule(request: string, options: { + layer?: string; publicPath?: PublicPath; baseUri?: string; }, callback: (err?: Error, res?: any) => void): void; diff --git a/packages/rspack/src/builtin-plugin/css-extract/loader.ts b/packages/rspack/src/builtin-plugin/css-extract/loader.ts index 7940db69260..db07f2d8ec4 100644 --- a/packages/rspack/src/builtin-plugin/css-extract/loader.ts +++ b/packages/rspack/src/builtin-plugin/css-extract/loader.ts @@ -29,9 +29,7 @@ export interface CssExtractRspackLoaderOptions { publicPath?: string | ((resourcePath: string, context: string) => string); emit?: boolean; esModule?: boolean; - - // TODO: support layer - layer?: boolean; + layer?: string; defaultExport?: boolean; } @@ -274,16 +272,7 @@ export const pitch: LoaderDefinition["pitch"] = function (request, _, data) { if (dependencies.length > 0) { additionalData[CssExtractRspackPlugin.pluginName] = dependencies .map(dep => { - return [ - dep.identifier, - dep.content, - dep.context, - dep.media, - dep.supports, - dep.sourceMap, - dep.identifierIndex, - dep.filepath - ].join(SERIALIZE_SEP); + return JSON.stringify(dep); }) .join(SERIALIZE_SEP); } @@ -294,6 +283,7 @@ export const pitch: LoaderDefinition["pitch"] = function (request, _, data) { this.importModule( `${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, { + layer: options.layer, publicPath: /** @type {Filename} */ publicPathForExtract, baseUri: `${BASE_URI}/` }, diff --git a/packages/rspack/src/config/adapterRuleUse.ts b/packages/rspack/src/config/adapterRuleUse.ts index 37cdf069329..9c5b10f0f67 100644 --- a/packages/rspack/src/config/adapterRuleUse.ts +++ b/packages/rspack/src/config/adapterRuleUse.ts @@ -135,7 +135,7 @@ export interface LoaderContext { addBuildDependency(file: string): void; importModule( request: string, - options: { publicPath?: PublicPath; baseUri?: string }, + options: { layer?: string; publicPath?: PublicPath; baseUri?: string }, callback: (err?: Error, res?: any) => void ): void; fs: any; diff --git a/packages/rspack/src/loader-runner/index.ts b/packages/rspack/src/loader-runner/index.ts index 225214f322d..7499f0accd9 100644 --- a/packages/rspack/src/loader-runner/index.ts +++ b/packages/rspack/src/loader-runner/index.ts @@ -410,6 +410,7 @@ export async function runLoaders( ._lastCompilation!.__internal_getInner() .importModule( request, + options.layer, options.publicPath, options.baseUri, context._module.moduleIdentifier, @@ -443,6 +444,7 @@ export async function runLoaders( ._lastCompilation!.__internal_getInner() .importModule( request, + options.layer, options.publicPath, options.baseUri, context._module.moduleIdentifier, diff --git a/tests/plugin-test/css-extract/cases/at-import-layer/expected/main.css b/tests/plugin-test/css-extract/cases/at-import-layer/expected/main.css index 3e7d1c112d2..1b122e93e03 100644 --- a/tests/plugin-test/css-extract/cases/at-import-layer/expected/main.css +++ b/tests/plugin-test/css-extract/cases/at-import-layer/expected/main.css @@ -12,7 +12,7 @@ } } -@layer { +@layer { .color { color: red; } diff --git a/tests/plugin-test/css-extract/cases/at-import-layer/test.filter.js b/tests/plugin-test/css-extract/cases/at-import-layer/test.filter.js deleted file mode 100644 index 71331f6ff59..00000000000 --- a/tests/plugin-test/css-extract/cases/at-import-layer/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// not support layer -module.exports = () => false; diff --git a/tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/one_js.$4b5109fbbb7c7970bd73f145985a8713$.css b/tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/one_js.$b470ca82f8ee5c2da18fa687c2178e3d$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/one_js.$4b5109fbbb7c7970bd73f145985a8713$.css rename to tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/one_js.$b470ca82f8ee5c2da18fa687c2178e3d$.css diff --git a/tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/two_js.$765cfc26ddecf262088215f69c92da3e$.css b/tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/two_js.$c468cd1246827e0c2204c1830c235ec4$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/two_js.$765cfc26ddecf262088215f69c92da3e$.css rename to tests/plugin-test/css-extract/cases/content-entries-with-same-import/expected/two_js.$c468cd1246827e0c2204c1830c235ec4$.css diff --git a/tests/plugin-test/css-extract/cases/contenthash-1/expected/main.$c414a55a331514d313ce34913a677700$.css b/tests/plugin-test/css-extract/cases/contenthash-1/expected/main.$d4641399bd65817bb933f6126404706d$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/contenthash-1/expected/main.$c414a55a331514d313ce34913a677700$.css rename to tests/plugin-test/css-extract/cases/contenthash-1/expected/main.$d4641399bd65817bb933f6126404706d$.css diff --git a/tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryA.$5038057b5dc54d459c2090d9455373d6$.css b/tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryA.$89bd96c1999014f578f3919f80e90777$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryA.$5038057b5dc54d459c2090d9455373d6$.css rename to tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryA.$89bd96c1999014f578f3919f80e90777$.css diff --git a/tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryB.$8ddf1fb367ac73deeba175a1de156238$.css b/tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryB.$258372b94aba7cf7773edad684cfb7f4$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryB.$8ddf1fb367ac73deeba175a1de156238$.css rename to tests/plugin-test/css-extract/cases/contenthash-multiple-entries/expected/entryB.$258372b94aba7cf7773edad684cfb7f4$.css diff --git a/tests/plugin-test/css-extract/cases/contenthash/expected/1.main.$7a92eedfa1f9813bd6a40e1910d3ecc0$.css b/tests/plugin-test/css-extract/cases/contenthash/expected/1.main.$5dd17a3bf1a2f969ec0edfa5a446d38f$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/contenthash/expected/1.main.$7a92eedfa1f9813bd6a40e1910d3ecc0$.css rename to tests/plugin-test/css-extract/cases/contenthash/expected/1.main.$5dd17a3bf1a2f969ec0edfa5a446d38f$.css diff --git a/tests/plugin-test/css-extract/cases/contenthash/expected/2.main.$4f43297fc0af2c899c5e56fd341c7258$.css b/tests/plugin-test/css-extract/cases/contenthash/expected/2.main.$6fa338b85cf3ead72beb9d07663b81a0$.css similarity index 100% rename from tests/plugin-test/css-extract/cases/contenthash/expected/2.main.$4f43297fc0af2c899c5e56fd341c7258$.css rename to tests/plugin-test/css-extract/cases/contenthash/expected/2.main.$6fa338b85cf3ead72beb9d07663b81a0$.css diff --git a/tests/plugin-test/css-extract/cases/issue-6649/expected/main.js b/tests/plugin-test/css-extract/cases/issue-6649/expected/main.js index 4a43f6e9c50..3d25f57363d 100644 --- a/tests/plugin-test/css-extract/cases/issue-6649/expected/main.js +++ b/tests/plugin-test/css-extract/cases/issue-6649/expected/main.js @@ -100,14 +100,14 @@ __webpack_require__.e = function (chunkId) { // return url for filenames not based on template // return url for filenames based on template - return "" + chunkId + ".$" + "51f879692dc41105d447" + "$.css"; + return "" + chunkId + ".$" + "86c54060555b09b6022b" + "$.css"; }; })(); // webpack/runtime/get_full_hash (() => { __webpack_require__.h = function () { - return "5e241c5760a3e354e528"; + return "030fa05479cf238ffca6"; }; })(); diff --git a/tests/plugin-test/css-extract/cases/issue-css-loader-1503-2/test.filter.js b/tests/plugin-test/css-extract/cases/issue-css-loader-1503-2/test.filter.js deleted file mode 100644 index c2e6765a2af..00000000000 --- a/tests/plugin-test/css-extract/cases/issue-css-loader-1503-2/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// supports layer -module.exports = () => false; diff --git a/tests/plugin-test/css-extract/cases/js-hash/expected/style.$cdffad3f0b38fa11c50b5a3ca2766a33$.2.css b/tests/plugin-test/css-extract/cases/js-hash/expected/style.$6801f44433f215d57d5ae0536124eb1e$.2.css similarity index 100% rename from tests/plugin-test/css-extract/cases/js-hash/expected/style.$cdffad3f0b38fa11c50b5a3ca2766a33$.2.css rename to tests/plugin-test/css-extract/cases/js-hash/expected/style.$6801f44433f215d57d5ae0536124eb1e$.2.css diff --git a/tests/plugin-test/css-extract/cases/js-hash/expected/style.$33888ee88d16a14ff101cdf362266f8f$.1.css b/tests/plugin-test/css-extract/cases/js-hash/expected/style.$bbffdf56250bca63f573b437fef250d9$.1.css similarity index 100% rename from tests/plugin-test/css-extract/cases/js-hash/expected/style.$33888ee88d16a14ff101cdf362266f8f$.1.css rename to tests/plugin-test/css-extract/cases/js-hash/expected/style.$bbffdf56250bca63f573b437fef250d9$.1.css