MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/snap.cafsinfotech.in/node_modules/workbox-webpack-plugin/src/lib/get-asset-hash.ts
/*
  Copyright 2018 Google LLC

  Use of this source code is governed by an MIT-style
  license that can be found in the LICENSE file or at
  https://opensource.org/licenses/MIT.
*/

import crypto from 'crypto';
import type {Asset} from 'webpack';

/**
 * @param {Asset} asset
 * @return {string} The MD5 hash of the asset's source.
 *
 * @private
 */
export function getAssetHash(asset: Asset): string | null {
  // If webpack has the asset marked as immutable, then we don't need to
  // use an out-of-band revision for it.
  // See https://github.com/webpack/webpack/issues/9038
  if (asset.info && asset.info.immutable) {
    return null;
  }

  return crypto.createHash('md5')
      .update(Buffer.from(asset.source.source()))
      .digest('hex');
}