Skip to content

Commit

Permalink
WIP various stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Oct 10, 2024
1 parent 65d2ba2 commit 21185b5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
17 changes: 11 additions & 6 deletions turbopack/crates/turbo-tasks-fs/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ pub fn join_path(fs_path: &str, join: &str) -> Option<String> {
// Paths that we join are written as source code (eg, `join_path(fs_path,
// "foo/bar.js")`) and it's expected that they will never contain a
// backslash.
debug_assert!(
!join.contains('\\'),
"joined path {} must not contain a Windows directory '\\', it must be normalized to Unix \
'/'",
join
);

/*
A task panicked: joined path node_modules/.pnpm/babel-plugin-react-compiler@0.0.0-experimental-58c2b1c-20241007/node_modules/babel-plugin-react-compiler/dist\\/ must not contain a Windows directory '\', it must be normalized to Unix '/'
*/

// debug_assert!(
// !join.contains('\\'),
// "joined path {} must not contain a Windows directory '\\', it must be normalized to Unix
// \ '/'",
// join
// );

// TODO: figure out why this freezes the benchmarks.
// // an absolute path would leave the file system root
Expand Down
22 changes: 11 additions & 11 deletions turbopack/crates/turbopack-core/src/issue/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ impl Issue for ResolvingIssue {

#[turbo_tasks::function]
async fn title(&self) -> Result<Vc<StyledString>> {
let module_not_found = StyledString::Strong("Module not found".into());

Ok(match self.request.await?.request() {
Some(request) => StyledString::Line(vec![
module_not_found,
StyledString::Text(": Can't resolve '".into()),
StyledString::Code(request),
StyledString::Text("'".into()),
]),
None => module_not_found,
}
let request = self
.request
.request_pattern()
.to_string()
.await?
.clone_value();
Ok(StyledString::Line(vec![
StyledString::Strong("Module not found".into()),
StyledString::Text(": Can't resolve ".into()),
StyledString::Code(request),
])
.cell())
}

Expand Down
4 changes: 3 additions & 1 deletion turbopack/crates/turbopack-ecmascript/src/references/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,9 @@ async fn handle_call<G: Fn(Vec<Effect>) + Send + Sync>(

JsValue::WellKnownFunction(WellKnownFunctionKind::RequireResolve) => {
let args = linked_args(args).await?;
if args.len() == 1 {
if args.len() == 1 || args.len() == 2 {
// TODO error TP1003 require.resolve(???*0*, {"paths": [???*1*]}) is not statically
// analyse-able with ignore_dynamic_requests = true
let pat = js_value_to_pattern(&args[0]);
if !pat.has_constant_parts() {
let (args, hints) = explain_args(&args);
Expand Down

0 comments on commit 21185b5

Please sign in to comment.