@modern-js/main-doc 3.0.0-alpha.0 → 3.0.0-alpha.1

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 (142) hide show
  1. package/docs/en/apis/app/commands.mdx +6 -30
  2. package/docs/en/components/bff-upload.mdx +3 -5
  3. package/docs/en/components/bundler.mdx +1 -1
  4. package/docs/en/components/enable-bff.mdx +6 -2
  5. package/docs/en/components/enable-ssg.mdx +1 -0
  6. package/docs/en/components/esbuild.mdx +2 -2
  7. package/docs/en/components/extend-bff-function.mdx +2 -4
  8. package/docs/en/components/hono.mdx +119 -0
  9. package/docs/en/components/international/custom-instance-code.mdx +16 -0
  10. package/docs/en/components/international/init-options-desc.mdx +1 -0
  11. package/docs/en/components/international/install-command.mdx +15 -1
  12. package/docs/en/components/international/instance-code.mdx +26 -0
  13. package/docs/en/configure/app/builder-plugins.mdx +1 -2
  14. package/docs/en/configure/app/dev/server.mdx +108 -0
  15. package/docs/en/configure/app/experiments/source-build.mdx +0 -1
  16. package/docs/en/configure/app/output/assets-retry.mdx +1 -1
  17. package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +2 -2
  18. package/docs/en/configure/app/output/filename.mdx +2 -4
  19. package/docs/en/configure/app/output/temp-dir.mdx +3 -3
  20. package/docs/en/configure/app/performance/build-cache.mdx +1 -1
  21. package/docs/en/configure/app/performance/profile.mdx +1 -1
  22. package/docs/en/configure/app/plugins.mdx +1 -3
  23. package/docs/en/configure/app/runtime/router.mdx +0 -4
  24. package/docs/en/configure/app/security/sri.mdx +0 -1
  25. package/docs/en/configure/app/source/alias.mdx +1 -1
  26. package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
  27. package/docs/en/configure/app/source/include.mdx +2 -14
  28. package/docs/en/configure/app/tools/dev-server.mdx +8 -8
  29. package/docs/en/configure/app/usage.mdx +0 -12
  30. package/docs/en/guides/_meta.json +5 -0
  31. package/docs/en/guides/advanced-features/bff/_meta.json +9 -1
  32. package/docs/en/guides/advanced-features/bff/cross-project.mdx +1 -1
  33. package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -15
  34. package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
  35. package/docs/en/guides/advanced-features/bff/operators.mdx +628 -0
  36. package/docs/en/guides/advanced-features/bff/sdk.mdx +17 -9
  37. package/docs/en/guides/advanced-features/bff/upload.mdx +3 -1
  38. package/docs/en/guides/advanced-features/international/configuration.mdx +7 -16
  39. package/docs/en/guides/advanced-features/international/quick-start.mdx +4 -32
  40. package/docs/en/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
  41. package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +18 -4
  42. package/docs/en/guides/advanced-features/rspack-start.mdx +1 -1
  43. package/docs/en/guides/advanced-features/server-monitor/monitors.mdx +62 -5
  44. package/docs/en/guides/basic-features/data/data-cache.mdx +60 -76
  45. package/docs/en/guides/basic-features/data/data-fetch.mdx +15 -14
  46. package/docs/en/guides/basic-features/debug/proxy.mdx +6 -9
  47. package/docs/en/guides/basic-features/render/rsc.mdx +24 -19
  48. package/docs/en/guides/basic-features/render/ssg.mdx +4 -9
  49. package/docs/en/guides/basic-features/render/ssr-cache.mdx +0 -4
  50. package/docs/en/guides/basic-features/static-assets/svg-assets.mdx +0 -4
  51. package/docs/en/guides/get-started/tech-stack.mdx +1 -1
  52. package/docs/en/guides/upgrade/_meta.json +1 -0
  53. package/docs/en/guides/upgrade/config.mdx +936 -0
  54. package/docs/en/guides/upgrade/entry.mdx +463 -0
  55. package/docs/en/guides/upgrade/other.mdx +83 -0
  56. package/docs/en/guides/upgrade/overview.mdx +33 -0
  57. package/docs/en/guides/upgrade/tailwindcss.mdx +130 -0
  58. package/docs/en/guides/upgrade/web-server.mdx +91 -0
  59. package/docs/en/plugin/_meta.json +5 -0
  60. package/docs/en/plugin/cli-plugins/_meta.json +1 -1
  61. package/docs/en/plugin/cli-plugins/api.mdx +13 -63
  62. package/docs/en/plugin/cli-plugins/life-cycle.mdx +0 -4
  63. package/docs/en/plugin/introduction.mdx +8 -20
  64. package/docs/en/plugin/plugin-system.mdx +3 -3
  65. package/docs/en/plugin/runtime-plugins/_meta.json +1 -1
  66. package/docs/en/plugin/runtime-plugins/api.mdx +1 -1
  67. package/docs/en/plugin/server-plugins/_meta.json +1 -0
  68. package/docs/en/plugin/server-plugins/api.mdx +210 -1
  69. package/docs/en/plugin/server-plugins/life-cycle.mdx +41 -1
  70. package/docs/zh/apis/app/commands.mdx +6 -30
  71. package/docs/zh/components/bff-operator-code.mdx +5 -0
  72. package/docs/zh/components/bff-upload.mdx +0 -2
  73. package/docs/zh/components/bundler.mdx +1 -1
  74. package/docs/zh/components/enable-bff.mdx +6 -2
  75. package/docs/zh/components/enable-ssg.mdx +3 -1
  76. package/docs/zh/components/esbuild.mdx +2 -2
  77. package/docs/zh/components/extend-bff-function.mdx +2 -4
  78. package/docs/zh/components/hono.mdx +119 -0
  79. package/docs/zh/components/international/custom-instance-code.mdx +16 -0
  80. package/docs/zh/components/international/init-options-desc.mdx +1 -0
  81. package/docs/zh/components/international/install-command.mdx +15 -0
  82. package/docs/zh/components/international/instance-code.mdx +26 -0
  83. package/docs/zh/configure/app/builder-plugins.mdx +1 -2
  84. package/docs/zh/configure/app/dev/server.mdx +109 -2
  85. package/docs/zh/configure/app/experiments/source-build.mdx +0 -1
  86. package/docs/zh/configure/app/output/assets-retry.mdx +1 -1
  87. package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +2 -2
  88. package/docs/zh/configure/app/output/filename.mdx +2 -4
  89. package/docs/zh/configure/app/output/temp-dir.mdx +3 -3
  90. package/docs/zh/configure/app/performance/build-cache.mdx +1 -1
  91. package/docs/zh/configure/app/performance/profile.mdx +1 -1
  92. package/docs/zh/configure/app/plugins.mdx +1 -2
  93. package/docs/zh/configure/app/runtime/router.mdx +0 -4
  94. package/docs/zh/configure/app/security/sri.mdx +0 -1
  95. package/docs/zh/configure/app/source/alias.mdx +1 -1
  96. package/docs/zh/configure/app/source/enable-async-entry.mdx +1 -1
  97. package/docs/zh/configure/app/source/include.mdx +2 -16
  98. package/docs/zh/configure/app/tools/dev-server.mdx +5 -5
  99. package/docs/zh/configure/app/usage.mdx +0 -12
  100. package/docs/zh/guides/advanced-features/bff/_meta.json +9 -1
  101. package/docs/zh/guides/advanced-features/bff/frameworks.mdx +2 -16
  102. package/docs/zh/guides/advanced-features/bff/operators.mdx +628 -0
  103. package/docs/zh/guides/advanced-features/bff/sdk.mdx +19 -12
  104. package/docs/zh/guides/advanced-features/bff/upload.mdx +3 -1
  105. package/docs/zh/guides/advanced-features/international/configuration.mdx +7 -16
  106. package/docs/zh/guides/advanced-features/international/quick-start.mdx +2 -25
  107. package/docs/zh/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
  108. package/docs/zh/guides/advanced-features/page-performance/react-compiler.mdx +18 -4
  109. package/docs/zh/guides/advanced-features/server-monitor/monitors.mdx +60 -5
  110. package/docs/zh/guides/basic-features/data/data-cache.mdx +47 -54
  111. package/docs/zh/guides/basic-features/data/data-fetch.mdx +9 -12
  112. package/docs/zh/guides/basic-features/debug/proxy.mdx +4 -7
  113. package/docs/zh/guides/basic-features/render/rsc.mdx +23 -37
  114. package/docs/zh/guides/basic-features/render/ssr-cache.mdx +0 -4
  115. package/docs/zh/guides/basic-features/static-assets/svg-assets.mdx +0 -4
  116. package/docs/zh/guides/get-started/tech-stack.mdx +1 -1
  117. package/docs/zh/guides/troubleshooting/builder.mdx +1 -1
  118. package/docs/zh/guides/upgrade/config.mdx +132 -1
  119. package/docs/zh/plugin/_meta.json +5 -0
  120. package/docs/zh/plugin/cli-plugins/_meta.json +1 -1
  121. package/docs/zh/plugin/cli-plugins/api.mdx +15 -65
  122. package/docs/zh/plugin/cli-plugins/life-cycle.mdx +0 -4
  123. package/docs/zh/plugin/introduction.mdx +4 -16
  124. package/docs/zh/plugin/plugin-system.mdx +3 -14
  125. package/docs/zh/plugin/runtime-plugins/_meta.json +1 -1
  126. package/docs/zh/plugin/runtime-plugins/api.mdx +1 -1
  127. package/docs/zh/plugin/server-plugins/_meta.json +1 -0
  128. package/docs/zh/plugin/server-plugins/api.mdx +210 -1
  129. package/docs/zh/plugin/server-plugins/life-cycle.mdx +41 -1
  130. package/package.json +2 -2
  131. package/src/components/FrameworkCode/index.tsx +605 -0
  132. package/docs/en/configure/app/performance/bundle-analyze.mdx +0 -24
  133. package/docs/en/configure/app/tools/babel.mdx +0 -225
  134. package/docs/en/plugin/cli-plugins/migration.mdx +0 -83
  135. package/docs/en/plugin/runtime-plugins/migration.mdx +0 -110
  136. package/docs/zh/components/default-mwa-generate.mdx +0 -4
  137. package/docs/zh/configure/app/performance/bundle-analyze.mdx +0 -24
  138. package/docs/zh/configure/app/tools/babel.mdx +0 -224
  139. package/docs/zh/plugin/cli-plugins/migration.mdx +0 -83
  140. package/docs/zh/plugin/runtime-plugins/migration.mdx +0 -110
  141. /package/docs/en/components/{router-legacy-tip.mdx → upgrade-config-deploy.mdx} +0 -0
  142. /package/docs/zh/components/{router-legacy-tip.mdx → upgrade-config-deploy.mdx} +0 -0
@@ -9,10 +9,7 @@ title: include
9
9
 
10
10
  ```ts
11
11
  const defaultInclude = [
12
- [
13
- { not: /[\\/]node_modules[\\/]/ },
14
- /\.(?:ts|tsx|jsx|mts|cts)$/,
15
- ],
12
+ [{ not: /[\\/]node_modules[\\/]/ }, /\.(?:ts|tsx|jsx|mts|cts)$/],
16
13
  ];
17
14
  ```
18
15
 
@@ -28,10 +25,7 @@ Before Rsbuild version 1.4, the default value of `source.include` was:
28
25
  const defaultInclude = [
29
26
  [
30
27
  {
31
- and: [
32
- APP_ROOT,
33
- { not: /[\\/]node_modules[\\/]/ }
34
- ]
28
+ and: [APP_ROOT, { not: /[\\/]node_modules[\\/]/ }],
35
29
  },
36
30
  /\.(?:ts|tsx|jsx|mts|cts)$/,
37
31
  ],
@@ -41,12 +35,6 @@ const defaultInclude = [
41
35
  The difference from the new version is that `.js`, `.mjs`, `.cjs` files only in the current directory will be compiled.
42
36
  :::
43
37
 
44
- ## Rspack
45
-
46
38
  import RsbuildConfig from '@site-docs/components/rsbuild-config-tooltip';
47
39
 
48
40
  <RsbuildConfig configName="source.include" />
49
-
50
- ## Webpack
51
-
52
- To ensure legacy projects can run properly, when using Webpack, the default value of `source.include` is the same as before Rsbuild version 1.4.
@@ -151,16 +151,16 @@ type ProxyOptions =
151
151
  | ProxyDetail;
152
152
  ```
153
153
 
154
- In addition to the http-proxy-middleware option, we also support the bypass and context configuration:
154
+ In addition to the http-proxy-middleware options, two configuration items are also supported: bypass and context:
155
155
 
156
- - bypass: bypass the proxy based on the return value of a function.
157
- - Return `null` or `undefined` to continue processing the request with proxy.
158
- - Return `false` to produce a 404 error for the request.
159
- - Return a path to serve from, instead of continuing to proxy the request.
160
- - context: If you want to proxy multiple, specific paths to the same target, you can use an array of one or more objects with a context property.
156
+ - bypass: Bypass the proxy based on the return value of the function.
157
+ - Returning `null` or `undefined` will continue to process the request with proxy.
158
+ - Returning `false` will return a 404 error.
159
+ - Returning a specific service path will use this path to replace the original request path.
160
+ - context: If you want to proxy multiple specific paths to the same target, you can use the context configuration item.
161
161
 
162
162
  ```js
163
- // custom bypass
163
+ // Custom bypass method
164
164
  export default {
165
165
  tools: {
166
166
  devServer: {
@@ -181,7 +181,7 @@ export default {
181
181
  ```
182
182
 
183
183
  ```js
184
- // proxy multiple
184
+ // Proxy multiple paths to the same target
185
185
  export default {
186
186
  tools: {
187
187
  devServer: {
@@ -246,18 +246,6 @@ Modern.js exports the `AppUserConfig` type, which corresponds to the type of the
246
246
  ```ts title="modern.config.ts"
247
247
  import type { AppUserConfig } from '@modern-js/app-tools';
248
248
 
249
- const config: AppUserConfig = {
250
- tools: {
251
- webpack: {},
252
- },
253
- };
254
- ```
255
-
256
- When using Rspack as the bundler, due to some differences in configuration types between webpack and Rspack, you need to specify the ``generic for`AppUserConfig`:
257
-
258
- ```ts title="modern.config.ts"
259
- import type { AppUserConfig } from '@modern-js/app-tools';
260
-
261
249
  const config: AppUserConfig = {
262
250
  tools: {
263
251
  rspack: {},
@@ -28,5 +28,10 @@
28
28
  "type": "dir",
29
29
  "name": "troubleshooting",
30
30
  "label": "troubleshooting"
31
+ },
32
+ {
33
+ "type": "dir",
34
+ "name": "upgrade",
35
+ "label": "Upgrade"
31
36
  }
32
37
  ]
@@ -1 +1,9 @@
1
- ["function", "frameworks", "extend-server", "sdk", "upload", "cross-project"]
1
+ [
2
+ "function",
3
+ "frameworks",
4
+ "operators",
5
+ "extend-server",
6
+ "sdk",
7
+ "upload",
8
+ "cross-project"
9
+ ]
@@ -7,7 +7,7 @@ Cross-project invocation consists of **producer** and **consumer** sides. The pr
7
7
 
8
8
  ## BFF Producer
9
9
 
10
- Upgrade Modern.js dependencies to version x.64.4 or higher, then enable cross-project invocation via configuration. Projects with BFF capabilities enabled can act as BFF producers, or you can create standalone BFF applications.
10
+ Enable cross-project invocation via configuration. Projects with BFF capabilities enabled can act as BFF producers, or you can create standalone BFF applications.
11
11
  When executing `dev` or `build`, the following artifacts for consumers will be automatically generated:
12
12
  - API functions under the `dist/client` directory
13
13
  - Runtime configuration functions under the `dist/runtime` directory
@@ -7,19 +7,6 @@ title: Runtime Framework
7
7
 
8
8
  Modern.js uses [Hono.js](https://hono.dev/) as the BFF and Server runtime framework, so you can [extend BFF Server](/guides/advanced-features/bff/extend-server.html) based on the Hono.js ecosystem.
9
9
 
10
- ## Getting Request Context
10
+ import Hono from '@site-docs-en/components/hono';
11
11
 
12
- Sometimes in BFF functions, it's necessary to obtain the request context to handle more logic. In such cases, you can use `useHonoContext` to get it:
13
-
14
- ```ts title="api/lambda/hello.ts"
15
- import { useHonoContext } from '@modern-js/plugin-bff/server'
16
- export const get = async () => {
17
- const c = useHonoContext();
18
- console.info(`access url: ${c.req.url}`);
19
- return 'Hello Modern.js'
20
- };
21
- ```
22
-
23
- :::info
24
- For more details, refer to [useHonoContext](/apis/app/runtime/bff/use-hono-context).
25
- :::
12
+ <Hono />
@@ -6,9 +6,9 @@ This invocation method is called **unified invocation**, where developers do not
6
6
 
7
7
  ## Enable BFF
8
8
 
9
- import EnableBFF from "@site-docs-en/components/enable-bff"
9
+ import EnableBFF from '@site-docs-en/components/enable-bff';
10
10
 
11
- <EnableBFF/>
11
+ <EnableBFF />
12
12
 
13
13
  ## BFF Functions
14
14
 
@@ -252,9 +252,9 @@ export default () => {
252
252
 
253
253
  ## Extend BFF Function
254
254
 
255
- import ExtendBFF from "@site-docs-en/components/extend-bff-function"
255
+ import ExtendBFF from '@site-docs-en/components/extend-bff-function';
256
256
 
257
- <ExtendBFF/>
257
+ <ExtendBFF />
258
258
 
259
259
  ## Code Sharing
260
260