vona-core 5.0.97 → 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;
|
package/dist/lib/core/config.js
CHANGED
|
@@ -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
|
+
}
|
package/dist/lib/core/context.js
CHANGED
|
@@ -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)
|