Skip to content

Commit

Permalink
solve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Oct 8, 2024
1 parent a429391 commit 5bd31c7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async-trait = { version = "0.1.79" }
bitflags = { version = "2.5.0" }
camino = { version = "1.1.8" }
concat-string = { version = "1.0.1" }
cow-utils = { version = "0.1.3" }
css-module-lexer = { version = "0.0.14" }
dashmap = { version = "5.5.3" }
derivative = { version = "2.2.0" }
Expand Down
1 change: 1 addition & 0 deletions crates/rspack_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ anymap = { workspace = true }
async-recursion = { workspace = true }
async-trait = { workspace = true }
bitflags = { workspace = true }
cow-utils = { workspace = true }
dashmap = { workspace = true, features = ["rayon"] }
derivative = { workspace = true }
dyn-clone = "1.0.17"
Expand Down
9 changes: 6 additions & 3 deletions crates/rspack_core/src/utils/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use std::borrow::Cow;

use cow_utils::CowUtils;
use indexmap::IndexMap;
use rustc_hash::FxHashMap as HashMap;
use rustc_hash::FxHashSet as HashSet;
Expand Down Expand Up @@ -130,7 +133,7 @@ pub fn get_filename_without_hash_length<F: Clone>(
let Some(template) = filename.template() else {
return (filename.clone(), hash_len_map);
};
let mut template = template.to_string();
let mut template = Cow::Borrowed(template);
for key in [
HASH_PLACEHOLDER,
FULL_HASH_PLACEHOLDER,
Expand All @@ -141,8 +144,8 @@ pub fn get_filename_without_hash_length<F: Clone>(
if let Some(hash_len) = p.len {
hash_len_map.insert((*key).to_string(), hash_len);
}
template = template.replace(&p.pattern, key);
template = Cow::Owned(template.cow_replace(&p.pattern, key).into_owned());
}
}
(Filename::from(template), hash_len_map)
(Filename::from(template.into_owned()), hash_len_map)
}

0 comments on commit 5bd31c7

Please sign in to comment.