New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/bridge-react

Package Overview
Dependencies
Maintainers
0
Versions
372
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-20241107072243 to 0.0.0-next-20241108091829

dist/context-Dh6IUBWT.js

8

CHANGELOG.md
# @module-federation/bridge-react
## 0.0.0-next-20241107072243
## 0.0.0-next-20241108091829

@@ -11,5 +11,5 @@ ### Patch Changes

- Updated dependencies [3082116]
- @module-federation/runtime@0.0.0-next-20241107072243
- @module-federation/sdk@0.0.0-next-20241107072243
- @module-federation/bridge-shared@0.0.0-next-20241107072243
- @module-federation/runtime@0.0.0-next-20241108091829
- @module-federation/sdk@0.0.0-next-20241108091829
- @module-federation/bridge-shared@0.0.0-next-20241108091829

@@ -16,0 +16,0 @@ ## 0.7.0

"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const React = require("react");
const context = require("./context-BBLu8BlQ.cjs");
const context = require("./context-DmzxwI_7.cjs");
const ReactRouterDOM = require("react-router-dom");

@@ -125,16 +125,2 @@ const runtime = require("@module-federation/runtime");

}
const getModuleName = (id) => {
const idArray = id.split("/");
if (idArray.length < 2) {
return id;
}
return idArray[0] + "/" + idArray[1];
};
const getRootDomDefaultClassName = (moduleName) => {
if (!moduleName) {
return "";
}
const name = getModuleName(moduleName).replace(/\@/, "").replace(/\//, "-");
return `bridge-root-component-${name}`;
};
const RemoteAppWrapper = React.forwardRef(function(props, ref) {

@@ -160,3 +146,3 @@ const host = runtime.getInstance();

const renderTimeout = setTimeout(() => {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const providerReturn = providerInfo();

@@ -177,13 +163,6 @@ providerInfoRef.current = providerReturn;

);
if ((host == null ? void 0 : host.bridgeHook) && ((_b = (_a = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender)) {
const beforeBridgeRenderRes = (_d = (_c = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _c.lifecycle) == null ? void 0 : _d.beforeBridgeRender.emit({
...renderProps
});
const extraProps = beforeBridgeRenderRes && typeof beforeBridgeRenderRes === "object" && (beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps) ? beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps : {};
renderProps = {
...renderProps,
...extraProps
};
}
const beforeBridgeRenderRes = ((_c = (_b = (_a = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(renderProps)) || {};
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
providerReturn.render(renderProps);
(_f = (_e = (_d = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
});

@@ -193,3 +172,3 @@ return () => {

setTimeout(() => {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h;
if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {

@@ -200,16 +179,22 @@ context.LoggerInstance.log(

);
if ((host == null ? void 0 : host.bridgeHook) && ((_c = (_b = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.afterBridgeDestroy)) {
(_e = (_d = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
}
(_f = providerInfoRef.current) == null ? void 0 : _f.destroy({
(_d = (_c = (_b = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
(_e = providerInfoRef.current) == null ? void 0 : _e.destroy({
moduleName,
dom: renderDom.current
});
(_h = (_g = (_f = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
}

@@ -219,3 +204,3 @@ });

}, []);
const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${props == null ? void 0 : props.className}`;
const rootComponentClassName = `${context.getRootDomDefaultClassName(moduleName)} ${props == null ? void 0 : props.className}`;
return /* @__PURE__ */ React.createElement(

@@ -396,3 +381,3 @@ "div",

async render(info) {
var _a, _b;
var _a, _b, _c, _d;
context.LoggerInstance.log(`createBridgeComponent render Info`, info);

@@ -407,5 +392,8 @@ const {

} = info;
const beforeBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeRender) || ((_a = params == null ? void 0 : params.hooks) == null ? void 0 : _a.beforeBridgeRender);
const beforeBridgeRenderRes = beforeBridgeRender && beforeBridgeRender(info);
const extraProps = beforeBridgeRenderRes && typeof beforeBridgeRenderRes === "object" && (beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps) ? beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps : {};
const moduleNameWithoutExpose = context.getModuleName(moduleName);
const instance = __FEDERATION__.__INSTANCES__.find(
(v) => v.name === moduleNameWithoutExpose
);
context.LoggerInstance.log(`createBridgeComponent remote instance`, instance);
const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(info)) || {};
const rootComponentWithErrorBoundary = (

@@ -421,3 +409,3 @@ // set ErrorBoundary for RawComponent rendering error, usually caused by user app rendering error

},
propsInfo: { ...propsInfo, ...extraProps }
propsInfo: { ...propsInfo, ...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps }
}

@@ -440,12 +428,20 @@ ))

}
const afterBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_b = params == null ? void 0 : params.hooks) == null ? void 0 : _b.afterBridgeRender);
const afterBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_d = params == null ? void 0 : params.hooks) == null ? void 0 : _d.afterBridgeRender);
afterBridgeRender && afterBridgeRender(info);
},
async destroy(info) {
var _a, _b;
var _a, _b, _c, _d, _e, _f;
context.LoggerInstance.log(`createBridgeComponent destroy Info`, {
dom: info.dom
});
const beforeBridgeDestroy = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeDestroy) || ((_a = params == null ? void 0 : params.hooks) == null ? void 0 : _a.beforeBridgeDestroy);
beforeBridgeDestroy && beforeBridgeDestroy(info);
const moduleNameWithoutExpose = context.getModuleName(info.moduleName);
context.LoggerInstance.log(
`createBridgeComponent remote module without expose name >>>`,
moduleNameWithoutExpose
);
const instance = __FEDERATION__.__INSTANCES__.find(
(v) => v.name === moduleNameWithoutExpose
);
context.LoggerInstance.log(`createBridgeComponent remote instance`, instance);
(_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(info);
if (context.atLeastReact18(React__namespace)) {

@@ -458,4 +454,3 @@ const root = rootMap.get(info.dom);

}
const afterBridgeDestroy = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_b = params == null ? void 0 : params.hooks) == null ? void 0 : _b.afterBridgeDestroy);
afterBridgeDestroy && afterBridgeDestroy(info);
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(info);
},

@@ -462,0 +457,0 @@ rawComponent: bridgeInfo.rootComponent,

import * as React from "react";
import React__default, { createContext, Component, createElement, isValidElement, forwardRef, useRef, useEffect, useContext, useState } from "react";
import { L as LoggerInstance, p as pathJoin, a as atLeastReact18, R as RouterContext } from "./context-BcyT-d0V.js";
import { L as LoggerInstance, g as getRootDomDefaultClassName, p as pathJoin, a as getModuleName, b as atLeastReact18, R as RouterContext } from "./context-Dh6IUBWT.js";
import * as ReactRouterDOM from "react-router-dom";

@@ -106,16 +106,2 @@ import { getInstance } from "@module-federation/runtime";

}
const getModuleName = (id) => {
const idArray = id.split("/");
if (idArray.length < 2) {
return id;
}
return idArray[0] + "/" + idArray[1];
};
const getRootDomDefaultClassName = (moduleName) => {
if (!moduleName) {
return "";
}
const name = getModuleName(moduleName).replace(/\@/, "").replace(/\//, "-");
return `bridge-root-component-${name}`;
};
const RemoteAppWrapper = forwardRef(function(props, ref) {

@@ -141,3 +127,3 @@ const host = getInstance();

const renderTimeout = setTimeout(() => {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const providerReturn = providerInfo();

@@ -158,13 +144,6 @@ providerInfoRef.current = providerReturn;

);
if ((host == null ? void 0 : host.bridgeHook) && ((_b = (_a = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender)) {
const beforeBridgeRenderRes = (_d = (_c = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _c.lifecycle) == null ? void 0 : _d.beforeBridgeRender.emit({
...renderProps
});
const extraProps = beforeBridgeRenderRes && typeof beforeBridgeRenderRes === "object" && (beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps) ? beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps : {};
renderProps = {
...renderProps,
...extraProps
};
}
const beforeBridgeRenderRes = ((_c = (_b = (_a = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(renderProps)) || {};
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
providerReturn.render(renderProps);
(_f = (_e = (_d = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
});

@@ -174,3 +153,3 @@ return () => {

setTimeout(() => {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h;
if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {

@@ -181,16 +160,22 @@ LoggerInstance.log(

);
if ((host == null ? void 0 : host.bridgeHook) && ((_c = (_b = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.afterBridgeDestroy)) {
(_e = (_d = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
}
(_f = providerInfoRef.current) == null ? void 0 : _f.destroy({
(_d = (_c = (_b = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
(_e = providerInfoRef.current) == null ? void 0 : _e.destroy({
moduleName,
dom: renderDom.current
});
(_h = (_g = (_f = host == null ? void 0 : host.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
moduleName,
dom: renderDom.current,
basename,
memoryRoute,
fallback,
...resProps
});
}

@@ -376,3 +361,3 @@ });

async render(info) {
var _a, _b;
var _a, _b, _c, _d;
LoggerInstance.log(`createBridgeComponent render Info`, info);

@@ -387,5 +372,8 @@ const {

} = info;
const beforeBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeRender) || ((_a = params == null ? void 0 : params.hooks) == null ? void 0 : _a.beforeBridgeRender);
const beforeBridgeRenderRes = beforeBridgeRender && beforeBridgeRender(info);
const extraProps = beforeBridgeRenderRes && typeof beforeBridgeRenderRes === "object" && (beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps) ? beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps : {};
const moduleNameWithoutExpose = getModuleName(moduleName);
const instance = __FEDERATION__.__INSTANCES__.find(
(v) => v.name === moduleNameWithoutExpose
);
LoggerInstance.log(`createBridgeComponent remote instance`, instance);
const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(info)) || {};
const rootComponentWithErrorBoundary = (

@@ -401,3 +389,3 @@ // set ErrorBoundary for RawComponent rendering error, usually caused by user app rendering error

},
propsInfo: { ...propsInfo, ...extraProps }
propsInfo: { ...propsInfo, ...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps }
}

@@ -420,12 +408,20 @@ ))

}
const afterBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_b = params == null ? void 0 : params.hooks) == null ? void 0 : _b.afterBridgeRender);
const afterBridgeRender = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_d = params == null ? void 0 : params.hooks) == null ? void 0 : _d.afterBridgeRender);
afterBridgeRender && afterBridgeRender(info);
},
async destroy(info) {
var _a, _b;
var _a, _b, _c, _d, _e, _f;
LoggerInstance.log(`createBridgeComponent destroy Info`, {
dom: info.dom
});
const beforeBridgeDestroy = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.beforeBridgeDestroy) || ((_a = params == null ? void 0 : params.hooks) == null ? void 0 : _a.beforeBridgeDestroy);
beforeBridgeDestroy && beforeBridgeDestroy(info);
const moduleNameWithoutExpose = getModuleName(info.moduleName);
LoggerInstance.log(
`createBridgeComponent remote module without expose name >>>`,
moduleNameWithoutExpose
);
const instance = __FEDERATION__.__INSTANCES__.find(
(v) => v.name === moduleNameWithoutExpose
);
LoggerInstance.log(`createBridgeComponent remote instance`, instance);
(_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(info);
if (atLeastReact18(React)) {

@@ -438,4 +434,3 @@ const root = rootMap.get(info.dom);

}
const afterBridgeDestroy = (bridgeInfo == null ? void 0 : bridgeInfo.hooks) && (bridgeInfo == null ? void 0 : bridgeInfo.hooks.afterBridgeDestroy) || ((_b = params == null ? void 0 : params.hooks) == null ? void 0 : _b.afterBridgeDestroy);
afterBridgeDestroy && afterBridgeDestroy(info);
(_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(info);
},

@@ -442,0 +437,0 @@ rawComponent: bridgeInfo.rootComponent,

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

const ReactRouterDom$1 = require("react-router-dom/index.js");
const context = require("./context-BBLu8BlQ.cjs");
const context = require("./context-DmzxwI_7.cjs");
const ReactRouterDom = require("react-router-dom/index.js");

@@ -8,0 +8,0 @@ function _interopNamespaceDefault(e) {

import React__default, { useContext } from "react";
import * as ReactRouterDom$1 from "react-router-dom/index.js";
import { R as RouterContext, L as LoggerInstance } from "./context-BcyT-d0V.js";
import { R as RouterContext, L as LoggerInstance } from "./context-Dh6IUBWT.js";
export * from "react-router-dom/index.js";

@@ -5,0 +5,0 @@ function WraperRouter(props) {

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

const ReactRouterDom = require("react-router-dom/dist/index.js");
const context = require("./context-BBLu8BlQ.cjs");
const context = require("./context-DmzxwI_7.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/dist/index.js";
export * from "react-router-dom/dist/index.js";
import { R as RouterContext, L as LoggerInstance } from "./context-BcyT-d0V.js";
import { R as RouterContext, L as LoggerInstance } from "./context-Dh6IUBWT.js";
function WraperRouter(props) {

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

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

const ReactRouterDom = require("react-router-dom/");
const context = require("./context-BBLu8BlQ.cjs");
const context = require("./context-DmzxwI_7.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-BcyT-d0V.js";
import { R as RouterContext, L as LoggerInstance } from "./context-Dh6IUBWT.js";
function WrapperRouter(props) {

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

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

@@ -44,4 +44,4 @@ "access": "public"

"react-error-boundary": "^4.0.13",
"@module-federation/bridge-shared": "0.0.0-next-20241107072243",
"@module-federation/sdk": "0.0.0-next-20241107072243"
"@module-federation/bridge-shared": "0.0.0-next-20241108091829",
"@module-federation/sdk": "0.0.0-next-20241108091829"
},

@@ -52,3 +52,3 @@ "peerDependencies": {

"react-router-dom": ">=4",
"@module-federation/runtime": "0.0.0-next-20241107072243"
"@module-federation/runtime": "0.0.0-next-20241108091829"
},

@@ -55,0 +55,0 @@ "devDependencies": {

@@ -44,1 +44,22 @@ import React from 'react';

}
export const getModuleName = (id: string) => {
if (!id) {
return id;
}
// separate module name without detailed module path
// @vmok-e2e/edenx-demo-app2/button -> @vmok-e2e/edenx-demo-app2
const idArray = id.split('/');
if (idArray.length < 2) {
return id;
}
return idArray[0] + '/' + idArray[1];
};
export const getRootDomDefaultClassName = (moduleName: string) => {
if (!moduleName) {
return '';
}
const name = getModuleName(moduleName).replace(/\@/, '').replace(/\//, '-');
return `bridge-root-component-${name}`;
};

Sorry, the diff of this file is not supported yet

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