MCPcopy
hub / github.com/webpack/webpack / isSourceEqual

Function isSourceEqual

lib/util/source.js:39–63  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

37 * @returns {boolean} true, when both sources are equal
38 */
39const isSourceEqual = (a, b) => {
40 if (a === b) return true;
41 const cache1 = equalityCache.get(a);
42 if (cache1 !== undefined) {
43 const result = cache1.get(b);
44 if (result !== undefined) return result;
45 }
46 const result = _isSourceEqual(a, b);
47 if (cache1 !== undefined) {
48 cache1.set(b, result);
49 } else {
50 const map = new WeakMap();
51 map.set(b, result);
52 equalityCache.set(a, map);
53 }
54 const cache2 = equalityCache.get(b);
55 if (cache2 !== undefined) {
56 cache2.set(a, result);
57 } else {
58 const map = new WeakMap();
59 map.set(a, result);
60 equalityCache.set(b, map);
61 }
62 return result;
63};
64
65// TODO remove in webpack 6, this is protection against authors who directly use `webpack-sources` outdated version
66/**

Callers 3

emitAssetMethod · 0.85
renameAssetMethod · 0.85
checkSimilarFileMethod · 0.85

Calls 3

_isSourceEqualFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected