@modern-js/main-doc 2.31.2 → 2.32.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +13 -0
- package/LICENSE +1 -1
- package/docs/en/components/enable-bff-caution.mdx +1 -1
- package/docs/en/configure/app/auto-load-plugin.mdx +2 -2
- package/docs/en/configure/app/bff/_category_.json +1 -1
- package/docs/en/configure/app/builder-plugins.mdx +2 -2
- package/docs/en/configure/app/dev/_category_.json +1 -1
- package/docs/en/configure/app/experiments/_category_.json +1 -1
- package/docs/en/configure/app/html/_category_.json +1 -1
- package/docs/en/configure/app/output/_category_.json +1 -1
- package/docs/en/configure/app/output/ssg.mdx +1 -1
- package/docs/en/configure/app/plugins.mdx +0 -1
- package/docs/en/configure/app/runtime/_category_.json +1 -1
- package/docs/en/configure/app/security/_category_.json +1 -1
- package/docs/en/configure/app/server/_category_.json +1 -1
- package/docs/en/configure/app/source/_category_.json +1 -1
- package/docs/en/configure/app/source/design-system.mdx +4 -4
- package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
- package/docs/en/configure/app/source/mainEntryName.mdx +1 -1
- package/docs/en/configure/app/testing/_category_.json +1 -1
- package/docs/en/configure/app/tools/_category_.json +1 -1
- package/docs/en/configure/app/tools/tailwindcss.mdx +5 -12
- package/docs/en/configure/app/usage.mdx +1 -3
- package/docs/en/guides/advanced-features/bff/_category_.json +1 -1
- package/docs/en/guides/advanced-features/code-split.mdx +2 -2
- package/docs/en/guides/advanced-features/eslint.mdx +2 -2
- package/docs/en/guides/advanced-features/low-level.mdx +2 -2
- package/docs/en/guides/advanced-features/ssg.mdx +2 -3
- package/docs/en/guides/advanced-features/ssr.mdx +2 -3
- package/docs/en/guides/advanced-features/testing.mdx +3 -3
- package/docs/en/guides/advanced-features/using-storybook.mdx +1 -1
- package/docs/en/guides/advanced-features/web-server.mdx +2 -2
- package/docs/en/guides/basic-features/alias.mdx +3 -3
- package/docs/en/guides/basic-features/css.mdx +33 -38
- package/docs/en/guides/basic-features/data-fetch.mdx +2 -2
- package/docs/en/guides/basic-features/env-vars.mdx +2 -2
- package/docs/en/guides/basic-features/html.mdx +0 -1
- package/docs/en/guides/basic-features/mock.mdx +3 -3
- package/docs/en/guides/basic-features/proxy.mdx +3 -3
- package/docs/en/guides/basic-features/routes.mdx +1 -2
- package/docs/en/guides/concept/builder.mdx +2 -2
- package/docs/en/guides/concept/entries.mdx +1 -1
- package/docs/en/guides/get-started/upgrade.mdx +1 -2
- package/docs/zh/community/releases.mdx +1 -1
- package/docs/zh/community/team.mdx +1 -1
- package/docs/zh/components/enable-bff-caution.mdx +2 -2
- package/docs/zh/configure/app/auto-load-plugin.mdx +2 -3
- package/docs/zh/configure/app/bff/_category_.json +2 -2
- package/docs/zh/configure/app/builder-plugins.mdx +2 -3
- package/docs/zh/configure/app/deploy/_category_.json +1 -1
- package/docs/zh/configure/app/dev/_category_.json +2 -2
- package/docs/zh/configure/app/experiments/_category_.json +2 -2
- package/docs/zh/configure/app/html/_category_.json +2 -2
- package/docs/zh/configure/app/output/_category_.json +2 -2
- package/docs/zh/configure/app/output/ssg.mdx +1 -1
- package/docs/zh/configure/app/performance/_category_.json +1 -1
- package/docs/zh/configure/app/plugins.mdx +1 -2
- package/docs/zh/configure/app/runtime/_category_.json +2 -2
- package/docs/zh/configure/app/security/_category_.json +2 -2
- package/docs/zh/configure/app/server/_category_.json +2 -2
- package/docs/zh/configure/app/source/_category_.json +2 -2
- package/docs/zh/configure/app/source/design-system.mdx +1 -1
- package/docs/zh/configure/app/testing/_category_.json +2 -2
- package/docs/zh/configure/app/tools/_category_.json +2 -2
- package/docs/zh/configure/app/tools/tailwindcss.mdx +6 -13
- package/docs/zh/configure/app/usage.mdx +1 -3
- package/docs/zh/guides/advanced-features/bff/_category_.json +1 -1
- package/docs/zh/guides/advanced-features/code-split.mdx +2 -2
- package/docs/zh/guides/advanced-features/compatibility.mdx +1 -1
- package/docs/zh/guides/advanced-features/eslint.mdx +1 -1
- package/docs/zh/guides/advanced-features/low-level.mdx +2 -2
- package/docs/zh/guides/advanced-features/rspack-start.mdx +0 -1
- package/docs/zh/guides/advanced-features/ssg.mdx +3 -4
- package/docs/zh/guides/advanced-features/ssr.mdx +2 -3
- package/docs/zh/guides/advanced-features/testing.mdx +2 -2
- package/docs/zh/guides/advanced-features/using-storybook.mdx +1 -1
- package/docs/zh/guides/advanced-features/web-server.mdx +2 -2
- package/docs/zh/guides/basic-features/alias.mdx +3 -3
- package/docs/zh/guides/basic-features/css.mdx +34 -38
- package/docs/zh/guides/basic-features/data-fetch.mdx +1 -2
- package/docs/zh/guides/basic-features/env-vars.mdx +1 -1
- package/docs/zh/guides/basic-features/mock.mdx +2 -2
- package/docs/zh/guides/basic-features/proxy.mdx +3 -3
- package/docs/zh/guides/basic-features/routes.mdx +1 -2
- package/docs/zh/guides/concept/builder.mdx +1 -1
- package/docs/zh/guides/concept/entries.mdx +3 -3
- package/docs/zh/guides/get-started/upgrade.mdx +1 -2
- package/package.json +5 -5
- package/src/i18n/enUS.ts +1 -1
- package/src/i18n/zhCN.ts +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
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
|
+
|
9
|
+
## 2.32.0
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- Updated dependencies [0cc3981]
|
14
|
+
- @modern-js/builder-doc@2.32.0
|
15
|
+
|
3
16
|
## 2.31.2
|
4
17
|
|
5
18
|
### Patch Changes
|
package/LICENSE
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
:::caution
|
2
|
-
Please
|
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
|
:::
|
@@ -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 [
|
13
|
+
For more routes detail, see [Routing](/guides/basic-features/routes).
|
14
14
|
|
15
15
|
:::
|
16
16
|
|
@@ -648,7 +648,7 @@ const designSystem = {
|
|
648
648
|
</details>
|
649
649
|
|
650
650
|
:::tip
|
651
|
-
For more information on
|
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
|
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
|
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
|
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
|
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
|
|
@@ -10,17 +10,10 @@ sidebar_label: tailwindcss
|
|
10
10
|
```js
|
11
11
|
const tailwind = {
|
12
12
|
content: [
|
13
|
-
'./
|
14
|
-
'./config/html/**/*.ejs',
|
15
|
-
'./config/html/**/*.hbs',
|
16
|
-
'./src/**/*.js',
|
17
|
-
'./src/**/*.jsx',
|
18
|
-
'./src/**/*.ts',
|
19
|
-
'./src/**/*.tsx',
|
13
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
14
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
20
15
|
'./storybook/**/*',
|
21
16
|
],
|
22
|
-
// Use source.design System config as Tailwind CSS theme config
|
23
|
-
theme: source.designSystem,
|
24
17
|
};
|
25
18
|
```
|
26
19
|
|
@@ -56,8 +49,8 @@ export default {
|
|
56
49
|
};
|
57
50
|
```
|
58
51
|
|
59
|
-
###
|
52
|
+
### Notes
|
60
53
|
|
61
|
-
|
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`.
|
62
55
|
|
63
|
-
|
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.
|
@@ -203,9 +203,7 @@ When using `modern.config.local.ts`, please note the following:
|
|
203
203
|
- As `modern.config.local.ts` is only used for local debugging, it is not recommended to commit it to the repository, please ensure that the project's `.gitignore` file contains `modern.config.local.ts`.
|
204
204
|
|
205
205
|
```bash title=".gitingore"
|
206
|
-
modern.config.local
|
207
|
-
modern.config.local.js
|
208
|
-
modern.config.local.mjs
|
206
|
+
modern.config.local.*
|
209
207
|
```
|
210
208
|
|
211
209
|
## Merge Multiple Configurations
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
|
-
|
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 [
|
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
|
-
|
3
|
-
sidebar_position: 3
|
2
|
+
sidebar_position: 4
|
4
3
|
---
|
5
4
|
|
6
|
-
# Server-
|
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,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
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.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
sidebar_position: 2
|
3
3
|
---
|
4
4
|
|
5
|
-
#
|
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
|
|
@@ -65,7 +65,7 @@ If you need to use other CSS-in-JS libraries such as [styled-jsx](https://www.np
|
|
65
65
|
|
66
66
|
Follow the steps below to make a selection:
|
67
67
|
|
68
|
-
```
|
68
|
+
```text
|
69
69
|
? Please select the operation you want: Enable features
|
70
70
|
? Please select the feature name: Enable Tailwind CSS
|
71
71
|
```
|
@@ -103,6 +103,37 @@ Depending on your needs, you can selectively import the CSS files provided by Ta
|
|
103
103
|
|
104
104
|
:::
|
105
105
|
|
106
|
+
### Tailwind CSS Autocomplete
|
107
|
+
|
108
|
+
Tailwind CSS provides an official extension called [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code.
|
109
|
+
|
110
|
+
You can follow the steps below to enable the autocompletion feature:
|
111
|
+
|
112
|
+
1. Install the [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) extension in VS Code.
|
113
|
+
2. Create a `tailwind.config.ts` file in the root directory of your project and write the desired Tailwind CSS configuration.
|
114
|
+
|
115
|
+
```ts title="tailwind.config.ts"
|
116
|
+
export default {
|
117
|
+
content: [
|
118
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
119
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
120
|
+
'./storybook/**/*',
|
121
|
+
],
|
122
|
+
};
|
123
|
+
```
|
124
|
+
|
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.
|
126
|
+
|
127
|
+
```ts title="modern.config.ts"
|
128
|
+
import tailwindConfig from './tailwind.config';
|
129
|
+
|
130
|
+
export default defineConfig({
|
131
|
+
tools: {
|
132
|
+
tailwindcss: tailwindConfig,
|
133
|
+
},
|
134
|
+
});
|
135
|
+
```
|
136
|
+
|
106
137
|
### Tailwind CSS Version
|
107
138
|
|
108
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.
|
@@ -120,39 +151,3 @@ Tailwind CSS v2 and v3 do not support the IE 11 browser, please refer to:
|
|
120
151
|
- [Tailwind CSS v2 - Browser Support](https://v2.tailwindcss.com/docs/browser-support)
|
121
152
|
|
122
153
|
If you use Tailwind CSS on IE 11 browser, some styles may not be available, please use it with caution.
|
123
|
-
|
124
|
-
### Theme Configuration
|
125
|
-
|
126
|
-
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:
|
127
|
-
|
128
|
-
```ts title="modern.config.ts"
|
129
|
-
export default defineConfig({
|
130
|
-
source: {
|
131
|
-
designSystem: {
|
132
|
-
extend: {
|
133
|
-
colors: {
|
134
|
-
primary: '#5c6ac4',
|
135
|
-
},
|
136
|
-
},
|
137
|
-
},
|
138
|
-
},
|
139
|
-
});
|
140
|
-
```
|
141
|
-
|
142
|
-
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`:
|
143
|
-
|
144
|
-
```ts title="modern.config.ts"
|
145
|
-
export default defineConfig({
|
146
|
-
tools: {
|
147
|
-
tailwindcss: {
|
148
|
-
variants: {
|
149
|
-
extend: {
|
150
|
-
backgroundColor: ['active'],
|
151
|
-
},
|
152
|
-
},
|
153
|
-
},
|
154
|
-
},
|
155
|
-
});
|
156
|
-
```
|
157
|
-
|
158
|
-
> 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,9 +1,8 @@
|
|
1
1
|
---
|
2
|
-
title: Routes
|
3
2
|
sidebar_position: 1
|
4
3
|
---
|
5
4
|
|
6
|
-
#
|
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
|
-
#
|
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-
|
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
|
|
@@ -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` 命令,参考 [
|
27
|
+
当你需要升级项目中的 Modern.js 版本时,可以使用 `modern upgrade` 命令,参考 [版本升级](/guides/get-started/upgrade)。
|
28
28
|
|
29
29
|
```bash
|
30
30
|
npx modern upgrade
|