@module-federation/bridge-react 2.6.0 → 2.8.0
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-CIOXqUYV.mjs → bridge-base-BaKy6CY_.mjs} +25 -92
- package/dist/{bridge-base-HLp3d7aF.js → bridge-base-Ch33UJuN.js} +25 -91
- package/dist/{createHelpers-DNBacpxb.js → createHelpers-19BP0xtB.js} +2 -3
- package/dist/{createHelpers-BY5Uj9_Z.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/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-DEu-DfZt.mjs} +2 -2
- package/dist/{lazy-load-component-plugin-DG4e3Tib.js → lazy-load-component-plugin-FKp6nQa-.js} +2 -2
- 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-CTZuFBqh.mjs} +387 -16
- package/dist/{prefetch-CG2l-06N.js → prefetch-D66kL1aM.js} +387 -16
- 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 +20 -13
- package/dist/utils-CFTy4LVE.js +0 -2029
- package/dist/utils-DGS4pYp8.mjs +0 -2030
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-
|
|
1
|
+
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-BaKy6CY_.mjs";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import { L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-Bs2NxD2z.mjs";
|
|
4
4
|
import React__default, { forwardRef, useRef, useState, useEffect } from "react";
|
|
@@ -161,13 +161,12 @@ function createLazyRemoteComponentFactory(RemoteApp) {
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
function createRemoteAppComponentFactory(RemoteApp) {
|
|
164
|
-
const ErrorBoundaryComponent = ErrorBoundary;
|
|
165
164
|
const createLazyRemoteComponent = createLazyRemoteComponentFactory(RemoteApp);
|
|
166
165
|
return function createRemoteAppComponent(info) {
|
|
167
166
|
const LazyComponent = createLazyRemoteComponent(info);
|
|
168
167
|
return forwardRef((props, ref) => {
|
|
169
168
|
return /* @__PURE__ */ React__default.createElement(
|
|
170
|
-
|
|
169
|
+
ErrorBoundary,
|
|
171
170
|
{
|
|
172
171
|
FallbackComponent: info.fallback
|
|
173
172
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const lazyUtils = require("./utils-
|
|
2
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
3
3
|
const logger = require("./logger-Dxblx6P-.js");
|
|
4
4
|
function wrapSetTimeout(targetPromise, delay = 2e4, id) {
|
|
5
5
|
if (targetPromise && typeof targetPromise.then === "function") {
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const dataFetchServerMiddleware: MiddlewareHandler;
|
|
4
|
-
export default dataFetchServerMiddleware;
|
|
5
|
-
|
|
6
|
-
export { }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare module '@module-federation/runtime-core' {
|
|
10
|
-
interface ModuleFederation {
|
|
11
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
12
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
13
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
export { default } from './lazy/data-fetch/data-fetch-server-middleware';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DATA_FETCH_QUERY, l as logger, e as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, h as fetchData, j as loadDataFetchModule } from "./utils-
|
|
1
|
+
import { D as DATA_FETCH_QUERY, l as logger, e as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, h as fetchData, j as loadDataFetchModule } from "./utils-BBP3hEeV.mjs";
|
|
2
2
|
import { M as MANIFEST_EXT, S as SEPARATOR } from "./logger-DwWkXsWl.mjs";
|
|
3
3
|
function wrapSetTimeout(targetPromise, delay = 2e4, id) {
|
|
4
4
|
if (targetPromise && typeof targetPromise.then === "function") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const lazyUtils = require("./utils-
|
|
4
|
-
const prefetch = require("./prefetch-
|
|
3
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
4
|
+
const prefetch = require("./prefetch-D66kL1aM.js");
|
|
5
5
|
async function callDataFetch() {
|
|
6
6
|
const dataFetch = globalThis[lazyUtils.DATA_FETCH_FUNCTION];
|
|
7
7
|
if (dataFetch) {
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
|
|
4
|
-
|
|
5
|
-
declare interface CacheConfig {
|
|
6
|
-
maxSize?: number;
|
|
7
|
-
unstable_shouldDisable?: ({ request, }: {
|
|
8
|
-
request: Request;
|
|
9
|
-
}) => boolean | Promise<boolean>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare interface CacheOptions {
|
|
13
|
-
tag?: string | string[];
|
|
14
|
-
maxAge?: number;
|
|
15
|
-
revalidate?: number;
|
|
16
|
-
getKey?: <Args extends any[]>(...args: Args) => string;
|
|
17
|
-
onCache?: (info: CacheStatsInfo) => boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export declare const CacheSize: {
|
|
21
|
-
readonly KB: 1024;
|
|
22
|
-
readonly MB: number;
|
|
23
|
-
readonly GB: number;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export declare interface CacheStatsInfo {
|
|
27
|
-
status: CacheStatus;
|
|
28
|
-
key: string | symbol;
|
|
29
|
-
params: DataFetchParams;
|
|
30
|
-
result: any;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export declare type CacheStatus = 'hit' | 'stale' | 'miss';
|
|
34
|
-
|
|
35
|
-
export declare const CacheTime: {
|
|
36
|
-
readonly SECOND: 1000;
|
|
37
|
-
readonly MINUTE: number;
|
|
38
|
-
readonly HOUR: number;
|
|
39
|
-
readonly DAY: number;
|
|
40
|
-
readonly WEEK: number;
|
|
41
|
-
readonly MONTH: number;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export declare function callDataFetch(): Promise<void>;
|
|
45
|
-
|
|
46
|
-
export declare function clearStore(): void;
|
|
47
|
-
|
|
48
|
-
export declare function configureCache(config: CacheConfig): void;
|
|
49
|
-
|
|
50
|
-
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
51
|
-
|
|
52
|
-
declare type DataFetchParams = {
|
|
53
|
-
isDowngrade: boolean;
|
|
54
|
-
_id?: string;
|
|
55
|
-
} & Record<string, unknown>;
|
|
56
|
-
|
|
57
|
-
export declare function generateKey(dataFetchOptions: DataFetchParams): string;
|
|
58
|
-
|
|
59
|
-
export declare function injectDataFetch(): void;
|
|
60
|
-
|
|
61
|
-
export declare function prefetch(options: PrefetchOptions): Promise<void>;
|
|
62
|
-
|
|
63
|
-
export declare type PrefetchOptions = {
|
|
64
|
-
id: string;
|
|
65
|
-
instance: ReturnType<typeof getInstance>;
|
|
66
|
-
dataFetchParams?: DataFetchParams;
|
|
67
|
-
preloadComponentResource?: boolean;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export declare function revalidateTag(tag: string): void;
|
|
71
|
-
|
|
72
|
-
export { }
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
declare module '@module-federation/runtime-core' {
|
|
76
|
-
interface ModuleFederation {
|
|
77
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
78
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
79
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
export * from './lazy/data-fetch';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { y as DATA_FETCH_FUNCTION } from "./utils-
|
|
2
|
-
import { C, a, c, b, d, g, r } from "./utils-
|
|
3
|
-
import { d as dataFetchFunction } from "./prefetch-
|
|
4
|
-
import { i, p } from "./prefetch-
|
|
1
|
+
import { y as DATA_FETCH_FUNCTION } from "./utils-BBP3hEeV.mjs";
|
|
2
|
+
import { C, a, c, b, d, g, r } from "./utils-BBP3hEeV.mjs";
|
|
3
|
+
import { d as dataFetchFunction } from "./prefetch-CTZuFBqh.mjs";
|
|
4
|
+
import { i, p } from "./prefetch-CTZuFBqh.mjs";
|
|
5
5
|
async function callDataFetch() {
|
|
6
6
|
const dataFetch = globalThis[DATA_FETCH_FUNCTION];
|
|
7
7
|
if (dataFetch) {
|
package/dist/data-fetch.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-
|
|
4
|
-
const lazyUtils = require("./utils-
|
|
3
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-FKp6nQa-.js");
|
|
4
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
5
5
|
const dataFetchUtils = require("./data-fetch-utils.cjs.js");
|
|
6
|
-
const prefetch = require("./prefetch-
|
|
6
|
+
const prefetch = require("./prefetch-D66kL1aM.js");
|
|
7
7
|
exports.autoFetchDataPlugin = lazyLoadComponentPlugin.autoFetchData;
|
|
8
8
|
exports.collectSSRAssets = lazyLoadComponentPlugin.collectSSRAssets;
|
|
9
9
|
exports.createLazyComponent = lazyLoadComponentPlugin.createLazyComponent;
|
package/dist/data-fetch.d.ts
CHANGED
|
@@ -1,140 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const autoFetchDataPlugin: () => ModuleFederationRuntimePlugin;
|
|
7
|
-
|
|
8
|
-
export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
|
|
9
|
-
|
|
10
|
-
declare interface CacheConfig {
|
|
11
|
-
maxSize?: number;
|
|
12
|
-
unstable_shouldDisable?: ({ request, }: {
|
|
13
|
-
request: Request;
|
|
14
|
-
}) => boolean | Promise<boolean>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare interface CacheOptions {
|
|
18
|
-
tag?: string | string[];
|
|
19
|
-
maxAge?: number;
|
|
20
|
-
revalidate?: number;
|
|
21
|
-
getKey?: <Args extends any[]>(...args: Args) => string;
|
|
22
|
-
onCache?: (info: CacheStatsInfo) => boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export declare const CacheSize: {
|
|
26
|
-
readonly KB: 1024;
|
|
27
|
-
readonly MB: number;
|
|
28
|
-
readonly GB: number;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export declare interface CacheStatsInfo {
|
|
32
|
-
status: CacheStatus;
|
|
33
|
-
key: string | symbol;
|
|
34
|
-
params: DataFetchParams;
|
|
35
|
-
result: any;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export declare type CacheStatus = 'hit' | 'stale' | 'miss';
|
|
39
|
-
|
|
40
|
-
export declare const CacheTime: {
|
|
41
|
-
readonly SECOND: 1000;
|
|
42
|
-
readonly MINUTE: number;
|
|
43
|
-
readonly HOUR: number;
|
|
44
|
-
readonly DAY: number;
|
|
45
|
-
readonly WEEK: number;
|
|
46
|
-
readonly MONTH: number;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export declare function callDataFetch(): Promise<void>;
|
|
50
|
-
|
|
51
|
-
export declare function clearStore(): void;
|
|
52
|
-
|
|
53
|
-
export declare function collectSSRAssets(options: CollectSSRAssetsOptions): default_2.ReactNode[];
|
|
54
|
-
|
|
55
|
-
export declare type CollectSSRAssetsOptions = {
|
|
56
|
-
id: string;
|
|
57
|
-
instance: ReturnType<typeof getInstance>;
|
|
58
|
-
injectScript?: boolean;
|
|
59
|
-
injectLink?: boolean;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export declare function configureCache(config: CacheConfig): void;
|
|
63
|
-
|
|
64
|
-
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;
|
|
65
|
-
|
|
66
|
-
export declare type CreateLazyComponentOptions<T, E extends keyof T> = {
|
|
67
|
-
loader: () => Promise<T>;
|
|
68
|
-
instance: ReturnType<typeof getInstance>;
|
|
69
|
-
loading: default_2.ReactNode;
|
|
70
|
-
delayLoading?: number;
|
|
71
|
-
fallback: ReactNode | ((errorInfo: ErrorInfo) => ReactNode);
|
|
72
|
-
export?: E;
|
|
73
|
-
dataFetchParams?: DataFetchParams;
|
|
74
|
-
noSSR?: boolean;
|
|
75
|
-
injectScript?: boolean;
|
|
76
|
-
injectLink?: boolean;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
|
|
80
|
-
|
|
81
|
-
export declare type DataFetchParams = {
|
|
82
|
-
isDowngrade: boolean;
|
|
83
|
-
_id?: string;
|
|
84
|
-
} & Record<string, unknown>;
|
|
85
|
-
|
|
86
|
-
export declare const ERROR_TYPE: {
|
|
87
|
-
DATA_FETCH: number;
|
|
88
|
-
LOAD_REMOTE: number;
|
|
89
|
-
UNKNOWN: number;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
declare type ErrorInfo = {
|
|
93
|
-
error: Error;
|
|
94
|
-
errorType: number;
|
|
95
|
-
dataFetchMapKey?: string;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export declare const flushDataFetch: () => void;
|
|
99
|
-
|
|
100
|
-
export declare function generateKey(dataFetchOptions: DataFetchParams): string;
|
|
101
|
-
|
|
102
|
-
export declare function lazyLoadComponentPlugin(): ModuleFederationRuntimePlugin;
|
|
103
|
-
|
|
104
|
-
export declare type NoSSRRemoteInfo = {
|
|
105
|
-
name: string;
|
|
106
|
-
version: string;
|
|
107
|
-
ssrPublicPath: string;
|
|
108
|
-
ssrRemoteEntry: string;
|
|
109
|
-
globalName: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export declare function prefetch(options: PrefetchOptions): Promise<void>;
|
|
113
|
-
|
|
114
|
-
export declare type PrefetchOptions = {
|
|
115
|
-
id: string;
|
|
116
|
-
instance: ReturnType<typeof getInstance>;
|
|
117
|
-
dataFetchParams?: DataFetchParams;
|
|
118
|
-
preloadComponentResource?: boolean;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
declare type ReactKey = {
|
|
122
|
-
key?: default_2.Key | null;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export declare function revalidateTag(tag: string): void;
|
|
126
|
-
|
|
127
|
-
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
128
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
129
|
-
}): void;
|
|
130
|
-
|
|
131
|
-
export { }
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
declare module '@module-federation/runtime-core' {
|
|
135
|
-
interface ModuleFederation {
|
|
136
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
137
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
138
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
1
|
+
export { ERROR_TYPE, createLazyComponent, collectSSRAssets, callDataFetch, setSSREnv, autoFetchDataPlugin, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, prefetch, } from './lazy';
|
|
2
|
+
export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
|
|
3
|
+
export { flushDataFetch } from './lazy/utils';
|
|
4
|
+
export type { DataFetchParams, NoSSRRemoteInfo, CollectSSRAssetsOptions, CreateLazyComponentOptions, CacheStatus, CacheStatsInfo, PrefetchOptions, } from './lazy';
|
package/dist/data-fetch.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a, c, b, l } from "./lazy-load-component-plugin-
|
|
2
|
-
import { C, a as a2, E, c as c2, b as b2, d, f, g, r, s } from "./utils-
|
|
1
|
+
import { a, c, b, l } from "./lazy-load-component-plugin-DEu-DfZt.mjs";
|
|
2
|
+
import { C, a as a2, E, c as c2, b as b2, d, f, g, r, s } from "./utils-BBP3hEeV.mjs";
|
|
3
3
|
import { callDataFetch } from "./data-fetch-utils.es.js";
|
|
4
|
-
import { p } from "./prefetch-
|
|
4
|
+
import { p } from "./prefetch-CTZuFBqh.mjs";
|
|
5
5
|
export {
|
|
6
6
|
C as CacheSize,
|
|
7
7
|
a2 as CacheTime,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ErrorFallbackProps } from './types';
|
|
3
|
+
type ErrorBoundaryProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
FallbackComponent: React.ComponentType<ErrorFallbackProps>;
|
|
6
|
+
};
|
|
7
|
+
type ErrorBoundaryState = {
|
|
8
|
+
didCatch: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
};
|
|
11
|
+
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
12
|
+
state: ErrorBoundaryState;
|
|
13
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
14
|
+
private resetErrorBoundary;
|
|
15
|
+
render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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-FKp6nQa-.js");
|
|
5
|
+
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
6
6
|
const dataFetchUtils = require("./data-fetch-utils.cjs.js");
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const ReactRouterDOM = require("react-router-dom");
|
|
9
9
|
const index = require("./index-DbjGCKOr.js");
|
|
10
|
-
const prefetch = require("./prefetch-
|
|
10
|
+
const prefetch = require("./prefetch-D66kL1aM.js");
|
|
11
11
|
function _interopNamespaceDefault(e2) {
|
|
12
12
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
13
|
if (e2) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,299 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export
|
|
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<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
|
-
* Interface for a remote module provider
|
|
222
|
-
*/
|
|
223
|
-
export declare interface RemoteModule {
|
|
224
|
-
provider: () => {
|
|
225
|
-
render: (info: RenderFnParams) => void;
|
|
226
|
-
destroy: (info: {
|
|
227
|
-
dom: any;
|
|
228
|
-
}) => void;
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Parameters for the render function, extending ProviderParams
|
|
234
|
-
*/
|
|
235
|
-
export declare interface RenderFnParams extends ProviderParams {
|
|
236
|
-
dom: HTMLElement;
|
|
237
|
-
fallback?: React_2.ComponentType<{
|
|
238
|
-
error: Error;
|
|
239
|
-
}>;
|
|
240
|
-
[key: string]: unknown;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Parameters for the render function
|
|
245
|
-
*/
|
|
246
|
-
export declare interface RenderParams {
|
|
247
|
-
moduleName?: string;
|
|
248
|
-
basename?: string;
|
|
249
|
-
memoryRoute?: {
|
|
250
|
-
entryPath: string;
|
|
251
|
-
initialState?: Record<string, unknown>;
|
|
252
|
-
};
|
|
253
|
-
dom: HTMLElement;
|
|
254
|
-
/**
|
|
255
|
-
* Options to pass to createRoot for React 18 and 19
|
|
256
|
-
* @example
|
|
257
|
-
* {
|
|
258
|
-
* identifierPrefix: 'app-',
|
|
259
|
-
* onRecoverableError: (err) => console.error(err)
|
|
260
|
-
* }
|
|
261
|
-
*/
|
|
262
|
-
rootOptions?: CreateRootOptions_2;
|
|
263
|
-
[key: string]: unknown;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export declare function revalidateTag(tag: string): void;
|
|
267
|
-
|
|
268
|
-
export declare interface Root {
|
|
269
|
-
render(children: React.ReactNode): void;
|
|
270
|
-
unmount(): void;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Interface for a React root object
|
|
275
|
-
*/
|
|
276
|
-
declare interface Root_2 {
|
|
277
|
-
render(children: React_2.ReactNode): void;
|
|
278
|
-
unmount(): void;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Type for a root element, which can be either an HTMLElement or a React root
|
|
283
|
-
*/
|
|
284
|
-
export declare type RootType = HTMLElement | Root_2;
|
|
285
|
-
|
|
286
|
-
export declare function setSSREnv({ fetchServerQuery, }: {
|
|
287
|
-
fetchServerQuery?: Record<string, unknown>;
|
|
288
|
-
}): void;
|
|
289
|
-
|
|
290
|
-
export { }
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
declare module '@module-federation/runtime-core' {
|
|
294
|
-
interface ModuleFederation {
|
|
295
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
296
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
297
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for React 16/17 (legacy) specific bridge components
|
|
3
|
+
* This file provides support for React 16 and 17 versions, using the traditional ReactDOM.render API
|
|
4
|
+
*/
|
|
5
|
+
export { createBridgeComponent } from './provider/versions/legacy';
|
|
6
|
+
export { createRemoteComponent, createRemoteAppComponent, } from './remote/router-component';
|
|
7
|
+
export type { LazyRemoteComponentInfo } from './remote/router-component';
|
|
8
|
+
export { ERROR_TYPE, createLazyComponent, collectSSRAssets, callDataFetch, setSSREnv, autoFetchDataPlugin, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, prefetch, } from './lazy';
|
|
9
|
+
export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
|
|
10
|
+
export type { CreateRootOptions, Root } from './provider/versions/legacy';
|
|
11
|
+
export type { ProviderParams, ProviderFnParams, RootType, DestroyParams, RenderParams, RemoteComponentParams, RenderFnParams, RemoteComponentProps, RemoteModule, } from './types';
|
|
12
|
+
export type { DataFetchParams, NoSSRRemoteInfo, CollectSSRAssetsOptions, CreateLazyComponentOptions, CacheStatus, CacheStatsInfo, } from './lazy';
|