@modern-js/main-doc 2.56.1 → 2.57.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
title: Hook
|
3
3
|
---
|
4
|
+
|
4
5
|
# Hook
|
5
6
|
|
6
7
|
Used to extend Modern.js built-in Web Server, all page requests are handled by these hooks.
|
@@ -37,6 +38,7 @@ type HookContext = {
|
|
37
38
|
response: {
|
38
39
|
set: (key: string, value: string) => void;
|
39
40
|
status: (code: number) => void;
|
41
|
+
getStatus: () => number;
|
40
42
|
cookies: {
|
41
43
|
set: (key: string, value: string, options?: any) => void;
|
42
44
|
clear: () => void;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
title: Hook
|
3
3
|
---
|
4
|
+
|
4
5
|
# Hook
|
5
6
|
|
6
7
|
用于拓展 Modern.js 内置的 Web Server,所有的页面请求都会经过 Hook。
|
@@ -26,6 +27,7 @@ pnpm run new
|
|
26
27
|
? 请选择你想要的操作 创建工程元素
|
27
28
|
? 新建「自定义 Web Server」源码目录
|
28
29
|
```
|
30
|
+
|
29
31
|
:::
|
30
32
|
|
31
33
|
## 函数签名
|
@@ -35,6 +37,7 @@ type HookContext = {
|
|
35
37
|
response: {
|
36
38
|
set: (key: string, value: string) => void;
|
37
39
|
status: (code: number) => void;
|
40
|
+
getStatus: () => number;
|
38
41
|
cookies: {
|
39
42
|
set: (key: string, value: string, options?: any) => void;
|
40
43
|
clear: () => void;
|
package/package.json
CHANGED
@@ -15,17 +15,17 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.57.0",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@modern-js/sandpack-react": "2.
|
25
|
+
"@modern-js/sandpack-react": "2.57.0"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
|
-
"@modern-js/builder-doc": "^2.
|
28
|
+
"@modern-js/builder-doc": "^2.57.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"classnames": "^2",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"@rspress/shared": "1.26.1",
|
40
40
|
"@types/node": "^16",
|
41
41
|
"@types/fs-extra": "9.0.13",
|
42
|
-
"@modern-js/builder-doc": "2.
|
43
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.
|
42
|
+
"@modern-js/builder-doc": "2.57.0",
|
43
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.57.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"dev": "rspress dev",
|