@module-federation/bridge-react 0.0.0-next-20250410121036 → 0.0.0-next-20250411200445

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/dist/index.cjs.js +136 -64
  3. package/dist/index.d.ts +1 -24
  4. package/dist/index.es.js +139 -67
  5. package/dist/router-v5.cjs.js +1 -1
  6. package/dist/router-v5.es.js +1 -1
  7. package/dist/router-v6.cjs.js +1 -1
  8. package/dist/router-v6.es.js +1 -1
  9. package/dist/router.cjs.js +1 -1
  10. package/dist/router.es.js +1 -1
  11. package/package.json +4 -19
  12. package/src/index.ts +0 -6
  13. package/src/provider/compat.ts +60 -0
  14. package/src/provider/create.tsx +20 -73
  15. package/src/remote/create.tsx +2 -4
  16. package/src/types.ts +0 -19
  17. package/src/utils/index.ts +20 -0
  18. package/vite.config.ts +0 -54
  19. package/dist/internal/bridge-base-CW88-1Be.es.js +0 -103
  20. package/dist/internal/bridge-base-DBiwuddQ.cjs.js +0 -119
  21. package/dist/internal/react-error-boundary.esm-CMdlkNPP.es.js +0 -99
  22. package/dist/internal/react-error-boundary.esm-D8nxmvmv.cjs.js +0 -98
  23. package/dist/legacy.cjs.js +0 -4
  24. package/dist/legacy.d.ts +0 -104
  25. package/dist/legacy.es.js +0 -4
  26. package/dist/v16.cjs.js +0 -22
  27. package/dist/v16.d.ts +0 -104
  28. package/dist/v16.es.js +0 -22
  29. package/dist/v18.cjs.js +0 -15
  30. package/dist/v18.d.ts +0 -105
  31. package/dist/v18.es.js +0 -15
  32. package/dist/v19.cjs.js +0 -15
  33. package/dist/v19.d.ts +0 -106
  34. package/dist/v19.es.js +0 -15
  35. package/src/legacy.ts +0 -13
  36. package/src/provider/versions/bridge-base.tsx +0 -122
  37. package/src/provider/versions/legacy.ts +0 -42
  38. package/src/provider/versions/v18.ts +0 -47
  39. package/src/provider/versions/v19.ts +0 -48
  40. package/src/v18.ts +0 -9
  41. package/src/v19.ts +0 -9
  42. /package/dist/{internal/context.cjs.js → context-C79iMWYD.cjs} +0 -0
  43. /package/dist/{internal/context.es.js → context-Dbqf0szX.js} +0 -0
@@ -1,119 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const reactErrorBoundary_esm = require("./react-error-boundary.esm-D8nxmvmv.cjs.js");
4
- const context = require("./context.cjs.js");
5
- const plugin = require("../plugin.cjs.js");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
23
- function createBaseBridgeComponent({
24
- createRoot,
25
- defaultRootOptions,
26
- ...bridgeInfo
27
- }) {
28
- return () => {
29
- const rootMap = /* @__PURE__ */ new Map();
30
- const instance = plugin.federationRuntime.instance;
31
- context.LoggerInstance.debug(
32
- `createBridgeComponent instance from props >>>`,
33
- instance
34
- );
35
- const RawComponent = (info) => {
36
- const { appInfo, propsInfo, ...restProps } = info;
37
- const { moduleName, memoryRoute, basename = "/" } = appInfo;
38
- return /* @__PURE__ */ React__namespace.createElement(context.RouterContext.Provider, { value: { moduleName, basename, memoryRoute } }, /* @__PURE__ */ React__namespace.createElement(
39
- bridgeInfo.rootComponent,
40
- {
41
- ...propsInfo,
42
- basename,
43
- ...restProps
44
- }
45
- ));
46
- };
47
- return {
48
- async render(info) {
49
- var _a, _b, _c, _d, _e, _f;
50
- context.LoggerInstance.debug(`createBridgeComponent render Info`, info);
51
- const {
52
- moduleName,
53
- dom,
54
- basename,
55
- memoryRoute,
56
- fallback,
57
- rootOptions,
58
- ...propsInfo
59
- } = info;
60
- const mergedRootOptions = {
61
- ...defaultRootOptions,
62
- ...rootOptions
63
- };
64
- const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(info)) || {};
65
- const rootComponentWithErrorBoundary = /* @__PURE__ */ React__namespace.createElement(
66
- reactErrorBoundary_esm.ErrorBoundary,
67
- {
68
- FallbackComponent: fallback
69
- },
70
- /* @__PURE__ */ React__namespace.createElement(
71
- RawComponent,
72
- {
73
- appInfo: {
74
- moduleName,
75
- basename,
76
- memoryRoute
77
- },
78
- propsInfo: {
79
- ...propsInfo,
80
- ...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
81
- }
82
- }
83
- )
84
- );
85
- if (bridgeInfo.render) {
86
- await Promise.resolve(
87
- bridgeInfo.render(rootComponentWithErrorBoundary, dom)
88
- ).then((root) => rootMap.set(dom, root));
89
- } else {
90
- let root = rootMap.get(dom);
91
- if (!root && createRoot) {
92
- root = createRoot(dom, mergedRootOptions);
93
- rootMap.set(dom, root);
94
- }
95
- if (root && "render" in root) {
96
- root.render(rootComponentWithErrorBoundary);
97
- }
98
- }
99
- ((_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(info)) || {};
100
- },
101
- destroy(info) {
102
- var _a, _b, _c;
103
- const { dom } = info;
104
- context.LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
105
- const root = rootMap.get(dom);
106
- if (root) {
107
- if ("unmount" in root) {
108
- root.unmount();
109
- } else {
110
- console.warn("Root does not have unmount method");
111
- }
112
- rootMap.delete(dom);
113
- }
114
- (_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.afterBridgeDestroy) == null ? void 0 : _c.emit(info);
115
- }
116
- };
117
- };
118
- }
119
- exports.createBaseBridgeComponent = createBaseBridgeComponent;
@@ -1,99 +0,0 @@
1
- import { createContext, Component, createElement } from "react";
2
- const ErrorBoundaryContext = createContext(null);
3
- const initialState = {
4
- didCatch: false,
5
- error: null
6
- };
7
- class ErrorBoundary extends Component {
8
- constructor(props) {
9
- super(props);
10
- this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
11
- this.state = initialState;
12
- }
13
- static getDerivedStateFromError(error) {
14
- return {
15
- didCatch: true,
16
- error
17
- };
18
- }
19
- resetErrorBoundary() {
20
- const {
21
- error
22
- } = this.state;
23
- if (error !== null) {
24
- var _this$props$onReset, _this$props;
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
- (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {
29
- args,
30
- reason: "imperative-api"
31
- });
32
- this.setState(initialState);
33
- }
34
- }
35
- componentDidCatch(error, info) {
36
- var _this$props$onError, _this$props2;
37
- (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
38
- }
39
- componentDidUpdate(prevProps, prevState) {
40
- const {
41
- didCatch
42
- } = this.state;
43
- const {
44
- resetKeys
45
- } = this.props;
46
- if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
47
- var _this$props$onReset2, _this$props3;
48
- (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
49
- next: resetKeys,
50
- prev: prevProps.resetKeys,
51
- reason: "keys"
52
- });
53
- this.setState(initialState);
54
- }
55
- }
56
- render() {
57
- const {
58
- children,
59
- fallbackRender,
60
- FallbackComponent,
61
- fallback
62
- } = this.props;
63
- const {
64
- didCatch,
65
- error
66
- } = this.state;
67
- let childToRender = children;
68
- if (didCatch) {
69
- const props = {
70
- error,
71
- resetErrorBoundary: this.resetErrorBoundary
72
- };
73
- if (typeof fallbackRender === "function") {
74
- childToRender = fallbackRender(props);
75
- } else if (FallbackComponent) {
76
- childToRender = createElement(FallbackComponent, props);
77
- } else if (fallback !== void 0) {
78
- childToRender = fallback;
79
- } else {
80
- throw error;
81
- }
82
- }
83
- return createElement(ErrorBoundaryContext.Provider, {
84
- value: {
85
- didCatch,
86
- error,
87
- resetErrorBoundary: this.resetErrorBoundary
88
- }
89
- }, childToRender);
90
- }
91
- }
92
- function hasArrayChanged() {
93
- let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
94
- let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
95
- return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
96
- }
97
- export {
98
- ErrorBoundary as E
99
- };
@@ -1,98 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const ErrorBoundaryContext = React.createContext(null);
4
- const initialState = {
5
- didCatch: false,
6
- error: null
7
- };
8
- class ErrorBoundary extends React.Component {
9
- constructor(props) {
10
- super(props);
11
- this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
12
- this.state = initialState;
13
- }
14
- static getDerivedStateFromError(error) {
15
- return {
16
- didCatch: true,
17
- error
18
- };
19
- }
20
- resetErrorBoundary() {
21
- const {
22
- error
23
- } = this.state;
24
- if (error !== null) {
25
- var _this$props$onReset, _this$props;
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
29
- (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {
30
- args,
31
- reason: "imperative-api"
32
- });
33
- this.setState(initialState);
34
- }
35
- }
36
- componentDidCatch(error, info) {
37
- var _this$props$onError, _this$props2;
38
- (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
39
- }
40
- componentDidUpdate(prevProps, prevState) {
41
- const {
42
- didCatch
43
- } = this.state;
44
- const {
45
- resetKeys
46
- } = this.props;
47
- if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
48
- var _this$props$onReset2, _this$props3;
49
- (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
50
- next: resetKeys,
51
- prev: prevProps.resetKeys,
52
- reason: "keys"
53
- });
54
- this.setState(initialState);
55
- }
56
- }
57
- render() {
58
- const {
59
- children,
60
- fallbackRender,
61
- FallbackComponent,
62
- fallback
63
- } = this.props;
64
- const {
65
- didCatch,
66
- error
67
- } = this.state;
68
- let childToRender = children;
69
- if (didCatch) {
70
- const props = {
71
- error,
72
- resetErrorBoundary: this.resetErrorBoundary
73
- };
74
- if (typeof fallbackRender === "function") {
75
- childToRender = fallbackRender(props);
76
- } else if (FallbackComponent) {
77
- childToRender = React.createElement(FallbackComponent, props);
78
- } else if (fallback !== void 0) {
79
- childToRender = fallback;
80
- } else {
81
- throw error;
82
- }
83
- }
84
- return React.createElement(ErrorBoundaryContext.Provider, {
85
- value: {
86
- didCatch,
87
- error,
88
- resetErrorBoundary: this.resetErrorBoundary
89
- }
90
- }, childToRender);
91
- }
92
- }
93
- function hasArrayChanged() {
94
- let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
95
- let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
96
- return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
97
- }
98
- exports.ErrorBoundary = ErrorBoundary;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const v16 = require("./v16.cjs.js");
4
- exports.createBridgeComponent = v16.createBridgeComponent;
package/dist/legacy.d.ts DELETED
@@ -1,104 +0,0 @@
1
- import * as React_2 from 'react';
2
-
3
- export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
4
- render(info: RenderParams): Promise<void>;
5
- destroy(info: DestroyParams): void;
6
- };
7
-
8
- export declare interface CreateRootOptions {
9
- identifierPrefix?: string;
10
- onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
11
- }
12
-
13
- /**
14
- * Options for creating a React root
15
- */
16
- declare interface CreateRootOptions_2 {
17
- identifierPrefix?: string;
18
- onRecoverableError?: (error: unknown) => void;
19
- transitionCallbacks?: unknown;
20
- }
21
-
22
- /**
23
- * Parameters for the destroy function
24
- */
25
- export declare interface DestroyParams {
26
- moduleName: string;
27
- dom: HTMLElement;
28
- }
29
-
30
- /**
31
- * Parameters for the provider function
32
- */
33
- export declare interface ProviderFnParams<T> {
34
- rootComponent: React_2.ComponentType<T>;
35
- render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
36
- createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions_2) => Root_2;
37
- /**
38
- * Default options to pass to createRoot for React 18 and 19
39
- * These options will be used when creating a root unless overridden by rootOptions in render params
40
- * @example
41
- * {
42
- * identifierPrefix: 'app-',
43
- * onRecoverableError: (err) => console.error(err)
44
- * }
45
- */
46
- defaultRootOptions?: CreateRootOptions_2;
47
- }
48
-
49
- /**
50
- * Parameters for the provider function
51
- */
52
- export declare interface ProviderParams {
53
- moduleName?: string;
54
- basename?: string;
55
- memoryRoute?: {
56
- entryPath: string;
57
- initialState?: Record<string, unknown>;
58
- };
59
- style?: React_2.CSSProperties;
60
- className?: string;
61
- }
62
-
63
- /**
64
- * Parameters for the render function
65
- */
66
- export declare interface RenderParams {
67
- moduleName?: string;
68
- basename?: string;
69
- memoryRoute?: {
70
- entryPath: string;
71
- initialState?: Record<string, unknown>;
72
- };
73
- dom: HTMLElement;
74
- /**
75
- * Options to pass to createRoot for React 18 and 19
76
- * @example
77
- * {
78
- * identifierPrefix: 'app-',
79
- * onRecoverableError: (err) => console.error(err)
80
- * }
81
- */
82
- rootOptions?: CreateRootOptions_2;
83
- [key: string]: unknown;
84
- }
85
-
86
- export declare interface Root {
87
- render(children: React.ReactNode): void;
88
- unmount(): void;
89
- }
90
-
91
- /**
92
- * Interface for a React root object
93
- */
94
- declare interface Root_2 {
95
- render(children: React_2.ReactNode): void;
96
- unmount(): void;
97
- }
98
-
99
- /**
100
- * Type for a root element, which can be either an HTMLElement or a React root
101
- */
102
- export declare type RootType = HTMLElement | Root_2;
103
-
104
- export { }
package/dist/legacy.es.js DELETED
@@ -1,4 +0,0 @@
1
- import { createBridgeComponent } from "./v16.es.js";
2
- export {
3
- createBridgeComponent
4
- };
package/dist/v16.cjs.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const bridgeBase = require("./internal/bridge-base-DBiwuddQ.cjs.js");
4
- const ReactDOM = require("react-dom");
5
- function createReact16Or17Root(container) {
6
- return {
7
- render(children) {
8
- ReactDOM.render(children, container);
9
- },
10
- unmount() {
11
- ReactDOM.unmountComponentAtNode(container);
12
- }
13
- };
14
- }
15
- function createBridgeComponent(bridgeInfo) {
16
- const fullBridgeInfo = {
17
- ...bridgeInfo,
18
- createRoot: createReact16Or17Root
19
- };
20
- return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
21
- }
22
- exports.createBridgeComponent = createBridgeComponent;
package/dist/v16.d.ts DELETED
@@ -1,104 +0,0 @@
1
- import * as React_2 from 'react';
2
-
3
- export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
4
- render(info: RenderParams): Promise<void>;
5
- destroy(info: DestroyParams): void;
6
- };
7
-
8
- export declare interface CreateRootOptions {
9
- identifierPrefix?: string;
10
- onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
11
- }
12
-
13
- /**
14
- * Options for creating a React root
15
- */
16
- declare interface CreateRootOptions_2 {
17
- identifierPrefix?: string;
18
- onRecoverableError?: (error: unknown) => void;
19
- transitionCallbacks?: unknown;
20
- }
21
-
22
- /**
23
- * Parameters for the destroy function
24
- */
25
- export declare interface DestroyParams {
26
- moduleName: string;
27
- dom: HTMLElement;
28
- }
29
-
30
- /**
31
- * Parameters for the provider function
32
- */
33
- export declare interface ProviderFnParams<T> {
34
- rootComponent: React_2.ComponentType<T>;
35
- render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
36
- createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions_2) => Root_2;
37
- /**
38
- * Default options to pass to createRoot for React 18 and 19
39
- * These options will be used when creating a root unless overridden by rootOptions in render params
40
- * @example
41
- * {
42
- * identifierPrefix: 'app-',
43
- * onRecoverableError: (err) => console.error(err)
44
- * }
45
- */
46
- defaultRootOptions?: CreateRootOptions_2;
47
- }
48
-
49
- /**
50
- * Parameters for the provider function
51
- */
52
- export declare interface ProviderParams {
53
- moduleName?: string;
54
- basename?: string;
55
- memoryRoute?: {
56
- entryPath: string;
57
- initialState?: Record<string, unknown>;
58
- };
59
- style?: React_2.CSSProperties;
60
- className?: string;
61
- }
62
-
63
- /**
64
- * Parameters for the render function
65
- */
66
- export declare interface RenderParams {
67
- moduleName?: string;
68
- basename?: string;
69
- memoryRoute?: {
70
- entryPath: string;
71
- initialState?: Record<string, unknown>;
72
- };
73
- dom: HTMLElement;
74
- /**
75
- * Options to pass to createRoot for React 18 and 19
76
- * @example
77
- * {
78
- * identifierPrefix: 'app-',
79
- * onRecoverableError: (err) => console.error(err)
80
- * }
81
- */
82
- rootOptions?: CreateRootOptions_2;
83
- [key: string]: unknown;
84
- }
85
-
86
- export declare interface Root {
87
- render(children: React.ReactNode): void;
88
- unmount(): void;
89
- }
90
-
91
- /**
92
- * Interface for a React root object
93
- */
94
- declare interface Root_2 {
95
- render(children: React_2.ReactNode): void;
96
- unmount(): void;
97
- }
98
-
99
- /**
100
- * Type for a root element, which can be either an HTMLElement or a React root
101
- */
102
- export declare type RootType = HTMLElement | Root_2;
103
-
104
- export { }
package/dist/v16.es.js DELETED
@@ -1,22 +0,0 @@
1
- import { c as createBaseBridgeComponent } from "./internal/bridge-base-CW88-1Be.es.js";
2
- import ReactDOM from "react-dom";
3
- function createReact16Or17Root(container) {
4
- return {
5
- render(children) {
6
- ReactDOM.render(children, container);
7
- },
8
- unmount() {
9
- ReactDOM.unmountComponentAtNode(container);
10
- }
11
- };
12
- }
13
- function createBridgeComponent(bridgeInfo) {
14
- const fullBridgeInfo = {
15
- ...bridgeInfo,
16
- createRoot: createReact16Or17Root
17
- };
18
- return createBaseBridgeComponent(fullBridgeInfo);
19
- }
20
- export {
21
- createBridgeComponent
22
- };
package/dist/v18.cjs.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const client = require("react-dom/client");
4
- const bridgeBase = require("./internal/bridge-base-DBiwuddQ.cjs.js");
5
- function createReact18Root(container, options) {
6
- return client.createRoot(container, options);
7
- }
8
- function createBridgeComponent(bridgeInfo) {
9
- const fullBridgeInfo = {
10
- ...bridgeInfo,
11
- createRoot: createReact18Root
12
- };
13
- return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
14
- }
15
- exports.createBridgeComponent = createBridgeComponent;
package/dist/v18.d.ts DELETED
@@ -1,105 +0,0 @@
1
- import { default as default_2 } from 'react';
2
- import * as React_2 from 'react';
3
-
4
- export declare function createBridgeComponent<T = any>(bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>): () => {
5
- render(info: RenderParams): Promise<void>;
6
- destroy(info: DestroyParams): void;
7
- };
8
-
9
- export declare interface CreateRootOptions {
10
- identifierPrefix?: string;
11
- onRecoverableError?: (error: unknown, errorInfo: unknown) => void;
12
- }
13
-
14
- /**
15
- * Options for creating a React root
16
- */
17
- declare interface CreateRootOptions_2 {
18
- identifierPrefix?: string;
19
- onRecoverableError?: (error: unknown) => void;
20
- transitionCallbacks?: unknown;
21
- }
22
-
23
- /**
24
- * Parameters for the destroy function
25
- */
26
- export declare interface DestroyParams {
27
- moduleName: string;
28
- dom: HTMLElement;
29
- }
30
-
31
- /**
32
- * Parameters for the provider function
33
- */
34
- export declare interface ProviderFnParams<T> {
35
- rootComponent: React_2.ComponentType<T>;
36
- render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
37
- createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions_2) => Root_2;
38
- /**
39
- * Default options to pass to createRoot for React 18 and 19
40
- * These options will be used when creating a root unless overridden by rootOptions in render params
41
- * @example
42
- * {
43
- * identifierPrefix: 'app-',
44
- * onRecoverableError: (err) => console.error(err)
45
- * }
46
- */
47
- defaultRootOptions?: CreateRootOptions_2;
48
- }
49
-
50
- /**
51
- * Parameters for the provider function
52
- */
53
- export declare interface ProviderParams {
54
- moduleName?: string;
55
- basename?: string;
56
- memoryRoute?: {
57
- entryPath: string;
58
- initialState?: Record<string, unknown>;
59
- };
60
- style?: React_2.CSSProperties;
61
- className?: string;
62
- }
63
-
64
- /**
65
- * Parameters for the render function
66
- */
67
- export declare interface RenderParams {
68
- moduleName?: string;
69
- basename?: string;
70
- memoryRoute?: {
71
- entryPath: string;
72
- initialState?: Record<string, unknown>;
73
- };
74
- dom: HTMLElement;
75
- /**
76
- * Options to pass to createRoot for React 18 and 19
77
- * @example
78
- * {
79
- * identifierPrefix: 'app-',
80
- * onRecoverableError: (err) => console.error(err)
81
- * }
82
- */
83
- rootOptions?: CreateRootOptions_2;
84
- [key: string]: unknown;
85
- }
86
-
87
- export declare interface Root {
88
- render(children: default_2.ReactNode): void;
89
- unmount(): void;
90
- }
91
-
92
- /**
93
- * Interface for a React root object
94
- */
95
- declare interface Root_2 {
96
- render(children: React_2.ReactNode): void;
97
- unmount(): void;
98
- }
99
-
100
- /**
101
- * Type for a root element, which can be either an HTMLElement or a React root
102
- */
103
- export declare type RootType = HTMLElement | Root_2;
104
-
105
- export { }