befly 3.18.0 → 3.18.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.
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 = /^\/(?:app|core)(?:\/[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*)*$/;
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: "菜单完整路径必须是 /app/xxx /core/xxx",
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"), prefixMenuPaths(menus, "app"));
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.0",
4
- "gitHead": "1d9785d976aaa758c598e30055570a607b0a0574",
3
+ "version": "3.18.1",
4
+ "gitHead": "f43a5007cf99e7a1b1ca976d12b5e94fee8de02e",
5
5
  "private": false,
6
6
  "description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",
7
7
  "keywords": [
@@ -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;