Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/bridge-react

Package Overview
Dependencies
Maintainers
8
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/bridge-react - npm Package Compare versions

Comparing version 0.0.0-next-20240620052430 to 0.0.0-next-20240620060503

dist/context--mtFt3tp.cjs

4

CHANGELOG.md
# @module-federation/bridge-react
## 0.0.0-next-20240620052430
## 0.0.0-next-20240620060503
### Patch Changes
- @module-federation/bridge-shared@0.0.0-next-20240620052430
- @module-federation/bridge-shared@0.0.0-next-20240620060503

@@ -5,3 +5,3 @@ "use strict";

const ReactRouterDOM = require("react-router-dom");
const context = require("./context-ePt4wynZ.cjs");
const context = require("./context--mtFt3tp.cjs");
const ReactDOM = require("react-dom");

@@ -90,2 +90,3 @@ function _interopNamespaceDefault(e) {

return (props) => {
var _a;
const exportName = (info == null ? void 0 : info.export) || "default";

@@ -101,2 +102,32 @@ let basename = "/";

}
if (props.basename) {
basename = props.basename;
} else if (enableDispathPopstate) {
const ReactRouterDOMAny = ReactRouterDOM__namespace;
const useRouteMatch = ReactRouterDOMAny["useRouteMatch"];
const useHistory = ReactRouterDOMAny["useHistory"];
const useHref = ReactRouterDOMAny["useHref"];
const UNSAFE_RouteContext = ReactRouterDOMAny["UNSAFE_RouteContext"];
if (UNSAFE_RouteContext) {
if (useHref) {
basename = useHref == null ? void 0 : useHref("/");
}
routerContextVal = React.useContext(UNSAFE_RouteContext);
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) {
basename = context.pathJoin(
basename,
routerContextVal.matches[0].pathnameBase || "/"
);
}
} else {
const match = useRouteMatch == null ? void 0 : useRouteMatch();
if (useHistory) {
const history = useHistory == null ? void 0 : useHistory();
basename = (_a = history == null ? void 0 : history.createHref) == null ? void 0 : _a.call(history, { pathname: "/" });
}
if (match) {
basename = context.pathJoin(basename, (match == null ? void 0 : match.path) || "/");
}
}
}
const LazyComponent = React.useMemo(() => {

@@ -103,0 +134,0 @@ return React.lazy(async () => {

import * as React from "react";
import React__default, { useMemo, useRef, useState, useEffect } from "react";
import React__default, { useContext, useMemo, useRef, useState, useEffect } from "react";
import * as ReactRouterDOM from "react-router-dom";
import { L as LoggerInstance, f, a as atLeastReact18, R as RouterContext } from "./context-CPtN38Ur.js";
import { p as pathJoin, L as LoggerInstance, f, a as atLeastReact18, R as RouterContext } from "./context-Bw2PEwa6.js";
import ReactDOM from "react-dom";

@@ -70,2 +70,3 @@ const RemoteApp = ({

return (props) => {
var _a;
const exportName = (info == null ? void 0 : info.export) || "default";

@@ -81,2 +82,32 @@ let basename = "/";

}
if (props.basename) {
basename = props.basename;
} else if (enableDispathPopstate) {
const ReactRouterDOMAny = ReactRouterDOM;
const useRouteMatch = ReactRouterDOMAny["useRouteMatch"];
const useHistory = ReactRouterDOMAny["useHistory"];
const useHref = ReactRouterDOMAny["useHref"];
const UNSAFE_RouteContext = ReactRouterDOMAny["UNSAFE_RouteContext"];
if (UNSAFE_RouteContext) {
if (useHref) {
basename = useHref == null ? void 0 : useHref("/");
}
routerContextVal = useContext(UNSAFE_RouteContext);
if (routerContextVal && routerContextVal.matches && routerContextVal.matches[0] && routerContextVal.matches[0].pathnameBase) {
basename = pathJoin(
basename,
routerContextVal.matches[0].pathnameBase || "/"
);
}
} else {
const match = useRouteMatch == null ? void 0 : useRouteMatch();
if (useHistory) {
const history = useHistory == null ? void 0 : useHistory();
basename = (_a = history == null ? void 0 : history.createHref) == null ? void 0 : _a.call(history, { pathname: "/" });
}
if (match) {
basename = pathJoin(basename, (match == null ? void 0 : match.path) || "/");
}
}
}
const LazyComponent = useMemo(() => {

@@ -83,0 +114,0 @@ return React__default.lazy(async () => {

@@ -5,3 +5,3 @@ "use strict";

const ReactRouterDom = require("react-router-dom/");
const context = require("./context-ePt4wynZ.cjs");
const context = require("./context--mtFt3tp.cjs");
function _interopNamespaceDefault(e) {

@@ -8,0 +8,0 @@ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });

import React__default, { useContext } from "react";
import * as ReactRouterDom from "react-router-dom/";
export * from "react-router-dom/";
import { R as RouterContext, L as LoggerInstance } from "./context-CPtN38Ur.js";
import { R as RouterContext, L as LoggerInstance } from "./context-Bw2PEwa6.js";
function WraperRouter(props) {

@@ -6,0 +6,0 @@ const { basename, ...propsRes } = props;

{
"name": "@module-federation/bridge-react",
"version": "0.0.0-next-20240620052430",
"version": "0.0.0-next-20240620060503",
"publishConfig": {

@@ -28,3 +28,3 @@ "access": "public"

"react-error-boundary": "^4.0.13",
"@module-federation/bridge-shared": "0.0.0-next-20240620052430"
"@module-federation/bridge-shared": "0.0.0-next-20240620060503"
},

@@ -31,0 +31,0 @@ "peerDependencies": {

@@ -24,1 +24,19 @@ import React from 'react';

}
export function pathJoin(...args: string[]) {
const res = args.reduce((res, path: string) => {
let nPath = path;
if (!nPath || typeof nPath !== 'string') {
return res;
}
if (nPath[0] !== '/') {
nPath = `/${nPath}`;
}
const lastIndex = nPath.length - 1;
if (nPath[lastIndex] === '/') {
nPath = nPath.substring(0, lastIndex);
}
return res + nPath;
}, '');
return res || '/';
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc