From 503e26c46e28fd25e39720dd600ae41ca3065125 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Wed, 14 Aug 2024 19:27:33 +0800 Subject: [PATCH] fix --- .../src/chunk_graph/chunk_graph_module.rs | 4 +- .../rspack_core/src/compiler/compilation.rs | 42 ++++++++++++------- crates/rspack_core/src/concatenated_module.rs | 12 ++---- crates/rspack_core/src/context_module.rs | 1 - crates/rspack_core/src/dependencies_block.rs | 7 +--- .../src/dependency/loader_import.rs | 4 +- crates/rspack_core/src/exports_info.rs | 9 ---- crates/rspack_core/src/external_module.rs | 2 - crates/rspack_core/src/module.rs | 5 +-- .../src/old_cache/occasion/code_generate.rs | 16 ++++--- .../rspack_core/src/parser_and_generator.rs | 5 +-- crates/rspack_core/src/raw_module.rs | 4 +- crates/rspack_core/src/self_module.rs | 2 +- .../tests/runtime_module.rs | 12 +----- crates/rspack_plugin_asset/src/lib.rs | 2 +- crates/rspack_plugin_hmr/src/lib.rs | 5 +-- .../src/parser_and_generator/mod.rs | 4 +- crates/rspack_plugin_json/src/lib.rs | 6 +-- .../src/module.rs | 4 +- .../src/container/container_entry_module.rs | 5 +-- .../src/container/fallback_module.rs | 4 +- .../src/container/remote_module.rs | 4 +- .../src/sharing/consume_shared_module.rs | 5 +-- .../src/sharing/provide_shared_module.rs | 5 +-- .../src/parser_and_generator.rs | 2 +- 25 files changed, 65 insertions(+), 106 deletions(-) diff --git a/crates/rspack_core/src/chunk_graph/chunk_graph_module.rs b/crates/rspack_core/src/chunk_graph/chunk_graph_module.rs index fe8e9e9ad5e8..c2e519c69f29 100644 --- a/crates/rspack_core/src/chunk_graph/chunk_graph_module.rs +++ b/crates/rspack_core/src/chunk_graph/chunk_graph_module.rs @@ -2,14 +2,14 @@ use std::hash::{Hash, Hasher}; -use rspack_collections::{IdentifierMap, IdentifierSet, UkeySet}; +use rspack_collections::{IdentifierSet, UkeySet}; use rspack_hash::RspackHashDigest; use rspack_util::ext::DynHash; use rustc_hash::FxHasher; use tracing::instrument; use crate::{ - get_chunk_group_from_ukey, AsyncDependenciesBlockIdentifier, BoxModule, ChunkByUkey, ChunkGroup, + get_chunk_group_from_ukey, AsyncDependenciesBlockIdentifier, ChunkByUkey, ChunkGroup, ChunkGroupByUkey, ChunkGroupUkey, ChunkUkey, Compilation, ModuleIdentifier, RuntimeGlobals, RuntimeSpec, RuntimeSpecMap, RuntimeSpecSet, }; diff --git a/crates/rspack_core/src/compiler/compilation.rs b/crates/rspack_core/src/compiler/compilation.rs index b470bbf8c80f..edc862a2dda8 100644 --- a/crates/rspack_core/src/compiler/compilation.rs +++ b/crates/rspack_core/src/compiler/compilation.rs @@ -754,11 +754,11 @@ impl Compilation { fn run_iteration( compilation: &mut Compilation, - codegen_cache_counter: &mut Option, + cache_counter: &mut Option, filter_op: impl Fn(&(ModuleIdentifier, &Box)) -> bool + Sync + Send, ) -> Result<()> { let results = compilation.code_generation_modules( - codegen_cache_counter, + cache_counter, compilation .get_module_graph() .modules() @@ -794,7 +794,7 @@ impl Compilation { pub(crate) fn code_generation_modules( &mut self, - codegen_cache_counter: &mut Option, + cache_counter: &mut Option, modules: IdentifierSet, ) -> Result> { let chunk_graph = &self.chunk_graph; @@ -855,24 +855,34 @@ impl Compilation { let module = module_graph .module_by_identifier(&module) .expect("should have module"); - module.code_generation(self, Some(&runtime), None) + module.code_generation(self, Some(runtime), None) }) - .map(|(res, runtimes)| (module, res, runtimes)) + .map(|(res, runtimes, from_cache)| (module, res, runtimes, from_cache)) }) .collect::>>()?; - let results = results.into_iter().map(|(module, codegen_res, runtimes)| { - let codegen_res_id = codegen_res.id; - self - .code_generation_results - .module_generation_result_map - .insert(codegen_res_id, codegen_res); - for runtime in runtimes { + let results = results + .into_iter() + .map(|(module, codegen_res, runtimes, from_cache)| { + if let Some(counter) = cache_counter { + if from_cache { + counter.hit(); + } else { + counter.miss(); + } + } + + let codegen_res_id = codegen_res.id; self .code_generation_results - .add(module, runtime, codegen_res_id); - } - module - }); + .module_generation_result_map + .insert(codegen_res_id, codegen_res); + for runtime in runtimes { + self + .code_generation_results + .add(module, runtime, codegen_res_id); + } + module + }); Ok(results.collect()) } diff --git a/crates/rspack_core/src/concatenated_module.rs b/crates/rspack_core/src/concatenated_module.rs index 737d16186dcb..bcd6ad7a2b98 100644 --- a/crates/rspack_core/src/concatenated_module.rs +++ b/crates/rspack_core/src/concatenated_module.rs @@ -1,14 +1,13 @@ use std::{ borrow::Cow, - collections::hash_map::{DefaultHasher, Entry}, + collections::hash_map::Entry, fmt::Debug, - hash::{BuildHasherDefault, Hash, Hasher}, + hash::{BuildHasherDefault, Hasher}, sync::{Arc, LazyLock, Mutex}, }; use dashmap::DashMap; use indexmap::{IndexMap, IndexSet}; -use once_cell::sync::OnceCell; use rayon::prelude::*; use regex::Regex; use rspack_ast::javascript::Ast; @@ -137,7 +136,6 @@ impl ConcatenationEntry { #[derive(Debug)] struct ConcatenationEntryConcatenated { module: ModuleIdentifier, - runtime_condition: RuntimeCondition, } #[derive(Debug)] @@ -363,7 +361,6 @@ pub struct ConcatenatedModule { cached_source_sizes: DashMap>, diagnostics: Mutex>, - cached_hash: OnceCell, build_info: Option, } @@ -386,7 +383,6 @@ impl ConcatenatedModule { blocks: vec![], cached_source_sizes: DashMap::default(), diagnostics: Mutex::new(vec![]), - cached_hash: OnceCell::default(), build_info: None, source_map_kind: SourceMapKind::empty(), } @@ -529,7 +525,7 @@ impl Module for ConcatenatedModule { /// the compilation is asserted to be `Some(Compilation)`, https://github.com/webpack/webpack/blob/1f99ad6367f2b8a6ef17cce0e058f7a67fb7db18/lib/optimize/ModuleConcatenationPlugin.js#L394-L418 async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, compilation: Option<&Compilation>, ) -> Result { let compilation = compilation.expect("should pass compilation"); @@ -1494,7 +1490,6 @@ impl ConcatenatedModule { list.push(ConcatenationEntry::Concatenated( ConcatenationEntryConcatenated { module: root_module, - runtime_condition: RuntimeCondition::Boolean(true), }, )); list @@ -1542,7 +1537,6 @@ impl ConcatenatedModule { list.push(ConcatenationEntry::Concatenated( ConcatenationEntryConcatenated { module: *con.module_identifier(), - runtime_condition, }, )); } else { diff --git a/crates/rspack_core/src/context_module.rs b/crates/rspack_core/src/context_module.rs index bc9d9395d20c..f416ba8e7ae5 100644 --- a/crates/rspack_core/src/context_module.rs +++ b/crates/rspack_core/src/context_module.rs @@ -12,7 +12,6 @@ use itertools::Itertools; use regex::{Captures, Regex}; use rspack_collections::{Identifiable, Identifier}; use rspack_error::{impl_empty_diagnosable_trait, miette::IntoDiagnostic, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_macros::impl_source_map_config; use rspack_regex::RspackRegex; use rspack_sources::{BoxSource, ConcatSource, RawSource, SourceExt}; diff --git a/crates/rspack_core/src/dependencies_block.rs b/crates/rspack_core/src/dependencies_block.rs index 25dd1489cb9b..f3e1f6a9e507 100644 --- a/crates/rspack_core/src/dependencies_block.rs +++ b/crates/rspack_core/src/dependencies_block.rs @@ -1,9 +1,4 @@ -use std::{ - borrow::Cow, - fmt::Display, - hash::{Hash, Hasher}, - sync::Arc, -}; +use std::{borrow::Cow, fmt::Display, hash::Hash, sync::Arc}; use derivative::Derivative; use rspack_collections::Identifier; diff --git a/crates/rspack_core/src/dependency/loader_import.rs b/crates/rspack_core/src/dependency/loader_import.rs index 861a1e2db9ef..3d039e5d0ec7 100644 --- a/crates/rspack_core/src/dependency/loader_import.rs +++ b/crates/rspack_core/src/dependency/loader_import.rs @@ -1,6 +1,6 @@ use crate::{ - AsContextDependency, AsDependencyTemplate, Compilation, Context, Dependency, DependencyCategory, - DependencyId, DependencyType, ModuleDependency, RuntimeSpec, + AsContextDependency, AsDependencyTemplate, Context, Dependency, DependencyCategory, DependencyId, + DependencyType, ModuleDependency, }; #[derive(Debug, Hash, PartialEq, Eq, Clone)] diff --git a/crates/rspack_core/src/exports_info.rs b/crates/rspack_core/src/exports_info.rs index 09f7242463ed..26cfd1cbc8d6 100644 --- a/crates/rspack_core/src/exports_info.rs +++ b/crates/rspack_core/src/exports_info.rs @@ -1,23 +1,19 @@ use std::borrow::Cow; use std::collections::hash_map::Entry; use std::collections::BTreeMap; -use std::hash::Hasher; use std::sync::atomic::AtomicU32; use std::sync::atomic::Ordering::Relaxed; use std::sync::Arc; -use std::sync::LazyLock; use either::Either; use itertools::Itertools; use rspack_collections::impl_item_ukey; use rspack_collections::Ukey; -use rspack_collections::UkeyDashMap; use rspack_collections::UkeySet; use rspack_util::atom::Atom; use rspack_util::ext::DynHash; use rustc_hash::FxHashMap as HashMap; use rustc_hash::FxHashSet as HashSet; -use rustc_hash::FxHasher; use serde::Serialize; use crate::Compilation; @@ -26,9 +22,6 @@ use crate::{ ModuleIdentifier, Nullable, RuntimeSpec, }; -static EXPORTS_INFO_HASH: LazyLock> = - LazyLock::new(UkeyDashMap::default); - #[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Ord, PartialOrd, Serialize)] pub struct ExportsInfo(Ukey); @@ -1553,7 +1546,6 @@ impl ExportInfo { pub struct ExportInfoData { // the name could be `null` you could refer https://github.com/webpack/webpack/blob/ac7e531436b0d47cd88451f497cdfd0dad4153d/lib/ExportsInfo.js#L78 name: Option, - usage_state: UsageState, /// this is mangled name, https://github.com/webpack/webpack/blob/1f99ad6367f2b8a6ef17cce0e058f7a67fb7db18/lib/ExportsInfo.js#L1181-L1188 used_name: Option, target: HashMap, ExportInfoTargetValue>, @@ -1688,7 +1680,6 @@ impl ExportInfoData { .unwrap_or_default(); Self { name, - usage_state: UsageState::Unknown, used_name, used_in_runtime, target, diff --git a/crates/rspack_core/src/external_module.rs b/crates/rspack_core/src/external_module.rs index 56b6b311f982..7aab7c14c102 100644 --- a/crates/rspack_core/src/external_module.rs +++ b/crates/rspack_core/src/external_module.rs @@ -1,10 +1,8 @@ use std::borrow::Cow; -use std::hash::Hash; use std::iter; use rspack_collections::{Identifiable, Identifier}; use rspack_error::{error, impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_macros::impl_source_map_config; use rspack_util::{ext::DynHash, json_stringify, source_map::SourceMapKind}; use rustc_hash::{FxHashMap as HashMap, FxHashSet}; diff --git a/crates/rspack_core/src/module.rs b/crates/rspack_core/src/module.rs index cdff0e915789..3c96e70e96d2 100644 --- a/crates/rspack_core/src/module.rs +++ b/crates/rspack_core/src/module.rs @@ -7,10 +7,10 @@ use async_trait::async_trait; use json::JsonValue; use rspack_collections::{Identifiable, Identifier, IdentifierSet}; use rspack_error::{Diagnosable, Diagnostic, Result}; -use rspack_hash::{RspackHash, RspackHashDigest}; +use rspack_hash::RspackHashDigest; use rspack_sources::Source; use rspack_util::atom::Atom; -use rspack_util::ext::{AsAny, DynEq, DynHash}; +use rspack_util::ext::{AsAny, DynHash}; use rspack_util::source_map::ModuleSourceMapConfig; use rustc_hash::FxHashSet as HashSet; @@ -597,7 +597,6 @@ pub struct LibIdentOptions<'me> { #[cfg(test)] mod test { use std::borrow::Cow; - use std::hash::Hash; use rspack_collections::{Identifiable, Identifier}; use rspack_error::{Diagnosable, Diagnostic, Result}; diff --git a/crates/rspack_core/src/old_cache/occasion/code_generate.rs b/crates/rspack_core/src/old_cache/occasion/code_generate.rs index b37a4c7071db..e824c2d4f739 100644 --- a/crates/rspack_core/src/old_cache/occasion/code_generate.rs +++ b/crates/rspack_core/src/old_cache/occasion/code_generate.rs @@ -1,10 +1,8 @@ use rspack_collections::Identifier; use rspack_error::Result; -use crate::{ - get_runtime_key, CodeGenerationJob, Module, ModuleIdentifier, RuntimeSpec, RuntimeSpecSet, -}; -use crate::{old_cache::storage, BoxModule, CodeGenerationResult, Compilation, NormalModuleSource}; +use crate::{old_cache::storage, CodeGenerationResult}; +use crate::{CodeGenerationJob, ModuleIdentifier, RuntimeSpec}; type Storage = dyn storage::Storage; @@ -18,25 +16,25 @@ impl CodeGenerateOccasion { Self { storage } } - pub fn use_cache<'a>( + pub fn use_cache( &self, job: CodeGenerationJob, provide: impl Fn(ModuleIdentifier, &RuntimeSpec) -> Result, - ) -> Result<(CodeGenerationResult, Vec)> { + ) -> Result<(CodeGenerationResult, Vec, bool)> { let storage = match &self.storage { Some(s) => s, None => { let res = provide(job.module, &job.runtime)?; - return Ok((res, job.runtimes)); + return Ok((res, job.runtimes, false)); } }; let cache_key = Identifier::from(format!("{}|{}", job.module, job.hash.encoded())); if let Some(value) = storage.get(&cache_key) { - return Ok((value, job.runtimes)); + Ok((value, job.runtimes, true)) } else { let res = provide(job.module, &job.runtime)?; storage.set(cache_key, res.clone()); - return Ok((res, job.runtimes)); + Ok((res, job.runtimes, false)) } } } diff --git a/crates/rspack_core/src/parser_and_generator.rs b/crates/rspack_core/src/parser_and_generator.rs index 82f88de7f846..271999144ec2 100644 --- a/crates/rspack_core/src/parser_and_generator.rs +++ b/crates/rspack_core/src/parser_and_generator.rs @@ -12,9 +12,8 @@ use swc_core::common::Span; use crate::{ AsyncDependenciesBlock, BoxDependency, BoxLoader, BuildInfo, BuildMeta, CodeGenerationData, - Compilation, CompilerOptions, DependencyTemplate, GeneratorOptions, Module, ModuleDependency, - ModuleIdentifier, ModuleLayer, ModuleType, NormalModule, ParserOptions, RuntimeGlobals, - RuntimeSpec, SourceType, + Compilation, CompilerOptions, DependencyTemplate, Module, ModuleDependency, ModuleIdentifier, + ModuleLayer, ModuleType, NormalModule, ParserOptions, RuntimeGlobals, RuntimeSpec, SourceType, }; use crate::{ChunkGraph, ConcatenationScope, Context, ModuleGraph}; diff --git a/crates/rspack_core/src/raw_module.rs b/crates/rspack_core/src/raw_module.rs index b6fe2244c561..4bacc9c5fc80 100644 --- a/crates/rspack_core/src/raw_module.rs +++ b/crates/rspack_core/src/raw_module.rs @@ -1,9 +1,7 @@ use std::borrow::Cow; -use std::hash::Hash; use rspack_collections::Identifiable; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_macros::impl_source_map_config; use rspack_sources::{BoxSource, RawSource, Source, SourceExt}; use rspack_util::source_map::SourceMapKind; @@ -108,7 +106,7 @@ impl Module for RawModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { Ok(BuildResult { diff --git a/crates/rspack_core/src/self_module.rs b/crates/rspack_core/src/self_module.rs index 4002f3dc0645..6f4af96e48f7 100644 --- a/crates/rspack_core/src/self_module.rs +++ b/crates/rspack_core/src/self_module.rs @@ -104,7 +104,7 @@ impl Module for SelfModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let build_info = BuildInfo { diff --git a/crates/rspack_macros_test/tests/runtime_module.rs b/crates/rspack_macros_test/tests/runtime_module.rs index e01be673ec80..b8926bd6dfb5 100644 --- a/crates/rspack_macros_test/tests/runtime_module.rs +++ b/crates/rspack_macros_test/tests/runtime_module.rs @@ -1,8 +1,7 @@ -use std::{marker::PhantomData, sync::Arc}; +use std::marker::PhantomData; use rspack_collections::Identifier; use rspack_core::{rspack_sources::Source, Compilation, RuntimeModule}; -use rspack_error::Result; use rspack_macros::impl_runtime_module; #[allow(dead_code)] @@ -14,15 +13,6 @@ fn with_generic() { marker: PhantomData, } - impl Foo { - fn name(&self) -> Identifier { - String::new().into() - } - fn generate_with_custom(&self, _compilation: &Compilation) -> Result> { - todo!() - } - } - impl RuntimeModule for Foo { fn name(&self) -> Identifier { todo!() diff --git a/crates/rspack_plugin_asset/src/lib.rs b/crates/rspack_plugin_asset/src/lib.rs index 41fc3d378e5f..e4a8736e57c1 100644 --- a/crates/rspack_plugin_asset/src/lib.rs +++ b/crates/rspack_plugin_asset/src/lib.rs @@ -250,7 +250,7 @@ impl AssetParserAndGenerator { .chunk_graph(&compilation.chunk_graph) .content_hash_optional(contenthash) .hash_optional(contenthash) - .filename(&source_file_name), + .filename(source_file_name), )?; let public_path = PublicPath::ensure_ends_with_slash(public_path); Ok((public_path, info)) diff --git a/crates/rspack_plugin_hmr/src/lib.rs b/crates/rspack_plugin_hmr/src/lib.rs index 3cac9293cb34..595195755b4d 100644 --- a/crates/rspack_plugin_hmr/src/lib.rs +++ b/crates/rspack_plugin_hmr/src/lib.rs @@ -1,7 +1,5 @@ mod hot_module_replacement; -use std::hash::Hash; - use async_trait::async_trait; use hot_module_replacement::HotModuleReplacementRuntimeModule; use rspack_collections::{IdentifierSet, UkeyMap}; @@ -12,10 +10,9 @@ use rspack_core::{ CompilationAdditionalTreeRuntimeRequirements, CompilationAsset, CompilationParams, CompilationProcessAssets, CompilationRecords, CompilerCompilation, CompilerOptions, DependencyType, LoaderContext, NormalModuleLoader, PathData, Plugin, PluginContext, - RunnerContext, RuntimeGlobals, RuntimeModuleExt, RuntimeSpec, SourceType, + RunnerContext, RuntimeGlobals, RuntimeModuleExt, RuntimeSpec, }; use rspack_error::Result; -use rspack_hash::RspackHash; use rspack_hook::{plugin, plugin_hook}; use rspack_util::infallible::ResultInfallibleExt as _; use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; diff --git a/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs b/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs index b1fc5591dbad..fd7c591a5a7f 100644 --- a/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs +++ b/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs @@ -7,8 +7,8 @@ use rspack_core::rspack_sources::{BoxSource, ReplaceSource, Source, SourceExt}; use rspack_core::{ render_init_fragments, AsyncDependenciesBlockIdentifier, BuildMetaExportsType, ChunkGraph, Compilation, DependenciesBlock, DependencyId, GenerateContext, Module, ModuleGraph, ModuleType, - NormalModule, ParseContext, ParseResult, ParserAndGenerator, RuntimeSpec, SideEffectsBailoutItem, - SourceType, SpanExt, TemplateContext, TemplateReplaceSource, + ParseContext, ParseResult, ParserAndGenerator, SideEffectsBailoutItem, SourceType, SpanExt, + TemplateContext, TemplateReplaceSource, }; use rspack_error::miette::Diagnostic; use rspack_error::{DiagnosticExt, IntoTWithDiagnosticArray, Result, TWithDiagnosticArray}; diff --git a/crates/rspack_plugin_json/src/lib.rs b/crates/rspack_plugin_json/src/lib.rs index 629e04912d2a..526d9b82dd78 100644 --- a/crates/rspack_plugin_json/src/lib.rs +++ b/crates/rspack_plugin_json/src/lib.rs @@ -13,9 +13,9 @@ use json::{ use rspack_core::{ diagnostics::ModuleParseError, rspack_sources::{BoxSource, RawSource, Source, SourceExt}, - BuildMetaDefaultObject, BuildMetaExportsType, ChunkGraph, Compilation, CompilerOptions, - ExportsInfo, GenerateContext, Module, ModuleGraph, ParserAndGenerator, Plugin, RuntimeGlobals, - RuntimeSpec, SourceType, UsageState, NAMESPACE_OBJECT_EXPORT, + BuildMetaDefaultObject, BuildMetaExportsType, ChunkGraph, CompilerOptions, ExportsInfo, + GenerateContext, Module, ModuleGraph, ParserAndGenerator, Plugin, RuntimeGlobals, RuntimeSpec, + SourceType, UsageState, NAMESPACE_OBJECT_EXPORT, }; use rspack_error::{ miette::diagnostic, DiagnosticExt, DiagnosticKind, IntoTWithDiagnosticArray, Result, diff --git a/crates/rspack_plugin_lazy_compilation/src/module.rs b/crates/rspack_plugin_lazy_compilation/src/module.rs index 3aff9d6e7539..597997b80409 100644 --- a/crates/rspack_plugin_lazy_compilation/src/module.rs +++ b/crates/rspack_plugin_lazy_compilation/src/module.rs @@ -1,4 +1,4 @@ -use std::{hash::Hash, path::PathBuf, sync::Arc}; +use std::{path::PathBuf, sync::Arc}; use rspack_collections::Identifiable; use rspack_core::{ @@ -28,7 +28,6 @@ pub(crate) struct LazyCompilationProxyModule { build_info: Option, build_meta: Option, factory_meta: Option, - original_module: ModuleIdentifier, cacheable: bool, readable_identifier: String, @@ -76,7 +75,6 @@ impl LazyCompilationProxyModule { build_info: None, build_meta: None, cacheable, - original_module, create_data, readable_identifier, resource, diff --git a/crates/rspack_plugin_mf/src/container/container_entry_module.rs b/crates/rspack_plugin_mf/src/container/container_entry_module.rs index 9a8e38696476..b773eea490ed 100644 --- a/crates/rspack_plugin_mf/src/container/container_entry_module.rs +++ b/crates/rspack_plugin_mf/src/container/container_entry_module.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, hash::Hash}; +use std::borrow::Cow; use async_trait::async_trait; use rspack_collections::{Identifiable, Identifier}; @@ -14,7 +14,6 @@ use rspack_core::{ StaticExportsDependency, StaticExportsSpec, }; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_util::source_map::SourceMapKind; use rustc_hash::FxHashSet; @@ -122,7 +121,7 @@ impl Module for ContainerEntryModule { } async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let mut blocks = vec![]; diff --git a/crates/rspack_plugin_mf/src/container/fallback_module.rs b/crates/rspack_plugin_mf/src/container/fallback_module.rs index 08209482d5a4..ef147bdc028c 100644 --- a/crates/rspack_plugin_mf/src/container/fallback_module.rs +++ b/crates/rspack_plugin_mf/src/container/fallback_module.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::hash::Hash; use async_trait::async_trait; use rspack_collections::{Identifiable, Identifier}; @@ -12,7 +11,6 @@ use rspack_core::{ RuntimeSpec, SourceType, }; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_util::source_map::SourceMapKind; use super::fallback_item_dependency::FallbackItemDependency; @@ -119,7 +117,7 @@ impl Module for FallbackModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let build_info = BuildInfo { diff --git a/crates/rspack_plugin_mf/src/container/remote_module.rs b/crates/rspack_plugin_mf/src/container/remote_module.rs index 005e97a09a8a..a7e87474c9d8 100644 --- a/crates/rspack_plugin_mf/src/container/remote_module.rs +++ b/crates/rspack_plugin_mf/src/container/remote_module.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::hash::Hash; use async_trait::async_trait; use rspack_collections::{Identifiable, Identifier}; @@ -11,7 +10,6 @@ use rspack_core::{ FactoryMeta, LibIdentOptions, Module, ModuleIdentifier, ModuleType, RuntimeSpec, SourceType, }; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_util::source_map::SourceMapKind; use super::{ @@ -136,7 +134,7 @@ impl Module for RemoteModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let build_info = BuildInfo { diff --git a/crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs b/crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs index 34df1fd2d343..2b958ba36b26 100644 --- a/crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs +++ b/crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, hash::Hash}; +use std::borrow::Cow; use async_trait::async_trait; use rspack_collections::{Identifiable, Identifier}; @@ -11,7 +11,6 @@ use rspack_core::{ }; use rspack_core::{module_update_hash, ConcatenationScope, FactoryMeta}; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_util::ext::DynHash; use rspack_util::source_map::SourceMapKind; @@ -146,7 +145,7 @@ impl Module for ConsumeSharedModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let mut blocks = vec![]; diff --git a/crates/rspack_plugin_mf/src/sharing/provide_shared_module.rs b/crates/rspack_plugin_mf/src/sharing/provide_shared_module.rs index df4cf70ddc23..c20bc6857106 100644 --- a/crates/rspack_plugin_mf/src/sharing/provide_shared_module.rs +++ b/crates/rspack_plugin_mf/src/sharing/provide_shared_module.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, hash::Hash}; +use std::borrow::Cow; use async_trait::async_trait; use rspack_collections::{Identifiable, Identifier}; @@ -11,7 +11,6 @@ use rspack_core::{ SourceType, }; use rspack_error::{impl_empty_diagnosable_trait, Diagnostic, Result}; -use rspack_hash::RspackHash; use rspack_util::source_map::SourceMapKind; use super::{ @@ -140,7 +139,7 @@ impl Module for ProvideSharedModule { async fn build( &mut self, - build_context: BuildContext<'_>, + _build_context: BuildContext<'_>, _: Option<&Compilation>, ) -> Result { let mut blocks = vec![]; diff --git a/crates/rspack_plugin_wasm/src/parser_and_generator.rs b/crates/rspack_plugin_wasm/src/parser_and_generator.rs index dd5c528ce382..88e0d9749b8c 100644 --- a/crates/rspack_plugin_wasm/src/parser_and_generator.rs +++ b/crates/rspack_plugin_wasm/src/parser_and_generator.rs @@ -9,7 +9,7 @@ use rspack_core::DependencyType::WasmImport; use rspack_core::{ AssetInfo, BoxDependency, BuildMetaExportsType, Compilation, FilenameTemplate, GenerateContext, Module, ModuleDependency, ModuleIdentifier, NormalModule, ParseContext, ParseResult, - ParserAndGenerator, PathData, RuntimeGlobals, RuntimeSpec, SourceType, StaticExportsDependency, + ParserAndGenerator, PathData, RuntimeGlobals, SourceType, StaticExportsDependency, StaticExportsSpec, UsedName, }; use rspack_error::{Diagnostic, IntoTWithDiagnosticArray, Result, TWithDiagnosticArray};