@modern-js/main-doc 2.67.0 → 2.67.2

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.
@@ -35,8 +35,8 @@ export default createRequestHandler(handleRequest);
35
35
  Users need to customize the Server-Side Rendering entry points, they can customize the server entry in `src/entry.server.ts` or `src/{entryName}/entry.server.ts`.
36
36
 
37
37
  ```tsx title="src/entry.server.tsx"
38
- import { renderString, createRequestHandler } from '@edenx/runtime/ssr/server';
39
- import type { HandleRequest } from '@edenx/runtime/ssr/server';
38
+ import { renderString, createRequestHandler } from '@modern-js/runtime/ssr/server';
39
+ import type { HandleRequest } from '@modern-js/runtime/ssr/server';
40
40
 
41
41
  const handleRequest: HandleRequest = async (request, ServerRoot, options) => {
42
42
  // do something before rendering
@@ -5,7 +5,7 @@ title: defineConfig
5
5
 
6
6
  :::warning
7
7
 
8
- Soon to be deprecated. It is recommended to use `src/modern.runtime.ts` to define Runtime configurations, which supports both static and dynamic configurations. Please refer to the plugin [Runtime Configuration](/configure/app/runtime/0-intro.html).
8
+ Soon to be deprecated. It is recommended to use `src/modern.runtime.ts` to define Runtime configurations, which supports both static and dynamic configurations. Please refer to [Runtime Configuration](/configure/app/runtime/0-intro.html).
9
9
 
10
10
  For dynamically configuring applications runtime features.
11
11
 
@@ -1,4 +1,4 @@
1
- Before getting started, you will need to install [Node.js](https://nodejs.org/), and ensure that your Node.js version is higher than 16.2.0. **We recommend using the LTS version of Node.js 18.**
1
+ Before getting started, you will need to install [Node.js](https://nodejs.org/), and ensure that your Node.js version is higher than 18.20.8. **We recommend using the LTS version of Node.js 22.**
2
2
 
3
3
  You can check the currently used Node.js version with the following command:
4
4
 
@@ -6,21 +6,27 @@ You can check the currently used Node.js version with the following command:
6
6
  node -v
7
7
  ```
8
8
 
9
- If you do not have Node.js installed in your current environment, or the installed version is lower than 16.2.0, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install the required version.
9
+ If you do not have Node.js installed in your current environment, or the installed version is lower than 18.20.8, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install the required version.
10
10
 
11
- Here is an example of how to install the Node.js 18 LTS version via nvm:
11
+ Here is an example of how to install the Node.js 22 LTS version via nvm:
12
12
 
13
13
  ```bash
14
- # Install the long-term support version of Node.js 18
15
- nvm install 18 --lts
14
+ # Install the long-term support version of Node.js 22
15
+ nvm install 22 --lts
16
16
 
17
- # Make the newly installed Node.js 18 as the default version
18
- nvm alias default 18
17
+ # Make the newly installed Node.js 22 as the default version
18
+ nvm alias default 22
19
19
 
20
- # Switch to the newly installed Node.js 18
21
- nvm use 18
20
+ # Switch to the newly installed Node.js 22
21
+ nvm use 22
22
22
  ```
23
23
 
24
24
  :::tip nvm and fnm
25
25
  Both nvm and fnm are Node.js version management tools. Relatively speaking, nvm is more mature and stable, while fnm is implemented using Rust, which provides better performance than nvm.
26
26
  :::
27
+
28
+ Additionally, after installing nvm or fnm, when there is a `.nvmrc` file containing `lts/jod` in the repository's root directory, the system will automatically install or switch to the correct Node.js version upon entering the repository.
29
+
30
+ :::warning
31
+ Modern.js currently still supports Node 16, but will officially terminate support for Node.js 16 in June 2025. To ensure a smooth transition for your project, please complete the Node.js version upgrade before June 2025.
32
+ :::
@@ -9,7 +9,7 @@ import NodeVersion from '@site-docs-en/components/nodeVersion.mdx';
9
9
  It is recommended to use [pnpm](https://pnpm.io/installation) to manage dependencies:
10
10
 
11
11
  ```bash
12
- npm install -g pnpm@8
12
+ npm install -g pnpm@9
13
13
  ```
14
14
 
15
15
  :::note
@@ -46,8 +46,8 @@ For more browser entry details, refer to [Entries](/guides/concept/entries.html)
46
46
  create `src/entry.server.tsx` file,add custom behavior for rendering responses:
47
47
 
48
48
  ```tsx
49
- import { renderString, createRequestHandler } from '@edenx/runtime/ssr/server';
50
- import type { HandleRequest } from '@edenx/runtime/ssr/server';
49
+ import { renderString, createRequestHandler } from '@modern-js/runtime/ssr/server';
50
+ import type { HandleRequest } from '@modern-js/runtime/ssr/server';
51
51
 
52
52
  const handleRequest: HandleRequest = async (request, ServerRoot, options) => {
53
53
  // do something before rendering
@@ -6,6 +6,10 @@ sidebar_position: 4
6
6
 
7
7
  The `cache` function allows you to cache the results of data fetching or computation.
8
8
 
9
+ :::info
10
+ X.65.5 and above versions are required
11
+ :::
12
+
9
13
  ## Basic Usage
10
14
 
11
15
  ```ts
@@ -35,8 +35,8 @@ export default createRequestHandler(handleRequest);
35
35
  如果用户需自定义 Server-Side Rendering 入口,可以在 `src/entry.server.ts`、`src/{entryName}/entry.server.ts` 中自定义 server 入口。
36
36
 
37
37
  ```tsx title="src/entry.server.tsx"
38
- import { renderString, createRequestHandler } from '@edenx/runtime/ssr/server';
39
- import type { HandleRequest } from '@edenx/runtime/ssr/server';
38
+ import { renderString, createRequestHandler } from '@modern-js/runtime/ssr/server';
39
+ import type { HandleRequest } from '@modern-js/runtime/ssr/server';
40
40
 
41
41
  const handleRequest: HandleRequest = async (request, ServerRoot, options) => {
42
42
  // do something before rendering
@@ -6,7 +6,7 @@ title: defineConfig
6
6
 
7
7
  :::warning
8
8
 
9
- 该 API 即将废弃,推荐使用 `src/modern.runtime.ts` 定义 Runtime 配置,同时支持静态配置和动态配置,使用姿势插件[Runtime 配置](/configure/app/runtime/0-intro.html)
9
+ 该 API 即将废弃,推荐使用 `src/modern.runtime.ts` 定义 Runtime 配置,同时支持静态配置和动态配置,使用姿势请参考 [Runtime 配置](/configure/app/runtime/0-intro.html)
10
10
  :::
11
11
 
12
12
  用于动态配置应用。
@@ -1,4 +1,4 @@
1
- 在开始使用前,你需要安装 [Node.js](https://nodejs.org/),并保证 Node.js 版本不低于 16.2.0,**我们推荐使用 Node.js 18 的 LTS 版本**。
1
+ 在开始使用前,你需要安装 [Node.js](https://nodejs.org/),并保证 Node.js 版本不低于 18.20.8,**我们推荐使用 Node.js 22 的 LTS 版本**。
2
2
 
3
3
  你可以通过以下命令检查当前使用的 Node.js 版本:
4
4
 
@@ -6,23 +6,27 @@
6
6
  node -v
7
7
  ```
8
8
 
9
- 如果你当前的环境中尚未安装 Node.js,或是安装的版本低于 16,可以通过 [nvm](https://github.com/nvm-sh/nvm) 或 [fnm](https://github.com/Schniz/fnm) 安装需要的版本。
9
+ 如果你当前的环境中尚未安装 Node.js,或是安装的版本低于 18,可以通过 [nvm](https://github.com/nvm-sh/nvm) 或 [fnm](https://github.com/Schniz/fnm) 安装需要的版本。
10
10
 
11
- 下面是通过 nvm 安装 Node.js 18 LTS 版本的例子:
11
+ 下面是通过 nvm 安装 Node.js 22 LTS 版本的例子:
12
12
 
13
13
  ```bash
14
- # 安装 Node.js 18 的长期支持版本
15
- nvm install 18 --lts
14
+ # 安装 Node.js 22 的长期支持版本
15
+ nvm install 22 --lts
16
16
 
17
- # 将刚安装的 Node.js 18 设置为默认版本
18
- nvm alias default 18
17
+ # 将刚安装的 Node.js 22 设置为默认版本
18
+ nvm alias default 22
19
19
 
20
- # 切换到刚安装的 Node.js 18
21
- nvm use 18
20
+ # 切换到刚安装的 Node.js 22
21
+ nvm use 22
22
22
  ```
23
23
 
24
24
  :::tip nvm 和 fnm
25
25
  nvm 和 fnm 都是 Node.js 版本管理工具。相对来说,nvm 较为成熟和稳定,而 fnm 是使用 Rust 实现的,比 nvm 提供了更好的性能。
26
26
  :::
27
27
 
28
- 此外,在安装 nvm 或 fnm 后,然后只要仓库根目录下有内容为 `lts/hydrogen` 的 `.nvmrc` 文件,进入这个仓库时就会自动安装或切换到正确的 Node.js 版本。
28
+ 此外,在安装 nvm 或 fnm 后,然后只要仓库根目录下有内容为 `lts/jod` 的 `.nvmrc` 文件,进入这个仓库时就会自动安装或切换到正确的 Node.js 版本。
29
+
30
+ :::warning
31
+ Modern.js 目前仍支持 Node 16,但会在 2025 年 6 月正式终止对 Node.js 16 的支持,为确保您的项目顺利过渡,请在 2025 年 6 月前完成 Node.js 版本升级。
32
+ :::
@@ -9,7 +9,7 @@ import NodeVersion from '@site-docs/components/nodeVersion.mdx';
9
9
  推荐使用 [pnpm](https://pnpm.io/installation) 来管理依赖:
10
10
 
11
11
  ```bash
12
- npm install -g pnpm@8
12
+ npm install -g pnpm@9
13
13
  ```
14
14
 
15
15
  :::note
@@ -45,8 +45,8 @@ beforeRender().then(() => {
45
45
  创建 `src/entry.server.tsx` 文件,为渲染响应添加自定义行为:
46
46
 
47
47
  ```tsx
48
- import { renderString, createRequestHandler } from '@edenx/runtime/ssr/server';
49
- import type { HandleRequest } from '@edenx/runtime/ssr/server';
48
+ import { renderString, createRequestHandler } from '@modern-js/runtime/ssr/server';
49
+ import type { HandleRequest } from '@modern-js/runtime/ssr/server';
50
50
 
51
51
  const handleRequest: HandleRequest = async (request, ServerRoot, options) => {
52
52
  // do something before rendering
@@ -6,6 +6,10 @@ sidebar_position: 4
6
6
 
7
7
  `cache` 函数可以让你缓存数据获取或计算的结果。
8
8
 
9
+ :::info
10
+ 需要 x.65.5 及以上版本
11
+ :::
12
+
9
13
  ## 基本用法
10
14
 
11
15
  ```ts
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.0",
18
+ "version": "2.67.2",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
24
  "mermaid": "^11.4.1",
25
- "@modern-js/sandpack-react": "2.67.0"
25
+ "@modern-js/sandpack-react": "2.67.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@rspress/shared": "1.42.0",
28
+ "@rspress/shared": "1.43.11",
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.42.0",
36
+ "rspress": "1.43.11",
37
37
  "ts-node": "^10.9.1",
38
38
  "typescript": "^5"
39
39
  },
package/rspress.config.ts CHANGED
@@ -8,7 +8,7 @@ export default defineConfig({
8
8
  base: '/',
9
9
  logo: 'https://lf-cdn-tos.bytescm.com/obj/static/webinfra/modern-js-website/assets/images/images/modernjs-logo.svg',
10
10
  icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico',
11
- lang: 'zh',
11
+ lang: 'en',
12
12
  themeDir: path.join(__dirname, 'src'),
13
13
  markdown: {
14
14
  checkDeadLinks: true,