Skip to content

Commit

Permalink
Fix turbopack-core
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed May 28, 2024
1 parent 20b0697 commit e88150a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ async fn resolve_internal_inline(
fragment,
} => {
let mut new_pat = path.clone();
new_pat.push_front(".".to_string().into());
new_pat.push_front(RcStr::from(".").into());
let relative = Request::relative(Value::new(new_pat), *query, *fragment, true);

if !has_alias {
Expand Down Expand Up @@ -1831,8 +1831,8 @@ async fn resolve_into_folder(
if let Some(field_value) = package_json[name].as_str() {
let normalized_request: RcStr = normalize_request(field_value).into();
if normalized_request.is_empty()
|| normalized_request == "."
|| normalized_request == "./"
|| &*normalized_request == "."
|| &*normalized_request == "./"
{
continue;
}
Expand Down Expand Up @@ -2175,7 +2175,7 @@ async fn resolve_module_request(
options,
options_value,
|_| {
let full_pattern = Pattern::concat([module.to_string().into(), path.clone()]);
let full_pattern = Pattern::concat([RcStr::from(module).into(), path.clone()]);
full_pattern.into_string()
},
query,
Expand Down Expand Up @@ -2244,8 +2244,8 @@ async fn resolve_module_request(
if options_value.prefer_relative {
let module_prefix: RcStr = format!("./{module}").into();
let pattern = Pattern::concat([
module_prefix.clone().into_owned().into(),
"/".to_string().into(),
module_prefix.clone().into(),
RcStr::from("/").into(),
path.clone(),
]);
let relative = Request::relative(Value::new(pattern), query, fragment, true);
Expand Down Expand Up @@ -2294,7 +2294,7 @@ async fn resolve_into_package(
todo!("pattern into an exports field is not implemented yet");
};

let path = if path == "/" {
let path = if &*path == "/" {
".".to_string()
} else {
format!(".{path}")
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-core/src/resolve/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Request {
.and_then(|caps| caps.get(1).zip(caps.get(2)))
{
let (path, query, fragment) =
split_off_query_fragment(path.as_str().to_string());
split_off_query_fragment(path.as_str().into());

return Request::Module {
module: module.as_str().into(),
Expand Down

0 comments on commit e88150a

Please sign in to comment.