@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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function WraperRouter(props: Record<string, unknown>): React.JSX.Element;
|
|
3
|
+
declare function WraperRouterProvider(props: Record<string, unknown>): React.JSX.Element;
|
|
4
|
+
export * from 'react-router';
|
|
5
|
+
export { WraperRouter as BrowserRouter };
|
|
6
|
+
export { WraperRouterProvider as RouterProvider };
|
package/dist/router-v5.d.ts
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function BrowserRouter(props: Record<string, unknown>): default_2.JSX.Element;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export * from "react-router-dom/";
|
|
7
|
-
|
|
8
|
-
export { }
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare module '@module-federation/runtime-core' {
|
|
12
|
-
interface ModuleFederation {
|
|
13
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
14
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
15
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
export * from './router/v5';
|
package/dist/router-v6.d.ts
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as ReactRouterDom from 'react-router-dom/dist/index.js';
|
|
3
|
-
|
|
4
|
-
export declare function BrowserRouter(props: Parameters<typeof ReactRouterDom.BrowserRouter>[0] | Parameters<typeof ReactRouterDom.MemoryRouter>[0]): default_2.JSX.Element;
|
|
5
|
-
|
|
6
|
-
export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): default_2.JSX.Element;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export * from "react-router-dom/";
|
|
10
|
-
|
|
11
|
-
export { }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare module '@module-federation/runtime-core' {
|
|
15
|
-
interface ModuleFederation {
|
|
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
|
-
}
|
|
1
|
+
export * from './router/v6';
|
package/dist/router-v7.d.ts
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function BrowserRouter(props: Record<string, unknown>): default_2.JSX.Element;
|
|
4
|
-
|
|
5
|
-
export declare function RouterProvider(props: Record<string, unknown>): default_2.JSX.Element;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export * from "react-router";
|
|
9
|
-
|
|
10
|
-
export { }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
declare module '@module-federation/runtime-core' {
|
|
14
|
-
interface ModuleFederation {
|
|
15
|
-
createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
|
|
16
|
-
prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
|
|
17
|
-
collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
export * from './router/v7';
|
package/dist/router.d.ts
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as ReactRouterDom from 'react-router-dom/';
|
|
3
|
-
|
|
4
|
-
export declare function BrowserRouter(props: Parameters<typeof ReactRouterDom.BrowserRouter>[0] | Parameters<typeof ReactRouterDom.MemoryRouter>[0]): default_2.JSX.Element;
|
|
5
|
-
|
|
6
|
-
export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): default_2.JSX.Element;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export * from "react-router-dom/";
|
|
10
|
-
|
|
11
|
-
export { }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare module '@module-federation/runtime-core' {
|
|
15
|
-
interface ModuleFederation {
|
|
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
|
-
}
|
|
1
|
+
export * from './router/default';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface SizeLimitedCacheOptions<K, V> {
|
|
2
|
+
maxSize: number;
|
|
3
|
+
sizeCalculation?: (value: V, key: K) => number;
|
|
4
|
+
}
|
|
5
|
+
export interface SizeLimitedCacheSetOptions {
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A small, size-aware least-recently-used cache.
|
|
10
|
+
*
|
|
11
|
+
* This intentionally implements only the operations used by federation
|
|
12
|
+
* packages. Reading or checking an entry refreshes its recency.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SizeLimitedCache<K, V> {
|
|
15
|
+
readonly maxSize: number;
|
|
16
|
+
private readonly entries;
|
|
17
|
+
private readonly sizeCalculation?;
|
|
18
|
+
private currentSize;
|
|
19
|
+
constructor(options: SizeLimitedCacheOptions<K, V>);
|
|
20
|
+
get size(): number;
|
|
21
|
+
get calculatedSize(): number;
|
|
22
|
+
get(key: K): V | undefined;
|
|
23
|
+
has(key: K): boolean;
|
|
24
|
+
set(key: K, value: V, options?: SizeLimitedCacheSetOptions): this;
|
|
25
|
+
delete(key: K): boolean;
|
|
26
|
+
clear(): void;
|
|
27
|
+
private refresh;
|
|
28
|
+
private evictUntilWithinLimit;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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);
|
|
5
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
+
class SizeLimitedCache {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
__publicField(this, "maxSize");
|
|
9
|
+
__publicField(this, "entries", /* @__PURE__ */ new Map());
|
|
10
|
+
__publicField(this, "sizeCalculation");
|
|
11
|
+
__publicField(this, "currentSize", 0);
|
|
12
|
+
if (!Number.isInteger(options.maxSize) || options.maxSize <= 0) {
|
|
13
|
+
throw new TypeError("maxSize must be a positive integer");
|
|
14
|
+
}
|
|
15
|
+
this.maxSize = options.maxSize;
|
|
16
|
+
this.sizeCalculation = options.sizeCalculation;
|
|
17
|
+
}
|
|
18
|
+
get size() {
|
|
19
|
+
return this.entries.size;
|
|
20
|
+
}
|
|
21
|
+
get calculatedSize() {
|
|
22
|
+
return this.currentSize;
|
|
23
|
+
}
|
|
24
|
+
get(key) {
|
|
25
|
+
const entry = this.entries.get(key);
|
|
26
|
+
if (!entry) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
this.refresh(key, entry);
|
|
30
|
+
return entry.value;
|
|
31
|
+
}
|
|
32
|
+
has(key) {
|
|
33
|
+
const entry = this.entries.get(key);
|
|
34
|
+
if (!entry) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
this.refresh(key, entry);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
set(key, value, options = {}) {
|
|
41
|
+
var _a;
|
|
42
|
+
const entrySize = options.size ?? ((_a = this.sizeCalculation) == null ? void 0 : _a.call(this, value, key)) ?? 1;
|
|
43
|
+
if (!Number.isInteger(entrySize) || entrySize <= 0) {
|
|
44
|
+
throw new TypeError("entry size must be a positive integer");
|
|
45
|
+
}
|
|
46
|
+
this.delete(key);
|
|
47
|
+
if (entrySize > this.maxSize) {
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
this.entries.set(key, { value, size: entrySize });
|
|
51
|
+
this.currentSize += entrySize;
|
|
52
|
+
this.evictUntilWithinLimit();
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
delete(key) {
|
|
56
|
+
const entry = this.entries.get(key);
|
|
57
|
+
if (!entry) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
this.currentSize -= entry.size;
|
|
61
|
+
return this.entries.delete(key);
|
|
62
|
+
}
|
|
63
|
+
clear() {
|
|
64
|
+
this.entries.clear();
|
|
65
|
+
this.currentSize = 0;
|
|
66
|
+
}
|
|
67
|
+
refresh(key, entry) {
|
|
68
|
+
this.entries.delete(key);
|
|
69
|
+
this.entries.set(key, entry);
|
|
70
|
+
}
|
|
71
|
+
evictUntilWithinLimit() {
|
|
72
|
+
while (this.currentSize > this.maxSize) {
|
|
73
|
+
const oldest = this.entries.keys().next();
|
|
74
|
+
if (oldest.done) {
|
|
75
|
+
this.currentSize = 0;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.delete(oldest.value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.SizeLimitedCache = SizeLimitedCache;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared/size-limited-cache';
|
|
@@ -0,0 +1,82 @@
|
|
|
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);
|
|
4
|
+
class SizeLimitedCache {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
__publicField(this, "maxSize");
|
|
7
|
+
__publicField(this, "entries", /* @__PURE__ */ new Map());
|
|
8
|
+
__publicField(this, "sizeCalculation");
|
|
9
|
+
__publicField(this, "currentSize", 0);
|
|
10
|
+
if (!Number.isInteger(options.maxSize) || options.maxSize <= 0) {
|
|
11
|
+
throw new TypeError("maxSize must be a positive integer");
|
|
12
|
+
}
|
|
13
|
+
this.maxSize = options.maxSize;
|
|
14
|
+
this.sizeCalculation = options.sizeCalculation;
|
|
15
|
+
}
|
|
16
|
+
get size() {
|
|
17
|
+
return this.entries.size;
|
|
18
|
+
}
|
|
19
|
+
get calculatedSize() {
|
|
20
|
+
return this.currentSize;
|
|
21
|
+
}
|
|
22
|
+
get(key) {
|
|
23
|
+
const entry = this.entries.get(key);
|
|
24
|
+
if (!entry) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
this.refresh(key, entry);
|
|
28
|
+
return entry.value;
|
|
29
|
+
}
|
|
30
|
+
has(key) {
|
|
31
|
+
const entry = this.entries.get(key);
|
|
32
|
+
if (!entry) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
this.refresh(key, entry);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
set(key, value, options = {}) {
|
|
39
|
+
var _a;
|
|
40
|
+
const entrySize = options.size ?? ((_a = this.sizeCalculation) == null ? void 0 : _a.call(this, value, key)) ?? 1;
|
|
41
|
+
if (!Number.isInteger(entrySize) || entrySize <= 0) {
|
|
42
|
+
throw new TypeError("entry size must be a positive integer");
|
|
43
|
+
}
|
|
44
|
+
this.delete(key);
|
|
45
|
+
if (entrySize > this.maxSize) {
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
this.entries.set(key, { value, size: entrySize });
|
|
49
|
+
this.currentSize += entrySize;
|
|
50
|
+
this.evictUntilWithinLimit();
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
delete(key) {
|
|
54
|
+
const entry = this.entries.get(key);
|
|
55
|
+
if (!entry) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
this.currentSize -= entry.size;
|
|
59
|
+
return this.entries.delete(key);
|
|
60
|
+
}
|
|
61
|
+
clear() {
|
|
62
|
+
this.entries.clear();
|
|
63
|
+
this.currentSize = 0;
|
|
64
|
+
}
|
|
65
|
+
refresh(key, entry) {
|
|
66
|
+
this.entries.delete(key);
|
|
67
|
+
this.entries.set(key, entry);
|
|
68
|
+
}
|
|
69
|
+
evictUntilWithinLimit() {
|
|
70
|
+
while (this.currentSize > this.maxSize) {
|
|
71
|
+
const oldest = this.entries.keys().next();
|
|
72
|
+
if (oldest.done) {
|
|
73
|
+
this.currentSize = 0;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.delete(oldest.value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
SizeLimitedCache
|
|
82
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type ErrorFallbackProps = {
|
|
3
|
+
error: unknown;
|
|
4
|
+
resetErrorBoundary: (...args: unknown[]) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Options for creating a React root
|
|
8
|
+
*/
|
|
9
|
+
export interface CreateRootOptions {
|
|
10
|
+
identifierPrefix?: string;
|
|
11
|
+
onRecoverableError?: (error: unknown) => void;
|
|
12
|
+
transitionCallbacks?: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface for a React root object
|
|
16
|
+
*/
|
|
17
|
+
export interface Root {
|
|
18
|
+
render(children: React.ReactNode): void;
|
|
19
|
+
unmount(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type for a root element, which can be either an HTMLElement or a React root
|
|
23
|
+
*/
|
|
24
|
+
export type RootType = HTMLElement | Root;
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for the render function
|
|
27
|
+
*/
|
|
28
|
+
export interface RenderParams {
|
|
29
|
+
moduleName?: string;
|
|
30
|
+
basename?: string;
|
|
31
|
+
memoryRoute?: {
|
|
32
|
+
entryPath: string;
|
|
33
|
+
initialState?: Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
dom: HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* Options to pass to createRoot for React 18 and 19
|
|
38
|
+
* @example
|
|
39
|
+
* {
|
|
40
|
+
* identifierPrefix: 'app-',
|
|
41
|
+
* onRecoverableError: (err) => console.error(err)
|
|
42
|
+
* }
|
|
43
|
+
*/
|
|
44
|
+
rootOptions?: CreateRootOptions;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for the destroy function
|
|
49
|
+
*/
|
|
50
|
+
export interface DestroyParams {
|
|
51
|
+
moduleName: string;
|
|
52
|
+
dom: HTMLElement;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parameters for the provider function
|
|
56
|
+
*/
|
|
57
|
+
export interface ProviderParams {
|
|
58
|
+
moduleName?: string;
|
|
59
|
+
basename?: string;
|
|
60
|
+
memoryRoute?: {
|
|
61
|
+
entryPath: string;
|
|
62
|
+
initialState?: Record<string, unknown>;
|
|
63
|
+
};
|
|
64
|
+
style?: React.CSSProperties;
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parameters for the render function, extending ProviderParams
|
|
69
|
+
*/
|
|
70
|
+
export interface RenderFnParams extends ProviderParams {
|
|
71
|
+
dom: HTMLElement;
|
|
72
|
+
fallback?: React.ComponentType<{
|
|
73
|
+
error: Error;
|
|
74
|
+
}>;
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parameters for the provider function
|
|
79
|
+
*/
|
|
80
|
+
export interface ProviderFnParams<T> {
|
|
81
|
+
rootComponent: React.ComponentType<T>;
|
|
82
|
+
render?: (App: React.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
|
|
83
|
+
createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions) => Root;
|
|
84
|
+
/**
|
|
85
|
+
* Default options to pass to createRoot for React 18 and 19
|
|
86
|
+
* These options will be used when creating a root unless overridden by rootOptions in render params
|
|
87
|
+
* @example
|
|
88
|
+
* {
|
|
89
|
+
* identifierPrefix: 'app-',
|
|
90
|
+
* onRecoverableError: (err) => console.error(err)
|
|
91
|
+
* }
|
|
92
|
+
*/
|
|
93
|
+
defaultRootOptions?: CreateRootOptions;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parameters for the remote component
|
|
97
|
+
*/
|
|
98
|
+
export interface RemoteComponentProps<T = Record<string, unknown>> {
|
|
99
|
+
props?: T;
|
|
100
|
+
fallback?: React.ComponentType<{
|
|
101
|
+
error: Error;
|
|
102
|
+
}>;
|
|
103
|
+
loading?: React.ReactNode;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parameters for the remote component loader
|
|
108
|
+
*/
|
|
109
|
+
export interface RemoteComponentParams<T = Record<string, unknown>, E extends keyof T = keyof T> {
|
|
110
|
+
loader: () => Promise<T>;
|
|
111
|
+
loading: React.ReactNode;
|
|
112
|
+
fallback: React.ComponentType<{
|
|
113
|
+
error: Error;
|
|
114
|
+
}>;
|
|
115
|
+
export?: E;
|
|
116
|
+
props?: T;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Interface for a remote module provider
|
|
120
|
+
*/
|
|
121
|
+
export interface RemoteModule {
|
|
122
|
+
provider: () => {
|
|
123
|
+
render: (info: RenderFnParams) => void;
|
|
124
|
+
destroy: (info: {
|
|
125
|
+
dom: any;
|
|
126
|
+
}) => void;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Parameters for a remote app component
|
|
131
|
+
*/
|
|
132
|
+
export interface RemoteAppParams extends ProviderParams {
|
|
133
|
+
moduleName: string;
|
|
134
|
+
providerInfo: NonNullable<RemoteModule['provider']>;
|
|
135
|
+
exportName: string | number | symbol;
|
|
136
|
+
fallback: React.ComponentType<ErrorFallbackProps>;
|
|
137
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const LoggerInstance: import("@module-federation/sdk").Logger;
|
|
2
|
+
export declare function pathJoin(...args: string[]): string;
|
|
3
|
+
export declare const getModuleName: (id: string) => string;
|
|
4
|
+
export declare const getRootDomDefaultClassName: (moduleName: string) => string;
|