Skip to content

Commit

Permalink
Revert "feat: do not use cache at all"
Browse files Browse the repository at this point in the history
This reverts commit 34e3da9.
  • Loading branch information
h-a-n-a committed Dec 9, 2024
1 parent e452ae9 commit f012d69
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion crates/rspack_core/src/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,10 @@ impl Compilation {

self.emit_asset(
filename.clone(),
CompilationAsset::new(Some(file_manifest.source.boxed()), file_manifest.info),
CompilationAsset::new(
Some(CachedSource::new(file_manifest.source).boxed()),
file_manifest.info,
),
);

_ = self
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 @@ -1282,7 +1282,7 @@ impl Module for ConcatenatedModule {
}

let mut code_generation_result = CodeGenerationResult::default();
code_generation_result.add(SourceType::JavaScript, result.boxed());
code_generation_result.add(SourceType::JavaScript, MapCachedSource::new(result).boxed());
code_generation_result.chunk_init_fragments = chunk_init_fragments;
code_generation_result.runtime_requirements = runtime_requirements;
code_generation_result
Expand Down
5 changes: 4 additions & 1 deletion crates/rspack_core/src/normal_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,10 @@ impl Module for NormalModule {
concatenation_scope: concatenation_scope.as_mut(),
},
)?;
code_generation_result.add(*source_type, generation_result.boxed());
code_generation_result.add(
*source_type,
MapCachedSource::new(generation_result).boxed(),
);
}
code_generation_result.concatenation_scope = concatenation_scope;
Ok(code_generation_result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ async fn render_manifest(
css_import_modules,
css_modules,
)?;
Ok((source.boxed(), diagnostics))
Ok((CachedSource::new(source).boxed(), diagnostics))
})
.await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_plugin_extract_css/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ async fn render_manifest(
let (source, diagnostics) = self
.render_content_asset(chunk, &rendered_modules, &filename, compilation)
.await;
Ok((source.boxed(), diagnostics))
Ok((CachedSource::new(source).boxed(), diagnostics))
})
.await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ async fn render_manifest(
} else {
self.render_chunk(compilation, chunk_ukey).await?
};
Ok((source.boxed(), Vec::new()))
Ok((CachedSource::new(source).boxed(), Vec::new()))
})
.await?;

Expand Down

0 comments on commit f012d69

Please sign in to comment.