Source Map Standard

Joey Schorr jschorr at
Wed Apr 11 12:42:12 PDT 2012

On Wed, Apr 11, 2012 at 3:22 PM, David Bruant <bruant.d at> wrote:

> Le 11/04/2012 20:11, Joey Schorr a écrit :
> > Greetings ES Discuss!
> >
> > We (Joey Schorr and John Lenz, CCed) are some of the authors of the
> > source map specification that is now implemented by WebKit and
> > Firefox, as well as a number of compilers (Closure Compiler, GWT and
> > soon CoffeeScript).
> I have some more technical questions. Some are partially answered in the
> specification you linked to, but I'd be interested in a response here so
> that we can all discuss it.
> If I want to start tomorrow a language that compiles down to JavaScript,
> what constraints do I need to fulfill to be compatible with your
> specification?

There has to be a 1 -> many relationship between the input language and JS
as output; in other words, you can produce many JS locations that map back
to a single input location, but not vice versa (without losing some basic

> Am I constrained in my language design?

It is more or less a pure mapping, so I have not seen any constraints in my
experience (I've seen or worked on 4 languages mappings so far).

> Do I have constraints in my compiler (do I need to ship in a certain way)?

No, you just need to provide the source map file with your code.

> I see that language neutral stack tracing is not supported, but what is
> your experience with the languages you currently support? How different
> can it be from language to language? (related: is it worthwhile to get
> inspiration in the work for other languages?)

Stack tracing almost always requires additional information that is not in
the map (such as how to collapse native stack frames, how to name the
frames, etc). In my experience, to have excellent stack tracing, you need
additional code which uses the source map + additional metadata to make the
view much nicer. My own "perfect" stack trace mapping stored extra metadata
in the source map and then used a Firebug extension to annotate the stack
trace. Source maps support arbitrary metadata storage, so the user still
needed just a single file. However, from languages which are much closer in
input (Closure, for example), we have had stack trace mapping for errors
for sometime and it works quite well (not perfectly, but Good Enough (TM)).

> David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list