@ubean/modules 0.1.3 → 0.1.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.
- package/dist/index.js +18 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { consola } from "consola";
|
|
1
2
|
import { createHooks } from "hookable";
|
|
2
3
|
//#region src/builtins.ts
|
|
3
4
|
const BUILTIN_MODULES = [
|
|
@@ -140,6 +141,18 @@ function topologicalSort(modules, keyToIndex) {
|
|
|
140
141
|
}
|
|
141
142
|
//#endregion
|
|
142
143
|
//#region src/index.ts
|
|
144
|
+
const logger = consola.withTag("ubean-modules");
|
|
145
|
+
/**
|
|
146
|
+
* Extracts the bare package name from a module path.
|
|
147
|
+
* Examples:
|
|
148
|
+
* '@ubean/ui/vite' → '@ubean/ui'
|
|
149
|
+
* '@ubean/electron/vite' → '@ubean/electron'
|
|
150
|
+
* 'some-pkg/sub' → 'some-pkg'
|
|
151
|
+
*/
|
|
152
|
+
function extractPackageName(modulePath) {
|
|
153
|
+
if (modulePath.startsWith("@")) return modulePath.split("/").slice(0, 2).join("/");
|
|
154
|
+
return modulePath.split("/")[0];
|
|
155
|
+
}
|
|
143
156
|
const BUILTIN_CORE_KEYS = /* @__PURE__ */ new Set([
|
|
144
157
|
"__ubean_core__",
|
|
145
158
|
"__ubean_vue__",
|
|
@@ -255,7 +268,11 @@ async function loadBuiltinModule(builtin, configValue) {
|
|
|
255
268
|
};
|
|
256
269
|
}
|
|
257
270
|
}
|
|
258
|
-
} catch {
|
|
271
|
+
} catch (err) {
|
|
272
|
+
const packageName = extractPackageName(builtin.modulePath);
|
|
273
|
+
logger.warn(`Built-in module "${builtin.key}" is enabled in ubean.config but \`${packageName}\` is not installed. The module will be skipped. Install it with: pnpm add ${packageName} (or npm/yarn/bun equivalent).`);
|
|
274
|
+
if (process.env.UBEAN_DEBUG) logger.debug(`Import error for ${builtin.modulePath}:`, err);
|
|
275
|
+
}
|
|
259
276
|
return null;
|
|
260
277
|
}
|
|
261
278
|
async function parseUserModule(mod, index) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/modules",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Module system for ubean (resolveModules, defineModule, BUILTIN_MODULES)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"consola": "^3.4.2",
|
|
19
20
|
"hookable": "^6.1.1",
|
|
20
|
-
"@ubean/app": "0.1.
|
|
21
|
-
"@ubean/config": "0.1.
|
|
22
|
-
"@ubean/types": "0.1.
|
|
21
|
+
"@ubean/app": "0.1.4",
|
|
22
|
+
"@ubean/config": "0.1.4",
|
|
23
|
+
"@ubean/types": "0.1.4"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/node": "^26.1.1",
|