cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [24/28] git commit: creating a transform for org.apache.cordova.* modules
Date Thu, 24 Apr 2014 21:14:22 GMT
creating a transform for org.apache.cordova.* modules


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

Branch: refs/heads/master
Commit: 89c2dadb442d0bccf04597f7a9b016693ca1dbe0
Parents: ef1b980
Author: Anis Kadri <anis@apache.org>
Authored: Sat Mar 29 21:16:47 2014 +0100
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Apr 11 12:45:45 2014 -0700

----------------------------------------------------------------------
 src/prepare.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/89c2dadb/src/prepare.js
----------------------------------------------------------------------
diff --git a/src/prepare.js b/src/prepare.js
index 8b770e1..ae7f500 100644
--- a/src/prepare.js
+++ b/src/prepare.js
@@ -33,6 +33,7 @@ var platform_modules   = require('./platforms'),
     plugman            = require('../plugman'),
     et                 = require('elementtree'),
     bundle             = require('cordova-js/tasks/lib/bundle-browserify'),
+    requireTr          = require('cordova-js/tasks/lib/require-tr'),
     writeLicenseHeader = require('cordova-js/tasks/lib/write-license-header');
 
 // Called on --prepare.
@@ -119,6 +120,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
     }
     
     /* begin browserify */
+    requireTr.platform = platform;
     var libraryRelease = bundle(platform, false, 'N/A');
     /* end browserify */
 
@@ -185,7 +187,11 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
 
             var fsPath = path.join.apply(path, pathParts);
             var scriptPath = path.join(pluginDir, fsPath);
+
+            /* begin browserify */
             var bScriptPath = util.format("%s.%s", scriptPath, 'browserify');
+            requireTr.addModule({symbol: new RegExp(moduleName), path: bScriptPath});
+            /* end browserify */
 
             var scriptContent = fs.readFileSync(scriptPath, 'utf-8');
             fs.writeFileSync(bScriptPath, scriptContent, 'utf-8');
@@ -237,7 +243,10 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
 
             // Add it to the list of module objects bound for cordova_plugins.json
             moduleObjects.push(obj);
+            /* begin browserify */
+            libraryRelease.transform(requireTr.transform);
             libraryRelease.add(bScriptPath);
+            /* end browserify */
         });
     });
 
@@ -273,6 +282,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
     outReleaseFileStream.on('finish', function() {
       var newtime = new Date().valueOf() - time;
       plugman.emit('verbose', 'generated cordova.' + platform + '.js @ ' + commitId + ' in
' + newtime + 'ms');
+      // TODO clean up all the *.browserify files
     });
 
     outReleaseFileStream.on('error', function(err) {
@@ -280,4 +290,5 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
       console.log('error while generating cordova_b.js');
       plugman.emit('verbose', 'error while generating cordova.js');
     });
+    /* end browserify */
 };


Mime
View raw message