* `output.hashFunction`/`hashSalt`/`hashDigest`/`hashDigestLength` * digest of `content`, with `nonNumericOnlyHash` applied — webpack's * standard `[contenthash]` recipe. * @param {string | Buffer} content content to hash * @param {import("../../declarations/WebpackOptions").Output} outputOp
(content, outputOptions)
| 105 | * @returns {string} content hash |
| 106 | */ |
| 107 | static computeContentHash(content, outputOptions) { |
| 108 | const hash = createHash( |
| 109 | /** @type {import("../../declarations/WebpackOptions").HashFunction} */ |
| 110 | (outputOptions.hashFunction) |
| 111 | ); |
| 112 | if (outputOptions.hashSalt) hash.update(outputOptions.hashSalt); |
| 113 | hash.update(content); |
| 114 | return digestNonNumericOnly( |
| 115 | hash, |
| 116 | /** @type {string} */ (outputOptions.hashDigest), |
| 117 | /** @type {number} */ (outputOptions.hashDigestLength) |
| 118 | ); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Applies the plugin by registering its hooks on the compiler. |
no test coverage detected