MCPcopy
hub / github.com/webpack/webpack / generateJavascriptHMR

Function generateJavascriptHMR

lib/hmr/JavascriptHotModuleReplacementHelper.js:17–36  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

15 * @returns {string} HMR runtime code
16 */
17const generateJavascriptHMR = (type) =>
18 Template.getFunctionContent(
19 require("../hmr/JavascriptHotModuleReplacement.runtime")
20 )
21 .replace(/\$key\$/g, type)
22 .replace(/\$installedChunks\$/g, "installedChunks")
23 .replace(/\$loadUpdateChunk\$/g, "loadUpdateChunk")
24 .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache)
25 .replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories)
26 .replace(/\$ensureChunkHandlers\$/g, RuntimeGlobals.ensureChunkHandlers)
27 .replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty)
28 .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData)
29 .replace(
30 /\$hmrDownloadUpdateHandlers\$/g,
31 RuntimeGlobals.hmrDownloadUpdateHandlers
32 )
33 .replace(
34 /\$hmrInvalidateModuleHandlers\$/g,
35 RuntimeGlobals.hmrInvalidateModuleHandlers
36 );
37
38module.exports.generateJavascriptHMR = generateJavascriptHMR;

Callers 5

generateMethod · 0.85
generateMethod · 0.85
generateMethod · 0.85
generateMethod · 0.85
generateMethod · 0.85

Calls 3

getFunctionContentMethod · 0.80
requireFunction · 0.50
replaceMethod · 0.45

Tested by

no test coverage detected