@modern-js/plugin-express 1.5.2 → 1.5.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @modern-js/plugin-express
|
|
2
2
|
|
|
3
|
+
## 1.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 69a728375: fix: remove exports.jsnext:source after publish
|
|
8
|
+
- Updated dependencies [cd7346b0d]
|
|
9
|
+
- Updated dependencies [69a728375]
|
|
10
|
+
- @modern-js/utils@1.7.2
|
|
11
|
+
- @modern-js/bff-utils@1.2.5
|
|
12
|
+
|
|
3
13
|
## 1.5.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -23,7 +23,7 @@ const registerRoutes = app => {
|
|
|
23
23
|
method,
|
|
24
24
|
name
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
26
|
+
const wrappedHandler = async (req, res, next) => {
|
|
27
27
|
const input = await getInputFromRequest(req);
|
|
28
28
|
|
|
29
29
|
if (isSchemaHandler(handler)) {
|
|
@@ -61,11 +61,11 @@ const registerRoutes = app => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
Object.defineProperties(
|
|
64
|
+
Object.defineProperties(wrappedHandler, Object.getOwnPropertyDescriptors(handler));
|
|
65
65
|
|
|
66
66
|
if (isNormalMethod(method)) {
|
|
67
67
|
const routeName = method.toLowerCase();
|
|
68
|
-
app[routeName](path || name,
|
|
68
|
+
app[routeName](path || name, wrappedHandler);
|
|
69
69
|
} else {
|
|
70
70
|
throw new Error(`Unknown HTTP Method: ${method}`);
|
|
71
71
|
}
|
|
@@ -87,7 +87,7 @@ const getInputFromRequest = async request => {
|
|
|
87
87
|
if (typeIs(request, ['application/json'])) {
|
|
88
88
|
draft.data = request.body;
|
|
89
89
|
} else if (typeIs(request, ['multipart/form-data'])) {
|
|
90
|
-
draft.formData = await
|
|
90
|
+
draft.formData = await resolveFormData(request);
|
|
91
91
|
} else if (typeIs(request, ['application/x-www-form-urlencoded'])) {
|
|
92
92
|
draft.formUrlencoded = request.body;
|
|
93
93
|
} else {
|
|
@@ -97,7 +97,7 @@ const getInputFromRequest = async request => {
|
|
|
97
97
|
return draft;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const resolveFormData = request => {
|
|
101
101
|
const form = formidable({
|
|
102
102
|
multiples: true
|
|
103
103
|
});
|
|
@@ -38,7 +38,7 @@ const registerRoutes = app => {
|
|
|
38
38
|
method,
|
|
39
39
|
name
|
|
40
40
|
}) => {
|
|
41
|
-
const
|
|
41
|
+
const wrappedHandler = async (req, res, next) => {
|
|
42
42
|
const input = await getInputFromRequest(req);
|
|
43
43
|
|
|
44
44
|
if ((0, _bffRuntime.isSchemaHandler)(handler)) {
|
|
@@ -76,11 +76,11 @@ const registerRoutes = app => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
Object.defineProperties(
|
|
79
|
+
Object.defineProperties(wrappedHandler, Object.getOwnPropertyDescriptors(handler));
|
|
80
80
|
|
|
81
81
|
if (isNormalMethod(method)) {
|
|
82
82
|
const routeName = method.toLowerCase();
|
|
83
|
-
app[routeName](path || name,
|
|
83
|
+
app[routeName](path || name, wrappedHandler);
|
|
84
84
|
} else {
|
|
85
85
|
throw new Error(`Unknown HTTP Method: ${method}`);
|
|
86
86
|
}
|
|
@@ -103,7 +103,7 @@ const getInputFromRequest = async request => {
|
|
|
103
103
|
if ((0, _typeIs.default)(request, ['application/json'])) {
|
|
104
104
|
draft.data = request.body;
|
|
105
105
|
} else if ((0, _typeIs.default)(request, ['multipart/form-data'])) {
|
|
106
|
-
draft.formData = await
|
|
106
|
+
draft.formData = await resolveFormData(request);
|
|
107
107
|
} else if ((0, _typeIs.default)(request, ['application/x-www-form-urlencoded'])) {
|
|
108
108
|
draft.formUrlencoded = request.body;
|
|
109
109
|
} else {
|
|
@@ -113,7 +113,7 @@ const getInputFromRequest = async request => {
|
|
|
113
113
|
return draft;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const
|
|
116
|
+
const resolveFormData = request => {
|
|
117
117
|
const form = (0, _formidable.default)({
|
|
118
118
|
multiples: true
|
|
119
119
|
});
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.5.
|
|
14
|
+
"version": "1.5.3",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"@babel/runtime": "^7.15.3",
|
|
37
37
|
"@modern-js/adapter-helpers": "^1.2.3",
|
|
38
38
|
"@modern-js/bff-runtime": "^1.2.2",
|
|
39
|
-
"@modern-js/bff-utils": "^1.2.
|
|
40
|
-
"@modern-js/types": "^1.5.
|
|
41
|
-
"@modern-js/utils": "^1.
|
|
39
|
+
"@modern-js/bff-utils": "^1.2.5",
|
|
40
|
+
"@modern-js/types": "^1.5.2",
|
|
41
|
+
"@modern-js/utils": "^1.7.2",
|
|
42
42
|
"cookie-parser": "^1.4.5",
|
|
43
43
|
"finalhandler": "^1.1.2",
|
|
44
44
|
"formidable": "^1.2.2",
|
|
45
45
|
"type-is": "^1.6.18"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@modern-js/core": "1.
|
|
49
|
-
"@modern-js/server-core": "1.3.
|
|
50
|
-
"@modern-js/server-utils": "1.2.
|
|
48
|
+
"@modern-js/core": "1.10.1",
|
|
49
|
+
"@modern-js/server-core": "1.3.4",
|
|
50
|
+
"@modern-js/server-utils": "1.2.5",
|
|
51
51
|
"@scripts/build": "0.0.0",
|
|
52
52
|
"@scripts/jest-config": "0.0.0",
|
|
53
53
|
"@types/cookie-parser": "^1.4.2",
|