@midwayjs/web 3.1.2 → 3.1.3

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.js CHANGED
@@ -67,6 +67,9 @@ class AppBootHook {
67
67
  this.app.useMiddleware(eggRouterMiddleware);
68
68
 
69
69
  if (process.env['EGG_CLUSTER_MODE'] === 'true') {
70
+ const lifeCycleService = this.app.applicationContext.get('midwayWebLifeCycleService');
71
+ // exec onReady()
72
+ await lifeCycleService.runReady();
70
73
  // 多进程时的路由加载必须放在这里,中间件加载之后
71
74
  const framework = this.app.applicationContext.get('midwayWebFramework');
72
75
  await framework.loadMidwayController();
@@ -6,6 +6,7 @@ export declare class MidwayWebLifeCycleService {
6
6
  private lifecycleInstanceList;
7
7
  constructor(applicationContext: IMidwayContainer);
8
8
  protected init(): Promise<void>;
9
+ runReady(): Promise<void>;
9
10
  afterInit(): Promise<void>;
10
11
  stop(): Promise<void>;
11
12
  private runContainerLifeCycle;
@@ -53,6 +53,9 @@ let MidwayWebLifeCycleService = class MidwayWebLifeCycleService {
53
53
  this.configService.addObject(configData);
54
54
  }
55
55
  });
56
+ // cluster 下,onReady 放到 egg willReady 中执行
57
+ }
58
+ async runReady() {
56
59
  // exec onReady()
57
60
  await this.runContainerLifeCycle(this.lifecycleInstanceList, 'onReady');
58
61
  }
@@ -86,7 +86,7 @@ export interface IWebMiddleware {
86
86
  resolve(): MidwayWebMiddleware;
87
87
  }
88
88
  declare module '@midwayjs/core/dist/interface' {
89
- interface MidwayConfig extends Partial<EggAppConfig> {
89
+ interface MidwayConfig extends PowerPartial<EggAppConfig> {
90
90
  egg?: IMidwayWebConfigurationOptions;
91
91
  }
92
92
  }
package/dist/utils.js CHANGED
@@ -114,6 +114,9 @@ async function initializeAgentApplicationContext(agent) {
114
114
  agentFramework['appLogger'] = agent.coreLogger;
115
115
  agentFramework.app = agent;
116
116
  agentFramework.configService = applicationContext.get(core_1.MidwayConfigService);
117
+ agentFramework.environmentService = applicationContext.get(core_1.MidwayEnvironmentService);
118
+ agentFramework.loggerService = applicationContext.get(core_1.MidwayLoggerService);
119
+ agentFramework.informationService = applicationContext.get(core_1.MidwayInformationService);
117
120
  agentFramework.overwriteApplication('agent');
118
121
  return applicationContext;
119
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/web",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=12"
62
62
  },
63
- "gitHead": "4ff3aa892b76d016f0ea123c7f9520d054d5c96b"
63
+ "gitHead": "98d41a7a8b40d65f43df9655b1f5b4aebcdc091a"
64
64
  }