@versu/core 0.6.0 → 0.6.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAM3E,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;IAC3C,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,mBAAmB,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,IAAI,OAAO,IAAI,cAAc,EAAE,CAE9B;IAED;;;OAGG;YACW,wBAAwB;IActC;;;OAGG;IACU,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE;IAyBtD;;OAEG;YACW,gBAAgB;
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAM3E,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;IAC3C,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,mBAAmB,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,IAAI,OAAO,IAAI,cAAc,EAAE,CAE9B;IAED;;;OAGG;YACW,wBAAwB;IActC;;;OAGG;IACU,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE;IAyBtD;;OAEG;YACW,gBAAgB;IA6C9B,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -37,7 +37,7 @@ export class PluginLoader {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
logger.info(`Plugins to load: ${pluginNames.join(", ")}`);
|
|
40
|
-
|
|
40
|
+
for (const pluginName of pluginNames) {
|
|
41
41
|
// Construct the absolute path to the specific package
|
|
42
42
|
const pluginPath = path.join(globalRoot, pluginName);
|
|
43
43
|
if (await exists(pluginPath)) {
|
|
@@ -47,7 +47,7 @@ export class PluginLoader {
|
|
|
47
47
|
logger.warning(`⚠️ Plugin not found: ${pluginName} (looked in ${globalRoot})`);
|
|
48
48
|
logger.warning(` Run 'npm install -g ${pluginName}' to fix this.`);
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* 3. Dynamically require the plugin
|
|
@@ -56,7 +56,12 @@ export class PluginLoader {
|
|
|
56
56
|
try {
|
|
57
57
|
// Dynamic require using the absolute path
|
|
58
58
|
// Note: If using ESM (import), use await import(absolutePath)
|
|
59
|
-
|
|
59
|
+
// For directory imports, we need to resolve to the main entry point
|
|
60
|
+
const pluginEntryPoint = path.join(absolutePath, "dist/index.js");
|
|
61
|
+
const importPath = (await exists(pluginEntryPoint))
|
|
62
|
+
? pluginEntryPoint
|
|
63
|
+
: absolutePath;
|
|
64
|
+
const rawModule = await import(importPath);
|
|
60
65
|
// Handle both "export default" and "module.exports"
|
|
61
66
|
const plugin = rawModule.default;
|
|
62
67
|
const isValid = this.isValidPlugin(plugin);
|
|
@@ -73,7 +78,8 @@ export class PluginLoader {
|
|
|
73
78
|
logger.info(`✅ Loaded: ${plugin.name}`);
|
|
74
79
|
}
|
|
75
80
|
catch (err) {
|
|
76
|
-
|
|
81
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
82
|
+
logger.error(`❌ Failed to load plugin at ${absolutePath} ${errorMessage}`, {
|
|
77
83
|
error: err,
|
|
78
84
|
});
|
|
79
85
|
}
|
package/dist/utils/version.d.ts
CHANGED
package/dist/utils/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versu/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "VERSU (Core Library)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"fast-glob": "^3.3.3",
|
|
53
53
|
"semver": "^7.5.4",
|
|
54
54
|
"yaml": "^2.3.4",
|
|
55
|
-
"zod": "^4.1.12"
|
|
55
|
+
"zod": "^4.1.12",
|
|
56
|
+
"typescript": "^5.3.3"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/node": "^20.19.23",
|
|
@@ -63,7 +64,6 @@
|
|
|
63
64
|
"cpx": "^1.5.0",
|
|
64
65
|
"eslint": "^8.56.0",
|
|
65
66
|
"prettier": "^3.1.1",
|
|
66
|
-
"typescript": "^5.3.3",
|
|
67
67
|
"vitest": "^1.1.0"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|