diff --git a/client/src/modules/contentmanager.js b/client/src/modules/contentmanager.js index aaebcb10..d13f9442 100644 --- a/client/src/modules/contentmanager.js +++ b/client/src/modules/contentmanager.js @@ -154,7 +154,7 @@ export default class { mainPath } - const content = await this.loadContent(paths, configs, readConfig.info, readConfig.main); + const content = await this.loadContent(paths, configs, readConfig.info, readConfig.main, readConfig.dependencies); if (reload) this.localContent[index] = content; else this.localContent.push(content); return content; diff --git a/client/src/modules/pluginmanager.js b/client/src/modules/pluginmanager.js index cb241637..105e7125 100644 --- a/client/src/modules/pluginmanager.js +++ b/client/src/modules/pluginmanager.js @@ -56,7 +56,7 @@ export default class extends ContentManager { 'message': `Dependency: ${key}:${value} is not loaded` }; } - deps.push(extModule); + deps[key] = extModule.__require; } } diff --git a/tests/plugins/Example/config.json b/tests/plugins/Example/config.json index ee96edbe..1ae4e604 100644 --- a/tests/plugins/Example/config.json +++ b/tests/plugins/Example/config.json @@ -9,6 +9,9 @@ }, "main": "index.js", "type": "plugin", + "dependencies": { + "Example Module": "1.0" + }, "defaultConfig": [ { "category_default_comment": "default category has no header and is always displayed first", diff --git a/tests/plugins/Example/index.js b/tests/plugins/Example/index.js index 48beaddf..74042970 100644 --- a/tests/plugins/Example/index.js +++ b/tests/plugins/Example/index.js @@ -1,4 +1,4 @@ -module.exports = (Plugin, Api, Vendor) => { +module.exports = (Plugin, Api, Vendor, Dependencies) => { const { $, moment, _ } = Vendor; const { Events, Logger } = Api; @@ -21,7 +21,7 @@ module.exports = (Plugin, Api, Vendor) => { console.log('Received internal setting update:', event); }); - const exampleModule = new (Api.import('Example Module')); + const exampleModule = new Dependencies['Example Module']; Logger.log(`2+4=${exampleModule.add(2, 4)}`); return true; }