cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject js commit: Fixed issues with data transforms when using browserify
Date Mon, 20 Jul 2015 23:34:54 GMT
Repository: cordova-js
Updated Branches:
  refs/heads/master eb620e293 -> e483adc8b


Fixed issues with data transforms when using browserify


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

Branch: refs/heads/master
Commit: e483adc8bcd703de8a69f227e7e8d3424f60bf98
Parents: eb620e2
Author: Suraj Pindoria <suraj.pindoria@yahoo.com>
Authored: Thu Jul 16 16:00:21 2015 -0700
Committer: Suraj Pindoria <suraj.pindoria@yahoo.com>
Committed: Thu Jul 16 16:00:21 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e483adc8/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index ac7f614..d287f79 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -51,20 +51,35 @@ var requireTr = {
     function end() {
       var platform = platObj.platform;
       // SOME BS pre-transforms
-      if(data.match(/clobbers\('cordova\/plugin\/android\/app/)) {
+      if(data.match(/clobbers\("cordova\/plugin\/android\/app/)) {
         // Checking for '\' from the windows path
         root = root.replace(/\\/g, '/');
 
+        // new way that uses files from cordova-js-src
+        if (file.match(/android\/platform_www\/cordova-js-src\/platform.js$/) || file.match(/android\\platform_www\\cordova-js-src\\platform.js$/))
{
+            var androidPath = path.dirname(file).replace(/\\/g, '/');
+
+            data = data.replace(/modulemapper\.clobbers.*\n/,
+                                util.format('navigator.app = require("%s/plugin/android/app.js");',
androidPath));
+        } else if (file.match(/amazon-fireos\/platform_www\/cordova-js-src\/platform.js$/)
|| file.match(/amazon-fireos\\platform_www\\cordova-js-src\\platform.js$/)) {
+            var amazonfirePath = path.dirname(file).replace(/\\/g, '/');
+
+            data = data.replace(/modulemapper\.clobbers.*\n/,
+                                util.format('navigator.app = require("%s/plugin/android/app.js");',
amazonfirePath));
+        }
+
+
+        // the old way, keep as a fallback
         if(file.match(/android\/platform.js$/) || file.match(/android\\platform.js$/)) {
           data = data.replace(/modulemapper\.clobbers.*\n/,
-                              util.format('navigator.app = require("%s/src/legacy-exec/android/plugin/android/app")',
root));
+                              util.format('navigator.app = require("%s/src/legacy-exec/android/plugin/android/app");',
root));
         } 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/legacy-exec/amazon-fireos/plugin/android/app")',
root));
+                              util.format('navigator.app = require("%s/src/legacy-exec/amazon-fireos/plugin/android/app");',
root));
         }
       }
 
-      if(data.match(/clobbers\('cordova\/exec\/proxy/)) {
+      if(data.match(/clobbers\("cordova\/exec\/proxy/)) {
         // Checking for '\' from the windows path
         root = root.replace(/\\/g, '/');
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message