aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto González Palomo <bugs@sentido-labs.com>2015-06-15 18:03:06 +0200
committerAlberto González Palomo <bugs@sentido-labs.com>2015-06-15 18:03:06 +0200
commit4fba3e0b80c3d1a5df04fa524f550868443aa784 (patch)
treef8b1ebcce59161ab2b393c3fb2b748ce332d3a0b
parent5bf617ebde8edd0720477944f84f69c9adec078e (diff)
downloadtracifyjs-4fba3e0b80c3d1a5df04fa524f550868443aa784.tar.gz
tracifyjs-4fba3e0b80c3d1a5df04fa524f550868443aa784.zip
fromString option, use index from argument array for filename instead of "?"
The index allows the caller to map things like parse errors back to the code chunk where they appeared.
-rw-r--r--tools/node.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/node.js b/tools/node.js
index cbe49e39..2eb90363 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -73,13 +73,13 @@ exports.minify = function(files, options) {
} else {
if (typeof files == "string")
files = [ files ];
- files.forEach(function(file){
+ files.forEach(function(file, i){
var code = options.fromString
? file
: fs.readFileSync(file, "utf8");
sourcesContent[file] = code;
toplevel = UglifyJS.parse(code, {
- filename: options.fromString ? "?" : file,
+ filename: options.fromString ? i : file,
toplevel: toplevel
});
});