@rspack-canary/core 1.7.0-canary-7f9f7f14-20251231041831 → 1.7.0-canary-b303a917-20251231130755

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/BuildInfo.d.ts +4 -4
  2. package/dist/Chunk.d.ts +3 -3
  3. package/dist/ChunkGraph.d.ts +3 -3
  4. package/dist/Chunks.d.ts +2 -2
  5. package/dist/Compilation.d.ts +40 -40
  6. package/dist/Compiler.d.ts +23 -25
  7. package/dist/ConcatenatedModule.d.ts +1 -1
  8. package/dist/ContextModule.d.ts +1 -1
  9. package/dist/ContextModuleFactory.d.ts +2 -2
  10. package/dist/Diagnostics.d.ts +2 -2
  11. package/dist/Entrypoint.d.ts +1 -1
  12. package/dist/ExecuteModulePlugin.d.ts +1 -1
  13. package/dist/ExportsInfo.d.ts +2 -2
  14. package/dist/ExternalModule.d.ts +1 -1
  15. package/dist/FileSystem.d.ts +3 -3
  16. package/dist/Module.d.ts +6 -6
  17. package/dist/ModuleGraph.d.ts +3 -3
  18. package/dist/MultiCompiler.d.ts +8 -8
  19. package/dist/MultiStats.d.ts +3 -3
  20. package/dist/MultiWatching.d.ts +3 -3
  21. package/dist/NativeWatchFileSystem.d.ts +5 -5
  22. package/dist/NormalModule.d.ts +6 -6
  23. package/dist/NormalModuleFactory.d.ts +4 -4
  24. package/dist/Resolver.d.ts +2 -2
  25. package/dist/ResolverFactory.d.ts +3 -3
  26. package/dist/RspackError.d.ts +2 -2
  27. package/dist/RuntimeGlobals.d.ts +2 -2
  28. package/dist/RuntimeModule.d.ts +4 -4
  29. package/dist/Stats.d.ts +4 -4
  30. package/dist/VirtualModulesPlugin.d.ts +1 -1
  31. package/dist/Watching.d.ts +5 -5
  32. package/dist/builtin-loader/index.d.ts +1 -1
  33. package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +1 -1
  34. package/dist/builtin-loader/swc/index.d.ts +5 -5
  35. package/dist/builtin-loader/swc/types.d.ts +8 -10
  36. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +10 -5
  38. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  39. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +2 -2
  41. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +2 -2
  42. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +4 -4
  44. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +3 -3
  46. package/dist/builtin-plugin/EntryPlugin.d.ts +3 -3
  47. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
  51. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +2 -2
  52. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +3 -3
  53. package/dist/builtin-plugin/HttpUriPlugin.d.ts +4 -4
  54. package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
  55. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +6 -6
  56. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +2 -2
  58. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +2 -2
  59. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +2 -2
  60. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +2 -2
  61. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +2 -2
  62. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +8 -8
  66. package/dist/builtin-plugin/RslibPlugin.d.ts +2 -2
  67. package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
  68. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/RuntimePlugin.d.ts +5 -5
  70. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  71. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +4 -4
  72. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +5 -5
  73. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -3
  74. package/dist/builtin-plugin/{CaseSensitivePlugin.d.ts → WarnCaseSensitiveModulesPlugin.d.ts} +1 -1
  75. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
  76. package/dist/builtin-plugin/WorkerPlugin.d.ts +4 -4
  77. package/dist/builtin-plugin/base.d.ts +3 -3
  78. package/dist/builtin-plugin/css-extract/index.d.ts +7 -7
  79. package/dist/builtin-plugin/css-extract/loader.d.ts +2 -2
  80. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
  81. package/dist/builtin-plugin/html-plugin/hooks.d.ts +4 -4
  82. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -2
  83. package/dist/builtin-plugin/html-plugin/options.d.ts +6 -6
  84. package/dist/builtin-plugin/html-plugin/plugin.d.ts +5 -5
  85. package/dist/builtin-plugin/html-plugin/taps.d.ts +1 -1
  86. package/dist/builtin-plugin/index.d.ts +88 -84
  87. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  88. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
  89. package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
  90. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +10 -0
  91. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +10 -0
  92. package/dist/builtin-plugin/rsc/index.d.ts +15 -0
  93. package/dist/config/adapter.d.ts +7 -7
  94. package/dist/config/adapterRuleUse.d.ts +16 -16
  95. package/dist/config/browserslistTargetHandler.d.ts +1 -1
  96. package/dist/config/defaults.d.ts +2 -11
  97. package/dist/config/devServer.d.ts +32 -32
  98. package/dist/config/index.d.ts +5 -5
  99. package/dist/config/normalization.d.ts +9 -9
  100. package/dist/config/target.d.ts +7 -7
  101. package/dist/config/types.d.ts +74 -75
  102. package/dist/container/ContainerPlugin.d.ts +4 -4
  103. package/dist/container/ContainerReferencePlugin.d.ts +4 -4
  104. package/dist/container/ModuleFederationManifestPlugin.d.ts +3 -3
  105. package/dist/container/ModuleFederationPlugin.d.ts +6 -8
  106. package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
  107. package/dist/container/ModuleFederationRuntimePlugin.d.ts +0 -4
  108. package/dist/container/index.d.ts +4 -4
  109. package/dist/cssExtractHmr.js +19 -19
  110. package/dist/cssExtractLoader.js +16 -16
  111. package/dist/exports.d.ts +74 -76
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.js +1965 -1933
  114. package/dist/lib/AbstractMethodError.d.ts +1 -1
  115. package/dist/lib/Cache.d.ts +2 -2
  116. package/dist/lib/CacheFacade.d.ts +3 -3
  117. package/dist/lib/DllPlugin.d.ts +1 -1
  118. package/dist/lib/DllReferencePlugin.d.ts +5 -5
  119. package/dist/lib/EntryOptionPlugin.d.ts +2 -2
  120. package/dist/lib/EnvironmentPlugin.d.ts +1 -1
  121. package/dist/lib/HookWebpackError.d.ts +2 -2
  122. package/dist/lib/IgnoreWarningsPlugin.d.ts +1 -1
  123. package/dist/lib/LoaderOptionsPlugin.d.ts +2 -2
  124. package/dist/lib/LoaderTargetPlugin.d.ts +2 -2
  125. package/dist/lib/WebpackError.d.ts +3 -3
  126. package/dist/lib/cache/MemoryCachePlugin.d.ts +1 -1
  127. package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
  128. package/dist/lib/cache/mergeEtags.d.ts +1 -1
  129. package/dist/loader-runner/ModuleError.d.ts +1 -1
  130. package/dist/loader-runner/index.d.ts +3 -3
  131. package/dist/loader-runner/loadLoader.d.ts +2 -2
  132. package/dist/loader-runner/service.d.ts +8 -8
  133. package/dist/loader-runner/utils.d.ts +3 -3
  134. package/dist/loader-runner/worker.d.ts +3 -3
  135. package/dist/logging/createConsoleLogger.d.ts +4 -4
  136. package/dist/moduleFederationDefaultRuntime.js +1 -1
  137. package/dist/node/NodeEnvironmentPlugin.d.ts +2 -2
  138. package/dist/node/NodeTemplatePlugin.d.ts +1 -1
  139. package/dist/node/NodeWatchFileSystem.d.ts +3 -3
  140. package/dist/node/nodeConsole.d.ts +2 -2
  141. package/dist/rspack.d.ts +6 -15
  142. package/dist/rspackOptionsApply.d.ts +1 -1
  143. package/dist/sharing/ConsumeSharedPlugin.d.ts +3 -3
  144. package/dist/sharing/ProvideSharedPlugin.d.ts +4 -4
  145. package/dist/sharing/SharePlugin.d.ts +1 -1
  146. package/dist/sharing/ShareRuntimePlugin.d.ts +3 -3
  147. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +15 -15
  148. package/dist/stats/DefaultStatsPresetPlugin.d.ts +1 -1
  149. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +1 -1
  150. package/dist/stats/StatsFactory.d.ts +5 -5
  151. package/dist/stats/StatsPrinter.d.ts +3 -3
  152. package/dist/stats/statsFactoryUtils.d.ts +5 -5
  153. package/dist/swc.d.ts +2 -2
  154. package/dist/taps/compilation.d.ts +2 -2
  155. package/dist/taps/compiler.d.ts +1 -1
  156. package/dist/taps/contextModuleFactory.d.ts +1 -1
  157. package/dist/taps/index.d.ts +6 -6
  158. package/dist/taps/javascriptModules.d.ts +1 -1
  159. package/dist/taps/normalModuleFactory.d.ts +1 -1
  160. package/dist/taps/types.d.ts +3 -3
  161. package/dist/trace/index.d.ts +4 -4
  162. package/dist/trace/traceHookPlugin.d.ts +1 -1
  163. package/dist/util/SplitChunkSize.d.ts +1 -1
  164. package/dist/util/createHash.d.ts +1 -1
  165. package/dist/util/createReadonlyMap.d.ts +1 -1
  166. package/dist/util/fs.d.ts +14 -14
  167. package/dist/util/hash/wasm-hash.d.ts +1 -1
  168. package/dist/util/identifier.d.ts +1 -1
  169. package/dist/util/index.d.ts +1 -2
  170. package/dist/util/source.d.ts +2 -2
  171. package/dist/util/validateConfig.d.ts +1 -1
  172. package/dist/worker.js +111 -111
  173. package/hot/dev-server.js +64 -64
  174. package/hot/emitter.js +11 -11
  175. package/hot/lazy-compilation-node.js +41 -41
  176. package/hot/lazy-compilation-web.js +52 -52
  177. package/hot/log-apply-result.js +36 -36
  178. package/hot/log.js +30 -30
  179. package/hot/only-dev-server.js +92 -92
  180. package/hot/poll.js +31 -31
  181. package/hot/signal.js +53 -53
  182. package/module.d.ts +215 -215
  183. package/package.json +4 -4
package/hot/dev-server.js CHANGED
@@ -4,72 +4,72 @@
4
4
  */
5
5
  /* globals __webpack_hash__ */
6
6
  if (module.hot) {
7
- /** @type {undefined|string} */
8
- var lastHash;
9
- var upToDate = function upToDate() {
10
- return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
11
- };
12
- var log = require('./log');
13
- var check = function check() {
14
- module.hot
15
- .check(true)
16
- .then(function (updatedModules) {
17
- if (!updatedModules) {
18
- log(
19
- 'warning',
20
- '[HMR] Cannot find update. ' +
21
- (typeof window !== 'undefined'
22
- ? 'Need to do a full reload!'
23
- : 'Please reload manually!'),
24
- );
25
- log(
26
- 'warning',
27
- '[HMR] (Probably because of restarting the webpack-dev-server)',
28
- );
29
- if (typeof window !== 'undefined') {
30
- window.location.reload();
31
- }
32
- return;
33
- }
7
+ /** @type {undefined|string} */
8
+ var lastHash;
9
+ var upToDate = function upToDate() {
10
+ return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
11
+ };
12
+ var log = require("./log");
13
+ var check = function check() {
14
+ module.hot
15
+ .check(true)
16
+ .then(function (updatedModules) {
17
+ if (!updatedModules) {
18
+ log(
19
+ "warning",
20
+ "[HMR] Cannot find update. " +
21
+ (typeof window !== "undefined"
22
+ ? "Need to do a full reload!"
23
+ : "Please reload manually!")
24
+ );
25
+ log(
26
+ "warning",
27
+ "[HMR] (Probably because of restarting the webpack-dev-server)"
28
+ );
29
+ if (typeof window !== "undefined") {
30
+ window.location.reload();
31
+ }
32
+ return;
33
+ }
34
34
 
35
- if (!upToDate()) {
36
- check();
37
- }
35
+ if (!upToDate()) {
36
+ check();
37
+ }
38
38
 
39
- require('./log-apply-result')(updatedModules, updatedModules);
39
+ require("./log-apply-result")(updatedModules, updatedModules);
40
40
 
41
- if (upToDate()) {
42
- log('info', '[HMR] App is up to date.');
43
- }
44
- })
45
- .catch(function (err) {
46
- var status = module.hot.status();
47
- if (['abort', 'fail'].indexOf(status) >= 0) {
48
- log(
49
- 'warning',
50
- '[HMR] Cannot apply update. ' +
51
- (typeof window !== 'undefined'
52
- ? 'Need to do a full reload!'
53
- : 'Please reload manually!'),
54
- );
55
- log('warning', '[HMR] ' + log.formatError(err));
56
- if (typeof window !== 'undefined') {
57
- window.location.reload();
58
- }
59
- } else {
60
- log('warning', '[HMR] Update failed: ' + log.formatError(err));
61
- }
62
- });
63
- };
64
- var hotEmitter = require('./emitter');
65
- hotEmitter.on('webpackHotUpdate', function (currentHash) {
66
- lastHash = currentHash;
67
- if (!upToDate() && module.hot.status() === 'idle') {
68
- log('info', '[HMR] Checking for updates on the server...');
69
- check();
70
- }
71
- });
72
- log('info', '[HMR] Waiting for update signal from WDS...');
41
+ if (upToDate()) {
42
+ log("info", "[HMR] App is up to date.");
43
+ }
44
+ })
45
+ .catch(function (err) {
46
+ var status = module.hot.status();
47
+ if (["abort", "fail"].indexOf(status) >= 0) {
48
+ log(
49
+ "warning",
50
+ "[HMR] Cannot apply update. " +
51
+ (typeof window !== "undefined"
52
+ ? "Need to do a full reload!"
53
+ : "Please reload manually!")
54
+ );
55
+ log("warning", "[HMR] " + log.formatError(err));
56
+ if (typeof window !== "undefined") {
57
+ window.location.reload();
58
+ }
59
+ } else {
60
+ log("warning", "[HMR] Update failed: " + log.formatError(err));
61
+ }
62
+ });
63
+ };
64
+ var hotEmitter = require("./emitter");
65
+ hotEmitter.on("webpackHotUpdate", function (currentHash) {
66
+ lastHash = currentHash;
67
+ if (!upToDate() && module.hot.status() === "idle") {
68
+ log("info", "[HMR] Checking for updates on the server...");
69
+ check();
70
+ }
71
+ });
72
+ log("info", "[HMR] Waiting for update signal from WDS...");
73
73
  } else {
74
- throw new Error('[HMR] Hot Module Replacement is disabled.');
74
+ throw new Error("[HMR] Hot Module Replacement is disabled.");
75
75
  }
package/hot/emitter.js CHANGED
@@ -1,21 +1,21 @@
1
1
  function EventEmitter() {
2
- this.events = {};
2
+ this.events = {};
3
3
  }
4
4
 
5
5
  EventEmitter.prototype.on = function (eventName, callback) {
6
- if (!this.events[eventName]) {
7
- this.events[eventName] = [];
8
- }
9
- this.events[eventName].push(callback);
6
+ if (!this.events[eventName]) {
7
+ this.events[eventName] = [];
8
+ }
9
+ this.events[eventName].push(callback);
10
10
  };
11
11
 
12
12
  EventEmitter.prototype.emit = function (eventName) {
13
- var args = Array.prototype.slice.call(arguments, 1);
14
- if (this.events[eventName]) {
15
- this.events[eventName].forEach(function (callback) {
16
- callback.apply(null, args);
17
- });
18
- }
13
+ var args = Array.prototype.slice.call(arguments, 1);
14
+ if (this.events[eventName]) {
15
+ this.events[eventName].forEach(function (callback) {
16
+ callback.apply(null, args);
17
+ });
18
+ }
19
19
  };
20
20
 
21
21
  module.exports = new EventEmitter();
@@ -5,46 +5,46 @@ var urlBase = decodeURIComponent(__resourceQuery.slice(1));
5
5
  * @returns {() => void} function to destroy response
6
6
  */
7
7
  exports.activate = function (options) {
8
- var data = options.data;
9
- var onError = options.onError;
10
- var active = options.active;
11
- var module = options.module;
12
- /** @type {import("http").IncomingMessage} */
13
- var response;
14
- var request = (
15
- urlBase.startsWith('https') ? require('https') : require('http')
16
- ).request(
17
- urlBase + encodeURIComponent(data),
18
- {
19
- agent: false,
20
- headers: { accept: 'text/event-stream' },
21
- },
22
- function (res) {
23
- response = res;
24
- response.on('error', errorHandler);
25
- if (!active && !module.hot) {
26
- console.log(
27
- 'Hot Module Replacement is not enabled. Waiting for process restart...',
28
- );
29
- }
30
- },
31
- );
8
+ var data = options.data;
9
+ var onError = options.onError;
10
+ var active = options.active;
11
+ var module = options.module;
12
+ /** @type {import("http").IncomingMessage} */
13
+ var response;
14
+ var request = (
15
+ urlBase.startsWith("https") ? require("https") : require("http")
16
+ ).request(
17
+ urlBase + encodeURIComponent(data),
18
+ {
19
+ agent: false,
20
+ headers: { accept: "text/event-stream" }
21
+ },
22
+ function (res) {
23
+ response = res;
24
+ response.on("error", errorHandler);
25
+ if (!active && !module.hot) {
26
+ console.log(
27
+ "Hot Module Replacement is not enabled. Waiting for process restart..."
28
+ );
29
+ }
30
+ }
31
+ );
32
32
 
33
- /**
34
- * @param {Error} err error
35
- */
36
- function errorHandler(err) {
37
- err.message =
38
- 'Problem communicating active modules to the server' +
39
- (err.message ? ': ' + err.message : '') +
40
- '\nRequest: ' +
41
- urlBase +
42
- data;
43
- onError(err);
44
- }
45
- request.on('error', errorHandler);
46
- request.end();
47
- return function () {
48
- response.destroy();
49
- };
33
+ /**
34
+ * @param {Error} err error
35
+ */
36
+ function errorHandler(err) {
37
+ err.message =
38
+ "Problem communicating active modules to the server" +
39
+ (err.message ? ": " + err.message : "") +
40
+ "\nRequest: " +
41
+ urlBase +
42
+ data;
43
+ onError(err);
44
+ }
45
+ request.on("error", errorHandler);
46
+ request.end();
47
+ return function () {
48
+ response.destroy();
49
+ };
50
50
  };
@@ -1,7 +1,7 @@
1
- if (typeof EventSource !== 'function') {
2
- throw new Error(
3
- "Environment doesn't support lazy compilation (requires EventSource)",
4
- );
1
+ if (typeof EventSource !== "function") {
2
+ throw new Error(
3
+ "Environment doesn't support lazy compilation (requires EventSource)"
4
+ );
5
5
  }
6
6
 
7
7
  var urlBase = decodeURIComponent(__resourceQuery.slice(1));
@@ -11,35 +11,35 @@ var compiling = new Set();
11
11
  var errorHandlers = new Set();
12
12
 
13
13
  var updateEventSource = function updateEventSource() {
14
- if (activeEventSource) activeEventSource.close();
15
- if (compiling.size) {
16
- activeEventSource = new EventSource(
17
- urlBase +
18
- Array.from(compiling, function (module) {
19
- return encodeURIComponent(module);
20
- }).join('@'),
21
- );
22
- /**
23
- * @this {EventSource}
24
- * @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
25
- */
26
- activeEventSource.onerror = function (event) {
27
- errorHandlers.forEach(function (onError) {
28
- onError(
29
- new Error(
30
- 'Problem communicating active modules to the server' +
31
- (event.message ? `: ${event.message} ` : '') +
32
- (event.filename ? `: ${event.filename} ` : '') +
33
- (event.lineno ? `: ${event.lineno} ` : '') +
34
- (event.colno ? `: ${event.colno} ` : '') +
35
- (event.error ? `: ${event.error}` : ''),
36
- ),
37
- );
38
- });
39
- };
40
- } else {
41
- activeEventSource = undefined;
42
- }
14
+ if (activeEventSource) activeEventSource.close();
15
+ if (compiling.size) {
16
+ activeEventSource = new EventSource(
17
+ urlBase +
18
+ Array.from(compiling, function (module) {
19
+ return encodeURIComponent(module);
20
+ }).join("@")
21
+ );
22
+ /**
23
+ * @this {EventSource}
24
+ * @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
25
+ */
26
+ activeEventSource.onerror = function (event) {
27
+ errorHandlers.forEach(function (onError) {
28
+ onError(
29
+ new Error(
30
+ "Problem communicating active modules to the server" +
31
+ (event.message ? `: ${event.message} ` : "") +
32
+ (event.filename ? `: ${event.filename} ` : "") +
33
+ (event.lineno ? `: ${event.lineno} ` : "") +
34
+ (event.colno ? `: ${event.colno} ` : "") +
35
+ (event.error ? `: ${event.error}` : "")
36
+ )
37
+ );
38
+ });
39
+ };
40
+ } else {
41
+ activeEventSource = undefined;
42
+ }
43
43
  };
44
44
 
45
45
  /**
@@ -47,26 +47,26 @@ var updateEventSource = function updateEventSource() {
47
47
  * @returns {() => void} function to destroy response
48
48
  */
49
49
  exports.activate = function (options) {
50
- var data = options.data;
51
- var onError = options.onError;
52
- var active = options.active;
53
- var module = options.module;
54
- errorHandlers.add(onError);
50
+ var data = options.data;
51
+ var onError = options.onError;
52
+ var active = options.active;
53
+ var module = options.module;
54
+ errorHandlers.add(onError);
55
55
 
56
- if (!compiling.has(data)) {
57
- compiling.add(data);
58
- updateEventSource();
59
- }
56
+ if (!compiling.has(data)) {
57
+ compiling.add(data);
58
+ updateEventSource();
59
+ }
60
60
 
61
- if (!active && !module.hot) {
62
- console.log(
63
- 'Hot Module Replacement is not enabled. Waiting for process restart...',
64
- );
65
- }
61
+ if (!active && !module.hot) {
62
+ console.log(
63
+ "Hot Module Replacement is not enabled. Waiting for process restart..."
64
+ );
65
+ }
66
66
 
67
- return function () {
68
- errorHandlers.delete(onError);
69
- compiling.delete(data);
70
- updateEventSource();
71
- };
67
+ return function () {
68
+ errorHandlers.delete(onError);
69
+ compiling.delete(data);
70
+ updateEventSource();
71
+ };
72
72
  };
@@ -8,42 +8,42 @@
8
8
  * @param {(string | number)[] | null} renewedModules renewed modules
9
9
  */
10
10
  module.exports = function (updatedModules, renewedModules) {
11
- var unacceptedModules = updatedModules.filter(function (moduleId) {
12
- return renewedModules && renewedModules.indexOf(moduleId) < 0;
13
- });
14
- var log = require('./log');
11
+ var unacceptedModules = updatedModules.filter(function (moduleId) {
12
+ return renewedModules && renewedModules.indexOf(moduleId) < 0;
13
+ });
14
+ var log = require("./log");
15
15
 
16
- if (unacceptedModules.length > 0) {
17
- log(
18
- 'warning',
19
- "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)",
20
- );
21
- unacceptedModules.forEach(function (moduleId) {
22
- log('warning', '[HMR] - ' + moduleId);
23
- });
24
- }
16
+ if (unacceptedModules.length > 0) {
17
+ log(
18
+ "warning",
19
+ "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
20
+ );
21
+ unacceptedModules.forEach(function (moduleId) {
22
+ log("warning", "[HMR] - " + moduleId);
23
+ });
24
+ }
25
25
 
26
- if (!renewedModules || renewedModules.length === 0) {
27
- log('info', '[HMR] Nothing hot updated.');
28
- } else {
29
- log('info', '[HMR] Updated modules:');
30
- renewedModules.forEach(function (moduleId) {
31
- if (typeof moduleId === 'string' && moduleId.indexOf('!') !== -1) {
32
- var parts = moduleId.split('!');
33
- log.groupCollapsed('info', '[HMR] - ' + parts.pop());
34
- log('info', '[HMR] - ' + moduleId);
35
- log.groupEnd('info');
36
- } else {
37
- log('info', '[HMR] - ' + moduleId);
38
- }
39
- });
40
- var numberIds = renewedModules.every(function (moduleId) {
41
- return typeof moduleId === 'number';
42
- });
43
- if (numberIds)
44
- log(
45
- 'info',
46
- '[HMR] Consider using the optimization.moduleIds: "named" for module names.',
47
- );
48
- }
26
+ if (!renewedModules || renewedModules.length === 0) {
27
+ log("info", "[HMR] Nothing hot updated.");
28
+ } else {
29
+ log("info", "[HMR] Updated modules:");
30
+ renewedModules.forEach(function (moduleId) {
31
+ if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
32
+ var parts = moduleId.split("!");
33
+ log.groupCollapsed("info", "[HMR] - " + parts.pop());
34
+ log("info", "[HMR] - " + moduleId);
35
+ log.groupEnd("info");
36
+ } else {
37
+ log("info", "[HMR] - " + moduleId);
38
+ }
39
+ });
40
+ var numberIds = renewedModules.every(function (moduleId) {
41
+ return typeof moduleId === "number";
42
+ });
43
+ if (numberIds)
44
+ log(
45
+ "info",
46
+ '[HMR] Consider using the optimization.moduleIds: "named" for module names.'
47
+ );
48
+ }
49
49
  };
package/hot/log.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /** @typedef {"info" | "warning" | "error"} LogLevel */
2
2
 
3
3
  /** @type {LogLevel} */
4
- var logLevel = 'info';
4
+ var logLevel = "info";
5
5
 
6
6
  function dummy() {}
7
7
 
@@ -10,11 +10,11 @@ function dummy() {}
10
10
  * @returns {boolean} true, if should log
11
11
  */
12
12
  function shouldLog(level) {
13
- var shouldLog =
14
- (logLevel === 'info' && level === 'info') ||
15
- (['info', 'warning'].indexOf(logLevel) >= 0 && level === 'warning') ||
16
- (['info', 'warning', 'error'].indexOf(logLevel) >= 0 && level === 'error');
17
- return shouldLog;
13
+ var shouldLog =
14
+ (logLevel === "info" && level === "info") ||
15
+ (["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") ||
16
+ (["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error");
17
+ return shouldLog;
18
18
  }
19
19
 
20
20
  /**
@@ -22,11 +22,11 @@ function shouldLog(level) {
22
22
  * @returns {(level: LogLevel, msg?: string) => void} function that logs when log level is sufficient
23
23
  */
24
24
  function logGroup(logFn) {
25
- return function (level, msg) {
26
- if (shouldLog(level)) {
27
- logFn(msg);
28
- }
29
- };
25
+ return function (level, msg) {
26
+ if (shouldLog(level)) {
27
+ logFn(msg);
28
+ }
29
+ };
30
30
  }
31
31
 
32
32
  /**
@@ -34,15 +34,15 @@ function logGroup(logFn) {
34
34
  * @param {string|Error} msg message
35
35
  */
36
36
  module.exports = function (level, msg) {
37
- if (shouldLog(level)) {
38
- if (level === 'info') {
39
- console.log(msg);
40
- } else if (level === 'warning') {
41
- console.warn(msg);
42
- } else if (level === 'error') {
43
- console.error(msg);
44
- }
45
- }
37
+ if (shouldLog(level)) {
38
+ if (level === "info") {
39
+ console.log(msg);
40
+ } else if (level === "warning") {
41
+ console.warn(msg);
42
+ } else if (level === "error") {
43
+ console.error(msg);
44
+ }
45
+ }
46
46
  };
47
47
 
48
48
  var group = console.group || dummy;
@@ -59,7 +59,7 @@ module.exports.groupEnd = logGroup(groupEnd);
59
59
  * @param {LogLevel} level log level
60
60
  */
61
61
  module.exports.setLogLevel = function (level) {
62
- logLevel = level;
62
+ logLevel = level;
63
63
  };
64
64
 
65
65
  /**
@@ -67,13 +67,13 @@ module.exports.setLogLevel = function (level) {
67
67
  * @returns {string} formatted error
68
68
  */
69
69
  module.exports.formatError = function (err) {
70
- var message = err.message;
71
- var stack = err.stack;
72
- if (!stack) {
73
- return message;
74
- } else if (stack.indexOf(message) < 0) {
75
- return message + '\n' + stack;
76
- } else {
77
- return stack;
78
- }
70
+ var message = err.message;
71
+ var stack = err.stack;
72
+ if (!stack) {
73
+ return message;
74
+ } else if (stack.indexOf(message) < 0) {
75
+ return message + "\n" + stack;
76
+ } else {
77
+ return stack;
78
+ }
79
79
  };