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

@module-federation/bridge-react-webpack-plugin

Package Overview
Dependencies
Maintainers
8
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.0-next-20240912070754 to 0.0.0-next-20240913081127

10

CHANGELOG.md
# @module-federation/bridge-react-webpack-plugin
## 0.0.0-next-20240912070754
## 0.0.0-next-20240913081127
### Patch Changes
- @module-federation/sdk@0.0.0-next-20240912070754
- @module-federation/sdk@0.0.0-next-20240913081127
## 0.6.3
### Patch Changes
- @module-federation/sdk@0.6.3
## 0.6.2

@@ -10,0 +16,0 @@

59

dist/index.cjs.js

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

};
const getBridgeRouterAlias = (originalAlias) => {
const getDependencies = () => {
const userPackageJsonPath = path.resolve(process.cwd(), "package.json");

@@ -1664,24 +1664,11 @@ let userDependencies = {};

}
return userDependencies;
};
const reactRouterDomV5AliasPath = "@module-federation/bridge-react/dist/router-v5.es.js";
const reactRouterDomV6AliasPath = "@module-federation/bridge-react/dist/router-v6.es.js";
const setRouterAlias = (majorVersion, reactRouterDomPath) => {
let bridgeRouterAlias = {};
let majorVersion = 0;
let reactRouterDomPath = "";
const reactRouterDomVersion = userDependencies["react-router-dom"];
if (originalAlias) {
reactRouterDomPath = originalAlias;
} else if (reactRouterDomVersion) {
majorVersion = checkVersion(reactRouterDomVersion);
reactRouterDomPath = require.resolve("react-router-dom");
} else {
reactRouterDomPath = require.resolve("react-router-dom");
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
majorVersion = checkVersion(packageJson.version);
} else {
console.warn("Unable to find package.json for react-router-dom");
}
if (majorVersion === 5) {
bridgeRouterAlias = {
"react-router-dom$": "@module-federation/bridge-react/dist/router-v5.es.js"
"react-router-dom$": reactRouterDomV5AliasPath
};

@@ -1698,3 +1685,3 @@ try {

bridgeRouterAlias = {
"react-router-dom$": "@module-federation/bridge-react/dist/router-v6.es.js"
"react-router-dom$": reactRouterDomV6AliasPath
};

@@ -1709,11 +1696,29 @@ try {

}
} else {
console.warn("react-router-dom version is not supported");
}
console.log(
"<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
};
const getBridgeRouterAlias = (originalAlias) => {
const userDependencies = getDependencies();
const reactRouterDomPath = originalAlias ? originalAlias : userDependencies["react-router-dom"] ? require.resolve("react-router-dom") : "";
const packageJsonPath = reactRouterDomPath ? findPackageJson(reactRouterDomPath) : "";
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
const majorVersion = checkVersion(packageJson.version);
const bridgeRouterAlias = setRouterAlias(majorVersion, reactRouterDomPath);
console.log(
"<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
} else {
const bridgeRouterAlias = {
"react-router-dom$": reactRouterDomV6AliasPath
};
console.log(
"<<<<<<<<<<<<< default bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
}
};
class ReactBridgeAliasChangerPlugin {

@@ -1720,0 +1725,0 @@ constructor(info) {

@@ -1629,3 +1629,3 @@ var __defProp = Object.defineProperty;

};
const getBridgeRouterAlias = (originalAlias) => {
const getDependencies = () => {
const userPackageJsonPath = path.resolve(process.cwd(), "package.json");

@@ -1642,24 +1642,11 @@ let userDependencies = {};

}
return userDependencies;
};
const reactRouterDomV5AliasPath = "@module-federation/bridge-react/dist/router-v5.es.js";
const reactRouterDomV6AliasPath = "@module-federation/bridge-react/dist/router-v6.es.js";
const setRouterAlias = (majorVersion, reactRouterDomPath) => {
let bridgeRouterAlias = {};
let majorVersion = 0;
let reactRouterDomPath = "";
const reactRouterDomVersion = userDependencies["react-router-dom"];
if (originalAlias) {
reactRouterDomPath = originalAlias;
} else if (reactRouterDomVersion) {
majorVersion = checkVersion(reactRouterDomVersion);
reactRouterDomPath = require.resolve("react-router-dom");
} else {
reactRouterDomPath = require.resolve("react-router-dom");
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
majorVersion = checkVersion(packageJson.version);
} else {
console.warn("Unable to find package.json for react-router-dom");
}
if (majorVersion === 5) {
bridgeRouterAlias = {
"react-router-dom$": "@module-federation/bridge-react/dist/router-v5.es.js"
"react-router-dom$": reactRouterDomV5AliasPath
};

@@ -1676,3 +1663,3 @@ try {

bridgeRouterAlias = {
"react-router-dom$": "@module-federation/bridge-react/dist/router-v6.es.js"
"react-router-dom$": reactRouterDomV6AliasPath
};

@@ -1687,11 +1674,29 @@ try {

}
} else {
console.warn("react-router-dom version is not supported");
}
console.log(
"<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
};
const getBridgeRouterAlias = (originalAlias) => {
const userDependencies = getDependencies();
const reactRouterDomPath = originalAlias ? originalAlias : userDependencies["react-router-dom"] ? require.resolve("react-router-dom") : "";
const packageJsonPath = reactRouterDomPath ? findPackageJson(reactRouterDomPath) : "";
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
const majorVersion = checkVersion(packageJson.version);
const bridgeRouterAlias = setRouterAlias(majorVersion, reactRouterDomPath);
console.log(
"<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
} else {
const bridgeRouterAlias = {
"react-router-dom$": reactRouterDomV6AliasPath
};
console.log(
"<<<<<<<<<<<<< default bridgeRouterAlias >>>>>>>>>>>>>",
bridgeRouterAlias
);
return bridgeRouterAlias;
}
};
class ReactBridgeAliasChangerPlugin {

@@ -1698,0 +1703,0 @@ constructor(info) {

{
"name": "@module-federation/bridge-react-webpack-plugin",
"version": "0.0.0-next-20240912070754",
"version": "0.0.0-next-20240913081127",
"publishConfig": {

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

"@types/semver": "7.5.8",
"@module-federation/sdk": "0.0.0-next-20240912070754"
"@module-federation/sdk": "0.0.0-next-20240913081127"
},

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

@@ -33,5 +33,3 @@ import fs from 'node:fs';

export const getBridgeRouterAlias = (
originalAlias: string,
): Record<string, string> => {
const getDependencies = () => {
const userPackageJsonPath = path.resolve(process.cwd(), 'package.json');

@@ -49,31 +47,15 @@ let userDependencies: Record<string, string> = {};

}
return userDependencies;
};
const reactRouterDomV5AliasPath =
'@module-federation/bridge-react/dist/router-v5.es.js';
const reactRouterDomV6AliasPath =
'@module-federation/bridge-react/dist/router-v6.es.js';
const setRouterAlias = (majorVersion: number, reactRouterDomPath: string) => {
let bridgeRouterAlias = {};
let majorVersion = 0;
let reactRouterDomPath = '';
const reactRouterDomVersion = userDependencies['react-router-dom'];
if (originalAlias) {
reactRouterDomPath = originalAlias;
} else if (reactRouterDomVersion) {
majorVersion = checkVersion(reactRouterDomVersion);
reactRouterDomPath = require.resolve('react-router-dom');
} else {
reactRouterDomPath = require.resolve('react-router-dom');
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
majorVersion = checkVersion(packageJson.version);
} else {
console.warn('Unable to find package.json for react-router-dom');
}
if (majorVersion === 5) {
bridgeRouterAlias = {
'react-router-dom$':
'@module-federation/bridge-react/dist/router-v5.es.js',
'react-router-dom$': reactRouterDomV5AliasPath,
};

@@ -91,6 +73,4 @@ try {

bridgeRouterAlias = {
'react-router-dom$':
'@module-federation/bridge-react/dist/router-v6.es.js',
'react-router-dom$': reactRouterDomV6AliasPath,
};
try {

@@ -105,11 +85,38 @@ require.resolve('react-router-dom/dist/index.js');

}
} else {
console.warn('react-router-dom version is not supported');
}
console.log(
'<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>',
bridgeRouterAlias,
);
return bridgeRouterAlias;
};
export const getBridgeRouterAlias = (
originalAlias: string,
): Record<string, string> => {
const userDependencies = getDependencies();
const reactRouterDomPath = originalAlias
? originalAlias
: userDependencies['react-router-dom']
? require.resolve('react-router-dom')
: '';
const packageJsonPath = reactRouterDomPath
? findPackageJson(reactRouterDomPath)
: '';
// if find react-router-dom in package.json
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
const majorVersion = checkVersion(packageJson.version);
const bridgeRouterAlias = setRouterAlias(majorVersion, reactRouterDomPath);
console.log(
'<<<<<<<<<<<<< bridgeRouterAlias >>>>>>>>>>>>>',
bridgeRouterAlias,
);
return bridgeRouterAlias;
} else {
const bridgeRouterAlias = {
'react-router-dom$': reactRouterDomV6AliasPath,
};
console.log(
'<<<<<<<<<<<<< default bridgeRouterAlias >>>>>>>>>>>>>',
bridgeRouterAlias,
);
return bridgeRouterAlias;
}
};
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