@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.
- package/docs/en/apis/app/commands.mdx +6 -30
- package/docs/en/components/bff-upload.mdx +3 -5
- package/docs/en/components/bundler.mdx +1 -1
- package/docs/en/components/enable-bff.mdx +6 -2
- package/docs/en/components/enable-ssg.mdx +1 -0
- package/docs/en/components/esbuild.mdx +2 -2
- package/docs/en/components/extend-bff-function.mdx +2 -4
- package/docs/en/components/hono.mdx +119 -0
- package/docs/en/components/international/custom-instance-code.mdx +16 -0
- package/docs/en/components/international/init-options-desc.mdx +1 -0
- package/docs/en/components/international/install-command.mdx +15 -1
- package/docs/en/components/international/instance-code.mdx +26 -0
- package/docs/en/configure/app/builder-plugins.mdx +1 -2
- package/docs/en/configure/app/dev/server.mdx +108 -0
- package/docs/en/configure/app/experiments/source-build.mdx +0 -1
- package/docs/en/configure/app/output/assets-retry.mdx +1 -1
- package/docs/en/configure/app/output/disable-inline-runtime-chunk.mdx +2 -2
- package/docs/en/configure/app/output/filename.mdx +2 -4
- package/docs/en/configure/app/output/temp-dir.mdx +3 -3
- package/docs/en/configure/app/performance/build-cache.mdx +1 -1
- package/docs/en/configure/app/performance/profile.mdx +1 -1
- package/docs/en/configure/app/plugins.mdx +1 -3
- package/docs/en/configure/app/runtime/router.mdx +0 -4
- package/docs/en/configure/app/security/sri.mdx +0 -1
- package/docs/en/configure/app/source/alias.mdx +1 -1
- package/docs/en/configure/app/source/enable-async-entry.mdx +1 -1
- package/docs/en/configure/app/source/include.mdx +2 -14
- package/docs/en/configure/app/tools/dev-server.mdx +8 -8
- package/docs/en/configure/app/usage.mdx +0 -12
- package/docs/en/guides/_meta.json +5 -0
- package/docs/en/guides/advanced-features/bff/_meta.json +9 -1
- package/docs/en/guides/advanced-features/bff/cross-project.mdx +1 -1
- package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -15
- package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
- package/docs/en/guides/advanced-features/bff/operators.mdx +628 -0
- package/docs/en/guides/advanced-features/bff/sdk.mdx +17 -9
- package/docs/en/guides/advanced-features/bff/upload.mdx +3 -1
- package/docs/en/guides/advanced-features/international/configuration.mdx +7 -16
- package/docs/en/guides/advanced-features/international/quick-start.mdx +4 -32
- package/docs/en/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
- package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +18 -4
- package/docs/en/guides/advanced-features/rspack-start.mdx +1 -1
- package/docs/en/guides/advanced-features/server-monitor/monitors.mdx +62 -5
- package/docs/en/guides/basic-features/data/data-cache.mdx +60 -76
- package/docs/en/guides/basic-features/data/data-fetch.mdx +15 -14
- package/docs/en/guides/basic-features/debug/proxy.mdx +6 -9
- package/docs/en/guides/basic-features/render/rsc.mdx +24 -19
- package/docs/en/guides/basic-features/render/ssg.mdx +4 -9
- package/docs/en/guides/basic-features/render/ssr-cache.mdx +0 -4
- package/docs/en/guides/basic-features/static-assets/svg-assets.mdx +0 -4
- package/docs/en/guides/get-started/tech-stack.mdx +1 -1
- package/docs/en/guides/upgrade/_meta.json +1 -0
- package/docs/en/guides/upgrade/config.mdx +936 -0
- package/docs/en/guides/upgrade/entry.mdx +463 -0
- package/docs/en/guides/upgrade/other.mdx +83 -0
- package/docs/en/guides/upgrade/overview.mdx +33 -0
- package/docs/en/guides/upgrade/tailwindcss.mdx +130 -0
- package/docs/en/guides/upgrade/web-server.mdx +91 -0
- package/docs/en/plugin/_meta.json +5 -0
- package/docs/en/plugin/cli-plugins/_meta.json +1 -1
- package/docs/en/plugin/cli-plugins/api.mdx +13 -63
- package/docs/en/plugin/cli-plugins/life-cycle.mdx +0 -4
- package/docs/en/plugin/introduction.mdx +8 -20
- package/docs/en/plugin/plugin-system.mdx +3 -3
- package/docs/en/plugin/runtime-plugins/_meta.json +1 -1
- package/docs/en/plugin/runtime-plugins/api.mdx +1 -1
- package/docs/en/plugin/server-plugins/_meta.json +1 -0
- package/docs/en/plugin/server-plugins/api.mdx +210 -1
- package/docs/en/plugin/server-plugins/life-cycle.mdx +41 -1
- package/docs/zh/apis/app/commands.mdx +6 -30
- package/docs/zh/components/bff-operator-code.mdx +5 -0
- package/docs/zh/components/bff-upload.mdx +0 -2
- package/docs/zh/components/bundler.mdx +1 -1
- package/docs/zh/components/enable-bff.mdx +6 -2
- package/docs/zh/components/enable-ssg.mdx +3 -1
- package/docs/zh/components/esbuild.mdx +2 -2
- package/docs/zh/components/extend-bff-function.mdx +2 -4
- package/docs/zh/components/hono.mdx +119 -0
- package/docs/zh/components/international/custom-instance-code.mdx +16 -0
- package/docs/zh/components/international/init-options-desc.mdx +1 -0
- package/docs/zh/components/international/install-command.mdx +15 -0
- package/docs/zh/components/international/instance-code.mdx +26 -0
- package/docs/zh/configure/app/builder-plugins.mdx +1 -2
- package/docs/zh/configure/app/dev/server.mdx +109 -2
- package/docs/zh/configure/app/experiments/source-build.mdx +0 -1
- package/docs/zh/configure/app/output/assets-retry.mdx +1 -1
- package/docs/zh/configure/app/output/disable-inline-runtime-chunk.mdx +2 -2
- package/docs/zh/configure/app/output/filename.mdx +2 -4
- package/docs/zh/configure/app/output/temp-dir.mdx +3 -3
- package/docs/zh/configure/app/performance/build-cache.mdx +1 -1
- package/docs/zh/configure/app/performance/profile.mdx +1 -1
- package/docs/zh/configure/app/plugins.mdx +1 -2
- package/docs/zh/configure/app/runtime/router.mdx +0 -4
- package/docs/zh/configure/app/security/sri.mdx +0 -1
- package/docs/zh/configure/app/source/alias.mdx +1 -1
- package/docs/zh/configure/app/source/enable-async-entry.mdx +1 -1
- package/docs/zh/configure/app/source/include.mdx +2 -16
- package/docs/zh/configure/app/tools/dev-server.mdx +5 -5
- package/docs/zh/configure/app/usage.mdx +0 -12
- package/docs/zh/guides/advanced-features/bff/_meta.json +9 -1
- package/docs/zh/guides/advanced-features/bff/frameworks.mdx +2 -16
- package/docs/zh/guides/advanced-features/bff/operators.mdx +628 -0
- package/docs/zh/guides/advanced-features/bff/sdk.mdx +19 -12
- package/docs/zh/guides/advanced-features/bff/upload.mdx +3 -1
- package/docs/zh/guides/advanced-features/international/configuration.mdx +7 -16
- package/docs/zh/guides/advanced-features/international/quick-start.mdx +2 -25
- package/docs/zh/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
- package/docs/zh/guides/advanced-features/page-performance/react-compiler.mdx +18 -4
- package/docs/zh/guides/advanced-features/server-monitor/monitors.mdx +60 -5
- package/docs/zh/guides/basic-features/data/data-cache.mdx +47 -54
- package/docs/zh/guides/basic-features/data/data-fetch.mdx +9 -12
- package/docs/zh/guides/basic-features/debug/proxy.mdx +4 -7
- package/docs/zh/guides/basic-features/render/rsc.mdx +23 -37
- package/docs/zh/guides/basic-features/render/ssr-cache.mdx +0 -4
- package/docs/zh/guides/basic-features/static-assets/svg-assets.mdx +0 -4
- package/docs/zh/guides/get-started/tech-stack.mdx +1 -1
- package/docs/zh/guides/troubleshooting/builder.mdx +1 -1
- package/docs/zh/guides/upgrade/config.mdx +132 -1
- package/docs/zh/plugin/_meta.json +5 -0
- package/docs/zh/plugin/cli-plugins/_meta.json +1 -1
- package/docs/zh/plugin/cli-plugins/api.mdx +15 -65
- package/docs/zh/plugin/cli-plugins/life-cycle.mdx +0 -4
- package/docs/zh/plugin/introduction.mdx +4 -16
- package/docs/zh/plugin/plugin-system.mdx +3 -14
- package/docs/zh/plugin/runtime-plugins/_meta.json +1 -1
- package/docs/zh/plugin/runtime-plugins/api.mdx +1 -1
- package/docs/zh/plugin/server-plugins/_meta.json +1 -0
- package/docs/zh/plugin/server-plugins/api.mdx +210 -1
- package/docs/zh/plugin/server-plugins/life-cycle.mdx +41 -1
- package/package.json +2 -2
- package/src/components/FrameworkCode/index.tsx +605 -0
- package/docs/en/configure/app/performance/bundle-analyze.mdx +0 -24
- package/docs/en/configure/app/tools/babel.mdx +0 -225
- package/docs/en/plugin/cli-plugins/migration.mdx +0 -83
- package/docs/en/plugin/runtime-plugins/migration.mdx +0 -110
- package/docs/zh/components/default-mwa-generate.mdx +0 -4
- package/docs/zh/configure/app/performance/bundle-analyze.mdx +0 -24
- package/docs/zh/configure/app/tools/babel.mdx +0 -224
- package/docs/zh/plugin/cli-plugins/migration.mdx +0 -83
- package/docs/zh/plugin/runtime-plugins/migration.mdx +0 -110
- /package/docs/en/components/{router-legacy-tip.mdx → upgrade-config-deploy.mdx} +0 -0
- /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
|
|
154
|
+
In addition to the http-proxy-middleware options, two configuration items are also supported: bypass and context:
|
|
155
155
|
|
|
156
|
-
- bypass:
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
- context: If you want to proxy multiple
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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: {},
|
|
@@ -7,7 +7,7 @@ Cross-project invocation consists of **producer** and **consumer** sides. The pr
|
|
|
7
7
|
|
|
8
8
|
## BFF Producer
|
|
9
9
|
|
|
10
|
-
|
|
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
|
-
|
|
10
|
+
import Hono from '@site-docs-en/components/hono';
|
|
11
11
|
|
|
12
|
-
|
|
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
|
|
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
|
|
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
|
|