* Applies the plugin by registering its hooks on the compiler. * @param {Compiler} compiler the compiler instance * @returns {void}
(compiler)
| 735 | * @returns {void} |
| 736 | */ |
| 737 | apply(compiler) { |
| 738 | compiler.hooks.compilation.tap(plugin, (compilation) => { |
| 739 | compilation.hooks.assetPath.tap(plugin, (path, data, assetInfo) => { |
| 740 | // Default from output options so `[uniqueName]` resolves in every template |
| 741 | if (data.uniqueName === undefined) { |
| 742 | data.uniqueName = compilation.outputOptions.uniqueName; |
| 743 | } |
| 744 | // Digest the stored hashes use, so `[hash:<digest>]` can re-encode them |
| 745 | if (data.hashDigest === undefined) { |
| 746 | data.hashDigest = compilation.outputOptions.hashDigest; |
| 747 | } |
| 748 | // Untruncated compilation hash, so `[fullhash:<digest>]` keeps full entropy |
| 749 | if (data.fullHash === undefined && data.hash === compilation.hash) { |
| 750 | data.fullHash = compilation.fullHash; |
| 751 | } |
| 752 | // `RealContentHashPlugin` rehashes content; flag it so an inline digest |
| 753 | // on `[contenthash]` is recorded and the recomputed hash re-encodes in it. |
| 754 | if (data.realContentHash === undefined) { |
| 755 | data.realContentHash = Boolean( |
| 756 | compilation.options.optimization.realContentHash |
| 757 | ); |
| 758 | } |
| 759 | return interpolate(path, data, assetInfo); |
| 760 | }); |
| 761 | }); |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | module.exports = TemplatedPathPlugin; |
nothing calls this directly
no test coverage detected