node-pluginsmanager 3.4.0 → 3.4.1

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.
@@ -288,21 +288,44 @@ class PluginsManager extends node_events_1.default {
288
288
  // check if plugin directory is created
289
289
  }).then(() => {
290
290
  return (0, isDirectory_1.default)(directory).then((isPluginADirectory) => {
291
- return !isPluginADirectory ? Promise.reject(new Error("\"" + repo + "\" plugin directory is not created")) : Promise.resolve();
291
+ if (!isPluginADirectory) {
292
+ throw new Error("\"" + repo + "\" plugin directory is not created");
293
+ }
292
294
  });
293
- // check if plugin has a valid package.json
294
- }).then(() => {
295
- return (0, isFile_1.default)((0, node_path_1.join)(directory, "package.json")).then((isPluginAPackageFile) => {
296
- return !isPluginAPackageFile ? Promise.reject(new Error("\"" + repo + "\" plugin has no valid package.json")) : Promise.resolve();
297
- });
298
- // install dependencies if needed
295
+ // work around package.json
299
296
  }).then(() => {
300
- return (0, promises_1.readFile)((0, node_path_1.join)(directory, "package.json"), "utf-8").then((content) => {
301
- return JSON.parse(content);
302
- }).then(({ dependencies }) => {
303
- return "object" !== typeof dependencies || null === dependencies || 0 >= Object.keys(dependencies).length
304
- ? Promise.resolve()
305
- : (0, npmInstall_1.default)(directory);
297
+ const packageFile = (0, node_path_1.join)(directory, "package.json");
298
+ // check if plugin has a valid package.json
299
+ return (0, isFile_1.default)(packageFile).then((isPluginAPackageFile) => {
300
+ if (!isPluginAPackageFile) {
301
+ throw new Error("\"" + repo + "\" plugin has no valid package.json");
302
+ }
303
+ // read package.json and parse it
304
+ }).then(() => {
305
+ return (0, promises_1.readFile)(packageFile, "utf-8").then((content) => {
306
+ return JSON.parse(content);
307
+ });
308
+ }).then((packageData) => {
309
+ const entryPoint = (0, node_path_1.join)(directory, packageData.main);
310
+ // check if the plugin has a valid entry point
311
+ return (0, isFile_1.default)(entryPoint).then((hasPluginEntryPoint) => {
312
+ if (!hasPluginEntryPoint) {
313
+ throw new Error("\"" + repo + "\" plugin has no valid entry point");
314
+ }
315
+ // check if the plugin is builded
316
+ // @TODO : "build installed plugin" feature to be implemented
317
+ }).then(() => {
318
+ return (0, isFile_1.default)(entryPoint).then((isEntryPointAFile) => {
319
+ if (!isEntryPointAFile) {
320
+ throw new Error("\"" + repo + "\" plugin entry point is not builded");
321
+ }
322
+ });
323
+ }).then(() => {
324
+ if ("object" !== typeof packageData.dependencies || null === packageData.dependencies || 0 >= Object.keys(packageData.dependencies).length) {
325
+ return Promise.resolve();
326
+ }
327
+ return (0, npmInstall_1.default)(directory);
328
+ });
306
329
  });
307
330
  // create plugin
308
331
  }).then(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "node-pluginsmanager",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "description": "A plugins manager.",
6
6
 
7
7
  "type": "commonjs",
@@ -52,14 +52,14 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/express": "5.0.6",
55
- "@types/node": "25.9.1",
55
+ "@types/node": "25.9.2",
56
56
  "@types/socket.io": "3.0.2",
57
57
  "@types/ws": "8.18.1",
58
58
  "eslint-plugin-personnallinter": "git+ssh://git@github.com/Psychopoulet/eslint-plugin-personnallinter",
59
59
  "express": "5.2.1",
60
60
  "husky": "9.1.7",
61
61
  "mocha": "11.7.6",
62
- "node-pluginsmanager-plugin": "7.3.0",
62
+ "node-pluginsmanager-plugin": "7.3.2",
63
63
  "nyc": "18.0.0",
64
64
  "proxyquire": "2.1.3",
65
65
  "rimraf": "6.1.3",