@modern-js/plugin-koa 1.5.1 → 1.5.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/CHANGELOG.md +14 -0
- package/dist/js/modern/utils.js +8 -4
- package/dist/js/node/utils.js +8 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @modern-js/plugin-koa
|
|
2
2
|
|
|
3
|
+
## 1.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f745969: fix: allow BFF function to return void
|
|
8
|
+
fix: 允许 BFF 函数返回 void
|
|
9
|
+
- Updated dependencies [aadd066]
|
|
10
|
+
- Updated dependencies [4fc801f]
|
|
11
|
+
- Updated dependencies [83660b6]
|
|
12
|
+
- Updated dependencies [c8614b8]
|
|
13
|
+
- @modern-js/bff-core@1.2.0
|
|
14
|
+
- @modern-js/utils@1.8.0
|
|
15
|
+
- @modern-js/bff-runtime@1.4.0
|
|
16
|
+
|
|
3
17
|
## 1.5.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/js/modern/utils.js
CHANGED
|
@@ -50,10 +50,10 @@ export const createRouteHandler = handler => {
|
|
|
50
50
|
if (isWithMetaHandler(handler)) {
|
|
51
51
|
try {
|
|
52
52
|
handleResponseMeta(ctx, handler);
|
|
53
|
-
const
|
|
53
|
+
const body = await handler(input);
|
|
54
54
|
|
|
55
|
-
if (
|
|
56
|
-
ctx.body =
|
|
55
|
+
if (typeof body !== 'undefined') {
|
|
56
|
+
ctx.body = body;
|
|
57
57
|
}
|
|
58
58
|
} catch (error) {
|
|
59
59
|
if (error instanceof Error) {
|
|
@@ -85,7 +85,11 @@ export const createRouteHandler = handler => {
|
|
|
85
85
|
}
|
|
86
86
|
} else {
|
|
87
87
|
const args = Object.values(input.params).concat(input);
|
|
88
|
-
|
|
88
|
+
const body = await handler(...args);
|
|
89
|
+
|
|
90
|
+
if (typeof body !== 'undefined') {
|
|
91
|
+
ctx.body = body;
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
};
|
|
91
95
|
|
package/dist/js/node/utils.js
CHANGED
|
@@ -61,10 +61,10 @@ const createRouteHandler = handler => {
|
|
|
61
61
|
if ((0, _bffCore.isWithMetaHandler)(handler)) {
|
|
62
62
|
try {
|
|
63
63
|
handleResponseMeta(ctx, handler);
|
|
64
|
-
const
|
|
64
|
+
const body = await handler(input);
|
|
65
65
|
|
|
66
|
-
if (
|
|
67
|
-
ctx.body =
|
|
66
|
+
if (typeof body !== 'undefined') {
|
|
67
|
+
ctx.body = body;
|
|
68
68
|
}
|
|
69
69
|
} catch (error) {
|
|
70
70
|
if (error instanceof Error) {
|
|
@@ -96,7 +96,11 @@ const createRouteHandler = handler => {
|
|
|
96
96
|
}
|
|
97
97
|
} else {
|
|
98
98
|
const args = Object.values(input.params).concat(input);
|
|
99
|
-
|
|
99
|
+
const body = await handler(...args);
|
|
100
|
+
|
|
101
|
+
if (typeof body !== 'undefined') {
|
|
102
|
+
ctx.body = body;
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
};
|
|
102
106
|
|
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.2",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.18.0",
|
|
37
37
|
"@modern-js/adapter-helpers": "^1.3.0",
|
|
38
|
-
"@modern-js/bff-core": "^1.
|
|
39
|
-
"@modern-js/bff-runtime": "^1.
|
|
40
|
-
"@modern-js/utils": "^1.
|
|
38
|
+
"@modern-js/bff-core": "^1.2.0",
|
|
39
|
+
"@modern-js/bff-runtime": "^1.4.0",
|
|
40
|
+
"@modern-js/utils": "^1.8.0",
|
|
41
41
|
"koa-body": "^4.2.0",
|
|
42
42
|
"koa-router": "^10.0.0",
|
|
43
43
|
"type-is": "^1.6.18"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@modern-js/core": "1.13.
|
|
46
|
+
"@modern-js/core": "1.13.1",
|
|
47
47
|
"@modern-js/server-core": "1.4.1",
|
|
48
48
|
"@scripts/build": "0.0.0",
|
|
49
49
|
"@scripts/jest-config": "0.0.0",
|