cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/7] js commit: Better handling of all "modulemapper.clobbers" replacements
Date Tue, 26 Aug 2014 18:07:47 GMT
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 <suraj.pindoria@yahoo.com>
Authored: Fri Aug 22 14:04:04 2014 -0700
Committer: Suraj Pindoria <suraj.pindoria@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, '\\');
         }
 


Mime
View raw message