From 6fcabbde08cdac7890fedcc29b0342208998a871 Mon Sep 17 00:00:00 2001 From: ebednarz Date: Sun, 13 Apr 2014 11:16:10 +0200 Subject: [PATCH 1/2] Fix sourceMapIncludeSources exception in Node API https://github.com/mishoo/UglifyJS2/issues/459 --- tools/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/node.js b/tools/node.js index bef296ea..04e67e78 100644 --- a/tools/node.js +++ b/tools/node.js @@ -115,7 +115,7 @@ exports.minify = function(files, options) { if (options.sourceMapIncludeSources) { for (var file in sourcesContent) { if (sourcesContent.hasOwnProperty(file)) { - options.source_map.get().setSourceContent(file, sourcesContent[file]); + output.source_map.get().setSourceContent(file, sourcesContent[file]); } } } From ef772b0049828fef64e81ba49f564d45d880b27a Mon Sep 17 00:00:00 2001 From: OiNutter Date: Fri, 11 Apr 2014 16:09:56 +0100 Subject: [PATCH 2/2] add sourceMappingUrl to output in node module If options.outSourceMap is specified the sourceMappingURL comment should be appended to the output stream --- tools/node.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/node.js b/tools/node.js index 04e67e78..084998da 100644 --- a/tools/node.js +++ b/tools/node.js @@ -126,6 +126,11 @@ exports.minify = function(files, options) { } var stream = UglifyJS.OutputStream(output); toplevel.print(stream); + + if(options.outSourceMap){ + stream += "\n//# sourceMappingURL=" + options.outSourceMap; + } + return { code : stream + "", map : output.source_map + ""