diff --git a/CHANGELOG.md b/CHANGELOG.md index 6366a4d92..0d9f73b94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ **Master** +- Apply source map section columns only to their first line. [Oskar Eichler](https://github.com/OskarEichler) + Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md # 4.4.1 diff --git a/README.md b/README.md index 958b44cd4..e20772bb8 100644 --- a/README.md +++ b/README.md @@ -714,3 +714,5 @@ Please see the [CHANGELOG](https://github.com/rails/sprockets/tree/master/CHANGE ## License Sprockets is released under the [MIT License](MIT-LICENSE). + +Index source map column offsets apply only to the first generated line of each section, while line offsets apply to all lines. diff --git a/lib/sprockets/source_map_utils.rb b/lib/sprockets/source_map_utils.rb index b2ae018be..754224204 100644 --- a/lib/sprockets/source_map_utils.rb +++ b/lib/sprockets/source_map_utils.rb @@ -196,8 +196,8 @@ def decode_source_map(map) if map["sections"] map["sections"].each do |s| mappings += decode_source_map(s["map"])[:mappings].each do |m| + m[:generated][1] += s["offset"]["column"] if m[:generated][0] == 1 m[:generated][0] += s["offset"]["line"] - m[:generated][1] += s["offset"]["column"] end sources |= s["map"]["sources"] names |= s["map"]["names"]