@modern-js/plugin-express 2.53.0 → 2.54.0
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/cjs/cli/index.js +2 -2
- package/dist/cjs/plugin.js +15 -14
- package/dist/esm/cli/index.js +2 -2
- package/dist/esm/plugin.js +12 -5
- package/dist/esm-node/cli/index.js +2 -2
- package/dist/esm-node/plugin.js +15 -14
- package/dist/types/plugin.d.ts +3 -3
- package/package.json +10 -10
package/dist/cjs/cli/index.js
CHANGED
|
@@ -54,9 +54,9 @@ const expressPlugin = () => ({
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
_internalServerPlugins({ plugins }) {
|
|
58
58
|
plugins.push({
|
|
59
|
-
|
|
59
|
+
name: "@modern-js/plugin-express/server"
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
62
|
plugins
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_express = __toESM(require("express"));
|
|
|
36
36
|
var import_cookie_parser = __toESM(require("cookie-parser"));
|
|
37
37
|
var import_utils = require("@modern-js/utils");
|
|
38
38
|
var import_finalhandler = __toESM(require("finalhandler"));
|
|
39
|
-
var import_node = require("@modern-js/server-core/
|
|
39
|
+
var import_node = require("@modern-js/server-core/node");
|
|
40
40
|
var import_context = require("./context");
|
|
41
41
|
var import_registerRoutes = __toESM(require("./registerRoutes"));
|
|
42
42
|
const findAppModule = async (apiDir) => {
|
|
@@ -104,7 +104,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
104
104
|
}
|
|
105
105
|
if (render) {
|
|
106
106
|
app.use(async (req, res, next) => {
|
|
107
|
-
const response = await render(req.__honoRequest, {
|
|
107
|
+
const response = await render(req.__honoRequest.raw, {
|
|
108
108
|
logger: import_utils.logger,
|
|
109
109
|
nodeReq: req,
|
|
110
110
|
templates: req.__templates,
|
|
@@ -141,18 +141,19 @@ var plugin_default = () => {
|
|
|
141
141
|
"@modern-js/plugin-server"
|
|
142
142
|
],
|
|
143
143
|
setup: (api) => ({
|
|
144
|
-
async
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
async reset({ event }) {
|
|
145
|
+
if (event.type === "file-change") {
|
|
146
|
+
const appContext = api.useAppContext();
|
|
147
|
+
const middlewares = appContext.apiMiddlewares;
|
|
148
|
+
const apiHandlerInfos = appContext.apiHandlerInfos;
|
|
149
|
+
app = await createApp({
|
|
150
|
+
apiDir,
|
|
151
|
+
middlewares,
|
|
152
|
+
mode,
|
|
153
|
+
apiHandlerInfos,
|
|
154
|
+
render: renderHtml
|
|
155
|
+
});
|
|
156
|
+
}
|
|
156
157
|
},
|
|
157
158
|
async prepareApiServer({ pwd, render }) {
|
|
158
159
|
var _userConfig_bff;
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -21,10 +21,10 @@ var expressPlugin = function() {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
_internalServerPlugins: function _internalServerPlugins(param) {
|
|
25
25
|
var plugins = param.plugins;
|
|
26
26
|
plugins.push({
|
|
27
|
-
|
|
27
|
+
name: "@modern-js/plugin-express/server"
|
|
28
28
|
});
|
|
29
29
|
return {
|
|
30
30
|
plugins
|
package/dist/esm/plugin.js
CHANGED
|
@@ -5,7 +5,7 @@ import express from "express";
|
|
|
5
5
|
import cookieParser from "cookie-parser";
|
|
6
6
|
import { fs, compatRequire, logger } from "@modern-js/utils";
|
|
7
7
|
import finalhandler from "finalhandler";
|
|
8
|
-
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/
|
|
8
|
+
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/node";
|
|
9
9
|
import { run } from "./context";
|
|
10
10
|
import registerRoutes from "./registerRoutes";
|
|
11
11
|
var findAppModule = function() {
|
|
@@ -175,7 +175,7 @@ var createApp = function() {
|
|
|
175
175
|
case 0:
|
|
176
176
|
return [
|
|
177
177
|
4,
|
|
178
|
-
render(req.__honoRequest, {
|
|
178
|
+
render(req.__honoRequest.raw, {
|
|
179
179
|
logger,
|
|
180
180
|
nodeReq: req,
|
|
181
181
|
templates: req.__templates,
|
|
@@ -237,12 +237,18 @@ function plugin_default() {
|
|
|
237
237
|
],
|
|
238
238
|
setup: function(api) {
|
|
239
239
|
return {
|
|
240
|
-
|
|
240
|
+
reset: function reset(param) {
|
|
241
|
+
var event = param.event;
|
|
241
242
|
return _async_to_generator(function() {
|
|
242
243
|
var appContext, middlewares, apiHandlerInfos;
|
|
243
244
|
return _ts_generator(this, function(_state) {
|
|
244
245
|
switch (_state.label) {
|
|
245
246
|
case 0:
|
|
247
|
+
if (!(event.type === "file-change"))
|
|
248
|
+
return [
|
|
249
|
+
3,
|
|
250
|
+
2
|
|
251
|
+
];
|
|
246
252
|
appContext = api.useAppContext();
|
|
247
253
|
middlewares = appContext.apiMiddlewares;
|
|
248
254
|
apiHandlerInfos = appContext.apiHandlerInfos;
|
|
@@ -258,9 +264,10 @@ function plugin_default() {
|
|
|
258
264
|
];
|
|
259
265
|
case 1:
|
|
260
266
|
app = _state.sent();
|
|
267
|
+
_state.label = 2;
|
|
268
|
+
case 2:
|
|
261
269
|
return [
|
|
262
|
-
2
|
|
263
|
-
changes
|
|
270
|
+
2
|
|
264
271
|
];
|
|
265
272
|
}
|
|
266
273
|
});
|
|
@@ -20,9 +20,9 @@ const expressPlugin = () => ({
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
_internalServerPlugins({ plugins }) {
|
|
24
24
|
plugins.push({
|
|
25
|
-
|
|
25
|
+
name: "@modern-js/plugin-express/server"
|
|
26
26
|
});
|
|
27
27
|
return {
|
|
28
28
|
plugins
|
package/dist/esm-node/plugin.js
CHANGED
|
@@ -3,7 +3,7 @@ import express from "express";
|
|
|
3
3
|
import cookieParser from "cookie-parser";
|
|
4
4
|
import { fs, compatRequire, logger } from "@modern-js/utils";
|
|
5
5
|
import finalhandler from "finalhandler";
|
|
6
|
-
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/
|
|
6
|
+
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/node";
|
|
7
7
|
import { run } from "./context";
|
|
8
8
|
import registerRoutes from "./registerRoutes";
|
|
9
9
|
const findAppModule = async (apiDir) => {
|
|
@@ -71,7 +71,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
71
71
|
}
|
|
72
72
|
if (render) {
|
|
73
73
|
app.use(async (req, res, next) => {
|
|
74
|
-
const response = await render(req.__honoRequest, {
|
|
74
|
+
const response = await render(req.__honoRequest.raw, {
|
|
75
75
|
logger,
|
|
76
76
|
nodeReq: req,
|
|
77
77
|
templates: req.__templates,
|
|
@@ -108,18 +108,19 @@ var plugin_default = () => {
|
|
|
108
108
|
"@modern-js/plugin-server"
|
|
109
109
|
],
|
|
110
110
|
setup: (api) => ({
|
|
111
|
-
async
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
async reset({ event }) {
|
|
112
|
+
if (event.type === "file-change") {
|
|
113
|
+
const appContext = api.useAppContext();
|
|
114
|
+
const middlewares = appContext.apiMiddlewares;
|
|
115
|
+
const apiHandlerInfos = appContext.apiHandlerInfos;
|
|
116
|
+
app = await createApp({
|
|
117
|
+
apiDir,
|
|
118
|
+
middlewares,
|
|
119
|
+
mode,
|
|
120
|
+
apiHandlerInfos,
|
|
121
|
+
render: renderHtml
|
|
122
|
+
});
|
|
123
|
+
}
|
|
123
124
|
},
|
|
124
125
|
async prepareApiServer({ pwd, render }) {
|
|
125
126
|
var _userConfig_bff;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ServerPlugin } from '@modern-js/server-core';
|
|
1
|
+
import type { ServerManifest, ServerPlugin, InternalRequest } from '@modern-js/server-core';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Express {
|
|
4
4
|
interface Request {
|
|
5
|
-
__honoRequest:
|
|
5
|
+
__honoRequest: InternalRequest;
|
|
6
6
|
__templates: Record<string, string>;
|
|
7
|
-
__serverManifest:
|
|
7
|
+
__serverManifest: ServerManifest;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.54.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"reflect-metadata": "^0.1.13",
|
|
50
50
|
"type-is": "^1.6.18",
|
|
51
51
|
"@swc/helpers": "0.5.3",
|
|
52
|
-
"@modern-js/bff-
|
|
53
|
-
"@modern-js/bff-
|
|
54
|
-
"@modern-js/
|
|
55
|
-
"@modern-js/
|
|
52
|
+
"@modern-js/bff-core": "2.54.0",
|
|
53
|
+
"@modern-js/bff-runtime": "2.54.0",
|
|
54
|
+
"@modern-js/types": "2.54.0",
|
|
55
|
+
"@modern-js/utils": "2.54.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/cookie-parser": "^1.4.2",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"supertest": "^6.1.6",
|
|
69
69
|
"typescript": "^5",
|
|
70
70
|
"zod": "^3.22.3",
|
|
71
|
-
"@modern-js/core": "2.
|
|
72
|
-
"@modern-js/app-tools": "2.
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@scripts/
|
|
71
|
+
"@modern-js/core": "2.54.0",
|
|
72
|
+
"@modern-js/app-tools": "2.54.0",
|
|
73
|
+
"@modern-js/server-core": "2.54.0",
|
|
74
|
+
"@scripts/build": "2.54.0",
|
|
75
|
+
"@scripts/jest-config": "2.54.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"express": "^4.17.1"
|