1 | "use strict";
|
2 | module.exports = () => {
|
3 | const pluginsConf = require(bun.globalPath.CONF_PATH + "/plugins.js");
|
4 | const context = bun.plugins;
|
5 | let Model;
|
6 | for (const [key, value] of Object.entries(pluginsConf)) {
|
7 | if (value.enable) {
|
8 | try {
|
9 | if (value.path) {
|
10 | Model = require(value.path + "/index.js");
|
11 | }
|
12 | else {
|
13 | Model = require(bun.globalPath.MODULES_PATH + "/" + value.package + "/index.js");
|
14 | }
|
15 | }
|
16 | catch (e) {
|
17 | bun.Logger.bunerr(e);
|
18 | }
|
19 | if (context[key]) {
|
20 | bun.Logger.bunwarn("Repeated plugin name: " + key + " in file: " + key);
|
21 | }
|
22 | context[key] = (() => {
|
23 | return Model;
|
24 | })();
|
25 | }
|
26 | }
|
27 | };
|
28 |
|
\ | No newline at end of file |