Fixed key name in source map, added coffee file to map sources

These are the modifications I had to do in order to get source maps working
in 27.0.1425.2 (Official Build 185250) canary. I haven't tested other
browsers.

I first looked at the V3 spec and a few examples, and I saw that the
`source` key of the source map should be called `sources`.

After doing the `source` to `sources` change, the coffee source and for
some odd reason the javascript file would not show up in the browser
dev tools (it was being fetched but not evaluated).

To fix this, I had to add the coffee source to the `sources` list in the
source map file.
This commit is contained in:
Nicolas Porter
2013-03-01 05:58:26 -05:00
parent 7073d18f23
commit 88e02322e5
5 changed files with 10 additions and 5 deletions

View File

@@ -279,7 +279,8 @@ writeJs = (base, sourcePath, js, sourceMap = null) ->
else if opts.compile and opts.watch
timeLog "compiled #{sourcePath}"
if sourceMap
fs.writeFile sourceMapPath, (sourcemap.generateV3SourceMap sourceMap), (err) ->
generatedSourceMap = sourcemap.generateV3SourceMap sourceMap, base
fs.writeFile sourceMapPath, generatedSourceMap, (err) ->
if err
printLine "Could not write source map: #{err.message}"
exists jsDir, (itExists) ->

View File

@@ -146,7 +146,7 @@ exports.generateV3SourceMap = (sourceMap, sourceFile=null, generatedFile=null) -
version: 3
file: generatedFile
sourceRoot: ""
source: [sourceFile]
sources: if sourceFile then [sourceFile] else []
names: []
mappings
}