1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure modules containing plugins and nodes are loaded properly

Fixes #3523
This commit is contained in:
Nick O'Leary 2023-01-01 19:36:49 +00:00
parent b3ce0c0079
commit 1efd1a52a7
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -126,38 +126,24 @@ function loadModuleFiles(modules) {
} }
var pluginList; var pluginList;
var nodeList; var nodeList;
return Promise.all(pluginPromises).then(function(results) { return Promise.all(pluginPromises).then(function(results) {
pluginList = results.filter(r => !!r); pluginList = results.filter(r => !!r);
// Initial plugin load has happened. Ensure modules that provide return Promise.all(nodePromises)
// plugins are in the registry now.
for (var module in modules) {
if (modules.hasOwnProperty(module)) {
if (modules[module].plugins && Object.keys(modules[module].plugins).length > 0) {
// Add the modules for plugins
if (!modules[module].err) {
registry.addModule(modules[module]);
}
}
}
}
return loadNodeSetList(pluginList);
}).then(function() {
return Promise.all(nodePromises);
}).then(function(results) { }).then(function(results) {
nodeList = results.filter(r => !!r); nodeList = results.filter(r => !!r);
// Initial node load has happened. Ensure remaining modules are in the registry // Initial node load has happened. Ensure remaining modules are in the registry
for (var module in modules) { for (var module in modules) {
if (modules.hasOwnProperty(module)) { if (modules.hasOwnProperty(module)) {
if (!modules[module].plugins || Object.keys(modules[module].plugins).length === 0) {
if (!modules[module].err) { if (!modules[module].err) {
registry.addModule(modules[module]); registry.addModule(modules[module]);
} }
} }
} }
} }).then(function() {
return loadNodeSetList(pluginList);
}).then(function() {
return loadNodeSetList(nodeList); return loadNodeSetList(nodeList);
}); })
} }
async function loadPluginTemplate(plugin) { async function loadPluginTemplate(plugin) {