@module-federation/bridge-react 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/base.cjs.js +29 -0
- package/dist/base.d.ts +311 -0
- package/dist/base.es.js +30 -0
- package/dist/bridge-base-CIOXqUYV.mjs +214 -0
- package/dist/bridge-base-HLp3d7aF.js +229 -0
- package/dist/createHelpers-BY5Uj9_Z.mjs +192 -0
- package/dist/createHelpers-DNBacpxb.js +191 -0
- package/dist/data-fetch-server-middleware.cjs.js +163 -0
- package/dist/data-fetch-server-middleware.d.ts +15 -0
- package/dist/data-fetch-server-middleware.es.js +164 -0
- package/dist/data-fetch-utils.cjs.js +24 -0
- package/dist/data-fetch-utils.d.ts +81 -0
- package/dist/data-fetch-utils.es.js +26 -0
- package/dist/data-fetch.cjs.js +22 -0
- package/dist/data-fetch.d.ts +140 -0
- package/dist/data-fetch.es.js +22 -0
- package/dist/index-Bs2NxD2z.mjs +46 -0
- package/dist/index-DbjGCKOr.js +45 -0
- package/dist/index.cjs.js +125 -0
- package/dist/index.d.ts +299 -0
- package/dist/index.es.js +109 -0
- package/dist/lazy-load-component-plugin-BjMVNoep.js +521 -0
- package/dist/lazy-load-component-plugin-aj97Vt-4.mjs +522 -0
- package/dist/lazy-load-component-plugin.cjs.js +6 -0
- package/dist/lazy-load-component-plugin.d.ts +16 -0
- package/dist/lazy-load-component-plugin.es.js +6 -0
- package/dist/lazy-utils.cjs.js +24 -0
- package/dist/lazy-utils.d.ts +149 -0
- package/dist/lazy-utils.es.js +24 -0
- package/dist/logger-DwWkXsWl.mjs +139 -0
- package/dist/logger-Dxblx6P-.js +138 -0
- package/dist/plugin.cjs.js +14 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.es.js +14 -0
- package/dist/prefetch-BwRDb4SJ.mjs +1082 -0
- package/dist/prefetch-DLhPTofn.js +1081 -0
- package/dist/router-v5.cjs.js +57 -0
- package/dist/router-v5.d.ts +17 -0
- package/dist/router-v5.es.js +34 -0
- package/dist/router-v6.cjs.js +84 -0
- package/dist/router-v6.d.ts +20 -0
- package/dist/router-v6.es.js +61 -0
- package/dist/router-v7.cjs.js +85 -0
- package/dist/router-v7.d.ts +19 -0
- package/dist/router-v7.es.js +63 -0
- package/dist/router.cjs.js +82 -0
- package/dist/router.d.ts +20 -0
- package/dist/router.es.js +60 -0
- package/dist/utils-CFTy4LVE.js +2029 -0
- package/dist/utils-DGS4pYp8.mjs +2030 -0
- package/dist/v18.cjs.js +15 -0
- package/dist/v18.d.ts +114 -0
- package/dist/v18.es.js +15 -0
- package/dist/v19.cjs.js +15 -0
- package/dist/v19.d.ts +115 -0
- package/dist/v19.es.js +15 -0
- package/package.json +189 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# React Bridge
|
|
2
|
+
|
|
3
|
+
React bridge is used to load the routing module in mf, so that the routing module can work properly with the host environment.
|
|
4
|
+
|
|
5
|
+
> When to use
|
|
6
|
+
|
|
7
|
+
- Load the route module
|
|
8
|
+
- Load across the front end framework
|
|
9
|
+
|
|
10
|
+
## How to use
|
|
11
|
+
|
|
12
|
+
# 1. Install the react bridge library
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @module-federation/bridge-react
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
# 2. Configure the react bridge library
|
|
19
|
+
|
|
20
|
+
> Use createBridgeComponent create component provider
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
// ./src/index.tsx
|
|
24
|
+
import { createBridgeComponent } from '@module-federation/bridge-react';
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return ( <BrowserRouter basename="/">
|
|
28
|
+
<Routes>
|
|
29
|
+
<Route path="/" Component={()=> <div>Home page</div>}>
|
|
30
|
+
<Route path="/detail" Component={()=> <div>Detail page</div>}>
|
|
31
|
+
</Routes>
|
|
32
|
+
</BrowserRouter>)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default createBridgeComponent({
|
|
36
|
+
rootComponent: App
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> set alias to proxy
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
//rsbuild.config.ts
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
source: {
|
|
46
|
+
alias: {
|
|
47
|
+
'react-router-dom$': path.resolve(
|
|
48
|
+
__dirname,
|
|
49
|
+
'node_modules/@module-federation/bridge-react/dist/router.es.js',
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
server: {
|
|
54
|
+
port: 2001,
|
|
55
|
+
host: 'localhost',
|
|
56
|
+
},
|
|
57
|
+
dev: {
|
|
58
|
+
assetPrefix: 'http://localhost:2001',
|
|
59
|
+
},
|
|
60
|
+
tools: {
|
|
61
|
+
rspack: (config, { appendPlugins }) => {
|
|
62
|
+
delete config.optimization?.splitChunks;
|
|
63
|
+
config.output!.uniqueName = 'remote1';
|
|
64
|
+
appendPlugins([
|
|
65
|
+
new ModuleFederationPlugin({
|
|
66
|
+
name: 'remote1',
|
|
67
|
+
exposes: {
|
|
68
|
+
'./export-app': './src/index.tsx',
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
]);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
# 3. Load the module with routing
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
//rsbuild.config.ts
|
|
81
|
+
export default defineConfig({
|
|
82
|
+
tools: {
|
|
83
|
+
rspack: (config, { appendPlugins }) => {
|
|
84
|
+
config.output!.uniqueName = 'host';
|
|
85
|
+
appendPlugins([
|
|
86
|
+
new ModuleFederationPlugin({
|
|
87
|
+
name: 'host',
|
|
88
|
+
remotes: {
|
|
89
|
+
remote1: 'remote1@http://localhost:2001/mf-manifest.json',
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
]);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> Use the module
|
|
99
|
+
|
|
100
|
+
```jsx
|
|
101
|
+
// ./src/index.tsx
|
|
102
|
+
import { createBridgeComponent } from '@module-federation/bridge-react';
|
|
103
|
+
|
|
104
|
+
const Remote1 = createBridgeComponent(()=> import('remote1/export-app'));
|
|
105
|
+
|
|
106
|
+
function App() {
|
|
107
|
+
return ( <BrowserRouter basename="/">
|
|
108
|
+
<ul>
|
|
109
|
+
<li>
|
|
110
|
+
<Link to="/">
|
|
111
|
+
Home
|
|
112
|
+
</Link>
|
|
113
|
+
</li>
|
|
114
|
+
<li>
|
|
115
|
+
<Link to="/remote1">
|
|
116
|
+
Remote1
|
|
117
|
+
</Link>
|
|
118
|
+
</li>
|
|
119
|
+
</ul>
|
|
120
|
+
<Routes>
|
|
121
|
+
<Route path="/" Component={()=> <div>Home page</div>}>
|
|
122
|
+
<Route path="/remote1" Component={()=> <Remote1 />}>
|
|
123
|
+
</Routes>
|
|
124
|
+
</BrowserRouter>)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const root = ReactDOM.createRoot(document.getElementById('root')!);
|
|
128
|
+
root.render(
|
|
129
|
+
<App />
|
|
130
|
+
);
|
|
131
|
+
```
|
package/dist/base.cjs.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const createHelpers = require("./createHelpers-DNBacpxb.js");
|
|
4
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-BjMVNoep.js");
|
|
5
|
+
const lazyUtils = require("./utils-CFTy4LVE.js");
|
|
6
|
+
const dataFetchUtils = require("./data-fetch-utils.cjs.js");
|
|
7
|
+
const prefetch = require("./prefetch-DLhPTofn.js");
|
|
8
|
+
const createRemoteAppComponent = createHelpers.createRemoteAppComponentFactory(createHelpers.RemoteAppWrapper);
|
|
9
|
+
const createRemoteComponent = createHelpers.createDeprecatedRemoteComponentFactory(
|
|
10
|
+
createRemoteAppComponent
|
|
11
|
+
);
|
|
12
|
+
exports.createBridgeComponent = createHelpers.createBridgeComponent;
|
|
13
|
+
exports.autoFetchDataPlugin = lazyLoadComponentPlugin.autoFetchData;
|
|
14
|
+
exports.collectSSRAssets = lazyLoadComponentPlugin.collectSSRAssets;
|
|
15
|
+
exports.createLazyComponent = lazyLoadComponentPlugin.createLazyComponent;
|
|
16
|
+
exports.lazyLoadComponentPlugin = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
|
|
17
|
+
exports.CacheSize = lazyUtils.CacheSize;
|
|
18
|
+
exports.CacheTime = lazyUtils.CacheTime;
|
|
19
|
+
exports.ERROR_TYPE = lazyUtils.ERROR_TYPE;
|
|
20
|
+
exports.cache = lazyUtils.cache;
|
|
21
|
+
exports.clearStore = lazyUtils.clearStore;
|
|
22
|
+
exports.configureCache = lazyUtils.configureCache;
|
|
23
|
+
exports.generateKey = lazyUtils.generateKey;
|
|
24
|
+
exports.revalidateTag = lazyUtils.revalidateTag;
|
|
25
|
+
exports.setSSREnv = lazyUtils.setSSREnv;
|
|
26
|
+
exports.callDataFetch = dataFetchUtils.callDataFetch;
|
|
27
|
+
exports.prefetch = prefetch.prefetch;
|
|
28
|
+
exports.createRemoteAppComponent = createRemoteAppComponent;
|
|
29
|
+
exports.createRemoteComponent = createRemoteComponent;
|
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
3
|
+
import { getInstance } from '@module-federation/runtime';
|
|
4
|
+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
5
|
+
import * as React_2 from 'react';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
import { RefAttributes } from 'react';
|
|
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
|
+
}
|
package/dist/base.es.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-BY5Uj9_Z.mjs";
|
|
2
|
+
import { b } from "./createHelpers-BY5Uj9_Z.mjs";
|
|
3
|
+
import { a, c, b as b2, l } from "./lazy-load-component-plugin-aj97Vt-4.mjs";
|
|
4
|
+
import { C, a as a2, E, c as c2, b as b3, d, g, r, s } from "./utils-DGS4pYp8.mjs";
|
|
5
|
+
import { callDataFetch } from "./data-fetch-utils.es.js";
|
|
6
|
+
import { p } from "./prefetch-BwRDb4SJ.mjs";
|
|
7
|
+
const createRemoteAppComponent = createRemoteAppComponentFactory(RemoteAppWrapper);
|
|
8
|
+
const createRemoteComponent = createDeprecatedRemoteComponentFactory(
|
|
9
|
+
createRemoteAppComponent
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
C as CacheSize,
|
|
13
|
+
a2 as CacheTime,
|
|
14
|
+
E as ERROR_TYPE,
|
|
15
|
+
a as autoFetchDataPlugin,
|
|
16
|
+
c2 as cache,
|
|
17
|
+
callDataFetch,
|
|
18
|
+
b3 as clearStore,
|
|
19
|
+
c as collectSSRAssets,
|
|
20
|
+
d as configureCache,
|
|
21
|
+
b as createBridgeComponent,
|
|
22
|
+
b2 as createLazyComponent,
|
|
23
|
+
createRemoteAppComponent,
|
|
24
|
+
createRemoteComponent,
|
|
25
|
+
g as generateKey,
|
|
26
|
+
l as lazyLoadComponentPlugin,
|
|
27
|
+
p as prefetch,
|
|
28
|
+
r as revalidateTag,
|
|
29
|
+
s as setSSREnv
|
|
30
|
+
};
|