@modern-js/plugin-express 2.58.0 → 2.58.2
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/plugin.js +7 -7
- package/dist/cjs/runtime/operators.js +0 -1
- package/dist/esm/plugin.js +159 -43
- package/dist/esm/runtime/operators.js +54 -57
- package/dist/esm-node/plugin.js +8 -8
- package/dist/esm-node/runtime/operators.js +0 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/runtime/operators.d.ts +2 -2
- package/dist/types/utils.d.ts +1 -1
- package/package.json +13 -11
- package/types.d.ts +7 -4
package/dist/cjs/plugin.js
CHANGED
|
@@ -49,18 +49,18 @@ const findAppModule = async (apiDir) => {
|
|
|
49
49
|
if (await import_utils.fs.pathExists(filename)) {
|
|
50
50
|
delete require.cache[filename];
|
|
51
51
|
return [
|
|
52
|
-
(0, import_utils.
|
|
52
|
+
await (0, import_utils.compatibleRequire)(filename),
|
|
53
53
|
require(filename)
|
|
54
54
|
];
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
return [];
|
|
58
58
|
};
|
|
59
|
-
const initMiddlewares = (middleware, app) => {
|
|
60
|
-
|
|
61
|
-
const middlewareFunc = typeof middlewareItem === "string" ? (0, import_utils.
|
|
59
|
+
const initMiddlewares = async (middleware, app) => {
|
|
60
|
+
for (const middlewareItem of middleware) {
|
|
61
|
+
const middlewareFunc = typeof middlewareItem === "string" ? await (0, import_utils.compatibleRequire)(middlewareItem) : middlewareItem;
|
|
62
62
|
app.use(middlewareFunc);
|
|
63
|
-
}
|
|
63
|
+
}
|
|
64
64
|
};
|
|
65
65
|
const useRun = (app) => {
|
|
66
66
|
app.use((req, res, next) => {
|
|
@@ -81,7 +81,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
81
81
|
}
|
|
82
82
|
initApp(app);
|
|
83
83
|
if (middlewares && middlewares.length > 0) {
|
|
84
|
-
initMiddlewares(middlewares, app);
|
|
84
|
+
await initMiddlewares(middlewares, app);
|
|
85
85
|
}
|
|
86
86
|
useRun(app);
|
|
87
87
|
(0, import_registerRoutes.default)(app, apiHandlerInfos);
|
|
@@ -95,7 +95,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
95
95
|
app = (0, import_express.default)();
|
|
96
96
|
initApp(app);
|
|
97
97
|
if (middlewares && middlewares.length > 0) {
|
|
98
|
-
initMiddlewares(middlewares, app);
|
|
98
|
+
await initMiddlewares(middlewares, app);
|
|
99
99
|
}
|
|
100
100
|
useRun(app);
|
|
101
101
|
(0, import_registerRoutes.default)(app, apiHandlerInfos);
|
|
@@ -26,7 +26,6 @@ var import_context = require("../context");
|
|
|
26
26
|
const Pipe = (func) => {
|
|
27
27
|
return {
|
|
28
28
|
name: "pipe",
|
|
29
|
-
// eslint-disable-next-line consistent-return
|
|
30
29
|
async execute(executeHelper, next) {
|
|
31
30
|
const { inputs } = executeHelper;
|
|
32
31
|
const ctx = (0, import_context.useContext)();
|
package/dist/esm/plugin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import express from "express";
|
|
5
5
|
import cookieParser from "cookie-parser";
|
|
6
|
-
import {
|
|
6
|
+
import { compatibleRequire, fs, logger } from "@modern-js/utils";
|
|
7
7
|
import finalhandler from "finalhandler";
|
|
8
8
|
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/node";
|
|
9
9
|
import { run } from "./context";
|
|
@@ -26,9 +26,9 @@ var findAppModule = function() {
|
|
|
26
26
|
case 1:
|
|
27
27
|
_state.trys.push([
|
|
28
28
|
1,
|
|
29
|
-
6,
|
|
30
29
|
7,
|
|
31
|
-
8
|
|
30
|
+
8,
|
|
31
|
+
9
|
|
32
32
|
]);
|
|
33
33
|
_iterator = paths[Symbol.iterator]();
|
|
34
34
|
_state.label = 2;
|
|
@@ -36,7 +36,7 @@ var findAppModule = function() {
|
|
|
36
36
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
|
37
37
|
return [
|
|
38
38
|
3,
|
|
39
|
-
|
|
39
|
+
6
|
|
40
40
|
];
|
|
41
41
|
filename = _step.value;
|
|
42
42
|
return [
|
|
@@ -44,37 +44,44 @@ var findAppModule = function() {
|
|
|
44
44
|
fs.pathExists(filename)
|
|
45
45
|
];
|
|
46
46
|
case 3:
|
|
47
|
-
if (_state.sent())
|
|
48
|
-
delete require.cache[filename];
|
|
47
|
+
if (!_state.sent())
|
|
49
48
|
return [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
compatRequire(filename),
|
|
53
|
-
require(filename)
|
|
54
|
-
]
|
|
49
|
+
3,
|
|
50
|
+
5
|
|
55
51
|
];
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
delete require.cache[filename];
|
|
53
|
+
return [
|
|
54
|
+
4,
|
|
55
|
+
compatibleRequire(filename)
|
|
56
|
+
];
|
|
58
57
|
case 4:
|
|
58
|
+
return [
|
|
59
|
+
2,
|
|
60
|
+
[
|
|
61
|
+
_state.sent(),
|
|
62
|
+
require(filename)
|
|
63
|
+
]
|
|
64
|
+
];
|
|
65
|
+
case 5:
|
|
59
66
|
_iteratorNormalCompletion = true;
|
|
60
67
|
return [
|
|
61
68
|
3,
|
|
62
69
|
2
|
|
63
70
|
];
|
|
64
|
-
case
|
|
71
|
+
case 6:
|
|
65
72
|
return [
|
|
66
73
|
3,
|
|
67
|
-
|
|
74
|
+
9
|
|
68
75
|
];
|
|
69
|
-
case
|
|
76
|
+
case 7:
|
|
70
77
|
err = _state.sent();
|
|
71
78
|
_didIteratorError = true;
|
|
72
79
|
_iteratorError = err;
|
|
73
80
|
return [
|
|
74
81
|
3,
|
|
75
|
-
|
|
82
|
+
9
|
|
76
83
|
];
|
|
77
|
-
case
|
|
84
|
+
case 8:
|
|
78
85
|
try {
|
|
79
86
|
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
80
87
|
_iterator.return();
|
|
@@ -87,7 +94,7 @@ var findAppModule = function() {
|
|
|
87
94
|
return [
|
|
88
95
|
7
|
|
89
96
|
];
|
|
90
|
-
case
|
|
97
|
+
case 9:
|
|
91
98
|
return [
|
|
92
99
|
2,
|
|
93
100
|
[]
|
|
@@ -99,12 +106,95 @@ var findAppModule = function() {
|
|
|
99
106
|
return _ref.apply(this, arguments);
|
|
100
107
|
};
|
|
101
108
|
}();
|
|
102
|
-
var initMiddlewares = function(
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
|
|
109
|
+
var initMiddlewares = function() {
|
|
110
|
+
var _ref = _async_to_generator(function(middleware, app) {
|
|
111
|
+
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, middlewareItem, middlewareFunc, _tmp, err;
|
|
112
|
+
return _ts_generator(this, function(_state) {
|
|
113
|
+
switch (_state.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
116
|
+
_state.label = 1;
|
|
117
|
+
case 1:
|
|
118
|
+
_state.trys.push([
|
|
119
|
+
1,
|
|
120
|
+
8,
|
|
121
|
+
9,
|
|
122
|
+
10
|
|
123
|
+
]);
|
|
124
|
+
_iterator = middleware[Symbol.iterator]();
|
|
125
|
+
_state.label = 2;
|
|
126
|
+
case 2:
|
|
127
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
|
128
|
+
return [
|
|
129
|
+
3,
|
|
130
|
+
7
|
|
131
|
+
];
|
|
132
|
+
middlewareItem = _step.value;
|
|
133
|
+
if (!(typeof middlewareItem === "string"))
|
|
134
|
+
return [
|
|
135
|
+
3,
|
|
136
|
+
4
|
|
137
|
+
];
|
|
138
|
+
return [
|
|
139
|
+
4,
|
|
140
|
+
compatibleRequire(middlewareItem)
|
|
141
|
+
];
|
|
142
|
+
case 3:
|
|
143
|
+
_tmp = _state.sent();
|
|
144
|
+
return [
|
|
145
|
+
3,
|
|
146
|
+
5
|
|
147
|
+
];
|
|
148
|
+
case 4:
|
|
149
|
+
_tmp = middlewareItem;
|
|
150
|
+
_state.label = 5;
|
|
151
|
+
case 5:
|
|
152
|
+
middlewareFunc = _tmp;
|
|
153
|
+
app.use(middlewareFunc);
|
|
154
|
+
_state.label = 6;
|
|
155
|
+
case 6:
|
|
156
|
+
_iteratorNormalCompletion = true;
|
|
157
|
+
return [
|
|
158
|
+
3,
|
|
159
|
+
2
|
|
160
|
+
];
|
|
161
|
+
case 7:
|
|
162
|
+
return [
|
|
163
|
+
3,
|
|
164
|
+
10
|
|
165
|
+
];
|
|
166
|
+
case 8:
|
|
167
|
+
err = _state.sent();
|
|
168
|
+
_didIteratorError = true;
|
|
169
|
+
_iteratorError = err;
|
|
170
|
+
return [
|
|
171
|
+
3,
|
|
172
|
+
10
|
|
173
|
+
];
|
|
174
|
+
case 9:
|
|
175
|
+
try {
|
|
176
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
177
|
+
_iterator.return();
|
|
178
|
+
}
|
|
179
|
+
} finally {
|
|
180
|
+
if (_didIteratorError) {
|
|
181
|
+
throw _iteratorError;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return [
|
|
185
|
+
7
|
|
186
|
+
];
|
|
187
|
+
case 10:
|
|
188
|
+
return [
|
|
189
|
+
2
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
106
193
|
});
|
|
107
|
-
|
|
194
|
+
return function initMiddlewares2(middleware, app) {
|
|
195
|
+
return _ref.apply(this, arguments);
|
|
196
|
+
};
|
|
197
|
+
}();
|
|
108
198
|
var useRun = function(app) {
|
|
109
199
|
app.use(function(req, res, next) {
|
|
110
200
|
run({
|
|
@@ -123,7 +213,7 @@ var createApp = function() {
|
|
|
123
213
|
if (!(mode === "framework"))
|
|
124
214
|
return [
|
|
125
215
|
3,
|
|
126
|
-
|
|
216
|
+
4
|
|
127
217
|
];
|
|
128
218
|
return [
|
|
129
219
|
4,
|
|
@@ -137,9 +227,19 @@ var createApp = function() {
|
|
|
137
227
|
app = express();
|
|
138
228
|
}
|
|
139
229
|
initApp(app);
|
|
140
|
-
if (middlewares && middlewares.length > 0)
|
|
141
|
-
|
|
142
|
-
|
|
230
|
+
if (!(middlewares && middlewares.length > 0))
|
|
231
|
+
return [
|
|
232
|
+
3,
|
|
233
|
+
3
|
|
234
|
+
];
|
|
235
|
+
return [
|
|
236
|
+
4,
|
|
237
|
+
initMiddlewares(middlewares, app)
|
|
238
|
+
];
|
|
239
|
+
case 2:
|
|
240
|
+
_state.sent();
|
|
241
|
+
_state.label = 3;
|
|
242
|
+
case 3:
|
|
143
243
|
useRun(app);
|
|
144
244
|
registerRoutes(app, apiHandlerInfos);
|
|
145
245
|
if (hooks) {
|
|
@@ -150,22 +250,38 @@ var createApp = function() {
|
|
|
150
250
|
}
|
|
151
251
|
return [
|
|
152
252
|
3,
|
|
153
|
-
|
|
253
|
+
8
|
|
154
254
|
];
|
|
155
|
-
case
|
|
156
|
-
if (mode === "function")
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
255
|
+
case 4:
|
|
256
|
+
if (!(mode === "function"))
|
|
257
|
+
return [
|
|
258
|
+
3,
|
|
259
|
+
7
|
|
260
|
+
];
|
|
261
|
+
app = express();
|
|
262
|
+
initApp(app);
|
|
263
|
+
if (!(middlewares && middlewares.length > 0))
|
|
264
|
+
return [
|
|
265
|
+
3,
|
|
266
|
+
6
|
|
267
|
+
];
|
|
268
|
+
return [
|
|
269
|
+
4,
|
|
270
|
+
initMiddlewares(middlewares, app)
|
|
271
|
+
];
|
|
272
|
+
case 5:
|
|
273
|
+
_state.sent();
|
|
274
|
+
_state.label = 6;
|
|
275
|
+
case 6:
|
|
276
|
+
useRun(app);
|
|
277
|
+
registerRoutes(app, apiHandlerInfos);
|
|
278
|
+
return [
|
|
279
|
+
3,
|
|
280
|
+
8
|
|
281
|
+
];
|
|
282
|
+
case 7:
|
|
283
|
+
throw new Error("mode must be function or framework");
|
|
284
|
+
case 8:
|
|
169
285
|
if (render) {
|
|
170
286
|
app.use(function() {
|
|
171
287
|
var _ref2 = _async_to_generator(function(req, res, next) {
|
|
@@ -4,66 +4,63 @@ import { useContext } from "../context";
|
|
|
4
4
|
var Pipe = function(func) {
|
|
5
5
|
return {
|
|
6
6
|
name: "pipe",
|
|
7
|
-
execute: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
res = ctx.res;
|
|
18
|
-
if (!(typeof func === "function"))
|
|
19
|
-
return [
|
|
20
|
-
3,
|
|
21
|
-
3
|
|
22
|
-
];
|
|
23
|
-
isPiped = true;
|
|
24
|
-
end = function(value) {
|
|
25
|
-
isPiped = false;
|
|
26
|
-
if (typeof value === "function") {
|
|
27
|
-
value(res);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
return value;
|
|
31
|
-
};
|
|
7
|
+
execute: function execute(executeHelper, next) {
|
|
8
|
+
return _async_to_generator(function() {
|
|
9
|
+
var inputs, ctx, res, isPiped, end, output;
|
|
10
|
+
return _ts_generator(this, function(_state) {
|
|
11
|
+
switch (_state.label) {
|
|
12
|
+
case 0:
|
|
13
|
+
inputs = executeHelper.inputs;
|
|
14
|
+
ctx = useContext();
|
|
15
|
+
res = ctx.res;
|
|
16
|
+
if (!(typeof func === "function"))
|
|
32
17
|
return [
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
3,
|
|
19
|
+
3
|
|
35
20
|
];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
executeHelper.result = output
|
|
43
|
-
];
|
|
44
|
-
} else {
|
|
45
|
-
return [
|
|
46
|
-
2
|
|
47
|
-
];
|
|
48
|
-
}
|
|
21
|
+
isPiped = true;
|
|
22
|
+
end = function(value) {
|
|
23
|
+
isPiped = false;
|
|
24
|
+
if (typeof value === "function") {
|
|
25
|
+
value(res);
|
|
26
|
+
return;
|
|
49
27
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
return [
|
|
31
|
+
4,
|
|
32
|
+
func(inputs, end)
|
|
33
|
+
];
|
|
34
|
+
case 1:
|
|
35
|
+
output = _state.sent();
|
|
36
|
+
if (!isPiped) {
|
|
37
|
+
if (output) {
|
|
38
|
+
return [
|
|
39
|
+
2,
|
|
40
|
+
executeHelper.result = output
|
|
41
|
+
];
|
|
42
|
+
} else {
|
|
43
|
+
return [
|
|
44
|
+
2
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
executeHelper.inputs = output;
|
|
49
|
+
return [
|
|
50
|
+
4,
|
|
51
|
+
next()
|
|
52
|
+
];
|
|
53
|
+
case 2:
|
|
54
|
+
_state.sent();
|
|
55
|
+
_state.label = 3;
|
|
56
|
+
case 3:
|
|
57
|
+
return [
|
|
58
|
+
2
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
})();
|
|
63
|
+
}
|
|
67
64
|
};
|
|
68
65
|
};
|
|
69
66
|
var Middleware = function(middleware) {
|
package/dist/esm-node/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import express from "express";
|
|
3
3
|
import cookieParser from "cookie-parser";
|
|
4
|
-
import {
|
|
4
|
+
import { compatibleRequire, fs, logger } from "@modern-js/utils";
|
|
5
5
|
import finalhandler from "finalhandler";
|
|
6
6
|
import { httpCallBack2HonoMid, sendResponse } from "@modern-js/server-core/node";
|
|
7
7
|
import { run } from "./context";
|
|
@@ -16,18 +16,18 @@ const findAppModule = async (apiDir) => {
|
|
|
16
16
|
if (await fs.pathExists(filename)) {
|
|
17
17
|
delete require.cache[filename];
|
|
18
18
|
return [
|
|
19
|
-
|
|
19
|
+
await compatibleRequire(filename),
|
|
20
20
|
require(filename)
|
|
21
21
|
];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
return [];
|
|
25
25
|
};
|
|
26
|
-
const initMiddlewares = (middleware, app) => {
|
|
27
|
-
|
|
28
|
-
const middlewareFunc = typeof middlewareItem === "string" ?
|
|
26
|
+
const initMiddlewares = async (middleware, app) => {
|
|
27
|
+
for (const middlewareItem of middleware) {
|
|
28
|
+
const middlewareFunc = typeof middlewareItem === "string" ? await compatibleRequire(middlewareItem) : middlewareItem;
|
|
29
29
|
app.use(middlewareFunc);
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
};
|
|
32
32
|
const useRun = (app) => {
|
|
33
33
|
app.use((req, res, next) => {
|
|
@@ -48,7 +48,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
48
48
|
}
|
|
49
49
|
initApp(app);
|
|
50
50
|
if (middlewares && middlewares.length > 0) {
|
|
51
|
-
initMiddlewares(middlewares, app);
|
|
51
|
+
await initMiddlewares(middlewares, app);
|
|
52
52
|
}
|
|
53
53
|
useRun(app);
|
|
54
54
|
registerRoutes(app, apiHandlerInfos);
|
|
@@ -62,7 +62,7 @@ const createApp = async ({ apiDir, middlewares, mode, apiHandlerInfos, render })
|
|
|
62
62
|
app = express();
|
|
63
63
|
initApp(app);
|
|
64
64
|
if (middlewares && middlewares.length > 0) {
|
|
65
|
-
initMiddlewares(middlewares, app);
|
|
65
|
+
await initMiddlewares(middlewares, app);
|
|
66
66
|
}
|
|
67
67
|
useRun(app);
|
|
68
68
|
registerRoutes(app, apiHandlerInfos);
|
package/dist/types/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Operator } from '@modern-js/bff-core';
|
|
2
|
-
import { NextFunction } from '@modern-js/types';
|
|
1
|
+
import type { Operator } from '@modern-js/bff-core';
|
|
2
|
+
import type { NextFunction } from '@modern-js/types';
|
|
3
3
|
import type { Request, Response } from 'express';
|
|
4
4
|
export type EndFunction = ((func: (res: Response) => void) => void) & ((data: unknown) => void);
|
|
5
5
|
type MaybeAsync<T> = T | Promise<T>;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { HttpMethod } from '@modern-js/bff-core';
|
|
2
|
+
import { type HttpMethod } from '@modern-js/bff-core';
|
|
3
3
|
import type { APIHandlerInfo } from '@modern-js/bff-core';
|
|
4
4
|
import type { Request, Response, NextFunction } from 'express';
|
|
5
5
|
type Handler = APIHandlerInfo['handler'];
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.
|
|
18
|
+
"version": "2.58.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
"./types": "./types.d.ts",
|
|
25
25
|
".": {
|
|
26
|
+
"types": "./dist/types/cli/index.d.ts",
|
|
26
27
|
"jsnext:source": "./src/cli/index.ts",
|
|
27
28
|
"default": "./dist/cjs/cli/index.js"
|
|
28
29
|
},
|
|
@@ -39,21 +40,22 @@
|
|
|
39
40
|
"default": "./dist/esm/index.js"
|
|
40
41
|
},
|
|
41
42
|
"./runtime": {
|
|
43
|
+
"types": "./dist/types/runtime/index.d.ts",
|
|
42
44
|
"default": "./dist/cjs/runtime/index.js"
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
"dependencies": {
|
|
48
|
+
"@swc/helpers": "0.5.3",
|
|
46
49
|
"cookie-parser": "^1.4.5",
|
|
47
50
|
"finalhandler": "^1.1.2",
|
|
48
51
|
"formidable": "^1.2.2",
|
|
49
52
|
"reflect-metadata": "^0.1.13",
|
|
50
53
|
"type-is": "^1.6.18",
|
|
51
|
-
"@
|
|
52
|
-
"@modern-js/
|
|
53
|
-
"@modern-js/
|
|
54
|
-
"@modern-js/
|
|
55
|
-
"@modern-js/types": "2.58.
|
|
56
|
-
"@modern-js/server-core": "2.58.0"
|
|
54
|
+
"@modern-js/bff-core": "2.58.2",
|
|
55
|
+
"@modern-js/server-core": "2.58.2",
|
|
56
|
+
"@modern-js/utils": "2.58.2",
|
|
57
|
+
"@modern-js/bff-runtime": "2.58.2",
|
|
58
|
+
"@modern-js/types": "2.58.2"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
61
|
"@types/cookie-parser": "^1.4.2",
|
|
@@ -69,10 +71,10 @@
|
|
|
69
71
|
"supertest": "^6.1.6",
|
|
70
72
|
"typescript": "^5",
|
|
71
73
|
"zod": "^3.22.3",
|
|
72
|
-
"@modern-js/
|
|
73
|
-
"@
|
|
74
|
-
"@scripts/
|
|
75
|
-
"@
|
|
74
|
+
"@modern-js/app-tools": "2.58.2",
|
|
75
|
+
"@modern-js/core": "2.58.2",
|
|
76
|
+
"@scripts/jest-config": "2.58.2",
|
|
77
|
+
"@scripts/build": "2.58.2"
|
|
76
78
|
},
|
|
77
79
|
"peerDependencies": {
|
|
78
80
|
"express": "^4.17.1"
|
package/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="./dist/types/index.d.ts" />
|
|
2
2
|
|
|
3
3
|
declare module '@modern-js/runtime/express' {
|
|
4
|
-
import { Request, Response, RequestHandler } from 'express';
|
|
4
|
+
import type { Request, Response, RequestHandler } from 'express';
|
|
5
5
|
|
|
6
6
|
type Context = { req: Request; res: Response };
|
|
7
7
|
|
|
@@ -15,13 +15,16 @@ declare module '@modern-js/runtime/express' {
|
|
|
15
15
|
export * from '@modern-js/bff-core';
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
// Todo: remove on next version
|
|
20
19
|
// For use with BFF, it will be removed on next version, and use @modern-js/runtime/express instead?
|
|
21
20
|
declare module '@modern-js/runtime/server' {
|
|
22
|
-
import { Request, Response, RequestHandler } from 'express';
|
|
21
|
+
import type { Request, Response, RequestHandler } from 'express';
|
|
23
22
|
|
|
24
|
-
import type {
|
|
23
|
+
import type {
|
|
24
|
+
AfterMatchContext,
|
|
25
|
+
AfterRenderContext,
|
|
26
|
+
NextFunction,
|
|
27
|
+
} from '@modern-js/types';
|
|
25
28
|
|
|
26
29
|
export type AfterRenderHook = (
|
|
27
30
|
context: AfterRenderContext,
|