befly 3.65.0 → 3.66.0

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.
@@ -37,6 +37,7 @@ export default {
37
37
  }
38
38
 
39
39
  return befly.tool.Yes("获取成功", {
40
+ runMode: befly.config.runMode,
40
41
  os: `${os.type()} ${os.arch()}`,
41
42
  server: `${os.platform()} ${os.release()}`,
42
43
  runtimeVersion: runtimeVersion,
package/index.js CHANGED
@@ -115,7 +115,7 @@ async function ensureSyncPrerequisites(ctx) {
115
115
  }
116
116
  }
117
117
 
118
- export async function createBefly(env = {}, config = {}, menus = []) {
118
+ export async function createBefly(config = {}, menus = []) {
119
119
  const mergedConfig = deepMerge(beflyConfig, config);
120
120
  const mergedMenus = deepMerge(prefixMenuPaths(beflyMenus, "core"), menus);
121
121
  mergedConfig.projectLists = mergeProjectListsByCode(mergedConfig.projectLists);
@@ -144,7 +144,6 @@ export async function createBefly(env = {}, config = {}, menus = []) {
144
144
  }
145
145
 
146
146
  return new Befly({
147
- env: env,
148
147
  config: mergedConfig,
149
148
  tables: tables,
150
149
  menus: mergedMenus,
@@ -162,7 +161,6 @@ export async function createBefly(env = {}, config = {}, menus = []) {
162
161
  export class Befly {
163
162
  constructor(init = {}) {
164
163
  this.context = {
165
- env: init.env || {},
166
164
  config: init.config || {},
167
165
  tables: init.tables || {}
168
166
  };
@@ -208,7 +206,7 @@ export class Befly {
208
206
  await ensureSyncPrerequisites(this.context);
209
207
 
210
208
  // 自动同步(PM2 cluster:主进程执行,其它进程等待同步完成)
211
- if (isPrimaryProcess(this.context.env)) {
209
+ if (isPrimaryProcess(Bun.env)) {
212
210
  await syncApi(this.context, this.apis);
213
211
  await syncMenu(this.context, this.menus);
214
212
  await syncDev(this.context);
@@ -229,7 +227,7 @@ export class Befly {
229
227
  port: this.context.config.appPort || 3000,
230
228
  hostname: this.context.config.appHost || "0.0.0.0",
231
229
  // 开发模式下启用详细错误信息
232
- development: this.context.env.RUN_MODE === "development",
230
+ development: this.context.config.runMode === "development",
233
231
  // 空闲连接超时时间(秒),防止恶意连接占用资源
234
232
  fetch: async (req, httpServer) => {
235
233
  const url = new URL(req.url);
@@ -247,7 +245,7 @@ export class Befly {
247
245
  error: (error) => {
248
246
  Logger.error("服务启动时发生错误", error);
249
247
  // 开发模式下返回详细错误信息
250
- if (this.context.env.RUN_MODE === "development") {
248
+ if (this.context.config.runMode === "development") {
251
249
  return Response.json(
252
250
  {
253
251
  code: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "3.65.0",
3
+ "version": "3.66.0",
4
4
  "gitHead": "49c39d36695036e85fc64083cc43c1652fff96cb",
5
5
  "private": false,
6
6
  "description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",