Skip to content

Commit de4c892

Browse files
committed
refactor: use new ModuleFederation instead of init
1 parent 028d645 commit de4c892

File tree

72 files changed

+947
-1975
lines changed

Some content is hidden

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

72 files changed

+947
-1975
lines changed

apps/manifest-demo/webpack-host/runtimePlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { FederationRuntimePlugin } from '@module-federation/runtime/types';
1+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
22

3-
export default function (): FederationRuntimePlugin {
3+
export default function (): ModuleFederationRuntimePlugin {
44
return {
55
name: 'custom-plugin-build',
66
beforeInit(args) {

apps/manifest-demo/webpack-host/src/runtimePlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FederationRuntimePlugin } from '@module-federation/runtime/types';
2-
export default function (): FederationRuntimePlugin {
1+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
2+
export default function (): ModuleFederationRuntimePlugin {
33
return {
44
name: 'custom-plugin',
55
beforeInit(args) {

apps/node-host/runtimePlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FederationRuntimePlugin } from '@module-federation/runtime/types';
1+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
22

33
export default function () {
44
return {

apps/router-demo/router-host-2000/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import './App.css';
1515
import BridgeReactPlugin from '@module-federation/bridge-react/plugin';
1616
import { ErrorBoundary } from 'react-error-boundary';
1717
import Remote1AppNew from 'remote1/app';
18-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
18+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1919
import { Spin } from 'antd';
2020

21-
const fallbackPlugin: () => FederationRuntimePlugin = function () {
21+
const fallbackPlugin: () => ModuleFederationRuntimePlugin = function () {
2222
return {
2323
name: 'fallback-plugin',
2424
errorLoadRemote(args) {

apps/router-demo/router-host-2000/src/runtime-plugin/error-handling/lifecycle-based.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* 2. Entry File Loading (afterResolve): Attempts to load from a backup service
1010
*/
1111

12-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
12+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1313

1414
interface LifecycleBasedConfig {
1515
backupEntryUrl?: string;
@@ -18,7 +18,7 @@ interface LifecycleBasedConfig {
1818

1919
export const createLifecycleBasedPlugin = (
2020
config: LifecycleBasedConfig = {},
21-
): FederationRuntimePlugin => {
21+
): ModuleFederationRuntimePlugin => {
2222
const {
2323
backupEntryUrl = 'http://localhost:2002/mf-manifest.json',
2424
errorMessage = 'Module loading failed, please try again later',

apps/router-demo/router-host-2000/src/runtime-plugin/error-handling/simple.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
* Use this when you don't need different handling strategies for different error types.
1313
*/
1414

15-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
15+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1616

1717
interface SimpleConfig {
1818
errorMessage?: string;
1919
}
2020

2121
export const createSimplePlugin = (
2222
config: SimpleConfig = {},
23-
): FederationRuntimePlugin => {
23+
): ModuleFederationRuntimePlugin => {
2424
const { errorMessage = 'Module loading failed, please try again later' } =
2525
config;
2626

apps/router-demo/router-host-2000/src/runtime-plugin/fallback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
22
import {
33
createLifecycleBasedPlugin,
44
createSimplePlugin,
@@ -15,7 +15,7 @@ interface FallbackConfig {
1515

1616
const fallbackPlugin = (
1717
config: FallbackConfig = {},
18-
): FederationRuntimePlugin => {
18+
): ModuleFederationRuntimePlugin => {
1919
const {
2020
backupEntryUrl = 'http://localhost:2002/mf-manifest.json',
2121
errorMessage = 'Module loading failed, please try again later',

apps/router-demo/router-host-2000/src/runtime-plugin/shared-strategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
22

33
// The default external policy is version-first: the version with a higher version is used preferentially, even if the version is not loaded. Internally, it must be compatible with the previous logic, mainly loading
4-
const sharedStrategy: () => FederationRuntimePlugin = () => ({
4+
const sharedStrategy: () => ModuleFederationRuntimePlugin = () => ({
55
name: 'shared-strategy',
66
beforeInit(args) {
77
const { userOptions, shareInfo } = args;

apps/router-demo/router-host-v5-2200/src/runtime-plugin/shared-strategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1+
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
22

33
// The default external policy is version-first: the version with a higher version is used preferentially, even if the version is not loaded. Internally, it must be compatible with the previous logic, mainly loading
4-
const sharedStrategy: () => FederationRuntimePlugin = () => ({
4+
const sharedStrategy: () => ModuleFederationRuntimePlugin = () => ({
55
name: 'shared-strategy',
66
beforeInit(args) {
77
const { userOptions, shareInfo } = args;

apps/runtime-demo/3005-runtime-host/src/runtimePlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FederationRuntimePlugin } from '@module-federation/runtime/types';
2-
export default function (): FederationRuntimePlugin {
1+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
2+
export default function (): ModuleFederationRuntimePlugin {
33
return {
44
name: 'custom-plugin',
55
beforeInit(args) {

0 commit comments

Comments
 (0)