@eggjs/core 7.0.0-beta.19 → 7.0.0-beta.21
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_context_class.d.ts +10 -15
- package/dist/base_context_class.js +36 -39
- package/dist/egg.d.ts +241 -243
- package/dist/egg.js +383 -353
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -12
- package/dist/lifecycle.d.ts +74 -80
- package/dist/lifecycle.js +306 -280
- package/dist/loader/context_loader.d.ts +25 -29
- package/dist/loader/context_loader.js +99 -76
- package/dist/loader/egg_loader.d.ts +365 -371
- package/dist/loader/egg_loader.js +1551 -1163
- package/dist/loader/file_loader.d.ts +92 -96
- package/dist/loader/file_loader.js +241 -190
- package/dist/singleton.d.ts +27 -31
- package/dist/singleton.js +117 -107
- package/dist/types.d.ts +49 -52
- package/dist/types.js +2 -0
- package/dist/utils/index.d.ts +14 -16
- package/dist/utils/index.js +107 -97
- package/dist/utils/sequencify.d.ts +10 -13
- package/dist/utils/sequencify.js +58 -44
- package/dist/utils/timing.d.ts +19 -22
- package/dist/utils/timing.js +92 -85
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
1
|
+
import utils from './utils/index.ts';
|
|
2
|
+
export { utils };
|
|
3
|
+
export * from './egg.ts';
|
|
4
|
+
export * from './base_context_class.ts';
|
|
5
|
+
export * from './lifecycle.ts';
|
|
6
|
+
export * from './singleton.ts';
|
|
7
|
+
export * from './loader/egg_loader.ts';
|
|
8
|
+
export * from './loader/file_loader.ts';
|
|
9
|
+
export * from './loader/context_loader.ts';
|
|
10
|
+
export * from './utils/sequencify.ts';
|
|
11
|
+
export * from './utils/timing.ts';
|
|
12
|
+
export type * from './types.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import utils from "./utils/index.js";
|
|
2
|
+
export { utils };
|
|
3
|
+
export * from "./egg.js";
|
|
4
|
+
export * from "./base_context_class.js";
|
|
5
|
+
export * from "./lifecycle.js";
|
|
6
|
+
export * from "./singleton.js";
|
|
7
|
+
export * from "./loader/egg_loader.js";
|
|
8
|
+
export * from "./loader/file_loader.js";
|
|
9
|
+
export * from "./loader/context_loader.js";
|
|
10
|
+
export * from "./utils/sequencify.js";
|
|
11
|
+
export * from "./utils/timing.js";
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE1BQU0sa0JBQWtCLENBQUM7QUFFckMsT0FBTyxFQUFFLEtBQUssRUFBRSxDQUFDO0FBRWpCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLDRCQUE0QixDQUFDO0FBQzNDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxtQkFBbUIsQ0FBQyJ9
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -1,84 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Do some thing before app close
|
|
42
|
-
*/
|
|
43
|
-
beforeClose?(): Promise<void>;
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { type ReadyFunctionArg } from 'get-ready';
|
|
3
|
+
import { Ready } from 'ready-callback';
|
|
4
|
+
import { EggConsoleLogger } from 'egg-logger';
|
|
5
|
+
import type { Fun } from './utils/index.ts';
|
|
6
|
+
import type { EggCore } from './egg.ts';
|
|
7
|
+
export interface ILifecycleBoot {
|
|
8
|
+
fullPath?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Ready to call configDidLoad,
|
|
11
|
+
* Config, plugin files are referred,
|
|
12
|
+
* this is the last chance to modify the config.
|
|
13
|
+
*/
|
|
14
|
+
configWillLoad?(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Config, plugin files have loaded
|
|
17
|
+
*/
|
|
18
|
+
configDidLoad?(): void;
|
|
19
|
+
/**
|
|
20
|
+
* All files have loaded, start plugin here
|
|
21
|
+
*/
|
|
22
|
+
didLoad?(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* All plugins have started, can do some thing before app ready
|
|
25
|
+
*/
|
|
26
|
+
willReady?(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Worker is ready, can do some things,
|
|
29
|
+
* don't need to block the app boot
|
|
30
|
+
*/
|
|
31
|
+
didReady?(err?: Error): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Server is listening
|
|
34
|
+
*/
|
|
35
|
+
serverDidReady?(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Do some thing before app close
|
|
38
|
+
*/
|
|
39
|
+
beforeClose?(): Promise<void>;
|
|
44
40
|
}
|
|
45
|
-
type BootImplClass<T = ILifecycleBoot> = new (...args: any[]) => T;
|
|
46
|
-
interface LifecycleOptions {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
export type BootImplClass<T = ILifecycleBoot> = new (...args: any[]) => T;
|
|
42
|
+
export interface LifecycleOptions {
|
|
43
|
+
baseDir: string;
|
|
44
|
+
app: EggCore;
|
|
45
|
+
logger: EggConsoleLogger;
|
|
50
46
|
}
|
|
51
|
-
type FunWithFullPath = Fun & {
|
|
52
|
-
|
|
47
|
+
export type FunWithFullPath = Fun & {
|
|
48
|
+
fullPath?: string;
|
|
53
49
|
};
|
|
54
|
-
declare class Lifecycle extends EventEmitter {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
50
|
+
export declare class Lifecycle extends EventEmitter {
|
|
51
|
+
#private;
|
|
52
|
+
loadReady: Ready;
|
|
53
|
+
bootReady: Ready;
|
|
54
|
+
options: LifecycleOptions;
|
|
55
|
+
readyTimeout: number;
|
|
56
|
+
constructor(options: Partial<LifecycleOptions>);
|
|
57
|
+
ready(): Promise<void>;
|
|
58
|
+
ready(flagOrFunction: ReadyFunctionArg): void;
|
|
59
|
+
get app(): EggCore;
|
|
60
|
+
get logger(): EggConsoleLogger<import("egg-logger").LoggerOptions>;
|
|
61
|
+
get timing(): import("./index.ts").Timing;
|
|
62
|
+
legacyReadyCallback(name: string, opt?: object): (...args: unknown[]) => void;
|
|
63
|
+
addBootHook(bootHootOrBootClass: BootImplClass | ILifecycleBoot): void;
|
|
64
|
+
addFunctionAsBootHook<T = EggCore>(hook: (app: T) => void, fullPath?: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* init boots and trigger config did config
|
|
67
|
+
*/
|
|
68
|
+
init(): void;
|
|
69
|
+
registerBeforeStart(scope: Fun, name: string): void;
|
|
70
|
+
registerBeforeClose(fn: FunWithFullPath, fullPath?: string): void;
|
|
71
|
+
close(): Promise<void>;
|
|
72
|
+
triggerConfigWillLoad(): void;
|
|
73
|
+
triggerConfigDidLoad(): void;
|
|
74
|
+
triggerDidLoad(): void;
|
|
75
|
+
triggerWillReady(): void;
|
|
76
|
+
triggerDidReady(err?: Error): Promise<void>;
|
|
77
|
+
triggerServerDidReady(): Promise<void>;
|
|
82
78
|
}
|
|
83
|
-
//#endregion
|
|
84
|
-
export { BootImplClass, FunWithFullPath, ILifecycleBoot, Lifecycle, LifecycleOptions };
|