@bleedingdev/modern-js-main-doc 3.5.0-ultramodern.22 → 3.5.0-ultramodern.24
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/docs/en/apis/app/hooks/src/routes.mdx +1 -1
- package/docs/en/apis/app/runtime/router/router.mdx +1 -1
- package/docs/en/guides/basic-features/routes/routes.mdx +2 -2
- package/docs/en/guides/concept/entries.mdx +1 -1
- package/docs/en/guides/get-started/tech-stack.mdx +1 -1
- package/docs/en/guides/get-started/ultramodern.mdx +1 -1
- package/docs/en/tutorials/examples/csr-auth.mdx +1 -1
- package/docs/zh/apis/app/hooks/src/routes.mdx +1 -1
- package/docs/zh/guides/basic-features/routes/routes.mdx +2 -2
- package/docs/zh/guides/concept/entries.mdx +1 -1
- package/docs/zh/guides/get-started/tech-stack.mdx +1 -1
- package/docs/zh/guides/get-started/ultramodern.mdx +1 -1
- package/docs/zh/tutorials/examples/csr-auth.mdx +1 -1
- package/package.json +2 -2
|
@@ -85,6 +85,6 @@ export default () => {
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
:::note
|
|
88
|
-
`<Outlet>` is
|
|
88
|
+
`<Outlet>` is an API provided by React Router. For details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
|
|
89
89
|
|
|
90
90
|
:::
|
|
@@ -6,7 +6,7 @@ sidebar_position: 1
|
|
|
6
6
|
# router
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
The router solution based on [react-router
|
|
9
|
+
The router solution based on [react-router](https://reactrouter.com/).
|
|
10
10
|
|
|
11
11
|
This page documents the React Router runtime export (`@modern-js/runtime/router`).
|
|
12
12
|
If your app uses TanStack Router (`--router tanstack`), use `@modern-js/plugin-tanstack/runtime` and refer to TanStack Router API docs.
|
|
@@ -4,7 +4,7 @@ sidebar_position: 2
|
|
|
4
4
|
|
|
5
5
|
# Routing
|
|
6
6
|
|
|
7
|
-
Modern.js supports conventional routing on top of both [React Router
|
|
7
|
+
Modern.js supports conventional routing on top of both [React Router](https://reactrouter.com/en/main) and [TanStack Router](https://tanstack.com/router), offering file convention-based routing capabilities and supporting the industry-popular **nested routing** pattern. When an entry is recognized as [conventional routing](/guides/concept/entries.html#conventional-routing), Modern.js automatically generates the corresponding routing structure based on the file system.
|
|
8
8
|
|
|
9
9
|
:::note
|
|
10
10
|
|
|
@@ -93,7 +93,7 @@ export default () => {
|
|
|
93
93
|
|
|
94
94
|
:::note
|
|
95
95
|
|
|
96
|
-
`<Outlet>` is an API provided by React Router
|
|
96
|
+
`<Outlet>` is an API provided by React Router. For more details, see [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
|
|
97
97
|
|
|
98
98
|
:::
|
|
99
99
|
|
|
@@ -156,7 +156,7 @@ If there is an `App.tsx?` file in the entry, this entry is a self-controlled rou
|
|
|
156
156
|
│ └── App.tsx
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
For the entry defined as `src/App.tsx`, Modern.js does not perform additional routing operations. Developers can use the [React Router
|
|
159
|
+
For the entry defined as `src/App.tsx`, Modern.js does not perform additional routing operations. Developers can use the [React Router](https://reactrouter.com/en/main) API to set up client-side routes, or not set up client-side routes. For example, the following code sets up client-side routes in the application:
|
|
160
160
|
|
|
161
161
|
```tsx title="src/App.tsx"
|
|
162
162
|
import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
|
|
@@ -19,7 +19,7 @@ Rsbuild supports building Vue applications. If you need to use Vue, you can refe
|
|
|
19
19
|
Modern.js provides two first-party routing frameworks:
|
|
20
20
|
|
|
21
21
|
- [TanStack Router](https://tanstack.com/router) (UltraModern default), via `@modern-js/plugin-tanstack/runtime`.
|
|
22
|
-
- [React Router
|
|
22
|
+
- [React Router](https://reactrouter.com/en/main), via `@modern-js/runtime/router`.
|
|
23
23
|
|
|
24
24
|
When creating an UltraModern project, TanStack Router is included by default:
|
|
25
25
|
|
|
@@ -403,7 +403,7 @@ Cloudflare and Zephyr proof:
|
|
|
403
403
|
ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
|
|
404
404
|
ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
|
|
405
405
|
ULTRAMODERN_PUBLIC_URL_PAYMENTS=https://payments.example.workers.dev \
|
|
406
|
-
mise exec -- pnpm cloudflare:proof --
|
|
406
|
+
mise exec -- pnpm cloudflare:proof --require-public-urls
|
|
407
407
|
```
|
|
408
408
|
|
|
409
409
|
Live Cloudflare and Zephyr proof requires public Worker URLs and Zephyr credentials. Without those, the repo can validate generated contracts, local builds, local Cloudflare output, dry-run Zephyr evidence plans, and local evidence schemas, but it cannot prove shell-driven live version selection.
|
|
@@ -4,7 +4,7 @@ title: Route Authorization
|
|
|
4
4
|
|
|
5
5
|
# Route Authorization
|
|
6
6
|
|
|
7
|
-
Modern.js defaults to the convention-based routing based on React Router
|
|
7
|
+
Modern.js defaults to the convention-based routing based on React Router. For more details, please refer to [Routing](/guides/basic-features/routes/routes#routing).
|
|
8
8
|
|
|
9
9
|
In a web application, if there are multiple routes, we may need to authorize access to some of them before accessing them. For example, in the following scenario:
|
|
10
10
|
|
|
@@ -85,6 +85,6 @@ export default () => {
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
:::note
|
|
88
|
-
`<Outlet>` 是 React Router
|
|
88
|
+
`<Outlet>` 是 React Router 提供的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet).
|
|
89
89
|
|
|
90
90
|
:::
|
|
@@ -4,7 +4,7 @@ sidebar_position: 2
|
|
|
4
4
|
|
|
5
5
|
# 路由基础
|
|
6
6
|
|
|
7
|
-
Modern.js 的约定式路由支持基于 [React Router
|
|
7
|
+
Modern.js 的约定式路由支持基于 [React Router](https://reactrouter.com/en/main) 和 [TanStack Router](https://tanstack.com/router) 两套框架,提供基于文件约定的路由能力,并支持业界流行的约定式路由模式:**嵌套路由**。当入口被识别为 [约定式路由](/guides/concept/entries.html#约定式路由) 时,Modern.js 会自动基于文件系统,生成对应的路由结构。
|
|
8
8
|
|
|
9
9
|
:::note
|
|
10
10
|
|
|
@@ -91,7 +91,7 @@ export default () => {
|
|
|
91
91
|
|
|
92
92
|
:::note
|
|
93
93
|
|
|
94
|
-
`<Outlet>` 是 React Router
|
|
94
|
+
`<Outlet>` 是 React Router 提供的 API,详情可以查看 [Outlet](https://reactrouter.com/en/main/components/outlet#outlet)。
|
|
95
95
|
|
|
96
96
|
:::
|
|
97
97
|
|
|
@@ -156,7 +156,7 @@ src/
|
|
|
156
156
|
│ └── App.tsx
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
以 `src/App.tsx` 为约定的入口,Modern.js 不会对路由做额外的操作,开发者可以使用 [React Router
|
|
159
|
+
以 `src/App.tsx` 为约定的入口,Modern.js 不会对路由做额外的操作,开发者可以使用 [React Router](https://reactrouter.com/en/main) 的 API 设置客户端路由,或不设置客户端路由。例如以下代码,在应用中自行设置了客户端路由:
|
|
160
160
|
|
|
161
161
|
```tsx title="src/App.tsx"
|
|
162
162
|
import { BrowserRouter, Route, Routes } from '@modern-js/runtime/router';
|
|
@@ -19,7 +19,7 @@ Modern.js 底层的 Rsbuild 支持构建 Vue 应用,如果你需要使用 Vue
|
|
|
19
19
|
Modern.js 提供两套一方路由方案:
|
|
20
20
|
|
|
21
21
|
- 默认使用 [TanStack Router](https://tanstack.com/router),通过 `@modern-js/plugin-tanstack/runtime` 导出 API。
|
|
22
|
-
- 兼容 [React Router
|
|
22
|
+
- 兼容 [React Router](https://reactrouter.com/en/main),通过 `@modern-js/runtime/router` 导出 API。
|
|
23
23
|
|
|
24
24
|
创建 UltraModern 项目时,默认会包含 TanStack Router:
|
|
25
25
|
|
|
@@ -356,7 +356,7 @@ Zephyr 证据:
|
|
|
356
356
|
ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
|
|
357
357
|
ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
|
|
358
358
|
ULTRAMODERN_PUBLIC_URL_PAYMENTS=https://payments.example.workers.dev \
|
|
359
|
-
mise exec -- pnpm cloudflare:proof --
|
|
359
|
+
mise exec -- pnpm cloudflare:proof --require-public-urls
|
|
360
360
|
```
|
|
361
361
|
|
|
362
362
|
Live Cloudflare 与 Zephyr 证明需要公开 Worker URL 和 Zephyr 凭据。没有这些凭据时,
|
|
@@ -4,7 +4,7 @@ title: 路由鉴权
|
|
|
4
4
|
|
|
5
5
|
# 路由鉴权
|
|
6
6
|
|
|
7
|
-
Modern.js 默认提供的路由方式是基于 React Router
|
|
7
|
+
Modern.js 默认提供的路由方式是基于 React Router 的约定式路由,具体可查看[路由方案](/guides/basic-features/routes/routes#路由方案)。
|
|
8
8
|
|
|
9
9
|
在一个 Web 应用中如果存在多个路由,我们可能需要对部分路由进行鉴权后才能访问。例如下面这个案例:
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"modern.js",
|
|
20
20
|
"ultramodern.js"
|
|
21
21
|
],
|
|
22
|
-
"version": "3.5.0-ultramodern.
|
|
22
|
+
"version": "3.5.0-ultramodern.24",
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"registry": "https://registry.npmjs.org/",
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"mermaid": "^11.16.0",
|
|
29
|
-
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.5.0-ultramodern.
|
|
29
|
+
"@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.5.0-ultramodern.24"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rsbuild/plugin-sass": "2.0.0",
|