@midwayjs/bootstrap 3.18.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/dist/bootstrap.d.ts +7 -7
- package/dist/bootstrap.js +2 -4
- package/dist/sticky.js +1 -1
- package/package.json +6 -7
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IMidwayBootstrapOptions,
|
|
2
|
-
import { ILogger } from '@midwayjs/logger';
|
|
1
|
+
import { IMidwayBootstrapOptions, IMidwayGlobalContainer } from '@midwayjs/core';
|
|
2
|
+
import { ILogger, LoggerFactory } from '@midwayjs/logger';
|
|
3
3
|
export declare class BootstrapStarter {
|
|
4
4
|
protected appDir: string;
|
|
5
5
|
protected baseDir: string;
|
|
@@ -8,24 +8,24 @@ export declare class BootstrapStarter {
|
|
|
8
8
|
private applicationContext;
|
|
9
9
|
private eventBus;
|
|
10
10
|
configure(options?: IMidwayBootstrapOptions): this;
|
|
11
|
-
init(): Promise<
|
|
11
|
+
init(): Promise<IMidwayGlobalContainer>;
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
stop(): Promise<void>;
|
|
14
|
-
getApplicationContext():
|
|
14
|
+
getApplicationContext(): IMidwayGlobalContainer;
|
|
15
15
|
protected getBaseDir(): string;
|
|
16
16
|
}
|
|
17
17
|
export declare class Bootstrap {
|
|
18
18
|
protected static starter: BootstrapStarter;
|
|
19
19
|
protected static logger: ILogger;
|
|
20
20
|
protected static configured: boolean;
|
|
21
|
-
protected static bootstrapLoggerFactory:
|
|
21
|
+
protected static bootstrapLoggerFactory: LoggerFactory;
|
|
22
22
|
/**
|
|
23
23
|
* set global configuration for midway
|
|
24
24
|
* @param configuration
|
|
25
25
|
*/
|
|
26
26
|
static configure(configuration?: IMidwayBootstrapOptions): typeof Bootstrap;
|
|
27
27
|
static getStarter(): BootstrapStarter;
|
|
28
|
-
static run(): Promise<
|
|
28
|
+
static run(): Promise<IMidwayGlobalContainer>;
|
|
29
29
|
static stop(): Promise<void>;
|
|
30
30
|
static reset(): void;
|
|
31
31
|
/**
|
|
@@ -40,6 +40,6 @@ export declare class Bootstrap {
|
|
|
40
40
|
private static onExit;
|
|
41
41
|
private static uncaughtExceptionHandler;
|
|
42
42
|
private static unhandledRejectionHandler;
|
|
43
|
-
static getApplicationContext():
|
|
43
|
+
static getApplicationContext(): IMidwayGlobalContainer;
|
|
44
44
|
}
|
|
45
45
|
//# sourceMappingURL=bootstrap.d.ts.map
|
package/dist/bootstrap.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.Bootstrap = exports.BootstrapStarter = void 0;
|
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const logger_1 = require("@midwayjs/logger");
|
|
7
|
-
const async_hooks_context_manager_1 = require("@midwayjs/async-hooks-context-manager");
|
|
8
7
|
const event_bus_1 = require("@midwayjs/event-bus");
|
|
9
8
|
const sticky_1 = require("./sticky");
|
|
10
9
|
class BootstrapStarter {
|
|
@@ -37,10 +36,9 @@ class BootstrapStarter {
|
|
|
37
36
|
enableCache: false,
|
|
38
37
|
});
|
|
39
38
|
this.globalOptions.moduleLoadType =
|
|
40
|
-
|
|
39
|
+
pkgJSON?.type === 'module' ? 'esm' : 'commonjs';
|
|
41
40
|
}
|
|
42
41
|
this.applicationContext = await (0, core_1.initializeGlobalApplicationContext)({
|
|
43
|
-
asyncContextManager: (0, async_hooks_context_manager_1.createContextManager)(),
|
|
44
42
|
loggerFactory: logger_1.loggers,
|
|
45
43
|
...this.globalOptions,
|
|
46
44
|
});
|
|
@@ -225,5 +223,5 @@ class Bootstrap {
|
|
|
225
223
|
}
|
|
226
224
|
exports.Bootstrap = Bootstrap;
|
|
227
225
|
Bootstrap.configured = false;
|
|
228
|
-
Bootstrap.bootstrapLoggerFactory = new logger_1.
|
|
226
|
+
Bootstrap.bootstrapLoggerFactory = new logger_1.LoggerFactory();
|
|
229
227
|
//# sourceMappingURL=bootstrap.js.map
|
package/dist/sticky.js
CHANGED
|
@@ -6,7 +6,7 @@ const crypto_1 = require("crypto");
|
|
|
6
6
|
const randomId = () => (0, crypto_1.randomBytes)(8).toString('hex');
|
|
7
7
|
function setupStickyMaster(httpServer, opts = {}) {
|
|
8
8
|
const options = {
|
|
9
|
-
loadBalancingMethod: 'least-connection',
|
|
9
|
+
loadBalancingMethod: 'least-connection', // either "random", "round-robin" or "least-connection"
|
|
10
10
|
...opts,
|
|
11
11
|
};
|
|
12
12
|
const sessionIdToWorker = new Map();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/bootstrap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "midwayjs bootstrap",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/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",
|
|
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": [
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@midwayjs/async-hooks-context-manager": "^3.18.0",
|
|
25
24
|
"@midwayjs/event-bus": "1.10.0"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
|
-
"@midwayjs/core": "^
|
|
27
|
+
"@midwayjs/core": "^4.0.0-alpha.1",
|
|
29
28
|
"@midwayjs/logger": "^3.0.0",
|
|
30
29
|
"request": "2.88.2",
|
|
31
|
-
"socket.io-client": "4.8.
|
|
30
|
+
"socket.io-client": "4.8.1"
|
|
32
31
|
},
|
|
33
32
|
"author": "Harry Chen <czy88840616@gmail.com>",
|
|
34
33
|
"repository": {
|
|
@@ -38,5 +37,5 @@
|
|
|
38
37
|
"engines": {
|
|
39
38
|
"node": ">=12.11.0"
|
|
40
39
|
},
|
|
41
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
|
|
42
41
|
}
|