@midwayjs/bootstrap 3.0.0-alpha.28 → 3.0.0-alpha.41

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.
@@ -1,4 +1,4 @@
1
- import { IMidwayFramework, IMidwayBootstrapOptions, MidwayFrameworkType, IMidwayContainer } from '@midwayjs/core';
1
+ import { IMidwayFramework, IMidwayBootstrapOptions, MidwayFrameworkType } from '@midwayjs/core';
2
2
  import { ILogger } from '@midwayjs/logger';
3
3
  export declare function isTypeScriptEnvironment(): boolean;
4
4
  export declare class BootstrapStarter {
@@ -27,7 +27,6 @@ export declare class Bootstrap {
27
27
  static starter: BootstrapStarter;
28
28
  static logger: ILogger;
29
29
  static configured: boolean;
30
- static beforeHandler: any;
31
30
  /**
32
31
  * set global configuration for midway
33
32
  * @param configuration
@@ -37,10 +36,8 @@ export declare class Bootstrap {
37
36
  * load midway framework unit
38
37
  * @param unit
39
38
  */
40
- static load(unit: (globalConfig: unknown) => IMidwayFramework<any, any>): any;
41
39
  static load(unit: IMidwayFramework<any, any>): any;
42
40
  private static getStarter;
43
- static before(beforeHandler: (container: IMidwayContainer) => void): typeof Bootstrap;
44
41
  static run(): Promise<void>;
45
42
  static stop(): Promise<void>;
46
43
  static reset(): void;
package/dist/bootstrap.js CHANGED
@@ -28,6 +28,7 @@ class BootstrapStarter {
28
28
  return this;
29
29
  }
30
30
  async init() {
31
+ var _a;
31
32
  this.appDir = this.globalOptions.appDir || process.cwd();
32
33
  this.baseDir = this.getBaseDir();
33
34
  let mainApp; // eslint-disable-line prefer-const
@@ -39,13 +40,9 @@ class BootstrapStarter {
39
40
  this.applicationContext.setFileDetector(new core_1.DirectoryFileDetector({
40
41
  loadDir: this.baseDir,
41
42
  }));
42
- this.applicationContext.load(require((0, path_1.join)(this.baseDir, 'configuration')));
43
+ this.applicationContext.load((_a = this.globalOptions.configurationModule) !== null && _a !== void 0 ? _a : require((0, path_1.join)(this.baseDir, 'configuration')));
43
44
  await this.applicationContext.ready();
44
45
  }
45
- // 调用 bootstrap 的 before 逻辑
46
- if (this.globalOptions['beforeHandler']) {
47
- await this.globalOptions['beforeHandler'](this.applicationContext);
48
- }
49
46
  // 获取全局配置
50
47
  this.globalConfig =
51
48
  this.applicationContext.getConfigService().getConfiguration() || {};
@@ -169,7 +166,6 @@ class Bootstrap {
169
166
  if (configuration.appDir && configuration.appDir !== process.cwd()) {
170
167
  process.chdir(configuration.appDir);
171
168
  }
172
- configuration['beforeHandler'] = this.beforeHandler;
173
169
  this.getStarter().configure(configuration);
174
170
  return this;
175
171
  }
@@ -183,10 +179,6 @@ class Bootstrap {
183
179
  }
184
180
  return this.starter;
185
181
  }
186
- static before(beforeHandler) {
187
- this.beforeHandler = beforeHandler;
188
- return this;
189
- }
190
182
  static async run() {
191
183
  if (!this.configured) {
192
184
  this.configure();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/bootstrap",
3
- "version": "3.0.0-alpha.28+80e676dc",
3
+ "version": "3.0.0-alpha.41",
4
4
  "description": "midwayjs bootstrap",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -21,9 +21,9 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "devDependencies": {
24
- "@midwayjs/core": "^3.0.0-alpha.28+80e676dc",
25
- "@midwayjs/decorator": "^3.0.0-alpha.2",
26
- "@midwayjs/logger": "^3.0.0-alpha.28+80e676dc",
24
+ "@midwayjs/core": "^3.0.0-alpha.41",
25
+ "@midwayjs/decorator": "^3.0.0-alpha.41",
26
+ "@midwayjs/logger": "^3.0.0-alpha.41",
27
27
  "@types/socket.io-client": "^1.4.36",
28
28
  "request": "^2.88.2",
29
29
  "socket.io-client": "^4.0.0"
@@ -33,5 +33,5 @@
33
33
  "type": "git",
34
34
  "url": "http://github.com/midwayjs/midway.git"
35
35
  },
36
- "gitHead": "80e676dc8f63f9c9efa960627889be73e6d1a6b5"
36
+ "gitHead": "408a11a924283e98f298de85b22083ce18e247ca"
37
37
  }