@module-federation/bridge-react 0.0.0-next-20250708121428 → 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 -143
- 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-BbqmMGKu.mjs +0 -492
- package/dist/lazy-load-component-plugin-DgYHamxE.js +0 -491
- 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-CXJhiNUD.mjs +0 -1333
- package/dist/utils-BTYYwZcb.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 -418
- 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,95 +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
|
-
cacheData?: boolean;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
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>>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!
|
|
92
|
-
*/
|
|
93
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>>;
|
|
94
10
|
|
|
95
11
|
export declare interface CreateRootOptions {
|
|
@@ -106,13 +22,6 @@ declare interface CreateRootOptions_2 {
|
|
|
106
22
|
transitionCallbacks?: unknown;
|
|
107
23
|
}
|
|
108
24
|
|
|
109
|
-
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
110
|
-
|
|
111
|
-
export declare type DataFetchParams = {
|
|
112
|
-
isDowngrade: boolean;
|
|
113
|
-
_id?: string;
|
|
114
|
-
} & Record<string, unknown>;
|
|
115
|
-
|
|
116
25
|
/**
|
|
117
26
|
* Parameters for the destroy function
|
|
118
27
|
*/
|
|
@@ -121,41 +30,8 @@ export declare interface DestroyParams {
|
|
|
121
30
|
dom: HTMLElement;
|
|
122
31
|
}
|
|
123
32
|
|
|
124
|
-
export declare const ERROR_TYPE: {
|
|
125
|
-
DATA_FETCH: number;
|
|
126
|
-
LOAD_REMOTE: number;
|
|
127
|
-
UNKNOWN: number;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
declare type ErrorInfo = {
|
|
131
|
-
error: Error;
|
|
132
|
-
errorType: number;
|
|
133
|
-
dataFetchMapKey?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export declare function generateKey(dataFetchOptions: DataFetchParams): string;
|
|
137
|
-
|
|
138
|
-
export declare function lazyLoadComponentPlugin(): FederationRuntimePlugin;
|
|
139
|
-
|
|
140
33
|
declare type LazyRemoteComponentInfo<T, E extends keyof T> = RemoteComponentParams<T>;
|
|
141
34
|
|
|
142
|
-
export declare type NoSSRRemoteInfo = {
|
|
143
|
-
name: string;
|
|
144
|
-
version: string;
|
|
145
|
-
ssrPublicPath: string;
|
|
146
|
-
ssrRemoteEntry: string;
|
|
147
|
-
globalName: string;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export declare function prefetch(options: PrefetchOptions): Promise<void>;
|
|
151
|
-
|
|
152
|
-
declare type PrefetchOptions = {
|
|
153
|
-
id: string;
|
|
154
|
-
instance: ReturnType<typeof getInstance>;
|
|
155
|
-
dataFetchParams?: DataFetchParams;
|
|
156
|
-
preloadComponentResource?: boolean;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
35
|
/**
|
|
160
36
|
* Parameters for the provider function
|
|
161
37
|
*/
|
|
@@ -189,10 +65,6 @@ export declare interface ProviderParams {
|
|
|
189
65
|
className?: string;
|
|
190
66
|
}
|
|
191
67
|
|
|
192
|
-
declare type ReactKey = {
|
|
193
|
-
key?: default_2.Key | null;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
68
|
/**
|
|
197
69
|
* Parameters for the remote component loader
|
|
198
70
|
*/
|
|
@@ -241,8 +113,6 @@ export declare interface RenderParams {
|
|
|
241
113
|
[key: string]: unknown;
|
|
242
114
|
}
|
|
243
115
|
|
|
244
|
-
export declare function revalidateTag(tag: string): void;
|
|
245
|
-
|
|
246
116
|
export declare interface Root {
|
|
247
117
|
render(children: React.ReactNode): void;
|
|
248
118
|
unmount(): void;
|
|
@@ -261,17 +131,4 @@ declare interface Root_2 {
|
|
|
261
131
|
*/
|
|
262
132
|
export declare type RootType = HTMLElement | Root_2;
|
|
263
133
|
|
|
264
|
-
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
265
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
266
|
-
}): void;
|
|
267
|
-
|
|
268
134
|
export { }
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
declare module '@module-federation/runtime-core' {
|
|
272
|
-
interface FederationHost {
|
|
273
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
274
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
275
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
276
|
-
}
|
|
277
|
-
}
|
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-BbqmMGKu.mjs";
|
|
8
|
-
import { C, b as b2, E, e, h, c as c2, d, r, s } from "./utils-BTYYwZcb.mjs";
|
|
9
|
-
import { callDataFetch } from "./data-fetch-utils.es.js";
|
|
10
|
-
import { p } from "./prefetch-CXJhiNUD.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-20250708121428"
|
|
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-20250708121428",
|
|
121
|
-
"@module-federation/runtime-core": "0.0.0-next-20250708121428"
|
|
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,
|