You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/05/17 03:02:53 UTC

[2/2] git commit: Compile CoffeeScript as with --bare

Compile CoffeeScript as with --bare


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9e76c372
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9e76c372
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9e76c372

Branch: refs/heads/master
Commit: 9e76c372bbae35881d384178160cb29c6799b347
Parents: bd26fb5
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu May 16 18:02:47 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu May 16 18:02:47 2013 -0700

----------------------------------------------------------------------
 .../wro4j/CoffeeScriptResourceCompiler.java        |    6 ++++--
 .../test/resources/META-INF/modules/index.coffee   |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9e76c372/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/CoffeeScriptResourceCompiler.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/CoffeeScriptResourceCompiler.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/CoffeeScriptResourceCompiler.java
index 0f691ad..9dd9ed3 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/CoffeeScriptResourceCompiler.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/CoffeeScriptResourceCompiler.java
@@ -29,7 +29,8 @@ import ro.isdc.wro.model.resource.processor.ResourcePreProcessor;
 import java.io.*;
 
 /**
- * Compiles CoffeeScript to JavaScript, using {@link RhinoCoffeeScriptProcessor}.
+ * Compiles CoffeeScript to JavaScript, using {@link RhinoCoffeeScriptProcessor}. Because what is most commonly written
+ * are AMD Modules, which have (effectively) an implicit hygenic function wrapper, we compile as with "--bare".
  *
  * @since 5.4
  */
@@ -44,10 +45,11 @@ public class CoffeeScriptResourceCompiler implements ResourceTransformer
     private final ResourcePreProcessor compiler =
             new RhinoCoffeeScriptProcessor()
             {
+
                 @Override
                 protected CoffeeScript newCoffeeScript()
                 {
-                    return new CoffeeScript();
+                    return new CoffeeScript().setOptions("bare");
                 }
             };
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9e76c372/tapestry-wro4j/src/test/resources/META-INF/modules/index.coffee
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/modules/index.coffee b/tapestry-wro4j/src/test/resources/META-INF/modules/index.coffee
index d8e9c1d..6f48b17 100644
--- a/tapestry-wro4j/src/test/resources/META-INF/modules/index.coffee
+++ b/tapestry-wro4j/src/test/resources/META-INF/modules/index.coffee
@@ -1,5 +1,5 @@
 require ["t5/core/dom"], (dom) ->
 
-  (dom "banner").update "Index module loaded !!!"
+  (dom "banner").update "Index module loaded, bare."