cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] git commit: Allow plugin modules to be .json files
Date Thu, 14 Aug 2014 23:07:01 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 6e1e3d95c -> 1cf81044a


Allow plugin modules to be .json files


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

Branch: refs/heads/master
Commit: 28b372e1952131e18dcfa679694bd523a3e46e20
Parents: 190eb20
Author: Joseph Frazier <joseph@onsip.com>
Authored: Thu Aug 7 10:06:39 2014 -0400
Committer: Joseph Frazier <joseph@onsip.com>
Committed: Thu Aug 7 10:06:57 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/plugman/prepare.js | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/28b372e1/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 961141e..6083cbf 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -150,6 +150,9 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
 
             var fsPath = path.join.apply(path, pathParts);
             var scriptContent = fs.readFileSync(path.join(pluginDir, fsPath), 'utf-8').replace(/^\ufeff/,
''); // Window BOM
+            if (fsPath.match(/.*\.json$/)) {
+                scriptContent = 'module.exports = ' + scriptContent;
+            }
             scriptContent = 'cordova.define("' + moduleName + '", function(require, exports,
module) { ' + scriptContent + '\n});\n';
             fs.writeFileSync(path.join(platformPluginsDir, plugin_id, fsPath), scriptContent,
'utf-8');
             if(platform == 'wp8' || platform == 'windows8') {


Mime
View raw message