403Webshell
Server IP : 185.208.173.17  /  Your IP : 87.236.161.98
Web Server : Microsoft-IIS/10.0
System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64
User : IUSR ( 0)
PHP Version : 7.4.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/parsmega.nuxt/node_modules/hard-source-webpack-plugin/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/hard-source-webpack-plugin/lib/CacheAsset.js
const crypto = require('crypto');

const pluginCompat = require('./util/plugin-compat');
const relateContext = require('./util/relate-context');
const { parityCacheFromCache, pushParityWriteOps } = require('./util/parity');

function requestHash(request) {
  return crypto
    .createHash('sha1')
    .update(request)
    .digest()
    .hexSlice();
}

const relateNormalRequest = relateContext.relateNormalRequest;

class AssetCache {
  apply(compiler) {
    const compilerHooks = pluginCompat.hooks(compiler);

    let assetCache = {};
    let parityCache = {};

    const assetArchetypeCache = {
      _ops: [],

      get(id) {
        const hashId = requestHash(relateNormalRequest(compiler, id));
        if (assetCache[hashId]) {
          if (typeof assetCache[hashId] === 'string') {
            assetCache[hashId] = JSON.parse(assetCache[hashId]);
          }
          return assetCache[hashId];
        }
      },

      set(id, item) {
        const hashId = requestHash(relateNormalRequest(compiler, id));
        if (item) {
          assetCache[hashId] = item;
          this._ops.push({
            key: hashId,
            value: item,
          });
        } else {
          assetCache[hashId] = null;
          this._ops.push({
            key: hashId,
            value: null,
          });
        }
      },

      operations() {
        const ops = this._ops.slice();
        this._ops.length = 0;
        return ops;
      },
    };

    compilerHooks._hardSourceArchetypeRegister.call(
      'Asset',
      assetArchetypeCache,
    );

    let assetCacheSerializer;
    let assetParityCacheSerializer;

    compilerHooks._hardSourceCreateSerializer.tap(
      'HardSource - AssetCache',
      (cacheSerializerFactory, cacheDirPath) => {
        assetCacheSerializer = cacheSerializerFactory.create({
          name: 'assets',
          type: 'file',
          cacheDirPath,
        });
        assetParityCacheSerializer = cacheSerializerFactory.create({
          name: 'assets-parity',
          type: 'data',
          cacheDirPath,
        });
      },
    );

    compilerHooks._hardSourceResetCache.tap('HardSource - AssetCache', () => {
      assetCache = {};
      parityCache = {};
    });

    compilerHooks._hardSourceReadCache.tapPromise(
      'HardSource - AssetCache',
      () =>
        Promise.all([
          assetCacheSerializer.read().then(_assetCache => {
            assetCache = _assetCache;
          }),
          assetParityCacheSerializer.read().then(_parityCache => {
            parityCache = _parityCache;
          }),
        ]),
    );

    compilerHooks._hardSourceParityCache.tap(
      'HardSource - AssetCache',
      parityRoot => {
        parityCacheFromCache('Asset', parityRoot, parityCache);
      },
    );

    compilerHooks._hardSourceWriteCache.tapPromise(
      'HardSource - AssetCache',
      compilation => {
        const assetOps = assetArchetypeCache.operations();

        const parityOps = [];
        pushParityWriteOps(compilation, parityOps);

        return Promise.all([
          assetCacheSerializer.write(assetOps),
          assetParityCacheSerializer.write(parityOps),
        ]);
      },
    );
  }
}

module.exports = AssetCache;

Youez - 2016 - github.com/yon3zu
LinuXploit