egg 4.1.2-beta.16 → 4.1.2-beta.19
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/README.md +7 -4
- package/dist/lib/egg.d.ts +13 -5
- package/dist/lib/egg.js +33 -9
- package/package.json +93 -39
package/README.md
CHANGED
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
Follow the commands listed below.
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
+
$ corepack enable utoo
|
|
24
25
|
$ mkdir showcase && cd showcase
|
|
25
|
-
$
|
|
26
|
-
|
|
27
|
-
$
|
|
26
|
+
$ ut create egg@beta
|
|
27
|
+
# Or with npm:
|
|
28
|
+
$ npm init egg --type=simple
|
|
29
|
+
$ ut install
|
|
30
|
+
$ ut run dev
|
|
28
31
|
$ open http://localhost:7001
|
|
29
32
|
```
|
|
30
33
|
|
|
31
|
-
> Node.js >=
|
|
34
|
+
> Node.js >= 22.18.0 required.
|
|
32
35
|
|
|
33
36
|
## Documentations
|
|
34
37
|
|
package/dist/lib/egg.d.ts
CHANGED
|
@@ -245,15 +245,23 @@ declare class EggApplicationCore extends EggCore {
|
|
|
245
245
|
_unhandledRejectionHandler(err: any): void;
|
|
246
246
|
/**
|
|
247
247
|
* Clean up non-serializable resources before V8 heap serialization.
|
|
248
|
-
* Closes messenger (IPC listeners),
|
|
249
|
-
* and removes the process-level unhandledRejection
|
|
248
|
+
* Closes messenger (IPC listeners), logger streams and flush timers
|
|
249
|
+
* (file descriptors), and removes the process-level unhandledRejection
|
|
250
|
+
* listener.
|
|
251
|
+
*
|
|
252
|
+
* The `EggLoggers` instance is intentionally kept (not discarded): plugins
|
|
253
|
+
* such as `@eggjs/schedule` capture individual logger references during the
|
|
254
|
+
* load phase, before serialization. Replacing them with a fresh `EggLoggers`
|
|
255
|
+
* on restore would leave those captured references pointing at closed
|
|
256
|
+
* streams (`... log stream had been closed`). Instead, `snapshotDidDeserialize`
|
|
257
|
+
* reopens these same logger objects in place.
|
|
250
258
|
*/
|
|
251
259
|
protected snapshotWillSerialize(): void;
|
|
252
260
|
/**
|
|
253
261
|
* Restore non-serializable resources after V8 heap deserialization.
|
|
254
|
-
* Recreates messenger, re-registers the egg-ready listener,
|
|
255
|
-
* and re-attaches the process-level
|
|
256
|
-
*
|
|
262
|
+
* Recreates messenger, re-registers the egg-ready listener, reopens the
|
|
263
|
+
* logger streams closed during serialize, and re-attaches the process-level
|
|
264
|
+
* unhandledRejection listener.
|
|
257
265
|
*/
|
|
258
266
|
protected snapshotDidDeserialize(): void;
|
|
259
267
|
/**
|
package/dist/lib/egg.js
CHANGED
|
@@ -388,31 +388,55 @@ var EggApplicationCore = class extends EggCore {
|
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
390
390
|
* Clean up non-serializable resources before V8 heap serialization.
|
|
391
|
-
* Closes messenger (IPC listeners),
|
|
392
|
-
* and removes the process-level unhandledRejection
|
|
391
|
+
* Closes messenger (IPC listeners), logger streams and flush timers
|
|
392
|
+
* (file descriptors), and removes the process-level unhandledRejection
|
|
393
|
+
* listener.
|
|
394
|
+
*
|
|
395
|
+
* The `EggLoggers` instance is intentionally kept (not discarded): plugins
|
|
396
|
+
* such as `@eggjs/schedule` capture individual logger references during the
|
|
397
|
+
* load phase, before serialization. Replacing them with a fresh `EggLoggers`
|
|
398
|
+
* on restore would leave those captured references pointing at closed
|
|
399
|
+
* streams (`... log stream had been closed`). Instead, `snapshotDidDeserialize`
|
|
400
|
+
* reopens these same logger objects in place.
|
|
393
401
|
*/
|
|
394
402
|
snapshotWillSerialize() {
|
|
395
403
|
this.messenger.close();
|
|
396
|
-
if (this.#loggers)
|
|
397
|
-
for (const logger of this.#loggers.values()) logger.close();
|
|
398
|
-
this.#loggers = void 0;
|
|
399
|
-
}
|
|
404
|
+
if (this.#loggers) for (const logger of this.#loggers.values()) logger.close();
|
|
400
405
|
process.removeListener("unhandledRejection", this._unhandledRejectionHandler);
|
|
401
406
|
}
|
|
402
407
|
/**
|
|
403
408
|
* Restore non-serializable resources after V8 heap deserialization.
|
|
404
|
-
* Recreates messenger, re-registers the egg-ready listener,
|
|
405
|
-
* and re-attaches the process-level
|
|
406
|
-
*
|
|
409
|
+
* Recreates messenger, re-registers the egg-ready listener, reopens the
|
|
410
|
+
* logger streams closed during serialize, and re-attaches the process-level
|
|
411
|
+
* unhandledRejection listener.
|
|
407
412
|
*/
|
|
408
413
|
snapshotDidDeserialize() {
|
|
409
414
|
this.messenger = create(this);
|
|
410
415
|
this.messenger.once("egg-ready", () => {
|
|
411
416
|
this.lifecycle.triggerServerDidReady();
|
|
412
417
|
});
|
|
418
|
+
this.#reopenLoggers();
|
|
413
419
|
process.on("unhandledRejection", this._unhandledRejectionHandler);
|
|
414
420
|
}
|
|
415
421
|
/**
|
|
422
|
+
* Reopen logger resources that `snapshotWillSerialize` released.
|
|
423
|
+
*
|
|
424
|
+
* `transport.reload()` reopens each `FileTransport` stream on the existing
|
|
425
|
+
* logger objects (so references captured before the snapshot keep working).
|
|
426
|
+
* `FileBufferTransport`, however, clears its flush interval in `close()` and
|
|
427
|
+
* does not restart it in `reload()`, so buffered logs would never flush after
|
|
428
|
+
* restore. Restart that interval explicitly to keep the willSerialize /
|
|
429
|
+
* didDeserialize resource pairing complete.
|
|
430
|
+
*/
|
|
431
|
+
#reopenLoggers() {
|
|
432
|
+
if (!this.#loggers) return;
|
|
433
|
+
for (const logger of this.#loggers.values()) for (const transport of logger.values()) {
|
|
434
|
+
transport.reload();
|
|
435
|
+
const bufferTransport = transport;
|
|
436
|
+
if (typeof bufferTransport._createInterval === "function" && !bufferTransport._timer) bufferTransport._timer = bufferTransport._createInterval();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
416
440
|
* dump out the config and meta object
|
|
417
441
|
* @private
|
|
418
442
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "egg",
|
|
3
|
-
"version": "4.1.2-beta.
|
|
3
|
+
"version": "4.1.2-beta.19",
|
|
4
4
|
"description": "A web application framework for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -82,9 +82,94 @@
|
|
|
82
82
|
},
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public",
|
|
85
|
+
"exports": {
|
|
86
|
+
".": "./dist/index.js",
|
|
87
|
+
"./agent": "./dist/agent.js",
|
|
88
|
+
"./ajv": "./dist/ajv.js",
|
|
89
|
+
"./aop": "./dist/aop.js",
|
|
90
|
+
"./app/extend/context": "./dist/app/extend/context.js",
|
|
91
|
+
"./app/extend/helper": "./dist/app/extend/helper.js",
|
|
92
|
+
"./app/extend/request": "./dist/app/extend/request.js",
|
|
93
|
+
"./app/extend/response": "./dist/app/extend/response.js",
|
|
94
|
+
"./app/middleware/body_parser": "./dist/app/middleware/body_parser.js",
|
|
95
|
+
"./app/middleware/meta": "./dist/app/middleware/meta.js",
|
|
96
|
+
"./app/middleware/notfound": "./dist/app/middleware/notfound.js",
|
|
97
|
+
"./app/middleware/override_method": "./dist/app/middleware/override_method.js",
|
|
98
|
+
"./app/middleware/site_file": "./dist/app/middleware/site_file.js",
|
|
99
|
+
"./config/config.default": "./dist/config/config.default.js",
|
|
100
|
+
"./config/config.local": "./dist/config/config.local.js",
|
|
101
|
+
"./config/config.unittest": "./dist/config/config.unittest.js",
|
|
102
|
+
"./config/plugin": "./dist/config/plugin.js",
|
|
103
|
+
"./dal": "./dist/dal.js",
|
|
104
|
+
"./errors": "./dist/errors.js",
|
|
105
|
+
"./helper": "./dist/helper.js",
|
|
106
|
+
"./lib/agent": "./dist/lib/agent.js",
|
|
107
|
+
"./lib/application": "./dist/lib/application.js",
|
|
108
|
+
"./lib/core/base_context_class": "./dist/lib/core/base_context_class.js",
|
|
109
|
+
"./lib/core/base_context_logger": "./dist/lib/core/base_context_logger.js",
|
|
110
|
+
"./lib/core/base_hook_class": "./dist/lib/core/base_hook_class.js",
|
|
111
|
+
"./lib/core/context_httpclient": "./dist/lib/core/context_httpclient.js",
|
|
112
|
+
"./lib/core/httpclient": "./dist/lib/core/httpclient.js",
|
|
113
|
+
"./lib/core/logger": "./dist/lib/core/logger.js",
|
|
114
|
+
"./lib/core/messenger": "./dist/lib/core/messenger/index.js",
|
|
115
|
+
"./lib/core/messenger/base": "./dist/lib/core/messenger/base.js",
|
|
116
|
+
"./lib/core/messenger/IMessenger": "./dist/lib/core/messenger/IMessenger.js",
|
|
117
|
+
"./lib/core/messenger/ipc": "./dist/lib/core/messenger/ipc.js",
|
|
118
|
+
"./lib/core/messenger/local": "./dist/lib/core/messenger/local.js",
|
|
119
|
+
"./lib/core/utils": "./dist/lib/core/utils.js",
|
|
120
|
+
"./lib/define": "./dist/lib/define.js",
|
|
121
|
+
"./lib/egg": "./dist/lib/egg.js",
|
|
122
|
+
"./lib/error": "./dist/lib/error/index.js",
|
|
123
|
+
"./lib/error/CookieLimitExceedError": "./dist/lib/error/CookieLimitExceedError.js",
|
|
124
|
+
"./lib/error/MessageUnhandledRejectionError": "./dist/lib/error/MessageUnhandledRejectionError.js",
|
|
125
|
+
"./lib/loader": "./dist/lib/loader/index.js",
|
|
126
|
+
"./lib/loader/AgentWorkerLoader": "./dist/lib/loader/AgentWorkerLoader.js",
|
|
127
|
+
"./lib/loader/AppWorkerLoader": "./dist/lib/loader/AppWorkerLoader.js",
|
|
128
|
+
"./lib/loader/EggApplicationLoader": "./dist/lib/loader/EggApplicationLoader.js",
|
|
129
|
+
"./lib/snapshot": "./dist/lib/snapshot.js",
|
|
130
|
+
"./lib/start": "./dist/lib/start.js",
|
|
131
|
+
"./lib/types": "./dist/lib/types.js",
|
|
132
|
+
"./lib/types.plugin": "./dist/lib/types.plugin.js",
|
|
133
|
+
"./orm": "./dist/orm.js",
|
|
134
|
+
"./schedule": "./dist/schedule.js",
|
|
135
|
+
"./transaction": "./dist/transaction.js",
|
|
136
|
+
"./urllib": "./dist/urllib.js",
|
|
137
|
+
"./package.json": "./package.json"
|
|
138
|
+
},
|
|
85
139
|
"tag": "beta"
|
|
86
140
|
},
|
|
141
|
+
"scripts": {
|
|
142
|
+
"typecheck": "tsgo --noEmit"
|
|
143
|
+
},
|
|
87
144
|
"dependencies": {
|
|
145
|
+
"@eggjs/ajv-plugin": "4.0.2-beta.19",
|
|
146
|
+
"@eggjs/aop-plugin": "4.0.2-beta.19",
|
|
147
|
+
"@eggjs/cluster": "4.0.2-beta.19",
|
|
148
|
+
"@eggjs/controller-plugin": "4.0.2-beta.19",
|
|
149
|
+
"@eggjs/cookies": "4.0.2-beta.19",
|
|
150
|
+
"@eggjs/core": "7.0.2-beta.19",
|
|
151
|
+
"@eggjs/dal-plugin": "4.0.2-beta.19",
|
|
152
|
+
"@eggjs/development": "5.0.2-beta.19",
|
|
153
|
+
"@eggjs/errors": "3.0.2-beta.19",
|
|
154
|
+
"@eggjs/eventbus-plugin": "4.0.2-beta.19",
|
|
155
|
+
"@eggjs/extend2": "5.0.2-beta.19",
|
|
156
|
+
"@eggjs/i18n": "4.0.2-beta.19",
|
|
157
|
+
"@eggjs/jsonp": "4.0.2-beta.19",
|
|
158
|
+
"@eggjs/logrotator": "5.0.2-beta.19",
|
|
159
|
+
"@eggjs/multipart": "5.0.2-beta.19",
|
|
160
|
+
"@eggjs/onerror": "4.0.2-beta.19",
|
|
161
|
+
"@eggjs/orm-plugin": "4.0.2-beta.19",
|
|
162
|
+
"@eggjs/schedule": "6.0.2-beta.19",
|
|
163
|
+
"@eggjs/schedule-plugin": "4.0.2-beta.19",
|
|
164
|
+
"@eggjs/security": "5.0.2-beta.19",
|
|
165
|
+
"@eggjs/session": "5.0.2-beta.19",
|
|
166
|
+
"@eggjs/static": "4.0.2-beta.19",
|
|
167
|
+
"@eggjs/tegg": "4.0.2-beta.19",
|
|
168
|
+
"@eggjs/tegg-config": "4.0.2-beta.19",
|
|
169
|
+
"@eggjs/tegg-plugin": "4.0.2-beta.19",
|
|
170
|
+
"@eggjs/utils": "5.0.2-beta.19",
|
|
171
|
+
"@eggjs/view": "4.0.2-beta.19",
|
|
172
|
+
"@eggjs/watcher": "5.0.2-beta.19",
|
|
88
173
|
"circular-json-for-egg": "^1.0.0",
|
|
89
174
|
"cluster-client": "^3.7.0",
|
|
90
175
|
"egg-logger": "^3.5.0",
|
|
@@ -98,37 +183,13 @@
|
|
|
98
183
|
"sendmessage": "^3.0.1",
|
|
99
184
|
"type-fest": "^5.0.1",
|
|
100
185
|
"urllib": "^4.8.2",
|
|
101
|
-
"utility": "^2.5.0"
|
|
102
|
-
"@eggjs/ajv-plugin": "4.0.2-beta.16",
|
|
103
|
-
"@eggjs/aop-plugin": "4.0.2-beta.16",
|
|
104
|
-
"@eggjs/cookies": "4.0.2-beta.16",
|
|
105
|
-
"@eggjs/controller-plugin": "4.0.2-beta.16",
|
|
106
|
-
"@eggjs/development": "5.0.2-beta.16",
|
|
107
|
-
"@eggjs/errors": "3.0.2-beta.16",
|
|
108
|
-
"@eggjs/eventbus-plugin": "4.0.2-beta.16",
|
|
109
|
-
"@eggjs/core": "7.0.2-beta.16",
|
|
110
|
-
"@eggjs/dal-plugin": "4.0.2-beta.16",
|
|
111
|
-
"@eggjs/cluster": "4.0.2-beta.16",
|
|
112
|
-
"@eggjs/i18n": "4.0.2-beta.16",
|
|
113
|
-
"@eggjs/extend2": "5.0.2-beta.16",
|
|
114
|
-
"@eggjs/logrotator": "5.0.2-beta.16",
|
|
115
|
-
"@eggjs/jsonp": "4.0.2-beta.16",
|
|
116
|
-
"@eggjs/multipart": "5.0.2-beta.16",
|
|
117
|
-
"@eggjs/onerror": "4.0.2-beta.16",
|
|
118
|
-
"@eggjs/orm-plugin": "4.0.2-beta.16",
|
|
119
|
-
"@eggjs/schedule": "6.0.2-beta.16",
|
|
120
|
-
"@eggjs/schedule-plugin": "4.0.2-beta.16",
|
|
121
|
-
"@eggjs/static": "4.0.2-beta.16",
|
|
122
|
-
"@eggjs/session": "5.0.2-beta.16",
|
|
123
|
-
"@eggjs/tegg": "4.0.2-beta.16",
|
|
124
|
-
"@eggjs/security": "5.0.2-beta.16",
|
|
125
|
-
"@eggjs/tegg-config": "4.0.2-beta.16",
|
|
126
|
-
"@eggjs/tegg-plugin": "4.0.2-beta.16",
|
|
127
|
-
"@eggjs/utils": "5.0.2-beta.16",
|
|
128
|
-
"@eggjs/view": "4.0.2-beta.16",
|
|
129
|
-
"@eggjs/watcher": "5.0.2-beta.16"
|
|
186
|
+
"utility": "^2.5.0"
|
|
130
187
|
},
|
|
131
188
|
"devDependencies": {
|
|
189
|
+
"@eggjs/koa": "3.1.2-beta.19",
|
|
190
|
+
"@eggjs/mock": "7.0.2-beta.19",
|
|
191
|
+
"@eggjs/supertest": "9.0.2-beta.19",
|
|
192
|
+
"@eggjs/tracer": "4.0.2-beta.19",
|
|
132
193
|
"@types/koa-bodyparser": "^4.3.12",
|
|
133
194
|
"address": "2",
|
|
134
195
|
"assert-file": "1",
|
|
@@ -141,19 +202,12 @@
|
|
|
141
202
|
"runscript": "^2.0.1",
|
|
142
203
|
"sdk-base": "^5.0.1",
|
|
143
204
|
"spy": "^1.0.0",
|
|
144
|
-
"typescript": "^5.9.3"
|
|
145
|
-
"@eggjs/koa": "3.1.2-beta.16",
|
|
146
|
-
"@eggjs/mock": "7.0.2-beta.16",
|
|
147
|
-
"@eggjs/tracer": "4.0.2-beta.16",
|
|
148
|
-
"@eggjs/supertest": "9.0.2-beta.16"
|
|
205
|
+
"typescript": "^5.9.3"
|
|
149
206
|
},
|
|
150
207
|
"engines": {
|
|
151
208
|
"node": ">=22.18.0"
|
|
152
209
|
},
|
|
153
210
|
"egg": {
|
|
154
211
|
"framework": true
|
|
155
|
-
},
|
|
156
|
-
"scripts": {
|
|
157
|
-
"typecheck": "tsgo --noEmit"
|
|
158
212
|
}
|
|
159
|
-
}
|
|
213
|
+
}
|