egg 4.1.0-beta.13 → 4.1.0-beta.15
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.
|
@@ -8,6 +8,7 @@ import { BaseMessenger } from "./base.js";
|
|
|
8
8
|
* Communication between app worker and agent worker by IPC channel
|
|
9
9
|
*/
|
|
10
10
|
declare class Messenger extends BaseMessenger implements IMessenger {
|
|
11
|
+
#private;
|
|
11
12
|
readonly pid: string;
|
|
12
13
|
opids: string[];
|
|
13
14
|
constructor(egg: EggApplicationCore);
|
|
@@ -19,7 +19,8 @@ var Messenger = class extends BaseMessenger {
|
|
|
19
19
|
this.opids = workerIds.map((workerId) => String(workerId));
|
|
20
20
|
});
|
|
21
21
|
this.onMessage = this.onMessage.bind(this);
|
|
22
|
-
process.on("
|
|
22
|
+
if (this.egg.options.mode === "all-in-one-process") process.on("sendmessage-to-self", this.onMessage);
|
|
23
|
+
else process.on("message", this.onMessage);
|
|
23
24
|
if (!workerThreads.isMainThread) workerThreads.parentPort.on("message", this.onMessage);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
@@ -43,12 +44,13 @@ var Messenger = class extends BaseMessenger {
|
|
|
43
44
|
*/
|
|
44
45
|
sendTo(workerId, action, data) {
|
|
45
46
|
debug("[%s:%s] send %s with %j to workerId:%s", this.egg.type, this.pid, action, data, workerId);
|
|
46
|
-
|
|
47
|
+
const message = {
|
|
47
48
|
action,
|
|
48
49
|
data,
|
|
49
50
|
receiverPid: String(workerId),
|
|
50
51
|
receiverWorkerId: String(workerId)
|
|
51
|
-
}
|
|
52
|
+
};
|
|
53
|
+
this.#sendMessage(message);
|
|
52
54
|
return this;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
@@ -98,13 +100,19 @@ var Messenger = class extends BaseMessenger {
|
|
|
98
100
|
* @return {Messenger} this
|
|
99
101
|
*/
|
|
100
102
|
send(action, data, to) {
|
|
101
|
-
|
|
103
|
+
debug("send message %s with %j to %s", action, data, to);
|
|
104
|
+
this.#sendMessage({
|
|
102
105
|
action,
|
|
103
106
|
data,
|
|
104
107
|
to
|
|
105
108
|
});
|
|
106
109
|
return this;
|
|
107
110
|
}
|
|
111
|
+
#sendMessage(message) {
|
|
112
|
+
debug("[%s:%s] send message %j, mode: %s", this.egg.type, this.pid, message, this.egg.options.mode);
|
|
113
|
+
if (this.egg.options.mode === "all-in-one-process") process.emit("sendmessage-to-self", message);
|
|
114
|
+
else sendmessage(process, message);
|
|
115
|
+
}
|
|
108
116
|
onMessage(message) {
|
|
109
117
|
if (typeof message?.action === "string") {
|
|
110
118
|
debug("[%s:%s] got message %s with %j, receiverWorkerId: %s", this.egg.type, this.pid, message.action, message.data, message.receiverWorkerId ?? message.receiverPid);
|
package/dist/lib/egg.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { Cookies } from "@eggjs/cookies";
|
|
|
17
17
|
//#region src/lib/egg.d.ts
|
|
18
18
|
declare const EGG_PATH: unique symbol;
|
|
19
19
|
interface EggApplicationCoreOptions extends Omit<EggCoreOptions, 'baseDir'> {
|
|
20
|
-
mode?: 'cluster' | 'single';
|
|
20
|
+
mode?: 'cluster' | 'single' | 'all-in-one-process';
|
|
21
21
|
clusterPort?: number;
|
|
22
22
|
baseDir?: string;
|
|
23
23
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import "@eggjs/watcher";
|
|
2
|
-
import "@eggjs/jsonp";
|
|
3
1
|
import "@eggjs/i18n";
|
|
4
|
-
import "@eggjs/security";
|
|
5
|
-
import "@eggjs/session";
|
|
6
|
-
import "@eggjs/logrotator";
|
|
7
2
|
import "@eggjs/multipart";
|
|
8
|
-
import "@eggjs/view";
|
|
3
|
+
import "@eggjs/view";
|
|
4
|
+
import "@eggjs/watcher";
|
package/dist/lib/types.plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "egg",
|
|
3
|
-
"version": "4.1.0-beta.
|
|
3
|
+
"version": "4.1.0-beta.15",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.18.0"
|
|
6
6
|
},
|
|
@@ -73,15 +73,10 @@
|
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@eggjs/i18n": "^3.0.1",
|
|
76
|
-
"@eggjs/jsonp": "^3.0.0",
|
|
77
|
-
"@eggjs/logrotator": "^4.0.0",
|
|
78
76
|
"@eggjs/multipart": "^4.0.0",
|
|
79
|
-
"@eggjs/security": "^4.0.0",
|
|
80
|
-
"@eggjs/session": "^4.0.1",
|
|
81
77
|
"@eggjs/view": "^3.0.1",
|
|
82
78
|
"circular-json-for-egg": "^1.0.0",
|
|
83
79
|
"cluster-client": "^3.7.0",
|
|
84
|
-
"egg-errors": "^2.3.2",
|
|
85
80
|
"egg-logger": "^3.5.0",
|
|
86
81
|
"graceful": "^2.0.0",
|
|
87
82
|
"humanize-ms": "^2.0.0",
|
|
@@ -92,18 +87,22 @@
|
|
|
92
87
|
"performance-ms": "^1.1.0",
|
|
93
88
|
"sendmessage": "^3.0.1",
|
|
94
89
|
"type-fest": "^5.0.1",
|
|
95
|
-
"urllib": "^4.
|
|
90
|
+
"urllib": "^4.8.2",
|
|
96
91
|
"utility": "^2.5.0",
|
|
97
|
-
"@eggjs/
|
|
98
|
-
"@eggjs/cookies": "4.0.0-beta.
|
|
99
|
-
"@eggjs/
|
|
100
|
-
"@eggjs/
|
|
101
|
-
"@eggjs/
|
|
102
|
-
"@eggjs/onerror": "4.0.0-beta.
|
|
103
|
-
"@eggjs/
|
|
104
|
-
"@eggjs/
|
|
105
|
-
"@eggjs/
|
|
106
|
-
"@eggjs/
|
|
92
|
+
"@eggjs/cluster": "4.0.0-beta.15",
|
|
93
|
+
"@eggjs/cookies": "4.0.0-beta.15",
|
|
94
|
+
"@eggjs/core": "7.0.0-beta.15",
|
|
95
|
+
"@eggjs/extend2": "5.0.0-beta.15",
|
|
96
|
+
"@eggjs/jsonp": "4.0.0-beta.15",
|
|
97
|
+
"@eggjs/onerror": "4.0.0-beta.15",
|
|
98
|
+
"@eggjs/logrotator": "5.0.0-beta.15",
|
|
99
|
+
"@eggjs/schedule": "6.0.0-beta.15",
|
|
100
|
+
"@eggjs/development": "5.0.0-beta.15",
|
|
101
|
+
"@eggjs/security": "5.0.0-beta.15",
|
|
102
|
+
"@eggjs/session": "5.0.0-beta.15",
|
|
103
|
+
"@eggjs/utils": "5.0.0-beta.15",
|
|
104
|
+
"@eggjs/watcher": "5.0.0-beta.15",
|
|
105
|
+
"@eggjs/static": "4.0.0-beta.15"
|
|
107
106
|
},
|
|
108
107
|
"devDependencies": {
|
|
109
108
|
"@types/koa-bodyparser": "^4.3.12",
|
|
@@ -116,16 +115,15 @@
|
|
|
116
115
|
"formstream": "^1.5.1",
|
|
117
116
|
"koa-static": "^5.0.0",
|
|
118
117
|
"mm": "^4.0.2",
|
|
119
|
-
"pedding": "^2.0.1",
|
|
120
118
|
"runscript": "^2.0.1",
|
|
121
119
|
"sdk-base": "^5.0.1",
|
|
122
120
|
"spy": "^1.0.0",
|
|
123
121
|
"tsd": "^0.33.0",
|
|
124
122
|
"tsdown": "^0.15.4",
|
|
125
123
|
"typescript": "5.9.2",
|
|
126
|
-
"@eggjs/
|
|
127
|
-
"@eggjs/
|
|
128
|
-
"@eggjs/
|
|
124
|
+
"@eggjs/koa": "3.1.0-beta.15",
|
|
125
|
+
"@eggjs/mock": "7.0.0-beta.15",
|
|
126
|
+
"@eggjs/supertest": "9.0.0-beta.15"
|
|
129
127
|
},
|
|
130
128
|
"repository": {
|
|
131
129
|
"type": "git",
|