You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/05/19 10:37:12 UTC
js commit: CB-6865 added support for plugins with any id
Repository: cordova-js
Updated Branches:
refs/heads/master 9bd29ffa4 -> 237385819
CB-6865 added support for plugins with any id
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/23738581
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/23738581
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/23738581
Branch: refs/heads/master
Commit: 23738581906992092a43ad2e643b1e0c43bba38a
Parents: 9bd29ff
Author: Steve Gill <st...@gmail.com>
Authored: Tue May 19 01:37:08 2015 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Tue May 19 01:37:08 2015 -0700
----------------------------------------------------------------------
tasks/lib/require-tr.js | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/23738581/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index 628c428..603f3c1 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -114,7 +114,6 @@ var requireTr = {
*/
function _updateRequires(code, platform) {
var ast = UglifyJS.parse(code);
-
var before = new UglifyJS.TreeTransformer(function(node, descend) {
// check all function calls
@@ -129,15 +128,14 @@ function _updateRequires(code, platform) {
}
var module = node.args[0].value;
- console.log(module)
+
// make sure require only has one argument and that it starts with cordova (old style require.js)
if(module !== undefined &&
- module.indexOf("cordova") === 0) {
+ module.indexOf("cordova") === 0 && module.indexOf("cordova-") !== 0) {
var scriptPath;
var cordovajssrc = path.join(process.cwd(), "platforms", platform, "platform_www", "cordova-js-src")
-
// require('cordova') -> cordova.js
if(module === "cordova") {
scriptPath = node.args[0].value = path.join(root, "src", "cordova_b");
@@ -173,10 +171,10 @@ function _updateRequires(code, platform) {
requireTr.addModule({symbol: module, path: scriptPath}, platform);
}
}
- else if(module !== undefined && ( module.indexOf("org.apache.cordova") !== -1 ||
- module.indexOf("./") === 0 || module.indexOf("../") === 0 ) ) {
+ else if(module !== undefined && (module.indexOf("/") !== 0)){
var modules = requireTr.getModules(platform);
+
if(module.indexOf("../") === 0){
module = module.replace('../', '');
}
@@ -207,5 +205,4 @@ function _updateRequires(code, platform) {
return stream.toString();
}
-
module.exports = requireTr;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org