@modern-js/main-doc 2.0.0-beta.6 → 2.0.0-beta.7

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.
Files changed (76) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/index_.md +1 -1
  3. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/pages.md +1 -1
  4. package/en/docusaurus-plugin-content-docs/current/apis/app/hooks/src/routes.md +86 -0
  5. package/en/docusaurus-plugin-content-docs/current/apis/app/runtime/router/router.md +176 -373
  6. package/en/docusaurus-plugin-content-docs/current/components/enable-bff.md +36 -0
  7. package/en/docusaurus-plugin-content-docs/current/components/global-proxy-config.md +74 -0
  8. package/en/docusaurus-plugin-content-docs/current/components/global-proxy.md +28 -0
  9. package/en/docusaurus-plugin-content-docs/current/components/router-legacy-tip.md +1 -0
  10. package/en/docusaurus-plugin-content-docs/current/configure/app/auto-load-plugin.md +62 -0
  11. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/proxy.md +2 -72
  12. package/en/docusaurus-plugin-content-docs/current/configure/app/runtime/router.md +17 -2
  13. package/en/docusaurus-plugin-content-docs/current/configure/app/source/entries.md +0 -2
  14. package/en/docusaurus-plugin-content-docs/current/configure/app/tools/tailwindcss.md +16 -22
  15. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/_category_.json +8 -0
  16. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/bff-proxy.md +27 -0
  17. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/frameworks.md +150 -0
  18. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/function.md +222 -0
  19. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/index.md +20 -0
  20. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/bff/type.md +43 -0
  21. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/code-split.md +77 -0
  22. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/compatibility.md +76 -0
  23. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/eslint.md +145 -0
  24. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/index.md +12 -0
  25. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/low-level.md +46 -0
  26. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssg.md +132 -0
  27. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/ssr.md +306 -0
  28. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/testing.md +46 -0
  29. package/en/docusaurus-plugin-content-docs/current/guides/advanced-features/web-server.md +57 -0
  30. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/alias.md +67 -0
  31. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/css/tailwindcss.md +30 -35
  32. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/data-fetch.md +400 -0
  33. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/env-vars.md +166 -0
  34. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/html.md +235 -0
  35. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/mock.md +78 -0
  36. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/proxy.md +60 -0
  37. package/en/docusaurus-plugin-content-docs/current/guides/basic-features/routes.md +0 -2
  38. package/en/docusaurus-plugin-content-docs/current/guides/get-started/quick-start.md +2 -4
  39. package/package.json +3 -3
  40. package/zh/apis/app/hooks/src/index_.md +1 -1
  41. package/zh/apis/app/hooks/src/pages.md +1 -1
  42. package/zh/apis/app/hooks/src/routes.md +89 -0
  43. package/zh/apis/app/runtime/router/router.md +170 -368
  44. package/zh/components/debug-app.md +1 -2
  45. package/zh/components/enable-bff.md +36 -0
  46. package/zh/components/global-proxy-config.md +70 -0
  47. package/zh/components/micro-master-manifest-config.md +15 -0
  48. package/zh/components/router-legacy-tip.md +1 -0
  49. package/zh/configure/app/auto-load-plugin.md +62 -0
  50. package/zh/configure/app/deploy/microFrontend.md +0 -10
  51. package/zh/configure/app/dev/proxy.md +2 -70
  52. package/zh/configure/app/runtime/master-app.md +2 -16
  53. package/zh/configure/app/runtime/router.md +17 -3
  54. package/zh/configure/app/source/entries.md +1 -3
  55. package/zh/configure/app/tools/_category_.json +1 -1
  56. package/zh/configure/app/tools/tailwindcss.md +16 -23
  57. package/zh/guides/advanced-features/bff/frameworks.md +2 -0
  58. package/zh/guides/advanced-features/bff/function.md +44 -24
  59. package/zh/guides/advanced-features/code-split.md +28 -20
  60. package/zh/guides/advanced-features/compatibility.md +24 -14
  61. package/zh/guides/advanced-features/ssg.md +5 -47
  62. package/zh/guides/advanced-features/ssr.md +1 -1
  63. package/zh/guides/advanced-features/testing.md +2 -2
  64. package/zh/guides/basic-features/alias.md +5 -5
  65. package/zh/guides/basic-features/css/tailwindcss.md +31 -35
  66. package/zh/guides/basic-features/data-fetch.md +7 -6
  67. package/zh/guides/basic-features/env-vars.md +2 -2
  68. package/zh/guides/basic-features/html.md +62 -137
  69. package/zh/guides/basic-features/mock.md +8 -9
  70. package/zh/guides/basic-features/proxy.md +2 -2
  71. package/zh/guides/basic-features/routes.md +37 -6
  72. package/zh/guides/get-started/quick-start.md +1 -2
  73. package/zh/guides/topic-detail/framework-plugin/implement.md +54 -6
  74. package/zh/guides/topic-detail/micro-frontend/c02-development.md +1 -1
  75. package/en/docusaurus-plugin-content-docs/current/configure/app/dev/with-master-app.md +0 -31
  76. package/zh/configure/app/dev/with-master-app.md +0 -32
@@ -1,4 +1,4 @@
1
1
 
2
- > @modern-js/main-doc@2.0.0-beta.6 build /github/workspace/packages/toolkit/main-doc
2
+ > @modern-js/main-doc@2.0.0-beta.7 build /github/workspace/packages/toolkit/main-doc
3
3
  > npx ts-node ./scripts/sync.ts
4
4
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: index.[tj]s
3
- sidebar_position: 3
3
+ sidebar_position: 4
4
4
  ---
5
5
 
6
6
  Entry identifier if App want use custom entry. In most case, [`App.[tj]sx`](/docs/apis/app/hooks/src/app) hook file can already meet our needs.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: pages/
3
- sidebar_position: 2
3
+ sidebar_position: 3
4
4
  ---
5
5
 
6
6
  Entry identifier if the application want uses file system-based routing.
@@ -0,0 +1,86 @@
1
+ ---
2
+ title: routes/
3
+ sidebar_position: 2
4
+ ---
5
+
6
+ The entry identifier when the application uses file system-based routing.
7
+
8
+ When the project structure is of type `Routes directory entry`, the files in the `src/routes` directory are parsed to get the client-side routing configuration. See [Routing by convention](/docs/guides/basic-features/routes) for more details on usage.
9
+
10
+
11
+ Any `layout.[tj]sx` and `page.[tj]sx` under `src/routes` will be used as a route to the application:
12
+ ```bash {3}
13
+ .
14
+ └── routes
15
+ ├── layout.tsx
16
+ ├── page.tsx
17
+ └── user
18
+ ├── layout.tsx
19
+ └── page.tsx
20
+ ```
21
+
22
+ ## basic example
23
+
24
+ The directory names in the `routes` directory will be used as a mapping of the route url, where `layout.tsx` is used as the layout component and `page.tsx` as the content component, which is a leaf node of the whole route, for example the following directory structure:
25
+
26
+ ```bash
27
+ .
28
+ └── routes
29
+ ├── page.tsx
30
+ └── user
31
+ └── page.tsx
32
+ ```
33
+
34
+ The following two routes are produced:
35
+ - `/`
36
+ - `/user`
37
+
38
+ ## Dynamic Route
39
+
40
+ If the directory name of the route file is named with `[]`, the generated route will be used as a dynamic route. For example, the following file directories:
41
+
42
+ ```
43
+ └── routes
44
+ ├── [id]
45
+ │   └── page.tsx
46
+ ├── blog
47
+ │   └── page.tsx
48
+ └── page.tsx
49
+ ```
50
+
51
+ The `routes/[id]/page.tsx` file will be converted to a `/:id` route. All `/xxx` will match that route, except for the `/blog` route, which can be matched exactly.
52
+
53
+ In the component, you can get the corresponding parameters by [useParams](/docs/apis/app/runtime/router/#useparams).
54
+
55
+ In the loader, params will be used as input to [loader](/docs/guides/basic-features/data-fetch#loader-function), and the corresponding parameters can be retrieved through the property `params`.
56
+
57
+ ## Layout component
58
+
59
+ As in the example below, you can add a common layout component for all routing components by adding `layout.tsx`
60
+
61
+ ```bash
62
+ .
63
+ └── routes
64
+ ├── layout.tsx
65
+ ├── page.tsx
66
+ └── user
67
+ ├── layout.tsx
68
+ └── page.tsx
69
+ ```
70
+
71
+ You can represent child components in layout components by using `<Outlet>`:
72
+ ```tsx title=routes/layout.tsx
73
+ import { Link, Outlet, useLoaderData } from '@modern-js/runtime/router';
74
+
75
+ export default () => {
76
+ return (
77
+ <>
78
+ <Outlet></Outlet>
79
+ </>
80
+ )
81
+ }
82
+ ```
83
+
84
+ :::note
85
+ `<Outlet>` is a new API in React Router 6, see [Outlet] for details(https://reactrouter.com/en/main/components/outlet#outlet).
86
+ :::