node-pluginsmanager 2.5.0 → 2.5.2
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.
- package/lib/cjs/PluginsManager.d.ts +10 -10
- package/lib/cjs/PluginsManager.js +22 -18
- package/lib/cjs/checkers/checkAbsoluteDirectory.js +2 -3
- package/lib/cjs/checkers/checkDirectory.js +2 -3
- package/lib/cjs/checkers/checkFunction.js +2 -3
- package/lib/cjs/checkers/checkNonEmptyArray.js +2 -3
- package/lib/cjs/checkers/checkNonEmptyString.js +2 -3
- package/lib/cjs/checkers/checkOrchestrator.d.ts +2 -1
- package/lib/cjs/checkers/checkOrchestrator.js +2 -3
- package/lib/cjs/cmd/cmd.d.ts +1 -1
- package/lib/cjs/cmd/cmd.js +5 -4
- package/lib/cjs/cmd/git/gitInstall.js +2 -3
- package/lib/cjs/cmd/git/gitUpdate.js +2 -3
- package/lib/cjs/cmd/npm/npmInstall.js +8 -5
- package/lib/cjs/cmd/npm/npmUpdate.js +8 -5
- package/lib/cjs/cmd/stdToString.js +2 -3
- package/lib/cjs/createPluginByDirectory.d.ts +1 -1
- package/lib/cjs/createPluginByDirectory.js +2 -3
- package/lib/cjs/extractGithub.d.ts +7 -1
- package/lib/cjs/extractGithub.js +3 -3
- package/lib/cjs/initSortedPlugins.d.ts +2 -2
- package/lib/cjs/initSortedPlugins.js +8 -8
- package/lib/cjs/loadSortedPlugins.d.ts +2 -2
- package/lib/cjs/loadSortedPlugins.js +8 -9
- package/lib/cjs/main.cjs +1 -1
- package/lib/cjs/utils/isDirectory.js +2 -3
- package/lib/cjs/utils/rmdirp.js +2 -3
- package/package.json +27 -22
- package/lib/cjs/cmd/npm/npmCmd.d.ts +0 -1
- package/lib/cjs/cmd/npm/npmCmd.js +0 -18
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import EventEmitter from "node:events";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Server as
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
3
|
+
import type { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
4
|
+
import type { Server as WebSocketServer } from "ws";
|
|
5
|
+
import type { Server as SocketIOServer } from "socket.io";
|
|
6
6
|
interface iPluginManagerOptions {
|
|
7
7
|
"directory"?: string;
|
|
8
8
|
"externalRessourcesDirectory"?: string;
|
|
@@ -13,17 +13,17 @@ export default class PluginsManager extends EventEmitter {
|
|
|
13
13
|
protected _beforeLoadAll: tBeforeAllMethodCallback | null;
|
|
14
14
|
protected _beforeInitAll: tBeforeAllMethodCallback | null;
|
|
15
15
|
protected _logger: tLogger | null;
|
|
16
|
-
protected _orderedPluginsNames:
|
|
16
|
+
protected _orderedPluginsNames: string[];
|
|
17
17
|
directory: string;
|
|
18
18
|
externalRessourcesDirectory: string;
|
|
19
|
-
plugins:
|
|
19
|
+
plugins: Orchestrator[];
|
|
20
20
|
constructor(options: iPluginManagerOptions);
|
|
21
|
-
getPluginsNames():
|
|
22
|
-
setOrder(pluginsNames:
|
|
23
|
-
getOrder():
|
|
21
|
+
getPluginsNames(): string[];
|
|
22
|
+
setOrder(pluginsNames: string[]): Promise<void>;
|
|
23
|
+
getOrder(): string[];
|
|
24
24
|
checkAllModules(): Promise<void>;
|
|
25
25
|
checkModules(plugin: Orchestrator): Promise<void>;
|
|
26
|
-
appMiddleware(req:
|
|
26
|
+
appMiddleware(req: IncomingMessage, res: ServerResponse, next: () => void): void;
|
|
27
27
|
socketMiddleware(server: WebSocketServer | SocketIOServer): void;
|
|
28
28
|
beforeLoadAll(callback: tBeforeAllMethodCallback): Promise<void>;
|
|
29
29
|
loadAll(...data: any): Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// deps
|
|
7
7
|
// natives
|
|
8
8
|
const node_events_1 = __importDefault(require("node:events"));
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
@@ -40,14 +40,17 @@ class PluginsManager extends node_events_1.default {
|
|
|
40
40
|
this._beforeLoadAll = null;
|
|
41
41
|
this._beforeInitAll = null;
|
|
42
42
|
this._orderedPluginsNames = [];
|
|
43
|
-
this._logger = options && "function" === typeof options.logger
|
|
44
|
-
options.logger
|
|
43
|
+
this._logger = options && "function" === typeof options.logger
|
|
44
|
+
? options.logger
|
|
45
|
+
: null;
|
|
45
46
|
// public
|
|
46
47
|
this.plugins = [];
|
|
47
|
-
this.directory = options && "undefined" !== typeof options.directory
|
|
48
|
-
options.directory
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
this.directory = options && "undefined" !== typeof options.directory
|
|
49
|
+
? options.directory
|
|
50
|
+
: DEFAULT_PLUGINS_DIRECTORY;
|
|
51
|
+
this.externalRessourcesDirectory = options && "undefined" !== typeof options.externalRessourcesDirectory
|
|
52
|
+
? options.externalRessourcesDirectory
|
|
53
|
+
: DEFAULT_RESSOURCES_DIRECTORY;
|
|
51
54
|
}
|
|
52
55
|
// public
|
|
53
56
|
getPluginsNames() {
|
|
@@ -97,33 +100,34 @@ class PluginsManager extends node_events_1.default {
|
|
|
97
100
|
"failAtMajor": true,
|
|
98
101
|
"failAtMinor": true,
|
|
99
102
|
"failAtPatch": false,
|
|
100
|
-
"dev": false
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return valid ? Promise.resolve() : Promise.reject(new Error("\"" + plugin.name + "\" plugin has obsoletes modules"));
|
|
103
|
+
"dev": false
|
|
104
|
+
}).then((analyze) => {
|
|
105
|
+
return analyze.result ? Promise.resolve() : Promise.reject(new Error("\"" + plugin.name + "\" plugin has obsoletes modules"));
|
|
104
106
|
});
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
// used for execute all plugins' middlewares in app (express or other)
|
|
108
110
|
appMiddleware(req, res, next) {
|
|
111
|
+
// limit to plugins which has registered middleware
|
|
109
112
|
const plugins = this.plugins.filter((plugin) => {
|
|
110
113
|
return "function" === typeof plugin.appMiddleware;
|
|
111
114
|
});
|
|
112
|
-
if (
|
|
115
|
+
if (0 >= plugins.length) {
|
|
113
116
|
return next();
|
|
114
117
|
}
|
|
115
118
|
else {
|
|
116
|
-
const _recursiveNext = (i
|
|
117
|
-
if (i
|
|
118
|
-
return next;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
119
|
+
const _recursiveNext = (i) => {
|
|
120
|
+
if (i < plugins.length) {
|
|
121
121
|
return () => {
|
|
122
122
|
return plugins[i].appMiddleware(req, res, _recursiveNext(i + 1));
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
// if no more plugin to try, pass the lead to the application
|
|
126
|
+
else {
|
|
127
|
+
return next;
|
|
128
|
+
}
|
|
125
129
|
};
|
|
126
|
-
return plugins[0].appMiddleware(req, res, _recursiveNext());
|
|
130
|
+
return plugins[0].appMiddleware(req, res, _recursiveNext(1)); // must start at index "1", cause the "0" is executed here
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
// middleware for socket to add bilateral push events
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = checkAbsoluteDirectory;
|
|
7
8
|
// natives
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
// locals
|
|
@@ -16,5 +17,3 @@ function checkAbsoluteDirectory(dataName, directory) {
|
|
|
16
17
|
});
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
exports.default = checkAbsoluteDirectory;
|
|
20
|
-
;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = checkDirectory;
|
|
7
8
|
// natives
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
9
10
|
// locals
|
|
@@ -20,5 +21,3 @@ function checkDirectory(dataName, directory) {
|
|
|
20
21
|
return exists ? Promise.resolve() : Promise.reject(new Error("\"" + dataName + "\" (" + directory + ") is not a valid directory"));
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
exports.default = checkDirectory;
|
|
24
|
-
;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
// module
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = isFunction;
|
|
4
5
|
function isFunction(dataName, data) {
|
|
5
6
|
if ("undefined" === typeof data) {
|
|
6
7
|
return Promise.reject(new ReferenceError("\"" + dataName + "\" parameter is missing"));
|
|
@@ -12,5 +13,3 @@ function isFunction(dataName, data) {
|
|
|
12
13
|
return Promise.resolve();
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
exports.default = isFunction;
|
|
16
|
-
;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
// module
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = isNonEmptyArray;
|
|
4
5
|
function isNonEmptyArray(dataName, data) {
|
|
5
6
|
if ("undefined" === typeof data) {
|
|
6
7
|
return Promise.reject(new ReferenceError("\"" + dataName + "\" parameter is missing"));
|
|
@@ -15,5 +16,3 @@ function isNonEmptyArray(dataName, data) {
|
|
|
15
16
|
return Promise.resolve();
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
exports.default = isNonEmptyArray;
|
|
19
|
-
;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
// module
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = isNonEmptyString;
|
|
4
5
|
function isNonEmptyString(dataName, data) {
|
|
5
6
|
if ("undefined" === typeof data) {
|
|
6
7
|
return Promise.reject(new ReferenceError("\"" + dataName + "\" parameter is missing"));
|
|
@@ -15,5 +16,3 @@ function isNonEmptyString(dataName, data) {
|
|
|
15
16
|
return Promise.resolve();
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
exports.default = isNonEmptyString;
|
|
19
|
-
;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Orchestrator } from "node-pluginsmanager-plugin";
|
|
2
|
+
export default function checkOrchestrator(dataName: string, data: Orchestrator): Promise<void>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = checkOrchestrator;
|
|
7
8
|
// natives
|
|
8
9
|
const node_events_1 = __importDefault(require("node:events"));
|
|
9
10
|
// locals
|
|
@@ -32,5 +33,3 @@ function checkOrchestrator(dataName, data) {
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
exports.default = checkOrchestrator;
|
|
36
|
-
;
|
package/lib/cjs/cmd/cmd.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function cmd(directory: string, command: string, params:
|
|
1
|
+
export default function cmd(directory: string, command: string, params: string[]): Promise<void>;
|
package/lib/cjs/cmd/cmd.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = cmd;
|
|
7
8
|
// natives
|
|
8
9
|
const node_child_process_1 = require("node:child_process");
|
|
9
10
|
// locals
|
|
@@ -21,7 +22,9 @@ function cmd(directory, command, params) {
|
|
|
21
22
|
return new Promise((resolve, reject) => {
|
|
22
23
|
let result = "";
|
|
23
24
|
const mySpawn = (0, node_child_process_1.spawn)(command, params, {
|
|
24
|
-
"cwd": directory
|
|
25
|
+
"cwd": directory,
|
|
26
|
+
"windowsHide": true,
|
|
27
|
+
"shell": true
|
|
25
28
|
}).on("error", (err) => {
|
|
26
29
|
result += (0, stdToString_1.default)(err);
|
|
27
30
|
}).on("close", (code) => {
|
|
@@ -33,5 +36,3 @@ function cmd(directory, command, params) {
|
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
|
-
exports.default = cmd;
|
|
37
|
-
;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = gitInstall;
|
|
7
8
|
// natives
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
// locals
|
|
@@ -38,5 +39,3 @@ function gitInstall(directory, user, repo) {
|
|
|
38
39
|
]);
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
exports.default = gitInstall;
|
|
42
|
-
;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = gitUpdate;
|
|
7
8
|
// locals
|
|
8
9
|
const checkDirectory_1 = __importDefault(require("../../checkers/checkDirectory"));
|
|
9
10
|
const cmd_1 = __importDefault(require("../cmd"));
|
|
@@ -14,5 +15,3 @@ function gitUpdate(directory) {
|
|
|
14
15
|
return (0, cmd_1.default)(directory, "git", ["pull"]);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
exports.default = gitUpdate;
|
|
18
|
-
;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = npmInstall;
|
|
7
8
|
// locals
|
|
8
|
-
const
|
|
9
|
+
const cmd_1 = __importDefault(require("../cmd"));
|
|
9
10
|
// module
|
|
10
11
|
function npmInstall(directory) {
|
|
11
|
-
return (0,
|
|
12
|
+
return (0, cmd_1.default)(directory, "npm", [
|
|
13
|
+
"install",
|
|
14
|
+
"--omit=dev",
|
|
15
|
+
"--no-optional"
|
|
16
|
+
]);
|
|
12
17
|
}
|
|
13
|
-
exports.default = npmInstall;
|
|
14
|
-
;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = npmUpdate;
|
|
7
8
|
// locals
|
|
8
|
-
const
|
|
9
|
+
const cmd_1 = __importDefault(require("../cmd"));
|
|
9
10
|
// module
|
|
10
11
|
function npmUpdate(directory) {
|
|
11
|
-
return (0,
|
|
12
|
+
return (0, cmd_1.default)(directory, "npm", [
|
|
13
|
+
"update",
|
|
14
|
+
"--omit=dev",
|
|
15
|
+
"--no-optional"
|
|
16
|
+
]);
|
|
12
17
|
}
|
|
13
|
-
exports.default = npmUpdate;
|
|
14
|
-
;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
// module
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = stdToString;
|
|
4
5
|
function stdToString(msg) {
|
|
5
6
|
if ("object" !== typeof msg) {
|
|
6
7
|
return String(msg);
|
|
@@ -12,5 +13,3 @@ function stdToString(msg) {
|
|
|
12
13
|
return msg.message ? msg.message : String(msg);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
exports.default = stdToString;
|
|
16
|
-
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
1
|
+
import type { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
2
2
|
export default function createPluginByDirectory(directory: string, externalRessourcesDirectory: string, logger: tLogger | null, ...data: any): Promise<Orchestrator>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = createPluginByDirectory;
|
|
7
8
|
// natives
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
// locals
|
|
@@ -57,5 +58,3 @@ function createPluginByDirectory(directory, externalRessourcesDirectory, logger,
|
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
|
-
exports.default = createPluginByDirectory;
|
|
61
|
-
;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Orchestrator } from "node-pluginsmanager-plugin";
|
|
2
|
+
interface OrchestratorExtended extends Orchestrator {
|
|
3
|
+
"github"?: string;
|
|
4
|
+
"repository"?: string | Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export default function extractGithub(plugin: OrchestratorExtended): string;
|
|
7
|
+
export {};
|
package/lib/cjs/extractGithub.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// types & interfaces
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = extractGithub;
|
|
3
5
|
// module
|
|
4
6
|
function extractGithub(plugin) {
|
|
5
7
|
let github = "";
|
|
@@ -10,11 +12,9 @@ function extractGithub(plugin) {
|
|
|
10
12
|
else if ("string" === typeof plugin.repository) {
|
|
11
13
|
github = plugin.repository;
|
|
12
14
|
}
|
|
13
|
-
else if (plugin.repository && "string" === typeof plugin.repository.url) {
|
|
15
|
+
else if ("object" === typeof plugin.repository && "string" === typeof plugin.repository.url) {
|
|
14
16
|
github = plugin.repository.url;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
return github;
|
|
18
20
|
}
|
|
19
|
-
exports.default = extractGithub;
|
|
20
|
-
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Orchestrator } from "node-pluginsmanager-plugin";
|
|
2
|
-
export default function initSortedPlugins(plugins:
|
|
1
|
+
import type { Orchestrator } from "node-pluginsmanager-plugin";
|
|
2
|
+
export default function initSortedPlugins(plugins: Orchestrator[], orderedPluginsNames: string[], emit: (eventName: string, ...subdata: any) => void, ...data: any): Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// types & interfaces
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = initSortedPlugins;
|
|
3
5
|
// private
|
|
4
6
|
// methods
|
|
5
7
|
function _initPlugin(plugin, emit, ...data) {
|
|
@@ -31,9 +33,9 @@ function initSortedPlugins(plugins, orderedPluginsNames, emit, ...data) {
|
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
35
|
// first, sorted plugins
|
|
34
|
-
return sortedPlugins.length
|
|
35
|
-
_initPlugins(sortedPlugins, emit, data)
|
|
36
|
-
Promise.resolve();
|
|
36
|
+
return sortedPlugins.length
|
|
37
|
+
? _initPlugins(sortedPlugins, emit, data)
|
|
38
|
+
: Promise.resolve();
|
|
37
39
|
}).then(() => {
|
|
38
40
|
const unsortedPlugin = [
|
|
39
41
|
...plugins.filter((plugin) => {
|
|
@@ -51,10 +53,8 @@ function initSortedPlugins(plugins, orderedPluginsNames, emit, ...data) {
|
|
|
51
53
|
})
|
|
52
54
|
];
|
|
53
55
|
// then, all other plugins, asynchronously
|
|
54
|
-
return unsortedPlugin.length
|
|
55
|
-
_initPlugins(unsortedPlugin, emit, data)
|
|
56
|
-
Promise.resolve();
|
|
56
|
+
return unsortedPlugin.length
|
|
57
|
+
? _initPlugins(unsortedPlugin, emit, data)
|
|
58
|
+
: Promise.resolve();
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
exports.default = initSortedPlugins;
|
|
60
|
-
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
2
|
-
export default function loadSortedPlugins(globalDirectory: string, externalRessourcesDirectory: string, files:
|
|
1
|
+
import type { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
2
|
+
export default function loadSortedPlugins(globalDirectory: string, externalRessourcesDirectory: string, files: string[], loadedPlugins: Orchestrator[], orderedPluginsNames: string[], emit: (eventName: string, ...subdata: any) => void, logger: tLogger | null, ...data: any): Promise<void>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = loadSortedPlugins;
|
|
7
8
|
// natives
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
// locals
|
|
@@ -49,9 +50,9 @@ function loadSortedPlugins(globalDirectory, externalRessourcesDirectory, files,
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
// first, sorted plugins
|
|
52
|
-
return sortedPluginsNames.length
|
|
53
|
-
_loadPlugins(globalDirectory, externalRessourcesDirectory, sortedPluginsNames, loadedPlugins, emit, logger, data)
|
|
54
|
-
Promise.resolve();
|
|
53
|
+
return sortedPluginsNames.length
|
|
54
|
+
? _loadPlugins(globalDirectory, externalRessourcesDirectory, sortedPluginsNames, loadedPlugins, emit, logger, data)
|
|
55
|
+
: Promise.resolve();
|
|
55
56
|
}).then(() => {
|
|
56
57
|
const unsortedPluginsNames = [
|
|
57
58
|
...files.filter((pluginName) => {
|
|
@@ -69,10 +70,8 @@ function loadSortedPlugins(globalDirectory, externalRessourcesDirectory, files,
|
|
|
69
70
|
})
|
|
70
71
|
];
|
|
71
72
|
// then, all other plugins, asynchronously
|
|
72
|
-
return unsortedPluginsNames.length
|
|
73
|
-
_loadPlugins(globalDirectory, externalRessourcesDirectory, unsortedPluginsNames, loadedPlugins, emit, logger, data)
|
|
74
|
-
Promise.resolve();
|
|
73
|
+
return unsortedPluginsNames.length
|
|
74
|
+
? _loadPlugins(globalDirectory, externalRessourcesDirectory, unsortedPluginsNames, loadedPlugins, emit, logger, data)
|
|
75
|
+
: Promise.resolve();
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
exports.default = loadSortedPlugins;
|
|
78
|
-
;
|
package/lib/cjs/main.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
|
-
// deps
|
|
6
6
|
// locals
|
|
7
7
|
const PluginsManager_1 = __importDefault(require("./PluginsManager"));
|
|
8
8
|
module.exports = PluginsManager_1.default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
// deps
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = isDirectory;
|
|
4
5
|
// natives
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
7
|
// module
|
|
@@ -22,5 +23,3 @@ function isDirectory(directory) {
|
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
exports.default = isDirectory;
|
|
26
|
-
;
|
package/lib/cjs/utils/rmdirp.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// deps
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
+
exports.default = rmdirp;
|
|
7
8
|
// natives
|
|
8
9
|
const promises_1 = require("node:fs/promises");
|
|
9
10
|
// locals
|
|
@@ -16,5 +17,3 @@ function rmdirp(directory) {
|
|
|
16
17
|
}) : Promise.resolve();
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
exports.default = rmdirp;
|
|
20
|
-
;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "node-pluginsmanager",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.2",
|
|
5
5
|
"description": "A plugins manager",
|
|
6
6
|
|
|
7
7
|
"type": "commonjs",
|
|
@@ -19,43 +19,48 @@
|
|
|
19
19
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
|
|
22
|
-
"
|
|
22
|
+
"prepare": "npx husky",
|
|
23
23
|
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"clean": "npx rimraf ./lib/cjs",
|
|
25
|
+
"build": "npm run-script clean && npx tsc --project \"./tsconfig.json\"",
|
|
26
|
+
|
|
27
|
+
"lint": "npx eslint --config .eslintrc-src.js --ext .cts,.ts ./lib/src/**/* && npx eslint --config .eslintrc-tests.js ./bin/*.js ./test/**/*.js",
|
|
28
|
+
"check-requires": "npx used-deps-analyzer \"./package.json\" \"./lib/src\" --no-dev --overkill \"fs-extra\" \"node-promfs\"",
|
|
26
29
|
"check-updates": "npx check-version-modules",
|
|
27
|
-
"unit-tests": "npm run build && npx nyc --reporter=html --reporter=text mocha",
|
|
30
|
+
"unit-tests": "npm run-script build && npx nyc --reporter=html --reporter=text mocha",
|
|
28
31
|
|
|
29
|
-
"tests": "npm run-script lint && npm run check-requires && npm run-script check-updates && npm run-script unit-tests"
|
|
30
|
-
"ci": "npm run-script tests && npx nyc report --reporter=text-lcov | coveralls"
|
|
32
|
+
"tests": "npm run-script lint && npm run-script check-requires && npm run-script check-updates && npm run-script unit-tests"
|
|
31
33
|
|
|
32
34
|
},
|
|
33
35
|
|
|
34
36
|
"files": [
|
|
35
|
-
"/
|
|
37
|
+
"/bin",
|
|
38
|
+
"/lib/cjs",
|
|
39
|
+
"/public"
|
|
36
40
|
],
|
|
37
41
|
"engines": {
|
|
38
42
|
"node": ">=16.0.0"
|
|
39
43
|
},
|
|
40
44
|
|
|
41
45
|
"dependencies": {
|
|
42
|
-
"check-version-modules": "1.
|
|
46
|
+
"check-version-modules": "2.1.3"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
|
-
"@types/express": "
|
|
46
|
-
"@types/node": "
|
|
49
|
+
"@types/express": "5.0.3",
|
|
50
|
+
"@types/node": "24.3.0",
|
|
47
51
|
"@types/socket.io": "3.0.2",
|
|
48
|
-
"@types/ws": "8.
|
|
49
|
-
"
|
|
50
|
-
"express": "
|
|
51
|
-
"husky": "
|
|
52
|
-
"mocha": "
|
|
53
|
-
"node-pluginsmanager-plugin": "
|
|
54
|
-
"nyc": "
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
52
|
+
"@types/ws": "8.18.1",
|
|
53
|
+
"eslint-plugin-personnallinter": "git+ssh://git@github.com/Psychopoulet/eslint-plugin-personnallinter",
|
|
54
|
+
"express": "5.1.0",
|
|
55
|
+
"husky": "9.1.7",
|
|
56
|
+
"mocha": "11.7.1",
|
|
57
|
+
"node-pluginsmanager-plugin": "6.4.5",
|
|
58
|
+
"nyc": "17.1.0",
|
|
59
|
+
"rimraf": "6.0.1",
|
|
60
|
+
"socket.io": "4.8.1",
|
|
61
|
+
"typescript": "5.9.2",
|
|
62
|
+
"used-deps-analyzer": "0.1.8",
|
|
63
|
+
"ws": "8.18.3"
|
|
59
64
|
},
|
|
60
65
|
"optionalDependencies": {},
|
|
61
66
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function npmCmd(directory: string, params: Array<string>): Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// deps
|
|
7
|
-
// locals
|
|
8
|
-
const checkDirectory_1 = __importDefault(require("../../checkers/checkDirectory"));
|
|
9
|
-
const cmd_1 = __importDefault(require("../cmd"));
|
|
10
|
-
// module
|
|
11
|
-
function npmCmd(directory, params) {
|
|
12
|
-
return (0, checkDirectory_1.default)("cmd/npm/cmd/directory", directory).then(() => {
|
|
13
|
-
// npm install
|
|
14
|
-
return (0, cmd_1.default)(directory, (/^win/).test(process.platform) ? "npm.cmd" : "npm", params);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
exports.default = npmCmd;
|
|
18
|
-
;
|