Updated Branches: refs/heads/master 5686a320a -> 0c80083d2
[all] [CB-4022] Defer running of <runs> modules until after all scripts are loaded. Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0c80083d Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0c80083d Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0c80083d Branch: refs/heads/master Commit: 0c80083d289681616480054b84102758e9ed20bd Parents: 5686a32 Author: Andrew Grieve <[email protected]> Authored: Fri Jul 5 10:04:37 2013 -0400 Committer: Andrew Grieve <[email protected]> Committed: Fri Jul 5 10:04:37 2013 -0400 ---------------------------------------------------------------------- lib/common/modulemapper.js | 10 +++++++++- lib/common/pluginloader.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0c80083d/lib/common/modulemapper.js ---------------------------------------------------------------------- diff --git a/lib/common/modulemapper.js b/lib/common/modulemapper.js index bc414ca..208fbcb 100644 --- a/lib/common/modulemapper.js +++ b/lib/common/modulemapper.js @@ -51,6 +51,10 @@ exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) { addEntry('d', moduleName, symbolPath, opt_deprecationMessage); }; +exports.runs = function(moduleName) { + addEntry('r', moduleName, null); +}; + function prepareNamespace(symbolPath, context) { if (!symbolPath) { return context; @@ -69,12 +73,16 @@ exports.mapModules = function(context) { for (var i = 0, len = symbolList.length; i < len; i += 3) { var strategy = symbolList[i]; var moduleName = symbolList[i + 1]; + var module = require(moduleName); + // <runs/> + if (strategy == 'r') { + continue; + } var symbolPath = symbolList[i + 2]; var lastDot = symbolPath.lastIndexOf('.'); var namespace = symbolPath.substr(0, lastDot); var lastName = symbolPath.substr(lastDot + 1); - var module = require(moduleName); var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; var parentObj = prepareNamespace(namespace, context); var target = parentObj[lastName]; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0c80083d/lib/common/pluginloader.js ---------------------------------------------------------------------- diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js index 764aa90..f160312 100644 --- a/lib/common/pluginloader.js +++ b/lib/common/pluginloader.js @@ -64,7 +64,7 @@ function onScriptLoadingComplete() { // This can be skipped if it had any merges or clobbers, though, // since the mapper will already have required the module. if (module.runs && !(module.clobbers && module.clobbers.length) && !(module.merges && module.merges.length)) { - require(module.id); + modulemapper.runs(module.id); } } catch(err) {
