mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
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:
@@ -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) ->
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user