Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting line numbers from mappings

107 views
Skip to first unread message

richard....@gmail.com

unread,
Nov 12, 2017, 1:48:02 PM11/12/17
to mozilla-dev-...@lists.mozilla.org
I have a question when generating and reading mappings. In the v3 spec it says:

> The “mappings” data is broken down as follows: each group representing a line in the generated file is separated by a ”;”


Does this mean that the mapping should have the same number of semi-colons as lines and if it doesn't then it's a bug? Or are empty lines allowed to be omitted?

I'm asking because i'm trying to fix a piece of code that relies on this logic to concat source maps https://github.com/rails/sprockets/blob/341fed4f91e0dfd75f9740ee77885488db58aecd/lib/sprockets/source_map_utils.rb#L80

However it looks like coffeescript skips adding a mapping group for empty lines, so that technique is thrown off.

If empty lines can be omitted from mappings does anyone have another good way to concatenate source maps if the generated files are not available?

Tom Tromey

unread,
Nov 13, 2017, 11:39:08 AM11/13/17
to richard....@gmail.com, mozilla-dev-...@lists.mozilla.org
>>>>> "richard" == richard schneeman <richard....@gmail.com> writes:

>> The “mappings” data is broken down as follows: each group
>> representing a line in the generated file is separated by a ”;”


richard> Does this mean that the mapping should have the same number of
richard> semi-colons as lines and if it doesn't then it's a bug? Or are empty
richard> lines allowed to be omitted?

I think each line of the generated file has to be represented by a
group, because the generated line number is not explicit in the
encoding.

richard> However it looks like coffeescript skips adding a mapping group
richard> for empty lines, so that technique is thrown off.

This sounds like a coffeescript bug.

Tom

richard....@gmail.com

unread,
Nov 13, 2017, 5:28:26 PM11/13/17
to mozilla-dev-...@lists.mozilla.org
Thanks for the reply. I've opened up an issue with Coffee script with details on how to reproduce https://github.com/jashkenas/coffeescript/issues/4786.

0 new messages