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

webpack-named-moduleids-plugin

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-named-moduleids-plugin - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "webpack-named-moduleids-plugin",
"version": "1.0.1",
"version": "1.0.2",
"description": "base on packagename+version to generator module id ",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -86,6 +86,7 @@ /*

this.bulkHash = new BulkUpdateDecorator(hash);
this.localRegex = /[\\/]node_modules[\\/]([^\\/]*)[\\/].*/i;
this.foldRegex = /@([^@]+)@/g;
this.versionRegex = /@([\d\.]+)@/;
this.rootRegex = /@@([^@]+)/;
this.localRegex = /[\\/]node_modules[\\/]([^\\/]+)[\\/].*/i; // node_modules后面紧跟的一级目录
this.foldRegex = /@([^@]+)@/g; // 匹配一级目录
this.versionRegex = /@([\d\.]+)@/; // 匹配flatten中的版本号
this.rootRegex = /@@([^@]+)/; // 匹配flatten中的scope名称
this.scopeRegex = /@[^@\\/]+[\\/][^\\/]+[\\/]/; // 匹配非flatten的scope包名
this.enforeModules = enforeModules;

@@ -100,2 +101,3 @@ }

}
console.log(data);
if (absContext.startsWith(projectDir)) {

@@ -114,2 +116,3 @@ // const pkg = require(path.join(projectDir, 'package.json'));

let version = versionMatchs && versionMatchs[1];
// 这里处理flatten格式的
if (rootRegexMatchs && rootRegexMatchs[1]) {

@@ -128,2 +131,9 @@ const rootName = rootRegexMatchs[1]

}
// 这里处理未flatten,但是有scope的
if (/^@/.test(flattenName)) {
const scopeMatchs = this.scopeRegex.exec(absContext);
if (scopeMatchs && scopeMatchs[0]) {
flattenName = scopeMatchs[0].slice(0, -1);
}
}
const pkgData = require(path.join(projectDir, 'node_modules', flattenName, 'package.json'));

@@ -130,0 +140,0 @@ const { name } = pkgData;

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