Merge pull request #738 from cweider/packaging

Packaging
pull/743/head
John McLear 2012-05-28 17:08:23 -07:00
commit dfd81b79d4
2 changed files with 17 additions and 21 deletions

View File

@ -268,12 +268,6 @@ require.setGlobalKeyPath("require");\n\
parent_req = require("ep_etherpad-lite/static/js/pluginfw/parent_require");\ 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/hooks");\
parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/plugins");\ 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");\
});\
</script>\ </script>\
'); ');

View File

@ -19,19 +19,21 @@
* @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins) * @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins)
*/ */
exports.getRequirementFromParent = function(requireDefObj, reqModuleName) { exports.getRequirementFromParent = function(requireDefObj, reqModuleName) {
requireDefObj.define(reqModuleName, function(require, exports, module) { // Force the 'undefinition' of the modules (if they already have been loaded).
var t = parent; delete (requireDefObj._definitions)[reqModuleName];
var max = 0; // make sure I don't go up more than 10 times delete (requireDefObj._modules)[reqModuleName];
while (typeof(t) != "undefined") { requireDefObj.define(reqModuleName, function(require, exports, module) {
max++; var t = parent;
if (max==10) var max = 0; // make sure I don't go up more than 10 times
break; while (typeof(t) != "undefined") {
if (typeof(t.require) != "undefined") { max++;
module.exports = t.require(reqModuleName); if (max==10)
return; break;
} if (typeof(t.require) != "undefined") {
t = t.parent; module.exports = t.require(reqModuleName);
} return;
}); }
t = t.parent;
}
});
} }