[Pkg-javascript-commits] [uglifyjs] 139/491: fix CLI parsing of `--source-map content` (#2088)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:29 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 82db9188ac2f0a6ffa4c7ab4c7d4c0ade3d93de9
Author: Ziad El Khoury Hanna <zaygraveyard at users.noreply.github.com>
Date:   Tue Jun 13 10:30:46 2017 +0200

    fix CLI parsing of `--source-map content` (#2088)
    
    fixes #2082
---
 bin/uglifyjs                        |  2 +-
 test/input/issue-2082/sample.js     |  1 +
 test/input/issue-2082/sample.js.map |  1 +
 test/mocha/cli.js                   | 17 +++++++++++++++++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/bin/uglifyjs b/bin/uglifyjs
index 52708cc..f4feb39 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -371,7 +371,7 @@ function parse_js(flag, constants) {
 function parse_source_map() {
     var parse = parse_js("sourceMap", true);
     return function(value, options) {
-        var hasContent = options && options.sourceMap && "content" in options.sourceMap;
+        var hasContent = options && "content" in options;
         var settings = parse(value, options);
         if (!hasContent && settings.content && settings.content != "inline") {
             print_error("INFO: Using input source map: " + settings.content);
diff --git a/test/input/issue-2082/sample.js b/test/input/issue-2082/sample.js
new file mode 100644
index 0000000..f92e3a1
--- /dev/null
+++ b/test/input/issue-2082/sample.js
@@ -0,0 +1 @@
+console.log(x);
\ No newline at end of file
diff --git a/test/input/issue-2082/sample.js.map b/test/input/issue-2082/sample.js.map
new file mode 100644
index 0000000..88b42f5
--- /dev/null
+++ b/test/input/issue-2082/sample.js.map
@@ -0,0 +1 @@
+{"version": 3,"sources": ["index.js"],"mappings": ";"}
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index 3228e4e..fa6f146 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -77,6 +77,23 @@ describe("bin/uglifyjs", function () {
             done();
         });
     });
+    it("should not consider source map file content as source map file name (issue #2082)", function (done) {
+        var command = [
+            uglifyjscmd,
+            "test/input/issue-2082/sample.js",
+            "--source-map", "content=test/input/issue-2082/sample.js.map",
+            "--source-map", "url=inline",
+        ].join(" ");
+
+        exec(command, function (err, stdout, stderr) {
+            if (err) throw err;
+
+            var stderrLines = stderr.split('\n');
+            assert.strictEqual(stderrLines[0], 'INFO: Using input source map: test/input/issue-2082/sample.js.map');
+            assert.notStrictEqual(stderrLines[1], 'INFO: Using input source map: {"version": 3,"sources": ["index.js"],"mappings": ";"}');
+            done();
+        });
+    });
     it("Should work with --keep-fnames (mangle only)", function (done) {
         var command = uglifyjscmd + ' test/input/issue-1431/sample.js --keep-fnames -m';
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list