@eggjs/core 7.0.0-beta.35 → 7.0.0-beta.36
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 +19 -14
- package/dist/base_context_class.js +39 -36
- package/dist/egg.d.ts +279 -277
- package/dist/egg.js +394 -426
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -12
- package/dist/lifecycle.d.ts +79 -75
- package/dist/lifecycle.js +280 -306
- package/dist/loader/context_loader.d.ts +34 -30
- package/dist/loader/context_loader.js +76 -99
- package/dist/loader/egg_loader.d.ts +370 -366
- package/dist/loader/egg_loader.js +1169 -1567
- package/dist/loader/file_loader.d.ts +99 -95
- package/dist/loader/file_loader.js +190 -241
- package/dist/singleton.d.ts +31 -27
- package/dist/singleton.js +107 -117
- package/dist/types.d.ts +54 -51
- package/dist/utils/index.d.ts +16 -14
- package/dist/utils/index.js +96 -105
- package/dist/utils/sequencify.d.ts +13 -10
- package/dist/utils/sequencify.js +44 -58
- package/dist/utils/timing.d.ts +22 -19
- package/dist/utils/timing.js +85 -92
- package/package.json +35 -40
- package/dist/types.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import utils from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
1
|
+
import { utils } from "./utils/index.js";
|
|
2
|
+
import { BaseContextClass } from "./base_context_class.js";
|
|
3
|
+
import { Timing, TimingItem } from "./utils/timing.js";
|
|
4
|
+
import { BootImplClass, FunWithFullPath, ILifecycleBoot, Lifecycle, LifecycleOptions } from "./lifecycle.js";
|
|
5
|
+
import { CustomLoaderConfigItem, EggAppConfig, EggAppInfo, EggPluginInfo } from "./types.js";
|
|
6
|
+
import { CaseStyle, CaseStyleFunction, EXPORTS, FULLPATH, FileLoader, FileLoaderFilter, FileLoaderInitializer, FileLoaderOptions, FileLoaderParseItem } from "./loader/file_loader.js";
|
|
7
|
+
import { ClassLoader, ClassLoaderOptions, ContextLoader, ContextLoaderOptions } from "./loader/context_loader.js";
|
|
8
|
+
import { EggDirInfo, EggDirInfoType, EggLoader, EggLoaderOptions } from "./loader/egg_loader.js";
|
|
9
|
+
import { Singleton, SingletonCreateMethod, SingletonOptions } from "./singleton.js";
|
|
10
|
+
import { Context, EGG_LOADER, EggCore, EggCoreInitOptions, EggCoreOptions, KoaApplication, KoaContext, KoaMiddlewareFunc, KoaRequest, KoaResponse, MiddlewareFunc, Next, Request, Response, Router } from "./egg.js";
|
|
11
|
+
import { SequencifyResult, SequencifyTask, sequencify } from "./utils/sequencify.js";
|
|
12
|
+
export { BaseContextClass, BootImplClass, CaseStyle, CaseStyleFunction, ClassLoader, ClassLoaderOptions, Context, ContextLoader, ContextLoaderOptions, CustomLoaderConfigItem, EGG_LOADER, EXPORTS, EggAppConfig, EggAppInfo, EggCore, EggCoreInitOptions, EggCoreOptions, EggDirInfo, EggDirInfoType, EggLoader, EggLoaderOptions, EggPluginInfo, FULLPATH, FileLoader, FileLoaderFilter, FileLoaderInitializer, FileLoaderOptions, FileLoaderParseItem, FunWithFullPath, ILifecycleBoot, KoaApplication, KoaContext, KoaMiddlewareFunc, KoaRequest, KoaResponse, Lifecycle, LifecycleOptions, MiddlewareFunc, Next, Request, Response, Router, SequencifyResult, SequencifyTask, Singleton, SingletonCreateMethod, SingletonOptions, Timing, TimingItem, sequencify, utils };
|
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_default from "./utils/index.js";
|
|
2
|
+
import { BaseContextClass } from "./base_context_class.js";
|
|
3
|
+
import { Lifecycle } from "./lifecycle.js";
|
|
4
|
+
import { sequencify } from "./utils/sequencify.js";
|
|
5
|
+
import { Timing } from "./utils/timing.js";
|
|
6
|
+
import { CaseStyle, EXPORTS, FULLPATH, FileLoader } from "./loader/file_loader.js";
|
|
7
|
+
import { ClassLoader, ContextLoader } from "./loader/context_loader.js";
|
|
8
|
+
import { EggLoader } from "./loader/egg_loader.js";
|
|
9
|
+
import { Singleton } from "./singleton.js";
|
|
10
|
+
import { Context, EGG_LOADER, EggCore, KoaApplication, KoaContext, KoaRequest, KoaResponse, Request, Response, Router } from "./egg.js";
|
|
11
|
+
|
|
12
|
+
export { BaseContextClass, CaseStyle, ClassLoader, Context, ContextLoader, EGG_LOADER, EXPORTS, EggCore, EggLoader, FULLPATH, FileLoader, KoaApplication, KoaContext, KoaRequest, KoaResponse, Lifecycle, Request, Response, Router, Singleton, Timing, sequencify, utils_default as utils };
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -1,79 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
-
|
|
1
|
+
import { Fun } from "./utils/index.js";
|
|
2
|
+
import { Timing } from "./utils/timing.js";
|
|
3
|
+
import { EggCore } from "./egg.js";
|
|
4
|
+
import { EggConsoleLogger } from "egg-logger";
|
|
5
|
+
import { EventEmitter } from "node:events";
|
|
6
|
+
import { ReadyFunctionArg } from "get-ready";
|
|
7
|
+
import { Ready as Ready$1 } from "ready-callback";
|
|
8
|
+
|
|
9
|
+
//#region src/lifecycle.d.ts
|
|
10
|
+
interface ILifecycleBoot {
|
|
11
|
+
fullPath?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Ready to call configDidLoad,
|
|
14
|
+
* Config, plugin files are referred,
|
|
15
|
+
* this is the last chance to modify the config.
|
|
16
|
+
*/
|
|
17
|
+
configWillLoad?(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Config, plugin files have loaded
|
|
20
|
+
*/
|
|
21
|
+
configDidLoad?(): void;
|
|
22
|
+
/**
|
|
23
|
+
* All files have loaded, start plugin here
|
|
24
|
+
*/
|
|
25
|
+
didLoad?(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* All plugins have started, can do some thing before app ready
|
|
28
|
+
*/
|
|
29
|
+
willReady?(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Worker is ready, can do some things,
|
|
32
|
+
* don't need to block the app boot
|
|
33
|
+
*/
|
|
34
|
+
didReady?(err?: Error): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Server is listening
|
|
37
|
+
*/
|
|
38
|
+
serverDidReady?(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Do some thing before app close
|
|
41
|
+
*/
|
|
42
|
+
beforeClose?(): Promise<void>;
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
type BootImplClass<T = ILifecycleBoot> = new (...args: any[]) => T;
|
|
45
|
+
interface LifecycleOptions {
|
|
46
|
+
baseDir: string;
|
|
47
|
+
app: EggCore;
|
|
48
|
+
logger: EggConsoleLogger;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
type FunWithFullPath = Fun & {
|
|
51
|
+
fullPath?: string;
|
|
50
52
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
declare class Lifecycle extends EventEmitter {
|
|
54
|
+
#private;
|
|
55
|
+
loadReady: Ready$1;
|
|
56
|
+
bootReady: Ready$1;
|
|
57
|
+
options: LifecycleOptions;
|
|
58
|
+
readyTimeout: number;
|
|
59
|
+
constructor(options: Partial<LifecycleOptions>);
|
|
60
|
+
ready(): Promise<void>;
|
|
61
|
+
ready(flagOrFunction: ReadyFunctionArg): void;
|
|
62
|
+
get app(): EggCore;
|
|
63
|
+
get logger(): EggConsoleLogger;
|
|
64
|
+
get timing(): Timing;
|
|
65
|
+
legacyReadyCallback(name: string, opt?: object): (...args: unknown[]) => void;
|
|
66
|
+
addBootHook(bootHootOrBootClass: BootImplClass | ILifecycleBoot): void;
|
|
67
|
+
addFunctionAsBootHook<T = EggCore>(hook: (app: T) => void, fullPath?: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* init boots and trigger config did config
|
|
70
|
+
*/
|
|
71
|
+
init(): void;
|
|
72
|
+
registerBeforeStart(scope: Fun, name: string): void;
|
|
73
|
+
registerBeforeClose(fn: FunWithFullPath, fullPath?: string): void;
|
|
74
|
+
close(): Promise<void>;
|
|
75
|
+
triggerConfigWillLoad(): void;
|
|
76
|
+
triggerConfigDidLoad(): void;
|
|
77
|
+
triggerDidLoad(): void;
|
|
78
|
+
triggerWillReady(): void;
|
|
79
|
+
triggerDidReady(err?: Error): Promise<void>;
|
|
80
|
+
triggerServerDidReady(): Promise<void>;
|
|
79
81
|
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { BootImplClass, FunWithFullPath, ILifecycleBoot, Lifecycle, LifecycleOptions };
|