@modern-js/main-doc 2.63.4 → 2.63.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -135,9 +135,10 @@ Files and directories named with `[]` are turned into dynamic routes. For instan
135
135
  ```bash
136
136
  .
137
137
  └── routes
138
+ ├── [id]
139
+ │ └── page.tsx
138
140
  ├── blog
139
- │ └── [id]
140
- │ └── page.tsx
141
+ │ └── page.tsx
141
142
  └── page.tsx
142
143
  ```
143
144
 
@@ -168,7 +169,7 @@ Files and directories named with `[$]` are turned into optional dynamic routes.
168
169
  └── page.tsx
169
170
  ```
170
171
 
171
- The `routes/user/[id$]/page.tsx` file will be converted to the `/user/:id?` route. All routes under `/user` will match this route, and the `id` parameter is optional. This route can be used to distinguish between **create** and **edit** actions.
172
+ The `routes/blog/[id$]/page.tsx` file will be converted to the `/blog/:id?` route. All routes under `/blog` will match this route, and the `id` parameter is optional. This route can be used to distinguish between **create** and **edit** actions.
172
173
 
173
174
  ```tsx
174
175
  import { useParams } from '@modern-js/runtime/router';
@@ -12,28 +12,6 @@ In this chapter, all available Hooks are listed, and you can use the correspondi
12
12
 
13
13
  The following are the common CLI Hooks that can be used in both Modern.js Framework and Modern.js Module.
14
14
 
15
- ### `beforeConfig`
16
-
17
- - Functionality: Running tasks before the config process
18
- - Execution phase: Before the config process
19
- - Hook model: `AsyncWorkflow`
20
- - Type: `AsyncWorkflow<void, void>`
21
- - Example:
22
-
23
- ```ts
24
- import type { CliPlugin } from '@modern-js/core';
25
-
26
- export const myPlugin = (): CliPlugin => ({
27
- setup(api) {
28
- return {
29
- beforeConfig: () => {
30
- // do something
31
- },
32
- };
33
- },
34
- });
35
- ```
36
-
37
15
  ### `config`
38
16
 
39
17
  - Functionality: Collect configuration
@@ -27,7 +27,7 @@ title: 服务端渲染(SSR)
27
27
 
28
28
  ## 开启 SSR
29
29
 
30
- Modenr.js 启用 SSR 非常简单,只需要设置 [`server.ssr`](/configure/app/server/ssr) 为 `true` 即可:
30
+ Modern.js 启用 SSR 非常简单,只需要设置 [`server.ssr`](/configure/app/server/ssr) 为 `true` 即可:
31
31
 
32
32
  ```ts title="modern.config.ts"
33
33
  import { defineConfig } from '@modern-js/app-tools';
@@ -328,4 +328,4 @@ export default function Test() {
328
328
 
329
329
  在浏览器端,这段代码不会造成任何问题,但是在 SSR 时,Middleware 实例会一直无法被销毁。每次渲染组件,调用 `epicMiddleware.run(rootEpic)` 时,都会在内部添加新的事件绑定,导致整个对象不断变大,最终对应用性能造成影响。
330
330
 
331
- CSR 中这类问题不易被发觉,因此从 CSR 切换到 SSR 时,如果不确定应用是否存在这类隐患,可以对应用进行压测。
331
+ CSR 中这类问题不易被发觉,因此从 CSR 切换到 SSR 时,如果不确定应用是否存在这类隐患,可以对应用进行压测。
@@ -136,9 +136,10 @@ export default () => {
136
136
  ```bash
137
137
  .
138
138
  └── routes
139
+ ├── [id]
140
+ │ └── page.tsx
139
141
  ├── blog
140
-    └── [id]
141
- │   └── page.tsx
142
+ └── page.tsx
142
143
  └── page.tsx
143
144
  ```
144
145
 
@@ -169,7 +170,7 @@ export default Blog;
169
170
  └── page.tsx
170
171
  ```
171
172
 
172
- `routes/user/[id$]/page.tsx` 文件会转为 `/user/:id?` 路由。`/user` 下的所有路由都会匹配到该路由,并且 `id` 参数可选存在。通常在区分**创建**与**编辑**时,可以使用该路由。
173
+ `routes/blog/[id$]/page.tsx` 文件会转为 `/blog/:id?` 路由。`/blog` 下的所有路由都会匹配到该路由,并且 `id` 参数可选存在。通常在区分**创建**与**编辑**时,可以使用该路由。
173
174
 
174
175
  ```tsx
175
176
  import { useParams } from '@modern-js/runtime/router';
@@ -12,28 +12,6 @@ Modern.js 工程体系中包含三类插件:CLI、Runtime、Server,每一类
12
12
 
13
13
  以下是通用的 CLI Hooks,可以在 Modern.js Framework 以及 Modern.js Module 中使用。
14
14
 
15
- ### `beforeConfig`
16
-
17
- - 功能:运行收集配置前的任务
18
- - 执行阶段:收集配置前
19
- - Hook 模型:`AsyncWorkflow`
20
- - 类型:`AsyncWorkflow<void, void>`
21
- - 使用示例:
22
-
23
- ```ts
24
- import type { CliPlugin } from '@modern-js/core';
25
-
26
- export const myPlugin = (): CliPlugin => ({
27
- setup(api) {
28
- return {
29
- beforeConfig: () => {
30
- // do something
31
- },
32
- };
33
- },
34
- });
35
- ```
36
-
37
15
  ### `config`
38
16
 
39
17
  - 功能:收集配置
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.63.4",
18
+ "version": "2.63.6",
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.63.4"
25
+ "@modern-js/sandpack-react": "2.63.6"
26
26
  },
27
27
  "devDependencies": {
28
- "@rspress/shared": "1.35.4",
28
+ "@rspress/shared": "1.39.3",
29
29
  "@types/fs-extra": "9.0.13",
30
30
  "@types/node": "^16",
31
31
  "classnames": "^2",
@@ -33,7 +33,7 @@
33
33
  "fs-extra": "^10",
34
34
  "react": "^18.3.1",
35
35
  "react-dom": "^18.3.1",
36
- "rspress": "1.35.4",
36
+ "rspress": "1.39.3",
37
37
  "ts-node": "^10.9.1",
38
38
  "typescript": "^5"
39
39
  },