@midwayjs/web 3.1.6 → 3.2.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/dist/cluster.js +1 -2
- package/dist/framework/web.d.ts +2 -2
- package/dist/interface.d.ts +2 -21
- package/dist/logger.js +1 -4
- package/index.d.ts +36 -0
- package/package.json +7 -6
package/dist/cluster.js
CHANGED
|
@@ -22,11 +22,10 @@ if ((0, utils_1.isTypeScriptEnvironment)()) {
|
|
|
22
22
|
else {
|
|
23
23
|
baseDir = (0, path_1.join)(appDir, 'dist');
|
|
24
24
|
}
|
|
25
|
-
(0, core_1.
|
|
25
|
+
(0, core_1.prepareGlobalApplicationContext)({
|
|
26
26
|
appDir,
|
|
27
27
|
baseDir,
|
|
28
28
|
ignore: ['**/app/extend/**'],
|
|
29
|
-
lazyInitializeFramework: true,
|
|
30
29
|
});
|
|
31
30
|
if (!isAgent) {
|
|
32
31
|
debug('[egg]: run with egg-scripts in worker and init midway container complete');
|
package/dist/framework/web.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseFramework, IMidwayBootstrapOptions, RouterInfo, WebControllerGenerator } from '@midwayjs/core';
|
|
2
2
|
import { MidwayFrameworkType } from '@midwayjs/decorator';
|
|
3
|
-
import { IMidwayWebConfigurationOptions } from '../interface';
|
|
3
|
+
import { IMidwayWebConfigurationOptions, Application, Context } from '../interface';
|
|
4
4
|
import { EggRouter } from '@eggjs/router';
|
|
5
|
-
import {
|
|
5
|
+
import { EggLogger } from 'egg';
|
|
6
6
|
declare class EggControllerGenerator extends WebControllerGenerator<EggRouter> {
|
|
7
7
|
readonly app: any;
|
|
8
8
|
constructor(app: any);
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Context as EggContext, Application as EggApplication
|
|
3
|
-
import { IMidwayContainer, IMidwayContext,
|
|
2
|
+
import { Context as EggContext, Application as EggApplication } from 'egg';
|
|
3
|
+
import { IMidwayContainer, IMidwayContext, IMidwayApplication, IConfigurationOptions, NextFunction as BaseNextFunction } from '@midwayjs/core';
|
|
4
4
|
import { DefaultState, Middleware } from 'koa';
|
|
5
5
|
import { ILogger, LoggerOptions } from '@midwayjs/logger';
|
|
6
6
|
export interface IMidwayWebBaseApplication {
|
|
@@ -10,20 +10,6 @@ export interface IMidwayWebBaseApplication {
|
|
|
10
10
|
generateMiddleware?(middlewareId: any): Promise<Middleware<DefaultState, EggContext>>;
|
|
11
11
|
createLogger(name: string, options: LoggerOptions): ILogger;
|
|
12
12
|
}
|
|
13
|
-
declare module 'egg' {
|
|
14
|
-
interface EggAppInfo {
|
|
15
|
-
appDir: string;
|
|
16
|
-
}
|
|
17
|
-
interface Application extends IMidwayBaseApplication<Context>, IMidwayWebBaseApplication {
|
|
18
|
-
createAnonymousContext(...args: any[]): EggContext;
|
|
19
|
-
getCoreLogger(): EggLogger & ILogger;
|
|
20
|
-
getLogger(name?: string): EggLogger & ILogger;
|
|
21
|
-
createLogger(name: string, options: LoggerOptions): EggLogger & ILogger;
|
|
22
|
-
}
|
|
23
|
-
interface Context<ResponseBodyT = any> extends IMidwayBaseContext {
|
|
24
|
-
getLogger(name?: string): ILogger;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
13
|
export declare type IMidwayWebApplication = IMidwayApplication<Context, EggApplication & IMidwayWebBaseApplication>;
|
|
28
14
|
export interface Application extends IMidwayWebApplication {
|
|
29
15
|
}
|
|
@@ -85,9 +71,4 @@ export declare type MidwayWebMiddleware = Middleware<DefaultState, Context>;
|
|
|
85
71
|
export interface IWebMiddleware {
|
|
86
72
|
resolve(): MidwayWebMiddleware;
|
|
87
73
|
}
|
|
88
|
-
declare module '@midwayjs/core/dist/interface' {
|
|
89
|
-
interface MidwayConfig extends PowerPartial<EggAppConfig> {
|
|
90
|
-
egg?: IMidwayWebConfigurationOptions;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
74
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/logger.js
CHANGED
|
@@ -11,10 +11,7 @@ const util_1 = require("util");
|
|
|
11
11
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
12
12
|
const isWindows = os.platform() === 'win32';
|
|
13
13
|
function isEmptyFile(p) {
|
|
14
|
-
|
|
15
|
-
encoding: 'utf8',
|
|
16
|
-
});
|
|
17
|
-
return content === null || content === undefined || content === '';
|
|
14
|
+
return (0, fs_1.statSync)(p).size === 0;
|
|
18
15
|
}
|
|
19
16
|
const levelTransform = level => {
|
|
20
17
|
if (!level) {
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Context as IMidwayBaseContext,
|
|
3
|
+
IMidwayBaseApplication,
|
|
4
|
+
} from '@midwayjs/core';
|
|
5
|
+
import {
|
|
6
|
+
IMidwayWebBaseApplication,
|
|
7
|
+
IMidwayWebConfigurationOptions,
|
|
8
|
+
} from './dist';
|
|
9
|
+
|
|
10
|
+
export * from './dist/index';
|
|
11
|
+
|
|
12
|
+
declare module 'egg' {
|
|
13
|
+
interface EggAppInfo {
|
|
14
|
+
appDir: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 这里再次覆盖和 egg 不同的定义,不然 egg 插件里可能会报错
|
|
18
|
+
interface Application
|
|
19
|
+
extends IMidwayBaseApplication<Context>,
|
|
20
|
+
IMidwayWebBaseApplication {
|
|
21
|
+
createAnonymousContext(...args: any[]): EggContext;
|
|
22
|
+
getCoreLogger(): EggLogger & ILogger;
|
|
23
|
+
getLogger(name?: string): EggLogger & ILogger;
|
|
24
|
+
createLogger(name: string, options: LoggerOptions): EggLogger & ILogger;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Context<ResponseBodyT = any> extends IMidwayBaseContext {
|
|
28
|
+
getLogger(name?: string): ILogger;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare module '@midwayjs/core/dist/interface' {
|
|
33
|
+
interface MidwayConfig extends PowerPartial<EggAppConfig> {
|
|
34
|
+
egg?: IMidwayWebConfigurationOptions;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/web",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Midway Web Framework for Egg.js",
|
|
5
5
|
"main": "dist/index",
|
|
6
|
-
"typings": "
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
"agent.js",
|
|
24
24
|
"app.js",
|
|
25
25
|
"dist/**/*.js",
|
|
26
|
-
"dist/**/*.d.ts"
|
|
26
|
+
"dist/**/*.d.ts",
|
|
27
|
+
"index.d.ts"
|
|
27
28
|
],
|
|
28
29
|
"license": "MIT",
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@midwayjs/decorator": "^3.1.6",
|
|
31
32
|
"@midwayjs/logger": "^2.15.0",
|
|
32
|
-
"@midwayjs/mock": "^3.
|
|
33
|
+
"@midwayjs/mock": "^3.2.0",
|
|
33
34
|
"axios": "0.26.1",
|
|
34
35
|
"dayjs": "1.10.8",
|
|
35
36
|
"egg-logger": "2.7.1",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@eggjs/router": "^2.0.0",
|
|
49
|
-
"@midwayjs/core": "^3.
|
|
50
|
+
"@midwayjs/core": "^3.2.0",
|
|
50
51
|
"egg": "^2.28.0",
|
|
51
52
|
"egg-cluster": "^1.27.1",
|
|
52
53
|
"find-up": "5.0.0",
|
|
@@ -60,5 +61,5 @@
|
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=12"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e957e25e353a2e4c56d5ddcce24bb55a10f007ca"
|
|
64
65
|
}
|