@module-federation/bridge-react 0.0.0-fix-4748-shared-fallback-versions-20260604072020 → 0.0.0-fix-runtime-core-set-shared-lib-20260819111025
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/dist/base.cjs.js +4 -4
- package/dist/base.d.ts +8 -311
- package/dist/base.es.js +5 -5
- package/dist/{bridge-base-EnVXD4Hr.mjs → bridge-base-BaKy6CY_.mjs} +32 -97
- package/dist/{bridge-base-IlvdqYIj.js → bridge-base-Ch33UJuN.js} +32 -96
- package/dist/{createHelpers-9B0ttrN_.js → createHelpers-19BP0xtB.js} +2 -3
- package/dist/{createHelpers-D77sECmY.mjs → createHelpers-BSHeKyd-.mjs} +2 -3
- package/dist/data-fetch-server-middleware.cjs.js +1 -1
- package/dist/data-fetch-server-middleware.d.ts +1 -15
- package/dist/data-fetch-server-middleware.es.js +1 -1
- package/dist/data-fetch-utils.cjs.js +2 -2
- package/dist/data-fetch-utils.d.ts +1 -81
- package/dist/data-fetch-utils.es.js +4 -4
- package/dist/data-fetch.cjs.js +3 -3
- package/dist/data-fetch.d.ts +4 -140
- package/dist/data-fetch.es.js +3 -3
- package/dist/error-boundary.d.ts +17 -0
- package/dist/error-boundary.spec.d.ts +1 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.d.ts +12 -299
- package/dist/index.es.js +5 -5
- package/dist/lazy/AwaitDataFetch.d.ts +24 -0
- package/dist/lazy/HydratedStylesheetAssets.d.ts +4 -0
- package/dist/lazy/constant.d.ts +26 -0
- package/dist/lazy/createLazyComponent.d.ts +28 -0
- package/dist/lazy/data-fetch/cache.d.ts +34 -0
- package/dist/lazy/data-fetch/cache.spec.d.ts +1 -0
- package/dist/lazy/data-fetch/call-data-fetch.d.ts +1 -0
- package/dist/lazy/data-fetch/data-fetch-server-middleware.d.ts +3 -0
- package/dist/lazy/data-fetch/index.d.ts +6 -0
- package/dist/lazy/data-fetch/inject-data-fetch.d.ts +4 -0
- package/dist/lazy/data-fetch/prefetch.d.ts +9 -0
- package/dist/lazy/data-fetch/runtime-plugin.d.ts +3 -0
- package/dist/lazy/index.d.ts +9 -0
- package/dist/lazy/logger.d.ts +2 -0
- package/dist/lazy/types.d.ts +60 -0
- package/dist/lazy/utils.d.ts +48 -0
- package/dist/lazy/wrapNoSSR.d.ts +9 -0
- package/dist/{lazy-load-component-plugin-BYI941I2.mjs → lazy-load-component-plugin-CyCe4XLr.mjs} +171 -45
- package/dist/{lazy-load-component-plugin-DG4e3Tib.js → lazy-load-component-plugin-eEgUDc1T.js} +170 -44
- package/dist/lazy-load-component-plugin.cjs.js +2 -2
- package/dist/lazy-load-component-plugin.d.ts +2 -16
- package/dist/lazy-load-component-plugin.es.js +2 -2
- package/dist/lazy-utils.cjs.js +1 -1
- package/dist/lazy-utils.d.ts +1 -149
- package/dist/lazy-utils.es.js +2 -2
- package/dist/plugin.d.ts +2 -22
- package/dist/plugins/lazy-load-component-plugin.d.ts +12 -0
- package/dist/plugins/lazy-load-component-plugin.spec.d.ts +1 -0
- package/dist/{prefetch-DzO9_QQ-.mjs → prefetch-BI-rS7Uh.mjs} +494 -80
- package/dist/{prefetch-CG2l-06N.js → prefetch-DWvQSUu9.js} +494 -80
- package/dist/provider/context.d.ts +3 -0
- package/dist/provider/plugin.d.ts +7 -0
- package/dist/provider/versions/bridge-base.d.ts +5 -0
- package/dist/provider/versions/legacy.d.ts +26 -0
- package/dist/provider/versions/v18.d.ts +19 -0
- package/dist/provider/versions/v19.d.ts +21 -0
- package/dist/remote/RemoteAppWrapper.d.ts +7 -0
- package/dist/remote/base-component/component.d.ts +2 -0
- package/dist/remote/base-component/create.d.ts +9 -0
- package/dist/remote/base-component/index.d.ts +5 -0
- package/dist/remote/createHelpers.d.ts +17 -0
- package/dist/remote/router-component/component.d.ts +8 -0
- package/dist/remote/router-component/create.d.ts +9 -0
- package/dist/remote/router-component/index.d.ts +5 -0
- package/dist/router/default.d.ts +7 -0
- package/dist/router/v5.d.ts +4 -0
- package/dist/router/v6.d.ts +7 -0
- package/dist/router/v7.d.ts +6 -0
- package/dist/router-v5.d.ts +1 -17
- package/dist/router-v6.d.ts +1 -20
- package/dist/router-v7.d.ts +1 -19
- package/dist/router.d.ts +1 -20
- package/dist/shared/size-limited-cache.d.ts +29 -0
- package/dist/shared/size-limited-cache.spec.d.ts +1 -0
- package/dist/size-limited-cache.cjs.js +82 -0
- package/dist/size-limited-cache.d.ts +1 -0
- package/dist/size-limited-cache.es.js +82 -0
- package/dist/types.d.ts +137 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils-5dGErM3C.js +588 -0
- package/dist/utils-BBP3hEeV.mjs +589 -0
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.d.ts +3 -114
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.d.ts +3 -115
- package/dist/v19.es.js +1 -1
- package/package.json +21 -14
- package/dist/utils-CFTy4LVE.js +0 -2029
- package/dist/utils-DGS4pYp8.mjs +0 -2030
package/dist/base.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const createHelpers = require("./createHelpers-
|
|
4
|
-
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-
|
|
5
|
-
const lazyUtils = require("./utils-
|
|
3
|
+
const createHelpers = require("./createHelpers-19BP0xtB.js");
|
|
4
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-eEgUDc1T.js");
|
|
5
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
6
6
|
const dataFetchUtils = require("./data-fetch-utils.cjs.js");
|
|
7
|
-
const prefetch = require("./prefetch-
|
|
7
|
+
const prefetch = require("./prefetch-DWvQSUu9.js");
|
|
8
8
|
const createRemoteAppComponent = createHelpers.createRemoteAppComponentFactory(createHelpers.RemoteAppWrapper);
|
|
9
9
|
const createRemoteComponent = createHelpers.createDeprecatedRemoteComponentFactory(
|
|
10
10
|
createRemoteAppComponent
|
package/dist/base.d.ts
CHANGED
|
@@ -1,311 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const autoFetchDataPlugin: () => ModuleFederationRuntimePlugin;
|
|
10
|
-
|
|
11
|
-
export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
|
|
12
|
-
|
|
13
|
-
declare interface CacheConfig {
|
|
14
|
-
maxSize?: number;
|
|
15
|
-
unstable_shouldDisable?: ({ request, }: {
|
|
16
|
-
request: Request;
|
|
17
|
-
}) => boolean | Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare interface CacheOptions {
|
|
21
|
-
tag?: string | string[];
|
|
22
|
-
maxAge?: number;
|
|
23
|
-
revalidate?: number;
|
|
24
|
-
getKey?: <Args extends any[]>(...args: Args) => string;
|
|
25
|
-
onCache?: (info: CacheStatsInfo) => boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export declare const CacheSize: {
|
|
29
|
-
readonly KB: 1024;
|
|
30
|
-
readonly MB: number;
|
|
31
|
-
readonly GB: number;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export declare interface CacheStatsInfo {
|
|
35
|
-
status: CacheStatus;
|
|
36
|
-
key: string | symbol;
|
|
37
|
-
params: DataFetchParams;
|
|
38
|
-
result: any;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export declare type CacheStatus = 'hit' | 'stale' | 'miss';
|
|
42
|
-
|
|
43
|
-
export declare const CacheTime: {
|
|
44
|
-
readonly SECOND: 1000;
|
|
45
|
-
readonly MINUTE: number;
|
|
46
|
-
readonly HOUR: number;
|
|
47
|
-
readonly DAY: number;
|
|
48
|
-
readonly WEEK: number;
|
|
49
|
-
readonly MONTH: number;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export declare function callDataFetch(): Promise<void>;
|
|
53
|
-
|
|
54
|
-
export declare function clearStore(): void;
|
|
55
|
-
|
|
56
|
-
export declare function collectSSRAssets(options: CollectSSRAssetsOptions): default_2.ReactNode[];
|
|
57
|
-
|
|
58
|
-
export declare type CollectSSRAssetsOptions = {
|
|
59
|
-
id: string;
|
|
60
|
-
instance: ReturnType<typeof getInstance>;
|
|
61
|
-
injectScript?: boolean;
|
|
62
|
-
injectLink?: boolean;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export declare function configureCache(config: CacheConfig): void;
|
|
66
|
-
|
|
67
|
-
export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
|
|
68
|
-
render(info: RenderParams): Promise<void>;
|
|
69
|
-
destroy(info: DestroyParams): void;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
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;
|
|
73
|
-
|
|
74
|
-
export declare type CreateLazyComponentOptions<T, E extends keyof T> = {
|
|
75
|
-
loader: () => Promise<T>;
|
|
76
|
-
instance: ReturnType<typeof getInstance>;
|
|
77
|
-
loading: default_2.ReactNode;
|
|
78
|
-
delayLoading?: number;
|
|
79
|
-
fallback: ReactNode | ((errorInfo: ErrorInfo) => ReactNode);
|
|
80
|
-
export?: E;
|
|
81
|
-
dataFetchParams?: DataFetchParams;
|
|
82
|
-
noSSR?: boolean;
|
|
83
|
-
injectScript?: boolean;
|
|
84
|
-
injectLink?: boolean;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export declare const createRemoteAppComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => ForwardRefExoticComponent<Omit<RemoteComponentProps_2<Record<string, unknown>>, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated createRemoteComponent is deprecated, please use createRemoteAppComponent instead!
|
|
91
|
-
*/
|
|
92
|
-
export declare const createRemoteComponent: <T = Record<string, unknown>, E extends keyof T = keyof T>(info: LazyRemoteComponentInfo<T, E>) => any;
|
|
93
|
-
|
|
94
|
-
export declare interface CreateRootOptions {
|
|
95
|
-
identifierPrefix?: string;
|
|
96
|
-
onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Options for creating a React root
|
|
101
|
-
*/
|
|
102
|
-
declare interface CreateRootOptions_2 {
|
|
103
|
-
identifierPrefix?: string;
|
|
104
|
-
onRecoverableError?: (error: unknown) => void;
|
|
105
|
-
transitionCallbacks?: unknown;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
109
|
-
|
|
110
|
-
export declare type DataFetchParams = {
|
|
111
|
-
isDowngrade: boolean;
|
|
112
|
-
_id?: string;
|
|
113
|
-
} & Record<string, unknown>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Parameters for the destroy function
|
|
117
|
-
*/
|
|
118
|
-
export declare interface DestroyParams {
|
|
119
|
-
moduleName: string;
|
|
120
|
-
dom: HTMLElement;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export declare const ERROR_TYPE: {
|
|
124
|
-
DATA_FETCH: number;
|
|
125
|
-
LOAD_REMOTE: number;
|
|
126
|
-
UNKNOWN: number;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
declare type ErrorInfo = {
|
|
130
|
-
error: Error;
|
|
131
|
-
errorType: number;
|
|
132
|
-
dataFetchMapKey?: string;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export declare function generateKey(dataFetchOptions: DataFetchParams): string;
|
|
136
|
-
|
|
137
|
-
export declare function lazyLoadComponentPlugin(): ModuleFederationRuntimePlugin;
|
|
138
|
-
|
|
139
|
-
export declare type LazyRemoteComponentInfo<T, _E extends keyof T> = RemoteComponentParams<T>;
|
|
140
|
-
|
|
141
|
-
export declare type NoSSRRemoteInfo = {
|
|
142
|
-
name: string;
|
|
143
|
-
version: string;
|
|
144
|
-
ssrPublicPath: string;
|
|
145
|
-
ssrRemoteEntry: string;
|
|
146
|
-
globalName: string;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export declare function prefetch(options: PrefetchOptions): Promise<void>;
|
|
150
|
-
|
|
151
|
-
declare type PrefetchOptions = {
|
|
152
|
-
id: string;
|
|
153
|
-
instance: ReturnType<typeof getInstance>;
|
|
154
|
-
dataFetchParams?: DataFetchParams;
|
|
155
|
-
preloadComponentResource?: boolean;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Parameters for the provider function
|
|
160
|
-
*/
|
|
161
|
-
export declare interface ProviderFnParams<T> {
|
|
162
|
-
rootComponent: React_2.ComponentType<T>;
|
|
163
|
-
render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
|
|
164
|
-
createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions_2) => Root_2;
|
|
165
|
-
/**
|
|
166
|
-
* Default options to pass to createRoot for React 18 and 19
|
|
167
|
-
* These options will be used when creating a root unless overridden by rootOptions in render params
|
|
168
|
-
* @example
|
|
169
|
-
* {
|
|
170
|
-
* identifierPrefix: 'app-',
|
|
171
|
-
* onRecoverableError: (err) => console.error(err)
|
|
172
|
-
* }
|
|
173
|
-
*/
|
|
174
|
-
defaultRootOptions?: CreateRootOptions_2;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Parameters for the provider function
|
|
179
|
-
*/
|
|
180
|
-
export declare interface ProviderParams {
|
|
181
|
-
moduleName?: string;
|
|
182
|
-
basename?: string;
|
|
183
|
-
memoryRoute?: {
|
|
184
|
-
entryPath: string;
|
|
185
|
-
initialState?: Record<string, unknown>;
|
|
186
|
-
};
|
|
187
|
-
style?: React_2.CSSProperties;
|
|
188
|
-
className?: string;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
declare type ReactKey = {
|
|
192
|
-
key?: default_2.Key | null;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Parameters for the remote component loader
|
|
197
|
-
*/
|
|
198
|
-
export declare interface RemoteComponentParams<T = Record<string, unknown>, E extends keyof T = keyof T> {
|
|
199
|
-
loader: () => Promise<T>;
|
|
200
|
-
loading: React_2.ReactNode;
|
|
201
|
-
fallback: React_2.ComponentType<{
|
|
202
|
-
error: Error;
|
|
203
|
-
}>;
|
|
204
|
-
export?: E;
|
|
205
|
-
props?: T;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Parameters for the remote component
|
|
210
|
-
*/
|
|
211
|
-
export declare interface RemoteComponentProps<T = Record<string, unknown>> {
|
|
212
|
-
props?: T;
|
|
213
|
-
fallback?: React_2.ComponentType<{
|
|
214
|
-
error: Error;
|
|
215
|
-
}>;
|
|
216
|
-
loading?: React_2.ReactNode;
|
|
217
|
-
[key: string]: unknown;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Parameters for the remote component
|
|
222
|
-
*/
|
|
223
|
-
declare interface RemoteComponentProps_2<T = Record<string, unknown>> {
|
|
224
|
-
props?: T;
|
|
225
|
-
fallback?: React_2.ComponentType<{
|
|
226
|
-
error: Error;
|
|
227
|
-
}>;
|
|
228
|
-
loading?: React_2.ReactNode;
|
|
229
|
-
[key: string]: unknown;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Interface for a remote module provider
|
|
234
|
-
*/
|
|
235
|
-
export declare interface RemoteModule {
|
|
236
|
-
provider: () => {
|
|
237
|
-
render: (info: RenderFnParams) => void;
|
|
238
|
-
destroy: (info: {
|
|
239
|
-
dom: any;
|
|
240
|
-
}) => void;
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Parameters for the render function, extending ProviderParams
|
|
246
|
-
*/
|
|
247
|
-
export declare interface RenderFnParams extends ProviderParams {
|
|
248
|
-
dom: HTMLElement;
|
|
249
|
-
fallback?: React_2.ComponentType<{
|
|
250
|
-
error: Error;
|
|
251
|
-
}>;
|
|
252
|
-
[key: string]: unknown;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Parameters for the render function
|
|
257
|
-
*/
|
|
258
|
-
export declare interface RenderParams {
|
|
259
|
-
moduleName?: string;
|
|
260
|
-
basename?: string;
|
|
261
|
-
memoryRoute?: {
|
|
262
|
-
entryPath: string;
|
|
263
|
-
initialState?: Record<string, unknown>;
|
|
264
|
-
};
|
|
265
|
-
dom: HTMLElement;
|
|
266
|
-
/**
|
|
267
|
-
* Options to pass to createRoot for React 18 and 19
|
|
268
|
-
* @example
|
|
269
|
-
* {
|
|
270
|
-
* identifierPrefix: 'app-',
|
|
271
|
-
* onRecoverableError: (err) => console.error(err)
|
|
272
|
-
* }
|
|
273
|
-
*/
|
|
274
|
-
rootOptions?: CreateRootOptions_2;
|
|
275
|
-
[key: string]: unknown;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export declare function revalidateTag(tag: string): void;
|
|
279
|
-
|
|
280
|
-
export declare interface Root {
|
|
281
|
-
render(children: React.ReactNode): void;
|
|
282
|
-
unmount(): void;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Interface for a React root object
|
|
287
|
-
*/
|
|
288
|
-
declare interface Root_2 {
|
|
289
|
-
render(children: React_2.ReactNode): void;
|
|
290
|
-
unmount(): void;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Type for a root element, which can be either an HTMLElement or a React root
|
|
295
|
-
*/
|
|
296
|
-
export declare type RootType = HTMLElement | Root_2;
|
|
297
|
-
|
|
298
|
-
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
299
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
300
|
-
}): void;
|
|
301
|
-
|
|
302
|
-
export { }
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
declare module '@module-federation/runtime-core' {
|
|
306
|
-
interface ModuleFederation {
|
|
307
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
308
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
309
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
1
|
+
export { createBridgeComponent } from './provider/versions/legacy';
|
|
2
|
+
export { createRemoteComponent, createRemoteAppComponent, } from './remote/base-component';
|
|
3
|
+
export type { LazyRemoteComponentInfo } from './remote/base-component';
|
|
4
|
+
export { ERROR_TYPE, createLazyComponent, collectSSRAssets, callDataFetch, setSSREnv, autoFetchDataPlugin, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, prefetch, } from './lazy';
|
|
5
|
+
export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
|
|
6
|
+
export type { CreateRootOptions, Root } from './provider/versions/legacy';
|
|
7
|
+
export type { ProviderParams, ProviderFnParams, RootType, DestroyParams, RenderParams, RemoteComponentParams, RenderFnParams, RemoteComponentProps, RemoteModule, } from './types';
|
|
8
|
+
export type { DataFetchParams, NoSSRRemoteInfo, CollectSSRAssetsOptions, CreateLazyComponentOptions, CacheStatus, CacheStatsInfo, } from './lazy';
|
package/dist/base.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-
|
|
2
|
-
import { b } from "./createHelpers-
|
|
3
|
-
import { a, c, b as b2, l } from "./lazy-load-component-plugin-
|
|
4
|
-
import { C, a as a2, E, c as c2, b as b3, d, g, r, s } from "./utils-
|
|
1
|
+
import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-BSHeKyd-.mjs";
|
|
2
|
+
import { b } from "./createHelpers-BSHeKyd-.mjs";
|
|
3
|
+
import { a, c, b as b2, l } from "./lazy-load-component-plugin-CyCe4XLr.mjs";
|
|
4
|
+
import { C, a as a2, E, c as c2, b as b3, d, g, r, s } from "./utils-BBP3hEeV.mjs";
|
|
5
5
|
import { callDataFetch } from "./data-fetch-utils.es.js";
|
|
6
|
-
import { p } from "./prefetch-
|
|
6
|
+
import { p } from "./prefetch-BI-rS7Uh.mjs";
|
|
7
7
|
const createRemoteAppComponent = createRemoteAppComponentFactory(RemoteAppWrapper);
|
|
8
8
|
const createRemoteComponent = createDeprecatedRemoteComponentFactory(
|
|
9
9
|
createRemoteAppComponent
|
|
@@ -1,102 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import * as React from "react";
|
|
2
|
-
import { Component, createElement, createContext } from "react";
|
|
3
5
|
import { L as LoggerInstance, R as RouterContext } from "./index-Bs2NxD2z.mjs";
|
|
4
6
|
import { federationRuntime } from "./plugin.es.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
|
|
14
|
-
this.state = initialState;
|
|
15
|
-
}
|
|
16
|
-
static getDerivedStateFromError(error) {
|
|
17
|
-
return {
|
|
18
|
-
didCatch: true,
|
|
19
|
-
error
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
resetErrorBoundary() {
|
|
23
|
-
const {
|
|
24
|
-
error
|
|
25
|
-
} = this.state;
|
|
26
|
-
if (error !== null) {
|
|
27
|
-
var _this$props$onReset, _this$props;
|
|
28
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
-
args[_key] = arguments[_key];
|
|
7
|
+
const initialState = { didCatch: false, error: null };
|
|
8
|
+
class ErrorBoundary extends React.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
__publicField(this, "state", initialState);
|
|
12
|
+
__publicField(this, "resetErrorBoundary", (..._args) => {
|
|
13
|
+
if (this.state.didCatch) {
|
|
14
|
+
this.setState(initialState);
|
|
30
15
|
}
|
|
31
|
-
|
|
32
|
-
args,
|
|
33
|
-
reason: "imperative-api"
|
|
34
|
-
});
|
|
35
|
-
this.setState(initialState);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
componentDidCatch(error, info) {
|
|
39
|
-
var _this$props$onError, _this$props2;
|
|
40
|
-
(_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
|
|
16
|
+
});
|
|
41
17
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
didCatch
|
|
45
|
-
} = this.state;
|
|
46
|
-
const {
|
|
47
|
-
resetKeys
|
|
48
|
-
} = this.props;
|
|
49
|
-
if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
|
|
50
|
-
var _this$props$onReset2, _this$props3;
|
|
51
|
-
(_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
|
|
52
|
-
next: resetKeys,
|
|
53
|
-
prev: prevProps.resetKeys,
|
|
54
|
-
reason: "keys"
|
|
55
|
-
});
|
|
56
|
-
this.setState(initialState);
|
|
57
|
-
}
|
|
18
|
+
static getDerivedStateFromError(error) {
|
|
19
|
+
return { didCatch: true, error };
|
|
58
20
|
}
|
|
59
21
|
render() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
error
|
|
69
|
-
} = this.state;
|
|
70
|
-
let childToRender = children;
|
|
71
|
-
if (didCatch) {
|
|
72
|
-
const props = {
|
|
73
|
-
error,
|
|
74
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
75
|
-
};
|
|
76
|
-
if (typeof fallbackRender === "function") {
|
|
77
|
-
childToRender = fallbackRender(props);
|
|
78
|
-
} else if (FallbackComponent) {
|
|
79
|
-
childToRender = createElement(FallbackComponent, props);
|
|
80
|
-
} else if (fallback !== void 0) {
|
|
81
|
-
childToRender = fallback;
|
|
82
|
-
} else {
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
22
|
+
if (this.state.didCatch) {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(
|
|
24
|
+
this.props.FallbackComponent,
|
|
25
|
+
{
|
|
26
|
+
error: this.state.error,
|
|
27
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
28
|
+
}
|
|
29
|
+
);
|
|
85
30
|
}
|
|
86
|
-
return
|
|
87
|
-
value: {
|
|
88
|
-
didCatch,
|
|
89
|
-
error,
|
|
90
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
91
|
-
}
|
|
92
|
-
}, childToRender);
|
|
31
|
+
return this.props.children;
|
|
93
32
|
}
|
|
94
33
|
}
|
|
95
|
-
function hasArrayChanged() {
|
|
96
|
-
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
97
|
-
let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
98
|
-
return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
|
|
99
|
-
}
|
|
100
34
|
function createBaseBridgeComponent({
|
|
101
35
|
createRoot,
|
|
102
36
|
defaultRootOptions,
|
|
@@ -121,15 +55,18 @@ function createBaseBridgeComponent({
|
|
|
121
55
|
}
|
|
122
56
|
));
|
|
123
57
|
};
|
|
124
|
-
const DefaultFallback = ({ error }) => /* @__PURE__ */ React.createElement("div", { role: "alert" }, /* @__PURE__ */ React.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React.createElement("pre", { style: { color: "red" } }, error.message));
|
|
125
|
-
const
|
|
58
|
+
const DefaultFallback = ({ error }) => /* @__PURE__ */ React.createElement("div", { role: "alert" }, /* @__PURE__ */ React.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React.createElement("pre", { style: { color: "red" } }, error instanceof Error ? error.message : String(error)));
|
|
59
|
+
const omitHostFallback = (props) => {
|
|
60
|
+
const nextProps = { ...props };
|
|
61
|
+
delete nextProps.fallback;
|
|
62
|
+
return nextProps;
|
|
63
|
+
};
|
|
126
64
|
const BridgeWrapper = ({
|
|
127
65
|
basename,
|
|
128
66
|
moduleName,
|
|
129
67
|
memoryRoute,
|
|
130
|
-
propsInfo
|
|
131
|
-
|
|
132
|
-
}) => /* @__PURE__ */ React.createElement(ErrorBoundaryComponent, { FallbackComponent: fallback || DefaultFallback }, /* @__PURE__ */ React.createElement(
|
|
68
|
+
propsInfo
|
|
69
|
+
}) => /* @__PURE__ */ React.createElement(ErrorBoundary, { FallbackComponent: DefaultFallback }, /* @__PURE__ */ React.createElement(
|
|
133
70
|
RawComponent,
|
|
134
71
|
{
|
|
135
72
|
appInfo: {
|
|
@@ -149,7 +86,6 @@ function createBaseBridgeComponent({
|
|
|
149
86
|
dom,
|
|
150
87
|
basename,
|
|
151
88
|
memoryRoute,
|
|
152
|
-
fallback,
|
|
153
89
|
rootOptions,
|
|
154
90
|
...propsInfo
|
|
155
91
|
} = info;
|
|
@@ -164,9 +100,8 @@ function createBaseBridgeComponent({
|
|
|
164
100
|
basename,
|
|
165
101
|
moduleName,
|
|
166
102
|
memoryRoute,
|
|
167
|
-
fallback,
|
|
168
103
|
propsInfo: {
|
|
169
|
-
...propsInfo,
|
|
104
|
+
...omitHostFallback(propsInfo),
|
|
170
105
|
basename,
|
|
171
106
|
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
172
107
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2
5
|
const React = require("react");
|
|
3
6
|
const index = require("./index-DbjGCKOr.js");
|
|
4
7
|
const plugin = require("./plugin.cjs.js");
|
|
@@ -19,101 +22,33 @@ function _interopNamespaceDefault(e) {
|
|
|
19
22
|
return Object.freeze(n);
|
|
20
23
|
}
|
|
21
24
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
|
|
31
|
-
this.state = initialState;
|
|
32
|
-
}
|
|
33
|
-
static getDerivedStateFromError(error) {
|
|
34
|
-
return {
|
|
35
|
-
didCatch: true,
|
|
36
|
-
error
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
resetErrorBoundary() {
|
|
40
|
-
const {
|
|
41
|
-
error
|
|
42
|
-
} = this.state;
|
|
43
|
-
if (error !== null) {
|
|
44
|
-
var _this$props$onReset, _this$props;
|
|
45
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
46
|
-
args[_key] = arguments[_key];
|
|
25
|
+
const initialState = { didCatch: false, error: null };
|
|
26
|
+
class ErrorBoundary extends React__namespace.Component {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
__publicField(this, "state", initialState);
|
|
30
|
+
__publicField(this, "resetErrorBoundary", (..._args) => {
|
|
31
|
+
if (this.state.didCatch) {
|
|
32
|
+
this.setState(initialState);
|
|
47
33
|
}
|
|
48
|
-
|
|
49
|
-
args,
|
|
50
|
-
reason: "imperative-api"
|
|
51
|
-
});
|
|
52
|
-
this.setState(initialState);
|
|
53
|
-
}
|
|
34
|
+
});
|
|
54
35
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
|
|
58
|
-
}
|
|
59
|
-
componentDidUpdate(prevProps, prevState) {
|
|
60
|
-
const {
|
|
61
|
-
didCatch
|
|
62
|
-
} = this.state;
|
|
63
|
-
const {
|
|
64
|
-
resetKeys
|
|
65
|
-
} = this.props;
|
|
66
|
-
if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
|
|
67
|
-
var _this$props$onReset2, _this$props3;
|
|
68
|
-
(_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
|
|
69
|
-
next: resetKeys,
|
|
70
|
-
prev: prevProps.resetKeys,
|
|
71
|
-
reason: "keys"
|
|
72
|
-
});
|
|
73
|
-
this.setState(initialState);
|
|
74
|
-
}
|
|
36
|
+
static getDerivedStateFromError(error) {
|
|
37
|
+
return { didCatch: true, error };
|
|
75
38
|
}
|
|
76
39
|
render() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
error
|
|
86
|
-
} = this.state;
|
|
87
|
-
let childToRender = children;
|
|
88
|
-
if (didCatch) {
|
|
89
|
-
const props = {
|
|
90
|
-
error,
|
|
91
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
92
|
-
};
|
|
93
|
-
if (typeof fallbackRender === "function") {
|
|
94
|
-
childToRender = fallbackRender(props);
|
|
95
|
-
} else if (FallbackComponent) {
|
|
96
|
-
childToRender = React.createElement(FallbackComponent, props);
|
|
97
|
-
} else if (fallback !== void 0) {
|
|
98
|
-
childToRender = fallback;
|
|
99
|
-
} else {
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
40
|
+
if (this.state.didCatch) {
|
|
41
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
42
|
+
this.props.FallbackComponent,
|
|
43
|
+
{
|
|
44
|
+
error: this.state.error,
|
|
45
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
46
|
+
}
|
|
47
|
+
);
|
|
102
48
|
}
|
|
103
|
-
return
|
|
104
|
-
value: {
|
|
105
|
-
didCatch,
|
|
106
|
-
error,
|
|
107
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
108
|
-
}
|
|
109
|
-
}, childToRender);
|
|
49
|
+
return this.props.children;
|
|
110
50
|
}
|
|
111
51
|
}
|
|
112
|
-
function hasArrayChanged() {
|
|
113
|
-
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
114
|
-
let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
115
|
-
return a.length !== b.length || a.some((item, index2) => !Object.is(item, b[index2]));
|
|
116
|
-
}
|
|
117
52
|
function createBaseBridgeComponent({
|
|
118
53
|
createRoot,
|
|
119
54
|
defaultRootOptions,
|
|
@@ -138,15 +73,18 @@ function createBaseBridgeComponent({
|
|
|
138
73
|
}
|
|
139
74
|
));
|
|
140
75
|
};
|
|
141
|
-
const DefaultFallback = ({ error }) => /* @__PURE__ */ React__namespace.createElement("div", { role: "alert" }, /* @__PURE__ */ React__namespace.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React__namespace.createElement("pre", { style: { color: "red" } }, error.message));
|
|
142
|
-
const
|
|
76
|
+
const DefaultFallback = ({ error }) => /* @__PURE__ */ React__namespace.createElement("div", { role: "alert" }, /* @__PURE__ */ React__namespace.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React__namespace.createElement("pre", { style: { color: "red" } }, error instanceof Error ? error.message : String(error)));
|
|
77
|
+
const omitHostFallback = (props) => {
|
|
78
|
+
const nextProps = { ...props };
|
|
79
|
+
delete nextProps.fallback;
|
|
80
|
+
return nextProps;
|
|
81
|
+
};
|
|
143
82
|
const BridgeWrapper = ({
|
|
144
83
|
basename,
|
|
145
84
|
moduleName,
|
|
146
85
|
memoryRoute,
|
|
147
|
-
propsInfo
|
|
148
|
-
|
|
149
|
-
}) => /* @__PURE__ */ React__namespace.createElement(ErrorBoundaryComponent, { FallbackComponent: fallback || DefaultFallback }, /* @__PURE__ */ React__namespace.createElement(
|
|
86
|
+
propsInfo
|
|
87
|
+
}) => /* @__PURE__ */ React__namespace.createElement(ErrorBoundary, { FallbackComponent: DefaultFallback }, /* @__PURE__ */ React__namespace.createElement(
|
|
150
88
|
RawComponent,
|
|
151
89
|
{
|
|
152
90
|
appInfo: {
|
|
@@ -166,7 +104,6 @@ function createBaseBridgeComponent({
|
|
|
166
104
|
dom,
|
|
167
105
|
basename,
|
|
168
106
|
memoryRoute,
|
|
169
|
-
fallback,
|
|
170
107
|
rootOptions,
|
|
171
108
|
...propsInfo
|
|
172
109
|
} = info;
|
|
@@ -181,9 +118,8 @@ function createBaseBridgeComponent({
|
|
|
181
118
|
basename,
|
|
182
119
|
moduleName,
|
|
183
120
|
memoryRoute,
|
|
184
|
-
fallback,
|
|
185
121
|
propsInfo: {
|
|
186
|
-
...propsInfo,
|
|
122
|
+
...omitHostFallback(propsInfo),
|
|
187
123
|
basename,
|
|
188
124
|
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
189
125
|
}
|