Skip to content

Commit 833031b

Browse files
Merge branch 'main' into nextjs
2 parents 76f09cf + 7693f32 commit 833031b

File tree

88 files changed

+1537
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1537
-1263
lines changed

.changeset/beige-apricots-switch.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/early-tools-compete.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/rare-rockets-wink.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/rich-bees-applaud.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/silly-experts-begin.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/slimy-horses-give.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/spotty-trains-stare.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/violet-boxes-happen.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/weak-spoons-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/modern-js': patch
3+
---
4+
5+
fix(modern-js-plugin): adjust fetch type

apps/modernjs/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @module-federation/modernjsapp
22

3+
## 0.1.99
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [ad446af]
8+
- @module-federation/enhanced@0.15.0
9+
310
## 0.1.98
411

512
### Patch Changes

apps/modernjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@module-federation/modernjsapp",
33
"private": true,
4-
"version": "0.1.98",
4+
"version": "0.1.99",
55
"scripts": {
66
"reset": "npx rimraf ./**/node_modules",
77
"dev": "modern dev",

apps/router-demo/router-remote5-2005/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# remote5
22

3+
## 1.1.6
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [f777710]
8+
- @module-federation/rsbuild-plugin@0.15.0
9+
- @module-federation/bridge-react@0.15.0
10+
311
## 1.1.5
412

513
### Patch Changes

apps/router-demo/router-remote5-2005/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "remote5",
33
"private": true,
4-
"version": "1.1.5",
4+
"version": "1.1.6",
55
"scripts": {
66
"dev": "rsbuild dev",
77
"build": "rsbuild build",

apps/website-new/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# website-new
22

3+
## 1.1.6
4+
5+
### Patch Changes
6+
7+
- @module-federation/error-codes@0.15.0
8+
39
## 1.1.5
410

511
### Patch Changes

apps/website-new/docs/en/guide/basic/runtime.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ init({
4646
entry: "http://localhost:3006/remoteEntry.js",
4747
alias: "app2"
4848
},
49-
{
49+
{
5050
name: "@demo/app4",
5151
entry: "http://localhost:3006/remoteEntry.mjs",
5252
alias: "app2",

apps/website-new/docs/en/guide/framework/modernjs.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ In CSR applications, the loader function executes in the browser, meaning they a
251251
In SSR applications, the loader function only executes on the server, meaning they are all Server Loaders by default. In SSR, Module Federation directly calls the corresponding loader function on the server. When switching routes in the browser, Module Federation sends an HTTP request to the SSR service, which also triggers the loader function on the server.
252252

253253
:::note NOTE
254+
254255
Having the loader function for SSR applications execute only on the server offers the following benefits:
255256

256257
- Simplified usage: Ensures that data fetching in SSR applications is isomorphic, so developers don't need to differentiate loader function execution code based on the environment.
257258
- Reduced browser bundle size: Moves logic code and its dependencies from the browser to the server.
258259
- Improved maintainability: Moves logic code to the server, reducing the direct impact of data logic on the frontend UI. Additionally, it prevents accidental inclusion of server-side dependencies in the browser bundle or browser-side dependencies in the server bundle.
260+
259261
:::
260262

261263
#### Using Client Loader in SSR Applications
@@ -280,6 +282,7 @@ export async function loader({ params }) {
280282
}
281283
}
282284
```
285+
283286
:::warning WARNING
284287
To use a Client Loader, there must be a corresponding Server Loader, and the Server Loader must be defined using the `.data` file convention, not the `.loader` file convention.
285288
:::
@@ -483,7 +486,7 @@ export default Index;
483486

484487
If the current project only needs to load MF in CSR, you can set `ssr: false` to help with progressive migration.
485488

486-
```title='modern.config.ts'
489+
```ts title='modern.config.ts'
487490
import { appTools, defineConfig } from '@modern-js/app-tools';
488491
import { moduleFederationPlugin } from '@module-federation/modern-js';
489492

apps/website-new/docs/en/practice/frameworks/modern/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Modern.js also supports dependency management with `yarn` and `npm`.
5555
:::
5656

5757

58-
## 创建项目
58+
## Create Project
5959

6060
`@modern-js/create` provides an interactive Q & A interface to initialize the project based on the results, with initialization performed according to the default settings:
6161

apps/website-new/docs/en/practice/frameworks/next/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next build
169169

170170
`.env` can be set as well, but can be unreliable in setting `NEXT_PRIVATE_LOCAL_WEBPACK` in time.
171171

172-
```.env title=".env"
172+
```ini title=".env"
173173
NEXT_PRIVATE_LOCAL_WEBPACK=true
174174
```
175175

apps/website-new/docs/zh/guide/framework/modernjs.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,13 @@ loader 函数可能会在服务端或浏览器端执行。在服务端执行的
252252
在 SSR 应用中,loader 函数只会在服务端执行,即默认都是 Server Loader。在 SSR Module Federation 会直接在服务端调用对应的 loader 函数。在浏览器端切换路由时,Module Federation 会发送一个 http 请求到 SSR 服务,同样在服务端触发 loader 函数。
253253

254254
:::note NOTE
255+
255256
SSR 应用的 loader 函数只在服务端执行可以带来以下好处:
256257

257258
简化使用方式:保证 SSR 应用获取数据的方式是同构的,开发者无需根据环境区分 loader 函数执行的代码。
258259
减少浏览器端 bundle 体积:将逻辑代码及其依赖,从浏览器端移动到了服务端。
259260
提高可维护性:将逻辑代码移动到服务端,减少了数据逻辑对前端 UI 的直接影响。此外,也避免了浏览器端 bundle 中误引入服务端依赖,或服务端 bundle 中误引入浏览器端依赖的问题。
261+
260262
:::
261263

262264
#### 在 SSR 应用中使用 Client Loader
@@ -282,7 +284,9 @@ export async function loader({ params }) {
282284
}
283285
```
284286
:::warning WARNING
287+
285288
要使用 Client Loader,必须有对应的 Server Loader,且 Server Loader 必须是 .data 文件约定,不能是 .loader 文件约定。
289+
286290
:::
287291

288292
### FAQ
@@ -484,7 +488,7 @@ export default Index;
484488

485489
如果当前项目仅需要在 CSR 加载 MF ,那么可以设置 `ssr: false` 来帮助渐进式迁移。
486490

487-
```title='modern.config.ts'
491+
```ts title='modern.config.ts'
488492
import { appTools, defineConfig } from '@modern-js/app-tools';
489493
import { moduleFederationPlugin } from '@module-federation/modern-js';
490494

apps/website-new/docs/zh/practice/frameworks/next/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next build
164164

165165
`.env` 也可以设置,但及时设置 `NEXT_PRIVATE_LOCAL_WEBPACK` 可能不可靠。
166166

167-
```.env title=".env"
167+
```ini title=".env"
168168
NEXT_PRIVATE_LOCAL_WEBPACK=true
169169
```
170170

apps/website-new/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "website-new",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"private": true,
55
"scripts": {
66
"dev": "rspress dev",
@@ -9,12 +9,14 @@
99
},
1010
"dependencies": {
1111
"framer-motion": "^10.0.0",
12-
"rspress": "1.34.1",
12+
"rspress": "2.0.0-beta.13",
1313
"tailwindcss": "^3.2.7",
1414
"video-react": "^0.16.0",
1515
"xgplayer": "^3.0.16",
1616
"rspress-plugin-annotation-words": "0.0.1",
17-
"@module-federation/error-codes": "workspace:*"
17+
"@rsbuild/plugin-sass": "^1.3.2",
18+
"@module-federation/error-codes": "workspace:*",
19+
"@rspress/plugin-llms": "2.0.0-beta.13"
1820
},
1921
"devDependencies": {
2022
"@types/node": "^20"

apps/website-new/rspress.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import * as path from 'path';
22
import { defineConfig } from 'rspress/config';
33
import { moduleFederationPluginOverview } from './src/moduleFederationPluginOverview';
44
import { pluginAnnotationWords } from 'rspress-plugin-annotation-words';
5+
import { pluginSass } from '@rsbuild/plugin-sass';
6+
import { pluginLlms } from '@rspress/plugin-llms';
57

68
const getNavbar = (lang: string) => {
79
const cn = lang === 'zh';
@@ -81,15 +83,16 @@ export default defineConfig({
8183
pluginAnnotationWords({
8284
wordsMapPath: 'words-map.json',
8385
}),
86+
pluginLlms(),
8487
],
8588
builderConfig: {
86-
plugins: [moduleFederationPluginOverview],
89+
plugins: [moduleFederationPluginOverview, pluginSass()],
8790
tools: {
8891
postcss: (config, { addPlugins }) => {
8992
addPlugins([require('tailwindcss/nesting'), require('tailwindcss')]);
9093
},
9194
},
92-
source: {
95+
resolve: {
9396
alias: {
9497
'@site': path.resolve(__dirname),
9598
'@components': path.join(__dirname, 'src/components'),

apps/website-new/src/components/AnnouncementVideo.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect, useLayoutEffect, useState } from 'react';
22
import { useI18n } from '../../theme/i18n';
33
import Player from 'xgplayer';
44
import 'xgplayer/dist/index.min.css';
@@ -31,13 +31,17 @@ export default function AnnouncementVideo(props: {
3131
};
3232
}
3333

34-
const [divWidth, setDivWidth] = useState(window.innerWidth);
34+
const [divWidth, setDivWidth] = useState(0);
3535

3636
// 更新宽度的函数
3737
const updateWidth = () => {
3838
setDivWidth(window.innerWidth);
3939
};
4040

41+
useLayoutEffect(() => {
42+
updateWidth();
43+
}, []);
44+
4145
useEffect(() => {
4246
window.addEventListener('resize', updateWidth);
4347

apps/website-new/theme/components/HomeFeature/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function HomeFeature({ features }: { features: Feature[] }) {
5252
}
5353
}}
5454
>
55-
<div className="flex-center">
55+
<div className="flex justify-center items-center">
5656
<div className="w-12 h-12 text-3xl text-center">{icon}</div>
5757
</div>
5858
<h2 className="font-bold text-center">{title}</h2>

apps/website-new/theme/components/HomeFooter/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function HomeFooter() {
8787
</div>
8888
))}
8989
</div>
90-
<div className="flex flex-center">
90+
<div className="flex justify-center items-center">
9191
<h2 className="font-normal text-sm text-gray-600 dark:text-light-600 py-4">
9292
© {new Date().getFullYear()} Module Federation core team. All Rights
9393
Reserved.

apps/website-new/theme/components/HomeHero/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,18 @@ export function HomeHero({ hero }: { hero: Hero }) {
5050
<Button
5151
className="pl-2 pr-2"
5252
type="a"
53-
text={action.text}
5453
href={normalizeHrefInRuntime(action.link)}
5554
theme={action.theme}
56-
/>
55+
>
56+
{action.text}
57+
</Button>
5758
</div>
5859
))}
5960
</div>
6061
</div>
6162

6263
{hasImage ? (
63-
<div className="modern-doc-home-hero-image m-auto flex-center md:none lg:flex order-1 md:order-2">
64+
<div className="modern-doc-home-hero-image m-auto justify-center items-center md:none lg:flex order-1 md:order-2">
6465
<div className={styles.imgMask}></div>
6566
<img src="/svg.svg" alt={hero.image?.alt} />
6667
</div>

apps/website-new/theme/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import Theme from 'rspress/theme';
21
import { HomeLayout } from './pages';
32
import './index.css';
43

5-
// eslint-disable-next-line import/export
4+
export { HomeLayout };
65
export * from 'rspress/theme';
7-
8-
export default {
9-
...Theme,
10-
HomeLayout,
11-
};

packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @module-federation/bridge-react-webpack-plugin
22

3+
## 0.15.0
4+
5+
### Patch Changes
6+
7+
- @module-federation/sdk@0.15.0
8+
39
## 0.14.3
410

511
### Patch Changes

packages/bridge/bridge-react-webpack-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-react-webpack-plugin",
3-
"version": "0.14.3",
3+
"version": "0.15.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/bridge/bridge-react/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @module-federation/bridge-react
22

3+
## 0.15.0
4+
5+
### Patch Changes
6+
7+
- @module-federation/sdk@0.15.0
8+
- @module-federation/bridge-shared@0.15.0
9+
310
## 0.14.3
411

512
### Patch Changes

packages/bridge/bridge-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-react",
3-
"version": "0.14.3",
3+
"version": "0.15.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/bridge/bridge-shared/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# @module-federation/bridge-shared
22

3+
## 0.15.0
4+
35
## 0.14.3
46

57
## 0.14.2

packages/bridge/bridge-shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-shared",
3-
"version": "0.14.3",
3+
"version": "0.15.0",
44
"publishConfig": {
55
"access": "public"
66
},

0 commit comments

Comments
 (0)