From 4fba3e0b80c3d1a5df04fa524f550868443aa784 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alberto=20Gonz=C3=A1lez=20Palomo?= Date: Mon, 15 Jun 2015 18:03:06 +0200 Subject: [PATCH] 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. --- tools/node.js | 4 ++-- 1 file 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 }); }); -- 2.34.1