@modern-js/plugin-express 1.5.1 → 1.5.4
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 +45 -0
- package/dist/js/modern/plugin.js +2 -4
- package/dist/js/modern/registerRoutes.js +5 -5
- package/dist/js/node/plugin.js +2 -4
- package/dist/js/node/registerRoutes.js +5 -5
- package/package.json +34 -12
- package/.eslintrc.js +0 -7
- package/jest.config.js +0 -7
- package/modern.config.js +0 -2
- package/tsconfig.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @modern-js/plugin-express
|
|
2
2
|
|
|
3
|
+
## 1.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
|
|
8
|
+
- Updated dependencies [d32f35134]
|
|
9
|
+
- Updated dependencies [6ae4a34ae]
|
|
10
|
+
- Updated dependencies [b80229c79]
|
|
11
|
+
- Updated dependencies [948cc4436]
|
|
12
|
+
- @modern-js/adapter-helpers@1.2.4
|
|
13
|
+
- @modern-js/bff-runtime@1.2.3
|
|
14
|
+
- @modern-js/bff-utils@1.2.6
|
|
15
|
+
- @modern-js/types@1.5.3
|
|
16
|
+
- @modern-js/utils@1.7.3
|
|
17
|
+
|
|
18
|
+
## 1.5.3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 69a728375: fix: remove exports.jsnext:source after publish
|
|
23
|
+
- Updated dependencies [cd7346b0d]
|
|
24
|
+
- Updated dependencies [69a728375]
|
|
25
|
+
- @modern-js/utils@1.7.2
|
|
26
|
+
- @modern-js/bff-utils@1.2.5
|
|
27
|
+
|
|
28
|
+
## 1.5.2
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 895fa0ff: chore: using "workspace:\*" in devDependencies
|
|
33
|
+
- Updated dependencies [2d155c4c]
|
|
34
|
+
- Updated dependencies [123e432d]
|
|
35
|
+
- Updated dependencies [e5a9b26d]
|
|
36
|
+
- Updated dependencies [0b26b93b]
|
|
37
|
+
- Updated dependencies [123e432d]
|
|
38
|
+
- Updated dependencies [f9f66ef9]
|
|
39
|
+
- Updated dependencies [592edabc]
|
|
40
|
+
- Updated dependencies [895fa0ff]
|
|
41
|
+
- Updated dependencies [3d1fac2a]
|
|
42
|
+
- Updated dependencies [3578913e]
|
|
43
|
+
- Updated dependencies [1c3beab3]
|
|
44
|
+
- @modern-js/utils@1.6.0
|
|
45
|
+
- @modern-js/bff-utils@1.2.4
|
|
46
|
+
- @modern-js/types@1.5.1
|
|
47
|
+
|
|
3
48
|
## 1.5.1
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/dist/js/modern/plugin.js
CHANGED
|
@@ -74,8 +74,7 @@ export default (() => ({
|
|
|
74
74
|
middleware
|
|
75
75
|
} = config;
|
|
76
76
|
initMiddlewares(middleware, app);
|
|
77
|
-
}
|
|
78
|
-
|
|
77
|
+
}
|
|
79
78
|
|
|
80
79
|
useRun(app);
|
|
81
80
|
registerRoutes(app);
|
|
@@ -88,8 +87,7 @@ export default (() => ({
|
|
|
88
87
|
middleware
|
|
89
88
|
} = config;
|
|
90
89
|
initMiddlewares(middleware, app);
|
|
91
|
-
}
|
|
92
|
-
|
|
90
|
+
}
|
|
93
91
|
|
|
94
92
|
useRun(app);
|
|
95
93
|
registerRoutes(app);
|
|
@@ -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
|
});
|
package/dist/js/node/plugin.js
CHANGED
|
@@ -95,8 +95,7 @@ var _default = () => ({
|
|
|
95
95
|
middleware
|
|
96
96
|
} = config;
|
|
97
97
|
initMiddlewares(middleware, app);
|
|
98
|
-
}
|
|
99
|
-
|
|
98
|
+
}
|
|
100
99
|
|
|
101
100
|
useRun(app);
|
|
102
101
|
(0, _registerRoutes.default)(app);
|
|
@@ -109,8 +108,7 @@ var _default = () => ({
|
|
|
109
108
|
middleware
|
|
110
109
|
} = config;
|
|
111
110
|
initMiddlewares(middleware, app);
|
|
112
|
-
}
|
|
113
|
-
|
|
111
|
+
}
|
|
114
112
|
|
|
115
113
|
useRun(app);
|
|
116
114
|
(0, _registerRoutes.default)(app);
|
|
@@ -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.4",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.15.3",
|
|
37
|
-
"@modern-js/adapter-helpers": "^1.2.
|
|
38
|
-
"@modern-js/bff-runtime": "^1.2.
|
|
39
|
-
"@modern-js/bff-utils": "^1.2.
|
|
40
|
-
"@modern-js/types": "^1.5.
|
|
41
|
-
"@modern-js/utils": "^1.
|
|
37
|
+
"@modern-js/adapter-helpers": "^1.2.4",
|
|
38
|
+
"@modern-js/bff-runtime": "^1.2.3",
|
|
39
|
+
"@modern-js/bff-utils": "^1.2.6",
|
|
40
|
+
"@modern-js/types": "^1.5.3",
|
|
41
|
+
"@modern-js/utils": "^1.7.3",
|
|
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": "
|
|
49
|
-
"@modern-js/server-core": "
|
|
50
|
-
"@modern-js/server-utils": "
|
|
48
|
+
"@modern-js/core": "1.10.2",
|
|
49
|
+
"@modern-js/server-core": "1.3.5",
|
|
50
|
+
"@modern-js/server-utils": "1.2.6",
|
|
51
51
|
"@scripts/build": "0.0.0",
|
|
52
52
|
"@scripts/jest-config": "0.0.0",
|
|
53
53
|
"@types/cookie-parser": "^1.4.2",
|
|
54
54
|
"@types/express": "^4.17.13",
|
|
55
55
|
"@types/finalhandler": "^1.1.1",
|
|
56
56
|
"@types/formidable": "^1.2.3",
|
|
57
|
-
"@types/jest": "^27
|
|
57
|
+
"@types/jest": "^27",
|
|
58
58
|
"@types/node": "^14",
|
|
59
59
|
"@types/supertest": "^2.0.11",
|
|
60
60
|
"@types/type-is": "^1.6.3",
|
|
@@ -75,10 +75,32 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org/",
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
+
"wireit": {
|
|
79
|
+
"build": {
|
|
80
|
+
"command": "modern build",
|
|
81
|
+
"files": [
|
|
82
|
+
"src/**/*",
|
|
83
|
+
"tsconfig.json",
|
|
84
|
+
"package.json"
|
|
85
|
+
],
|
|
86
|
+
"output": [
|
|
87
|
+
"dist/**/*"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"test": {
|
|
91
|
+
"command": "jest --passWithNoTests",
|
|
92
|
+
"files": [
|
|
93
|
+
"src/**/*",
|
|
94
|
+
"tsconfig.json",
|
|
95
|
+
"package.json"
|
|
96
|
+
],
|
|
97
|
+
"output": []
|
|
98
|
+
}
|
|
99
|
+
},
|
|
78
100
|
"scripts": {
|
|
79
101
|
"new": "modern new",
|
|
80
|
-
"build": "
|
|
81
|
-
"test": "
|
|
102
|
+
"build": "wireit",
|
|
103
|
+
"test": "wireit"
|
|
82
104
|
},
|
|
83
105
|
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
84
106
|
}
|
package/.eslintrc.js
DELETED
package/jest.config.js
DELETED
package/modern.config.js
DELETED