liusuyi
2023-04-24 4737f1e038743ced243c9e52423404d9034d6107
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
 
class Cache {
  constructor(compilation) {
    this.cache = compilation.getCache('CompressionWebpackPlugin');
  }
 
  async get(cacheData) {
    // eslint-disable-next-line no-param-reassign
    cacheData.eTag = cacheData.eTag || this.cache.getLazyHashedEtag(cacheData.source);
    return this.cache.getPromise(cacheData.assetName, cacheData.eTag);
  }
 
  async store(cacheData) {
    return this.cache.storePromise(cacheData.assetName, cacheData.eTag, cacheData.output);
  }
 
}
 
exports.default = Cache;