From e6f1ccc6814f7a19b8dd34842365e6b7bc0fe42a Mon Sep 17 00:00:00 2001 From: Peter Peterson Date: Mon, 13 Nov 2017 13:25:53 -0700 Subject: [PATCH 1/2] pass the error to the callback when trying to load additional plugins at runtime. --- architect.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/architect.js b/architect.js index 090b564..ef421cf 100644 --- a/architect.js +++ b/architect.js @@ -527,20 +527,24 @@ function Architect(config) { callback(null, app); }); // What about error state? - // Check the config - hopefully this works - var _sortedPlugins = checkConfig(additionalConfig, function(name){ - return services[name]; - }); - - if (ready) { - sortedPlugins = _sortedPlugins; - // Start Loading additional plugins - startPlugins(true); - } - else { - _sortedPlugins.forEach(function(item){ - sortedPlugins.push(item); + try { + // Check the config - hopefully this works + var _sortedPlugins = checkConfig(additionalConfig, function(name){ + return services[name]; }); + + if (ready) { + sortedPlugins = _sortedPlugins; + // Start Loading additional plugins + startPlugins(true); + } + else { + _sortedPlugins.forEach(function(item){ + sortedPlugins.push(item); + }); + } + } catch (err) { + callback(err, null); } }); } From b3a0d64d966322ec6cf749ca50a3a644e6821ac1 Mon Sep 17 00:00:00 2001 From: Peter Peterson Date: Mon, 20 Nov 2017 13:37:13 -0700 Subject: [PATCH 2/2] adding better name detection for win32 paths --- architect.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/architect.js b/architect.js index ef421cf..6403199 100644 --- a/architect.js +++ b/architect.js @@ -454,8 +454,9 @@ function Architect(config) { }); } - var m = /^plugins\/([^\/]+)|\/plugins\/[^\/]+\/([^\/]+)/.exec(plugin.packagePath); - var packageName = m && (m[1] || m[2]); + var m = /^plugins\/([^\/]+)|\/plugins\/([^\/]+)|\/plugins\/[^\/]+\/([^\/]+)|^plugins\\([^\\]+)|\\plugins\\([^\\]+)|\\plugins\\[^\\]+\\([^\\]+)/.exec(plugin.packagePath); + + var packageName = m && (m[1] || m[2] || m[3] || m[4] || m[5] || m[6]); if (!app.packages[packageName]) app.packages[packageName] = []; if (DEBUG) {