JSDOC/Packer.js
[gnome.introspection-doc-generator] / JSDOC / Packer.js
index 172374b..a4ec80e 100644 (file)
@@ -29,6 +29,7 @@ var x = new  Packer({
     target : "/tmp/output.js",
     debugTarget : "/tmp/output.debug.js", // merged file without compression.
     debugTranslateTarget : "/tmp/output.translate.js", // merged with translation
+                                                       // and no compression
     translateJSON: "/tmp/translate.json",
     
     
@@ -150,9 +151,16 @@ Packer.prototype = {
      */
     module: false,
     /**
-     * @cfg {String} debugTargettarget to write files debug version to (uncompacted)- must be full path.
+     * @cfg {String} debugTarget target to write files debug version to (uncompacted)- must be full path.
      */
     debugTarget : '', // merged file without compression.
+    /**
+     * @cfg {String} debugTranslateTarget target to write files debug version
+     *            to (uncompacted) but with translation- must be full path.
+     */
+    
+    debugTranslateTarget : '', 
+    
     /**
      * @cfg {String} tmpDir  (optional) where to put the temporary files. 
      *      if you set this, then files will not be cleaned up
@@ -224,6 +232,9 @@ Packer.prototype = {
         if (this.debugTarget) {
             File.write(this.debugTarget, "");
         }
+        if (this.debugTranslateTarget) {
+            File.write(this.debugTarget, "");
+        }
         
         for(var i=0; i < this.files.length; i++)  {
             var file = this.files[i];
@@ -261,7 +272,7 @@ Packer.prototype = {
                 }
                 
             }
-            
+             
             print("COMPRESSING ");
             //var codeComp = pack(str, 10, 0, 0);
             if (File.exists(minfile)) {
@@ -269,13 +280,19 @@ Packer.prototype = {
             }
             var str = File.read(file);
             var str = this.pack(str, file, minfile);
+            
+            
             if (str.length) {
                 File.write(minfile, str);
             }
             
              
           
-        }  
+        }
+        
+        // if we are translating, write the translations strings at the top
+        // of the file..
+        
         if (this.translateJSON) {
             
                
@@ -286,9 +303,7 @@ Packer.prototype = {
             } else {
                 this.out += out;
             }
-            
-            
-            
+             
             File.write(this.translateJSON, "");
             for(var i=0; i < this.files.length; i++)  {
                 var file = this.files[i];
@@ -410,6 +425,11 @@ Packer.prototype = {
         
         
         this.timerPrint("Compressed");
+        
+         if (out.length) {
+            File.write(minfile, str);
+        }
+        
         return out;