mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 01:07:55 -05:00
Ensure unique source maps’ sourceURL; closes #4126
This commit is contained in:
@@ -92,11 +92,13 @@
|
||||
};
|
||||
source = script.src || script.getAttribute('data-src');
|
||||
if (source) {
|
||||
options.filename = source;
|
||||
return CoffeeScript.load(source, function(param) {
|
||||
coffees[i] = param;
|
||||
return execute();
|
||||
}, options, true);
|
||||
} else {
|
||||
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
|
||||
options.sourceFiles = ['embedded'];
|
||||
return coffees[i] = [script.innerHTML, options];
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ runScripts = ->
|
||||
options = literate: script.type is coffeetypes[1]
|
||||
source = script.src or script.getAttribute('data-src')
|
||||
if source
|
||||
options.filename = source
|
||||
CoffeeScript.load source,
|
||||
(param) ->
|
||||
coffees[i] = param
|
||||
@@ -76,6 +77,12 @@ runScripts = ->
|
||||
options
|
||||
true
|
||||
else
|
||||
# `options.filename` defines how the filename the source map appears as
|
||||
# in Developer Tools. If a script tag has an `id`, use that as the
|
||||
# filename; otherwise use `coffeescript`, or `coffeescript1` etc.
|
||||
# leaving the first one unnumbered for the common case that there’s
|
||||
# only one CoffeeScript script block to parse.
|
||||
options.filename = if script.id and script.id isnt '' then script.id else "coffeescript#{if i isnt 0 then i else ''}"
|
||||
options.sourceFiles = ['embedded']
|
||||
coffees[i] = [script.innerHTML, options]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user