webpack-sources
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -76,2 +76,3 @@ /* | ||
if(m2rBestFit) { | ||
var allowMiddleName = false; | ||
var middleLine; | ||
@@ -86,3 +87,2 @@ var rightSourceContent; | ||
rightSource && | ||
m2rBestFit.generatedColumn !== middleMapping.column && | ||
(middleLine = middleSourceLines[m2rBestFit.generatedLine - 1]) && | ||
@@ -103,18 +103,27 @@ ((rightSourceContentLines = rightSourceContentsLines[rightSource]) || | ||
var offset = middleMapping.column - m2rBestFit.generatedColumn; | ||
var middlePart = middleLine.slice( | ||
m2rBestFit.generatedColumn, | ||
middleMapping.column | ||
); | ||
var rightPart = rightLine.slice( | ||
m2rBestFit.originalColumn, | ||
m2rBestFit.originalColumn + offset | ||
); | ||
if(middlePart === rightPart) { | ||
// When original and generated code is equal we assume we have an "identity" mapping | ||
// In this case we can offset the original position | ||
m2rBestFit = Object.assign({}, m2rBestFit, { | ||
originalColumn: m2rBestFit.originalColumn + offset, | ||
generatedColumn: middleMapping.column | ||
}); | ||
if(offset > 0) { | ||
var middlePart = middleLine.slice( | ||
m2rBestFit.generatedColumn, | ||
middleMapping.column | ||
); | ||
var rightPart = rightLine.slice( | ||
m2rBestFit.originalColumn, | ||
m2rBestFit.originalColumn + offset | ||
); | ||
if(middlePart === rightPart) { | ||
// When original and generated code is equal we assume we have an "identity" mapping | ||
// In this case we can offset the original position | ||
m2rBestFit = Object.assign({}, m2rBestFit, { | ||
originalColumn: m2rBestFit.originalColumn + offset, | ||
generatedColumn: middleMapping.column | ||
}); | ||
} | ||
} | ||
if(!m2rBestFit.name && middleMapping.name) { | ||
allowMiddleName = | ||
rightLine.slice( | ||
m2rBestFit.originalColumn, | ||
m2rBestFit.originalColumn + middleMapping.name.length | ||
) === middleMapping.name; | ||
} | ||
} | ||
@@ -131,3 +140,3 @@ } | ||
chunk, | ||
m2rBestFit.name || middleMapping.name | ||
allowMiddleName ? middleMapping.name : m2rBestFit.name | ||
) | ||
@@ -134,0 +143,0 @@ ); |
{ | ||
"name": "webpack-sources", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Source code handling classes for webpack", | ||
@@ -25,3 +25,3 @@ "main": "./lib/index.js", | ||
"coveralls": "^2.11.6", | ||
"eslint": "^3.19.0", | ||
"eslint": "^4.18.2", | ||
"eslint-plugin-nodeca": "^1.0.3", | ||
@@ -28,0 +28,0 @@ "istanbul": "^0.4.1", |
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
36675
959