[Pkg-javascript-commits] [uglifyjs] 45/190: add `--pure-funcs` option

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Aug 7 23:17:11 UTC 2016


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

terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.

commit d5138f74677012b301636cad6d218486e53265e2
Author: Damian Krzeminski <pirxpilot at code42day.com>
Date:   Tue Oct 13 21:05:37 2015 -0400

    add `--pure-funcs` option
    
    it has the same effect as specifying `pure_funcs` in `--compressor`
    option, however it's much easier to use
    
    instead of:
    
        --compressor 'pure_func=["Math.floor","debug","console.logTime"]'
    
    it's now possible:
    
        --compressor --pure-funcs Math.floor debug console.logTime
    
    fixes #684
---
 README.md    | 2 ++
 bin/uglifyjs | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/README.md b/README.md
index b6abc37..c243454 100644
--- a/README.md
+++ b/README.md
@@ -134,6 +134,8 @@ The available options are:
   --mangle-props                Mangle property names
   --mangle-regex                Only mangle property names matching the regex
   --name-cache                  File to hold mangled names mappings
+  --pure-funcs                  List of functions that can be safely removed if
+                                their return value is not used           [array]
 ```
 
 Specify `--output` (`-o`) to declare the output file.  Otherwise the output
diff --git a/bin/uglifyjs b/bin/uglifyjs
index f82d43c..ca75f15 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -72,6 +72,7 @@ You need to pass an argument to this option to specify the name that your module
     .describe("mangle-props", "Mangle property names")
     .describe("mangle-regex", "Only mangle property names matching the regex")
     .describe("name-cache", "File to hold mangled names mappings")
+    .describe("pure-funcs", "List of functions that can be safely removed if their return value is not used")
 
     .alias("p", "prefix")
     .alias("o", "output")
@@ -104,6 +105,7 @@ You need to pass an argument to this option to specify the name that your module
     .string("prefix")
     .string("name-cache")
     .array("reserved-file")
+    .array("pure-funcs")
 
     .boolean("expr")
     .boolean("source-map-include-sources")
@@ -175,6 +177,10 @@ if (ARGS.d) {
     if (COMPRESS) COMPRESS.global_defs = getOptions("d");
 }
 
+if (ARGS.pure_funcs) {
+    if (COMPRESS) COMPRESS.pure_funcs = ARGS.pure_funcs;
+}
+
 if (ARGS.r) {
     if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/);
 }

-- 
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