[Pkg-javascript-commits] [uglifyjs] 110/190: Create and map `bare-returns` into new `parse` property name

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Aug 7 23:17:18 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 cdba43cfa44c15fe12f87c356dad4caa5a946b5b
Author: Martii <thalamew at q.com>
Date:   Sat Feb 6 12:46:18 2016 -0700

    Create and map `bare-returns` into new `parse` property name
---
 README.md     | 11 ++++++++++-
 tools/node.js |  6 ++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 4bd1cab..a145bb6 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,9 @@ The available options are:
   --noerr                       Don't throw an error for unknown options in -c,
                                 -b or -m.
   --bare-returns                Allow return outside of functions.  Useful when
-                                minifying CommonJS modules.
+                                minifying CommonJS modules and Userscripts that
+                                may be anonymous function wrapped (IIFE) by the
+                                .user.js engine `caller`.
   --keep-fnames                 Do not mangle/drop function names.  Useful for
                                 code relying on Function.prototype.name.
   --reserved-file               File containing reserved names
@@ -636,6 +638,9 @@ Other options:
 - `compress` (default `{}`) — pass `false` to skip compressing entirely.
   Pass an object to specify custom [compressor options][compressor].
 
+- `parse` (default {}) — pass an object if you wish to specify some
+  additional [parser options][parser]. (not all options available... see below)
+
 ##### mangleProperties options
 
  - `regex` — Pass a RegExp to only mangle certain names (maps to the `--mange-regex` CLI arguments option)
@@ -658,6 +663,9 @@ properties are available:
 
 - `strict` — disable automatic semicolon insertion and support for trailing
   comma in arrays and objects
+- `bare_returns` — Allow return outside of functions. (maps to the
+  `--bare-returns` CLI arguments option and available to `minify` `parse`
+  other options object)
 - `filename` — the name of the file where this code is coming from
 - `toplevel` — a `toplevel` node (as returned by a previous invocation of
   `parse`)
@@ -797,3 +805,4 @@ The `source_map_options` (optional) can contain the following properties:
   [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
   [codegen]: http://lisperator.net/uglifyjs/codegen
   [compressor]: http://lisperator.net/uglifyjs/compress
+  [parser]: http://lisperator.net/uglifyjs/parser
diff --git a/tools/node.js b/tools/node.js
index 5764286..fa8c19d 100644
--- a/tools/node.js
+++ b/tools/node.js
@@ -42,7 +42,8 @@ exports.minify = function(files, options) {
         mangleProperties : false,
         nameCache        : null,
         output           : null,
-        compress         : {}
+        compress         : {},
+        parse            : {}
     });
     UglifyJS.base54.reset();
 
@@ -62,7 +63,8 @@ exports.minify = function(files, options) {
             sourcesContent[file] = code;
             toplevel = UglifyJS.parse(code, {
                 filename: options.fromString ? i : file,
-                toplevel: toplevel
+                toplevel: toplevel,
+                bare_returns: options.parse ? options.parse.bare_returns : undefined
             });
         });
     }

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