befly 3.18.0 → 3.18.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/checks/menu.js +2 -2
- package/index.js +1 -1
- package/package.json +2 -2
- package/utils/scanFiles.js +1 -1
package/checks/menu.js
CHANGED
|
@@ -5,7 +5,7 @@ import { formatZodIssues } from "../utils/formatZodIssues.js";
|
|
|
5
5
|
|
|
6
6
|
z.config(z.locales.zhCN());
|
|
7
7
|
|
|
8
|
-
const fullMenuPathRegex = /^\/(?:
|
|
8
|
+
const fullMenuPathRegex = /^\/(?:core(?:\/[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*)*|(?:(?!app(?:\/|$))[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*(?:\/[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*)*)?)$/;
|
|
9
9
|
const childMenuPathRegex = /^\/[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$/;
|
|
10
10
|
|
|
11
11
|
const childMenuSchema = z
|
|
@@ -36,7 +36,7 @@ const menuListSchema = z.array(menuSchema).superRefine((menuList, refineCtx) =>
|
|
|
36
36
|
if (!fullMenuPathRegex.test(childFullPath)) {
|
|
37
37
|
refineCtx.addIssue({
|
|
38
38
|
code: z.ZodIssueCode.custom,
|
|
39
|
-
message: "菜单完整路径必须是 /
|
|
39
|
+
message: "菜单完整路径必须是 /core/xxx 或无前缀路径(禁止 /app 前缀)",
|
|
40
40
|
path: [menuIndex, "children", childIndex, "path"]
|
|
41
41
|
});
|
|
42
42
|
}
|
package/index.js
CHANGED
|
@@ -137,7 +137,7 @@ export class Befly {
|
|
|
137
137
|
const instance = new Befly();
|
|
138
138
|
instance.context.env = env;
|
|
139
139
|
instance.context.config = deepMerge(beflyConfig, config);
|
|
140
|
-
instance.menus = deepMerge(prefixMenuPaths(beflyMenus, "core"),
|
|
140
|
+
instance.menus = deepMerge(prefixMenuPaths(beflyMenus, "core"), menus);
|
|
141
141
|
instance.createdByFactory = true;
|
|
142
142
|
|
|
143
143
|
const configHasError = await checkConfig(instance.context.config);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "3.18.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "3.18.2",
|
|
4
|
+
"gitHead": "f6fdc07aded11161f7722df5da27bc9166692caf",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",
|
|
7
7
|
"keywords": [
|
package/utils/scanFiles.js
CHANGED
|
@@ -98,7 +98,7 @@ export async function scanFiles(dir, source, type, pattern) {
|
|
|
98
98
|
filePath: filePath,
|
|
99
99
|
relativePath: relativePath,
|
|
100
100
|
fileName: fileName,
|
|
101
|
-
apiPath: `/api/${source}/${relativePath}`
|
|
101
|
+
apiPath: source === "core" ? `/api/${source}/${relativePath}` : `/api/${relativePath}`
|
|
102
102
|
};
|
|
103
103
|
if (type === "table") {
|
|
104
104
|
base["fieldsDef"] = contentObj;
|