From 774e2a1517d8b13b03fdd4015249da253d537d41 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 28 May 2012 15:43:39 -0700 Subject: [PATCH 1/3] Fix indentation. --- src/static/js/pluginfw/parent_require.js | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/static/js/pluginfw/parent_require.js b/src/static/js/pluginfw/parent_require.js index d7f6190d4..971687467 100644 --- a/src/static/js/pluginfw/parent_require.js +++ b/src/static/js/pluginfw/parent_require.js @@ -19,19 +19,18 @@ * @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins) */ exports.getRequirementFromParent = function(requireDefObj, reqModuleName) { - requireDefObj.define(reqModuleName, function(require, exports, module) { - var t = parent; - var max = 0; // make sure I don't go up more than 10 times - while (typeof(t) != "undefined") { - max++; - if (max==10) - break; - if (typeof(t.require) != "undefined") { - module.exports = t.require(reqModuleName); - return; - } - t = t.parent; - } - }); - + requireDefObj.define(reqModuleName, function(require, exports, module) { + var t = parent; + var max = 0; // make sure I don't go up more than 10 times + while (typeof(t) != "undefined") { + max++; + if (max==10) + break; + if (typeof(t.require) != "undefined") { + module.exports = t.require(reqModuleName); + return; + } + t = t.parent; + } + }); } From a28bbd0b3f98020371e2541f05563440a26619cf Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 28 May 2012 16:38:02 -0700 Subject: [PATCH 2/3] Definition will not have an effect if already defined - force redefinition. --- src/static/js/pluginfw/parent_require.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/static/js/pluginfw/parent_require.js b/src/static/js/pluginfw/parent_require.js index 971687467..cd3b9218f 100644 --- a/src/static/js/pluginfw/parent_require.js +++ b/src/static/js/pluginfw/parent_require.js @@ -19,6 +19,9 @@ * @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins) */ exports.getRequirementFromParent = function(requireDefObj, reqModuleName) { + // Force the 'undefinition' of the modules (if they already have been loaded). + delete (requireDefObj._definitions)[reqModuleName]; + delete (requireDefObj._modules)[reqModuleName]; requireDefObj.define(reqModuleName, function(require, exports, module) { var t = parent; var max = 0; // make sure I don't go up more than 10 times From 819fb76dcd3a3e76b8ef3623f47247756ba02134 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 28 May 2012 16:38:26 -0700 Subject: [PATCH 3/3] These definitions are meaningless. --- src/static/js/ace.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 87068d07d..26d6c0eb6 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -268,12 +268,6 @@ require.setGlobalKeyPath("require");\n\ parent_req = require("ep_etherpad-lite/static/js/pluginfw/parent_require");\ parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/hooks");\ parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/plugins");\ - parent_req.getRequirementFromParent(require, "./pluginfw/hooks");\ - parent_req.getRequirementFromParent(require, "./pluginfw/plugins");\ - require.define("/plugins", null);\n\ - require.define("/plugins.js", function (require, exports, module) {\ - module.exports = require("ep_etherpad-lite/static/js/plugins");\ - });\ \ ');