GetFullHashRuntimeModule.js 664 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. */
  4. "use strict";
  5. const RuntimeGlobals = require("../RuntimeGlobals");
  6. const RuntimeModule = require("../RuntimeModule");
  7. /** @typedef {import("../Compilation")} Compilation */
  8. class GetFullHashRuntimeModule extends RuntimeModule {
  9. constructor() {
  10. super("getFullHash");
  11. this.fullHash = true;
  12. }
  13. /**
  14. * @returns {string} runtime code
  15. */
  16. generate() {
  17. const { runtimeTemplate } = this.compilation;
  18. return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction(
  19. JSON.stringify(this.compilation.hash || "XXXX")
  20. )}`;
  21. }
  22. }
  23. module.exports = GetFullHashRuntimeModule;