aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArtemy Tregubenko <me@arty.name>2014-01-09 15:12:00 +0100
committerArtemy Tregubenko <me@arty.name>2014-01-09 15:12:00 +0100
commit03cf94ebe8b7bc87eccde800705beabf012ff275 (patch)
tree226c23d1f3a679f3ce0d3678dcbe6249ce9187e6 /tools
parentc3087dd179bcef93626ae8227bf8f0ac5baa15a2 (diff)
downloadtracifyjs-03cf94ebe8b7bc87eccde800705beabf012ff275.tar.gz
tracifyjs-03cf94ebe8b7bc87eccde800705beabf012ff275.zip
Added support for sourcesContent property of source map
Diffstat (limited to 'tools')
-rw-r--r--tools/node.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/node.js b/tools/node.js
index 7e6a38df..4dfa9338 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -64,7 +64,8 @@ exports.minify = function(files, options) {
UglifyJS.base54.reset();
// 1. parse
- var toplevel = null;
+ var toplevel = null,
+ sourcesContent = {};
if (options.spidermonkey) {
toplevel = UglifyJS.AST_Node.from_mozilla_ast(files);
@@ -75,6 +76,7 @@ exports.minify = function(files, options) {
var code = options.fromString
? file
: fs.readFileSync(file, "utf8");
+ sourcesContent[file] = code;
toplevel = UglifyJS.parse(code, {
filename: options.fromString ? "?" : file,
toplevel: toplevel
@@ -110,6 +112,12 @@ exports.minify = function(files, options) {
orig: inMap,
root: options.sourceRoot
});
+ if (options.sourceMapIncludeSources) {
+ for (var file in sourcesContent) {
+ options.source_map.get().setSourceContent(file, sourcesContent[file]);
+ }
+ }
+
}
if (options.output) {
UglifyJS.merge(output, options.output);