@modern-js/main-doc 2.15.0 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @modern-js/main-doc
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 63b3538: fix: dev server crashed when prepare api handler failed
8
+
9
+ fix: 修复更新 api server 报错导致 dev server 退出的问题
10
+
11
+ - fe92de6: fix(builder): browserslist config should not affect node bundles
12
+
13
+ fix(builder): 修复 browserslist 配置会对 node 产物生效的问题
14
+
15
+ - 4e876ab: chore: package.json include the monorepo-relative directory
16
+
17
+ chore: 在 package.json 中声明 monorepo 的子路径
18
+
19
+ - Updated dependencies [fe92de6]
20
+ - Updated dependencies [4e876ab]
21
+ - @modern-js/builder-doc@2.16.0
22
+
3
23
  ## 2.15.0
4
24
 
5
25
  ### Patch Changes
@@ -0,0 +1,268 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # Contributing Guide
6
+
7
+ Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines.
8
+
9
+ ---
10
+
11
+ ## Setup the Dev Environment
12
+
13
+ ### Fork the Repo
14
+
15
+ [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your
16
+ own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local.
17
+
18
+ ### Install Node.js
19
+
20
+ We recommend using Node.js 16 or 18. You can check your currently used Node.js version with the following command:
21
+
22
+ ```bash
23
+ node -v
24
+ #v16.18.0
25
+ ```
26
+
27
+ If you do not have Node.js installed in your current environment, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install it.
28
+
29
+ Here is an example of how to install the Node.js 16 LTS version via nvm:
30
+
31
+ ```bash
32
+ # Install the LTS version of Node.js 16
33
+ nvm install 16 --lts
34
+
35
+ # Make the newly installed Node.js 16 as the default version
36
+ nvm alias default 16
37
+
38
+ # Switch to the newly installed Node.js 16
39
+ nvm use 16
40
+ ```
41
+
42
+ ### Install pnpm
43
+
44
+ ```sh
45
+ # Enable pnpm with corepack, only available on Node.js >= `v14.19.0`
46
+ corepack enable
47
+ ```
48
+
49
+ ### Install Dependencies
50
+
51
+ ```sh
52
+ pnpm install
53
+ ```
54
+
55
+ What this will do:
56
+
57
+ - Install all dependencies
58
+ - Create symlinks between packages in the monorepo
59
+ - Run the `prepare` script to build all packages (this will take some time, but is necessary to make ensure all packages are built)
60
+
61
+ > A full rebuild of all packages is generally not required after this. If a new feature you are developing requires an updated version of another package, it is usually sufficient to build the changed dependencies.
62
+
63
+ ### Set Git Email
64
+
65
+ Please make sure you have your email set up in `<https://github.com/settings/emails>`. This will be needed later when you want to submit a pull request.
66
+
67
+ Check that your git client is already configured the email:
68
+
69
+ ```sh
70
+ git config --list | grep email
71
+ ```
72
+
73
+ Set the email to global config:
74
+
75
+ ```sh
76
+ git config --global user.email "SOME_EMAIL@example.com"
77
+ ```
78
+
79
+ Set the email for local repo:
80
+
81
+ ```sh
82
+ git config user.email "SOME_EMAIL@example.com"
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Making Changes and Building
88
+
89
+ Once you have set up the local development environment in your forked repo, we can start development.
90
+
91
+ ### Checkout A New Branch
92
+
93
+ It is recommended to develop on a new branch, as it will make things easier later when you submit a pull request:
94
+
95
+ ```sh
96
+ git checkout -b MY_BRANCH_NAME
97
+ ```
98
+
99
+ ### Build the Package
100
+
101
+ To build the package you want to change, first open the package directory, then run the `build` command:
102
+
103
+ ```sh
104
+ # Replace some-path with the path of the package you want to work on
105
+ cd ./packages/some-path
106
+ pnpm run build
107
+ ```
108
+
109
+ Alternatively, you can build the package from the root directory of the repository using the `--filter` option:
110
+
111
+ ```sh
112
+ pnpm run --filter @modern-js/some-package build
113
+ ```
114
+
115
+ Build all packages:
116
+
117
+ ```sh
118
+ pnpm run prepare
119
+ ```
120
+
121
+ If you need to clean all `node_modules/*` in the project, run the `reset` command:
122
+
123
+ ```sh
124
+ pnpm run reset
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Testing
130
+
131
+ ### Add New Tests
132
+
133
+ If you've fixed a bug or added code that should be tested, then add some tests.
134
+
135
+ You can add unit test cases in the `<PACKAGE_DIR>/tests` folder. The test syntax is based on [Jest](https://jestjs.io/) and [Vitest](https://vitest.dev/).
136
+
137
+ ### Run Unit Tests
138
+
139
+ Before submitting a pull request, it's important to make sure that the changes haven't introduced any regressions or bugs. You can run the unit tests for the project by executing the following command:
140
+
141
+ ```sh
142
+ pnpm run test
143
+ ```
144
+
145
+ Alternatively, you can run the unit tests of single package using the `--filter` option:
146
+
147
+ ```sh
148
+ pnpm run --filter @modern-js/some-package test
149
+ ```
150
+
151
+ ### Run E2E Tests
152
+
153
+ In addition to the unit tests, the Modern.js also includes end-to-end (E2E) tests, which checks the functionality of the application as a whole.
154
+
155
+ You can run the `test:e2e` command to run the E2E tests:
156
+
157
+ ```sh
158
+ pnpm run test:e2e
159
+ ```
160
+
161
+ If you need to run a specified test, you can add keywords to filter:
162
+
163
+ ```sh
164
+ # Only run test cases with the copy-assets keyword
165
+ npx jest copy-assets
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Linting
171
+
172
+ To help maintain consistency and readability of the codebase, we use a ESLint to lint the codes.
173
+
174
+ You can run the Linter by executing the following command:
175
+
176
+ ```sh
177
+ pnpm run lint
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Documentation
183
+
184
+ Currently Modern.js provides documentation in English and Chinese. If you can use Chinese, please update both documents at the same time. Otherwise, just update the English documentation.
185
+
186
+ You can find all the documentation in the `packages/document` folder:
187
+
188
+ ```bash
189
+ root
190
+ └─ packages
191
+ └─ document
192
+ ├─ builder-doc # Documentation for Modern.js Builder
193
+ ├─ doc-tools-doc # Documentation for Modern.js Doc
194
+ ├─ main-doc # Documentation for Modern.js Framework
195
+ └─ module-doc # Documentation for Modern.js Module
196
+ ```
197
+
198
+ This website is built with [Modern.js Doc](https://modernjs.dev/doc-tools), the document content can be written using markdown or mdx syntax. You can refer to the [Modern.js Doc Website](https://modernjs.dev/doc-tools) for detailed usage.
199
+
200
+ The source code of Modern.js Doc can be found in [this folder](https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/doc-tools).
201
+
202
+ ---
203
+
204
+ ## Submitting Changes
205
+
206
+ ### Add a Changeset
207
+
208
+ Modern.js is using [Changesets](https://github.com/changesets/changesets) to manage the versioning and changelogs.
209
+
210
+ If you've changed some packages, you need add a new changeset for the changes. Please run `change` command to select the changed packages and add the changeset info.
211
+
212
+ ```sh
213
+ pnpm run change
214
+ ```
215
+
216
+ ### Committing your Changes
217
+
218
+ Commit your changes to your forked repo, and [create a pull request](https://help.github.com/articles/creating-a-pull-request/).
219
+
220
+ ### Format of PR titles
221
+
222
+ The format of PR titles follow Conventional Commits.
223
+
224
+ An example:
225
+
226
+ ```
227
+ feat(plugin-swc): Add `xxx` config
228
+ ^ ^ ^
229
+ | | |__ Subject
230
+ | |_______ Scope
231
+ |____________ Type
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Publishing
237
+
238
+ We use **Modern.js Monorepo Solution** to manage version and changelog.
239
+
240
+ Repository maintainers can publish a new version of all packages to npm.
241
+
242
+ Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
243
+
244
+ 1. Pull latest code from the `main` branch.
245
+ 2. Install:
246
+
247
+ ```sh
248
+ pnpm i
249
+ ```
250
+
251
+ 3. Build packages:
252
+
253
+ ```sh
254
+ pnpm run prepare
255
+ ```
256
+
257
+ 4. Bump version:
258
+
259
+ ```sh
260
+ pnpm run bump
261
+ ```
262
+
263
+ 5. Commit the version change.
264
+
265
+ ```sh
266
+ git add .
267
+ git commit -m "Release va.b.c"
268
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # Releases
6
+
7
+ ## Changelog
8
+
9
+ Please visit [GitHub - Releases](https://github.com/web-infra-dev/modern.js/releases) to see what has changed with each release of Modern.js.
10
+
11
+ ## Version Specification
12
+
13
+ Modern.js follows the [Semantic Versioning](https://semver.org) specification.
14
+
15
+ - Major version: Contains incompatible API changes.
16
+ - Minor version: Contains backward compatible functional changes.
17
+ - Patch version: Contains backwards compatible bug fixes
18
+
19
+ ## Release Cycle
20
+
21
+ - Modern.js generally releases an official release every Thursday.
22
+ - If critical bugs appear, we will release a revised version on the same day.
23
+ - We expect to keep Modern.js v2 stable and compatible, there are currently no plans to release the next major version.
24
+
25
+ ## Version Upgrade
26
+
27
+ When you need to upgrade the Modern.js version in your project, you can use the `modern upgrade` command, refer to [Upgrade](/guides/get-started/upgrade).
28
+
29
+ ```bash
30
+ npx modern upgrade
31
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ sidebar_position: 0
3
+ ---
4
+
5
+ # Showcase
6
+
7
+ Welcome to the Modern.js showcase page! Here, we present a collection of websites that have been built using Modern.js.
8
+
9
+ If you have built a website using Modern.js, we would love for you to share it with the community. Simply reply to the GitHub discussion thread with a link to your website. We will collect content on a regular basis and display it on the current page.
10
+
11
+ ## The Cases
12
+
13
+ import { ShowcaseList } from '@site/src/components/ShowcaseList';
14
+
15
+ <ShowcaseList />
@@ -0,0 +1,29 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Meet the Team
6
+
7
+ The development of Modern.js is driven by ByteDance's Modern.js team and community contributors.
8
+
9
+ ## Core Team Members
10
+
11
+ The Modern.js core team members:
12
+
13
+ import { RandomMemberList } from '@site/src/components/RandomMemberList';
14
+
15
+ <RandomMemberList />
16
+
17
+ ## All Contributors
18
+
19
+ Thanks to the following friends for their contributions to Modern.js:
20
+
21
+ <a
22
+ href="https://github.com/web-infra-dev/modern.js/graphs/contributors"
23
+ style={{ display: 'block', marginTop: 24 }}
24
+ >
25
+ <img
26
+ src="https://opencollective.com/modernjs/contributors.svg?width=890&button=false"
27
+ alt="contributors"
28
+ />
29
+ </a>
@@ -0,0 +1,13 @@
1
+ ---
2
+ sidebar_label: disableSvgr
3
+ ---
4
+
5
+ # output.disableSvgr
6
+
7
+ :::tip
8
+ This config is provided by Modern.js Builder, more detail can see [output.disableSvgr](https://modernjs.dev/builder/en/api/config-output.html#outputdisablesvgr).
9
+ :::
10
+
11
+ import Main from '@modern-js/builder-doc/docs/en/config/output/disableSvgr.md';
12
+
13
+ <Main />
@@ -0,0 +1,267 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # 贡献指南
6
+
7
+ 感谢你有兴趣为 Modern.js 做贡献!在开始你的贡献之前,请花几分钟时间阅读以下指南。
8
+
9
+ ---
10
+
11
+ ## 设置开发环境
12
+
13
+ ### Fork 仓库
14
+
15
+ [Fork](https://help.github.com/articles/fork-a-repo/) Modern.js 仓库到你的 GitHub 账户,然后 [clone](https://help.github.com/articles/cloning-a-repository/) 到你的本地。
16
+
17
+ ### 安装 Node.js
18
+
19
+ 我们推荐使用 Node.js 16 或 18。你可以通过以下命令查看当前使用的 Node.js 版本:
20
+
21
+ ```bash
22
+ node -v
23
+ #v16.18.0
24
+ ```
25
+
26
+ 如果你当前环境没有安装 Node.js,可以使用 [nvm](https://github.com/nvm-sh/nvm)或者 [fnm](https://github.com/Schniz/fnm) 来安装它。
27
+
28
+ 以下是如何通过 nvm 安装 Node.js 16 LTS 版本的示例:
29
+
30
+ ```bash
31
+ # 安装 Node.js 16 的 LTS 版本
32
+ nvm install 16 --lts
33
+
34
+ # 将新安装的 Node.js 16 设为默认版本
35
+ nvm alias default 16
36
+
37
+ # 切换到新安装的 Node.js 16
38
+ nvm use 16
39
+ ```
40
+
41
+ ### 安装 pnpm
42
+
43
+ ```bash
44
+ # 使用 corepack 启用 pnpm,仅在 Node.js >= `v14.19.0` 上可用
45
+ corepack enable
46
+ ```
47
+
48
+ ### 安装依赖
49
+
50
+ ```sh
51
+ pnpm install
52
+ ```
53
+
54
+ 这将完成:
55
+
56
+ - 安装所有依赖项
57
+ - 在 monorepo 中的 packages 之间创建 symlinks
58
+ - 运行 `prepare` 脚本来构建所有包(这将需要一些时间,但可以保证所有包都被正确构建)
59
+
60
+ > 在此之后,你通常不需要一次性构建所有 packages。如果你正在开发的新功能依赖另一个 package 的最新代码,通常只构建指定的 package 就足够了。
61
+
62
+ ### 设置 Git 邮箱
63
+
64
+ 请确保在 `<https://github.com/settings/emails>` 中设置了电子邮件,当你提交 Pull Request 时将需要它。
65
+
66
+ 检查你的 git 客户端是否已配置邮箱:
67
+
68
+ ```sh
69
+ git config --list | grep email
70
+ ```
71
+
72
+ 全局设置邮箱:
73
+
74
+ ```sh
75
+ git config --global user.email "SOME_EMAIL@example.com"
76
+ ```
77
+
78
+ 针对本地仓库设置邮箱:
79
+
80
+ ```sh
81
+ git config user.email "SOME_EMAIL@example.com"
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 代码变更和构建
87
+
88
+ 当你在 fork 的仓库中设置完本地开发环境后,我们就可以开始开发了。
89
+
90
+ ### 创建一个新分支
91
+
92
+ 建议在一个新的分支上开发,这样便于后续提交 pull request:
93
+
94
+ ```sh
95
+ git checkout -b MY_BRANCH_NAME
96
+ ```
97
+
98
+ ### 构建 Package
99
+
100
+ 要构建你要更改的 package,首先打开 package 目录,然后执行 `build` 命令:
101
+
102
+ ```sh
103
+ # 将 some-path 替换为你要构建的 package 的路径
104
+ cd ./packages/some-package
105
+ pnpm run build
106
+ ```
107
+
108
+ 此外,你可以使用 `--filter` 选项从仓库根目录来构建指定的 package:
109
+
110
+ ```sh
111
+ pnpm run --filter @modern-js/some-package build
112
+ ```
113
+
114
+ 构建所有包:
115
+
116
+ ```sh
117
+ pnpm run prepare
118
+ ```
119
+
120
+ 如果你需要清理项目中的所有 `node_modules/*`,执行 `reset` 命令:
121
+
122
+ ```sh
123
+ pnpm 运行重置
124
+ ```
125
+
126
+ ---
127
+
128
+ ## 测试
129
+
130
+ ### 添加新测试
131
+
132
+ 如果你进行了 bugfix,或者添加了需要测试的代码,请添加一些测试代码。
133
+
134
+ 你可以在 `<PACKAGE_DIR>/tests` 文件夹中添加单元测试用例。测试语法基于 [Jest](https://jestjs.io/) 和 [Vitest](https://vitest.dev/)。
135
+
136
+ ### 运行单元测试
137
+
138
+ 在提交 pull request 之前,为了确保本次变更没有引入缺陷,你可以通过执行以下命令运行单元测试:
139
+
140
+ ```sh
141
+ pnpm run test
142
+ ```
143
+
144
+ 你也可以使用 `--filter` 选项运行单个包的单元测试:
145
+
146
+ ```sh
147
+ pnpm run --filter @modern-js/some-package test
148
+ ```
149
+
150
+ ### 运行 E2E 测试
151
+
152
+ 除了单元测试之外,Modern.js 仓库还包括端到端 (E2E) 测试,用于检查整个应用程序的功能。
153
+
154
+ 你可以执行 `test:e2e` 命令来运行 E2E 测试:
155
+
156
+ ```sh
157
+ pnpm run test:e2e
158
+ ```
159
+
160
+ 如果需要运行指定的测试,可以添加关键字进行过滤:
161
+
162
+ ```sh
163
+ # 只运行带有 copy-assets 关键词的测试用例
164
+ npx jest copy-assets
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Linting
170
+
171
+ 为了帮助保持代码风格的一致性和可读性,我们使用 ESLint 对代码进行校验。
172
+
173
+ 你可以执行以下命令来运行 Linter:
174
+
175
+ ```sh
176
+ pnpm run lint
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 文档
182
+
183
+ 目前 Modern.js 提供英文和中文文档。如果你熟悉中文,请同时更新中英文文档。否则,只需更新英文文档即可。
184
+
185
+ 你可以在 `packages/document` 文件夹中找到所有文档:
186
+
187
+ ```sh
188
+ root
189
+ └─ packages
190
+ └─ document
191
+ ├─ builder-doc # Modern.js Builder 文档
192
+ ├─ doc-tools-doc # Modern.js Doc 文档
193
+ ├─ main-doc # Modern.js Framework 文档
194
+ └─ module-doc # Modern.js Module 文档
195
+ ```
196
+
197
+ 文档站使用 [Modern.js Doc](https://modernjs.dev/doc-tools) 构建,文档内容可以使用 markdown 或 mdx 语法编写。详细使用方法可以参考 [Modern.js Doc 文档](https://modernjs.dev/doc-tools)。
198
+
199
+ Modern.js Doc 的源代码可以在 [这个文件夹](https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/doc-tools) 中找到。
200
+
201
+ ---
202
+
203
+ ## 提交变更
204
+
205
+ ### 添加 Changeset
206
+
207
+ Modern.js 使用 [Changesets](https://github.com/changesets/changesets) 来管理版本和 Changelog。
208
+
209
+ 如果你修改了一些包,则需要为本次变更添加一个新的变更集。请运行 `change` 命令来选择更改的包并添加 changeset 信息。
210
+
211
+ ```sh
212
+ pnpm run change
213
+ ```
214
+
215
+ ### 提交你的变更
216
+
217
+ 提交变更到 fork 后的仓库,并 [创建 pull request](https://help.github.com/articles/creating-a-pull-request/)。
218
+
219
+ ### PR 标题格式
220
+
221
+ PR 标题的格式遵循 Conventional Commits。
222
+
223
+ 一个例子:
224
+
225
+ ```
226
+ feat(plugin-swc): 添加 `xxx` 配置项
227
+ ^ ^ ^
228
+ | | |__ 主题
229
+ | |_______ 范围
230
+ |____________ 类型
231
+ ```
232
+
233
+ ---
234
+
235
+ ## 发布
236
+
237
+ Modern.js 使用 [Changesets](https://github.com/changesets/changesets) 来管理版本和 changelog。
238
+
239
+ 仓库的维护者可以将所有包的新版本发布到 npm。
240
+
241
+ 以下是发布的步骤(我们通常使用 CI 进行发布,并避免在本地发布 npm 包):
242
+
243
+ 1. 拉取 `main` 分支的最新代码。
244
+ 2. 安装依赖:
245
+
246
+ ```sh
247
+ pnpm i
248
+ ```
249
+
250
+ 3. 构建 packages:
251
+
252
+ ```sh
253
+ pnpm prepare
254
+ ```
255
+
256
+ 4. 升级版本:
257
+
258
+ ```sh
259
+ pnpm run bump
260
+ ```
261
+
262
+ 5. 提交版本变更。
263
+
264
+ ```sh
265
+ git add .
266
+ git commit -m "Release va.b.c"
267
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # 版本发布
6
+
7
+ ## 更新日志
8
+
9
+ 请访问 [GitHub - Release](https://github.com/web-infra-dev/modern.js/releases) 来了解 Modern.js 每个版本的变更内容。
10
+
11
+ ## 版本规范
12
+
13
+ Modern.js 遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/) 语义化版本规范。
14
+
15
+ - 主版本号:包含不兼容的 API 变更。
16
+ - 次版本号:包含向下兼容的功能性变更。
17
+ - 修订号:包含向下兼容的问题修正。
18
+
19
+ ## 发版周期
20
+
21
+ - Modern.js 通常在每周四发布一个正式版本。
22
+ - 当出现较为严重的问题时,我们会在当天发布修订版本。
23
+ - 我们期望保持 Modern.js v2 的稳定和兼容,目前没有发布下一个 Major 版本的计划。
24
+
25
+ ## 版本升级
26
+
27
+ 当你需要升级项目中的 Modern.js 版本时,可以使用 `modern upgrade` 命令,参考 [升级](/guides/get-started/upgrade)。
28
+
29
+ ```bash
30
+ npx modern upgrade
31
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ sidebar_position: 0
3
+ ---
4
+
5
+ # 案例展示
6
+
7
+ 欢迎来到 Modern.js 的案例展示页面!在这里,我们展示了一些基于 Modern.js 所实现的网站。
8
+
9
+ 如果你使用 Modern.js 构建了一个网站,欢迎你与社区分享它。只需回复 [GitHub 讨论贴](https://github.com/web-infra-dev/modern.js/discussions/3554) 并附上你网站的链接即可。我们会定期收集内容,并将它们展示在当前页面。
10
+
11
+ ## 案例
12
+
13
+ import { ShowcaseList } from '@site/src/components/ShowcaseList';
14
+
15
+ <ShowcaseList />
@@ -0,0 +1,29 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # 团队
6
+
7
+ Modern.js 的开发由字节跳动的 Modern.js 团队和社区贡献者驱动。
8
+
9
+ ## 核心团队成员
10
+
11
+ 以下是 Modern.js 团队的核心成员:
12
+
13
+ import { RandomMemberList } from '@site/src/components/RandomMemberList';
14
+
15
+ <RandomMemberList />
16
+
17
+ ## 所有贡献者
18
+
19
+ 感谢以下伙伴们为 Modern.js 做出的贡献:
20
+
21
+ <a
22
+ href="https://github.com/web-infra-dev/modern.js/graphs/contributors"
23
+ style={{ display: 'block', marginTop: 24 }}
24
+ >
25
+ <img
26
+ src="https://opencollective.com/modernjs/contributors.svg?width=890&button=false"
27
+ alt="contributors"
28
+ />
29
+ </a>
@@ -0,0 +1,13 @@
1
+ ---
2
+ sidebar_label: disableSvgr
3
+ ---
4
+
5
+ # output.disableSvgr
6
+
7
+ :::tip
8
+ 该配置由 Modern.js Builder 提供,更多信息可参考 [output.disableSvgr](https://modernjs.dev/builder/api/config-output.html#outputdisablesvgr)。
9
+ :::
10
+
11
+ import Main from '@modern-js/builder-doc/docs/zh/config/output/disableSvgr.md';
12
+
13
+ <Main />
package/modern.config.ts CHANGED
@@ -8,6 +8,7 @@ const rootCategories = [
8
8
  'apis/app',
9
9
  'configure/app',
10
10
  'blog',
11
+ 'about',
11
12
  ];
12
13
 
13
14
  const { version } = require('./package.json');
@@ -45,6 +46,11 @@ const getNavbar = (lang: string): NavItem[] => {
45
46
  link: getLink('/blog/index'),
46
47
  activeMatch: '/blog/',
47
48
  },
49
+ {
50
+ text: getText('关于', 'About'),
51
+ link: getLink('/about/showcase'),
52
+ activeMatch: '/about/',
53
+ },
48
54
  {
49
55
  text: `v${version}`,
50
56
  items: [
package/package.json CHANGED
@@ -3,7 +3,11 @@
3
3
  "description": "Documentation of modern.js framework",
4
4
  "homepage": "https://modernjs.dev",
5
5
  "bugs": "https://github.com/web-infra-dev/modern.js/issues",
6
- "repository": "web-infra-dev/modern.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/web-infra-dev/modern.js",
9
+ "directory": "packages/document/main-doc"
10
+ },
7
11
  "license": "MIT",
8
12
  "keywords": [
9
13
  "react",
@@ -11,13 +15,13 @@
11
15
  "modern",
12
16
  "modern.js"
13
17
  ],
14
- "version": "2.15.0",
18
+ "version": "2.16.0",
15
19
  "publishConfig": {
16
20
  "registry": "https://registry.npmjs.org/",
17
21
  "access": "public"
18
22
  },
19
23
  "peerDependencies": {
20
- "@modern-js/builder-doc": "^2.15.0"
24
+ "@modern-js/builder-doc": "^2.16.0"
21
25
  },
22
26
  "devDependencies": {
23
27
  "classnames": "^2",
@@ -29,9 +33,9 @@
29
33
  "fs-extra": "^10",
30
34
  "@types/node": "^16",
31
35
  "@types/fs-extra": "^9",
32
- "@modern-js/builder-doc": "2.15.0",
33
- "@modern-js/doc-tools": "2.15.0",
34
- "@modern-js/doc-plugin-auto-sidebar": "2.15.0"
36
+ "@modern-js/builder-doc": "2.16.0",
37
+ "@modern-js/doc-tools": "2.16.0",
38
+ "@modern-js/doc-plugin-auto-sidebar": "2.16.0"
35
39
  },
36
40
  "scripts": {
37
41
  "dev": "modern dev",
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["@modern-js-app"]
3
+ }
@@ -0,0 +1,35 @@
1
+ .wrapper {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ align-items: center;
5
+ }
6
+
7
+ .link {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ flex-direction: column;
12
+ width: 20%;
13
+ max-width: 20%;
14
+ margin: 24px 0;
15
+
16
+ &:hover {
17
+ .avatar {
18
+ transform: scale(1.15);
19
+ }
20
+ }
21
+ }
22
+
23
+ .avatar {
24
+ width: 48px;
25
+ height: 48px;
26
+ border-radius: 999px;
27
+ transition: all 0.2s ease-in-out;
28
+ background-color: #f8f8f8;
29
+ }
30
+
31
+ .name {
32
+ margin-top: 12px;
33
+ font-size: 13px;
34
+ color: rgb(0, 53, 67);
35
+ }
@@ -0,0 +1,122 @@
1
+ import { NoSSR } from '@modern-js/doc-tools/runtime';
2
+ import style from './index.module.scss';
3
+
4
+ interface Member {
5
+ id: string;
6
+ avatar: string;
7
+ // The display name, if not set, use id instead
8
+ name?: string;
9
+ }
10
+
11
+ const MEMBERS: Member[] = [
12
+ {
13
+ id: '10Derozan',
14
+ avatar: 'https://avatars.githubusercontent.com/u/50694858?s=120&v=4',
15
+ },
16
+ {
17
+ id: '2heal1',
18
+ avatar: 'https://avatars.githubusercontent.com/u/41466093?s=120&v=4',
19
+ },
20
+ {
21
+ id: '9aoy',
22
+ avatar: 'https://avatars.githubusercontent.com/u/22373761?s=120&v=4',
23
+ },
24
+ {
25
+ id: 'Asuka109',
26
+ avatar: 'https://avatars.githubusercontent.com/u/18379948?s=120&v=4',
27
+ },
28
+ {
29
+ id: 'caohuilin',
30
+ avatar: 'https://avatars.githubusercontent.com/u/12605189?s=120&v=4',
31
+ },
32
+ {
33
+ id: 'chenjiahan',
34
+ avatar: 'https://avatars.githubusercontent.com/u/7237365?s=120&v=4',
35
+ },
36
+ {
37
+ id: 'clChenLiang',
38
+ avatar: 'https://avatars.githubusercontent.com/u/13596193?s=120&v=4',
39
+ },
40
+ {
41
+ id: 'danpeen',
42
+ avatar: 'https://avatars.githubusercontent.com/u/18045417?s=120&v=4',
43
+ },
44
+ {
45
+ id: 'GiveMe-A-Name',
46
+ avatar: 'https://avatars.githubusercontent.com/u/58852732?s=120&v=4',
47
+ },
48
+ {
49
+ id: 'jkzing',
50
+ avatar: 'https://avatars.githubusercontent.com/u/2851517?s=120&v=4',
51
+ },
52
+ {
53
+ id: 'JSerFeng',
54
+ avatar: 'https://avatars.githubusercontent.com/u/57202839?s=120&v=4',
55
+ },
56
+ {
57
+ id: 'KyrieLii',
58
+ avatar: 'https://avatars.githubusercontent.com/u/16858738?s=120&v=4',
59
+ },
60
+ {
61
+ id: 'nyqykk',
62
+ avatar: 'https://avatars.githubusercontent.com/u/65393845?s=120&v=4',
63
+ },
64
+ {
65
+ id: 'sanyuan0704',
66
+ avatar: 'https://avatars.githubusercontent.com/u/39261479?s=120&v=4',
67
+ },
68
+ {
69
+ id: 'targeral',
70
+ avatar: 'https://avatars.githubusercontent.com/u/9037723?s=120&v=4',
71
+ },
72
+ {
73
+ id: 'xuchaobei',
74
+ avatar: 'https://avatars.githubusercontent.com/u/5110783?s=120&v=4',
75
+ },
76
+ {
77
+ id: 'xyoscer',
78
+ avatar: 'https://avatars.githubusercontent.com/u/16360717?s=120&v=4',
79
+ },
80
+ {
81
+ id: 'yimingjfe',
82
+ avatar: 'https://avatars.githubusercontent.com/u/10381581?s=120&v=4',
83
+ },
84
+ {
85
+ id: 'zhoushaw',
86
+ avatar: 'https://avatars.githubusercontent.com/u/27547179?s=120&v=4',
87
+ },
88
+ {
89
+ id: 'zllkjc',
90
+ avatar: 'https://avatars.githubusercontent.com/u/68810266?s=120&v=4',
91
+ },
92
+ {
93
+ id: 'zoolsher',
94
+ avatar: 'https://avatars.githubusercontent.com/u/9161085?s=120&v=4',
95
+ },
96
+ ];
97
+
98
+ export const RandomMemberList = () => {
99
+ const randomList = MEMBERS.sort(() => Math.random() - 0.5);
100
+
101
+ return (
102
+ <NoSSR>
103
+ <div className={style.wrapper}>
104
+ {randomList.map(item => (
105
+ <a
106
+ className={style.link}
107
+ href={`https://github.com/${item.id}`}
108
+ target="_blank"
109
+ rel="nofollow"
110
+ key={item.id}
111
+ style={{
112
+ border: 'none',
113
+ }}
114
+ >
115
+ <img className={style.avatar} src={item.avatar} />
116
+ <span className={style.name}>{item.name || item.id}</span>
117
+ </a>
118
+ ))}
119
+ </div>
120
+ </NoSSR>
121
+ );
122
+ };
@@ -0,0 +1,80 @@
1
+ .wrapper {
2
+ display: grid;
3
+ grid-template-columns: repeat(2, 1fr);
4
+ grid-gap: 32px;
5
+ }
6
+
7
+ @media (max-width: 1100px) {
8
+ .wrapper {
9
+ grid-template-columns: repeat(1, 1fr);
10
+ }
11
+ }
12
+
13
+ .card {
14
+ display: block;
15
+ cursor: pointer;
16
+ age-break-inside: avoid;
17
+ break-inside: avoid;
18
+ border-radius: 20px;
19
+ overflow: hidden;
20
+ transition: 0.15s ease-in;
21
+ border: 1px solid var(--modern-c-divider-light);
22
+
23
+ &:hover {
24
+ border-color: var(--modern-c-brand);
25
+ }
26
+ }
27
+
28
+ .preview {
29
+ display: block;
30
+ width: 100%;
31
+ aspect-ratio: 1.84;
32
+ object-fit: contain;
33
+ cursor: pointer;
34
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
35
+ pointer-events: none;
36
+ background-color: var(--modern-c-bg-soft);
37
+ }
38
+
39
+ .bottom {
40
+ padding: 12px 18px 14px;
41
+ }
42
+
43
+ .name {
44
+ display: flex;
45
+ justify-content: space-between;
46
+ font-weight: 600;
47
+ font-size: 17px;
48
+ line-height: 28px;
49
+ color: var(--modern-c-text-1);
50
+ }
51
+
52
+ .type {
53
+ display: block;
54
+ color: #fff;
55
+ font-size: 12px;
56
+ background: -webkit-linear-gradient(
57
+ 305deg,
58
+ hsl(166deg, 77%, 43%) 10%,
59
+ hsl(198deg, 100%, 50%)
60
+ );
61
+ background-clip: text;
62
+ -webkit-background-clip: text;
63
+ -webkit-text-fill-color: transparent;
64
+ }
65
+
66
+ :global(.dark) .type {
67
+ background: -webkit-linear-gradient(
68
+ 305deg,
69
+ hsl(166deg, 77%, 53%) 10%,
70
+ hsl(198deg, 100%, 60%)
71
+ );
72
+ background-clip: text;
73
+ -webkit-background-clip: text;
74
+ }
75
+
76
+ .domain {
77
+ font-size: 13px;
78
+ line-height: 24px;
79
+ color: var(--modern-c-text-2);
80
+ }
@@ -0,0 +1,39 @@
1
+ import { useShowcases } from './useShowcases';
2
+ import styles from './index.module.scss';
3
+
4
+ const getDomain = (url: string) => new URL(url).hostname;
5
+
6
+ const TYPE_MAP = {
7
+ doc: 'Modern.js Doc',
8
+ module: 'Modern.js Module',
9
+ builder: 'Modern.js Builder',
10
+ framework: 'Modern.js Framework',
11
+ };
12
+
13
+ export const ShowcaseList = () => {
14
+ const showcases = useShowcases();
15
+
16
+ return (
17
+ <div className={styles.wrapper}>
18
+ {showcases.map(item => {
19
+ return (
20
+ <a
21
+ key={item.url}
22
+ href={item.url}
23
+ target="_blank"
24
+ className={styles.card}
25
+ >
26
+ <img src={item.preview} className={styles.preview} />
27
+ <div className={styles.bottom}>
28
+ <div className={styles.name}>
29
+ {item.name}
30
+ <span className={styles.type}>{TYPE_MAP[item.type]}</span>
31
+ </div>
32
+ <div className={styles.domain}>{getDomain(item.url)}</div>
33
+ </div>
34
+ </a>
35
+ );
36
+ })}
37
+ </div>
38
+ );
39
+ };
@@ -0,0 +1,73 @@
1
+ import { useI18n } from '../../i18n';
2
+
3
+ export type ShowcaseType = 'framework' | 'builder' | 'doc' | 'module';
4
+
5
+ export type ShowcaseItem = {
6
+ url: string;
7
+ name: string;
8
+ preview: string;
9
+ type: ShowcaseType;
10
+ };
11
+
12
+ export const useShowcases = (): ShowcaseItem[] => {
13
+ const t = useI18n();
14
+
15
+ return [
16
+ {
17
+ name: t('volctrans'),
18
+ url: 'https://translate.volcengine.com/',
19
+ preview:
20
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/volctrans-0424.jpeg',
21
+ type: 'framework',
22
+ },
23
+ {
24
+ name: t('writingo'),
25
+ url: 'https://writingo.net/',
26
+ preview:
27
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/writingo-0424.jpeg',
28
+ type: 'framework',
29
+ },
30
+ {
31
+ name: 'Rspack',
32
+ url: 'https://rspack.dev/',
33
+ preview:
34
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/rspack-0424.jpeg',
35
+ type: 'doc',
36
+ },
37
+ {
38
+ name: 'Modern.js',
39
+ url: 'https://modernjs.dev/en/',
40
+ preview:
41
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/modernjs-dev-0425.jpeg',
42
+ type: 'doc',
43
+ },
44
+ {
45
+ name: t('shidianbaike'),
46
+ url: 'https://shidian.baike.com/',
47
+ preview:
48
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/shidianbaike-0424.jpeg',
49
+ type: 'framework',
50
+ },
51
+ {
52
+ name: t('xiaohe'),
53
+ url: 'https://xiaohe.cn/',
54
+ preview:
55
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/xiaohe-0424.png',
56
+ type: 'framework',
57
+ },
58
+ {
59
+ name: t('dongchedi'),
60
+ url: 'https://m.dcdapp.com/motor/feoffline/usedcar_channel/channel.html',
61
+ preview:
62
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/dongchedi-0425.png',
63
+ type: 'builder',
64
+ },
65
+ {
66
+ name: t('volcengineDeveloper'),
67
+ url: 'https://developer.volcengine.com/',
68
+ preview:
69
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/showcase/developer-volcengine-0425.png',
70
+ type: 'framework',
71
+ },
72
+ ];
73
+ };
package/src/i18n/enUS.ts CHANGED
@@ -47,4 +47,12 @@ export const EN_US = {
47
47
  projectGenerator: 'Project Generator',
48
48
  githubDiscussion: 'Github Discussion',
49
49
  changelog: 'Changelog',
50
+
51
+ // Showcases
52
+ writingo: 'Writingo',
53
+ volctrans: 'Volctrans',
54
+ shidianbaike: 'Shidian Baike',
55
+ xiaohe: 'Xiaohe',
56
+ dongchedi: 'Dongchedi',
57
+ volcengineDeveloper: 'Volcengine Developer',
50
58
  } as const;
package/src/i18n/zhCN.ts CHANGED
@@ -47,4 +47,12 @@ export const ZH_CN: Record<keyof typeof EN_US, string> = {
47
47
  projectGenerator: '项目生成器',
48
48
  githubDiscussion: 'Github 讨论区',
49
49
  changelog: '更新日志',
50
+
51
+ // Showcase
52
+ writingo: '火山写作',
53
+ volctrans: '火山翻译',
54
+ shidianbaike: '识典百科',
55
+ xiaohe: '小荷健康',
56
+ dongchedi: '懂车帝',
57
+ volcengineDeveloper: '火山引擎开发者社区',
50
58
  };
@@ -1,3 +0,0 @@
1
- # 社区
2
-
3
- Modern.js 社区正在建设中,敬请关注!