(a, b)
| 37 | * @returns {boolean} true, when both sources are equal |
| 38 | */ |
| 39 | const 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 | /** |
no test coverage detected