cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [05/50] git commit: Allow plugin modules to be .json files
Date Fri, 05 Sep 2014 18:14:10 GMT
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/04a624b4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/04a624b4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/04a624b4

Branch: refs/heads/master
Commit: 04a624b44a518e1baa716af1dc0271518e19c0f9
Parents: dac44fc
Author: Joseph Frazier <joseph@onsip.com>
Authored: Thu Aug 7 10:06:39 2014 -0400
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Sep 5 11:12:17 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/04a624b4/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