webpack-sources
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -46,2 +46,3 @@ /* | ||
this._cachedMaps = cachedData ? cachedData.maps : new Map(); | ||
this._cachedHashUpdate = cachedData ? cachedData.hash : undefined; | ||
} | ||
@@ -78,3 +79,4 @@ | ||
size: this._cachedSize, | ||
maps: bufferedMaps | ||
maps: bufferedMaps, | ||
hash: this._cachedHashUpdate | ||
}; | ||
@@ -180,3 +182,35 @@ } | ||
updateHash(hash) { | ||
this.original().updateHash(hash); | ||
if (this._cachedHashUpdate !== undefined) { | ||
for (const item of this._cachedHashUpdate) hash.update(item); | ||
return; | ||
} | ||
const update = []; | ||
let currentString = undefined; | ||
const tracker = { | ||
update: item => { | ||
if (typeof item === "string" && item.length < 10240) { | ||
if (currentString === undefined) { | ||
currentString = item; | ||
} else { | ||
currentString += item; | ||
if (currentString > 102400) { | ||
update.push(Buffer.from(currentString)); | ||
currentString = undefined; | ||
} | ||
} | ||
} else { | ||
if (currentString !== undefined) { | ||
update.push(Buffer.from(currentString)); | ||
currentString = undefined; | ||
} | ||
update.push(item); | ||
} | ||
} | ||
}; | ||
this.original().updateHash(tracker); | ||
if (currentString !== undefined) { | ||
update.push(Buffer.from(currentString)); | ||
} | ||
for (const item of update) hash.update(item); | ||
this._cachedHashUpdate = update; | ||
} | ||
@@ -183,0 +217,0 @@ } |
{ | ||
"name": "webpack-sources", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"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
55066
1652