[Pkg-javascript-commits] [uglifyjs] 25/190: Fix wrap_commonjs to include code first

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Aug 7 23:17:09 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 33528002b496728457cccd9ddf54d2e50bc7e3f2
Author: Mihai Bazon <mihai.bazon at gmail.com>
Date:   Thu Sep 24 17:55:37 2015 +0300

    Fix wrap_commonjs to include code first
    
    (code could have directives, i.e. "use strict")
---
 lib/ast.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/ast.js b/lib/ast.js
index 2e539cf..c317670 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -329,12 +329,11 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", {
                 }
             }));
         }
-        var wrapped_tl = "(function(exports, global){ global['" + name + "'] = exports; '$ORIG'; '$EXPORTS'; }({}, (function(){return this}())))";
+        var wrapped_tl = "(function(exports, global){ '$ORIG'; '$EXPORTS'; global['" + name + "'] = exports; }({}, (function(){return this}())))";
         wrapped_tl = parse(wrapped_tl);
         wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){
-            if (node instanceof AST_SimpleStatement) {
-                node = node.body;
-                if (node instanceof AST_String) switch (node.getValue()) {
+            if (node instanceof AST_Directive) {
+                switch (node.value) {
                   case "$ORIG":
                     return MAP.splice(self.body);
                   case "$EXPORTS":

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