Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include omit entries in hash #3552

Merged
merged 4 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/turbo-tasks-hash/src/deterministic_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ impl DeterministicHash for &str {
}
}

impl DeterministicHash for bool {
fn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H) {
state.write_u8(*self as u8);
}
}

impl<T: DeterministicHash> DeterministicHash for Option<T> {
fn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H) {
match self {
Expand Down
20 changes: 17 additions & 3 deletions crates/turbopack-ecmascript/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use turbo_tasks::{
use turbo_tasks_fs::{
embed_file, rope::Rope, File, FileContent, FileSystemPathOptionVc, FileSystemPathVc,
};
use turbo_tasks_hash::{encode_hex, hash_xxh3_hash64, Xxh3Hash64Hasher};
use turbo_tasks_hash::{encode_hex, hash_xxh3_hash64, DeterministicHasher, Xxh3Hash64Hasher};
use turbopack_core::{
asset::{Asset, AssetContentVc, AssetVc},
chunk::{
Expand Down Expand Up @@ -969,11 +969,15 @@ impl Asset for EcmascriptChunk {
// evalute only contributes to the hashed info
if let Some(evaluate) = this.evaluate {
let evaluate = evaluate.content(this.context, self_vc).await?;
for path in evaluate.chunks_server_paths.await?.iter() {
let chunks_server_paths = evaluate.chunks_server_paths.await?;
hasher.write_usize(chunks_server_paths.len());
for path in chunks_server_paths.iter() {
hasher.write_ref(path);
need_hash = true;
}
for id in evaluate.entry_modules_ids.await?.iter() {
let entry_modules_ids = evaluate.entry_modules_ids.await?;
hasher.write_usize(entry_modules_ids.len());
for id in entry_modules_ids.iter() {
hasher.write_value(id.await?);
need_hash = true;
}
Expand All @@ -986,6 +990,7 @@ impl Asset for EcmascriptChunk {
let main_entry = main_entries.iter().next().unwrap();
main_entry.path()
} else {
hasher.write_usize(main_entries.len());
for entry in &main_entries {
let path = entry.path().to_string().await?;
hasher.write_value(path);
Expand All @@ -1001,6 +1006,15 @@ impl Asset for EcmascriptChunk {
main_entry.path()
}
};
if let Some(omit_entries) = this.omit_entries {
let omit_entries = omit_entries.await?;
hasher.write_usize(omit_entries.len());
for omit_entry in &omit_entries {
let path = omit_entry.path().to_string().await?;
hasher.write_value(path);
}
need_hash = true;
}

if need_hash {
let hash = hasher.finish();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading