Skip to content

Commit a8c9cdb

Browse files
authored
feat(bridge): framework ability (#2605)
1 parent f7a6d3f commit a8c9cdb

File tree

186 files changed

+32795
-18904
lines changed

Some content is hidden

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

186 files changed

+32795
-18904
lines changed

.changeset/config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
"@module-federation/manifest",
1515
"@module-federation/dts-plugin",
1616
"@module-federation/third-party-dts-extractor",
17-
"@module-federation/devtools"
17+
"@module-federation/devtools",
18+
"@module-federation/bridge-react",
19+
"@module-federation/bridge-vue3",
20+
"@module-federation/bridge-shared",
21+
"@module-federation/bridge-react-webpack-plugin"
1822
]
1923
],
2024
"ignorePatterns": ["^alpha|^beta"],

.github/workflows/build-and-test.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@ jobs:
3838
run: npx nx format:check
3939

4040
- name: Run Affected Build
41-
run: pnpm run build:pkg
41+
run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
4242

4343
- name: Run Affected Lint
4444
run: npx nx affected -t lint --parallel=7 --exclude='*,!tag:type:pkg'
4545

4646
- name: Run Affected Test
4747
run: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg' --skip-nx-cache
4848

49-
- name: E2E Test for Next.js Dev
50-
run: |
51-
pnpm run app:next:dev > /dev/null 2>&1 &
52-
sleep 1 &&
53-
npx wait-on tcp:3001 &&
54-
npx wait-on tcp:3002 &&
55-
npx wait-on tcp:3000 &&
56-
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=3 &&
57-
lsof -ti tcp:3000,3001,3002 | xargs kill
58-
59-
- name: E2E Test for Next.js Prod
60-
run: |
61-
pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
62-
pnpm run app:next:prod &
63-
sleep 2 &&
64-
npx wait-on tcp:3001 &&
65-
npx wait-on tcp:3002 &&
66-
npx wait-on tcp:3000 &&
67-
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
68-
lsof -ti tcp:3000,3001,3002 | xargs kill
49+
# - name: E2E Test for Next.js Dev
50+
# run: |
51+
# pnpm run app:next:dev > /dev/null 2>&1 &
52+
# sleep 1 &&
53+
# npx wait-on tcp:3001 &&
54+
# npx wait-on tcp:3002 &&
55+
# npx wait-on tcp:3000 &&
56+
# npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=3 &&
57+
# lsof -ti tcp:3000,3001,3002 | xargs kill
58+
59+
# - name: E2E Test for Next.js Prod
60+
# run: |
61+
# pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
62+
# pnpm run app:next:prod &
63+
# sleep 2 &&
64+
# npx wait-on tcp:3001 &&
65+
# npx wait-on tcp:3002 &&
66+
# npx wait-on tcp:3000 &&
67+
# npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
68+
# lsof -ti tcp:3000,3001,3002 | xargs kill
6969

7070
- name: E2E Test for ModernJS
7171
run: npx nx run-many --target=test:e2e --projects=modernjs --parallel=1 && lsof -ti tcp:4001 | xargs kill

.github/workflows/devtools.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ jobs:
3535
run: pnpm install
3636

3737
- name: Run Affected Build
38-
run: npx nx build --parallel=10 --exclude='*,!tag:type:pkg'
38+
run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
3939

4040
- name: Configuration xvfb
4141
shell: bash
4242
run: sudo apt-get update && sudo apt-get install xvfb
4343

4444
- name: E2E Chrome Devtools
45-
run: |
46-
pnpm run app:manifest:dev & echo "done" && sleep 50 && npx nx e2e:devtools chrome-devtools && lsof -ti tcp:3008,3009,3010,3011,3012 | xargs kill
45+
run: pnpm run app:manifest:dev & echo "done" && sleep 50 && npx nx e2e:devtools chrome-devtools
46+
47+
- name: kill port
48+
run: lsof -ti tcp:3008,3009,3010,3011,3012 | xargs kill

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ apps/**/dist
5555
!packages/enhanced/test/configCases/**/**/node_modules
5656
packages/enhanced/test/js
5757
.ignored
58-
/.mf
58+
**/.mf
59+
**/.mf/**
5960

apps/manifest-demo/3008-webpack-host/@mf-types/index.d.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
import type { PackageType as PackageType_0,RemoteKeys as RemoteKeys_0 } from './js-entry-provider/apis.d.ts';
2-
import type { PackageType as PackageType_1,RemoteKeys as RemoteKeys_1 } from './manifest-provider/apis.d.ts';
1+
import type { PackageType as PackageType_0,RemoteKeys as RemoteKeys_0 } from './dynamic-remote/apis.d.ts';
2+
import type { PackageType as PackageType_1,RemoteKeys as RemoteKeys_1 } from './js-entry-provider/apis.d.ts';
3+
import type { PackageType as PackageType_2,RemoteKeys as RemoteKeys_2 } from './manifest-provider/apis.d.ts';
34
declare module "@module-federation/runtime" {
4-
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
5+
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1 | RemoteKeys_2;
56
type PackageType<T, Y=any> = T extends RemoteKeys_0 ? PackageType_0<T> :
67
T extends RemoteKeys_1 ? PackageType_1<T> :
8+
T extends RemoteKeys_2 ? PackageType_2<T> :
79
Y ;
810
export function loadRemote<T extends RemoteKeys,Y>(packageName: T): Promise<PackageType<T, Y>>;
911
export function loadRemote<T extends string,Y>(packageName: T): Promise<PackageType<T, Y>>;
1012
}
1113
declare module "@module-federation/enhanced/runtime" {
12-
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
14+
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1 | RemoteKeys_2;
1315
type PackageType<T, Y=any> = T extends RemoteKeys_0 ? PackageType_0<T> :
1416
T extends RemoteKeys_1 ? PackageType_1<T> :
17+
T extends RemoteKeys_2 ? PackageType_2<T> :
1518
Y ;
1619
export function loadRemote<T extends RemoteKeys,Y>(packageName: T): Promise<PackageType<T, Y>>;
1720
export function loadRemote<T extends string,Y>(packageName: T): Promise<PackageType<T, Y>>;
1821
}
1922
declare module "@module-federation/runtime-tools" {
20-
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1;
23+
type RemoteKeys = RemoteKeys_0 | RemoteKeys_1 | RemoteKeys_2;
2124
type PackageType<T, Y=any> = T extends RemoteKeys_0 ? PackageType_0<T> :
2225
T extends RemoteKeys_1 ? PackageType_1<T> :
26+
T extends RemoteKeys_2 ? PackageType_2<T> :
2327
Y ;
2428
export function loadRemote<T extends RemoteKeys,Y>(packageName: T): Promise<PackageType<T, Y>>;
2529
export function loadRemote<T extends string,Y>(packageName: T): Promise<PackageType<T, Y>>;

apps/manifest-demo/3008-webpack-host/@mf-types/js-entry-provider/apis.d.ts

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

apps/manifest-demo/3008-webpack-host/@mf-types/manifest-provider/apis.d.ts

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

apps/router-demo/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## How to run the e2e project
2+
3+
```bash
4+
# Root directory
5+
pnpm install
6+
pnpm run app:router:dev
7+
8+
open http://localhost:2000/
9+
open http://localhost:2100/
10+
```
11+
12+
## Function description
13+
14+
> Scenario description
15+
16+
* This demo mainly demonstrates how to use the mf bridge library to load a module with routing
17+
* How to load modules between vue and react projects
18+
19+
## Test run
20+
21+
* nx e2e router-host-2000 --watch
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Rsbuild Project
2+
3+
## Setup
4+
5+
Install the dependencies:
6+
7+
```bash
8+
pnpm install
9+
```
10+
11+
## Get Started
12+
13+
Start the dev server:
14+
15+
```bash
16+
pnpm dev
17+
```
18+
19+
Build the app for production:
20+
21+
```bash
22+
pnpm build
23+
```
24+
25+
Preview the production build locally:
26+
27+
```bash
28+
pnpm preview
29+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
2+
import { defineConfig } from 'cypress';
3+
4+
export default defineConfig({
5+
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
6+
defaultCommandTimeout: 20000,
7+
});

0 commit comments

Comments
 (0)