Webpack5Cache.js 605 B

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