egg 4.1.0-beta.13 → 4.1.0-beta.14

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.
@@ -25,7 +25,7 @@ declare class Response extends Response$1 {
25
25
  */
26
26
  set realStatus(status: number);
27
27
  }
28
- declare module '@eggjs/core' {
28
+ declare module 'egg' {
29
29
  interface Response {
30
30
  get realStatus(): number;
31
31
  set realStatus(status: number);
@@ -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("message", this.onMessage);
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
- sendmessage(process, {
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
- sendmessage(process, {
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";
@@ -1,10 +1,6 @@
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
3
  import "@eggjs/view";
4
+ import "@eggjs/watcher";
9
5
 
10
6
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "4.1.0-beta.13",
3
+ "version": "4.1.0-beta.14",
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.6.11",
90
+ "urllib": "^4.8.2",
96
91
  "utility": "^2.5.0",
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"
92
+ "@eggjs/cookies": "4.0.0-beta.14",
93
+ "@eggjs/core": "7.0.0-beta.14",
94
+ "@eggjs/cluster": "4.0.0-beta.14",
95
+ "@eggjs/extend2": "5.0.0-beta.14",
96
+ "@eggjs/jsonp": "4.0.0-beta.14",
97
+ "@eggjs/logrotator": "5.0.0-beta.14",
98
+ "@eggjs/schedule": "6.0.0-beta.14",
99
+ "@eggjs/onerror": "4.0.0-beta.14",
100
+ "@eggjs/security": "5.0.0-beta.14",
101
+ "@eggjs/session": "5.0.0-beta.14",
102
+ "@eggjs/static": "4.0.0-beta.14",
103
+ "@eggjs/utils": "5.0.0-beta.14",
104
+ "@eggjs/development": "5.0.0-beta.14",
105
+ "@eggjs/watcher": "5.0.0-beta.14"
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/mock": "7.0.0-beta.13",
127
- "@eggjs/supertest": "9.0.0-beta.13",
128
- "@eggjs/koa": "3.1.0-beta.13"
124
+ "@eggjs/koa": "3.1.0-beta.14",
125
+ "@eggjs/mock": "7.0.0-beta.14",
126
+ "@eggjs/supertest": "9.0.0-beta.14"
129
127
  },
130
128
  "repository": {
131
129
  "type": "git",