You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/26 20:07:44 UTC

[1/7] js commit: Fixed Windows path issue when trying to set "navigator.app" in cordova.js

Repository: cordova-js
Updated Branches:
  refs/heads/master 58e9d6cd0 -> 912f028b9


Fixed Windows path issue when trying to set "navigator.app" in cordova.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/826be56d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/826be56d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/826be56d

Branch: refs/heads/master
Commit: 826be56d2f94b0a6ca73a62949d043f96c0e6c4f
Parents: ff0358b
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Mon Aug 18 16:36:06 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Mon Aug 18 16:36:06 2014 -0700

----------------------------------------------------------------------
 tasks/lib/require-tr.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/826be56d/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index f495e89..12117dd 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -44,7 +44,10 @@ var requireTr = {
 
     function end() {
         // SOME BS pre-transforms
-      if(file.match(/android\/platform.js$/)) {
+      if(file.match(/android\/platform.js$/) || file.match(/android\\platform.js$/)) {
+
+        // Checking for '\' from the windows path
+        root = root.replace(/\\/g, "/");
         data = data.replace(/modulemapper\.clobbers.*\n/,
                             util.format('navigator.app = require("%s/src/android/plugin/android/app")', root));
       }
@@ -77,7 +80,6 @@ var requireTr = {
  * visits AST and modifies all the require('cordova/*') and require('org.apache.cordova.*')
  */
 function _updateRequires(code) {
-  
   var ast = UglifyJS.parse(code);
 
   var before = new UglifyJS.TreeTransformer(function(node, descend) {
@@ -86,7 +88,15 @@ function _updateRequires(code) {
     if(node instanceof UglifyJS.AST_Call) {
       // check if function call is a require('module') call
       if(node.expression.name === "require" && node.args.length === 1) {
+
+        // Uglify is not able to recognize Windows style paths using '\' instead of '/'
+        // So replacing all of the '/' back to Windows '\'
+        if (node.args[0].value != undefined && node.args[0].value.indexOf('c:') != -1) {
+            node.args[0].value = node.args[0].value.replace(/\//g, '\\');
+        }
+
         var module = node.args[0].value;
+
         // make sure require only has one argument and that it starts with cordova (old style require.js)
         if(module !== undefined &&
            module.indexOf("cordova") === 0) {


[6/7] js commit: Removed old comment

Posted by st...@apache.org.
Removed old comment


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/8520c662
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/8520c662
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/8520c662

Branch: refs/heads/master
Commit: 8520c66281fd2727d27c6601dbb44a966d3d1892
Parents: de45d81
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Tue Aug 26 10:17:07 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Tue Aug 26 10:17:07 2014 -0700

----------------------------------------------------------------------
 tasks/lib/require-tr.js | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8520c662/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index ed0e95d..c71ab98 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -105,8 +105,6 @@ function _updateRequires(code) {
 
         // Uglify is not able to recognize Windows style paths using '\' instead of '/'
         // So replacing all of the '/' back to Windows '\'
-
-        // FIXME: need to better handle cases of modulemapper replace
         if (node.args[0].value !== undefined && node.args[0].value.indexOf(root) !== -1 && process.platform === 'win32') {
             node.args[0].value = node.args[0].value.replace(/\//g, '\\');
         }


[7/7] js commit: Merge branch 'modulemapperClobbers' of github.com:surajpindoria/cordova-js

Posted by st...@apache.org.
Merge branch 'modulemapperClobbers' of github.com:surajpindoria/cordova-js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/912f028b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/912f028b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/912f028b

Branch: refs/heads/master
Commit: 912f028b970bf0f772f1cc976cd2f29c53084d36
Parents: 58e9d6c 8520c66
Author: Steven Gill <st...@gmail.com>
Authored: Tue Aug 26 11:07:07 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Tue Aug 26 11:07:07 2014 -0700

----------------------------------------------------------------------
 src/browser/platform.js   |  8 +++-----
 src/firefoxos/platform.js |  4 +++-
 tasks/lib/require-tr.js   | 30 +++++++++++++++++++++++++++---
 3 files changed, 33 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[2/7] js commit: Removed check for "c:" and added check for windows platform

Posted by st...@apache.org.
Removed check for "c:" and added check for windows platform


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/bf4c4db8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/bf4c4db8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/bf4c4db8

Branch: refs/heads/master
Commit: bf4c4db8539bf036e83107d9250c99c266a7a991
Parents: 826be56
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Tue Aug 19 11:23:45 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Tue Aug 19 11:23:45 2014 -0700

----------------------------------------------------------------------
 tasks/lib/require-tr.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/bf4c4db8/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index 12117dd..6c61b1a 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -91,7 +91,7 @@ function _updateRequires(code) {
 
         // Uglify is not able to recognize Windows style paths using '\' instead of '/'
         // So replacing all of the '/' back to Windows '\'
-        if (node.args[0].value != undefined && node.args[0].value.indexOf('c:') != -1) {
+        if (node.args[0].value !== undefined && node.args[0].value.indexOf('/android/app') !== -1 && process.platform === 'win32') {
             node.args[0].value = node.args[0].value.replace(/\//g, '\\');
         }
 


[4/7] js commit: Better handling of all "modulemapper.clobbers" replacements

Posted by st...@apache.org.
Better handling of all "modulemapper.clobbers" replacements


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/4ccaed2a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/4ccaed2a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/4ccaed2a

Branch: refs/heads/master
Commit: 4ccaed2a80f8e9be4dc7d1086b8d2b5b603c9cab
Parents: feb58c4
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Fri Aug 22 14:04:04 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Fri Aug 22 14:04:04 2014 -0700

----------------------------------------------------------------------
 src/browser/platform.js   |  4 ++--
 src/firefoxos/platform.js |  4 +++-
 tasks/lib/require-tr.js   | 26 ++++++++++++++++++--------
 3 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4ccaed2a/src/browser/platform.js
----------------------------------------------------------------------
diff --git a/src/browser/platform.js b/src/browser/platform.js
index b8f7ac3..0514059 100644
--- a/src/browser/platform.js
+++ b/src/browser/platform.js
@@ -25,10 +25,10 @@ module.exports = {
 
     bootstrap: function() {
 
-        var moduleMapper = require('cordova/modulemapper');
+        var modulemapper = require('cordova/modulemapper');
         var channel = require('cordova/channel');
 
-        moduleMapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
+        modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
 
         channel.onNativeReady.fire();
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4ccaed2a/src/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/platform.js b/src/firefoxos/platform.js
index 7fac8a4..b7d89b8 100644
--- a/src/firefoxos/platform.js
+++ b/src/firefoxos/platform.js
@@ -23,7 +23,9 @@ module.exports = {
     id: 'firefoxos',
 
     bootstrap: function() {
-        require('cordova/modulemapper').clobbers('cordova/exec/proxy', 'cordova.commandProxy');
+        var modulemapper = require('cordova/modulemapper');
+
+        modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
         require('cordova/channel').onNativeReady.fire();
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4ccaed2a/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index 7669993..87fe55a 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -43,18 +43,28 @@ var requireTr = {
     }
 
     function end() {
-      if(file.match(/browser\/platform.js$/) || file.match(/browser\\platform.js$/)) {
-        data = data.replace(/moduleMapper\.clobbers.*\n/,
-                            util.format('cordova.commandProxy = require("%s/src/common/exec/proxy")', root));
-      }
         // SOME BS pre-transforms
-      if(file.match(/android\/platform.js$/) || file.match(/android\\platform.js$/)) {
+      if(data.match(/clobbers\('cordova\/plugin\/android\/app/)) {
+        // Checking for '\' from the windows path
+        root = root.replace(/\\/g, '/');
+
+        if(file.match(/android\/platform.js$/)) {
+          data = data.replace(/modulemapper\.clobbers.*\n/,
+                              util.format('navigator.app = require("%s/src/android/plugin/android/app")', root));
+        } else if (file.match(/amazon-fireos\/platform.js$/)) {
+          data = data.replace(/modulemapper\.clobbers.*\n/,
+                              util.format('navigator.app = require("%s/src/amazon-fireos/plugin/android/app")', root));
+        }
+      }
 
+      if(data.match(/clobbers\('cordova\/exec\/proxy/)) {
         // Checking for '\' from the windows path
-        root = root.replace(/\\/g, "/");
+        root = root.replace(/\\/g, '/');
+
         data = data.replace(/modulemapper\.clobbers.*\n/,
-                            util.format('navigator.app = require("%s/src/android/plugin/android/app")', root));
+                            util.format('cordova.commandProxy = require("%s/src/common/exec/proxy");', root));
       }
+
       if(file.match(/FileReader.js$/)) {
         data = data.replace(/getOriginalSymbol\(this/,
                             'getOriginalSymbol(window');
@@ -97,7 +107,7 @@ function _updateRequires(code) {
         // So replacing all of the '/' back to Windows '\'
 
         // FIXME: need to better handle cases of modulemapper replace
-        if (node.args[0].value !== undefined && node.args[0].value.indexOf('/android/app') !== -1 && process.platform === 'win32') {
+        if (node.args[0].value !== undefined && node.args[0].value.indexOf(root) !== -1 && process.platform === 'win32') {
             node.args[0].value = node.args[0].value.replace(/\//g, '\\');
         }
 


[3/7] js commit: Fixed browserify onDeviceReady event not firing on the browser

Posted by st...@apache.org.
Fixed browserify onDeviceReady event not firing on the browser


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/feb58c41
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/feb58c41
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/feb58c41

Branch: refs/heads/master
Commit: feb58c41daba2d59caa7adbf4178b24a763472b1
Parents: bf4c4db
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Thu Aug 21 17:08:20 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Thu Aug 21 17:08:20 2014 -0700

----------------------------------------------------------------------
 src/browser/platform.js | 4 +---
 tasks/lib/require-tr.js | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/feb58c41/src/browser/platform.js
----------------------------------------------------------------------
diff --git a/src/browser/platform.js b/src/browser/platform.js
index 8015cef..b8f7ac3 100644
--- a/src/browser/platform.js
+++ b/src/browser/platform.js
@@ -30,9 +30,7 @@ module.exports = {
 
         moduleMapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
 
-        channel.onPluginsReady.subscribe(function () {
-            channel.onNativeReady.fire();
-        });
+        channel.onNativeReady.fire();
 
         // FIXME is this the right place to clobber pause/resume? I am guessing not
         // FIXME pause/resume should be deprecated IN CORDOVA for pagevisiblity api

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/feb58c41/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index 6c61b1a..7669993 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -43,6 +43,10 @@ var requireTr = {
     }
 
     function end() {
+      if(file.match(/browser\/platform.js$/) || file.match(/browser\\platform.js$/)) {
+        data = data.replace(/moduleMapper\.clobbers.*\n/,
+                            util.format('cordova.commandProxy = require("%s/src/common/exec/proxy")', root));
+      }
         // SOME BS pre-transforms
       if(file.match(/android\/platform.js$/) || file.match(/android\\platform.js$/)) {
 
@@ -91,6 +95,8 @@ function _updateRequires(code) {
 
         // Uglify is not able to recognize Windows style paths using '\' instead of '/'
         // So replacing all of the '/' back to Windows '\'
+
+        // FIXME: need to better handle cases of modulemapper replace
         if (node.args[0].value !== undefined && node.args[0].value.indexOf('/android/app') !== -1 && process.platform === 'win32') {
             node.args[0].value = node.args[0].value.replace(/\//g, '\\');
         }


[5/7] js commit: Checking for windows style path

Posted by st...@apache.org.
Checking for windows style path


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/de45d81a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/de45d81a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/de45d81a

Branch: refs/heads/master
Commit: de45d81a84b3b528baad4c14f9d8c9ddb9c8f2bd
Parents: 4ccaed2
Author: Suraj Pindoria <su...@yahoo.com>
Authored: Fri Aug 22 14:08:24 2014 -0700
Committer: Suraj Pindoria <su...@yahoo.com>
Committed: Fri Aug 22 14:08:24 2014 -0700

----------------------------------------------------------------------
 tasks/lib/require-tr.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/de45d81a/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index 87fe55a..ed0e95d 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -48,10 +48,10 @@ var requireTr = {
         // Checking for '\' from the windows path
         root = root.replace(/\\/g, '/');
 
-        if(file.match(/android\/platform.js$/)) {
+        if(file.match(/android\/platform.js$/) || file.match(/android\\platform.js$/)) {
           data = data.replace(/modulemapper\.clobbers.*\n/,
                               util.format('navigator.app = require("%s/src/android/plugin/android/app")', root));
-        } else if (file.match(/amazon-fireos\/platform.js$/)) {
+        } else if (file.match(/amazon-fireos\/platform.js$/) || file.match(/amazon-fireos\\platform.js$/)) {
           data = data.replace(/modulemapper\.clobbers.*\n/,
                               util.format('navigator.app = require("%s/src/amazon-fireos/plugin/android/app")', root));
         }