@bleedingdev/modern-js-main-doc 3.2.0-ultramodern.74 → 3.2.0-ultramodern.77

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 (53) hide show
  1. package/docs/en/apis/app/commands.mdx +32 -32
  2. package/docs/en/community/blog/2022-0708-updates.md +1 -1
  3. package/docs/en/community/blog/2022-0910-updates.md +2 -2
  4. package/docs/en/community/blog/v2-release-note.mdx +5 -5
  5. package/docs/en/community/blog/v3-release-note.mdx +1 -1
  6. package/docs/en/community/releases.mdx +2 -2
  7. package/docs/en/components/build-output.mdx +1 -1
  8. package/docs/en/components/debug-app.mdx +1 -1
  9. package/docs/en/components/deploy-command.mdx +3 -3
  10. package/docs/en/components/init-app.mdx +13 -30
  11. package/docs/en/components/init-rspack-app.mdx +1 -1
  12. package/docs/en/components/serve-command.mdx +3 -3
  13. package/docs/en/configure/app/bff/runtime-framework.mdx +1 -1
  14. package/docs/en/configure/app/usage.mdx +6 -6
  15. package/docs/en/guides/basic-features/debug/using-storybook.mdx +1 -1
  16. package/docs/en/guides/basic-features/deploy.mdx +14 -14
  17. package/docs/en/guides/basic-features/env-vars.mdx +2 -2
  18. package/docs/en/guides/basic-features/routes/config-routes.mdx +2 -2
  19. package/docs/en/guides/concept/server.mdx +2 -2
  20. package/docs/en/guides/get-started/quick-start.mdx +2 -2
  21. package/docs/en/guides/get-started/tech-stack.mdx +4 -4
  22. package/docs/en/guides/topic-detail/module-federation/application.mdx +1 -1
  23. package/docs/en/guides/topic-detail/module-federation/deploy.mdx +2 -2
  24. package/docs/en/guides/topic-detail/module-federation/usage.mdx +5 -5
  25. package/docs/en/guides/troubleshooting/builder.mdx +1 -1
  26. package/docs/en/guides/upgrade/other.mdx +7 -7
  27. package/docs/zh/apis/app/commands.mdx +32 -32
  28. package/docs/zh/community/blog/2022-0708-updates.md +1 -1
  29. package/docs/zh/community/blog/2022-0910-updates.md +2 -2
  30. package/docs/zh/community/blog/v2-release-note.mdx +5 -5
  31. package/docs/zh/community/blog/v3-release-note.mdx +1 -1
  32. package/docs/zh/community/releases.mdx +2 -2
  33. package/docs/zh/components/build-output.mdx +1 -1
  34. package/docs/zh/components/debug-app.mdx +1 -1
  35. package/docs/zh/components/deploy-command.mdx +3 -3
  36. package/docs/zh/components/init-app.mdx +13 -30
  37. package/docs/zh/components/init-rspack-app.mdx +1 -1
  38. package/docs/zh/components/serve-command.mdx +3 -3
  39. package/docs/zh/configure/app/bff/runtime-framework.mdx +1 -1
  40. package/docs/zh/configure/app/usage.mdx +5 -5
  41. package/docs/zh/guides/basic-features/debug/using-storybook.mdx +1 -1
  42. package/docs/zh/guides/basic-features/deploy.mdx +13 -13
  43. package/docs/zh/guides/basic-features/env-vars.mdx +2 -2
  44. package/docs/zh/guides/basic-features/routes/config-routes.mdx +2 -2
  45. package/docs/zh/guides/concept/server.mdx +2 -2
  46. package/docs/zh/guides/get-started/quick-start.mdx +2 -2
  47. package/docs/zh/guides/get-started/tech-stack.mdx +4 -4
  48. package/docs/zh/guides/topic-detail/module-federation/application.mdx +1 -1
  49. package/docs/zh/guides/topic-detail/module-federation/deploy.mdx +2 -2
  50. package/docs/zh/guides/topic-detail/module-federation/usage.mdx +5 -5
  51. package/docs/zh/guides/troubleshooting/builder.mdx +1 -1
  52. package/docs/zh/guides/upgrade/other.md +7 -8
  53. package/package.json +2 -2
@@ -15,11 +15,11 @@ sidebar_position: 15
15
15
 
16
16
  ## 构建部署产物
17
17
 
18
- 执行 `modern deploy` 命令将自动输出部署产物。此过程包括优化 Bundler 构建产物及产物依赖,检测当前部署平台,并自动生成可以在该平台运行的产物。
18
+ 执行 `ultramodern deploy` 命令将自动输出部署产物。此过程包括优化 Bundler 构建产物及产物依赖,检测当前部署平台,并自动生成可以在该平台运行的产物。
19
19
  如果你希望在本地生成并测试特定部署平台的产物,可以通过设置环境变量来指定平台:
20
20
 
21
21
  ```bash
22
- MODERNJS_DEPLOY=netlify npx modern deploy
22
+ MODERNJS_DEPLOY=netlify npx ultramodern deploy
23
23
  ```
24
24
 
25
25
  :::info
@@ -35,10 +35,10 @@ MODERNJS_DEPLOY=netlify npx modern deploy
35
35
  你可以使用以下命令构建项目:
36
36
 
37
37
  ```bash
38
- npx modern deploy
38
+ npx ultramodern deploy
39
39
  ```
40
40
 
41
- 当执行 `modern deploy` 命令时,Modern.js 将生成可执行的部署产物,并在控制台输出以下内容:
41
+ 当执行 `ultramodern deploy` 命令时,UltraModern.js 将生成可执行的部署产物,并在控制台输出以下内容:
42
42
 
43
43
  ```bash
44
44
  Static directory: `.output/static`
@@ -66,7 +66,7 @@ PORT=3000 node .output/index
66
66
  {
67
67
  "scripts": {
68
68
  "build:packages": "pnpm --filter 'app^...' run build",
69
- "deploy": "pnpm run build:packages && modern deploy"
69
+ "deploy": "pnpm run build:packages && ultramodern deploy"
70
70
  }
71
71
  }
72
72
  ```
@@ -77,7 +77,7 @@ PORT=3000 node .output/index
77
77
  {
78
78
  "scripts": {
79
79
  "build:packages": "rush rebuild --to-except app",
80
- "deploy": "rushx build:packages && modern deploy"
80
+ "deploy": "rushx build:packages && ultramodern deploy"
81
81
  }
82
82
  }
83
83
  ```
@@ -105,7 +105,7 @@ Netlify 是一个流行的 Web 开发平台,专为构建、发布和维护现
105
105
  ```toml
106
106
  [build]
107
107
  publish = "dist"
108
- command = "modern deploy"
108
+ command = "ultramodern deploy"
109
109
  ```
110
110
 
111
111
  :::info
@@ -121,7 +121,7 @@ Netlify 是一个流行的 Web 开发平台,专为构建、发布和维护现
121
121
  ```toml title="netlify.toml"
122
122
  [build]
123
123
  publish = "dist"
124
- command = "modern deploy"
124
+ command = "ultramodern deploy"
125
125
 
126
126
  [functions]
127
127
  directory = ".netlify/functions"
@@ -167,7 +167,7 @@ Netlify 是一个流行的 Web 开发平台,专为构建、发布和维护现
167
167
  {
168
168
  "scripts": {
169
169
  "build:packages": "pnpm --filter 'app^...' run build",
170
- "deploy": "pnpm run build:packages && modern deploy"
170
+ "deploy": "pnpm run build:packages && ultramodern deploy"
171
171
  }
172
172
  }
173
173
  ```
@@ -207,7 +207,7 @@ Vercel 是一个面向现代 Web 应用的部署平台,它提供了丰富的
207
207
 
208
208
  ```json title="vercel.json"
209
209
  {
210
- "buildCommand": "modern deploy",
210
+ "buildCommand": "ultramodern deploy",
211
211
  "outputDirectory": ".vercel/output"
212
212
  }
213
213
  ```
@@ -272,7 +272,7 @@ Vercel 是一个面向现代 Web 应用的部署平台,它提供了丰富的
272
272
  {
273
273
  "scripts": {
274
274
  "build:packages": "pnpm --filter 'app^...' run build",
275
- "deploy": "pnpm run build:packages && modern deploy"
275
+ "deploy": "pnpm run build:packages && ultramodern deploy"
276
276
  }
277
277
  }
278
278
  ```
@@ -311,12 +311,12 @@ Github Pages 支持两种部署方式,通过分支部署或通过 Github Actio
311
311
 
312
312
  1. 在 github 仓库中,选择 `Settings > Pages > Source > Deploy from a branch`。
313
313
  2. 安装 `gh-pages` 依赖作为开发依赖。
314
- 3. 在 package.json 的 `scripts` 中添加 `"deploy:gh-pages": "MODERNJS_DEPLOY=ghPages modern deploy && gh-pages -d .output"`。
314
+ 3. 在 package.json 的 `scripts` 中添加 `"deploy:gh-pages": "MODERNJS_DEPLOY=ghPages ultramodern deploy && gh-pages -d .output"`。
315
315
  4. 执行 `npm run deploy:gh-pages`。
316
316
 
317
317
  :::info
318
318
 
319
- 1. 执行 `MODERNJS_DEPLOY=ghPages modern deploy`,Modern.js 会把可用于 github 部署的产物构建到 `.output` 目录。
319
+ 1. 执行 `MODERNJS_DEPLOY=ghPages ultramodern deploy`,UltraModern.js 会把可用于 github 部署的产物构建到 `.output` 目录。
320
320
  2. 可以参考项目[示例](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/modern-js-deploy-csr)。
321
321
 
322
322
  :::
@@ -16,8 +16,8 @@ Modern.js 提供了对环境变量的支持,包含内置的环境变量和自
16
16
 
17
17
  表示当前的执行环境,是**只读的**的环境变量,其值在不同的执行命令下具有不同的值:
18
18
 
19
- - `production`:执行 `modern build`、`modern serve` 命令时的默认值。
20
- - `development`:执行 `modern dev` 命令时的默认值,同时也是其他所有情况下的默认值。
19
+ - `production`:执行 `ultramodern build`、`ultramodern serve` 命令时的默认值。
20
+ - `development`:执行 `ultramodern dev` 命令时的默认值,同时也是其他所有情况下的默认值。
21
21
 
22
22
  ### MODERN_ENV
23
23
 
@@ -270,7 +270,7 @@ Modern.js 会自动查找并加载:
270
270
 
271
271
  :::info
272
272
 
273
- 当前路由结构可以通过 [`modern routes`](#调试路由) 命令查看
273
+ 当前路由结构可以通过 [`ultramodern routes`](#调试路由) 命令查看
274
274
 
275
275
  :::
276
276
 
@@ -318,7 +318,7 @@ export default defineRoutes(({ page }, fileRoutes) => {
318
318
 
319
319
  ```bash
320
320
  # 生成路由结构分析报告
321
- npx modern routes
321
+ npx ultramodern routes
322
322
  ```
323
323
 
324
324
  该命令会在 `dist/routes-inspect.json` 文件中生成最终的路由结构,帮助你了解合并后的完整路由信息。
@@ -26,10 +26,10 @@ Modern.js 开发环境和生产环境的 Web 服务器流程是完全同构的
26
26
 
27
27
  Modern.js 支持在任何 Node.js 环境运行构建产物。在 CI 环境中,通常情况下已经安装了应用全部的依赖。
28
28
 
29
- 你可以执行 [`modern build`](/apis/app/commands#modern-build) 来构建应用,执行 [`modern serve`](/apis/app/commands#modern-serve) 命令来运行 Web 服务器,启动 Modern.js 应用。
29
+ 你可以执行 [`ultramodern build`](/apis/app/commands#ultramodern-build) 来构建应用,执行 [`ultramodern serve`](/apis/app/commands#ultramodern-serve) 命令来运行 Web 服务器,启动 UltraModern.js 应用。
30
30
 
31
31
  ## 在生产环境中运行
32
32
 
33
33
  在部署到生产环境时,产物体积应该尽可能小,而上述在 CI 中运行的方案,会保留原项目的所有产物。因此在生产环境,不推荐通过上述命令运行应用。
34
34
 
35
- Modern.js 提供了独立的部署方案,当运行 [`modern deploy`](/apis/app/commands#modern-deploy) 命令时,产物中会包含可运行 Web 服务器的入口文件。
35
+ UltraModern.js 提供了独立的部署方案,当运行 [`ultramodern deploy`](/apis/app/commands#ultramodern-deploy) 命令时,产物中会包含可运行 Web 服务器的入口文件。
@@ -25,7 +25,7 @@ import DebugApp from '@site-docs/components/debug-app';
25
25
 
26
26
  ## 使用配置
27
27
 
28
- 通过 `@modern-js/create` 创建的 Modern.js 项目中,会默认生成 `modern.config.ts` 文件。
28
+ 通过 `@bleedingdev/modern-js-create` 创建的 UltraModern.js 项目中,会默认生成 `modern.config.ts` 文件。
29
29
 
30
30
  你可以通过该配置文件修改配置,覆盖 Modern.js 的默认行为。例如添加如下配置,开启 SSR:
31
31
 
@@ -46,7 +46,7 @@ export default defineConfig({
46
46
 
47
47
  在新创建的工程中,默认会安装 `@modern-js/app-tools` npm 包,它是 Modern.js 框架的核心包,主要提供以下能力:
48
48
 
49
- - 提供 `modern dev`, `modern build` 等常用的 CLI 命令。
49
+ - 提供 `ultramodern dev`, `ultramodern build` 等常用的 CLI 命令。
50
50
  - 集成 Rsbuild,提供构建能力。
51
51
  - 集成 Modern.js Server,提供开发和生产服务器相关能力。
52
52
 
@@ -18,13 +18,13 @@ Modern.js 底层的 Rsbuild 支持构建 Vue 应用,如果你需要使用 Vue
18
18
 
19
19
  Modern.js 提供两套一方路由方案:
20
20
 
21
- - 默认使用 [React Router 7](https://reactrouter.com/en/main),通过 `@modern-js/runtime/router` 导出 API。
22
- - 支持 [TanStack Router](https://tanstack.com/router),通过 `@modern-js/plugin-tanstack/runtime` 导出 API。
21
+ - 默认使用 [TanStack Router](https://tanstack.com/router),通过 `@modern-js/plugin-tanstack/runtime` 导出 API。
22
+ - 兼容 [React Router 7](https://reactrouter.com/en/main),通过 `@modern-js/runtime/router` 导出 API。
23
23
 
24
- 创建项目时,可通过以下命令选择 TanStack Router:
24
+ 创建 UltraModern 项目时,默认会包含 TanStack Router:
25
25
 
26
26
  ```bash
27
- npx @modern-js/create@latest myapp --router tanstack
27
+ pnpm dlx @bleedingdev/modern-js-create myapp
28
28
  ```
29
29
 
30
30
  Modern.js 支持约定式路由、自控式路由或其他路由方案,请参考 [页面入口](/guides/concept/entries) 进行选择。
@@ -104,7 +104,7 @@ export default RemoteApp;
104
104
 
105
105
  ## 启动应用
106
106
 
107
- 现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `modern dev` 启动两个应用。
107
+ 现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `ultramodern dev` 启动两个应用。
108
108
 
109
109
  启动后,消费者应用访问 `/remote` 路由时,会进入生产者应用中。访问 `http://localhost:8080/remote`,可以看到页面中已经包含了生产者的远程模块的完整页面。
110
110
 
@@ -88,10 +88,10 @@ export default createModuleFederationConfig({
88
88
 
89
89
  ## 本地验证部署
90
90
 
91
- Modern.js 提供了 `modern deploy` 命令,可以方便生成可运行在 Node.js 环境的产物。
91
+ Modern.js 提供了 `ultramodern deploy` 命令,可以方便生成可运行在 Node.js 环境的产物。
92
92
 
93
93
  ```bash
94
- modern deploy
94
+ ultramodern deploy
95
95
  ```
96
96
 
97
97
  执行命令后,可以在控制台看到以下输出:
@@ -154,7 +154,7 @@ export default Index;
154
154
 
155
155
  ## 启动应用
156
156
 
157
- 现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `modern dev` 启动两个应用。
157
+ 现在,生产者应用和消费者应用都已经搭建完毕,我们可以在本地运行 `ultramodern dev` 启动两个应用。
158
158
 
159
159
  启动后,消费者中对生产者模块的引入,不会再出现抛错,类型已经下载到消费者应用中。
160
160
 
@@ -164,7 +164,7 @@ export default Index;
164
164
 
165
165
  访问 `http://localhost:8080/remote`,可以看到页面中已经包含了生产者的远程模块 `Button` 组件。
166
166
 
167
- 我们也可以在本地执行 `modern serve` 来模拟生产环境。
167
+ 我们也可以在本地执行 `ultramodern serve` 来模拟生产环境。
168
168
 
169
169
  因为 Module Federation 插件会自动读取 Modern.js 的 `output.assetPrefix` 配置作为远程模块的访问地址,而该值在生产环境下构建后默认是 `/`。如果不做特殊处理,消费者将从自己的域名下拉取远程模块的入口文件。我们可以添加如下配置:
170
170
 
@@ -178,7 +178,7 @@ export default defineConfig({
178
178
  port: 3051,
179
179
  },
180
180
  output: {
181
- // Now this configuration is only used in the local when you run modern serve command.
181
+ // Now this configuration is only used in the local when you run ultramodern serve command.
182
182
  // If you want to deploy the application to the platform, use your own domain name.
183
183
  // Module federation will automatically write it to mf-manifest.json, which influences consumer to fetch remoteEntry.js.
184
184
  assetPrefix: 'http://127.0.0.1:3051',
@@ -187,10 +187,10 @@ export default defineConfig({
187
187
  });
188
188
  ```
189
189
 
190
- 现在,在生产者中运行 `modern build && MODERN_MF_AUTO_CORS=true modern serve`,在消费者中运行 `modern build && modern serve`,即可在本地模拟生产环境,访问到远程模块。
190
+ 现在,在生产者中运行 `ultramodern build && MODERN_MF_AUTO_CORS=true ultramodern serve`,在消费者中运行 `ultramodern build && ultramodern serve`,即可在本地模拟生产环境,访问到远程模块。
191
191
 
192
192
  :::tip
193
- 在使用 `modern serve` 命令时,需要在启动生产者项目时携带 `MODERN_MF_AUTO_CORS=true` 环境变量,以自动处理跨域问题,确保消费者可以正常访问生产者的远程模块资源。
193
+ 在使用 `ultramodern serve` 命令时,需要在启动生产者项目时携带 `MODERN_MF_AUTO_CORS=true` 环境变量,以自动处理跨域问题,确保消费者可以正常访问生产者的远程模块资源。
194
194
  :::
195
195
 
196
196
  上述用例可以参考:[Modern.js & Module Federation 基础用法示例](https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/module-federation/base)。
@@ -23,7 +23,7 @@ Modern.js 内部基于 [Rsbuild](https://v2.rsbuild.rs/) 封装了自身的构
23
23
  Modern.js 提供 [inspect 命令](/apis/app/commands.html) 用于查看项目最终生成的 Modern.js 配置以及 Rspack 配置。
24
24
 
25
25
  ```bash
26
- ➜ npx modern inspect
26
+ ➜ npx ultramodern inspect
27
27
 
28
28
  Inspect config succeed, open following files to view the content:
29
29
 
@@ -88,14 +88,14 @@ Modern.js 3.0 默认使用 React Router v7 作为路由库。React Router v7 相
88
88
 
89
89
  如果需要使用 React Router v5 或 React Router v6,需要使用**自控式路由**模式。自控式路由允许你完全控制路由配置,不受 Modern.js 约定式路由的限制。
90
90
 
91
- ## 使用 @modern-js/create 创建 Monorepo 和 Modern.js Module
91
+ ## 使用 @bleedingdev/modern-js-create 创建 Monorepo 和 Modern.js Module
92
92
 
93
- Modern.js 3.0 不再支持通过 `@modern-js/create` 创建 Monorepo 项目和 Modern.js Module 项目。
93
+ Modern.js 3.0 不再支持通过 `@bleedingdev/modern-js-create` 创建 Monorepo 项目和 Modern.js Module 项目。
94
94
 
95
95
  **变更内容**:
96
96
 
97
- - 在 [v2.53.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.53.0) 版本中,移除了使用 `@modern-js/create` 创建 Monorepo 项目的功能
98
- - 在 [v2.61.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.61.0) 版本中,移除了使用 `@modern-js/create` 和 `modern new` 命令创建 Modern.js Module 项目的功能
97
+ - 在 [v2.53.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.53.0) 版本中,移除了使用 `@bleedingdev/modern-js-create` 创建 Monorepo 项目的功能
98
+ - 在 [v2.61.0](https://github.com/web-infra-dev/modern.js/releases/tag/v2.61.0) 版本中,移除了使用 `@bleedingdev/modern-js-create` 和 `ultramodern new` 命令创建 Modern.js Module 项目的功能
99
99
 
100
100
  **处理方式**:
101
101
 
@@ -104,12 +104,12 @@ Modern.js 3.0 不再支持通过 `@modern-js/create` 创建 Monorepo 项目和 M
104
104
 
105
105
  ## new 命令和 upgrade 命令移除
106
106
 
107
- Modern.js 3.0 移除了 `modern new` 和 `modern upgrade` 命令,需要按照文档手动操作。
107
+ Modern.js 3.0 移除了 `ultramodern new` 和 `ultramodern upgrade` 命令,需要按照文档手动操作。
108
108
 
109
109
  **变更内容**:
110
110
 
111
- - `modern new` 命令在 Modern.js 3.0 中不再支持,无法通过命令添加入口或启用功能
112
- - `modern upgrade` 命令在 Modern.js 3.0 中不再支持,无法通过命令自动升级依赖
111
+ - `ultramodern new` 命令在 Modern.js 3.0 中不再支持,无法通过命令添加入口或启用功能
112
+ - `ultramodern upgrade` 命令在 Modern.js 3.0 中不再支持,无法通过命令自动升级依赖
113
113
 
114
114
  **处理方式**:
115
115
 
@@ -187,4 +187,3 @@ Modern.js 之前提供了 ESLint 的完整规则集,涵盖了 @modern-js(针
187
187
 
188
188
 
189
189
 
190
-
package/package.json CHANGED
@@ -18,14 +18,14 @@
18
18
  "modern",
19
19
  "modern.js"
20
20
  ],
21
- "version": "3.2.0-ultramodern.74",
21
+ "version": "3.2.0-ultramodern.77",
22
22
  "publishConfig": {
23
23
  "registry": "https://registry.npmjs.org/",
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
27
  "mermaid": "^11.15.0",
28
- "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.2.0-ultramodern.74"
28
+ "@modern-js/sandpack-react": "npm:@bleedingdev/modern-js-sandpack-react@3.2.0-ultramodern.77"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@rsbuild/plugin-sass": "1.5.2",