@modern-js/main-doc 2.32.0 → 2.32.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/docs/en/components/enable-bff-caution.mdx +1 -1
  3. package/docs/en/configure/app/auto-load-plugin.mdx +2 -2
  4. package/docs/en/configure/app/bff/_category_.json +1 -1
  5. package/docs/en/configure/app/builder-plugins.mdx +2 -2
  6. package/docs/en/configure/app/dev/_category_.json +1 -1
  7. package/docs/en/configure/app/experiments/_category_.json +1 -1
  8. package/docs/en/configure/app/html/_category_.json +1 -1
  9. package/docs/en/configure/app/output/_category_.json +1 -1
  10. package/docs/en/configure/app/output/ssg.mdx +1 -1
  11. package/docs/en/configure/app/plugins.mdx +0 -1
  12. package/docs/en/configure/app/runtime/_category_.json +1 -1
  13. package/docs/en/configure/app/security/_category_.json +1 -1
  14. package/docs/en/configure/app/server/_category_.json +1 -1
  15. package/docs/en/configure/app/source/_category_.json +1 -1
  16. package/docs/en/configure/app/source/design-system.mdx +4 -4
  17. package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
  18. package/docs/en/configure/app/source/mainEntryName.mdx +1 -1
  19. package/docs/en/configure/app/testing/_category_.json +1 -1
  20. package/docs/en/configure/app/tools/_category_.json +1 -1
  21. package/docs/en/configure/app/tools/tailwindcss.mdx +3 -5
  22. package/docs/en/guides/advanced-features/bff/_category_.json +1 -1
  23. package/docs/en/guides/advanced-features/code-split.mdx +2 -2
  24. package/docs/en/guides/advanced-features/eslint.mdx +2 -2
  25. package/docs/en/guides/advanced-features/low-level.mdx +2 -2
  26. package/docs/en/guides/advanced-features/ssg.mdx +2 -3
  27. package/docs/en/guides/advanced-features/ssr.mdx +2 -3
  28. package/docs/en/guides/advanced-features/testing.mdx +3 -3
  29. package/docs/en/guides/advanced-features/using-storybook.mdx +1 -1
  30. package/docs/en/guides/advanced-features/web-server.mdx +2 -2
  31. package/docs/en/guides/basic-features/alias.mdx +3 -3
  32. package/docs/en/guides/basic-features/css.mdx +2 -49
  33. package/docs/en/guides/basic-features/data-fetch.mdx +2 -2
  34. package/docs/en/guides/basic-features/env-vars.mdx +2 -2
  35. package/docs/en/guides/basic-features/html.mdx +0 -1
  36. package/docs/en/guides/basic-features/mock.mdx +3 -3
  37. package/docs/en/guides/basic-features/proxy.mdx +3 -3
  38. package/docs/en/guides/basic-features/routes.mdx +1 -2
  39. package/docs/en/guides/concept/builder.mdx +2 -2
  40. package/docs/en/guides/concept/entries.mdx +1 -1
  41. package/docs/en/guides/get-started/upgrade.mdx +1 -2
  42. package/docs/zh/community/releases.mdx +1 -1
  43. package/docs/zh/community/team.mdx +1 -1
  44. package/docs/zh/components/enable-bff-caution.mdx +2 -2
  45. package/docs/zh/configure/app/auto-load-plugin.mdx +2 -3
  46. package/docs/zh/configure/app/bff/_category_.json +2 -2
  47. package/docs/zh/configure/app/builder-plugins.mdx +2 -3
  48. package/docs/zh/configure/app/deploy/_category_.json +1 -1
  49. package/docs/zh/configure/app/dev/_category_.json +2 -2
  50. package/docs/zh/configure/app/experiments/_category_.json +2 -2
  51. package/docs/zh/configure/app/html/_category_.json +2 -2
  52. package/docs/zh/configure/app/output/_category_.json +2 -2
  53. package/docs/zh/configure/app/output/ssg.mdx +1 -1
  54. package/docs/zh/configure/app/performance/_category_.json +1 -1
  55. package/docs/zh/configure/app/plugins.mdx +1 -2
  56. package/docs/zh/configure/app/runtime/_category_.json +2 -2
  57. package/docs/zh/configure/app/security/_category_.json +2 -2
  58. package/docs/zh/configure/app/server/_category_.json +2 -2
  59. package/docs/zh/configure/app/source/_category_.json +2 -2
  60. package/docs/zh/configure/app/source/design-system.mdx +1 -1
  61. package/docs/zh/configure/app/testing/_category_.json +2 -2
  62. package/docs/zh/configure/app/tools/_category_.json +2 -2
  63. package/docs/zh/configure/app/tools/tailwindcss.mdx +4 -6
  64. package/docs/zh/guides/advanced-features/bff/_category_.json +1 -1
  65. package/docs/zh/guides/advanced-features/code-split.mdx +2 -2
  66. package/docs/zh/guides/advanced-features/compatibility.mdx +1 -1
  67. package/docs/zh/guides/advanced-features/eslint.mdx +1 -1
  68. package/docs/zh/guides/advanced-features/low-level.mdx +2 -2
  69. package/docs/zh/guides/advanced-features/rspack-start.mdx +0 -1
  70. package/docs/zh/guides/advanced-features/ssg.mdx +3 -4
  71. package/docs/zh/guides/advanced-features/ssr.mdx +2 -3
  72. package/docs/zh/guides/advanced-features/testing.mdx +2 -2
  73. package/docs/zh/guides/advanced-features/using-storybook.mdx +1 -1
  74. package/docs/zh/guides/advanced-features/web-server.mdx +2 -2
  75. package/docs/zh/guides/basic-features/alias.mdx +3 -3
  76. package/docs/zh/guides/basic-features/css.mdx +2 -48
  77. package/docs/zh/guides/basic-features/data-fetch.mdx +1 -2
  78. package/docs/zh/guides/basic-features/env-vars.mdx +1 -1
  79. package/docs/zh/guides/basic-features/mock.mdx +2 -2
  80. package/docs/zh/guides/basic-features/proxy.mdx +3 -3
  81. package/docs/zh/guides/basic-features/routes.mdx +1 -2
  82. package/docs/zh/guides/concept/builder.mdx +1 -1
  83. package/docs/zh/guides/concept/entries.mdx +3 -3
  84. package/docs/zh/guides/get-started/upgrade.mdx +1 -2
  85. package/package.json +5 -5
  86. package/src/i18n/enUS.ts +1 -1
  87. package/src/i18n/zhCN.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/builder-doc@2.32.1
8
+
3
9
  ## 2.32.0
4
10
 
5
11
  ### Patch Changes
@@ -1,3 +1,3 @@
1
1
  :::caution
2
- Please enable BFF functionality in the current application project root directory using [new](/apis/app/commands#modern-new) first.
2
+ Please use the [new command](/apis/app/commands#modern-new) in the root directory of the current project to enable BFF functionality first.
3
3
  :::
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: autoLoadPlugins
3
- sidebar_position: 11
2
+ sidebar_position: 22
4
3
  ---
4
+
5
5
  # autoLoadPlugins
6
6
 
7
7
  - **Type:** `boolean`
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "bff",
3
- "position": 5
3
+ "position": 2
4
4
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: builderPlugins
3
- sidebar_position: 10
2
+ sidebar_position: 21
4
3
  ---
4
+
5
5
  # builderPlugins
6
6
 
7
7
  - **Type:** `BuilderPlugin[]`
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "dev",
3
- "position": 7
3
+ "position": 1
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "experiments",
3
- "position": 15
3
+ "position": 14
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "html",
3
- "position": 2
3
+ "position": 3
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "output",
3
- "position": 2
3
+ "position": 7
4
4
  }
@@ -10,7 +10,7 @@ sidebar_label: ssg
10
10
  Enable the SSG for **Self-controlled Routing** or **Conventional Routing**.
11
11
 
12
12
  :::info
13
- For more routes detail, see [routes](/guides/basic-features/routes).
13
+ For more routes detail, see [Routing](/guides/basic-features/routes).
14
14
 
15
15
  :::
16
16
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- title: plugins
3
2
  sidebar_position: 9
4
3
  ---
5
4
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "runtime",
3
- "position": 3
3
+ "position": 12
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "security",
3
- "position": 14
3
+ "position": 11
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "server",
3
- "position": 4
3
+ "position": 6
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "source",
3
- "position": 1
3
+ "position": 5
4
4
  }
@@ -648,7 +648,7 @@ const designSystem = {
648
648
  </details>
649
649
 
650
650
  :::tip
651
- For more information on TailwindCSS configuration, please refer to [here](https://tailwindcss.com/docs/configuration#theme).
651
+ For more information on Tailwind CSS configuration, please refer to [here](https://tailwindcss.com/docs/configuration#theme).
652
652
 
653
653
  :::
654
654
 
@@ -673,7 +673,7 @@ const designSystem = {
673
673
  };
674
674
  ```
675
675
 
676
- The property names in the `screens` object are screen names (used as prefixes for the responsive utility variants generated by TailwindCSS, such as `md:text-center`), and the values are the `min-width` at which the breakpoint should start.
676
+ The property names in the `screens` object are screen names (used as prefixes for the responsive utility variants generated by Tailwind CSS, such as `md:text-center`), and the values are the `min-width` at which the breakpoint should start.
677
677
 
678
678
  The default breakpoints are inspired by common device resolutions:
679
679
 
@@ -859,7 +859,7 @@ Then, you can use the `dark:` prefix to set different styles for elements in dar
859
859
  </div>
860
860
  ```
861
861
 
862
- Please note that since these screen variants are implemented in TailwindCSS, **it is not possible to use this method to combine breakpoints with dark mode**, e.g. `md:dark:text-gray-300` will not work.
862
+ Please note that since these screen variants are implemented in Tailwind CSS, **it is not possible to use this method to combine breakpoints with dark mode**, e.g. `md:dark:text-gray-300` will not work.
863
863
 
864
864
  #### Colors
865
865
 
@@ -1158,7 +1158,7 @@ export default defineConfig({
1158
1158
 
1159
1159
  ### Configuration Reference
1160
1160
 
1161
- In addition to `screens`, `colors`, and `spacing`, all properties in the configuration object map to core plugins in TailwindCSS. Because many plugins are responsible for CSS properties that only accept a set of static values (e.g. `float`), not every plugin has a corresponding property in the theme object.
1161
+ In addition to `screens`, `colors`, and `spacing`, all properties in the configuration object map to core plugins in Tailwind CSS. Because many plugins are responsible for CSS properties that only accept a set of static values (e.g. `float`), not every plugin has a corresponding property in the theme object.
1162
1162
 
1163
1163
  All of these properties can also be extended from the default theme under the `designSystem.extend` property.
1164
1164
 
@@ -9,7 +9,7 @@ sidebar_label: enableAsyncEntry
9
9
 
10
10
  This option is used for webpack Module Federation scenario.
11
11
 
12
- When this option is enabled, Modern.js will wrap the automatically generated entry files with Dynamic Imports (Asynchronous Boundaries), allowing page code to consume remote modules generated by Module Federation.
12
+ When this option is enabled, Modern.js will wrap the automatically generated entry files with dynamic import (Asynchronous Boundaries), allowing page code to consume remote modules generated by Module Federation.
13
13
 
14
14
  ## Background
15
15
 
@@ -5,7 +5,7 @@ sidebar_label: mainEntryName
5
5
  # source.mainEntryName
6
6
 
7
7
  - **Type:** `string`
8
- - **Default value:** `main`
8
+ - **Default:** `main`
9
9
 
10
10
  This option is used to configure the main entry name of Modern.js.
11
11
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "testing",
3
- "position": 8
3
+ "position": 10
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "tools",
3
- "position": 12
3
+ "position": 4
4
4
  }
@@ -14,8 +14,6 @@ const tailwind = {
14
14
  './config/html/**/*.{html,ejs,hbs}',
15
15
  './storybook/**/*',
16
16
  ],
17
- // Use source.design System config as Tailwind CSS theme config
18
- theme: source.designSystem,
19
17
  };
20
18
  ```
21
19
 
@@ -51,8 +49,8 @@ export default {
51
49
  };
52
50
  ```
53
51
 
54
- ### Limitations
52
+ ### Notes
55
53
 
56
- The `theme` attribute is not allowed, otherwise the build will fail. Modern.js use [source.designSystem](/configure/app/source/design-system) as the Tailwind CSS Theme configuration.
54
+ Please note that if you are using the [source.designSystem](/configure/app/source/design-system) configuration option simultaneously, the `theme` configuration of Tailwind CSS will be overridden by the value of `source.designSystem`.
57
55
 
58
- Other uses are consistent with [Tailwind CSS](https://tailwindcss.com/docs/configuration).
56
+ The usage of other configurations follows the same approach as the official usage of Tailwind CSS. Please refer to [tailwindcss - Configuration](https://tailwindcss.com/docs/configuration) for more details.
@@ -1,5 +1,5 @@
1
1
  {
2
- "label": "BFF",
2
+ "label": "Using BFF",
3
3
  "position": 2,
4
4
  "link": {
5
5
  "type": "doc",
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Code Split
3
- sidebar_position: 6
2
+ sidebar_position: 3
4
3
  ---
4
+
5
5
  # Code Splitting
6
6
 
7
7
  Code splitting is a common way to optimize frontend resource loading. This article will introduce the three types of code splitting supported by Modern.js:
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: ESLint
3
2
  sidebar_position: 8
4
3
  ---
5
- # ESLint
4
+
5
+ # ESLint Rules
6
6
 
7
7
  **Modern.js ESLint Rules** is the full set of **ESLint** rules, includes `@modern-js` (Lint rules for Node.js projects) and `@modern-js-app` (Lint rules for web projects).
8
8
 
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Low-Level Tools
3
- sidebar_position: 11
2
+ sidebar_position: 10
4
3
  ---
4
+
5
5
  # Low-Level Tools
6
6
 
7
7
  ## Usage
@@ -1,6 +1,5 @@
1
1
  ---
2
- title: Static Site Generation
3
- sidebar_position: 4
2
+ sidebar_position: 5
4
3
  ---
5
4
 
6
5
  # Static Site Generation
@@ -55,7 +54,7 @@ The above file directory will generate the following three routes:
55
54
  - `/user/profile`
56
55
 
57
56
  :::note
58
- If you are not familiar with the rules of Conventional Routing, you can first check [routes](/guides/basic-features/routes).
57
+ If you are not familiar with the rules of Conventional Routing, you can first check [Routing](/guides/basic-features/routes).
59
58
 
60
59
  :::
61
60
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: Server-side rendering
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
5
4
 
6
- # Server-side rendering
5
+ # Server-Side Rendering
7
6
 
8
7
  In Modern.js, SSR is readily available without the need for developers to write intricate server-level logic or worry about the operation and maintenance of SSR services. Additionally, Modern.js includes a comprehensive degradation strategy for SSR to ensure safe page execution.
9
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- sidebar_position: 10
3
- title: Testing
2
+ sidebar_position: 11
4
3
  ---
5
- # Testing
4
+
5
+ # Using Jest
6
6
 
7
7
  Modern.js integrates the testing capabilities of [Jest](https://jestjs.io/) by default.
8
8
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 20
2
+ sidebar_position: 12
3
3
  ---
4
4
 
5
5
  # Using Storybook
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Custom Web Server
3
- sidebar_position: 3
2
+ sidebar_position: 13
4
3
  ---
4
+
5
5
  # Custom Web Server
6
6
 
7
7
  As a client-centric development framework, Modern.js has limited customization capabilities on the server side. However, in some development scenarios, special server-level logic needs to be customized, such as user authentication, request preprocessing, and adding page rendering skeletons.
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Alias
3
- sidebar_position: 8
2
+ sidebar_position: 3
4
3
  ---
5
- # Alias
4
+
5
+ # Path Alias
6
6
 
7
7
  Modern.js allows you to use alias to import modules from custom directories in JS and CSS, and comes with the following built-in alias:
8
8
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 2
3
3
  ---
4
4
 
5
- # CSS Solutions
5
+ # Styling
6
6
 
7
7
  Modern.js has built-in a variety of commonly used CSS solutions, including Less / Sass / Stylus preprocessors, PostCSS, CSS Modules, CSS-in-JS, and Tailwind CSS.
8
8
 
@@ -119,12 +119,10 @@ export default {
119
119
  './config/html/**/*.{html,ejs,hbs}',
120
120
  './storybook/**/*',
121
121
  ],
122
- // Theme configuration (optional)
123
- theme: {},
124
122
  };
125
123
  ```
126
124
 
127
- 3. In the `modern.config.ts` file, import the `tailwind.config.ts` file you created, so that Modern.js can recognize the Tailwind CSS configuration correctly.
125
+ 3. In the `modern.config.ts` file, import the `tailwind.config.ts` file you created and pass it to [tools.tailwindcss](/configure/app/tools/tailwindcss), so that Modern.js can recognize the Tailwind CSS configuration correctly.
128
126
 
129
127
  ```ts title="modern.config.ts"
130
128
  import tailwindConfig from './tailwind.config';
@@ -133,18 +131,9 @@ export default defineConfig({
133
131
  tools: {
134
132
  tailwindcss: tailwindConfig,
135
133
  },
136
- // Theme configuration (optional)
137
- source: {
138
- designSystem: tailwindConfig.theme,
139
- },
140
134
  });
141
135
  ```
142
136
 
143
- Please read the documentation for the following configuration options to understand their functions:
144
-
145
- - [tools.tailwindcss](/configure/app/tools/tailwindcss).
146
- - [source.designSystem](/configure/app/source/design-system).
147
-
148
137
  ### Tailwind CSS Version
149
138
 
150
139
  Modern.js supports both Tailwind CSS v2 and v3 versions, and the framework will recognize the version of the `tailwindcss` dependency in the project `package.json` file and enable the corresponding configuration. By default, we will install Tailwind CSS v3 version for you.
@@ -162,39 +151,3 @@ Tailwind CSS v2 and v3 do not support the IE 11 browser, please refer to:
162
151
  - [Tailwind CSS v2 - Browser Support](https://v2.tailwindcss.com/docs/browser-support)
163
152
 
164
153
  If you use Tailwind CSS on IE 11 browser, some styles may not be available, please use it with caution.
165
-
166
- ### Theme Configuration
167
-
168
- When you need to customize the [theme](https://tailwindcss.com/docs/theme) configuration of Tailwind CSS, you can modify it in the [`source.designSystem`](/configure/app/source/design-system) configuration. For example, adding a `primary` color theme:
169
-
170
- ```ts title="modern.config.ts"
171
- export default defineConfig({
172
- source: {
173
- designSystem: {
174
- extend: {
175
- colors: {
176
- primary: '#5c6ac4',
177
- },
178
- },
179
- },
180
- },
181
- });
182
- ```
183
-
184
- When you need to make other special configurations to Tailwind CSS besides [theme](https://tailwindcss.com/docs/theme), you can configure them in [`tools.tailwindcss`](/configure/app/tools/tailwindcss), such as setting `variants`:
185
-
186
- ```ts title="modern.config.ts"
187
- export default defineConfig({
188
- tools: {
189
- tailwindcss: {
190
- variants: {
191
- extend: {
192
- backgroundColor: ['active'],
193
- },
194
- },
195
- },
196
- },
197
- });
198
- ```
199
-
200
- > When you configure Tailwind CSS for your project, the combination of [source.designSystem](/configure/app/source/design-system) and [tools.tailwindcss](/configure/app/tools/tailwindcss) configurations is equivalent to configuring a `tailwindcss.config.js` file separately. [source.designSystem](/configure/app/source/design-system) is equivalent to the Tailwind CSS [theme](https://v2.tailwindcss.com/docs/configuration#theme) configuration.
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: Data Fetching
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
4
+
5
5
  # Data Fetching
6
6
 
7
7
  Modern.js provides out-of-the-box data fetching capabilities, allowing developers to develop in an isomorphic way in both client-side and server-side code.
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Environment Variable
3
2
  sidebar_position: 7
4
3
  ---
5
- # Environment Variable
4
+
5
+ # Environment Variables
6
6
 
7
7
  Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
8
8
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- title: HTML Template
3
2
  sidebar_position: 9
4
3
  ---
5
4
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Mock
3
- sidebar_position: 6
2
+ sidebar_position: 5
4
3
  ---
5
- # Mock
4
+
5
+ # Data Mocking
6
6
 
7
7
  Modern.js allows you to easily generate mock data so that the front-end can develop independently without depending on the back-end API.
8
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: Proxy
3
- sidebar_position: 5
2
+ sidebar_position: 6
4
3
  ---
5
- # Proxy
4
+
5
+ # Network Proxy
6
6
 
7
7
  ## Local Proxy
8
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: Routes
3
2
  sidebar_position: 1
4
3
  ---
5
4
 
6
- # Routes
5
+ # Routing
7
6
 
8
7
  Modern.js's routing is based on [React Router 6](https://reactrouter.com/en/main) and provides multiple types of routing modes. According to different [entry](/guides/concept/entries) types, routing is divided into three modes: **Conventional Routing**, **Self-controlled Routing**, and **Other**.
9
8
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 2
3
3
  ---
4
4
 
5
- # Builder
5
+ # Build Engine
6
6
 
7
7
  **Modern.js uses [Modern.js Builder](https://modernjs.dev/builder/en) to build your Web App.**
8
8
 
@@ -16,7 +16,7 @@ From a building perspective, Modern.js is divided into three layers, from top to
16
16
  - Common build engine: Modern.js Builder.
17
17
  - Low-level bundler: webpack and Rspack.
18
18
 
19
- <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
19
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-0824.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## Builder Documentation
22
22
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 1
3
3
  ---
4
4
 
5
- # Entry
5
+ # Page Entry
6
6
 
7
7
  In this chapter, you will learn about the entry convention in Modern.js and how to customize it.
8
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: Upgrade
3
2
  sidebar_position: 3
4
3
  ---
5
4
 
6
- # Upgrade
5
+ # Upgrading
7
6
 
8
7
  ## Upgrade with command
9
8
 
@@ -24,7 +24,7 @@ Modern.js 遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/) 语义化
24
24
 
25
25
  ## 版本升级
26
26
 
27
- 当你需要升级项目中的 Modern.js 版本时,可以使用 `modern upgrade` 命令,参考 [升级](/guides/get-started/upgrade)。
27
+ 当你需要升级项目中的 Modern.js 版本时,可以使用 `modern upgrade` 命令,参考 [版本升级](/guides/get-started/upgrade)。
28
28
 
29
29
  ```bash
30
30
  npx modern upgrade
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 1
3
3
  ---
4
4
 
5
- # 团队
5
+ # 开发团队
6
6
 
7
7
  Modern.js 的开发由字节跳动的 Modern.js 团队和社区贡献者驱动。
8
8
 
@@ -1,4 +1,4 @@
1
- :::caution 注意
2
- 请先在当前应用项目根目录使用【[new](/apis/app/commands#modern-new) 启用 BFF 功能。
1
+ :::tip
2
+ 请先在当前项目的根目录使用 [new 命令](/apis/app/commands#modern-new) 启用 BFF 功能。
3
3
 
4
4
  :::
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: autoLoadPlugins (自动注册插件)
3
- sidebar_position: 11
2
+ sidebar_position: 22
4
3
  ---
5
4
 
6
- # autoLoadPlugins (自动注册插件)
5
+ # autoLoadPlugins 自动注册插件
7
6
 
8
7
  - **类型:** `boolean`
9
8
  - **默认值:** `false`
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "bff (BFF API)",
3
- "position": 5
2
+ "label": "bff 一体化",
3
+ "position": 2
4
4
  }
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: builderPlugins (构建插件)
3
- sidebar_position: 10
2
+ sidebar_position: 21
4
3
  ---
5
4
 
6
- # builderPlugins (构建插件)
5
+ # builderPlugins 构建插件
7
6
 
8
7
  - **类型:** `BuilderPlugin[]`
9
8
  - **默认值:** `[]`
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "deploy (部署)",
2
+ "label": "deploy 部署",
3
3
  "position": 8
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "dev (开发调试)",
3
- "position": 7
2
+ "label": "dev 开发",
3
+ "position": 1
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "experiments (实验性)",
3
- "position": 15
2
+ "label": "experiments 实验性",
3
+ "position": 14
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "html (模板)",
3
- "position": 2
2
+ "label": "html 模板",
3
+ "position": 3
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "output (构建产物)",
3
- "position": 2
2
+ "label": "output 产物",
3
+ "position": 7
4
4
  }
@@ -10,7 +10,7 @@ sidebar_label: ssg
10
10
  开启**自控式路由**或**约定式路由** SSG 功能的配置。
11
11
 
12
12
  :::info 客户端路由
13
- 相关内容可以查看[路由](/guides/basic-features/routes)。
13
+ 相关内容可以查看[路由方案](/guides/basic-features/routes)。
14
14
 
15
15
  :::
16
16
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "performance (性能)",
2
+ "label": "performance 性能",
3
3
  "position": 13
4
4
  }
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: plugins (插件)
3
2
  sidebar_position: 9
4
3
  ---
5
4
 
6
- # plugins (插件)
5
+ # plugins 插件
7
6
 
8
7
  - **类型:** `CliPlugin[]`
9
8
  - **默认值:** `[]`
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "runtime (运行时)",
3
- "position": 3
2
+ "label": "runtime 运行时",
3
+ "position": 12
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "security (安全)",
3
- "position": 14
2
+ "label": "security 安全",
3
+ "position": 11
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "server (服务器)",
3
- "position": 4
2
+ "label": "server 服务器",
3
+ "position": 6
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "source (源文件)",
3
- "position": 1
2
+ "label": "source 源文件",
3
+ "position": 5
4
4
  }
@@ -647,7 +647,7 @@ const designSystem = {
647
647
  </details>
648
648
 
649
649
  :::tip 提示
650
- 更多关于 TailwindCSS 配置可查看[这里](https://tailwindcss.com/docs/configuration#theme)。
650
+ 更多关于 Tailwind CSS 配置可查看[这里](https://tailwindcss.com/docs/configuration#theme)。
651
651
 
652
652
  :::
653
653
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "testing (测试)",
3
- "position": 8
2
+ "label": "testing 测试",
3
+ "position": 10
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "tools (底层配置)",
3
- "position": 12
2
+ "label": "tools 底层工具",
3
+ "position": 4
4
4
  }
@@ -14,12 +14,10 @@ const tailwind = {
14
14
  './config/html/**/*.{html,ejs,hbs}',
15
15
  './storybook/**/*',
16
16
  ],
17
- // 使用 source.designSystem 配置作为 Tailwind CSS Theme 配置
18
- theme: source.designSystem,
19
17
  };
20
18
  ```
21
19
 
22
- 对应 [TailwindCSS](https://tailwindcss.com/docs/configuration) 的配置。
20
+ 对应 [Tailwind CSS](https://tailwindcss.com/docs/configuration) 的配置。
23
21
 
24
22
  ### Function 类型
25
23
 
@@ -53,8 +51,8 @@ export default {
53
51
  };
54
52
  ```
55
53
 
56
- ### 限制
54
+ ### 注意事项
57
55
 
58
- 注意,该配置中不允许使用 `theme` 配置项,否则会构建失败。在 Modern.js 中,请使用 [source.designSystem](/configure/app/source/design-system) 作为 `Tailwind CSS Theme` 配置。
56
+ 注意,如果你同时使用了 [source.designSystem](/configure/app/source/design-system) 配置项,那么 Tailwind CSS `theme` 配置将会被 `source.designSystem` 的值所覆盖。
59
57
 
60
- 其他配置的使用方式和 Tailwind CSS 一致,请参考 [tailwindcss - Configuration](https://tailwindcss.com/docs/configuration)。
58
+ 其他配置的使用方式与 Tailwind CSS 官方用法一致,请参考 [tailwindcss - Configuration](https://tailwindcss.com/docs/configuration)。
@@ -1,5 +1,5 @@
1
1
  {
2
- "label": "BFF",
2
+ "label": "使用 BFF",
3
3
  "position": 2,
4
4
  "link": {
5
5
  "type": "doc",
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: 代码分割
3
- sidebar_position: 6
2
+ sidebar_position: 3
4
3
  ---
4
+
5
5
  # 代码分割
6
6
 
7
7
  代码分割是优化前端资源加载的一种常用手段,本文将介绍 Modern.js 支持的三种代码分割方式:
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 5
2
+ sidebar_position: 6
3
3
  ---
4
4
 
5
5
  # 浏览器兼容性
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: ESLint 规则集
3
2
  sidebar_position: 8
4
3
  ---
4
+
5
5
  # ESLint 规则集
6
6
 
7
7
  {/* 参考 [实战教程 - 确认编程环境](../handbook/c03-ide/3.1-setting-up) 确保本地 IDE 环境正常。 */}
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: 配置底层工具
3
- sidebar_position: 11
2
+ sidebar_position: 10
4
3
  ---
4
+
5
5
  # 配置底层工具
6
6
 
7
7
  ## 使用方式
@@ -1,5 +1,4 @@
1
1
  ---
2
- title: 使用 Rspack
3
2
  sidebar_position: 1
4
3
  ---
5
4
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: 静态站点生成(SSG)
3
- sidebar_position: 4
2
+ sidebar_position: 5
4
3
  ---
5
4
 
6
- # 静态站点生成(SSG)
5
+ # 静态站点生成
7
6
 
8
7
  SSG(Static Site Generation)是一种基于数据与模板,在构建时渲染完整静态网页的技术解决方案。
9
8
 
@@ -55,7 +54,7 @@ SSG 在**约定式路由**和**自控式路由**下的使用方式不同。
55
54
  - `/user/profile`
56
55
 
57
56
  :::note
58
- 如果还不了解约定式路由的规则,可以先查看[路由](/guides/basic-features/routes)。
57
+ 如果还不了解约定式路由的规则,可以先查看[路由方案](/guides/basic-features/routes)。
59
58
 
60
59
  :::
61
60
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: 服务端渲染(SSR)
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
5
4
 
6
- # 服务端渲染(SSR)
5
+ # 服务端渲染
7
6
 
8
7
  在 Modern.js 中,SSR 也是开箱即用的。开发者无需为 SSR 编写复杂的服务端逻辑,也无需关心 SSR 的运维,或是创建单独的服务。Modern.js 拥有完备的 SSR 降级策略,保证页面能够安全运行。
9
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- sidebar_position: 10
2
+ sidebar_position: 11
3
3
  ---
4
4
 
5
- # 测试
5
+ # 使用 Jest 测试
6
6
 
7
7
  Modern.js 默认集成了 [Jest](https://jestjs.io/) 的测试能力。
8
8
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- sidebar_position: 20
2
+ sidebar_position: 12
3
3
  ---
4
4
 
5
5
  # 使用 Storybook
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: 自定义 Web Server
3
- sidebar_position: 3
2
+ sidebar_position: 13
4
3
  ---
4
+
5
5
  # 自定义 Web Server
6
6
 
7
7
  Modern.js 作为以客户端为中心的开发框架,对服务端的定制能力较弱。而在有些开发场景下,需要定制特殊的服务端逻辑,例如用户鉴权、请求预处理、添加页面渲染骨架等。
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: 别名
3
- sidebar_position: 8
2
+ sidebar_position: 3
4
3
  ---
5
- # 别名
4
+
5
+ # 路径别名
6
6
 
7
7
  Modern.js 允许在 JS 和 CSS 中使用别名导入自定义目录下的模块,并内置了以下别名:
8
8
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 2
3
3
  ---
4
4
 
5
- # CSS 开发方案
5
+ # 样式开发
6
6
 
7
7
  Modern.js 内置多种常用的 CSS 开发方案,包括 Less / Sass / Stylus 预处理器、PostCSS、CSS Modules、CSS-in-JS 和 Tailwind CSS。
8
8
 
@@ -119,12 +119,10 @@ export default {
119
119
  './config/html/**/*.{html,ejs,hbs}',
120
120
  './storybook/**/*',
121
121
  ],
122
- // 主题配置(可选)
123
- theme: {},
124
122
  };
125
123
  ```
126
124
 
127
- 3. 在 `modern.config.ts` 中引用你创建的 `tailwind.config.ts` 文件,使 Modern.js 可以正确识别 Tailwind CSS 配置内容。
125
+ 3. 在 `modern.config.ts` 中通过 [tools.tailwindcss](/configure/app/tools/tailwindcss) 引用你创建的 `tailwind.config.ts` 文件,使 Modern.js 可以正确识别 Tailwind CSS 配置内容。
128
126
 
129
127
  ```ts title="modern.config.ts"
130
128
  import tailwindConfig from './tailwind.config';
@@ -133,17 +131,9 @@ export default defineConfig({
133
131
  tools: {
134
132
  tailwindcss: tailwindConfig,
135
133
  },
136
- // 主题配置(可选)
137
- source: {
138
- designSystem: tailwindConfig.theme,
139
- },
140
134
  });
141
135
  ```
142
136
 
143
- 请阅读相关配置项的文档来了解其作用:
144
-
145
- - [tools.tailwindcss](/configure/app/tools/tailwindcss)。
146
- - [source.designSystem](/configure/app/source/design-system)。
147
137
 
148
138
  ### Tailwind CSS 版本
149
139
 
@@ -162,39 +152,3 @@ Tailwind CSS v2 和 v3 均不支持 IE 11 浏览器,相关背景请参考:
162
152
  - [Tailwind CSS v2 - Browser Support](https://v2.tailwindcss.com/docs/browser-support)
163
153
 
164
154
  如果你在 IE 11 浏览器上使用 Tailwind CSS,可能会出现部分样式不可用的现象,请谨慎使用。
165
-
166
- ### Theme 配置
167
-
168
- 当需要自定义 Tailwind CSS 的 [theme](https://tailwindcss.com/docs/theme) 配置的时候,可以在配置 [`source.designSystem`](/configure/app/source/design-system) 中修改,例如,颜色主题中增加一个 `primary`:
169
-
170
- ```ts title="modern.config.ts"
171
- export default defineConfig({
172
- source: {
173
- designSystem: {
174
- extend: {
175
- colors: {
176
- primary: '#5c6ac4',
177
- },
178
- },
179
- },
180
- },
181
- });
182
- ```
183
-
184
- 当需要对 Tailwind CSS 做 [theme](https://tailwindcss.com/docs/theme) 以外的其他特殊配置时,可以在 [`tools.tailwindcss`](/configure/app/tools/tailwindcss) 中配置,例如设置 `variants`:
185
-
186
- ```ts title="modern.config.ts"
187
- export default defineConfig({
188
- tools: {
189
- tailwindcss: {
190
- variants: {
191
- extend: {
192
- backgroundColor: ['active'],
193
- },
194
- },
195
- },
196
- },
197
- });
198
- ```
199
-
200
- > 当你为项目配置 Tailwind CSS 的时候,[source.designSystem](/configure/app/source/design-system) 和 [tools.tailwindcss](/configure/app/tools/tailwindcss) 这两个配置的组合等价于单独配置了一个 `tailwindcss.config.js` 文件。其中 [source.designSystem](/configure/app/source/design-system) 等效于 Tailwind CSS 的 [theme](https://v2.tailwindcss.com/docs/configuration#theme) 配置。
@@ -1,6 +1,5 @@
1
1
  ---
2
- title: 数据获取
3
- sidebar_position: 3
2
+ sidebar_position: 4
4
3
  ---
5
4
 
6
5
  # 数据获取
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: 环境变量
3
2
  sidebar_position: 7
4
3
  ---
4
+
5
5
  # 环境变量
6
6
 
7
7
  Modern.js 提供了对环境变量的支持,包含内置的环境变量和自定义的环境变量。
@@ -1,7 +1,7 @@
1
1
  ---
2
- title: 数据模拟
3
- sidebar_position: 6
2
+ sidebar_position: 5
4
3
  ---
4
+
5
5
  # 数据模拟
6
6
 
7
7
  Modern.js 提供了快速生成 Mock 数据的功能,能够让前端独立自主开发,不被后端接口阻塞。
@@ -1,8 +1,8 @@
1
1
  ---
2
- title: 代理
3
- sidebar_position: 5
2
+ sidebar_position: 6
4
3
  ---
5
- # 代理
4
+
5
+ # 网络代理
6
6
 
7
7
  ## 本地代理
8
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: 路由
3
2
  sidebar_position: 1
4
3
  ---
5
4
 
6
- # 路由
5
+ # 路由方案
7
6
 
8
7
  Modern.js 的路由基于 [React Router 6](https://reactrouter.com/en/main),并提供了多种类型的路由模式。根据不同 [入口](/guides/concept/entries) 类型,将路由分为三种模式,分别是**约定式路由**,**自控式路由**和**其他路由方案**。
9
8
 
@@ -16,7 +16,7 @@ Modern.js Builder 是 Modern.js 体系的核心组件之一,它是一个面向
16
16
  - 通用构建引擎:Modern.js Builder。
17
17
  - 底层打包工具:webpack 和 Rspack。
18
18
 
19
- <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-1117.png" style={{ width: '100%', maxWidth: '540px' }} />
19
+ <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/builder-layers-0824.png" style={{ width: '100%', maxWidth: '540px' }} />
20
20
 
21
21
  ## 构建文档
22
22
 
@@ -2,7 +2,7 @@
2
2
  sidebar_position: 1
3
3
  ---
4
4
 
5
- # 入口
5
+ # 页面入口
6
6
 
7
7
  通过本章节,你可以了解到 Modern.js 中的入口约定,以及如何自定义入口。
8
8
 
@@ -114,7 +114,7 @@ import EntryMode from '@site-docs/components/entry-mode.mdx';
114
114
 
115
115
  上述目录中,`layout.tsx` 中导出的组件会作为最外层的组件,`page.tsx` 中导出的组件会作为 `/` 路由的组件。
116
116
 
117
- 详细内容可以参考[路由](/guides/basic-features/routes#约定式路由)。
117
+ 详细内容可以参考[路由方案](/guides/basic-features/routes#约定式路由)。
118
118
 
119
119
  #### 自控式路由
120
120
 
@@ -135,7 +135,7 @@ export default () => {
135
135
  };
136
136
  ```
137
137
 
138
- 详细内容可以参考[路由](/guides/basic-features/routes#自控式路由)。
138
+ 详细内容可以参考[路由方案](/guides/basic-features/routes#自控式路由)。
139
139
 
140
140
  #### 自定义 Bootstrap
141
141
 
@@ -1,9 +1,8 @@
1
1
  ---
2
- title: 升级
3
2
  sidebar_position: 3
4
3
  ---
5
4
 
6
- # 升级
5
+ # 版本升级
7
6
 
8
7
  ## 通过命令行升级
9
8
 
package/package.json CHANGED
@@ -15,14 +15,14 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.32.0",
18
+ "version": "2.32.1",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "peerDependencies": {
25
- "@modern-js/builder-doc": "^2.32.0"
25
+ "@modern-js/builder-doc": "^2.32.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "classnames": "^2",
@@ -34,9 +34,9 @@
34
34
  "fs-extra": "^10",
35
35
  "@types/node": "^16",
36
36
  "@types/fs-extra": "^9",
37
- "@modern-js/builder-doc": "2.32.0",
38
- "@modern-js/doc-tools": "2.32.0",
39
- "@modern-js/doc-plugin-auto-sidebar": "2.32.0"
37
+ "@modern-js/builder-doc": "2.32.1",
38
+ "@modern-js/doc-tools": "2.32.1",
39
+ "@modern-js/doc-plugin-auto-sidebar": "2.32.1"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "modern dev",
package/src/i18n/enUS.ts CHANGED
@@ -18,7 +18,7 @@ export const EN_US = {
18
18
  feature4: 'Multi-Rendering Mode',
19
19
  featureDesc4: 'SSR, SSG, SPR, all out of the box for you.',
20
20
  feature5: 'CSS Solutions',
21
- featureDesc5: 'CSS Modules, CSS-in-JS, TailwindCSS, take your pick.',
21
+ featureDesc5: 'CSS Modules, CSS-in-JS, Tailwind CSS, take your pick.',
22
22
  feature6: 'Easy to Configure',
23
23
  featureDesc6:
24
24
  'Launch with zero configuration, then everything is configurable.',
package/src/i18n/zhCN.ts CHANGED
@@ -19,7 +19,7 @@ export const ZH_CN: Record<keyof typeof EN_US, string> = {
19
19
  feature4: '多渲染模式',
20
20
  featureDesc4: 'SSR、SSG、SPR 等多种渲染模式,通通开箱即用。',
21
21
  feature5: 'CSS 方案',
22
- featureDesc5: 'CSS Modules、CSS-in-JS、TailwindCSS,任你挑选。',
22
+ featureDesc5: 'CSS Modules、CSS-in-JS、Tailwind CSS,任你挑选。',
23
23
  feature6: '易于配置',
24
24
  featureDesc6: '以零配置启动,然后一切皆可配置。',
25
25