Skip to content

Commit

Permalink
Merge branch 'main' into release_1_0_0_beta_1
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jul 30, 2024
2 parents 281679a + d49d325 commit 4cb4479
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 20,976 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ tests/webpack-test/browsertest/js
tests/webpack-test/fixtures/temp-*
tests/webpack-test/temp
tests/webpack-test/ChangesAndRemovals
tests/webpack-test/__snapshots__/*.snap.*
tests/webpack-test/**/dev-defaults.webpack.lock
!tests/webpack-test/**/target
!tests/webpack-test/cases/**/node_modules
Expand Down
21 changes: 7 additions & 14 deletions crates/rspack_core/src/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use crate::{
build_chunk_graph::build_chunk_graph,
get_chunk_from_ukey, get_mut_chunk_from_ukey, is_source_equal,
old_cache::{use_code_splitting_cache, Cache as OldCache, CodeSplittingCache},
prepare_get_exports_type, to_identifier, BoxDependency, BoxModule, CacheCount, CacheOptions,
Chunk, ChunkByUkey, ChunkContentHash, ChunkGraph, ChunkGroupByUkey, ChunkGroupUkey, ChunkKind,
ChunkUkey, CodeGenerationResults, CompilationLogger, CompilationLogging, CompilerOptions,
DependencyId, DependencyType, Entry, EntryData, EntryOptions, EntryRuntime, Entrypoint,
ExecuteModuleId, Filename, ImportVarMap, LocalFilenameFn, Logger, Module, ModuleFactory,
ModuleGraph, ModuleGraphPartial, ModuleIdentifier, PathData, ResolverFactory, RuntimeGlobals,
RuntimeModule, RuntimeSpec, SharedPluginDriver, SourceType, Stats,
to_identifier, BoxDependency, BoxModule, CacheCount, CacheOptions, Chunk, ChunkByUkey,
ChunkContentHash, ChunkGraph, ChunkGroupByUkey, ChunkGroupUkey, ChunkKind, ChunkUkey,
CodeGenerationResults, CompilationLogger, CompilationLogging, CompilerOptions, DependencyId,
DependencyType, Entry, EntryData, EntryOptions, EntryRuntime, Entrypoint, ExecuteModuleId,
Filename, ImportVarMap, LocalFilenameFn, Logger, Module, ModuleFactory, ModuleGraph,
ModuleGraphPartial, ModuleIdentifier, PathData, ResolverFactory, RuntimeGlobals, RuntimeModule,
RuntimeSpec, SharedPluginDriver, SourceType, Stats,
};

pub type BuildDependency = (
Expand Down Expand Up @@ -752,13 +752,6 @@ impl Compilation {
Ok(())
}

// FIXME:
// Webpack may modify the moduleGraph in module.getExportsType()
// and it is widely called after compilation.finish()
// so add this method to trigger moduleGraph modification and
// then make sure that moduleGraph is immutable
prepare_get_exports_type(&mut self.get_module_graph_mut());

run_iteration(self, &mut codegen_cache_counter, |(_, module)| {
module.get_code_generation_dependencies().is_none()
})?;
Expand Down
10 changes: 3 additions & 7 deletions crates/rspack_core/src/compiler/make/repair/factorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
utils::task_loop::{Task, TaskResult, TaskType},
BoxDependency, CompilerOptions, Context, DependencyId, ExportInfo, ExportsInfo, ModuleFactory,
ModuleFactoryCreateData, ModuleFactoryResult, ModuleIdentifier, ModuleLayer, ModuleProfile,
Resolve, UsageState,
Resolve,
};

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

let other_exports_info = ExportInfo::new(None, UsageState::Unknown, None);
let side_effects_only_info = ExportInfo::new(
Some("*side effects only*".into()),
UsageState::Unknown,
None,
);
let other_exports_info = ExportInfo::new(None, None);
let side_effects_only_info = ExportInfo::new(Some("*side effects only*".into()), None);
let exports_info = ExportsInfo::new(other_exports_info.id, side_effects_only_info.id);
let factorize_result_task = FactorizeResultTask {
// dependency: dep_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_core/src/concatenated_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ impl ConcatenatedModule {
let module = mg
.module_by_identifier(&info.id())
.expect("should have module");
let exports_type = module.get_exports_type_readonly(mg, strict_harmony_module);
let exports_type = module.get_exports_type(mg, strict_harmony_module);

if export_name.is_empty() {
match exports_type {
Expand Down
10 changes: 2 additions & 8 deletions crates/rspack_core/src/dependency/runtime_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,11 @@ pub fn get_exports_type(
id: &DependencyId,
parent_module: &ModuleIdentifier,
) -> ExportsType {
let module = module_graph
.module_identifier_by_dependency_id(id)
.expect("should have module");
let strict = module_graph
.module_by_identifier(parent_module)
.expect("should have mgm")
.get_strict_harmony_module();
module_graph
.module_by_identifier(module)
.expect("should have mgm")
.get_exports_type_readonly(module_graph, strict)
get_exports_type_with_strict(module_graph, id, strict)
}

pub fn get_exports_type_with_strict(
Expand All @@ -281,7 +275,7 @@ pub fn get_exports_type_with_strict(
module_graph
.module_by_identifier(module)
.expect("should have module")
.get_exports_type_readonly(module_graph, strict)
.get_exports_type(module_graph, strict)
}

// information content of the comment
Expand Down
Loading

0 comments on commit 4cb4479

Please sign in to comment.