egg 4.1.0-beta.11 → 4.1.0-beta.13

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 { EggAppInfo, PartialEggConfig } from "../lib/types.js";
1
+ import { EggConfigFactory } from "../lib/types.js";
2
2
 
3
3
  //#region src/config/config.default.d.ts
4
4
 
@@ -7,6 +7,6 @@ import { EggAppInfo, PartialEggConfig } from "../lib/types.js";
7
7
  * @class Config
8
8
  * @since 1.0.0
9
9
  */
10
- declare const _default: (appInfo: EggAppInfo) => PartialEggConfig;
10
+ declare const _default: EggConfigFactory;
11
11
  //#endregion
12
12
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import { defineConfig } from "../lib/types.js";
1
+ import { defineConfigFactory } from "../lib/types.js";
2
2
  import "../index.js";
3
3
  import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
@@ -9,7 +9,7 @@ import { pathToFileURL } from "node:url";
9
9
  * @class Config
10
10
  * @since 1.0.0
11
11
  */
12
- var config_default_default = defineConfig((appInfo) => {
12
+ var config_default_default = defineConfigFactory((appInfo) => {
13
13
  const config = {
14
14
  env: appInfo.env,
15
15
  name: appInfo.name,
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import Helper from "./app/extend/helper.js";
5
5
  import { Application } from "./lib/application.js";
6
6
  import { EggContextHttpClient as HttpClient, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse } from "./lib/core/httpclient.js";
7
7
  import Context from "./app/extend/context.js";
8
- import { ClientErrorResponse, CustomLoaderConfig, EggAppConfig, EggAppInfo, EggConfigFactory, EggEnvType, EggLoggerConfig, EggPlugin, EggPluginItem, HttpClientConfig, IEggPluginItem, PartialDeep, PartialEggConfig, PowerPartial, RequestObjectBody, defineConfig } from "./lib/types.js";
8
+ import { ClientErrorResponse, CustomLoaderConfig, EggAppConfig, EggAppInfo, EggConfigFactory, EggEnvType, EggLoggerConfig, EggPlugin, EggPluginItem, HttpClientConfig, IEggPluginItem, PartialDeep, PartialEggConfig, PowerPartial, RequestObjectBody, defineConfig, defineConfigFactory } from "./lib/types.js";
9
9
  import { ContextHttpClient } from "./lib/core/context_httpclient.js";
10
10
  import { EggApplicationCore, EggApplicationCoreOptions, EggContext, IBoot as ILifecycleBoot, MiddlewareFunc, Next, Request, Response, Router } from "./lib/egg.js";
11
11
  import { BaseContextClass } from "./lib/core/base_context_class.js";
@@ -16,4 +16,4 @@ import { BaseHookClass } from "./lib/core/base_hook_class.js";
16
16
  import { Singleton, SingletonCreateMethod, SingletonOptions } from "@eggjs/core";
17
17
  import { EggLogger, LoggerLevel } from "egg-logger";
18
18
  export * from "@eggjs/cluster";
19
- export { Agent, AgentWorkerLoader, AppWorkerLoader, Application, BaseContextClass, BaseHookClass as Boot, ClientErrorResponse, Context, ContextHttpClient, BaseContextClass as Controller, BaseContextClass as Service, BaseContextClass as Subscription, CookieLimitExceedError, CustomLoaderConfig, EggAppConfig, EggAppInfo, EggApplicationCore, EggApplicationCoreOptions, EggConfigFactory, EggContext, HttpClient as EggContextHttpClient, HttpClient as EggHttpClient, HttpClient, EggEnvType, type EggLogger, EggLoggerConfig, EggPlugin, EggPluginItem, Helper, type Helper as IHelper, HttpClientConfig, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse, ILifecycleBoot as IBoot, ILifecycleBoot, IEggPluginItem, type LoggerLevel, MessageUnhandledRejectionError, MiddlewareFunc, Next, PartialDeep, PartialEggConfig, PowerPartial, Request, RequestObjectBody, Response, Router, type SingleModeAgent, type SingleModeApplication, Singleton, type SingletonCreateMethod, type SingletonOptions, StartEggOptions, defineConfig, startEgg as start, startEgg };
19
+ export { Agent, AgentWorkerLoader, AppWorkerLoader, Application, BaseContextClass, BaseHookClass as Boot, ClientErrorResponse, Context, ContextHttpClient, BaseContextClass as Controller, BaseContextClass as Service, BaseContextClass as Subscription, CookieLimitExceedError, CustomLoaderConfig, EggAppConfig, EggAppInfo, EggApplicationCore, EggApplicationCoreOptions, EggConfigFactory, EggContext, HttpClient as EggContextHttpClient, HttpClient as EggHttpClient, HttpClient, EggEnvType, type EggLogger, EggLoggerConfig, EggPlugin, EggPluginItem, Helper, type Helper as IHelper, HttpClientConfig, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse, ILifecycleBoot as IBoot, ILifecycleBoot, IEggPluginItem, type LoggerLevel, MessageUnhandledRejectionError, MiddlewareFunc, Next, PartialDeep, PartialEggConfig, PowerPartial, Request, RequestObjectBody, Response, Router, type SingleModeAgent, type SingleModeApplication, Singleton, type SingletonCreateMethod, type SingletonOptions, StartEggOptions, defineConfig, defineConfigFactory, startEgg as start, startEgg };
package/dist/index.js CHANGED
@@ -12,10 +12,10 @@ import "./lib/loader/index.js";
12
12
  import { Agent } from "./lib/agent.js";
13
13
  import Helper from "./app/extend/helper.js";
14
14
  import { Application } from "./lib/application.js";
15
- import { defineConfig } from "./lib/types.js";
15
+ import { defineConfig, defineConfigFactory } from "./lib/types.js";
16
16
  import { startEgg } from "./lib/start.js";
17
17
  import { Singleton } from "@eggjs/core";
18
18
 
19
19
  export * from "@eggjs/cluster"
20
20
 
21
- export { Agent, AgentWorkerLoader, AppWorkerLoader, Application, BaseContextClass, BaseHookClass as Boot, Context, ContextHttpClient, BaseContextClass as Controller, BaseContextClass as Service, BaseContextClass as Subscription, CookieLimitExceedError, EggApplicationCore, Helper, HttpClient, MessageUnhandledRejectionError, Request, Response, Router, Singleton, defineConfig, startEgg as start, startEgg };
21
+ export { Agent, AgentWorkerLoader, AppWorkerLoader, Application, BaseContextClass, BaseHookClass as Boot, Context, ContextHttpClient, BaseContextClass as Controller, BaseContextClass as Service, BaseContextClass as Subscription, CookieLimitExceedError, EggApplicationCore, Helper, HttpClient, MessageUnhandledRejectionError, Request, Response, Router, Singleton, defineConfig, defineConfigFactory, startEgg as start, startEgg };
@@ -7,18 +7,6 @@ import { EggAppConfig as EggAppConfig$1, EggAppInfo, FileLoaderOptions } from "@
7
7
  import { EggLoggerOptions, EggLoggersOptions } from "egg-logger";
8
8
  import { RequestOptions } from "urllib";
9
9
  import { Socket } from "node:net";
10
- import "@eggjs/watcher";
11
- import "@eggjs/development";
12
- import "@eggjs/jsonp";
13
- import "@eggjs/i18n";
14
- import "@eggjs/static";
15
- import "@eggjs/security";
16
- import "@eggjs/schedule";
17
- import "@eggjs/session";
18
- import "@eggjs/onerror";
19
- import "@eggjs/logrotator";
20
- import "@eggjs/multipart";
21
- import "@eggjs/view";
22
10
  import { PartialDeep } from "type-fest";
23
11
 
24
12
  //#region src/lib/types.d.ts
@@ -93,20 +81,27 @@ type EggConfigFactory = (appInfo: EggAppInfo) => PartialEggConfig;
93
81
  /**
94
82
  * Define configuration with type safety
95
83
  * @example
84
+ * ```ts
96
85
  * import { defineConfig } from 'egg';
97
86
  *
98
87
  * export default defineConfig({
99
88
  * keys: 'my-keys',
100
89
  * middleware: []
101
90
  * });
102
- *
103
- * // or with function
104
- * export default defineConfig((appInfo) => ({
91
+ * ```
92
+ */
93
+ declare function defineConfig(config: PartialEggConfig): PartialEggConfig;
94
+ /**
95
+ * Define configuration factory function with type safety
96
+ * @example
97
+ * ```ts
98
+ * export default defineConfigFactory((appInfo): PartialEggConfig => ({
105
99
  * keys: appInfo.name + '_keys',
106
100
  * middleware: []
107
101
  * }));
102
+ * ```
108
103
  */
109
- declare function defineConfig<T extends PartialEggConfig | EggConfigFactory>(config: T): T;
104
+ declare function defineConfigFactory(configFactory: EggConfigFactory): EggConfigFactory;
110
105
  interface EggAppConfig extends EggAppConfig$1 {
111
106
  workerStartTimeout: number;
112
107
  baseDir: string;
@@ -284,4 +279,4 @@ interface EggPlugin {
284
279
  view?: EggPluginItem;
285
280
  }
286
281
  //#endregion
287
- export { ClientErrorResponse, CustomLoaderConfig, EggAppConfig, type EggAppInfo, EggConfigFactory, EggEnvType, EggLoggerConfig, EggPlugin, EggPluginItem, HttpClientConfig, IEggPluginItem, type PartialDeep, PartialEggConfig, PowerPartial, RequestObjectBody, defineConfig };
282
+ export { ClientErrorResponse, CustomLoaderConfig, EggAppConfig, type EggAppInfo, EggConfigFactory, EggEnvType, EggLoggerConfig, EggPlugin, EggPluginItem, HttpClientConfig, IEggPluginItem, type PartialDeep, PartialEggConfig, PowerPartial, RequestObjectBody, defineConfig, defineConfigFactory };
package/dist/lib/types.js CHANGED
@@ -1,36 +1,34 @@
1
- import "@eggjs/watcher";
2
- import "@eggjs/development";
3
- import "@eggjs/jsonp";
4
- import "@eggjs/i18n";
5
- import "@eggjs/static";
6
- import "@eggjs/security";
7
- import "@eggjs/schedule";
8
- import "@eggjs/session";
9
- import "@eggjs/onerror";
10
- import "@eggjs/logrotator";
11
- import "@eggjs/multipart";
12
- import "@eggjs/view";
1
+ import "./types.plugin.js";
13
2
 
14
3
  //#region src/lib/types.ts
15
4
  /**
16
5
  * Define configuration with type safety
17
6
  * @example
7
+ * ```ts
18
8
  * import { defineConfig } from 'egg';
19
9
  *
20
10
  * export default defineConfig({
21
11
  * keys: 'my-keys',
22
12
  * middleware: []
23
13
  * });
24
- *
25
- * // or with function
26
- * export default defineConfig((appInfo) => ({
14
+ * ```
15
+ */
16
+ function defineConfig(config) {
17
+ return config;
18
+ }
19
+ /**
20
+ * Define configuration factory function with type safety
21
+ * @example
22
+ * ```ts
23
+ * export default defineConfigFactory((appInfo): PartialEggConfig => ({
27
24
  * keys: appInfo.name + '_keys',
28
25
  * middleware: []
29
26
  * }));
27
+ * ```
30
28
  */
31
- function defineConfig(config) {
32
- return config;
29
+ function defineConfigFactory(configFactory) {
30
+ return configFactory;
33
31
  }
34
32
 
35
33
  //#endregion
36
- export { defineConfig };
34
+ export { defineConfig, defineConfigFactory };
@@ -0,0 +1,8 @@
1
+ import "@eggjs/watcher";
2
+ import "@eggjs/jsonp";
3
+ import "@eggjs/i18n";
4
+ import "@eggjs/security";
5
+ import "@eggjs/session";
6
+ import "@eggjs/logrotator";
7
+ import "@eggjs/multipart";
8
+ import "@eggjs/view";
@@ -0,0 +1,10 @@
1
+ import "@eggjs/watcher";
2
+ import "@eggjs/jsonp";
3
+ import "@eggjs/i18n";
4
+ import "@eggjs/security";
5
+ import "@eggjs/session";
6
+ import "@eggjs/logrotator";
7
+ import "@eggjs/multipart";
8
+ import "@eggjs/view";
9
+
10
+ export { };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "4.1.0-beta.11",
3
+ "version": "4.1.0-beta.13",
4
4
  "engines": {
5
- "node": ">= 20.19.0"
5
+ "node": ">=22.18.0"
6
6
  },
7
7
  "publishConfig": {
8
8
  "access": "public",
@@ -52,6 +52,7 @@
52
52
  "./lib/loader/EggApplicationLoader": "./dist/lib/loader/EggApplicationLoader.js",
53
53
  "./lib/start": "./dist/lib/start.js",
54
54
  "./lib/types": "./dist/lib/types.js",
55
+ "./lib/types.plugin": "./dist/lib/types.plugin.js",
55
56
  "./lib/utils": "./dist/lib/utils.js",
56
57
  "./urllib": "./dist/urllib.js",
57
58
  "./package.json": "./package.json"
@@ -71,16 +72,12 @@
71
72
  "egg"
72
73
  ],
73
74
  "dependencies": {
74
- "@eggjs/cookies": "^3.1.0",
75
75
  "@eggjs/i18n": "^3.0.1",
76
76
  "@eggjs/jsonp": "^3.0.0",
77
77
  "@eggjs/logrotator": "^4.0.0",
78
78
  "@eggjs/multipart": "^4.0.0",
79
- "@eggjs/onerror": "^3.0.0",
80
- "@eggjs/schedule": "^5.0.2",
81
79
  "@eggjs/security": "^4.0.0",
82
80
  "@eggjs/session": "^4.0.1",
83
- "@eggjs/static": "^3.0.0",
84
81
  "@eggjs/view": "^3.0.1",
85
82
  "circular-json-for-egg": "^1.0.0",
86
83
  "cluster-client": "^3.7.0",
@@ -97,16 +94,19 @@
97
94
  "type-fest": "^5.0.1",
98
95
  "urllib": "^4.6.11",
99
96
  "utility": "^2.5.0",
100
- "@eggjs/cluster": "3.1.0-beta.11",
101
- "@eggjs/core": "6.6.0-beta.11",
102
- "@eggjs/development": "4.1.0-beta.11",
103
- "@eggjs/extend2": "4.1.0-beta.11",
104
- "@eggjs/utils": "4.5.0-beta.11",
105
- "@eggjs/watcher": "4.1.0-beta.11"
97
+ "@eggjs/core": "7.0.0-beta.13",
98
+ "@eggjs/cookies": "4.0.0-beta.13",
99
+ "@eggjs/cluster": "4.0.0-beta.13",
100
+ "@eggjs/development": "5.0.0-beta.13",
101
+ "@eggjs/extend2": "5.0.0-beta.13",
102
+ "@eggjs/onerror": "4.0.0-beta.13",
103
+ "@eggjs/schedule": "6.0.0-beta.13",
104
+ "@eggjs/static": "4.0.0-beta.13",
105
+ "@eggjs/utils": "5.0.0-beta.13",
106
+ "@eggjs/watcher": "5.0.0-beta.13"
106
107
  },
107
108
  "devDependencies": {
108
109
  "@types/koa-bodyparser": "^4.3.12",
109
- "@types/node": "24.5.2",
110
110
  "address": "2",
111
111
  "assert-file": "1",
112
112
  "coffee": "5",
@@ -123,9 +123,9 @@
123
123
  "tsd": "^0.33.0",
124
124
  "tsdown": "^0.15.4",
125
125
  "typescript": "5.9.2",
126
- "@eggjs/koa": "3.1.0-beta.11",
127
- "@eggjs/mock": "6.1.0-beta.11",
128
- "@eggjs/supertest": "8.3.0-beta.11"
126
+ "@eggjs/mock": "7.0.0-beta.13",
127
+ "@eggjs/supertest": "9.0.0-beta.13",
128
+ "@eggjs/koa": "3.1.0-beta.13"
129
129
  },
130
130
  "repository": {
131
131
  "type": "git",