@module-federation/bridge-react
Advanced tools
Comparing version 0.0.0-next-20240620023927 to 0.0.0-next-20240620034636
# @module-federation/bridge-react | ||
## 0.0.0-next-20240620023927 | ||
## 0.0.0-next-20240620034636 | ||
### Patch Changes | ||
- @module-federation/bridge-shared@0.0.0-next-20240620023927 | ||
- @module-federation/bridge-shared@0.0.0-next-20240620034636 |
"use strict"; | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const React = require("react"); | ||
const reactRouterDom = require("react-router-dom"); | ||
const ReactRouterDOM = require("react-router-dom"); | ||
const context = require("./context-ePt4wynZ.cjs"); | ||
@@ -24,2 +24,3 @@ const ReactDOM = require("react-dom"); | ||
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React); | ||
const ReactRouterDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactRouterDOM); | ||
const RemoteApp = ({ | ||
@@ -37,3 +38,3 @@ name, | ||
if (dispathPopstate) { | ||
const location = reactRouterDom.useLocation(); | ||
const location = ReactRouterDOM__namespace.useLocation(); | ||
const [pathname, setPathname] = React.useState(location.pathname); | ||
@@ -91,7 +92,18 @@ React.useEffect(() => { | ||
const exportName = (info == null ? void 0 : info.export) || "default"; | ||
const routerContextVal = React.useContext(reactRouterDom.UNSAFE_RouteContext); | ||
let basename = "/"; | ||
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) { | ||
basename = routerContextVal.matches[0].pathnameBase; | ||
let enableDispathPopstate = false; | ||
let routerContextVal; | ||
try { | ||
ReactRouterDOM__namespace.useLocation(); | ||
enableDispathPopstate = true; | ||
} catch { | ||
enableDispathPopstate = false; | ||
} | ||
if (ReactRouterDOM__namespace.UNSAFE_RouteContext && enableDispathPopstate) { | ||
routerContextVal = React.useContext(ReactRouterDOM__namespace.UNSAFE_RouteContext); | ||
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) { | ||
basename = routerContextVal.matches[0].pathnameBase; | ||
} | ||
enableDispathPopstate = (routerContextVal == null ? void 0 : routerContextVal.matches) && (routerContextVal == null ? void 0 : routerContextVal.matches.length) > 0; | ||
} | ||
const LazyComponent = React.useMemo(() => { | ||
@@ -119,3 +131,3 @@ return React.lazy(async () => { | ||
name: moduleName, | ||
dispathPopstate: (routerContextVal == null ? void 0 : routerContextVal.matches) && (routerContextVal == null ? void 0 : routerContextVal.matches.length) > 0, | ||
dispathPopstate: enableDispathPopstate, | ||
...info, | ||
@@ -122,0 +134,0 @@ ...props, |
import * as React from "react"; | ||
import React__default, { useContext, useMemo, useRef, useState, useEffect } from "react"; | ||
import { UNSAFE_RouteContext, useLocation } from "react-router-dom"; | ||
import * as ReactRouterDOM from "react-router-dom"; | ||
import { L as LoggerInstance, f, a as atLeastReact18, R as RouterContext } from "./context-CPtN38Ur.js"; | ||
@@ -18,3 +18,3 @@ import ReactDOM from "react-dom"; | ||
if (dispathPopstate) { | ||
const location = useLocation(); | ||
const location = ReactRouterDOM.useLocation(); | ||
const [pathname, setPathname] = useState(location.pathname); | ||
@@ -72,7 +72,18 @@ useEffect(() => { | ||
const exportName = (info == null ? void 0 : info.export) || "default"; | ||
const routerContextVal = useContext(UNSAFE_RouteContext); | ||
let basename = "/"; | ||
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) { | ||
basename = routerContextVal.matches[0].pathnameBase; | ||
let enableDispathPopstate = false; | ||
let routerContextVal; | ||
try { | ||
ReactRouterDOM.useLocation(); | ||
enableDispathPopstate = true; | ||
} catch { | ||
enableDispathPopstate = false; | ||
} | ||
if (ReactRouterDOM.UNSAFE_RouteContext && enableDispathPopstate) { | ||
routerContextVal = useContext(ReactRouterDOM.UNSAFE_RouteContext); | ||
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) { | ||
basename = routerContextVal.matches[0].pathnameBase; | ||
} | ||
enableDispathPopstate = (routerContextVal == null ? void 0 : routerContextVal.matches) && (routerContextVal == null ? void 0 : routerContextVal.matches.length) > 0; | ||
} | ||
const LazyComponent = useMemo(() => { | ||
@@ -100,3 +111,3 @@ return React__default.lazy(async () => { | ||
name: moduleName, | ||
dispathPopstate: (routerContextVal == null ? void 0 : routerContextVal.matches) && (routerContextVal == null ? void 0 : routerContextVal.matches.length) > 0, | ||
dispathPopstate: enableDispathPopstate, | ||
...info, | ||
@@ -103,0 +114,0 @@ ...props, |
{ | ||
"name": "@module-federation/bridge-react", | ||
"version": "0.0.0-next-20240620023927", | ||
"version": "0.0.0-next-20240620034636", | ||
"publishConfig": { | ||
@@ -28,3 +28,3 @@ "access": "public" | ||
"react-error-boundary": "^4.0.13", | ||
"@module-federation/bridge-shared": "0.0.0-next-20240620023927" | ||
"@module-federation/bridge-shared": "0.0.0-next-20240620034636" | ||
}, | ||
@@ -31,0 +31,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51199
1427
+ Added@module-federation/bridge-shared@0.0.0-next-20240620034636(transitive)
- Removed@module-federation/bridge-shared@0.0.0-next-20240620023927(transitive)
Updated@module-federation/bridge-shared@0.0.0-next-20240620034636