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-20240826075118 to 0.0.0-next-20240826081819

10

CHANGELOG.md
# @module-federation/bridge-react-webpack-plugin
## 0.0.0-next-20240826075118
## 0.0.0-next-20240826081819
### Patch Changes
- @module-federation/sdk@0.0.0-next-20240826075118
## 0.5.2
### Patch Changes
- Updated dependencies [b90fa7d]
- @module-federation/sdk@0.5.2
- @module-federation/sdk@0.0.0-next-20240826081819

@@ -16,0 +10,0 @@ ## 0.5.1

43

dist/index.cjs.js

@@ -1628,2 +1628,25 @@ "use strict";

const semver$1 = /* @__PURE__ */ getDefaultExportFromCjs(semver);
const checkVersion = (version) => {
const versionMatch = version.match(/\d.*/);
if (!versionMatch)
return 0;
const cleanVersion = versionMatch[0];
if (semver$1.gte(cleanVersion, "5.0.0") && semver$1.lt(cleanVersion, "6.0.0")) {
return 5;
} else if (semver$1.gte(cleanVersion, "6.0.0")) {
return 6;
}
return 0;
};
const findPackageJson = (startPath) => {
let currentPath = startPath;
while (currentPath !== path.parse(currentPath).root) {
const packageJsonPath = path.join(currentPath, "package.json");
if (fs.existsSync(packageJsonPath)) {
return packageJsonPath;
}
currentPath = path.dirname(currentPath);
}
return null;
};
const getBridgeRouterAlias = (originalAlias) => {

@@ -1647,17 +1670,17 @@ const userPackageJsonPath = path.resolve(process.cwd(), "package.json");

let reactRouterDomPath = "";
if (reactRouterDomVersion) {
majorVersion = semver$1.major(
semver$1.coerce(reactRouterDomVersion || "0.0.0") ?? "0.0.0"
);
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 = path.resolve(
reactRouterDomPath,
"../../package.json"
);
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
majorVersion = parseInt(packageJson.version.split(".")[0]);
majorVersion = checkVersion(packageJson.version);
} else {
console.warn("Unable to find package.json for react-router-dom");
}
reactRouterDomPath = originalAlias || reactRouterDomPath;
if (majorVersion === 5) {

@@ -1664,0 +1687,0 @@ bridgeRouterAlias = {

@@ -1606,2 +1606,25 @@ var __defProp = Object.defineProperty;

const semver$1 = /* @__PURE__ */ getDefaultExportFromCjs(semver);
const checkVersion = (version) => {
const versionMatch = version.match(/\d.*/);
if (!versionMatch)
return 0;
const cleanVersion = versionMatch[0];
if (semver$1.gte(cleanVersion, "5.0.0") && semver$1.lt(cleanVersion, "6.0.0")) {
return 5;
} else if (semver$1.gte(cleanVersion, "6.0.0")) {
return 6;
}
return 0;
};
const findPackageJson = (startPath) => {
let currentPath = startPath;
while (currentPath !== path.parse(currentPath).root) {
const packageJsonPath = path.join(currentPath, "package.json");
if (fs.existsSync(packageJsonPath)) {
return packageJsonPath;
}
currentPath = path.dirname(currentPath);
}
return null;
};
const getBridgeRouterAlias = (originalAlias) => {

@@ -1625,17 +1648,17 @@ const userPackageJsonPath = path.resolve(process.cwd(), "package.json");

let reactRouterDomPath = "";
if (reactRouterDomVersion) {
majorVersion = semver$1.major(
semver$1.coerce(reactRouterDomVersion || "0.0.0") ?? "0.0.0"
);
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 = path.resolve(
reactRouterDomPath,
"../../package.json"
);
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
majorVersion = parseInt(packageJson.version.split(".")[0]);
majorVersion = checkVersion(packageJson.version);
} else {
console.warn("Unable to find package.json for react-router-dom");
}
reactRouterDomPath = originalAlias || reactRouterDomPath;
if (majorVersion === 5) {

@@ -1642,0 +1665,0 @@ bridgeRouterAlias = {

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

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

"@types/semver": "7.5.8",
"@module-federation/sdk": "0.0.0-next-20240826075118"
"@module-federation/sdk": "0.0.0-next-20240826081819"
},

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

@@ -5,2 +5,30 @@ import fs from 'node:fs';

const checkVersion = (version: string) => {
// Extract the version number starting from the first digit
const versionMatch = version.match(/\d.*/);
if (!versionMatch) return 0;
const cleanVersion = versionMatch[0];
if (semver.gte(cleanVersion, '5.0.0') && semver.lt(cleanVersion, '6.0.0')) {
return 5;
} else if (semver.gte(cleanVersion, '6.0.0')) {
return 6;
}
return 0;
};
const findPackageJson = (startPath: string): string | null => {
let currentPath = startPath;
while (currentPath !== path.parse(currentPath).root) {
const packageJsonPath = path.join(currentPath, 'package.json');
if (fs.existsSync(packageJsonPath)) {
return packageJsonPath;
}
currentPath = path.dirname(currentPath);
}
return null;
};
export const getBridgeRouterAlias = (

@@ -32,22 +60,19 @@ originalAlias: string,

// if react-router-dom version is set, use the version in package.json
if (reactRouterDomVersion) {
majorVersion = semver.major(
semver.coerce(reactRouterDomVersion || '0.0.0') ?? '0.0.0',
);
if (originalAlias) {
reactRouterDomPath = originalAlias;
} else if (reactRouterDomVersion) {
majorVersion = checkVersion(reactRouterDomVersion);
reactRouterDomPath = require.resolve('react-router-dom');
} else {
// if react-router-dom version is not set, reslove react-router-dom to get the version
reactRouterDomPath = require.resolve('react-router-dom');
const packageJsonPath = path.resolve(
reactRouterDomPath,
'../../package.json',
);
}
const packageJsonPath = findPackageJson(reactRouterDomPath);
if (packageJsonPath) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
majorVersion = parseInt(packageJson.version.split('.')[0]);
majorVersion = checkVersion(packageJson.version);
} else {
console.warn('Unable to find package.json for react-router-dom');
}
// if react-router-dom path has set alias by user, use the originalAlias
reactRouterDomPath = originalAlias || reactRouterDomPath;
if (majorVersion === 5) {

@@ -54,0 +79,0 @@ 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