You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0;
class Cache { constructor(compilation) { this.cache = compilation.getCache('TerserWebpackPlugin'); }
async get(cacheData) { // eslint-disable-next-line no-param-reassign
cacheData.eTag = cacheData.eTag || Array.isArray(cacheData.inputSource) ? cacheData.inputSource.map(item => this.cache.getLazyHashedEtag(item)).reduce((previousValue, currentValue) => this.cache.mergeEtags(previousValue, currentValue)) : this.cache.getLazyHashedEtag(cacheData.inputSource); return this.cache.getPromise(cacheData.name, cacheData.eTag); }
async store(cacheData) { let data;
if (cacheData.target === 'comments') { data = cacheData.output; } else { data = { source: cacheData.source, extractedCommentsSource: cacheData.extractedCommentsSource, commentsFilename: cacheData.commentsFilename }; }
return this.cache.storePromise(cacheData.name, cacheData.eTag, data); }
}
exports.default = Cache;
|