@module-federation/bridge-react 0.0.0-next-20250416061914 → 0.0.0-next-20250421062338

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/index.es.js CHANGED
@@ -1,10 +1,39 @@
1
- import * as React from "react";
1
+ import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-0CS6p-6-.js";
2
+ import ReactDOM from "react-dom";
2
3
  import React__default, { forwardRef, useRef, useState, useEffect, useContext } from "react";
3
- import { E as ErrorBoundary } from "./react-error-boundary.esm-CMdlkNPP.js";
4
- import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin, R as RouterContext } from "./context-Dbqf0szX.js";
4
+ import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin } from "./index-BlBMQSoq.js";
5
5
  import * as ReactRouterDOM from "react-router-dom";
6
6
  import { federationRuntime } from "./plugin.es.js";
7
- import ReactDOM from "react-dom";
7
+ function createReact16Or17Root(container) {
8
+ return {
9
+ render(children) {
10
+ const reactVersion = ReactDOM.version || "";
11
+ const isReact18 = reactVersion.startsWith("18");
12
+ const isReact19 = reactVersion.startsWith("19");
13
+ if (isReact19) {
14
+ throw new Error(
15
+ `React 19 detected in legacy mode. This is not supported. Please use the version-specific import: import { createBridgeComponent } from '@module-federation/bridge-react/v19'`
16
+ );
17
+ }
18
+ if (isReact18) {
19
+ console.warn(
20
+ `[Bridge-React] React 18 detected in legacy mode. For better compatibility, please use the version-specific import: import { createBridgeComponent } from '@module-federation/bridge-react/v18'`
21
+ );
22
+ }
23
+ ReactDOM.render(children, container);
24
+ },
25
+ unmount() {
26
+ ReactDOM.unmountComponentAtNode(container);
27
+ }
28
+ };
29
+ }
30
+ function createBridgeComponent(bridgeInfo) {
31
+ const fullBridgeInfo = {
32
+ createRoot: createReact16Or17Root,
33
+ ...bridgeInfo
34
+ };
35
+ return createBaseBridgeComponent(fullBridgeInfo);
36
+ }
8
37
  function e() {
9
38
  const t = new PopStateEvent("popstate", { state: window.history.state });
10
39
  window.dispatchEvent(t);
@@ -213,118 +242,6 @@ function createRemoteComponent(info) {
213
242
  );
214
243
  });
215
244
  }
216
- function defaultCreateRoot(container, options) {
217
- const reactVersion = ReactDOM.version || "";
218
- const isReact18 = reactVersion.startsWith("18");
219
- if (isReact18) {
220
- try {
221
- return ReactDOM.createRoot(container, options);
222
- } catch (e2) {
223
- console.warn(
224
- "Failed to use React 18 createRoot API, falling back to legacy API",
225
- e2
226
- );
227
- }
228
- }
229
- return {
230
- render(children) {
231
- ReactDOM.render(children, container);
232
- },
233
- unmount() {
234
- ReactDOM.unmountComponentAtNode(container);
235
- }
236
- };
237
- }
238
- function createBridgeComponent({
239
- createRoot = defaultCreateRoot,
240
- defaultRootOptions,
241
- ...bridgeInfo
242
- }) {
243
- return () => {
244
- const rootMap = /* @__PURE__ */ new Map();
245
- const instance = federationRuntime.instance;
246
- LoggerInstance.debug(
247
- `createBridgeComponent instance from props >>>`,
248
- instance
249
- );
250
- const RawComponent = (info) => {
251
- const { appInfo, propsInfo, ...restProps } = info;
252
- const { moduleName, memoryRoute, basename = "/" } = appInfo;
253
- return /* @__PURE__ */ React.createElement(RouterContext.Provider, { value: { moduleName, basename, memoryRoute } }, /* @__PURE__ */ React.createElement(
254
- bridgeInfo.rootComponent,
255
- {
256
- ...propsInfo,
257
- basename,
258
- ...restProps
259
- }
260
- ));
261
- };
262
- return {
263
- async render(info) {
264
- var _a, _b, _c, _d, _e, _f;
265
- LoggerInstance.debug(`createBridgeComponent render Info`, info);
266
- const {
267
- moduleName,
268
- dom,
269
- basename,
270
- memoryRoute,
271
- fallback,
272
- rootOptions,
273
- ...propsInfo
274
- } = info;
275
- const mergedRootOptions = {
276
- ...defaultRootOptions,
277
- ...rootOptions
278
- };
279
- 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)) || {};
280
- const rootComponentWithErrorBoundary = /* @__PURE__ */ React.createElement(
281
- ErrorBoundary,
282
- {
283
- FallbackComponent: fallback
284
- },
285
- /* @__PURE__ */ React.createElement(
286
- RawComponent,
287
- {
288
- appInfo: {
289
- moduleName,
290
- basename,
291
- memoryRoute
292
- },
293
- propsInfo: {
294
- ...propsInfo,
295
- ...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
296
- }
297
- }
298
- )
299
- );
300
- let root = rootMap.get(dom);
301
- if (!root) {
302
- root = createRoot(dom, mergedRootOptions);
303
- rootMap.set(dom, root);
304
- }
305
- if ("render" in root) {
306
- root.render(rootComponentWithErrorBoundary);
307
- }
308
- ((_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)) || {};
309
- },
310
- destroy(info) {
311
- var _a, _b, _c;
312
- const { dom } = info;
313
- LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
314
- const root = rootMap.get(dom);
315
- if (root) {
316
- if ("unmount" in root) {
317
- root.unmount();
318
- } else {
319
- ReactDOM.unmountComponentAtNode(dom);
320
- }
321
- rootMap.delete(dom);
322
- }
323
- (_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);
324
- }
325
- };
326
- };
327
- }
328
245
  export {
329
246
  createBridgeComponent,
330
247
  createRemoteComponent
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom$1 = require("react-router-dom/index.js");
5
- const context = require("./context-C79iMWYD.cjs");
5
+ const index = require("./index-BYDWxFmi.cjs");
6
6
  const ReactRouterDom = require("react-router-dom/index.js");
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -23,8 +23,8 @@ function _interopNamespaceDefault(e) {
23
23
  const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom$1);
24
24
  function WraperRouter(props) {
25
25
  const { basename, ...propsRes } = props;
26
- const routerContextProps = React.useContext(context.RouterContext) || {};
27
- context.LoggerInstance.debug(`WraperRouter info >>>`, {
26
+ const routerContextProps = React.useContext(index.RouterContext) || {};
27
+ index.LoggerInstance.debug(`WraperRouter info >>>`, {
28
28
  ...routerContextProps,
29
29
  routerContextProps,
30
30
  WraperRouterProps: props
@@ -1,6 +1,6 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom$1 from "react-router-dom/index.js";
3
- import { R as RouterContext, L as LoggerInstance } from "./context-Dbqf0szX.js";
3
+ import { R as RouterContext, L as LoggerInstance } from "./index-BlBMQSoq.js";
4
4
  export * from "react-router-dom/index.js";
5
5
  function WraperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom$1 = require("react-router-dom/dist/index.js");
5
- const context = require("./context-C79iMWYD.cjs");
5
+ const index = require("./index-BYDWxFmi.cjs");
6
6
  const ReactRouterDom = require("react-router-dom/dist/index.js");
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -23,8 +23,8 @@ function _interopNamespaceDefault(e) {
23
23
  const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom$1);
24
24
  function WraperRouter(props) {
25
25
  const { basename, ...propsRes } = props;
26
- const routerContextProps = React.useContext(context.RouterContext) || {};
27
- context.LoggerInstance.debug(`WraperRouter info >>>`, {
26
+ const routerContextProps = React.useContext(index.RouterContext) || {};
27
+ index.LoggerInstance.debug(`WraperRouter info >>>`, {
28
28
  ...routerContextProps,
29
29
  routerContextProps,
30
30
  WraperRouterProps: props
@@ -48,9 +48,9 @@ function WraperRouter(props) {
48
48
  }
49
49
  function WraperRouterProvider(props) {
50
50
  const { router, ...propsRes } = props;
51
- const routerContextProps = React.useContext(context.RouterContext) || {};
51
+ const routerContextProps = React.useContext(index.RouterContext) || {};
52
52
  const routers = router.routes;
53
- context.LoggerInstance.debug(`WraperRouterProvider info >>>`, {
53
+ index.LoggerInstance.debug(`WraperRouterProvider info >>>`, {
54
54
  ...routerContextProps,
55
55
  routerContextProps,
56
56
  WraperRouterProviderProps: props,
@@ -1,6 +1,6 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom$1 from "react-router-dom/dist/index.js";
3
- import { R as RouterContext, L as LoggerInstance } from "./context-Dbqf0szX.js";
3
+ import { R as RouterContext, L as LoggerInstance } from "./index-BlBMQSoq.js";
4
4
  export * from "react-router-dom/dist/index.js";
5
5
  function WraperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom = require("react-router-dom/");
5
- const context = require("./context-C79iMWYD.cjs");
5
+ const index = require("./index-BYDWxFmi.cjs");
6
6
  function _interopNamespaceDefault(e) {
7
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
8
  if (e) {
@@ -22,8 +22,8 @@ function _interopNamespaceDefault(e) {
22
22
  const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom);
23
23
  function WrapperRouter(props) {
24
24
  const { basename, ...propsRes } = props;
25
- const routerContextProps = React.useContext(context.RouterContext) || {};
26
- context.LoggerInstance.debug(`WrapperRouter info >>>`, {
25
+ const routerContextProps = React.useContext(index.RouterContext) || {};
26
+ index.LoggerInstance.debug(`WrapperRouter info >>>`, {
27
27
  ...routerContextProps,
28
28
  routerContextProps,
29
29
  WrapperRouterProps: props
@@ -47,9 +47,9 @@ function WrapperRouter(props) {
47
47
  }
48
48
  function WrapperRouterProvider(props) {
49
49
  const { router, ...propsRes } = props;
50
- const routerContextProps = React.useContext(context.RouterContext) || {};
50
+ const routerContextProps = React.useContext(index.RouterContext) || {};
51
51
  const routers = router.routes;
52
- context.LoggerInstance.debug(`WrapperRouterProvider info >>>`, {
52
+ index.LoggerInstance.debug(`WrapperRouterProvider info >>>`, {
53
53
  ...routerContextProps,
54
54
  routerContextProps,
55
55
  WrapperRouterProviderProps: props,
package/dist/router.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom from "react-router-dom/";
3
3
  export * from "react-router-dom/";
4
- import { R as RouterContext, L as LoggerInstance } from "./context-Dbqf0szX.js";
4
+ import { R as RouterContext, L as LoggerInstance } from "./index-BlBMQSoq.js";
5
5
  function WrapperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
7
7
  const routerContextProps = useContext(RouterContext) || {};
package/dist/v18.cjs.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const client = require("react-dom/client");
4
- const bridgeBase = require("./bridge-base-BQcdOEoU.cjs");
4
+ const bridgeBase = require("./bridge-base-DIOcSEVT.cjs");
5
5
  function createReact18Root(container, options) {
6
6
  return client.createRoot(container, options);
7
7
  }
8
8
  function createBridgeComponent(bridgeInfo) {
9
9
  const fullBridgeInfo = {
10
- ...bridgeInfo,
11
- createRoot: createReact18Root
10
+ createRoot: createReact18Root,
11
+ ...bridgeInfo
12
12
  };
13
13
  return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
14
14
  }
package/dist/v18.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-BbzPi965.js";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-0CS6p-6-.js";
3
3
  function createReact18Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
6
6
  function createBridgeComponent(bridgeInfo) {
7
7
  const fullBridgeInfo = {
8
- ...bridgeInfo,
9
- createRoot: createReact18Root
8
+ createRoot: createReact18Root,
9
+ ...bridgeInfo
10
10
  };
11
11
  return createBaseBridgeComponent(fullBridgeInfo);
12
12
  }
package/dist/v19.cjs.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const client = require("react-dom/client");
4
- const bridgeBase = require("./bridge-base-BQcdOEoU.cjs");
4
+ const bridgeBase = require("./bridge-base-DIOcSEVT.cjs");
5
5
  function createReact19Root(container, options) {
6
6
  return client.createRoot(container, options);
7
7
  }
8
8
  function createBridgeComponent(bridgeInfo) {
9
9
  const fullBridgeInfo = {
10
- ...bridgeInfo,
11
- createRoot: createReact19Root
10
+ createRoot: createReact19Root,
11
+ ...bridgeInfo
12
12
  };
13
13
  return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
14
14
  }
package/dist/v19.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-BbzPi965.js";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-0CS6p-6-.js";
3
3
  function createReact19Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
6
6
  function createBridgeComponent(bridgeInfo) {
7
7
  const fullBridgeInfo = {
8
- ...bridgeInfo,
9
- createRoot: createReact19Root
8
+ createRoot: createReact19Root,
9
+ ...bridgeInfo
10
10
  };
11
11
  return createBaseBridgeComponent(fullBridgeInfo);
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/bridge-react",
3
- "version": "0.0.0-next-20250416061914",
3
+ "version": "0.0.0-next-20250421062338",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,11 +21,6 @@
21
21
  "import": "./dist/index.es.js",
22
22
  "require": "./dist/index.cjs.js"
23
23
  },
24
- "./legacy": {
25
- "types": "./dist/legacy.d.ts",
26
- "import": "./dist/legacy.es.js",
27
- "require": "./dist/legacy.cjs.js"
28
- },
29
24
  "./v18": {
30
25
  "types": "./dist/v18.d.ts",
31
26
  "import": "./dist/v18.es.js",
@@ -60,8 +55,8 @@
60
55
  },
61
56
  "dependencies": {
62
57
  "react-error-boundary": "^4.1.2",
63
- "@module-federation/bridge-shared": "0.0.0-next-20250416061914",
64
- "@module-federation/sdk": "0.0.0-next-20250416061914"
58
+ "@module-federation/bridge-shared": "0.0.0-next-20250421062338",
59
+ "@module-federation/sdk": "0.0.0-next-20250421062338"
65
60
  },
66
61
  "peerDependencies": {
67
62
  "react": ">=16.9.0",
@@ -80,9 +75,9 @@
80
75
  "react-dom": "18.3.1",
81
76
  "react-router-dom": "6.22.3",
82
77
  "typescript": "^5.2.2",
83
- "vite": "^5.4.12",
78
+ "vite": "^5.4.18",
84
79
  "vite-plugin-dts": "^4.3.0",
85
- "@module-federation/runtime": "0.0.0-next-20250416061914"
80
+ "@module-federation/runtime": "0.0.0-next-20250421062338"
86
81
  },
87
82
  "scripts": {
88
83
  "dev": "vite",
package/src/index.ts CHANGED
@@ -1,8 +1,14 @@
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';
1
6
  export { createRemoteComponent } from './remote/create';
2
- export { createBridgeComponent } from './provider/create';
7
+ export type { CreateRootOptions, Root } from './provider/versions/legacy';
3
8
  export type {
4
9
  ProviderParams,
5
- RenderFnParams,
10
+ ProviderFnParams,
11
+ RootType,
6
12
  DestroyParams,
7
13
  RenderParams,
8
14
  } from './types';
@@ -16,11 +16,55 @@ export interface Root {
16
16
  unmount(): void;
17
17
  }
18
18
 
19
+ /**
20
+ * Default createRoot function that automatically detects React version and uses the appropriate API(only support React 16/17, 18)
21
+ *
22
+ * Note: Users can also directly import version-specific bridge components:
23
+ * - import { createBridgeComponent } from '@module-federation/bridge-react'
24
+ * - import { createBridgeComponent } from '@module-federation/bridge-react/v18'
25
+ * - import { createBridgeComponent } from '@module-federation/bridge-react/v19'
26
+ */
27
+
19
28
  export function createReact16Or17Root(
20
29
  container: Element | DocumentFragment,
21
30
  ): Root {
22
31
  return {
23
32
  render(children: React.ReactNode) {
33
+ /**
34
+ * Detect React version
35
+ */
36
+ const reactVersion = ReactDOM.version || '';
37
+ const isReact18 = reactVersion.startsWith('18');
38
+ const isReact19 = reactVersion.startsWith('19');
39
+
40
+ /**
41
+ * Throw error for React 19
42
+ *
43
+ * Note: Due to Module Federation sharing mechanism, the actual version detected here
44
+ * might be 18 or 19, even if the application itself uses React 16/17.
45
+ * This happens because in MF environments, different remote modules may share different React versions.
46
+ * The console may throw warnings about version and API mismatches. If you need to resolve these issues,
47
+ * consider disabling the shared configuration for React.
48
+ */
49
+ if (isReact19) {
50
+ throw new Error(
51
+ `React 19 detected in legacy mode. This is not supported. ` +
52
+ `Please use the version-specific import: ` +
53
+ `import { createBridgeComponent } from '@module-federation/bridge-react/v19'`,
54
+ );
55
+ }
56
+
57
+ /**
58
+ * Provide warning for React 18
59
+ */
60
+ if (isReact18) {
61
+ console.warn(
62
+ `[Bridge-React] React 18 detected in legacy mode. ` +
63
+ `For better compatibility, please use the version-specific import: ` +
64
+ `import { createBridgeComponent } from '@module-federation/bridge-react/v18'`,
65
+ );
66
+ }
67
+
24
68
  // @ts-ignore - React 17's render method is deprecated but still functional
25
69
  ReactDOM.render(children, container);
26
70
  },
@@ -34,8 +78,8 @@ export function createBridgeComponent<T = any>(
34
78
  bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>,
35
79
  ) {
36
80
  const fullBridgeInfo = {
37
- ...bridgeInfo,
38
81
  createRoot: createReact16Or17Root,
82
+ ...bridgeInfo,
39
83
  } as unknown as ProviderFnParams<T>;
40
84
 
41
85
  return createBaseBridgeComponent(fullBridgeInfo);
@@ -39,8 +39,8 @@ export function createBridgeComponent<T = any>(
39
39
  bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>,
40
40
  ) {
41
41
  const fullBridgeInfo = {
42
- ...bridgeInfo,
43
42
  createRoot: createReact18Root,
43
+ ...bridgeInfo,
44
44
  } as unknown as ProviderFnParams<T>;
45
45
 
46
46
  return createBaseBridgeComponent(fullBridgeInfo);
@@ -40,8 +40,8 @@ export function createBridgeComponent<T = any>(
40
40
  bridgeInfo: Omit<ProviderFnParams<T>, 'createRoot'>,
41
41
  ) {
42
42
  const fullBridgeInfo = {
43
- ...bridgeInfo,
44
43
  createRoot: createReact19Root,
44
+ ...bridgeInfo,
45
45
  } as unknown as ProviderFnParams<T>;
46
46
 
47
47
  return createBaseBridgeComponent(fullBridgeInfo);
package/vite.config.ts CHANGED
@@ -24,8 +24,6 @@ export default defineConfig({
24
24
  router: path.resolve(__dirname, 'src/router/default.tsx'),
25
25
  'router-v5': path.resolve(__dirname, 'src/router/v5.tsx'),
26
26
  'router-v6': path.resolve(__dirname, 'src/router/v6.tsx'),
27
- v16: path.resolve(__dirname, 'src/legacy.ts'),
28
- legacy: path.resolve(__dirname, 'src/legacy.ts'),
29
27
  v18: path.resolve(__dirname, 'src/v18.ts'),
30
28
  v19: path.resolve(__dirname, 'src/v19.ts'),
31
29
  },
@@ -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
- };