webpack-named-moduleids-plugin
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10587
6
250