@modern-js/main-doc 0.0.0-nightly-20240826170723 → 0.0.0-nightly-20240827170702

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 (39) hide show
  1. package/docs/en/community/blog/_meta.json +1 -6
  2. package/docs/en/configure/_meta.json +1 -1
  3. package/docs/en/configure/app/tools/swc.mdx +1 -1
  4. package/docs/en/guides/advanced-features/bff/_meta.json +1 -6
  5. package/docs/en/guides/advanced-features/rspack-start.mdx +1 -8
  6. package/docs/en/guides/advanced-features/ssr/_meta.json +1 -5
  7. package/docs/en/guides/basic-features/data/_meta.json +1 -4
  8. package/docs/en/guides/basic-features/data/data-fetch.mdx +1 -1
  9. package/docs/en/guides/concept/_meta.json +1 -4
  10. package/docs/en/guides/get-started/_meta.json +1 -7
  11. package/docs/en/guides/topic-detail/framework-plugin/_meta.json +1 -1
  12. package/docs/en/guides/topic-detail/generator/_meta.json +1 -1
  13. package/docs/en/guides/topic-detail/generator/create/_meta.json +1 -5
  14. package/docs/en/guides/topic-detail/generator/new/_meta.json +1 -5
  15. package/docs/en/guides/topic-detail/generator/plugin/_meta.json +1 -1
  16. package/docs/en/guides/troubleshooting/_meta.json +1 -6
  17. package/docs/zh/community/blog/_meta.json +1 -6
  18. package/docs/zh/configure/_meta.json +1 -1
  19. package/docs/zh/configure/app/tools/swc.mdx +1 -1
  20. package/docs/zh/guides/advanced-features/bff/_meta.json +1 -6
  21. package/docs/zh/guides/advanced-features/rspack-start.mdx +1 -8
  22. package/docs/zh/guides/advanced-features/ssr/_meta.json +1 -5
  23. package/docs/zh/guides/basic-features/data/_meta.json +1 -4
  24. package/docs/zh/guides/basic-features/data/data-fetch.mdx +1 -2
  25. package/docs/zh/guides/concept/_meta.json +1 -4
  26. package/docs/zh/guides/get-started/_meta.json +1 -7
  27. package/docs/zh/guides/topic-detail/framework-plugin/_meta.json +1 -1
  28. package/docs/zh/guides/topic-detail/generator/_meta.json +1 -1
  29. package/docs/zh/guides/topic-detail/generator/create/_meta.json +1 -5
  30. package/docs/zh/guides/topic-detail/generator/new/_meta.json +1 -5
  31. package/docs/zh/guides/topic-detail/generator/plugin/_meta.json +1 -1
  32. package/docs/zh/guides/troubleshooting/_meta.json +1 -6
  33. package/package.json +4 -4
  34. package/rspress.config.ts +1 -1
  35. package/src/components/ContentCard/index.tsx +1 -1
  36. package/src/components/Sandpack/index.tsx +1 -1
  37. package/src/components/ShowcaseList/index.tsx +1 -1
  38. package/src/i18n/index.ts +1 -1
  39. package/src/pages/index.tsx +2 -2
@@ -1,6 +1 @@
1
- [
2
- "overview",
3
- "v2-release-note",
4
- "2022-0910-updates",
5
- "2022-0708-updates"
6
- ]
1
+ ["overview", "v2-release-note", "2022-0910-updates", "2022-0708-updates"]
@@ -75,4 +75,4 @@
75
75
  },
76
76
  "app/builder-plugins",
77
77
  "app/auto-load-plugin"
78
- ]
78
+ ]
@@ -19,7 +19,7 @@ When using Rspack as the bundler, SWC will be used for transpiling and compressi
19
19
 
20
20
  ## Used in Rspack mode
21
21
 
22
- You can set the options of [builtin:swc-loader](https://www.rspack.dev/guide/builtin-swc-loader) through `tools.swc`.
22
+ You can set the options of [builtin:swc-loader](https://rspack.dev/guide/features/builtin-swc-loader) through `tools.swc`.
23
23
 
24
24
  ```
25
25
  import { defineConfig } from '@modern-js/app-tools';
@@ -1,6 +1 @@
1
- [
2
- "function",
3
- "type",
4
- "frameworks",
5
- "sdk"
6
- ]
1
+ ["function", "type", "frameworks", "sdk"]
@@ -22,13 +22,6 @@ import InitRspackApp from '@site-docs-en/components/init-rspack-app';
22
22
 
23
23
  After the project is created, you can experience the project by running `pnpm run dev`. For more project information, please refer to [Quick Start](/guides/get-started/quick-start.html).
24
24
 
25
- :::tip
26
- When using Rspack as the bundler, the following Features are temporarily unavailable as some of the capabilities are still under development and we will provide support in the future.
27
-
28
- - The usage of [useLoader](/guides/basic-features/data/data-fetch.html) in Client Side Rendering
29
-
30
- :::
31
-
32
25
  ## Enable Rspack build
33
26
 
34
27
  Since Modern.js MAJOR_VERSION.46.0, you can enable Rspack build by add the following configuration in `modern.config.ts`:
@@ -85,7 +78,7 @@ For unsupported configurations, we have marked `Bundler: only support webpack` o
85
78
 
86
79
  ## Modify transpile configuration
87
80
 
88
- Modern.js uses Rspack [builtin:swc-loader](https://www.rspack.dev/guide/builtin-swc-loader.html) for code translation in Rspack mode.
81
+ Modern.js uses Rspack [builtin:swc-loader](https://rspack.dev/guide/features/builtin-swc-loader) for code translation in Rspack mode.
89
82
 
90
83
  Modern.js has provided a more convenient configuration for the common configuration of `builtin:swc-loader`, such as: configuring the component library to import it on demand through [source.transformImport](/configure/app/source/transform-import).
91
84
 
@@ -1,5 +1 @@
1
- [
2
- "usage",
3
- "stream",
4
- "cache"
5
- ]
1
+ ["usage", "stream", "cache"]
@@ -1,4 +1 @@
1
- [
2
- "data-fetch",
3
- "data-write"
4
- ]
1
+ ["data-fetch", "data-write"]
@@ -481,7 +481,7 @@ The Data Loader in our SSR project is designed to only run on the server side. T
481
481
  **`useLoader`** is a legacy API in Modern.js v1. This API is a React Hook designed specifically for SSR applications, allowing developers to fetch data in components in isomorphic development.
482
482
 
483
483
  :::tip
484
- It is not necessary to use `useLoader` to fetch data in CSR projects.
484
+ It is not necessary to use `useLoader` to fetch data in CSR projects, and `useLoader` is not supported when using Rspack as the bundler.
485
485
  :::
486
486
 
487
487
  Here is the simplest example:
@@ -1,4 +1 @@
1
- [
2
- "entries",
3
- "builder"
4
- ]
1
+ ["entries", "builder"]
@@ -1,7 +1 @@
1
- [
2
- "introduction",
3
- "quick-start",
4
- "upgrade",
5
- "glossary",
6
- "tech-stack"
7
- ]
1
+ ["introduction", "quick-start", "upgrade", "glossary", "tech-stack"]
@@ -7,4 +7,4 @@
7
7
  "extend",
8
8
  "plugin-api",
9
9
  "hook-list"
10
- ]
10
+ ]
@@ -14,4 +14,4 @@
14
14
  "name": "plugin",
15
15
  "label": "generator-plugin"
16
16
  }
17
- ]
17
+ ]
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -8,4 +8,4 @@
8
8
  "name": "api",
9
9
  "label": "API"
10
10
  }
11
- ]
11
+ ]
@@ -1,6 +1 @@
1
- [
2
- "dependencies",
3
- "cli",
4
- "builder",
5
- "hmr"
6
- ]
1
+ ["dependencies", "cli", "builder", "hmr"]
@@ -1,6 +1 @@
1
- [
2
- "overview",
3
- "v2-release-note",
4
- "2022-0910-updates",
5
- "2022-0708-updates"
6
- ]
1
+ ["overview", "v2-release-note", "2022-0910-updates", "2022-0708-updates"]
@@ -75,4 +75,4 @@
75
75
  },
76
76
  "app/builder-plugins",
77
77
  "app/auto-load-plugin"
78
- ]
78
+ ]
@@ -19,7 +19,7 @@ import SWC from '@modern-js/builder-doc/docs/zh/shared/swc.md';
19
19
 
20
20
  ## 在 Rspack 模式下使用
21
21
 
22
- 通过 `tools.swc` 可以设置 Rspack [builtin:swc-loader](https://www.rspack.dev/guide/builtin-swc-loader) 的选项。
22
+ 通过 `tools.swc` 可以设置 Rspack [builtin:swc-loader](https://rspack.dev/zh/guide/features/builtin-swc-loader) 的选项。
23
23
 
24
24
  ```
25
25
  import { defineConfig } from '@modern-js/app-tools';
@@ -1,6 +1 @@
1
- [
2
- "function",
3
- "type",
4
- "frameworks",
5
- "sdk"
6
- ]
1
+ ["function", "type", "frameworks", "sdk"]
@@ -22,13 +22,6 @@ import InitRspackApp from '@site-docs/components/init-rspack-app';
22
22
 
23
23
  项目创建完成后,在项目中执行 `pnpm run dev` 即可体验项目,更多信息可参考[快速上手](/guides/get-started/quick-start.html)。
24
24
 
25
- :::tip
26
- 在使用 Rspack 作为打包工具时,由于部分能力尚在开发中,以下 features 暂时无法使用,我们将在未来提供支持:
27
-
28
- - 客户端渲染(CSR)使用 [useLoader](/guides/basic-features/data/data-fetch.html)
29
-
30
- :::
31
-
32
25
  ## 开启 Rspack 构建
33
26
 
34
27
  从 Modern.js MAJOR_VERSION.46.0 版本起,在一个已有的 Modern.js 项目中,你仅需在 `modern.config.ts` 中添加以下配置,即可启用 Rspack 构建:
@@ -86,7 +79,7 @@ export default {
86
79
 
87
80
  ## 修改转译配置
88
81
 
89
- Modern.js 在 Rspack 模式下使用 Rspack [builtin:swc-loader](https://www.rspack.dev/zh/guide/builtin-swc-loader.html) 进行代码转译。
82
+ Modern.js 在 Rspack 模式下使用 Rspack [builtin:swc-loader](https://rspack.dev/zh/guide/features/builtin-swc-loader) 进行代码转译。
90
83
 
91
84
  Modern.js 已对 `builtin:swc-loader` 的常见配置提供了更方便的配置方式,如:通过 [source.transformImport](/configure/app/source/transform-import) 配置组件库按需引入。如果对 `builtin:swc-loader` 有自定义配置的需求,可通过 [tools.swc](/configure/app/tools/swc) 进行配置:
92
85
 
@@ -1,5 +1 @@
1
- [
2
- "usage",
3
- "stream",
4
- "cache"
5
- ]
1
+ ["usage", "stream", "cache"]
@@ -1,4 +1 @@
1
- [
2
- "data-fetch",
3
- "data-write"
4
- ]
1
+ ["data-fetch", "data-write"]
@@ -499,8 +499,7 @@ export const loader = async (): Promise<ProfileData> => {
499
499
  **`useLoader`** 是 Modern.js 老版本中的 API。该 API 是一个 React Hook,专门提供给 SSR 应用使用,让开发者能同构的在组件中获取数据。
500
500
 
501
501
  :::tip
502
- CSR 的项目没有必要使用 `useLoader` 获取数据。
503
-
502
+ CSR 的项目没有必要使用 `useLoader` 获取数据,且在使用 Rspack 作为打包工具时,`useLoader` 不支持使用。
504
503
  :::
505
504
 
506
505
  以下是一个最简单的例子:
@@ -1,4 +1 @@
1
- [
2
- "entries",
3
- "builder"
4
- ]
1
+ ["entries", "builder"]
@@ -1,7 +1 @@
1
- [
2
- "introduction",
3
- "quick-start",
4
- "upgrade",
5
- "glossary",
6
- "tech-stack"
7
- ]
1
+ ["introduction", "quick-start", "upgrade", "glossary", "tech-stack"]
@@ -7,4 +7,4 @@
7
7
  "extend",
8
8
  "plugin-api",
9
9
  "hook-list"
10
- ]
10
+ ]
@@ -14,4 +14,4 @@
14
14
  "name": "plugin",
15
15
  "label": "generator-plugin"
16
16
  }
17
- ]
17
+ ]
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -1,5 +1 @@
1
- [
2
- "use",
3
- "option",
4
- "config"
5
- ]
1
+ ["use", "option", "config"]
@@ -8,4 +8,4 @@
8
8
  "name": "api",
9
9
  "label": "API"
10
10
  }
11
- ]
11
+ ]
@@ -1,6 +1 @@
1
- [
2
- "dependencies",
3
- "cli",
4
- "builder",
5
- "hmr"
6
- ]
1
+ ["dependencies", "cli", "builder", "hmr"]
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20240826170723",
18
+ "version": "0.0.0-nightly-20240827170702",
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": "0.0.0-nightly-20240826170723"
25
+ "@modern-js/sandpack-react": "0.0.0-nightly-20240827170702"
26
26
  },
27
27
  "peerDependencies": {
28
- "@modern-js/builder-doc": "0.0.0-nightly-20240826170723"
28
+ "@modern-js/builder-doc": "0.0.0-nightly-20240827170702"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@rspress/shared": "1.27.0",
@@ -39,7 +39,7 @@
39
39
  "rspress": "1.27.0",
40
40
  "ts-node": "^10.9.1",
41
41
  "typescript": "^5",
42
- "@modern-js/builder-doc": "0.0.0-nightly-20240826170723"
42
+ "@modern-js/builder-doc": "0.0.0-nightly-20240827170702"
43
43
  },
44
44
  "scripts": {
45
45
  "dev": "rspress dev",
package/rspress.config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
- import { defineConfig } from 'rspress/config';
3
2
  import type { NavItem } from '@rspress/shared';
3
+ import { defineConfig } from 'rspress/config';
4
4
 
5
5
  const { version } = require('./package.json');
6
6
 
@@ -1,5 +1,5 @@
1
- import type React from 'react';
2
1
  import cl from 'classnames';
2
+ import type React from 'react';
3
3
  import { withBase } from 'rspress/runtime';
4
4
  import styles from './index.module.scss';
5
5
 
@@ -2,7 +2,7 @@ import ModernSandpack, {
2
2
  type ModernSandpackProps,
3
3
  } from '@modern-js/sandpack-react';
4
4
  import React, { type PropsWithChildren } from 'react';
5
- import { useDark, NoSSR } from 'rspress/runtime';
5
+ import { NoSSR, useDark } from 'rspress/runtime';
6
6
 
7
7
  import './index.css';
8
8
 
@@ -1,5 +1,5 @@
1
- import { useShowcases } from './useShowcases';
2
1
  import styles from './index.module.scss';
2
+ import { useShowcases } from './useShowcases';
3
3
 
4
4
  const getDomain = (url: string) => new URL(url).hostname;
5
5
 
package/src/i18n/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { withBase, useLang } from 'rspress/runtime';
1
+ import { useLang, withBase } from 'rspress/runtime';
2
2
  import { EN_US } from './enUS';
3
3
  import { ZH_CN } from './zhCN';
4
4
 
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable react/no-unescaped-entities */
2
2
  import clsx from 'clsx';
3
- import { useLang, Helmet, useLocation } from 'rspress/runtime';
4
3
  import { useEffect } from 'react';
4
+ import { Helmet, useLang, useLocation } from 'rspress/runtime';
5
5
  import ContentCard from '../components/ContentCard';
6
- import SecondaryTitle from '../components/SecondaryTitle';
7
6
  import { FeatureLayout } from '../components/FeatureLayout';
8
7
  import Footer from '../components/Footer';
8
+ import SecondaryTitle from '../components/SecondaryTitle';
9
9
  import { useI18n, useUrl } from '../i18n';
10
10
  import styles from './index.module.scss';
11
11