Sha256: 26f10d56b0212e30aecc4c84cbea1f0eabb8dec5ad52ad855c0260294489323f

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

"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;

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.15.2 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.18.4 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.18.1 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.14.0 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
tang-0.2.1 spec/tang_app/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
tang-0.2.0 spec/tang_app/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
tang-0.1.0 spec/tang_app/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js
tang-0.0.9 spec/tang_app/node_modules/terser-webpack-plugin/dist/Webpack5Cache.js