@midwayjs/bootstrap 3.4.0-beta.4 → 3.4.0-beta.7

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.
@@ -10,13 +10,13 @@ export declare class BootstrapStarter {
10
10
  init(): Promise<IMidwayContainer>;
11
11
  run(): Promise<void>;
12
12
  stop(): Promise<void>;
13
+ getApplicationContext(): IMidwayContainer;
13
14
  protected getBaseDir(): string;
14
15
  }
15
16
  export declare class Bootstrap {
16
17
  private static starter;
17
18
  private static logger;
18
19
  private static configured;
19
- private static applicationContext;
20
20
  /**
21
21
  * set global configuration for midway
22
22
  * @param configuration
package/dist/bootstrap.js CHANGED
@@ -31,10 +31,15 @@ class BootstrapStarter {
31
31
  });
32
32
  return this.applicationContext;
33
33
  }
34
- async run() { }
34
+ async run() {
35
+ this.applicationContext = await this.init();
36
+ }
35
37
  async stop() {
36
38
  await (0, core_1.destroyGlobalApplicationContext)(this.applicationContext);
37
39
  }
40
+ getApplicationContext() {
41
+ return this.applicationContext;
42
+ }
38
43
  getBaseDir() {
39
44
  if (this.globalOptions.baseDir) {
40
45
  return this.globalOptions.baseDir;
@@ -99,11 +104,11 @@ class Bootstrap {
99
104
  process.on('uncaughtException', this.uncaughtExceptionHandler);
100
105
  this.unhandledRejectionHandler = this.unhandledRejectionHandler.bind(this);
101
106
  process.on('unhandledRejection', this.unhandledRejectionHandler);
102
- this.applicationContext = await this.getStarter().init();
103
107
  return this.getStarter()
104
108
  .run()
105
109
  .then(() => {
106
110
  this.logger.info('[midway:bootstrap] current app started');
111
+ global['MIDWAY_BOOTSTRAP_APP_READY'] = true;
107
112
  })
108
113
  .catch(err => {
109
114
  this.logger.error(err);
@@ -115,6 +120,7 @@ class Bootstrap {
115
120
  process.removeListener('uncaughtException', this.uncaughtExceptionHandler);
116
121
  process.removeListener('unhandledRejection', this.unhandledRejectionHandler);
117
122
  this.reset();
123
+ global['MIDWAY_BOOTSTRAP_APP_READY'] = false;
118
124
  }
119
125
  static reset() {
120
126
  this.configured = false;
@@ -173,7 +179,7 @@ class Bootstrap {
173
179
  this.logger.error(err);
174
180
  }
175
181
  static getApplicationContext() {
176
- return this.applicationContext;
182
+ return this.getStarter().getApplicationContext();
177
183
  }
178
184
  }
179
185
  exports.Bootstrap = Bootstrap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/bootstrap",
3
- "version": "3.4.0-beta.4",
3
+ "version": "3.4.0-beta.7",
4
4
  "description": "midwayjs bootstrap",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -21,11 +21,11 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "devDependencies": {
24
- "@midwayjs/core": "^3.4.0-beta.4",
25
- "@midwayjs/decorator": "^3.4.0-beta.4",
24
+ "@midwayjs/core": "^3.4.0-beta.7",
25
+ "@midwayjs/decorator": "^3.4.0-beta.7",
26
26
  "@midwayjs/logger": "^2.15.0",
27
- "@midwayjs/socketio": "^3.4.0-beta.4",
28
- "@midwayjs/web": "^3.4.0-beta.4",
27
+ "@midwayjs/socketio": "^3.4.0-beta.7",
28
+ "@midwayjs/web": "^3.4.0-beta.7",
29
29
  "@types/socket.io-client": "1.4.36",
30
30
  "request": "2.88.2",
31
31
  "socket.io-client": "4.4.1"
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=12"
40
40
  },
41
- "gitHead": "3b686101f7802f87d47b8c9d25561339d556e573"
41
+ "gitHead": "4d5cc59a7a33e49beeaf20fcfaf766438649959c"
42
42
  }