@module-federation/bridge-react 0.0.0-next-20250708134245 → 0.0.0-next-20250709032753
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/CHANGELOG.md +4 -8
- package/__tests__/bridge.spec.tsx +7 -7
- package/dist/{bridge-base-UGCwcMnG.js → bridge-base-BBH982Tz.cjs} +1 -1
- package/dist/{bridge-base-BoshEggF.mjs → bridge-base-P6pEjY1q.js} +1 -1
- package/dist/index-Cv3p6r66.cjs +235 -0
- package/dist/index-D4yt7Udv.js +236 -0
- package/dist/index.cjs.js +9 -35
- package/dist/index.d.ts +0 -144
- package/dist/index.es.js +12 -38
- package/dist/plugin.d.ts +0 -9
- package/dist/router-v5.cjs.js +1 -1
- package/dist/router-v5.d.ts +0 -9
- package/dist/router-v5.es.js +1 -1
- package/dist/router-v6.cjs.js +1 -1
- package/dist/router-v6.d.ts +0 -9
- package/dist/router-v6.es.js +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.d.ts +0 -9
- package/dist/router.es.js +1 -1
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.d.ts +0 -9
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.d.ts +0 -9
- package/dist/v19.es.js +1 -1
- package/package.json +5 -46
- package/src/.eslintrc.js +9 -0
- package/src/index.ts +1 -32
- package/src/remote/component.tsx +3 -3
- package/src/remote/create.tsx +4 -17
- package/tsconfig.json +1 -1
- package/vite.config.ts +0 -13
- package/dist/data-fetch-server-middleware.cjs.js +0 -163
- package/dist/data-fetch-server-middleware.d.ts +0 -15
- package/dist/data-fetch-server-middleware.es.js +0 -164
- package/dist/data-fetch-utils.cjs.js +0 -24
- package/dist/data-fetch-utils.d.ts +0 -86
- package/dist/data-fetch-utils.es.js +0 -26
- package/dist/index-C0fDZB5b.js +0 -45
- package/dist/index-CqxytsLY.mjs +0 -46
- package/dist/index.esm-BCeUd-x9.mjs +0 -418
- package/dist/index.esm-j_1sIRzg.js +0 -417
- package/dist/lazy-load-component-plugin-Bobxn-VP.js +0 -524
- package/dist/lazy-load-component-plugin-Dvi5dnb7.mjs +0 -525
- package/dist/lazy-load-component-plugin.cjs.js +0 -6
- package/dist/lazy-load-component-plugin.d.ts +0 -16
- package/dist/lazy-load-component-plugin.es.js +0 -6
- package/dist/lazy-utils.cjs.js +0 -24
- package/dist/lazy-utils.d.ts +0 -149
- package/dist/lazy-utils.es.js +0 -24
- package/dist/prefetch-BWabXlKU.js +0 -1332
- package/dist/prefetch-Dq-ZhN17.mjs +0 -1333
- package/dist/utils-Cy-amYU5.mjs +0 -2016
- package/dist/utils-iEVlDmyk.js +0 -2015
- package/src/lazy/AwaitDataFetch.tsx +0 -215
- package/src/lazy/constant.ts +0 -30
- package/src/lazy/createLazyComponent.tsx +0 -414
- package/src/lazy/data-fetch/cache.ts +0 -296
- package/src/lazy/data-fetch/call-data-fetch.ts +0 -13
- package/src/lazy/data-fetch/data-fetch-server-middleware.ts +0 -196
- package/src/lazy/data-fetch/index.ts +0 -16
- package/src/lazy/data-fetch/inject-data-fetch.ts +0 -109
- package/src/lazy/data-fetch/prefetch.ts +0 -106
- package/src/lazy/data-fetch/runtime-plugin.ts +0 -115
- package/src/lazy/index.ts +0 -35
- package/src/lazy/logger.ts +0 -6
- package/src/lazy/types.ts +0 -75
- package/src/lazy/utils.ts +0 -372
- package/src/lazy/wrapNoSSR.tsx +0 -10
- package/src/plugins/lazy-load-component-plugin.ts +0 -62
package/dist/index.d.ts
CHANGED
|
@@ -1,96 +1,11 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
|
-
import { FederationRuntimePlugin } from '@module-federation/runtime';
|
|
3
|
-
import { getInstance } from '@module-federation/runtime';
|
|
4
2
|
import * as React_2 from 'react';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
export declare const autoFetchDataPlugin: () => FederationRuntimePlugin;
|
|
8
|
-
|
|
9
|
-
export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
|
|
10
|
-
|
|
11
|
-
declare interface CacheConfig {
|
|
12
|
-
maxSize?: number;
|
|
13
|
-
unstable_shouldDisable?: ({ request, }: {
|
|
14
|
-
request: Request;
|
|
15
|
-
}) => boolean | Promise<boolean>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare interface CacheOptions {
|
|
19
|
-
tag?: string | string[];
|
|
20
|
-
maxAge?: number;
|
|
21
|
-
revalidate?: number;
|
|
22
|
-
getKey?: <Args extends any[]>(...args: Args) => string;
|
|
23
|
-
customKey?: <Args extends any[]>(options: {
|
|
24
|
-
params: Args;
|
|
25
|
-
fn: (...args: Args) => any;
|
|
26
|
-
generatedKey: string;
|
|
27
|
-
}) => string | symbol;
|
|
28
|
-
onCache?: (info: CacheStatsInfo) => boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export declare const CacheSize: {
|
|
32
|
-
readonly KB: 1024;
|
|
33
|
-
readonly MB: number;
|
|
34
|
-
readonly GB: number;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export declare interface CacheStatsInfo {
|
|
38
|
-
status: CacheStatus;
|
|
39
|
-
key: string | symbol;
|
|
40
|
-
params: DataFetchParams;
|
|
41
|
-
result: any;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export declare type CacheStatus = 'hit' | 'stale' | 'miss';
|
|
45
|
-
|
|
46
|
-
export declare const CacheTime: {
|
|
47
|
-
readonly SECOND: 1000;
|
|
48
|
-
readonly MINUTE: number;
|
|
49
|
-
readonly HOUR: number;
|
|
50
|
-
readonly DAY: number;
|
|
51
|
-
readonly WEEK: number;
|
|
52
|
-
readonly MONTH: number;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export declare function callDataFetch(): Promise<void>;
|
|
56
|
-
|
|
57
|
-
export declare function clearStore(): void;
|
|
58
|
-
|
|
59
|
-
export declare function collectSSRAssets(options: CollectSSRAssetsOptions): default_2.ReactNode[];
|
|
60
|
-
|
|
61
|
-
export declare type CollectSSRAssetsOptions = {
|
|
62
|
-
id: string;
|
|
63
|
-
instance: ReturnType<typeof getInstance>;
|
|
64
|
-
injectScript?: boolean;
|
|
65
|
-
injectLink?: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export declare function configureCache(config: CacheConfig): void;
|
|
69
3
|
|
|
70
4
|
export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
|
|
71
5
|
render(info: RenderParams): Promise<void>;
|
|
72
6
|
destroy(info: DestroyParams): void;
|
|
73
7
|
};
|
|
74
8
|
|
|
75
|
-
export declare function createLazyComponent<T, E extends keyof T>(options: CreateLazyComponentOptions<T, E>): (props: T[E] extends (...args: any) => any ? Parameters<T[E]>[0] extends undefined ? ReactKey : Parameters<T[E]>[0] & ReactKey : ReactKey) => default_2.JSX.Element;
|
|
76
|
-
|
|
77
|
-
export declare type CreateLazyComponentOptions<T, E extends keyof T> = {
|
|
78
|
-
loader: () => Promise<T>;
|
|
79
|
-
instance: ReturnType<typeof getInstance>;
|
|
80
|
-
loading: default_2.ReactNode;
|
|
81
|
-
delayLoading?: number;
|
|
82
|
-
fallback: ReactNode | ((errorInfo: ErrorInfo) => ReactNode);
|
|
83
|
-
export?: E;
|
|
84
|
-
dataFetchParams?: DataFetchParams;
|
|
85
|
-
noSSR?: boolean;
|
|
86
|
-
cacheData?: boolean;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export declare function createRemoteAppComponent<T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>): default_2.ForwardRefExoticComponent<Omit<RemoteComponentProps<Record<string, unknown>>, "ref"> & default_2.RefAttributes<HTMLDivElement>>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!
|
|
93
|
-
*/
|
|
94
9
|
export declare function createRemoteComponent<T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>): default_2.ForwardRefExoticComponent<Omit<RemoteComponentProps<Record<string, unknown>>, "ref"> & default_2.RefAttributes<HTMLDivElement>>;
|
|
95
10
|
|
|
96
11
|
export declare interface CreateRootOptions {
|
|
@@ -107,13 +22,6 @@ declare interface CreateRootOptions_2 {
|
|
|
107
22
|
transitionCallbacks?: unknown;
|
|
108
23
|
}
|
|
109
24
|
|
|
110
|
-
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
111
|
-
|
|
112
|
-
export declare type DataFetchParams = {
|
|
113
|
-
isDowngrade: boolean;
|
|
114
|
-
_id?: string;
|
|
115
|
-
} & Record<string, unknown>;
|
|
116
|
-
|
|
117
25
|
/**
|
|
118
26
|
* Parameters for the destroy function
|
|
119
27
|
*/
|
|
@@ -122,41 +30,8 @@ export declare interface DestroyParams {
|
|
|
122
30
|
dom: HTMLElement;
|
|
123
31
|
}
|
|
124
32
|
|
|
125
|
-
export declare const ERROR_TYPE: {
|
|
126
|
-
DATA_FETCH: number;
|
|
127
|
-
LOAD_REMOTE: number;
|
|
128
|
-
UNKNOWN: number;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
declare type ErrorInfo = {
|
|
132
|
-
error: Error;
|
|
133
|
-
errorType: number;
|
|
134
|
-
dataFetchMapKey?: string;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export declare function generateKey(dataFetchOptions: DataFetchParams): string;
|
|
138
|
-
|
|
139
|
-
export declare function lazyLoadComponentPlugin(): FederationRuntimePlugin;
|
|
140
|
-
|
|
141
33
|
declare type LazyRemoteComponentInfo<T, E extends keyof T> = RemoteComponentParams<T>;
|
|
142
34
|
|
|
143
|
-
export declare type NoSSRRemoteInfo = {
|
|
144
|
-
name: string;
|
|
145
|
-
version: string;
|
|
146
|
-
ssrPublicPath: string;
|
|
147
|
-
ssrRemoteEntry: string;
|
|
148
|
-
globalName: string;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export declare function prefetch(options: PrefetchOptions): Promise<void>;
|
|
152
|
-
|
|
153
|
-
declare type PrefetchOptions = {
|
|
154
|
-
id: string;
|
|
155
|
-
instance: ReturnType<typeof getInstance>;
|
|
156
|
-
dataFetchParams?: DataFetchParams;
|
|
157
|
-
preloadComponentResource?: boolean;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
35
|
/**
|
|
161
36
|
* Parameters for the provider function
|
|
162
37
|
*/
|
|
@@ -190,10 +65,6 @@ export declare interface ProviderParams {
|
|
|
190
65
|
className?: string;
|
|
191
66
|
}
|
|
192
67
|
|
|
193
|
-
declare type ReactKey = {
|
|
194
|
-
key?: default_2.Key | null;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
68
|
/**
|
|
198
69
|
* Parameters for the remote component loader
|
|
199
70
|
*/
|
|
@@ -242,8 +113,6 @@ export declare interface RenderParams {
|
|
|
242
113
|
[key: string]: unknown;
|
|
243
114
|
}
|
|
244
115
|
|
|
245
|
-
export declare function revalidateTag(tag: string): void;
|
|
246
|
-
|
|
247
116
|
export declare interface Root {
|
|
248
117
|
render(children: React.ReactNode): void;
|
|
249
118
|
unmount(): void;
|
|
@@ -262,17 +131,4 @@ declare interface Root_2 {
|
|
|
262
131
|
*/
|
|
263
132
|
export declare type RootType = HTMLElement | Root_2;
|
|
264
133
|
|
|
265
|
-
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
266
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
267
|
-
}): void;
|
|
268
|
-
|
|
269
134
|
export { }
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
declare module '@module-federation/runtime-core' {
|
|
273
|
-
interface FederationHost {
|
|
274
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
275
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
276
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
277
|
-
}
|
|
278
|
-
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-
|
|
1
|
+
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-P6pEjY1q.js";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import React__default, { forwardRef, useRef, useState, useEffect, useContext } from "react";
|
|
4
|
-
import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin } from "./index-
|
|
4
|
+
import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin } from "./index-D4yt7Udv.js";
|
|
5
5
|
import * as ReactRouterDOM from "react-router-dom";
|
|
6
6
|
import { federationRuntime } from "./plugin.es.js";
|
|
7
|
-
import { b, a, c, l } from "./lazy-load-component-plugin-Dvi5dnb7.mjs";
|
|
8
|
-
import { C, b as b2, E, e, h, c as c2, d, r, s } from "./utils-Cy-amYU5.mjs";
|
|
9
|
-
import { callDataFetch } from "./data-fetch-utils.es.js";
|
|
10
|
-
import { p } from "./prefetch-Dq-ZhN17.mjs";
|
|
11
7
|
function createReact16Or17Root(container) {
|
|
12
8
|
return {
|
|
13
9
|
render(children) {
|
|
@@ -38,7 +34,7 @@ function createBridgeComponent(bridgeInfo) {
|
|
|
38
34
|
};
|
|
39
35
|
return createBaseBridgeComponent(fullBridgeInfo);
|
|
40
36
|
}
|
|
41
|
-
function
|
|
37
|
+
function e() {
|
|
42
38
|
const t = new PopStateEvent("popstate", { state: window.history.state });
|
|
43
39
|
window.dispatchEvent(t);
|
|
44
40
|
}
|
|
@@ -68,7 +64,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
68
64
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
69
65
|
if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {
|
|
70
66
|
LoggerInstance.debug(
|
|
71
|
-
`
|
|
67
|
+
`createRemoteComponent LazyComponent destroy >>>`,
|
|
72
68
|
{ moduleName, basename, dom: renderDom.current }
|
|
73
69
|
);
|
|
74
70
|
(_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
|
|
@@ -156,7 +152,7 @@ function withRouterData(WrappedComponent) {
|
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
154
|
}
|
|
159
|
-
LoggerInstance.debug(`
|
|
155
|
+
LoggerInstance.debug(`createRemoteComponent withRouterData >>>`, {
|
|
160
156
|
...props,
|
|
161
157
|
basename,
|
|
162
158
|
routerContextVal,
|
|
@@ -168,13 +164,13 @@ function withRouterData(WrappedComponent) {
|
|
|
168
164
|
useEffect(() => {
|
|
169
165
|
if (pathname !== "" && pathname !== location.pathname) {
|
|
170
166
|
LoggerInstance.debug(
|
|
171
|
-
`
|
|
167
|
+
`createRemoteComponent dispatchPopstateEnv >>>`,
|
|
172
168
|
{
|
|
173
169
|
name: props.name,
|
|
174
170
|
pathname: location.pathname
|
|
175
171
|
}
|
|
176
172
|
);
|
|
177
|
-
|
|
173
|
+
e();
|
|
178
174
|
}
|
|
179
175
|
setPathname(location.pathname);
|
|
180
176
|
}, [location]);
|
|
@@ -189,7 +185,7 @@ const RemoteApp = withRouterData(RemoteAppWrapper);
|
|
|
189
185
|
function createLazyRemoteComponent(info) {
|
|
190
186
|
const exportName = (info == null ? void 0 : info.export) || "default";
|
|
191
187
|
return React__default.lazy(async () => {
|
|
192
|
-
LoggerInstance.debug(`
|
|
188
|
+
LoggerInstance.debug(`createRemoteComponent LazyComponent create >>>`, {
|
|
193
189
|
lazyComponent: info.loader,
|
|
194
190
|
exportName
|
|
195
191
|
});
|
|
@@ -197,7 +193,7 @@ function createLazyRemoteComponent(info) {
|
|
|
197
193
|
const m = await info.loader();
|
|
198
194
|
const moduleName = m && m[Symbol.for("mf_module_id")];
|
|
199
195
|
LoggerInstance.debug(
|
|
200
|
-
`
|
|
196
|
+
`createRemoteComponent LazyComponent loadRemote info >>>`,
|
|
201
197
|
{ name: moduleName, module: m, exportName }
|
|
202
198
|
);
|
|
203
199
|
const exportFn = m[exportName];
|
|
@@ -220,7 +216,7 @@ function createLazyRemoteComponent(info) {
|
|
|
220
216
|
};
|
|
221
217
|
} else {
|
|
222
218
|
LoggerInstance.debug(
|
|
223
|
-
`
|
|
219
|
+
`createRemoteComponent LazyComponent module not found >>>`,
|
|
224
220
|
{ name: moduleName, module: m, exportName }
|
|
225
221
|
);
|
|
226
222
|
throw Error(
|
|
@@ -234,7 +230,7 @@ function createLazyRemoteComponent(info) {
|
|
|
234
230
|
}
|
|
235
231
|
});
|
|
236
232
|
}
|
|
237
|
-
function
|
|
233
|
+
function createRemoteComponent(info) {
|
|
238
234
|
const LazyComponent = createLazyRemoteComponent(info);
|
|
239
235
|
return forwardRef((props, ref) => {
|
|
240
236
|
return /* @__PURE__ */ React__default.createElement(
|
|
@@ -246,29 +242,7 @@ function createRemoteAppComponent(info) {
|
|
|
246
242
|
);
|
|
247
243
|
});
|
|
248
244
|
}
|
|
249
|
-
function createRemoteComponent(info) {
|
|
250
|
-
LoggerInstance.warn(
|
|
251
|
-
`createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!`
|
|
252
|
-
);
|
|
253
|
-
return createRemoteAppComponent(info);
|
|
254
|
-
}
|
|
255
245
|
export {
|
|
256
|
-
C as CacheSize,
|
|
257
|
-
b2 as CacheTime,
|
|
258
|
-
E as ERROR_TYPE,
|
|
259
|
-
b as autoFetchDataPlugin,
|
|
260
|
-
e as cache,
|
|
261
|
-
callDataFetch,
|
|
262
|
-
h as clearStore,
|
|
263
|
-
a as collectSSRAssets,
|
|
264
|
-
c2 as configureCache,
|
|
265
246
|
createBridgeComponent,
|
|
266
|
-
|
|
267
|
-
createRemoteAppComponent,
|
|
268
|
-
createRemoteComponent,
|
|
269
|
-
d as generateKey,
|
|
270
|
-
l as lazyLoadComponentPlugin,
|
|
271
|
-
p as prefetch,
|
|
272
|
-
r as revalidateTag,
|
|
273
|
-
s as setSSREnv
|
|
247
|
+
createRemoteComponent
|
|
274
248
|
};
|
package/dist/plugin.d.ts
CHANGED
|
@@ -11,12 +11,3 @@ export declare type FederationRuntimeType = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
declare module '@module-federation/runtime-core' {
|
|
17
|
-
interface FederationHost {
|
|
18
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
19
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
20
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
21
|
-
}
|
|
22
|
-
}
|
package/dist/router-v5.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const ReactRouterDom$1 = require("react-router-dom/index.js");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Cv3p6r66.cjs");
|
|
6
6
|
const ReactRouterDom = require("react-router-dom/index.js");
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
package/dist/router-v5.d.ts
CHANGED
|
@@ -7,12 +7,3 @@ export declare function BrowserRouter(props: Parameters<typeof ReactRouterDom.Br
|
|
|
7
7
|
export * from "react-router-dom/";
|
|
8
8
|
|
|
9
9
|
export { }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare module '@module-federation/runtime-core' {
|
|
13
|
-
interface FederationHost {
|
|
14
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
15
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
16
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
17
|
-
}
|
|
18
|
-
}
|
package/dist/router-v5.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
2
|
import * as ReactRouterDom$1 from "react-router-dom/index.js";
|
|
3
|
-
import { R as RouterContext, L as LoggerInstance } from "./index-
|
|
3
|
+
import { R as RouterContext, L as LoggerInstance } from "./index-D4yt7Udv.js";
|
|
4
4
|
export * from "react-router-dom/index.js";
|
|
5
5
|
function WraperRouter(props) {
|
|
6
6
|
const { basename, ...propsRes } = props;
|
package/dist/router-v6.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const ReactRouterDom$1 = require("react-router-dom/dist/index.js");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Cv3p6r66.cjs");
|
|
6
6
|
const ReactRouterDom = require("react-router-dom/dist/index.js");
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
package/dist/router-v6.d.ts
CHANGED
|
@@ -9,12 +9,3 @@ export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.R
|
|
|
9
9
|
export * from "react-router-dom/";
|
|
10
10
|
|
|
11
11
|
export { }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare module '@module-federation/runtime-core' {
|
|
15
|
-
interface FederationHost {
|
|
16
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
17
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
18
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
19
|
-
}
|
|
20
|
-
}
|
package/dist/router-v6.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
2
|
import * as ReactRouterDom$1 from "react-router-dom/dist/index.js";
|
|
3
|
-
import { R as RouterContext, L as LoggerInstance } from "./index-
|
|
3
|
+
import { R as RouterContext, L as LoggerInstance } from "./index-D4yt7Udv.js";
|
|
4
4
|
export * from "react-router-dom/dist/index.js";
|
|
5
5
|
function WraperRouter(props) {
|
|
6
6
|
const { basename, ...propsRes } = props;
|
package/dist/router.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const ReactRouterDom = require("react-router-dom/");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Cv3p6r66.cjs");
|
|
6
6
|
function _interopNamespaceDefault(e) {
|
|
7
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
8
|
if (e) {
|
package/dist/router.d.ts
CHANGED
|
@@ -9,12 +9,3 @@ export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.R
|
|
|
9
9
|
export * from "react-router-dom/";
|
|
10
10
|
|
|
11
11
|
export { }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare module '@module-federation/runtime-core' {
|
|
15
|
-
interface FederationHost {
|
|
16
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
17
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
18
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
19
|
-
}
|
|
20
|
-
}
|
package/dist/router.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
2
|
import * as ReactRouterDom from "react-router-dom/";
|
|
3
3
|
export * from "react-router-dom/";
|
|
4
|
-
import { R as RouterContext, L as LoggerInstance } from "./index-
|
|
4
|
+
import { R as RouterContext, L as LoggerInstance } from "./index-D4yt7Udv.js";
|
|
5
5
|
function WrapperRouter(props) {
|
|
6
6
|
const { basename, ...propsRes } = props;
|
|
7
7
|
const routerContextProps = useContext(RouterContext) || {};
|
package/dist/v18.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("react-dom/client");
|
|
4
|
-
const bridgeBase = require("./bridge-base-
|
|
4
|
+
const bridgeBase = require("./bridge-base-BBH982Tz.cjs");
|
|
5
5
|
function createReact18Root(container, options) {
|
|
6
6
|
return client.createRoot(container, options);
|
|
7
7
|
}
|
package/dist/v18.d.ts
CHANGED
|
@@ -103,12 +103,3 @@ declare interface Root_2 {
|
|
|
103
103
|
export declare type RootType = HTMLElement | Root_2;
|
|
104
104
|
|
|
105
105
|
export { }
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
declare module '@module-federation/runtime-core' {
|
|
109
|
-
interface FederationHost {
|
|
110
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
111
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
112
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
113
|
-
}
|
|
114
|
-
}
|
package/dist/v18.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRoot } from "react-dom/client";
|
|
2
|
-
import { c as createBaseBridgeComponent } from "./bridge-base-
|
|
2
|
+
import { c as createBaseBridgeComponent } from "./bridge-base-P6pEjY1q.js";
|
|
3
3
|
function createReact18Root(container, options) {
|
|
4
4
|
return createRoot(container, options);
|
|
5
5
|
}
|
package/dist/v19.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("react-dom/client");
|
|
4
|
-
const bridgeBase = require("./bridge-base-
|
|
4
|
+
const bridgeBase = require("./bridge-base-BBH982Tz.cjs");
|
|
5
5
|
function createReact19Root(container, options) {
|
|
6
6
|
return client.createRoot(container, options);
|
|
7
7
|
}
|
package/dist/v19.d.ts
CHANGED
|
@@ -104,12 +104,3 @@ declare interface Root_2 {
|
|
|
104
104
|
export declare type RootType = HTMLElement | Root_2;
|
|
105
105
|
|
|
106
106
|
export { }
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
declare module '@module-federation/runtime-core' {
|
|
110
|
-
interface FederationHost {
|
|
111
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
112
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
113
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
114
|
-
}
|
|
115
|
-
}
|
package/dist/v19.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRoot } from "react-dom/client";
|
|
2
|
-
import { c as createBaseBridgeComponent } from "./bridge-base-
|
|
2
|
+
import { c as createBaseBridgeComponent } from "./bridge-base-P6pEjY1q.js";
|
|
3
3
|
function createReact19Root(container, options) {
|
|
4
4
|
return createRoot(container, options);
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/bridge-react",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250709032753",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"url": "https://github.com/module-federation/core",
|
|
12
12
|
"directory": "packages/bridge-react"
|
|
13
13
|
},
|
|
14
|
+
"type": "module",
|
|
14
15
|
"main": "./dist/index.cjs.js",
|
|
15
16
|
"module": "./dist/index.es.js",
|
|
16
17
|
"types": "./dist/index.d.ts",
|
|
@@ -50,52 +51,12 @@
|
|
|
50
51
|
"import": "./dist/router-v6.es.js",
|
|
51
52
|
"require": "./dist/router-v6.cjs.js"
|
|
52
53
|
},
|
|
53
|
-
"./lazy-utils": {
|
|
54
|
-
"types": "./dist/lazy-utils.d.ts",
|
|
55
|
-
"import": "./dist/lazy-utils.es.js",
|
|
56
|
-
"require": "./dist/lazy-utils.cjs.js"
|
|
57
|
-
},
|
|
58
|
-
"./data-fetch-utils": {
|
|
59
|
-
"types": "./dist/data-fetch-utils.d.ts",
|
|
60
|
-
"import": "./dist/data-fetch-utils.es.js",
|
|
61
|
-
"require": "./dist/data-fetch-utils.cjs.js"
|
|
62
|
-
},
|
|
63
|
-
"./data-fetch-server-middleware": {
|
|
64
|
-
"types": "./dist/data-fetch-server-middleware.d.ts",
|
|
65
|
-
"import": "./dist/data-fetch-server-middleware.es.js",
|
|
66
|
-
"require": "./dist/data-fetch-server-middleware.cjs.js"
|
|
67
|
-
},
|
|
68
|
-
"./lazy-load-component-plugin": {
|
|
69
|
-
"types": "./dist/lazy-load-component-plugin.d.ts",
|
|
70
|
-
"import": "./dist/lazy-load-component-plugin.es.js",
|
|
71
|
-
"require": "./dist/lazy-load-component-plugin.cjs.js"
|
|
72
|
-
},
|
|
73
54
|
"./*": "./*"
|
|
74
55
|
},
|
|
75
|
-
"typesVersions": {
|
|
76
|
-
"*": {
|
|
77
|
-
".": [
|
|
78
|
-
"./dist/types/index.d.ts"
|
|
79
|
-
],
|
|
80
|
-
"lazy-load-component-plugin": [
|
|
81
|
-
"./dist/lazy-load-component-plugin.d.ts"
|
|
82
|
-
],
|
|
83
|
-
"lazy-utils": [
|
|
84
|
-
"./dist/lazy-utils.d.ts"
|
|
85
|
-
],
|
|
86
|
-
"data-fetch-utils": [
|
|
87
|
-
"./dist/data-fetch-utils.d.ts"
|
|
88
|
-
],
|
|
89
|
-
"data-fetch-server-middleware": [
|
|
90
|
-
"./dist/data-fetch-server-middleware.d.ts"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
56
|
"dependencies": {
|
|
95
57
|
"react-error-boundary": "^4.1.2",
|
|
96
|
-
"
|
|
97
|
-
"@module-federation/
|
|
98
|
-
"@module-federation/sdk": "0.0.0-next-20250708134245"
|
|
58
|
+
"@module-federation/bridge-shared": "0.0.0-next-20250709032753",
|
|
59
|
+
"@module-federation/sdk": "0.0.0-next-20250709032753"
|
|
99
60
|
},
|
|
100
61
|
"peerDependencies": {
|
|
101
62
|
"react": ">=16.9.0",
|
|
@@ -116,9 +77,7 @@
|
|
|
116
77
|
"typescript": "^5.2.2",
|
|
117
78
|
"vite": "^5.4.18",
|
|
118
79
|
"vite-plugin-dts": "^4.3.0",
|
|
119
|
-
"
|
|
120
|
-
"@module-federation/runtime": "0.0.0-next-20250708134245",
|
|
121
|
-
"@module-federation/runtime-core": "0.0.0-next-20250708134245"
|
|
80
|
+
"@module-federation/runtime": "0.0.0-next-20250709032753"
|
|
122
81
|
},
|
|
123
82
|
"scripts": {
|
|
124
83
|
"dev": "vite",
|
package/src/.eslintrc.js
ADDED
package/src/index.ts
CHANGED
|
@@ -3,30 +3,7 @@
|
|
|
3
3
|
* This file provides support for React 16 and 17 versions, using the traditional ReactDOM.render API
|
|
4
4
|
*/
|
|
5
5
|
export { createBridgeComponent } from './provider/versions/legacy';
|
|
6
|
-
export {
|
|
7
|
-
createRemoteComponent,
|
|
8
|
-
createRemoteAppComponent,
|
|
9
|
-
} from './remote/create';
|
|
10
|
-
export {
|
|
11
|
-
ERROR_TYPE,
|
|
12
|
-
createLazyComponent,
|
|
13
|
-
collectSSRAssets,
|
|
14
|
-
// wrapNoSSR,
|
|
15
|
-
callDataFetch,
|
|
16
|
-
setSSREnv,
|
|
17
|
-
autoFetchDataPlugin,
|
|
18
|
-
CacheSize,
|
|
19
|
-
CacheTime,
|
|
20
|
-
configureCache,
|
|
21
|
-
generateKey,
|
|
22
|
-
cache,
|
|
23
|
-
revalidateTag,
|
|
24
|
-
clearStore,
|
|
25
|
-
prefetch,
|
|
26
|
-
} from './lazy';
|
|
27
|
-
|
|
28
|
-
export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
|
|
29
|
-
|
|
6
|
+
export { createRemoteComponent } from './remote/create';
|
|
30
7
|
export type { CreateRootOptions, Root } from './provider/versions/legacy';
|
|
31
8
|
export type {
|
|
32
9
|
ProviderParams,
|
|
@@ -35,11 +12,3 @@ export type {
|
|
|
35
12
|
DestroyParams,
|
|
36
13
|
RenderParams,
|
|
37
14
|
} from './types';
|
|
38
|
-
export type {
|
|
39
|
-
DataFetchParams,
|
|
40
|
-
NoSSRRemoteInfo,
|
|
41
|
-
CollectSSRAssetsOptions,
|
|
42
|
-
CreateLazyComponentOptions,
|
|
43
|
-
CacheStatus,
|
|
44
|
-
CacheStatsInfo,
|
|
45
|
-
} from './lazy';
|
package/src/remote/component.tsx
CHANGED
|
@@ -48,7 +48,7 @@ const RemoteAppWrapper = forwardRef(function (
|
|
|
48
48
|
return () => {
|
|
49
49
|
if (providerInfoRef.current?.destroy) {
|
|
50
50
|
LoggerInstance.debug(
|
|
51
|
-
`
|
|
51
|
+
`createRemoteComponent LazyComponent destroy >>>`,
|
|
52
52
|
{ moduleName, basename, dom: renderDom.current },
|
|
53
53
|
);
|
|
54
54
|
|
|
@@ -171,7 +171,7 @@ export function withRouterData<
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
LoggerInstance.debug(`
|
|
174
|
+
LoggerInstance.debug(`createRemoteComponent withRouterData >>>`, {
|
|
175
175
|
...props,
|
|
176
176
|
basename,
|
|
177
177
|
routerContextVal,
|
|
@@ -185,7 +185,7 @@ export function withRouterData<
|
|
|
185
185
|
useEffect(() => {
|
|
186
186
|
if (pathname !== '' && pathname !== location.pathname) {
|
|
187
187
|
LoggerInstance.debug(
|
|
188
|
-
`
|
|
188
|
+
`createRemoteComponent dispatchPopstateEnv >>>`,
|
|
189
189
|
{
|
|
190
190
|
name: props.name,
|
|
191
191
|
pathname: location.pathname,
|