From d9fab8496058c0d46eb10918d6e825e73ca101b2 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Mon, 9 Oct 2023 16:04:38 +0200 Subject: [PATCH 1/2] fix: Correctly flatten index sourcemaps --- src/types.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/types.rs b/src/types.rs index a7da53e7..3e5b814f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1133,9 +1133,14 @@ impl SourceMapIndex { }; for token in map.tokens() { + let dst_col = if token.get_dst_line() == 0 { + token.get_dst_col() + off_col + } else { + token.get_dst_col() + }; let raw = builder.add( token.get_dst_line() + off_line, - token.get_dst_col() + off_col, + dst_col, token.get_src_line(), token.get_src_col(), token.get_source(), From b450af27abb200f7fa492fe80b06437ea9e691ee Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Mon, 9 Oct 2023 16:08:47 +0200 Subject: [PATCH 2/2] Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6095a2b9..04a06dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Various fixes and improvements + +- fix: Fixed a bug in index sourcemap flattening (#74) by @loewenheim + ## 7.0.0 ### Various fixes and improvements