node-pluginsmanager 2.4.3 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,7 @@ interface iPluginManagerOptions {
|
|
|
8
8
|
"externalRessourcesDirectory"?: string;
|
|
9
9
|
"logger"?: tLogger | null;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type tBeforeAllMethodCallback = (...data: any) => Promise<void> | void;
|
|
12
12
|
export default class PluginsManager extends EventEmitter {
|
|
13
13
|
protected _beforeLoadAll: tBeforeAllMethodCallback | null;
|
|
14
14
|
protected _beforeInitAll: tBeforeAllMethodCallback | null;
|
|
@@ -21,11 +21,15 @@ function _initPlugins(pluginsToInit, emit, data, i = 0) {
|
|
|
21
21
|
function initSortedPlugins(plugins, orderedPluginsNames, emit, ...data) {
|
|
22
22
|
// if no plugins, does not run
|
|
23
23
|
return !plugins.length ? Promise.resolve() : Promise.resolve().then(() => {
|
|
24
|
-
const sortedPlugins = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const sortedPlugins = [];
|
|
25
|
+
orderedPluginsNames.forEach((pluginName) => {
|
|
26
|
+
const plugin = plugins.find((p) => {
|
|
27
|
+
return p.name === pluginName;
|
|
28
|
+
});
|
|
29
|
+
if (plugin) {
|
|
30
|
+
sortedPlugins.push(plugin);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
29
33
|
// first, sorted plugins
|
|
30
34
|
return sortedPlugins.length ?
|
|
31
35
|
_initPlugins(sortedPlugins, emit, data) :
|
|
@@ -39,11 +39,15 @@ function _loadPlugins(globalDirectory, externalRessourcesDirectory, pluginsToLoa
|
|
|
39
39
|
function loadSortedPlugins(globalDirectory, externalRessourcesDirectory, files, loadedPlugins, orderedPluginsNames, emit, logger, ...data) {
|
|
40
40
|
// if no files, does not run
|
|
41
41
|
return !files.length ? Promise.resolve() : Promise.resolve().then(() => {
|
|
42
|
-
const sortedPluginsNames = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const sortedPluginsNames = [];
|
|
43
|
+
orderedPluginsNames.forEach((pluginName) => {
|
|
44
|
+
const plugin = files.find((p) => {
|
|
45
|
+
return p === pluginName;
|
|
46
|
+
});
|
|
47
|
+
if (plugin) {
|
|
48
|
+
sortedPluginsNames.push(pluginName);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
47
51
|
// first, sorted plugins
|
|
48
52
|
return sortedPluginsNames.length ?
|
|
49
53
|
_loadPlugins(globalDirectory, externalRessourcesDirectory, sortedPluginsNames, loadedPlugins, emit, logger, data) :
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-pluginsmanager",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "A plugins manager",
|
|
5
5
|
|
|
6
6
|
"type": "commonjs",
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"check-version-modules": "1.3.5",
|
|
56
|
-
"fs-extra": "
|
|
56
|
+
"fs-extra": "11.1.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/express": "4.17.
|
|
60
|
-
"@types/fs-extra": "
|
|
61
|
-
"@types/node": "18.
|
|
59
|
+
"@types/express": "4.17.16",
|
|
60
|
+
"@types/fs-extra": "11.0.1",
|
|
61
|
+
"@types/node": "18.11.18",
|
|
62
62
|
"@types/socket.io": "3.0.2",
|
|
63
|
-
"@types/ws": "8.5.
|
|
63
|
+
"@types/ws": "8.5.4",
|
|
64
64
|
"coveralls": "3.1.1",
|
|
65
|
-
"express": "4.18.
|
|
66
|
-
"husky": "8.0.
|
|
67
|
-
"mocha": "10.
|
|
68
|
-
"node-pluginsmanager-plugin": "5.0.
|
|
65
|
+
"express": "4.18.2",
|
|
66
|
+
"husky": "8.0.3",
|
|
67
|
+
"mocha": "10.2.0",
|
|
68
|
+
"node-pluginsmanager-plugin": "5.0.11",
|
|
69
69
|
"nyc": "15.1.0",
|
|
70
|
-
"typescript": "4.
|
|
71
|
-
"ws": "8.
|
|
70
|
+
"typescript": "4.9.4",
|
|
71
|
+
"ws": "8.12.0"
|
|
72
72
|
},
|
|
73
73
|
"homepage": "https://github.com/Psychopoulet/node-pluginsmanager#readme",
|
|
74
74
|
"engines": {
|