@module-federation/bridge-react 2.7.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.
Files changed (90) hide show
  1. package/dist/base.cjs.js +4 -4
  2. package/dist/base.d.ts +8 -311
  3. package/dist/base.es.js +5 -5
  4. package/dist/{bridge-base-CIOXqUYV.mjs → bridge-base-BaKy6CY_.mjs} +25 -92
  5. package/dist/{bridge-base-HLp3d7aF.js → bridge-base-Ch33UJuN.js} +25 -91
  6. package/dist/{createHelpers-DNBacpxb.js → createHelpers-19BP0xtB.js} +2 -3
  7. package/dist/{createHelpers-BY5Uj9_Z.mjs → createHelpers-BSHeKyd-.mjs} +2 -3
  8. package/dist/data-fetch-server-middleware.cjs.js +1 -1
  9. package/dist/data-fetch-server-middleware.d.ts +1 -15
  10. package/dist/data-fetch-server-middleware.es.js +1 -1
  11. package/dist/data-fetch-utils.cjs.js +2 -2
  12. package/dist/data-fetch-utils.d.ts +1 -81
  13. package/dist/data-fetch-utils.es.js +4 -4
  14. package/dist/data-fetch.cjs.js +3 -3
  15. package/dist/data-fetch.d.ts +4 -140
  16. package/dist/data-fetch.es.js +3 -3
  17. package/dist/error-boundary.d.ts +17 -0
  18. package/dist/error-boundary.spec.d.ts +1 -0
  19. package/dist/index.cjs.js +4 -4
  20. package/dist/index.d.ts +12 -299
  21. package/dist/index.es.js +5 -5
  22. package/dist/lazy/AwaitDataFetch.d.ts +24 -0
  23. package/dist/lazy/constant.d.ts +26 -0
  24. package/dist/lazy/createLazyComponent.d.ts +28 -0
  25. package/dist/lazy/data-fetch/cache.d.ts +34 -0
  26. package/dist/lazy/data-fetch/cache.spec.d.ts +1 -0
  27. package/dist/lazy/data-fetch/call-data-fetch.d.ts +1 -0
  28. package/dist/lazy/data-fetch/data-fetch-server-middleware.d.ts +3 -0
  29. package/dist/lazy/data-fetch/index.d.ts +6 -0
  30. package/dist/lazy/data-fetch/inject-data-fetch.d.ts +4 -0
  31. package/dist/lazy/data-fetch/prefetch.d.ts +9 -0
  32. package/dist/lazy/data-fetch/runtime-plugin.d.ts +3 -0
  33. package/dist/lazy/index.d.ts +9 -0
  34. package/dist/lazy/logger.d.ts +2 -0
  35. package/dist/lazy/types.d.ts +60 -0
  36. package/dist/lazy/utils.d.ts +48 -0
  37. package/dist/lazy/wrapNoSSR.d.ts +9 -0
  38. package/dist/{lazy-load-component-plugin-aj97Vt-4.mjs → lazy-load-component-plugin-DEu-DfZt.mjs} +2 -2
  39. package/dist/{lazy-load-component-plugin-BjMVNoep.js → lazy-load-component-plugin-FKp6nQa-.js} +2 -2
  40. package/dist/lazy-load-component-plugin.cjs.js +2 -2
  41. package/dist/lazy-load-component-plugin.d.ts +2 -16
  42. package/dist/lazy-load-component-plugin.es.js +2 -2
  43. package/dist/lazy-utils.cjs.js +1 -1
  44. package/dist/lazy-utils.d.ts +1 -149
  45. package/dist/lazy-utils.es.js +2 -2
  46. package/dist/plugin.d.ts +2 -22
  47. package/dist/plugins/lazy-load-component-plugin.d.ts +12 -0
  48. package/dist/plugins/lazy-load-component-plugin.spec.d.ts +1 -0
  49. package/dist/{prefetch-BwRDb4SJ.mjs → prefetch-CTZuFBqh.mjs} +314 -1
  50. package/dist/{prefetch-DLhPTofn.js → prefetch-D66kL1aM.js} +314 -1
  51. package/dist/provider/context.d.ts +3 -0
  52. package/dist/provider/plugin.d.ts +7 -0
  53. package/dist/provider/versions/bridge-base.d.ts +5 -0
  54. package/dist/provider/versions/legacy.d.ts +26 -0
  55. package/dist/provider/versions/v18.d.ts +19 -0
  56. package/dist/provider/versions/v19.d.ts +21 -0
  57. package/dist/remote/RemoteAppWrapper.d.ts +7 -0
  58. package/dist/remote/base-component/component.d.ts +2 -0
  59. package/dist/remote/base-component/create.d.ts +9 -0
  60. package/dist/remote/base-component/index.d.ts +5 -0
  61. package/dist/remote/createHelpers.d.ts +17 -0
  62. package/dist/remote/router-component/component.d.ts +8 -0
  63. package/dist/remote/router-component/create.d.ts +9 -0
  64. package/dist/remote/router-component/index.d.ts +5 -0
  65. package/dist/router/default.d.ts +7 -0
  66. package/dist/router/v5.d.ts +4 -0
  67. package/dist/router/v6.d.ts +7 -0
  68. package/dist/router/v7.d.ts +6 -0
  69. package/dist/router-v5.d.ts +1 -17
  70. package/dist/router-v6.d.ts +1 -20
  71. package/dist/router-v7.d.ts +1 -19
  72. package/dist/router.d.ts +1 -20
  73. package/dist/shared/size-limited-cache.d.ts +29 -0
  74. package/dist/shared/size-limited-cache.spec.d.ts +1 -0
  75. package/dist/size-limited-cache.cjs.js +82 -0
  76. package/dist/size-limited-cache.d.ts +1 -0
  77. package/dist/size-limited-cache.es.js +82 -0
  78. package/dist/types.d.ts +137 -0
  79. package/dist/utils/index.d.ts +4 -0
  80. package/dist/utils-5dGErM3C.js +588 -0
  81. package/dist/utils-BBP3hEeV.mjs +589 -0
  82. package/dist/v18.cjs.js +1 -1
  83. package/dist/v18.d.ts +3 -114
  84. package/dist/v18.es.js +1 -1
  85. package/dist/v19.cjs.js +1 -1
  86. package/dist/v19.d.ts +3 -115
  87. package/dist/v19.es.js +1 -1
  88. package/package.json +16 -11
  89. package/dist/utils-CFTy4LVE.js +0 -2029
  90. package/dist/utils-DGS4pYp8.mjs +0 -2030
package/dist/v18.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-CIOXqUYV.mjs";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-BaKy6CY_.mjs";
3
3
  function createReact18Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
package/dist/v19.cjs.js CHANGED
@@ -1,7 +1,7 @@
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-HLp3d7aF.js");
4
+ const bridgeBase = require("./bridge-base-Ch33UJuN.js");
5
5
  function createReact19Root(container, options) {
6
6
  return client.createRoot(container, options);
7
7
  }
package/dist/v19.d.ts CHANGED
@@ -1,115 +1,3 @@
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
- transitionCallbacks?: unknown;
13
- }
14
-
15
- /**
16
- * Options for creating a React root
17
- */
18
- declare interface CreateRootOptions_2 {
19
- identifierPrefix?: string;
20
- onRecoverableError?: (error: unknown) => void;
21
- transitionCallbacks?: unknown;
22
- }
23
-
24
- /**
25
- * Parameters for the destroy function
26
- */
27
- export declare interface DestroyParams {
28
- moduleName: string;
29
- dom: HTMLElement;
30
- }
31
-
32
- /**
33
- * Parameters for the provider function
34
- */
35
- export declare interface ProviderFnParams<T> {
36
- rootComponent: React_2.ComponentType<T>;
37
- render?: (App: React_2.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
38
- createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions_2) => Root_2;
39
- /**
40
- * Default options to pass to createRoot for React 18 and 19
41
- * These options will be used when creating a root unless overridden by rootOptions in render params
42
- * @example
43
- * {
44
- * identifierPrefix: 'app-',
45
- * onRecoverableError: (err) => console.error(err)
46
- * }
47
- */
48
- defaultRootOptions?: CreateRootOptions_2;
49
- }
50
-
51
- /**
52
- * Parameters for the provider function
53
- */
54
- export declare interface ProviderParams {
55
- moduleName?: string;
56
- basename?: string;
57
- memoryRoute?: {
58
- entryPath: string;
59
- initialState?: Record<string, unknown>;
60
- };
61
- style?: React_2.CSSProperties;
62
- className?: string;
63
- }
64
-
65
- /**
66
- * Parameters for the render function
67
- */
68
- export declare interface RenderParams {
69
- moduleName?: string;
70
- basename?: string;
71
- memoryRoute?: {
72
- entryPath: string;
73
- initialState?: Record<string, unknown>;
74
- };
75
- dom: HTMLElement;
76
- /**
77
- * Options to pass to createRoot for React 18 and 19
78
- * @example
79
- * {
80
- * identifierPrefix: 'app-',
81
- * onRecoverableError: (err) => console.error(err)
82
- * }
83
- */
84
- rootOptions?: CreateRootOptions_2;
85
- [key: string]: unknown;
86
- }
87
-
88
- export declare interface Root {
89
- render(children: default_2.ReactNode): void;
90
- unmount(): void;
91
- }
92
-
93
- /**
94
- * Interface for a React root object
95
- */
96
- declare interface Root_2 {
97
- render(children: React_2.ReactNode): void;
98
- unmount(): void;
99
- }
100
-
101
- /**
102
- * Type for a root element, which can be either an HTMLElement or a React root
103
- */
104
- export declare type RootType = HTMLElement | Root_2;
105
-
106
- export { }
107
-
108
-
109
- declare module '@module-federation/runtime-core' {
110
- interface ModuleFederation {
111
- createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
112
- prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
113
- collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
114
- }
115
- }
1
+ export { createBridgeComponent } from './provider/versions/v19';
2
+ export type { CreateRootOptions, Root } from './provider/versions/v19';
3
+ export type { ProviderParams, ProviderFnParams, RootType, DestroyParams, RenderParams, } from './types';
package/dist/v19.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-CIOXqUYV.mjs";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-BaKy6CY_.mjs";
3
3
  function createReact19Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/bridge-react",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -90,6 +90,11 @@
90
90
  "import": "./dist/lazy-load-component-plugin.es.js",
91
91
  "require": "./dist/lazy-load-component-plugin.cjs.js"
92
92
  },
93
+ "./size-limited-cache": {
94
+ "types": "./dist/size-limited-cache.d.ts",
95
+ "import": "./dist/size-limited-cache.es.js",
96
+ "require": "./dist/size-limited-cache.cjs.js"
97
+ },
93
98
  "./*": "./*"
94
99
  },
95
100
  "typesVersions": {
@@ -135,12 +140,14 @@
135
140
  ],
136
141
  "data-fetch-server-middleware": [
137
142
  "./dist/data-fetch-server-middleware.d.ts"
143
+ ],
144
+ "size-limited-cache": [
145
+ "./dist/size-limited-cache.d.ts"
138
146
  ]
139
147
  }
140
148
  },
141
149
  "dependencies": {
142
- "lru-cache": "10.4.3",
143
- "@module-federation/sdk": "2.7.0"
150
+ "@module-federation/sdk": "2.8.0"
144
151
  },
145
152
  "peerDependencies": {
146
153
  "react": ">=16.9.0",
@@ -157,7 +164,6 @@
157
164
  }
158
165
  },
159
166
  "devDependencies": {
160
- "react-error-boundary": "^4.1.2",
161
167
  "@rsbuild/plugin-react": "2.1.0",
162
168
  "@testing-library/react": "15.0.7",
163
169
  "@testing-library/jest-dom": "6.6.3",
@@ -170,20 +176,19 @@
170
176
  "react-dom": "18.3.1",
171
177
  "react-router-dom": "6.30.3",
172
178
  "react-router": "7.16.0",
173
- "typescript": "^6.0.3",
179
+ "typescript": "7.0.2",
174
180
  "vite": "^5.4.21",
175
- "vite-plugin-dts": "^4.3.0",
176
181
  "hono": "4.12.26",
177
- "@module-federation/bridge-shared": "2.7.0",
178
- "@module-federation/runtime-core": "2.7.0",
179
- "@module-federation/runtime": "2.7.0"
182
+ "@module-federation/bridge-shared": "2.8.0",
183
+ "@module-federation/runtime": "2.8.0",
184
+ "@module-federation/runtime-core": "2.8.0"
180
185
  },
181
186
  "scripts": {
182
187
  "dev": "vite",
183
- "build": "vite build",
188
+ "build": "vite build && tsc -p tsconfig.json && node scripts/write-dts-entrypoints.mjs",
184
189
  "preview": "vite preview",
185
190
  "test": "pnpm run test:jest && pnpm run test:rstest",
186
- "test:jest": "pnpm exec jest --config jest.config.ts --passWithNoTests",
191
+ "test:jest": "pnpm exec jest --config jest.config.js --passWithNoTests",
187
192
  "test:rstest": "pnpm exec rstest --passWithNoTests"
188
193
  }
189
194
  }