From 682a1bb12ef35cbe0707169f3143e52924058418 Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Wed, 22 Jan 2025 13:34:49 +0530 Subject: [PATCH 1/4] Bumping oxc-resolver and adding debug statements --- Cargo.toml | 2 +- crates/turbo-trace/src/tracer.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0d4af5ddad8b8..088c47d4b317a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,7 @@ notify = "6.1.1" num_cpus = "1.15.0" once_cell = "1.17.1" owo-colors = "3.5.0" -oxc_resolver = { version = "2.1.0" } +oxc_resolver = { version = "2.1.1" } parking_lot = "0.12.1" path-clean = "1.0.1" pathdiff = "0.2.1" diff --git a/crates/turbo-trace/src/tracer.rs b/crates/turbo-trace/src/tracer.rs index 5052ed7f926ed..9e06ecfefb283 100644 --- a/crates/turbo-trace/src/tracer.rs +++ b/crates/turbo-trace/src/tracer.rs @@ -439,6 +439,8 @@ impl Tracer { futures.spawn(async move { let file_resolver = Self::infer_resolver_with_ts_config(&file, &resolver); let resolver = file_resolver.as_ref().unwrap_or(&resolver); + eprintln!("file: {:?}", file); + eprintln!("resolver: {:?}", resolver); let mut errors = Vec::new(); let Some((imported_files, seen_file)) = Self::get_imports_from_file( @@ -450,10 +452,12 @@ impl Tracer { ) .await else { + eprintln!("failed to get imports from file"); return (errors, None); }; for import in imported_files { + eprintln!("import: {:?}", import); if shared_self .files .iter() From 9b56fd381f9d4c2c5ebb4227d9d8087ff4bca2ed Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Mon, 24 Feb 2025 16:20:04 -0500 Subject: [PATCH 2/4] Trying to hotfix --- Cargo.lock | 31 +++++++++++++++++++++++++------ Cargo.toml | 2 +- crates/turbo-trace/src/tracer.rs | 9 ++++++--- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb16c0e1f59cf..9ff47b07ef1e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3729,15 +3729,14 @@ dependencies = [ [[package]] name = "oxc_resolver" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da33ec82d0f4770f4b5c120d6a1d8e45de2d99ae2672a7ee6bd29092ada945f2" +version = "4.2.0" +source = "git+https://github.com/nicholaslyang/oxc-resolver?branch=symlink-hotfix-again#a9e3fa452ec43352dc7bc0ddc2ef19342dbd0574" dependencies = [ "cfg-if", - "dashmap 6.1.0", "indexmap 2.2.6", "json-strip-comments", "once_cell", + "papaya", "rustc-hash 2.0.0", "serde", "serde_json", @@ -3746,6 +3745,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "papaya" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab21828b6b5952fdadd6c377728ffae53ec3a21b2febc47319ab65741f7e2fd" +dependencies = [ + "equivalent", + "seize", +] + [[package]] name = "parking" version = "2.0.0" @@ -4764,6 +4773,16 @@ dependencies = [ "libc", ] +[[package]] +name = "seize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b8d813387d566f627f3ea1b914c068aac94c40ae27ec43f5f33bde65abefe7" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "semver" version = "0.9.0" @@ -6213,7 +6232,7 @@ dependencies = [ "futures", "globwalk", "miette", - "oxc_resolver 2.1.1", + "oxc_resolver 4.2.0", "swc_common", "swc_ecma_ast", "swc_ecma_parser", @@ -6529,7 +6548,7 @@ dependencies = [ "notify", "num_cpus", "owo-colors 3.5.0", - "oxc_resolver 2.1.1", + "oxc_resolver 4.2.0", "path-clean", "petgraph", "pidlock", diff --git a/Cargo.toml b/Cargo.toml index 088c47d4b317a..ee575afa06481 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,7 @@ notify = "6.1.1" num_cpus = "1.15.0" once_cell = "1.17.1" owo-colors = "3.5.0" -oxc_resolver = { version = "2.1.1" } +oxc_resolver = { git = "https://github.com/nicholaslyang/oxc-resolver", branch = "symlink-hotfix-again" } parking_lot = "0.12.1" path-clean = "1.0.1" pathdiff = "0.2.1" diff --git a/crates/turbo-trace/src/tracer.rs b/crates/turbo-trace/src/tracer.rs index 9e06ecfefb283..5c054957d11c8 100644 --- a/crates/turbo-trace/src/tracer.rs +++ b/crates/turbo-trace/src/tracer.rs @@ -439,8 +439,7 @@ impl Tracer { futures.spawn(async move { let file_resolver = Self::infer_resolver_with_ts_config(&file, &resolver); let resolver = file_resolver.as_ref().unwrap_or(&resolver); - eprintln!("file: {:?}", file); - eprintln!("resolver: {:?}", resolver); + eprintln!("file: {:?}", shared_self.cwd.anchor(&file)); let mut errors = Vec::new(); let Some((imported_files, seen_file)) = Self::get_imports_from_file( @@ -456,8 +455,12 @@ impl Tracer { return (errors, None); }; + if imported_files.is_empty() { + eprintln!("no imports found for {}", file); + } + for import in imported_files { - eprintln!("import: {:?}", import); + eprintln!("import: {:?}", shared_self.cwd.anchor(&import)); if shared_self .files .iter() From cff984e3cee45d62dffece87cd34e9e87fa69b69 Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Mon, 24 Feb 2025 17:39:24 -0500 Subject: [PATCH 3/4] Attempting to fix by canonicalizing path on Windows --- crates/turbo-trace/src/tracer.rs | 20 ++++++++++++++++---- crates/turborepo-lib/src/query/file.rs | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/turbo-trace/src/tracer.rs b/crates/turbo-trace/src/tracer.rs index 5c054957d11c8..dc0392c5796df 100644 --- a/crates/turbo-trace/src/tracer.rs +++ b/crates/turbo-trace/src/tracer.rs @@ -48,7 +48,7 @@ pub enum TraceError { #[error("failed to read file: {0}")] FileNotFound(AbsoluteSystemPathBuf), #[error(transparent)] - PathEncoding(Arc), + PathError(Arc), #[error("tracing a root file `{0}`, no parent found")] RootFile(AbsoluteSystemPathBuf), #[error("failed to resolve import to `{import}` in `{file_path}`")] @@ -212,7 +212,7 @@ impl Tracer { match resolved.into_path_buf().try_into().map_err(Arc::new) { Ok(path) => files.push(path), Err(err) => { - errors.push(TraceError::PathEncoding(err)); + errors.push(TraceError::PathError(err)); continue; } } @@ -459,8 +459,20 @@ impl Tracer { eprintln!("no imports found for {}", file); } - for import in imported_files { - eprintln!("import: {:?}", shared_self.cwd.anchor(&import)); + for mut import in imported_files { + if cfg!(windows) { + match import.to_realpath() { + Ok(path) => { + import = path; + } + Err(err) => { + errors.push(TraceError::PathError(Arc::new(err))); + eprintln!("failed to canonicalize import: {}", import); + return (errors, None); + } + } + } + if shared_self .files .iter() diff --git a/crates/turborepo-lib/src/query/file.rs b/crates/turborepo-lib/src/query/file.rs index 49251173b6078..7be10fba8389e 100644 --- a/crates/turborepo-lib/src/query/file.rs +++ b/crates/turborepo-lib/src/query/file.rs @@ -81,7 +81,7 @@ impl From for Diagnostic { path: Some(file.to_string()), ..Default::default() }, - turbo_trace::TraceError::PathEncoding(_) => Diagnostic { + turbo_trace::TraceError::PathError(_) => Diagnostic { message, ..Default::default() }, From 985e707a431006d81acc5a39eb3856da117e42d1 Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Mon, 24 Feb 2025 18:02:49 -0500 Subject: [PATCH 4/4] Cleaning up --- Cargo.lock | 4 +++- Cargo.toml | 2 +- crates/turbo-trace/src/tracer.rs | 7 ------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff47b07ef1e8..2eedf71bc10b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3730,7 +3730,8 @@ dependencies = [ [[package]] name = "oxc_resolver" version = "4.2.0" -source = "git+https://github.com/nicholaslyang/oxc-resolver?branch=symlink-hotfix-again#a9e3fa452ec43352dc7bc0ddc2ef19342dbd0574" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c4d9cffbd24c3a874bd44cce4384cb73bf732c4fe4aa99c4406b2e0c4027bb" dependencies = [ "cfg-if", "indexmap 2.2.6", @@ -3738,6 +3739,7 @@ dependencies = [ "once_cell", "papaya", "rustc-hash 2.0.0", + "seize", "serde", "serde_json", "simdutf8", diff --git a/Cargo.toml b/Cargo.toml index ee575afa06481..a1faad4ca4c6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,7 @@ notify = "6.1.1" num_cpus = "1.15.0" once_cell = "1.17.1" owo-colors = "3.5.0" -oxc_resolver = { git = "https://github.com/nicholaslyang/oxc-resolver", branch = "symlink-hotfix-again" } +oxc_resolver = "4.2.0" parking_lot = "0.12.1" path-clean = "1.0.1" pathdiff = "0.2.1" diff --git a/crates/turbo-trace/src/tracer.rs b/crates/turbo-trace/src/tracer.rs index dc0392c5796df..06699349e2ac3 100644 --- a/crates/turbo-trace/src/tracer.rs +++ b/crates/turbo-trace/src/tracer.rs @@ -439,7 +439,6 @@ impl Tracer { futures.spawn(async move { let file_resolver = Self::infer_resolver_with_ts_config(&file, &resolver); let resolver = file_resolver.as_ref().unwrap_or(&resolver); - eprintln!("file: {:?}", shared_self.cwd.anchor(&file)); let mut errors = Vec::new(); let Some((imported_files, seen_file)) = Self::get_imports_from_file( @@ -451,14 +450,9 @@ impl Tracer { ) .await else { - eprintln!("failed to get imports from file"); return (errors, None); }; - if imported_files.is_empty() { - eprintln!("no imports found for {}", file); - } - for mut import in imported_files { if cfg!(windows) { match import.to_realpath() { @@ -467,7 +461,6 @@ impl Tracer { } Err(err) => { errors.push(TraceError::PathError(Arc::new(err))); - eprintln!("failed to canonicalize import: {}", import); return (errors, None); } }