1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const RuntimeGlobals = require("../RuntimeGlobals");
|
---|
9 | const RuntimeModule = require("../RuntimeModule");
|
---|
10 | const Template = require("../Template");
|
---|
11 |
|
---|
12 | class HotModuleReplacementRuntimeModule extends RuntimeModule {
|
---|
13 | constructor() {
|
---|
14 | super("hot module replacement", RuntimeModule.STAGE_BASIC);
|
---|
15 | }
|
---|
16 | /**
|
---|
17 | * @returns {string} runtime code
|
---|
18 | */
|
---|
19 | generate() {
|
---|
20 | return Template.getFunctionContent(
|
---|
21 | require("./HotModuleReplacement.runtime.js")
|
---|
22 | )
|
---|
23 | .replace(/\$getFullHash\$/g, RuntimeGlobals.getFullHash)
|
---|
24 | .replace(
|
---|
25 | /\$interceptModuleExecution\$/g,
|
---|
26 | RuntimeGlobals.interceptModuleExecution
|
---|
27 | )
|
---|
28 | .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache)
|
---|
29 | .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData)
|
---|
30 | .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest)
|
---|
31 | .replace(
|
---|
32 | /\$hmrInvalidateModuleHandlers\$/g,
|
---|
33 | RuntimeGlobals.hmrInvalidateModuleHandlers
|
---|
34 | )
|
---|
35 | .replace(
|
---|
36 | /\$hmrDownloadUpdateHandlers\$/g,
|
---|
37 | RuntimeGlobals.hmrDownloadUpdateHandlers
|
---|
38 | );
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | module.exports = HotModuleReplacementRuntimeModule;
|
---|