2018-11-06 01:50:58 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*/
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
|
|
const RuntimeModule = require("../RuntimeModule");
|
|
|
|
|
2018-12-18 05:05:08 +08:00
|
|
|
/** @typedef {import("../Compilation")} Compilation */
|
|
|
|
|
2018-11-06 01:50:58 +08:00
|
|
|
class GetFullHashRuntimeModule extends RuntimeModule {
|
2019-08-27 02:21:07 +08:00
|
|
|
constructor() {
|
2018-11-06 01:50:58 +08:00
|
|
|
super("getFullHash");
|
2020-09-02 00:09:28 +08:00
|
|
|
this.fullHash = true;
|
2018-11-06 01:50:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-06-17 01:13:03 +08:00
|
|
|
* @returns {string | null} runtime code
|
2018-11-06 01:50:58 +08:00
|
|
|
*/
|
2018-11-20 19:05:12 +08:00
|
|
|
generate() {
|
2023-06-13 01:24:59 +08:00
|
|
|
const compilation = /** @type {Compilation} */ (this.compilation);
|
|
|
|
const { runtimeTemplate } = compilation;
|
2019-08-27 02:21:07 +08:00
|
|
|
return `${RuntimeGlobals.getFullHash} = ${runtimeTemplate.returningFunction(
|
2023-06-13 01:24:59 +08:00
|
|
|
JSON.stringify(compilation.hash || "XXXX")
|
2019-08-27 02:21:07 +08:00
|
|
|
)}`;
|
2018-11-06 01:50:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = GetFullHashRuntimeModule;
|