vona-core 5.0.96 → 5.0.98

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.
@@ -12,3 +12,4 @@ export type TypeConfigLoader<T> = (app: VonaApplication) => Promise<PowerPartial
12
12
  export declare function combineConfigDefault<T>(app: VonaApplication, configDefault: TypeConfigLoader<T>, configDev?: TypeConfigLoader<T>, configProd?: TypeConfigLoader<T>, configTest?: TypeConfigLoader<T>): Promise<PowerPartial<T>>;
13
13
  export declare function getLoggerPathPhysicalRoot(appInfo: VonaAppInfo): string;
14
14
  export declare function getPublicPathPhysicalRoot(appInfo: VonaAppInfo): string;
15
+ export declare function getRuntimePathPhysicalRoot(app: VonaApplication): string;
@@ -66,3 +66,15 @@ export function getPublicPathPhysicalRoot(appInfo) {
66
66
  fse.ensureDirSync(publicDir);
67
67
  return publicDir;
68
68
  }
69
+ export function getRuntimePathPhysicalRoot(app) {
70
+ const mode = app.config.meta.mode;
71
+ let runtimeDir;
72
+ if (mode === 'test' || mode === 'dev') {
73
+ runtimeDir = path.join(app.options.projectPath, '.app/runtime');
74
+ }
75
+ else {
76
+ runtimeDir = path.join(os.homedir(), 'vona', app.options.name, 'runtime');
77
+ }
78
+ fse.ensureDirSync(runtimeDir);
79
+ return runtimeDir;
80
+ }
@@ -92,6 +92,8 @@ export const contextBase = {
92
92
  return true;
93
93
  if (self.response.type && self.response.type.includes('json'))
94
94
  return true;
95
+ if (self.request.headers['content-type']?.includes('application/json') && self.accepts('json') === 'json')
96
+ return true;
95
97
  if (self.accepts('html', 'text', 'json') === 'json')
96
98
  return true;
97
99
  return false;
@@ -2,5 +2,6 @@ import type { ILoggerOptionsClientInfo } from '../../../types/interface/logger.t
2
2
  import * as Winston from 'winston';
3
3
  export declare const formatLoggerAxiosError: Winston.Logform.FormatWrap;
4
4
  export declare const formatLoggerCtx: Winston.Logform.FormatWrap;
5
+ export declare const formatLoggerDummy: Winston.Logform.FormatWrap;
5
6
  export declare const formatLoggerFilter: Winston.Logform.FormatWrap;
6
7
  export declare const formatLoggerConsole: (clientInfo: ILoggerOptionsClientInfo) => Winston.Logform.Format;
@@ -34,6 +34,12 @@ export const formatLoggerCtx = Winston.format((info, _opts) => {
34
34
  info.path = app.ctx.path;
35
35
  return info;
36
36
  });
37
+ export const formatLoggerDummy = Winston.format(info => {
38
+ const app = useApp();
39
+ if (app.meta.env.LOGGER_DUMMY === 'true')
40
+ return false;
41
+ return info;
42
+ });
37
43
  export const formatLoggerFilter = Winston.format((info, opts) => {
38
44
  const level = typeof opts.level === 'function' ? opts.level() : opts.level;
39
45
  if (!level)
@@ -1,4 +1,3 @@
1
- import cluster from 'node:cluster';
2
1
  import { EnumAppEvent } from "../../types/index.js";
3
2
  import { BeanSimple } from "../bean/beanSimple.js";
4
3
  import { AppLocale, BeanScopeContainer } from "../bean/index.js";
@@ -94,17 +93,13 @@ export class AppMeta extends BeanSimple {
94
93
  return this[SymbolClosePromise];
95
94
  }
96
95
  async _closeInner() {
97
- if (this.app.meta.env.SERVER_WORKERS !== '1') {
98
- // disconnect
99
- cluster.worker?.disconnect();
100
- }
101
- else {
102
- // close server
103
- if (this.app.server) {
104
- this.app.server.close();
105
- // maybe hang up using await
106
- // await promisify(this.app.server.close).call(this.app.server);
107
- }
96
+ // should not call disconnect, which will cause channel closed
97
+ // cluster.worker?.disconnect();
98
+ // close server
99
+ if (this.app.server) {
100
+ this.app.server.close();
101
+ // maybe hang up using await
102
+ // await promisify(this.app.server.close).call(this.app.server);
108
103
  }
109
104
  // appClose
110
105
  this.appClose = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.96",
4
+ "version": "5.0.98",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"