Skip to content

Commit 4cb4479

Browse files
authored
Merge branch 'main' into release_1_0_0_beta_1
2 parents 281679a + d49d325 commit 4cb4479

24 files changed

+87
-20976
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ tests/webpack-test/browsertest/js
214214
tests/webpack-test/fixtures/temp-*
215215
tests/webpack-test/temp
216216
tests/webpack-test/ChangesAndRemovals
217+
tests/webpack-test/__snapshots__/*.snap.*
217218
tests/webpack-test/**/dev-defaults.webpack.lock
218219
!tests/webpack-test/**/target
219220
!tests/webpack-test/cases/**/node_modules

crates/rspack_core/src/compiler/compilation.rs

+7-14
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ use crate::{
3030
build_chunk_graph::build_chunk_graph,
3131
get_chunk_from_ukey, get_mut_chunk_from_ukey, is_source_equal,
3232
old_cache::{use_code_splitting_cache, Cache as OldCache, CodeSplittingCache},
33-
prepare_get_exports_type, to_identifier, BoxDependency, BoxModule, CacheCount, CacheOptions,
34-
Chunk, ChunkByUkey, ChunkContentHash, ChunkGraph, ChunkGroupByUkey, ChunkGroupUkey, ChunkKind,
35-
ChunkUkey, CodeGenerationResults, CompilationLogger, CompilationLogging, CompilerOptions,
36-
DependencyId, DependencyType, Entry, EntryData, EntryOptions, EntryRuntime, Entrypoint,
37-
ExecuteModuleId, Filename, ImportVarMap, LocalFilenameFn, Logger, Module, ModuleFactory,
38-
ModuleGraph, ModuleGraphPartial, ModuleIdentifier, PathData, ResolverFactory, RuntimeGlobals,
39-
RuntimeModule, RuntimeSpec, SharedPluginDriver, SourceType, Stats,
33+
to_identifier, BoxDependency, BoxModule, CacheCount, CacheOptions, Chunk, ChunkByUkey,
34+
ChunkContentHash, ChunkGraph, ChunkGroupByUkey, ChunkGroupUkey, ChunkKind, ChunkUkey,
35+
CodeGenerationResults, CompilationLogger, CompilationLogging, CompilerOptions, DependencyId,
36+
DependencyType, Entry, EntryData, EntryOptions, EntryRuntime, Entrypoint, ExecuteModuleId,
37+
Filename, ImportVarMap, LocalFilenameFn, Logger, Module, ModuleFactory, ModuleGraph,
38+
ModuleGraphPartial, ModuleIdentifier, PathData, ResolverFactory, RuntimeGlobals, RuntimeModule,
39+
RuntimeSpec, SharedPluginDriver, SourceType, Stats,
4040
};
4141

4242
pub type BuildDependency = (
@@ -752,13 +752,6 @@ impl Compilation {
752752
Ok(())
753753
}
754754

755-
// FIXME:
756-
// Webpack may modify the moduleGraph in module.getExportsType()
757-
// and it is widely called after compilation.finish()
758-
// so add this method to trigger moduleGraph modification and
759-
// then make sure that moduleGraph is immutable
760-
prepare_get_exports_type(&mut self.get_module_graph_mut());
761-
762755
run_iteration(self, &mut codegen_cache_counter, |(_, module)| {
763756
module.get_code_generation_dependencies().is_none()
764757
})?;

crates/rspack_core/src/compiler/make/repair/factorize.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
utils::task_loop::{Task, TaskResult, TaskType},
1212
BoxDependency, CompilerOptions, Context, DependencyId, ExportInfo, ExportsInfo, ModuleFactory,
1313
ModuleFactoryCreateData, ModuleFactoryResult, ModuleIdentifier, ModuleLayer, ModuleProfile,
14-
Resolve, UsageState,
14+
Resolve,
1515
};
1616

1717
#[derive(Debug)]
@@ -58,12 +58,8 @@ impl Task<MakeTaskContext> for FactorizeTask {
5858
.or(self.issuer_layer.as_ref())
5959
.cloned();
6060

61-
let other_exports_info = ExportInfo::new(None, UsageState::Unknown, None);
62-
let side_effects_only_info = ExportInfo::new(
63-
Some("*side effects only*".into()),
64-
UsageState::Unknown,
65-
None,
66-
);
61+
let other_exports_info = ExportInfo::new(None, None);
62+
let side_effects_only_info = ExportInfo::new(Some("*side effects only*".into()), None);
6763
let exports_info = ExportsInfo::new(other_exports_info.id, side_effects_only_info.id);
6864
let factorize_result_task = FactorizeResultTask {
6965
// dependency: dep_id,

crates/rspack_core/src/concatenated_module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ impl ConcatenatedModule {
18291829
let module = mg
18301830
.module_by_identifier(&info.id())
18311831
.expect("should have module");
1832-
let exports_type = module.get_exports_type_readonly(mg, strict_harmony_module);
1832+
let exports_type = module.get_exports_type(mg, strict_harmony_module);
18331833

18341834
if export_name.is_empty() {
18351835
match exports_type {

crates/rspack_core/src/dependency/runtime_template.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,11 @@ pub fn get_exports_type(
257257
id: &DependencyId,
258258
parent_module: &ModuleIdentifier,
259259
) -> ExportsType {
260-
let module = module_graph
261-
.module_identifier_by_dependency_id(id)
262-
.expect("should have module");
263260
let strict = module_graph
264261
.module_by_identifier(parent_module)
265262
.expect("should have mgm")
266263
.get_strict_harmony_module();
267-
module_graph
268-
.module_by_identifier(module)
269-
.expect("should have mgm")
270-
.get_exports_type_readonly(module_graph, strict)
264+
get_exports_type_with_strict(module_graph, id, strict)
271265
}
272266

273267
pub fn get_exports_type_with_strict(
@@ -281,7 +275,7 @@ pub fn get_exports_type_with_strict(
281275
module_graph
282276
.module_by_identifier(module)
283277
.expect("should have module")
284-
.get_exports_type_readonly(module_graph, strict)
278+
.get_exports_type(module_graph, strict)
285279
}
286280

287281
// information content of the comment

0 commit comments

Comments
 (0)