webpack-sources
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -49,2 +49,18 @@ /* | ||
const findM2rMapping = (line, column) => { | ||
const m2rMappings = m2rMappingsByLine[line]; | ||
let l = 0; | ||
let r = m2rMappings.length; | ||
while (l < r) { | ||
let m = (l + r) >> 1; | ||
if (m2rMappings[m].generatedColumn <= column) { | ||
l = m + 1; | ||
} else { | ||
r = m; | ||
} | ||
} | ||
if (l === 0) return undefined; | ||
return m2rMappings[l - 1]; | ||
}; | ||
// Store all source contents | ||
@@ -66,10 +82,5 @@ sourceNode.walkSourceContents(function (source, content) { | ||
) { | ||
let m2rBestFit; | ||
const m2rMappings = m2rMappingsByLine[middleMapping.line]; | ||
// Note: if this becomes a performance problem, use binary search | ||
for (let i = 0; i < m2rMappings.length; i++) { | ||
if (m2rMappings[i].generatedColumn <= middleMapping.column) { | ||
m2rBestFit = m2rMappings[i]; | ||
} | ||
} | ||
// For minimized sources this is performance-relevant, | ||
// since all mappings are in a single line, use a binary search | ||
let m2rBestFit = findM2rMapping(middleMapping.line, middleMapping.column); | ||
if (m2rBestFit) { | ||
@@ -76,0 +87,0 @@ let allowMiddleName = false; |
{ | ||
"name": "webpack-sources", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Source code handling classes for webpack", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
54089
1618