Skip to content

Commit

Permalink
fix(sourcemap): update sourcemap, remove checker (#7823)
Browse files Browse the repository at this point in the history
### Description

While debugging
https://vercel.slack.com/archives/C03EWR7LGEN/p1711146825831219?thread_ts=1711143217.892349&cid=C03EWR7LGEN,
found out sourcemap lookup fails on certain source and always returns
synthetictoken only.

Weirdly, the guards in this PR
https://github.com/vercel/turbo/pull/7823/files#diff-2ce67e28c5b3144ec6f7a89167f3c96da9f9e268abf3fd685ce881d75a4cd8a5L319
is preventing those lookup - removing it makes correct sourcemap lookup
occurs. I updated pkg to the version what swc uses and removed + ran
next.js tests, seems like most of tests are running just fine

(vercel/next.js#63624)

Still not 100% sure if this'll be ok or not, if not open to change for
the correct fixes. Some related fixes
getsentry/rust-sourcemap#60 might be the reason
we don't see any regressions in the test.
  • Loading branch information
kwonoj authored Mar 24, 2024
1 parent 97950cd commit d4cc4e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ smallvec = { version = "1.13.1", features = [
"union",
"const_new",
] }
sourcemap = "6.0.2"
sourcemap = "6.4.1"
syn = "1.0.107"
tempfile = "3.3.0"
test-case = "3.0.0"
Expand Down
3 changes: 0 additions & 3 deletions crates/turbopack-core/src/source_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ impl SourceMap {
SourceMap::Decoded(map) => {
let mut token = map
.lookup_token(line as u32, column as u32)
// The sourcemap crate incorrectly returns a previous line's token when there's
// not a match on this line.
.filter(|t| t.get_dst_line() == line as u32)
.map(Token::from)
.unwrap_or_else(|| {
Token::Synthetic(SyntheticToken {
Expand Down

0 comments on commit d4cc4e0

Please sign in to comment.