@module-federation/bridge-react 0.0.0-docs-remove-invalid-lark-link-20251205062649

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 (112) hide show
  1. package/CHANGELOG.md +728 -0
  2. package/LICENSE +21 -0
  3. package/README.md +131 -0
  4. package/__tests__/bridge.spec.tsx +160 -0
  5. package/__tests__/createLazyComponent.spec.tsx +209 -0
  6. package/__tests__/prefetch.spec.ts +156 -0
  7. package/__tests__/router.spec.tsx +82 -0
  8. package/__tests__/setupTests.ts +8 -0
  9. package/__tests__/util.ts +36 -0
  10. package/dist/base.cjs.js +29 -0
  11. package/dist/base.d.ts +311 -0
  12. package/dist/base.es.js +30 -0
  13. package/dist/bridge-base-CPSTBjEp.mjs +211 -0
  14. package/dist/bridge-base-RStDxH71.js +226 -0
  15. package/dist/createHelpers-B_L612IN.js +190 -0
  16. package/dist/createHelpers-Ui5pt7je.mjs +191 -0
  17. package/dist/data-fetch-server-middleware.cjs.js +163 -0
  18. package/dist/data-fetch-server-middleware.d.ts +15 -0
  19. package/dist/data-fetch-server-middleware.es.js +164 -0
  20. package/dist/data-fetch-utils.cjs.js +24 -0
  21. package/dist/data-fetch-utils.d.ts +81 -0
  22. package/dist/data-fetch-utils.es.js +26 -0
  23. package/dist/index-DRSBaSu3.js +45 -0
  24. package/dist/index-DyQNwY2M.mjs +46 -0
  25. package/dist/index.cjs.js +125 -0
  26. package/dist/index.d.ts +299 -0
  27. package/dist/index.es.js +109 -0
  28. package/dist/index.esm-BWaKho-8.js +491 -0
  29. package/dist/index.esm-CPwSeCvw.mjs +492 -0
  30. package/dist/lazy-load-component-plugin-CSRkMmKF.js +521 -0
  31. package/dist/lazy-load-component-plugin-DXqhuywC.mjs +522 -0
  32. package/dist/lazy-load-component-plugin.cjs.js +6 -0
  33. package/dist/lazy-load-component-plugin.d.ts +16 -0
  34. package/dist/lazy-load-component-plugin.es.js +6 -0
  35. package/dist/lazy-utils.cjs.js +24 -0
  36. package/dist/lazy-utils.d.ts +149 -0
  37. package/dist/lazy-utils.es.js +24 -0
  38. package/dist/plugin.cjs.js +14 -0
  39. package/dist/plugin.d.ts +22 -0
  40. package/dist/plugin.es.js +14 -0
  41. package/dist/prefetch-A3QkU5oZ.js +1272 -0
  42. package/dist/prefetch-zMJL79zx.mjs +1273 -0
  43. package/dist/router-v5.cjs.js +55 -0
  44. package/dist/router-v5.d.ts +18 -0
  45. package/dist/router-v5.es.js +32 -0
  46. package/dist/router-v6.cjs.js +84 -0
  47. package/dist/router-v6.d.ts +20 -0
  48. package/dist/router-v6.es.js +61 -0
  49. package/dist/router-v7.cjs.js +83 -0
  50. package/dist/router-v7.d.ts +20 -0
  51. package/dist/router-v7.es.js +61 -0
  52. package/dist/router.cjs.js +82 -0
  53. package/dist/router.d.ts +20 -0
  54. package/dist/router.es.js +60 -0
  55. package/dist/utils-dUgb9Jkm.mjs +2016 -0
  56. package/dist/utils-tM9yE73c.js +2015 -0
  57. package/dist/v18.cjs.js +15 -0
  58. package/dist/v18.d.ts +114 -0
  59. package/dist/v18.es.js +15 -0
  60. package/dist/v19.cjs.js +15 -0
  61. package/dist/v19.d.ts +115 -0
  62. package/dist/v19.es.js +15 -0
  63. package/jest.config.ts +21 -0
  64. package/package.json +173 -0
  65. package/project.json +23 -0
  66. package/src/base.ts +50 -0
  67. package/src/index.ts +50 -0
  68. package/src/lazy/AwaitDataFetch.tsx +215 -0
  69. package/src/lazy/constant.ts +30 -0
  70. package/src/lazy/createLazyComponent.tsx +411 -0
  71. package/src/lazy/data-fetch/cache.ts +291 -0
  72. package/src/lazy/data-fetch/call-data-fetch.ts +13 -0
  73. package/src/lazy/data-fetch/data-fetch-server-middleware.ts +196 -0
  74. package/src/lazy/data-fetch/index.ts +16 -0
  75. package/src/lazy/data-fetch/inject-data-fetch.ts +109 -0
  76. package/src/lazy/data-fetch/prefetch.ts +112 -0
  77. package/src/lazy/data-fetch/runtime-plugin.ts +115 -0
  78. package/src/lazy/index.ts +35 -0
  79. package/src/lazy/logger.ts +6 -0
  80. package/src/lazy/types.ts +75 -0
  81. package/src/lazy/utils.ts +372 -0
  82. package/src/lazy/wrapNoSSR.tsx +10 -0
  83. package/src/modern-app-env.d.ts +2 -0
  84. package/src/plugins/lazy-load-component-plugin.spec.ts +21 -0
  85. package/src/plugins/lazy-load-component-plugin.ts +57 -0
  86. package/src/provider/context.tsx +4 -0
  87. package/src/provider/plugin.ts +22 -0
  88. package/src/provider/versions/bridge-base.tsx +150 -0
  89. package/src/provider/versions/legacy.ts +87 -0
  90. package/src/provider/versions/v18.ts +47 -0
  91. package/src/provider/versions/v19.ts +48 -0
  92. package/src/remote/RemoteAppWrapper.tsx +108 -0
  93. package/src/remote/base-component/component.tsx +2 -0
  94. package/src/remote/base-component/create.tsx +23 -0
  95. package/src/remote/base-component/index.tsx +10 -0
  96. package/src/remote/createHelpers.tsx +130 -0
  97. package/src/remote/router-component/component.tsx +104 -0
  98. package/src/remote/router-component/create.tsx +23 -0
  99. package/src/remote/router-component/index.tsx +10 -0
  100. package/src/router/default.tsx +73 -0
  101. package/src/router/v5.tsx +43 -0
  102. package/src/router/v6.tsx +74 -0
  103. package/src/router/v7.tsx +75 -0
  104. package/src/types.ts +147 -0
  105. package/src/utils/index.ts +44 -0
  106. package/src/v18.ts +9 -0
  107. package/src/v19.ts +9 -0
  108. package/tsconfig.json +42 -0
  109. package/tsconfig.node.json +11 -0
  110. package/tsconfig.spec.json +26 -0
  111. package/vite.config.ts +112 -0
  112. package/vitest.config.ts +27 -0
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const client = require("react-dom/client");
4
+ const bridgeBase = require("./bridge-base-RStDxH71.js");
5
+ function createReact18Root(container, options) {
6
+ return client.createRoot(container, options);
7
+ }
8
+ function createBridgeComponent(bridgeInfo) {
9
+ const fullBridgeInfo = {
10
+ createRoot: createReact18Root,
11
+ ...bridgeInfo
12
+ };
13
+ return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
14
+ }
15
+ exports.createBridgeComponent = createBridgeComponent;
package/dist/v18.d.ts ADDED
@@ -0,0 +1,114 @@
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 { }
106
+
107
+
108
+ declare module '@module-federation/runtime-core' {
109
+ interface ModuleFederation {
110
+ createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
111
+ prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
112
+ collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
113
+ }
114
+ }
package/dist/v18.es.js ADDED
@@ -0,0 +1,15 @@
1
+ import { createRoot } from "react-dom/client";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-CPSTBjEp.mjs";
3
+ function createReact18Root(container, options) {
4
+ return createRoot(container, options);
5
+ }
6
+ function createBridgeComponent(bridgeInfo) {
7
+ const fullBridgeInfo = {
8
+ createRoot: createReact18Root,
9
+ ...bridgeInfo
10
+ };
11
+ return createBaseBridgeComponent(fullBridgeInfo);
12
+ }
13
+ export {
14
+ createBridgeComponent
15
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const client = require("react-dom/client");
4
+ const bridgeBase = require("./bridge-base-RStDxH71.js");
5
+ function createReact19Root(container, options) {
6
+ return client.createRoot(container, options);
7
+ }
8
+ function createBridgeComponent(bridgeInfo) {
9
+ const fullBridgeInfo = {
10
+ createRoot: createReact19Root,
11
+ ...bridgeInfo
12
+ };
13
+ return bridgeBase.createBaseBridgeComponent(fullBridgeInfo);
14
+ }
15
+ exports.createBridgeComponent = createBridgeComponent;
package/dist/v19.d.ts ADDED
@@ -0,0 +1,115 @@
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
+ }
package/dist/v19.es.js ADDED
@@ -0,0 +1,15 @@
1
+ import { createRoot } from "react-dom/client";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-CPSTBjEp.mjs";
3
+ function createReact19Root(container, options) {
4
+ return createRoot(container, options);
5
+ }
6
+ function createBridgeComponent(bridgeInfo) {
7
+ const fullBridgeInfo = {
8
+ createRoot: createReact19Root,
9
+ ...bridgeInfo
10
+ };
11
+ return createBaseBridgeComponent(fullBridgeInfo);
12
+ }
13
+ export {
14
+ createBridgeComponent
15
+ };
package/jest.config.ts ADDED
@@ -0,0 +1,21 @@
1
+ export default {
2
+ displayName: 'bridge-react',
3
+ preset: '../../../jest.preset.js',
4
+ transform: {
5
+ '^.+\\.[tj]sx?$': [
6
+ 'ts-jest',
7
+ {
8
+ tsconfig: '<rootDir>/tsconfig.spec.json',
9
+ isolatedModules: true,
10
+ },
11
+ ],
12
+ },
13
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
14
+ coverageDirectory: '../../../coverage/packages/bridge/bridge-react',
15
+ testEnvironment: 'jsdom',
16
+ setupFilesAfterEnv: ['<rootDir>/__tests__/setupTests.ts'],
17
+ testMatch: [
18
+ '<rootDir>/__tests__/**/*.spec.ts',
19
+ '<rootDir>/__tests__/**/*.spec.tsx',
20
+ ],
21
+ };
package/package.json ADDED
@@ -0,0 +1,173 @@
1
+ {
2
+ "name": "@module-federation/bridge-react",
3
+ "version": "0.0.0-docs-remove-invalid-lark-link-20251205062649",
4
+ "sideEffects": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "author": "zhouxiao <codingzx@gmail.com>",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/module-federation/core.git",
13
+ "directory": "packages/bridge/bridge-react"
14
+ },
15
+ "main": "./dist/index.cjs.js",
16
+ "module": "./dist/index.es.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.es.js",
22
+ "require": "./dist/index.cjs.js"
23
+ },
24
+ "./base": {
25
+ "types": "./dist/base.d.ts",
26
+ "import": "./dist/base.es.js",
27
+ "require": "./dist/base.cjs.js"
28
+ },
29
+ "./v18": {
30
+ "types": "./dist/v18.d.ts",
31
+ "import": "./dist/v18.es.js",
32
+ "require": "./dist/v18.cjs.js"
33
+ },
34
+ "./v19": {
35
+ "types": "./dist/v19.d.ts",
36
+ "import": "./dist/v19.es.js",
37
+ "require": "./dist/v19.cjs.js"
38
+ },
39
+ "./router": {
40
+ "types": "./dist/router.d.ts",
41
+ "import": "./dist/router.es.js",
42
+ "require": "./dist/router.cjs.js"
43
+ },
44
+ "./plugin": {
45
+ "types": "./dist/plugin.d.ts",
46
+ "import": "./dist/plugin.es.js",
47
+ "require": "./dist/plugin.cjs.js"
48
+ },
49
+ "./router-v5": {
50
+ "types": "./dist/router-v5.d.ts",
51
+ "import": "./dist/router-v5.es.js",
52
+ "require": "./dist/router-v5.cjs.js"
53
+ },
54
+ "./router-v6": {
55
+ "types": "./dist/router-v6.d.ts",
56
+ "import": "./dist/router-v6.es.js",
57
+ "require": "./dist/router-v6.cjs.js"
58
+ },
59
+ "./router-v7": {
60
+ "types": "./dist/router-v7.d.ts",
61
+ "import": "./dist/router-v7.es.js",
62
+ "require": "./dist/router-v7.cjs.js"
63
+ },
64
+ "./lazy-utils": {
65
+ "types": "./dist/lazy-utils.d.ts",
66
+ "import": "./dist/lazy-utils.es.js",
67
+ "require": "./dist/lazy-utils.cjs.js"
68
+ },
69
+ "./data-fetch-utils": {
70
+ "types": "./dist/data-fetch-utils.d.ts",
71
+ "import": "./dist/data-fetch-utils.es.js",
72
+ "require": "./dist/data-fetch-utils.cjs.js"
73
+ },
74
+ "./data-fetch-server-middleware": {
75
+ "types": "./dist/data-fetch-server-middleware.d.ts",
76
+ "import": "./dist/data-fetch-server-middleware.es.js",
77
+ "require": "./dist/data-fetch-server-middleware.cjs.js"
78
+ },
79
+ "./lazy-load-component-plugin": {
80
+ "types": "./dist/lazy-load-component-plugin.d.ts",
81
+ "import": "./dist/lazy-load-component-plugin.es.js",
82
+ "require": "./dist/lazy-load-component-plugin.cjs.js"
83
+ },
84
+ "./*": "./*"
85
+ },
86
+ "typesVersions": {
87
+ "*": {
88
+ ".": [
89
+ "./dist/index.d.ts"
90
+ ],
91
+ "base": [
92
+ "./dist/base.d.ts"
93
+ ],
94
+ "v18": [
95
+ "./dist/v18.d.ts"
96
+ ],
97
+ "v19": [
98
+ "./dist/v19.d.ts"
99
+ ],
100
+ "router": [
101
+ "./dist/router.d.ts"
102
+ ],
103
+ "plugin": [
104
+ "./dist/plugin.d.ts"
105
+ ],
106
+ "router-v5": [
107
+ "./dist/router-v5.d.ts"
108
+ ],
109
+ "router-v6": [
110
+ "./dist/router-v6.d.ts"
111
+ ],
112
+ "router-v7": [
113
+ "./dist/router-v7.d.ts"
114
+ ],
115
+ "lazy-load-component-plugin": [
116
+ "./dist/lazy-load-component-plugin.d.ts"
117
+ ],
118
+ "lazy-utils": [
119
+ "./dist/lazy-utils.d.ts"
120
+ ],
121
+ "data-fetch-utils": [
122
+ "./dist/data-fetch-utils.d.ts"
123
+ ],
124
+ "data-fetch-server-middleware": [
125
+ "./dist/data-fetch-server-middleware.d.ts"
126
+ ]
127
+ }
128
+ },
129
+ "dependencies": {
130
+ "react-error-boundary": "^4.1.2",
131
+ "lru-cache": "^10.4.3",
132
+ "@module-federation/bridge-shared": "0.0.0-docs-remove-invalid-lark-link-20251205062649",
133
+ "@module-federation/sdk": "0.0.0-docs-remove-invalid-lark-link-20251205062649"
134
+ },
135
+ "peerDependencies": {
136
+ "react": ">=16.9.0",
137
+ "react-dom": ">=16.9.0",
138
+ "react-router-dom": "^4 || ^5 || ^6 || ^7",
139
+ "react-router": "^6 || ^7"
140
+ },
141
+ "peerDependenciesMeta": {
142
+ "react-router-dom": {
143
+ "optional": true
144
+ },
145
+ "react-router": {
146
+ "optional": true
147
+ }
148
+ },
149
+ "devDependencies": {
150
+ "@testing-library/react": "15.0.7",
151
+ "@testing-library/jest-dom": "6.6.3",
152
+ "@types/react": "18.2.79",
153
+ "@types/react-dom": "18.3.0",
154
+ "@vitejs/plugin-react": "^4.3.3",
155
+ "@vitejs/plugin-vue": "^5.0.4",
156
+ "@vitejs/plugin-vue-jsx": "^4.0.0",
157
+ "react": "18.3.1",
158
+ "react-dom": "18.3.1",
159
+ "react-router-dom": "6.22.3",
160
+ "react-router": "7.9.4",
161
+ "typescript": "^5.2.2",
162
+ "vite": "^5.4.21",
163
+ "vite-plugin-dts": "^4.3.0",
164
+ "hono": "4.10.3",
165
+ "@module-federation/runtime": "0.0.0-docs-remove-invalid-lark-link-20251205062649",
166
+ "@module-federation/runtime-core": "0.0.0-docs-remove-invalid-lark-link-20251205062649"
167
+ },
168
+ "scripts": {
169
+ "dev": "vite",
170
+ "build": "vite build",
171
+ "preview": "vite preview"
172
+ }
173
+ }
package/project.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "bridge-react",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/bridge/bridge-react/src",
5
+ "projectType": "library",
6
+ "tags": ["type:pkg"],
7
+ "targets": {
8
+ "build": {
9
+ "executor": "nx:run-commands",
10
+ "options": {
11
+ "commands": ["npm run build --prefix packages/bridge/bridge-react"]
12
+ }
13
+ },
14
+ "test": {
15
+ "executor": "@nx/jest:jest",
16
+ "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
17
+ "options": {
18
+ "jestConfig": "packages/bridge/bridge-react/jest.config.ts",
19
+ "passWithNoTests": true
20
+ }
21
+ }
22
+ }
23
+ }
package/src/base.ts ADDED
@@ -0,0 +1,50 @@
1
+ export { createBridgeComponent } from './provider/versions/legacy';
2
+
3
+ // Export router-free versions of remote component creators
4
+ export {
5
+ createRemoteComponent,
6
+ createRemoteAppComponent,
7
+ } from './remote/base-component';
8
+ export type { LazyRemoteComponentInfo } from './remote/base-component';
9
+
10
+ // Export all lazy loading and data fetching utilities (no router dependencies)
11
+ export {
12
+ ERROR_TYPE,
13
+ createLazyComponent,
14
+ collectSSRAssets,
15
+ callDataFetch,
16
+ setSSREnv,
17
+ autoFetchDataPlugin,
18
+ CacheSize,
19
+ CacheTime,
20
+ configureCache,
21
+ generateKey,
22
+ cache,
23
+ revalidateTag,
24
+ clearStore,
25
+ prefetch,
26
+ } from './lazy';
27
+
28
+ export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
29
+
30
+ // Export all types
31
+ export type { CreateRootOptions, Root } from './provider/versions/legacy';
32
+ export type {
33
+ ProviderParams,
34
+ ProviderFnParams,
35
+ RootType,
36
+ DestroyParams,
37
+ RenderParams,
38
+ RemoteComponentParams,
39
+ RenderFnParams,
40
+ RemoteComponentProps,
41
+ RemoteModule,
42
+ } from './types';
43
+ export type {
44
+ DataFetchParams,
45
+ NoSSRRemoteInfo,
46
+ CollectSSRAssetsOptions,
47
+ CreateLazyComponentOptions,
48
+ CacheStatus,
49
+ CacheStatsInfo,
50
+ } from './lazy';
package/src/index.ts ADDED
@@ -0,0 +1,50 @@
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';
6
+ export {
7
+ createRemoteComponent,
8
+ createRemoteAppComponent,
9
+ } from './remote/router-component';
10
+ export type { LazyRemoteComponentInfo } from './remote/router-component';
11
+ export {
12
+ ERROR_TYPE,
13
+ createLazyComponent,
14
+ collectSSRAssets,
15
+ // wrapNoSSR,
16
+ callDataFetch,
17
+ setSSREnv,
18
+ autoFetchDataPlugin,
19
+ CacheSize,
20
+ CacheTime,
21
+ configureCache,
22
+ generateKey,
23
+ cache,
24
+ revalidateTag,
25
+ clearStore,
26
+ prefetch,
27
+ } from './lazy';
28
+
29
+ export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
30
+
31
+ export type { CreateRootOptions, Root } from './provider/versions/legacy';
32
+ export type {
33
+ ProviderParams,
34
+ ProviderFnParams,
35
+ RootType,
36
+ DestroyParams,
37
+ RenderParams,
38
+ RemoteComponentParams,
39
+ RenderFnParams,
40
+ RemoteComponentProps,
41
+ RemoteModule,
42
+ } from './types';
43
+ export type {
44
+ DataFetchParams,
45
+ NoSSRRemoteInfo,
46
+ CollectSSRAssetsOptions,
47
+ CreateLazyComponentOptions,
48
+ CacheStatus,
49
+ CacheStatsInfo,
50
+ } from './lazy';