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