@midwayjs/web 4.0.0-beta.7 → 4.0.0-beta.9
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/base.js +6 -4
- package/dist/configuration.js +4 -0
- package/dist/decorator.js +2 -3
- package/dist/framework/lifecycle.js +4 -1
- package/dist/framework/web.js +10 -4
- package/dist/index.js +2 -2
- package/dist/interface.d.ts +0 -2
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +2 -0
- package/dist/utils.js +6 -6
- package/package.json +8 -8
package/dist/base.js
CHANGED
|
@@ -35,10 +35,12 @@ function getFramework() {
|
|
|
35
35
|
const createAppWorkerLoader = () => {
|
|
36
36
|
const AppWorkerLoader = require(getFramework())?.AppWorkerLoader || require('egg').AppWorkerLoader;
|
|
37
37
|
class EggAppWorkerLoader extends AppWorkerLoader {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
app;
|
|
39
|
+
framework;
|
|
40
|
+
bootstrap;
|
|
41
|
+
useEggSocketIO = false;
|
|
42
|
+
applicationContext;
|
|
43
|
+
lifecycleService;
|
|
42
44
|
getEggPaths() {
|
|
43
45
|
if (!this.appDir) {
|
|
44
46
|
// 这里的逻辑是为了兼容老 cluster 模式
|
package/dist/configuration.js
CHANGED
|
@@ -13,6 +13,10 @@ exports.EggConfiguration = void 0;
|
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
let EggConfiguration = class EggConfiguration {
|
|
16
|
+
baseDir;
|
|
17
|
+
appDir;
|
|
18
|
+
app;
|
|
19
|
+
decoratorService;
|
|
16
20
|
init() {
|
|
17
21
|
this.decoratorService.registerParameterHandler(core_1.WEB_ROUTER_PARAM_KEY, options => {
|
|
18
22
|
return (0, core_1.extractKoaLikeValue)(options.metadata.type, options.metadata.propertyData, options.originParamType)(options.originArgs[0], options.originArgs[1]);
|
package/dist/decorator.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AgentApp = AgentApp;
|
|
4
|
+
exports.RunInEggAgent = RunInEggAgent;
|
|
4
5
|
const core_1 = require("@midwayjs/core");
|
|
5
6
|
const interface_1 = require("./interface");
|
|
6
7
|
function AgentApp() {
|
|
7
8
|
return core_1.DecoratorManager.createCustomPropertyDecorator(interface_1.EGG_AGENT_APP_KEY, {});
|
|
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
|
-
exports.RunInEggAgent = RunInEggAgent;
|
|
16
15
|
//# sourceMappingURL=decorator.js.map
|
|
@@ -15,9 +15,12 @@ const functional_1 = require("@midwayjs/core/functional");
|
|
|
15
15
|
const util_1 = require("util");
|
|
16
16
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
17
17
|
let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
|
|
18
|
+
applicationContext;
|
|
19
|
+
frameworkService;
|
|
20
|
+
configService;
|
|
21
|
+
lifecycleInstanceList = [];
|
|
18
22
|
constructor(applicationContext) {
|
|
19
23
|
this.applicationContext = applicationContext;
|
|
20
|
-
this.lifecycleInstanceList = [];
|
|
21
24
|
}
|
|
22
25
|
async init() {
|
|
23
26
|
// run lifecycle
|
package/dist/framework/web.js
CHANGED
|
@@ -18,6 +18,8 @@ const util_1 = require("util");
|
|
|
18
18
|
const net_1 = require("net");
|
|
19
19
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
20
20
|
class EggControllerGenerator extends core_1.WebControllerGenerator {
|
|
21
|
+
app;
|
|
22
|
+
webRouterService;
|
|
21
23
|
constructor(app, webRouterService) {
|
|
22
24
|
super(app, webRouterService);
|
|
23
25
|
this.app = app;
|
|
@@ -33,10 +35,13 @@ class EggControllerGenerator extends core_1.WebControllerGenerator {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
loggers;
|
|
39
|
+
generator;
|
|
40
|
+
server;
|
|
41
|
+
agent;
|
|
42
|
+
isClusterMode = false;
|
|
43
|
+
webRouterService;
|
|
44
|
+
appDir;
|
|
40
45
|
configure() {
|
|
41
46
|
process.env.EGG_TYPESCRIPT = 'true';
|
|
42
47
|
if (process.env['EGG_CLUSTER_MODE'] === 'true') {
|
|
@@ -98,6 +103,7 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
|
|
|
98
103
|
]);
|
|
99
104
|
this.generator = new EggControllerGenerator(this.app, this.webRouterService);
|
|
100
105
|
this.overwriteApplication('app');
|
|
106
|
+
this.app.loader.app = this.app;
|
|
101
107
|
this.app.loader.loadOrigin();
|
|
102
108
|
// 这里拦截 app.use 方法,让他可以加到 midway 的 middlewareManager 中
|
|
103
109
|
this.app.originUse = this.app.use;
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.Configuration = exports.Agent = exports.Application = exports.createAgentWorkerLoader = exports.createAppWorkerLoader = exports.createEggAgent = exports.createEggApplication = exports.Framework = void 0;
|
|
18
|
+
exports.startCluster = startCluster;
|
|
18
19
|
const egg_cluster_1 = require("egg-cluster");
|
|
19
20
|
const path_1 = require("path");
|
|
20
21
|
__exportStar(require("./interface"), exports);
|
|
@@ -41,5 +42,4 @@ function startCluster(serverConfig, callback) {
|
|
|
41
42
|
serverConfig['require'].push((0, path_1.join)(__dirname, 'cluster'));
|
|
42
43
|
return (0, egg_cluster_1.startCluster)(serverConfig, callback);
|
|
43
44
|
}
|
|
44
|
-
exports.startCluster = startCluster;
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { Context as EggContext, Application as EggApplication } from 'egg';
|
|
4
2
|
import { IMidwayContainer, IMidwayContext, IMidwayApplication, IConfigurationOptions, NextFunction as BaseNextFunction } from '@midwayjs/core';
|
|
5
3
|
import { DefaultState, Middleware } from 'koa';
|
package/dist/logger.d.ts
CHANGED
|
@@ -34,6 +34,6 @@ declare class MidwayLoggers extends Map<string, ILogger> {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export declare const createLoggers: (app: Application, processType:
|
|
37
|
+
export declare const createLoggers: (app: Application, processType: "agent" | "app") => MidwayLoggers;
|
|
38
38
|
export {};
|
|
39
39
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.js
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getCurrentDateString = exports.findLernaRoot = exports.parseNormalDir = void 0;
|
|
4
|
+
exports.initializeAgentApplicationContext = initializeAgentApplicationContext;
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const find_up_1 = require("find-up");
|
|
6
7
|
const fs_1 = require("fs");
|
|
@@ -64,10 +65,10 @@ async function initializeAgentApplicationContext(agent) {
|
|
|
64
65
|
agentFramework['logger'] = agent.coreLogger;
|
|
65
66
|
agentFramework['appLogger'] = agent.logger;
|
|
66
67
|
agentFramework.app = agent;
|
|
67
|
-
agentFramework
|
|
68
|
-
agentFramework
|
|
69
|
-
agentFramework
|
|
70
|
-
agentFramework
|
|
68
|
+
agentFramework['configService'] = applicationContext.get(core_1.MidwayConfigService);
|
|
69
|
+
agentFramework['environmentService'] = applicationContext.get(core_1.MidwayEnvironmentService);
|
|
70
|
+
agentFramework['loggerService'] = applicationContext.get(core_1.MidwayLoggerService);
|
|
71
|
+
agentFramework['informationService'] = applicationContext.get(core_1.MidwayInformationService);
|
|
71
72
|
agentFramework.overwriteApplication('agent');
|
|
72
73
|
// init decorator service
|
|
73
74
|
const decoratorService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayDecoratorService);
|
|
@@ -115,5 +116,4 @@ async function initializeAgentApplicationContext(agent) {
|
|
|
115
116
|
}
|
|
116
117
|
return applicationContext;
|
|
117
118
|
}
|
|
118
|
-
exports.initializeAgentApplicationContext = initializeAgentApplicationContext;
|
|
119
119
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/web",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.9",
|
|
4
4
|
"description": "Midway Web Framework for Egg.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@midwayjs/logger": "^
|
|
32
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
31
|
+
"@midwayjs/logger": "^4.0.0",
|
|
32
|
+
"@midwayjs/mock": "^4.0.0-beta.9",
|
|
33
33
|
"@types/koa": "2.15.0",
|
|
34
|
-
"dayjs": "1.11.
|
|
34
|
+
"dayjs": "1.11.19",
|
|
35
35
|
"egg-logger": "3.6.1",
|
|
36
36
|
"egg-mock": "4.2.1",
|
|
37
37
|
"egg-scripts": "3.1.0",
|
|
38
38
|
"egg-socket.io": "4.1.6",
|
|
39
39
|
"egg-view-nunjucks": "2.3.0",
|
|
40
40
|
"fake-egg": "1.0.0",
|
|
41
|
-
"fs-extra": "11.3.
|
|
41
|
+
"fs-extra": "11.3.2",
|
|
42
42
|
"is-type-of": "^2.1.0",
|
|
43
43
|
"mm": "3.4.0",
|
|
44
44
|
"mz-modules": "^2.1.0",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@eggjs/router": "^2.0.0",
|
|
52
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
52
|
+
"@midwayjs/core": "^4.0.0-beta.9",
|
|
53
53
|
"egg": "^2.28.0",
|
|
54
54
|
"egg-cluster": "^1.27.1",
|
|
55
55
|
"egg-path-matching": "^2.1.0",
|
|
56
56
|
"find-up": "5.0.0",
|
|
57
57
|
"mkdirp": "1.0.4",
|
|
58
|
-
"qs": "6.14.
|
|
58
|
+
"qs": "6.14.1"
|
|
59
59
|
},
|
|
60
60
|
"author": "Harry Chen <czy88840616@gmail.com>",
|
|
61
61
|
"repository": {
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=20"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "771e83974ef9f3d78c296e4ee0c8c68db44f6b31"
|
|
69
69
|
}
|