@modern-js/main-doc 0.0.0-next-1685297213448 → 0.0.0-next-1685369216913

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,6 +1,6 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-1685297213448
3
+ ## 0.0.0-next-1685369216913
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -10,7 +10,8 @@
10
10
 
11
11
  ### Patch Changes
12
12
 
13
- - @modern-js/builder-doc@0.0.0-next-1685297213448
13
+ - Updated dependencies [850cde667]
14
+ - @modern-js/builder-doc@0.0.0-next-1685369216913
14
15
 
15
16
  ## 2.21.1
16
17
 
@@ -28,6 +28,7 @@ type RuntimeContext = {
28
28
  cookie: string;
29
29
  };
30
30
  store: ReduckStore;
31
+ router: RemixRouter;
31
32
  };
32
33
 
33
34
  function useRuntimeContext(): RuntimeContext;
@@ -41,7 +42,10 @@ function useRuntimeContext(): RuntimeContext;
41
42
  - `query`: the query of the request.
42
43
  - `headers`: the header info of the request.
43
44
  - `cookie`: the cookie of the request.
44
- - `store`: when the runtime.state is enabled, this value is the reduck global `store`.
45
+ - `store`: when the `runtime.state` is enabled, this value is the Reduck global `store`.
46
+ - `router`: When the `runtime.router` is enabled, this value exists.
47
+ - `location`: The current location reflected by the router. The same as [`useLocation`] the return value of (/apis/app/runtime/router/router.html#uselocation).
48
+ - `navigate`: Navigate to the given path. The same as the return value of [`useNavigate`](/apis/app/runtime/router/router.html#usenavigate).
45
49
 
46
50
  ## Example
47
51
 
@@ -32,7 +32,7 @@ export default {
32
32
  /* the default method is GET */
33
33
  '/api/getExample': { id: 1 },
34
34
 
35
- /* You can use custom functions to dynamically return data */
35
+ /* You can use custom functions to dynamically return data, req and res are both Node.js HTTP objects. */
36
36
  'POST /api/addInfo': (req, res, next) => {
37
37
  res.setHeader('Access-Control-Allow-Origin', '*');
38
38
  res.end('200');
@@ -28,6 +28,7 @@ type RuntimeContext = {
28
28
  cookie: string;
29
29
  };
30
30
  store: ReduckStore;
31
+ router: RemixRouter;
31
32
  };
32
33
 
33
34
  function useRuntimeContext(): RuntimeContext;
@@ -41,7 +42,10 @@ function useRuntimeContext(): RuntimeContext;
41
42
  - `query`:请求的查询字符串对象。
42
43
  - `headers`:请求头信息。
43
44
  - `cookie`:请求的 cookie 信息。
44
- - `store`:在开启了 state 插件的时候,该值为 reduck 全局 `store`。
45
+ - `store`:在开启了 state 插件的时候,该值为 Reduck 全局 `store`。
46
+ - `router`:在开启 router 插件的时候存在。
47
+ - `location`:当前路由对应的位置信息。同 [`useLocation`](/apis/app/runtime/router/router.html#uselocation) 返回值。
48
+ - `navigate`:导航到给定路径。同 [`useNavigate`](/apis/app/runtime/router/router.html#usenavigate) 返回值。
45
49
 
46
50
  ## 示例
47
51
 
@@ -32,7 +32,7 @@ export default {
32
32
  /* method 默认为 GET */
33
33
  '/api/getExample': { id: 1 },
34
34
 
35
- /* 可以使用自定义函数根据请求动态返回数据,返回值参考 express middleware */
35
+ /* 可以使用自定义函数根据请求动态返回数据, req & res 都是 Node.js HTTP 原生对象 */
36
36
  'POST /api/addInfo': (req, res, next) => {
37
37
  res.setHeader('Access-Control-Allow-Origin', '*');
38
38
  res.end('200');
package/package.json CHANGED
@@ -15,13 +15,13 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-1685297213448",
18
+ "version": "0.0.0-next-1685369216913",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
22
22
  },
23
23
  "peerDependencies": {
24
- "@modern-js/builder-doc": "0.0.0-next-1685297213448"
24
+ "@modern-js/builder-doc": "0.0.0-next-1685369216913"
25
25
  },
26
26
  "devDependencies": {
27
27
  "classnames": "^2",
@@ -33,9 +33,9 @@
33
33
  "fs-extra": "^10",
34
34
  "@types/node": "^16",
35
35
  "@types/fs-extra": "^9",
36
- "@modern-js/builder-doc": "0.0.0-next-1685297213448",
37
- "@modern-js/doc-tools": "0.0.0-next-1685297213448",
38
- "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1685297213448"
36
+ "@modern-js/builder-doc": "0.0.0-next-1685369216913",
37
+ "@modern-js/doc-tools": "0.0.0-next-1685369216913",
38
+ "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1685369216913"
39
39
  },
40
40
  "scripts": {
41
41
  "dev": "modern dev",