@module-federation/bridge-react 0.0.0-next-20241117185051 → 0.0.0-next-20241118060105
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/CHANGELOG.md +4 -5
- package/dist/router-v6.cjs.js +2 -3
- package/dist/router-v6.d.ts +1 -1
- package/dist/router-v6.es.js +7 -7
- package/package.json +4 -4
- package/src/router-v5.tsx +1 -1
- package/src/router-v6.tsx +1 -2
- package/src/utils.ts +1 -0
- package/vite.config.ts +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# @module-federation/bridge-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20241118060105
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- @module-federation/bridge-shared@0.0.0-next-20241117185051
|
|
7
|
+
- @module-federation/runtime@0.0.0-next-20241118060105
|
|
8
|
+
- @module-federation/sdk@0.0.0-next-20241118060105
|
|
9
|
+
- @module-federation/bridge-shared@0.0.0-next-20241118060105
|
|
11
10
|
|
|
12
11
|
## 0.7.4
|
|
13
12
|
|
package/dist/router-v6.cjs.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const ReactRouterDom$1 = require("react-router-dom/dist/index.js");
|
|
5
|
-
const context = require("./context-BcJ-YlNr.cjs");
|
|
6
4
|
const ReactRouterDom = require("react-router-dom/dist/index.js");
|
|
5
|
+
const context = require("./context-BcJ-YlNr.cjs");
|
|
7
6
|
function _interopNamespaceDefault(e) {
|
|
8
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
8
|
if (e) {
|
|
@@ -20,7 +19,7 @@ function _interopNamespaceDefault(e) {
|
|
|
20
19
|
n.default = e;
|
|
21
20
|
return Object.freeze(n);
|
|
22
21
|
}
|
|
23
|
-
const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom
|
|
22
|
+
const ReactRouterDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDom);
|
|
24
23
|
function WraperRouter(props) {
|
|
25
24
|
const { basename, ...propsRes } = props;
|
|
26
25
|
const routerContextProps = React.useContext(context.RouterContext) || {};
|
package/dist/router-v6.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare function BrowserRouter(props: Parameters<typeof ReactRouterDom.Br
|
|
|
6
6
|
export declare function RouterProvider(props: Parameters<typeof ReactRouterDom.RouterProvider>[0]): default_2.JSX.Element;
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
export * from "react-router-dom/";
|
|
9
|
+
export * from "react-router-dom/dist/index.js";
|
|
10
10
|
|
|
11
11
|
export { }
|
package/dist/router-v6.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useContext } from "react";
|
|
2
|
-
import * as ReactRouterDom
|
|
3
|
-
import { R as RouterContext, L as LoggerInstance } from "./context-CUbFnlO5.js";
|
|
2
|
+
import * as ReactRouterDom from "react-router-dom/dist/index.js";
|
|
4
3
|
export * from "react-router-dom/dist/index.js";
|
|
4
|
+
import { R as RouterContext, L as LoggerInstance } from "./context-CUbFnlO5.js";
|
|
5
5
|
function WraperRouter(props) {
|
|
6
6
|
const { basename, ...propsRes } = props;
|
|
7
7
|
const routerContextProps = useContext(RouterContext) || {};
|
|
@@ -12,7 +12,7 @@ function WraperRouter(props) {
|
|
|
12
12
|
});
|
|
13
13
|
if (routerContextProps == null ? void 0 : routerContextProps.memoryRoute) {
|
|
14
14
|
return /* @__PURE__ */ React__default.createElement(
|
|
15
|
-
ReactRouterDom
|
|
15
|
+
ReactRouterDom.MemoryRouter,
|
|
16
16
|
{
|
|
17
17
|
...props,
|
|
18
18
|
initialEntries: [routerContextProps == null ? void 0 : routerContextProps.memoryRoute.entryPath]
|
|
@@ -20,7 +20,7 @@ function WraperRouter(props) {
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
return /* @__PURE__ */ React__default.createElement(
|
|
23
|
-
ReactRouterDom
|
|
23
|
+
ReactRouterDom.BrowserRouter,
|
|
24
24
|
{
|
|
25
25
|
...propsRes,
|
|
26
26
|
basename: (routerContextProps == null ? void 0 : routerContextProps.basename) || basename
|
|
@@ -37,9 +37,9 @@ function WraperRouterProvider(props) {
|
|
|
37
37
|
WraperRouterProviderProps: props,
|
|
38
38
|
router
|
|
39
39
|
});
|
|
40
|
-
const RouterProvider = ReactRouterDom
|
|
41
|
-
const createMemoryRouter = ReactRouterDom
|
|
42
|
-
const createBrowserRouter = ReactRouterDom
|
|
40
|
+
const RouterProvider = ReactRouterDom["RouterProvider"];
|
|
41
|
+
const createMemoryRouter = ReactRouterDom["createMemoryRouter"];
|
|
42
|
+
const createBrowserRouter = ReactRouterDom["createBrowserRouter"];
|
|
43
43
|
if (routerContextProps.memoryRoute) {
|
|
44
44
|
const MemeoryRouterInstance = createMemoryRouter(routers, {
|
|
45
45
|
initialEntries: [routerContextProps == null ? void 0 : routerContextProps.memoryRoute.entryPath]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/bridge-react",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241118060105",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@loadable/component": "^5.16.4",
|
|
43
43
|
"react-error-boundary": "^4.0.13",
|
|
44
|
-
"@module-federation/bridge-shared": "0.0.0-next-
|
|
45
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
46
|
-
"@module-federation/runtime": "0.0.0-next-
|
|
44
|
+
"@module-federation/bridge-shared": "0.0.0-next-20241118060105",
|
|
45
|
+
"@module-federation/sdk": "0.0.0-next-20241118060105",
|
|
46
|
+
"@module-federation/runtime": "0.0.0-next-20241118060105"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=16.9.0",
|
package/src/router-v5.tsx
CHANGED
|
@@ -36,7 +36,7 @@ function WraperRouter(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// @ts-ignore
|
|
39
|
-
//
|
|
39
|
+
// cause export directly from react-router-dom/index.js will cause build falied.
|
|
40
40
|
// it will be replace by react-router-dom/index.js in building phase
|
|
41
41
|
export * from 'react-router-dom/';
|
|
42
42
|
|
package/src/router-v6.tsx
CHANGED
|
@@ -69,7 +69,6 @@ function WraperRouterProvider(
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
export * from 'react-router-dom/';
|
|
72
|
+
export * from 'react-router-dom/dist/index.js';
|
|
74
73
|
export { WraperRouter as BrowserRouter };
|
|
75
74
|
export { WraperRouterProvider as RouterProvider };
|
package/src/utils.ts
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
|
-
|
|
2
|
+
import vue from '@vitejs/plugin-vue';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import dts from 'vite-plugin-dts';
|
|
5
|
-
|
|
5
|
+
import react from '@vitejs/plugin-react';
|
|
6
6
|
import packageJson from './package.json';
|
|
7
7
|
|
|
8
8
|
const perDepsKeys = Object.keys(packageJson.peerDependencies);
|
|
@@ -44,13 +44,13 @@ export default defineConfig({
|
|
|
44
44
|
generateBundle(options, bundle) {
|
|
45
45
|
for (const fileName in bundle) {
|
|
46
46
|
const chunk = bundle[fileName];
|
|
47
|
-
if (fileName.includes('router-v6') && chunk.type === 'chunk') {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
47
|
+
// if (fileName.includes('router-v6') && chunk.type === 'chunk') {
|
|
48
|
+
// chunk.code = chunk.code.replace(
|
|
49
|
+
// // Match 'react-router-dom/' followed by single quotes, double quotes, or backticks, replacing only 'react-router-dom/' to react-router-v6 dist file structure
|
|
50
|
+
// /react-router-dom\/(?=[\'\"\`])/g,
|
|
51
|
+
// 'react-router-dom/dist/index.js',
|
|
52
|
+
// );
|
|
53
|
+
// }
|
|
54
54
|
|
|
55
55
|
if (fileName.includes('router-v5') && chunk.type === 'chunk') {
|
|
56
56
|
chunk.code = chunk.code.replace(
|