| 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 | /**
|
|---|
| 18 | * Generates runtime code for this runtime module.
|
|---|
| 19 | * @returns {string | null} runtime code
|
|---|
| 20 | */
|
|---|
| 21 | generate() {
|
|---|
| 22 | return Template.getFunctionContent(
|
|---|
| 23 | require("./HotModuleReplacement.runtime")
|
|---|
| 24 | )
|
|---|
| 25 | .replace(
|
|---|
| 26 | /\$interceptModuleExecution\$/g,
|
|---|
| 27 | RuntimeGlobals.interceptModuleExecution
|
|---|
| 28 | )
|
|---|
| 29 | .replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache)
|
|---|
| 30 | .replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData)
|
|---|
| 31 | .replace(/\$hmrDownloadManifest\$/g, RuntimeGlobals.hmrDownloadManifest)
|
|---|
| 32 | .replace(
|
|---|
| 33 | /\$hmrInvalidateModuleHandlers\$/g,
|
|---|
| 34 | RuntimeGlobals.hmrInvalidateModuleHandlers
|
|---|
| 35 | )
|
|---|
| 36 | .replace(
|
|---|
| 37 | /\$hmrDownloadUpdateHandlers\$/g,
|
|---|
| 38 | RuntimeGlobals.hmrDownloadUpdateHandlers
|
|---|
| 39 | );
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | module.exports = HotModuleReplacementRuntimeModule;
|
|---|