@midwayjs/web 3.19.2 → 4.0.0-alpha.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/app/extend/context.js +0 -1
- package/dist/base.js +7 -13
- package/dist/cluster.js +1 -2
- package/dist/config/config.default.js +1 -2
- package/dist/configuration.js +3 -3
- package/dist/decorator.js +2 -2
- package/dist/framework/lifecycle.js +10 -9
- package/dist/framework/web.d.ts +1 -2
- package/dist/framework/web.js +4 -9
- package/dist/interface.d.ts +1 -0
- package/dist/logger.js +7 -10
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +8 -9
- package/package.json +12 -7
package/app/extend/context.js
CHANGED
package/dist/base.js
CHANGED
|
@@ -33,8 +33,7 @@ function getFramework() {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
const createAppWorkerLoader = () => {
|
|
36
|
-
|
|
37
|
-
const AppWorkerLoader = ((_a = require(getFramework())) === null || _a === void 0 ? void 0 : _a.AppWorkerLoader) || require('egg').AppWorkerLoader;
|
|
36
|
+
const AppWorkerLoader = require(getFramework())?.AppWorkerLoader || require('egg').AppWorkerLoader;
|
|
38
37
|
class EggAppWorkerLoader extends AppWorkerLoader {
|
|
39
38
|
constructor() {
|
|
40
39
|
super(...arguments);
|
|
@@ -166,8 +165,7 @@ const createAppWorkerLoader = () => {
|
|
|
166
165
|
};
|
|
167
166
|
exports.createAppWorkerLoader = createAppWorkerLoader;
|
|
168
167
|
const createAgentWorkerLoader = () => {
|
|
169
|
-
|
|
170
|
-
const AppWorkerLoader = ((_a = require(getFramework())) === null || _a === void 0 ? void 0 : _a.AgentWorkerLoader) ||
|
|
168
|
+
const AppWorkerLoader = require(getFramework())?.AgentWorkerLoader ||
|
|
171
169
|
require('egg').AgentWorkerLoader;
|
|
172
170
|
class EggAgentWorkerLoader extends AppWorkerLoader {
|
|
173
171
|
getEggPaths() {
|
|
@@ -238,7 +236,7 @@ const createAgentWorkerLoader = () => {
|
|
|
238
236
|
await (0, utils_1.initializeAgentApplicationContext)(this.app);
|
|
239
237
|
super.load();
|
|
240
238
|
debug('[egg]: start runAgent decorator');
|
|
241
|
-
const runInAgentModules =
|
|
239
|
+
const runInAgentModules = core_1.DecoratorManager.listModule(interface_1.RUN_IN_AGENT_KEY);
|
|
242
240
|
for (const module of runInAgentModules) {
|
|
243
241
|
await this.app.applicationContext.getAsync(module);
|
|
244
242
|
}
|
|
@@ -262,8 +260,7 @@ const createAgentWorkerLoader = () => {
|
|
|
262
260
|
};
|
|
263
261
|
exports.createAgentWorkerLoader = createAgentWorkerLoader;
|
|
264
262
|
const createEggApplication = () => {
|
|
265
|
-
|
|
266
|
-
const Application = ((_a = require(getFramework())) === null || _a === void 0 ? void 0 : _a.Application) || require('egg').Application;
|
|
263
|
+
const Application = require(getFramework())?.Application || require('egg').Application;
|
|
267
264
|
class EggApplication extends Application {
|
|
268
265
|
constructor(options) {
|
|
269
266
|
// eslint-disable-next-line constructor-super
|
|
@@ -289,8 +286,7 @@ const createEggApplication = () => {
|
|
|
289
286
|
return router;
|
|
290
287
|
}
|
|
291
288
|
dumpConfig() {
|
|
292
|
-
|
|
293
|
-
if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.egg) === null || _b === void 0 ? void 0 : _b.dumpConfig) !== false) {
|
|
289
|
+
if (this.config?.egg?.dumpConfig !== false) {
|
|
294
290
|
super.dumpConfig();
|
|
295
291
|
}
|
|
296
292
|
}
|
|
@@ -299,8 +295,7 @@ const createEggApplication = () => {
|
|
|
299
295
|
};
|
|
300
296
|
exports.createEggApplication = createEggApplication;
|
|
301
297
|
const createEggAgent = () => {
|
|
302
|
-
|
|
303
|
-
const Agent = ((_a = require(getFramework())) === null || _a === void 0 ? void 0 : _a.Agent) || require('egg').Agent;
|
|
298
|
+
const Agent = require(getFramework())?.Agent || require('egg').Agent;
|
|
304
299
|
class EggAgent extends Agent {
|
|
305
300
|
constructor(options) {
|
|
306
301
|
// eslint-disable-next-line constructor-super
|
|
@@ -319,8 +314,7 @@ const createEggAgent = () => {
|
|
|
319
314
|
return this[LOGGERS];
|
|
320
315
|
}
|
|
321
316
|
dumpConfig() {
|
|
322
|
-
|
|
323
|
-
if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.egg) === null || _b === void 0 ? void 0 : _b.dumpConfig) !== false) {
|
|
317
|
+
if (this.config?.egg?.dumpConfig !== false) {
|
|
324
318
|
super.dumpConfig();
|
|
325
319
|
}
|
|
326
320
|
}
|
package/dist/cluster.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
const core_1 = require("@midwayjs/core");
|
|
5
4
|
const path_1 = require("path");
|
|
@@ -13,7 +12,7 @@ function runInAgent() {
|
|
|
13
12
|
process.env['EGG_CLUSTER_MODE'] = 'true';
|
|
14
13
|
const isAgent = runInAgent();
|
|
15
14
|
debug('[egg]: run with egg-scripts in worker and init midway container in cluster mode');
|
|
16
|
-
const appDir =
|
|
15
|
+
const appDir = JSON.parse(process.argv[2])?.baseDir ?? process.cwd();
|
|
17
16
|
let baseDir;
|
|
18
17
|
if ((0, core_1.isTypeScriptEnvironment)()) {
|
|
19
18
|
baseDir = (0, path_1.join)(appDir, 'src');
|
|
@@ -24,11 +24,10 @@ exports.default = appInfo => {
|
|
|
24
24
|
exports.egg = {
|
|
25
25
|
dumpConfig: true,
|
|
26
26
|
contextLoggerFormat: info => {
|
|
27
|
-
var _a, _b, _c;
|
|
28
27
|
const ctx = info.ctx;
|
|
29
28
|
// format: '[$userId/$ip/$traceId/$use_ms $method $url]'
|
|
30
29
|
const userId = ctx.userId || '-';
|
|
31
|
-
const traceId =
|
|
30
|
+
const traceId = ctx.traceId ?? ctx.tracer?.traceId ?? '-';
|
|
32
31
|
const use = Date.now() - ctx.startTime;
|
|
33
32
|
const label = userId +
|
|
34
33
|
'/' +
|
package/dist/configuration.js
CHANGED
|
@@ -36,6 +36,7 @@ let EggConfiguration = class EggConfiguration {
|
|
|
36
36
|
// TODO flush egg logger and close it
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
exports.EggConfiguration = EggConfiguration;
|
|
39
40
|
__decorate([
|
|
40
41
|
(0, core_1.Inject)(),
|
|
41
42
|
__metadata("design:type", Object)
|
|
@@ -45,7 +46,7 @@ __decorate([
|
|
|
45
46
|
__metadata("design:type", Object)
|
|
46
47
|
], EggConfiguration.prototype, "appDir", void 0);
|
|
47
48
|
__decorate([
|
|
48
|
-
(0, core_1.
|
|
49
|
+
(0, core_1.MainApp)(),
|
|
49
50
|
__metadata("design:type", Object)
|
|
50
51
|
], EggConfiguration.prototype, "app", void 0);
|
|
51
52
|
__decorate([
|
|
@@ -58,11 +59,10 @@ __decorate([
|
|
|
58
59
|
__metadata("design:paramtypes", []),
|
|
59
60
|
__metadata("design:returntype", void 0)
|
|
60
61
|
], EggConfiguration.prototype, "init", null);
|
|
61
|
-
EggConfiguration = __decorate([
|
|
62
|
+
exports.EggConfiguration = EggConfiguration = __decorate([
|
|
62
63
|
(0, core_1.Configuration)({
|
|
63
64
|
namespace: 'egg',
|
|
64
65
|
importConfigs: [(0, path_1.join)(__dirname, 'config')],
|
|
65
66
|
})
|
|
66
67
|
], EggConfiguration);
|
|
67
|
-
exports.EggConfiguration = EggConfiguration;
|
|
68
68
|
//# sourceMappingURL=configuration.js.map
|
package/dist/decorator.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.RunInEggAgent = exports.AgentApp = void 0;
|
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const interface_1 = require("./interface");
|
|
6
6
|
function AgentApp() {
|
|
7
|
-
return
|
|
7
|
+
return core_1.DecoratorManager.createCustomPropertyDecorator(interface_1.EGG_AGENT_APP_KEY, {});
|
|
8
8
|
}
|
|
9
9
|
exports.AgentApp = AgentApp;
|
|
10
10
|
function RunInEggAgent() {
|
|
11
11
|
return function (target) {
|
|
12
|
-
|
|
12
|
+
core_1.DecoratorManager.saveModule(interface_1.RUN_IN_AGENT_KEY, target);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
exports.RunInEggAgent = RunInEggAgent;
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MidwayWebLifeCycleService = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
+
const functional_1 = require("@midwayjs/core/functional");
|
|
14
15
|
const util_1 = require("util");
|
|
15
16
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
16
17
|
let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
|
|
@@ -20,10 +21,10 @@ let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
|
|
|
20
21
|
}
|
|
21
22
|
async init() {
|
|
22
23
|
// run lifecycle
|
|
23
|
-
const cycles =
|
|
24
|
+
const cycles = core_1.DecoratorManager.listModule(core_1.CONFIGURATION_KEY);
|
|
24
25
|
debug(`[core]: Found Configuration length = ${cycles.length}`);
|
|
25
26
|
for (const cycle of cycles) {
|
|
26
|
-
if (cycle.target instanceof
|
|
27
|
+
if (cycle.target instanceof functional_1.FunctionalConfiguration) {
|
|
27
28
|
// 函数式写法
|
|
28
29
|
cycle.instance = cycle.target;
|
|
29
30
|
}
|
|
@@ -66,19 +67,19 @@ let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
|
|
|
66
67
|
if (!this.configService.getConfiguration('debug.recordConfigMergeOrder')) {
|
|
67
68
|
this.configService.clearConfigMergeOrder();
|
|
68
69
|
}
|
|
69
|
-
// some
|
|
70
|
-
const modules =
|
|
70
|
+
// some pre-start module init
|
|
71
|
+
const modules = core_1.DecoratorManager.listPreStartModule();
|
|
71
72
|
for (const module of modules) {
|
|
72
|
-
//
|
|
73
|
+
// pre-start init context
|
|
73
74
|
await this.applicationContext.getAsync(module);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
async stop() {
|
|
77
78
|
// stop lifecycle
|
|
78
|
-
const cycles =
|
|
79
|
+
const cycles = core_1.DecoratorManager.listModule(core_1.CONFIGURATION_KEY);
|
|
79
80
|
for (const cycle of cycles) {
|
|
80
81
|
let inst;
|
|
81
|
-
if (cycle.target instanceof
|
|
82
|
+
if (cycle.target instanceof functional_1.FunctionalConfiguration) {
|
|
82
83
|
// 函数式写法
|
|
83
84
|
inst = cycle.target;
|
|
84
85
|
}
|
|
@@ -121,6 +122,7 @@ let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
|
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
};
|
|
125
|
+
exports.MidwayWebLifeCycleService = MidwayWebLifeCycleService;
|
|
124
126
|
__decorate([
|
|
125
127
|
(0, core_1.Inject)(),
|
|
126
128
|
__metadata("design:type", core_1.MidwayFrameworkService)
|
|
@@ -135,10 +137,9 @@ __decorate([
|
|
|
135
137
|
__metadata("design:paramtypes", []),
|
|
136
138
|
__metadata("design:returntype", Promise)
|
|
137
139
|
], MidwayWebLifeCycleService.prototype, "init", null);
|
|
138
|
-
MidwayWebLifeCycleService = __decorate([
|
|
140
|
+
exports.MidwayWebLifeCycleService = MidwayWebLifeCycleService = __decorate([
|
|
139
141
|
(0, core_1.Provide)(),
|
|
140
142
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton),
|
|
141
143
|
__metadata("design:paramtypes", [Object])
|
|
142
144
|
], MidwayWebLifeCycleService);
|
|
143
|
-
exports.MidwayWebLifeCycleService = MidwayWebLifeCycleService;
|
|
144
145
|
//# sourceMappingURL=lifecycle.js.map
|
package/dist/framework/web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseFramework, IMidwayBootstrapOptions
|
|
1
|
+
import { BaseFramework, IMidwayBootstrapOptions } from '@midwayjs/core';
|
|
2
2
|
import { IMidwayWebConfigurationOptions, Application, Context } from '../interface';
|
|
3
3
|
import { EggLogger } from 'egg';
|
|
4
4
|
export declare class MidwayWebFramework extends BaseFramework<Application, Context, IMidwayWebConfigurationOptions> {
|
|
@@ -16,7 +16,6 @@ export declare class MidwayWebFramework extends BaseFramework<Application, Conte
|
|
|
16
16
|
applicationInitialize(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
|
|
17
17
|
overwriteApplication(processType: any): void;
|
|
18
18
|
loadMidwayController(): Promise<void>;
|
|
19
|
-
getFrameworkType(): MidwayFrameworkType;
|
|
20
19
|
run(): Promise<void>;
|
|
21
20
|
getLogger(name?: string): any;
|
|
22
21
|
setContextLoggerClass(): void;
|
package/dist/framework/web.js
CHANGED
|
@@ -154,20 +154,15 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
|
|
|
154
154
|
// move egg router to last
|
|
155
155
|
this.app.getMiddleware().findAndInsertLast('eggRouterMiddleware');
|
|
156
156
|
await this.generator.loadMidwayController(newRouter => {
|
|
157
|
-
var _a;
|
|
158
157
|
const dispatchFn = newRouter.middleware();
|
|
159
|
-
dispatchFn._name = `midwayController(${
|
|
158
|
+
dispatchFn._name = `midwayController(${newRouter?.opts?.prefix || '/'})`;
|
|
160
159
|
this.app.useMiddleware(dispatchFn);
|
|
161
160
|
});
|
|
162
161
|
// restore use method
|
|
163
162
|
this.app.use = this.app.originUse;
|
|
164
163
|
debug(`[egg]: current middleware = ${this.middlewareManager.getNames()}`);
|
|
165
164
|
}
|
|
166
|
-
getFrameworkType() {
|
|
167
|
-
return core_1.MidwayFrameworkType.WEB;
|
|
168
|
-
}
|
|
169
165
|
async run() {
|
|
170
|
-
var _a;
|
|
171
166
|
// cluster 模式加载路由需在 run 之前,因为 run 需要在拿到 server 之后执行
|
|
172
167
|
if (!this.isClusterMode) {
|
|
173
168
|
// load controller
|
|
@@ -205,7 +200,7 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
|
|
|
205
200
|
this.getApplicationContext().registerObject(core_1.HTTP_SERVER_KEY, this.server);
|
|
206
201
|
const eggConfig = this.configService.getConfiguration('egg');
|
|
207
202
|
if (!this.isClusterMode && eggConfig) {
|
|
208
|
-
const customPort =
|
|
203
|
+
const customPort = process.env.MIDWAY_HTTP_PORT ?? eggConfig.port;
|
|
209
204
|
if (customPort) {
|
|
210
205
|
new Promise(resolve => {
|
|
211
206
|
const args = [customPort];
|
|
@@ -257,12 +252,12 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
|
|
|
257
252
|
this.server = server;
|
|
258
253
|
}
|
|
259
254
|
};
|
|
255
|
+
exports.MidwayWebFramework = MidwayWebFramework;
|
|
260
256
|
__decorate([
|
|
261
257
|
(0, core_1.Inject)(),
|
|
262
258
|
__metadata("design:type", Object)
|
|
263
259
|
], MidwayWebFramework.prototype, "appDir", void 0);
|
|
264
|
-
MidwayWebFramework = __decorate([
|
|
260
|
+
exports.MidwayWebFramework = MidwayWebFramework = __decorate([
|
|
265
261
|
(0, core_1.Framework)()
|
|
266
262
|
], MidwayWebFramework);
|
|
267
|
-
exports.MidwayWebFramework = MidwayWebFramework;
|
|
268
263
|
//# sourceMappingURL=web.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Context as EggContext, Application as EggApplication } from 'egg';
|
|
3
4
|
import { IMidwayContainer, IMidwayContext, IMidwayApplication, IConfigurationOptions, NextFunction as BaseNextFunction } from '@midwayjs/core';
|
|
4
5
|
import { DefaultState, Middleware } from 'koa';
|
package/dist/logger.js
CHANGED
|
@@ -133,9 +133,8 @@ class MidwayLoggers extends Map {
|
|
|
133
133
|
return logger;
|
|
134
134
|
}
|
|
135
135
|
disableConsole() {
|
|
136
|
-
var _a;
|
|
137
136
|
for (const value of this.values()) {
|
|
138
|
-
if (value
|
|
137
|
+
if (value?.['disableConsole']) {
|
|
139
138
|
value.disableConsole();
|
|
140
139
|
}
|
|
141
140
|
else if (value.disable) {
|
|
@@ -145,7 +144,7 @@ class MidwayLoggers extends Map {
|
|
|
145
144
|
// v3
|
|
146
145
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
147
146
|
// @ts-ignore
|
|
148
|
-
(
|
|
147
|
+
value.get('console') && (value.get('console').level = 'none');
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
}
|
|
@@ -158,14 +157,13 @@ class MidwayLoggers extends Map {
|
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
transformEggLogger(eggCustomLogger, midwayLoggerConfig) {
|
|
161
|
-
var _a, _b, _c, _d;
|
|
162
160
|
const transformLoggerConfig = {
|
|
163
161
|
midwayLogger: {
|
|
164
162
|
clients: {},
|
|
165
163
|
},
|
|
166
164
|
};
|
|
167
165
|
for (const name in eggCustomLogger) {
|
|
168
|
-
const file =
|
|
166
|
+
const file = eggCustomLogger[name]?.file;
|
|
169
167
|
if (!file) {
|
|
170
168
|
continue;
|
|
171
169
|
}
|
|
@@ -179,15 +177,15 @@ class MidwayLoggers extends Map {
|
|
|
179
177
|
? (0, path_1.join)(midwayLoggerConfig['dir'], '.audit')
|
|
180
178
|
: midwayLoggerConfig['auditFileDir'];
|
|
181
179
|
options.errorDir =
|
|
182
|
-
|
|
180
|
+
midwayLoggerConfig['errorDir'] ?? midwayLoggerConfig['dir'];
|
|
183
181
|
}
|
|
184
182
|
else {
|
|
185
183
|
// 相对路径,使用默认的 dir 即可
|
|
186
184
|
options.fileLogName = file;
|
|
187
185
|
}
|
|
188
186
|
transformLoggerConfig.midwayLogger.clients[name] = {
|
|
189
|
-
level: levelTransform(
|
|
190
|
-
consoleLevel: levelTransform(
|
|
187
|
+
level: levelTransform(eggCustomLogger[name]?.level),
|
|
188
|
+
consoleLevel: levelTransform(eggCustomLogger[name]?.consoleLevel),
|
|
191
189
|
...options,
|
|
192
190
|
};
|
|
193
191
|
cleanUndefinedProperty(transformLoggerConfig.midwayLogger.clients[name]);
|
|
@@ -200,8 +198,7 @@ const createLoggers = (app, processType) => {
|
|
|
200
198
|
const loggers = new MidwayLoggers(app);
|
|
201
199
|
// won't print to console after started, except for local and unittest
|
|
202
200
|
app.ready(() => {
|
|
203
|
-
|
|
204
|
-
if ((_a = app.config.logger) === null || _a === void 0 ? void 0 : _a.disableConsoleAfterReady) {
|
|
201
|
+
if (app.config.logger?.disableConsoleAfterReady) {
|
|
205
202
|
loggers.disableConsole();
|
|
206
203
|
}
|
|
207
204
|
});
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare const parseNormalDir: (baseDir: string, isTypescript?: boolean) =
|
|
|
4
4
|
};
|
|
5
5
|
export declare const findLernaRoot: (findRoot?: string) => string;
|
|
6
6
|
export declare const getCurrentDateString: (timestamp?: number) => string;
|
|
7
|
-
export declare function initializeAgentApplicationContext(agent: any): Promise<import("@midwayjs/core").
|
|
7
|
+
export declare function initializeAgentApplicationContext(agent: any): Promise<import("@midwayjs/core").IMidwayGlobalContainer>;
|
|
8
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -83,27 +83,26 @@ async function initializeAgentApplicationContext(agent) {
|
|
|
83
83
|
// framework/config/plugin/logger/app decorator support
|
|
84
84
|
// register base config hook
|
|
85
85
|
decoratorService.registerPropertyHandler(core_2.CONFIG_KEY, (propertyName, meta) => {
|
|
86
|
-
|
|
87
|
-
if (meta.identifier === core_2.ALL) {
|
|
86
|
+
if (meta.identifier === core_2.ALL_VALUE_KEY) {
|
|
88
87
|
return configService.getConfiguration();
|
|
89
88
|
}
|
|
90
89
|
else {
|
|
91
|
-
return configService.getConfiguration(
|
|
90
|
+
return configService.getConfiguration(meta.identifier ?? propertyName);
|
|
92
91
|
}
|
|
93
92
|
});
|
|
94
93
|
// register @Logger decorator handler
|
|
95
94
|
decoratorService.registerPropertyHandler(core_2.LOGGER_KEY, (propertyName, meta) => {
|
|
96
|
-
|
|
97
|
-
return loggerService.getLogger((_a = meta.identifier) !== null && _a !== void 0 ? _a : propertyName);
|
|
98
|
-
});
|
|
99
|
-
decoratorService.registerPropertyHandler(core_2.PIPELINE_IDENTIFIER, (key, meta, instance) => {
|
|
100
|
-
var _a, _b;
|
|
101
|
-
return new core_1.MidwayPipelineService((_b = (_a = instance[core_1.REQUEST_OBJ_CTX_KEY]) === null || _a === void 0 ? void 0 : _a.requestContext) !== null && _b !== void 0 ? _b : this.applicationContext, meta.valves);
|
|
95
|
+
return loggerService.getLogger(meta.identifier ?? propertyName);
|
|
102
96
|
});
|
|
103
97
|
// register @App decorator handler
|
|
104
98
|
decoratorService.registerPropertyHandler(core_2.APPLICATION_KEY, (propertyName, mete) => {
|
|
105
99
|
return agent;
|
|
106
100
|
});
|
|
101
|
+
// register @MainApp decorator handler
|
|
102
|
+
decoratorService.registerPropertyHandler(core_1.MAIN_APPLICATION_KEY, (key, target) => {
|
|
103
|
+
return agent;
|
|
104
|
+
});
|
|
105
|
+
// register @Plugin decorator handler
|
|
107
106
|
decoratorService.registerPropertyHandler(core_2.PLUGIN_KEY, (key, target) => {
|
|
108
107
|
return agent[key];
|
|
109
108
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/web",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "Midway Web Framework for Egg.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"test": "node
|
|
10
|
-
"cov": "node
|
|
9
|
+
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --forceExit",
|
|
10
|
+
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
|
|
11
11
|
"link": "npm link"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@midwayjs/logger": "^3.0.0",
|
|
32
|
-
"@midwayjs/mock": "^
|
|
32
|
+
"@midwayjs/mock": "^4.0.0-alpha.1",
|
|
33
|
+
"@types/koa": "2.15.0",
|
|
33
34
|
"dayjs": "1.11.13",
|
|
34
35
|
"egg-logger": "3.6.0",
|
|
35
36
|
"egg-mock": "4.2.1",
|
|
@@ -38,16 +39,20 @@
|
|
|
38
39
|
"egg-view-nunjucks": "2.3.0",
|
|
39
40
|
"fake-egg": "1.0.0",
|
|
40
41
|
"fs-extra": "11.2.0",
|
|
42
|
+
"is-type-of": "^2.1.0",
|
|
41
43
|
"mm": "3.4.0",
|
|
44
|
+
"mz-modules": "^2.1.0",
|
|
42
45
|
"pedding": "1.1.0",
|
|
43
46
|
"react": "17.0.2",
|
|
44
|
-
"react-dom": "17.0.2"
|
|
47
|
+
"react-dom": "17.0.2",
|
|
48
|
+
"supertest": "6.3.3"
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"@eggjs/router": "^2.0.0",
|
|
48
|
-
"@midwayjs/core": "^
|
|
52
|
+
"@midwayjs/core": "^4.0.0-alpha.1",
|
|
49
53
|
"egg": "^2.28.0",
|
|
50
54
|
"egg-cluster": "^1.27.1",
|
|
55
|
+
"egg-path-matching": "^2.1.0",
|
|
51
56
|
"find-up": "5.0.0",
|
|
52
57
|
"mkdirp": "1.0.4",
|
|
53
58
|
"qs": "6.13.1"
|
|
@@ -60,5 +65,5 @@
|
|
|
60
65
|
"engines": {
|
|
61
66
|
"node": ">=12"
|
|
62
67
|
},
|
|
63
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
|
|
64
69
|
}
|