@rspack-canary/core 1.7.0-canary-a2d4dc73-20251231074311 → 1.7.0-canary-09dd289a-20260104030651
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.
- package/dist/BuildInfo.d.ts +4 -4
- package/dist/Chunk.d.ts +3 -3
- package/dist/ChunkGraph.d.ts +3 -3
- package/dist/Chunks.d.ts +2 -2
- package/dist/Compilation.d.ts +40 -40
- package/dist/Compiler.d.ts +23 -25
- package/dist/ConcatenatedModule.d.ts +1 -1
- package/dist/ContextModule.d.ts +1 -1
- package/dist/ContextModuleFactory.d.ts +2 -2
- package/dist/Diagnostics.d.ts +2 -2
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/ExecuteModulePlugin.d.ts +1 -1
- package/dist/ExportsInfo.d.ts +2 -2
- package/dist/ExternalModule.d.ts +1 -1
- package/dist/FileSystem.d.ts +3 -3
- package/dist/Module.d.ts +6 -6
- package/dist/ModuleGraph.d.ts +3 -3
- package/dist/MultiCompiler.d.ts +8 -8
- package/dist/MultiStats.d.ts +3 -3
- package/dist/MultiWatching.d.ts +3 -3
- package/dist/NativeWatchFileSystem.d.ts +5 -5
- package/dist/NormalModule.d.ts +6 -6
- package/dist/NormalModuleFactory.d.ts +4 -4
- package/dist/Resolver.d.ts +2 -2
- package/dist/ResolverFactory.d.ts +3 -3
- package/dist/RspackError.d.ts +2 -2
- package/dist/RuntimeGlobals.d.ts +2 -2
- package/dist/RuntimeModule.d.ts +4 -4
- package/dist/Stats.d.ts +4 -4
- package/dist/VirtualModulesPlugin.d.ts +1 -1
- package/dist/Watching.d.ts +5 -5
- package/dist/builtin-loader/index.d.ts +1 -1
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +1 -1
- package/dist/builtin-loader/swc/index.d.ts +5 -5
- package/dist/builtin-loader/swc/types.d.ts +8 -10
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +10 -5
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +4 -4
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EntryPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +2 -2
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +3 -3
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +4 -4
- package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +6 -6
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +2 -2
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +8 -8
- package/dist/builtin-plugin/RslibPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +5 -5
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +4 -4
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +5 -5
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/{CaseSensitivePlugin.d.ts → WarnCaseSensitiveModulesPlugin.d.ts} +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
- package/dist/builtin-plugin/WorkerPlugin.d.ts +4 -4
- package/dist/builtin-plugin/base.d.ts +3 -3
- package/dist/builtin-plugin/css-extract/index.d.ts +7 -7
- package/dist/builtin-plugin/css-extract/loader.d.ts +2 -2
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +4 -4
- package/dist/builtin-plugin/html-plugin/index.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/options.d.ts +6 -6
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +5 -5
- package/dist/builtin-plugin/html-plugin/taps.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +88 -84
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +10 -0
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +10 -0
- package/dist/builtin-plugin/rsc/index.d.ts +15 -0
- package/dist/config/adapter.d.ts +7 -7
- package/dist/config/adapterRuleUse.d.ts +16 -16
- package/dist/config/browserslistTargetHandler.d.ts +1 -1
- package/dist/config/defaults.d.ts +2 -11
- package/dist/config/devServer.d.ts +32 -32
- package/dist/config/index.d.ts +5 -5
- package/dist/config/normalization.d.ts +9 -9
- package/dist/config/target.d.ts +7 -7
- package/dist/config/types.d.ts +74 -75
- package/dist/container/ContainerPlugin.d.ts +4 -4
- package/dist/container/ContainerReferencePlugin.d.ts +4 -4
- package/dist/container/ModuleFederationManifestPlugin.d.ts +3 -3
- package/dist/container/ModuleFederationPlugin.d.ts +6 -6
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
- package/dist/container/index.d.ts +4 -4
- package/dist/cssExtractHmr.js +19 -19
- package/dist/cssExtractLoader.js +16 -16
- package/dist/exports.d.ts +74 -76
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1943 -1892
- package/dist/lib/AbstractMethodError.d.ts +1 -1
- package/dist/lib/Cache.d.ts +2 -2
- package/dist/lib/CacheFacade.d.ts +3 -3
- package/dist/lib/DllPlugin.d.ts +1 -1
- package/dist/lib/DllReferencePlugin.d.ts +5 -5
- package/dist/lib/EntryOptionPlugin.d.ts +2 -2
- package/dist/lib/EnvironmentPlugin.d.ts +1 -1
- package/dist/lib/HookWebpackError.d.ts +2 -2
- package/dist/lib/IgnoreWarningsPlugin.d.ts +1 -1
- package/dist/lib/LoaderOptionsPlugin.d.ts +2 -2
- package/dist/lib/LoaderTargetPlugin.d.ts +2 -2
- package/dist/lib/WebpackError.d.ts +3 -3
- package/dist/lib/cache/MemoryCachePlugin.d.ts +1 -1
- package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
- package/dist/lib/cache/mergeEtags.d.ts +1 -1
- package/dist/loader-runner/ModuleError.d.ts +1 -1
- package/dist/loader-runner/index.d.ts +3 -3
- package/dist/loader-runner/loadLoader.d.ts +2 -2
- package/dist/loader-runner/service.d.ts +8 -8
- package/dist/loader-runner/utils.d.ts +3 -3
- package/dist/loader-runner/worker.d.ts +3 -3
- package/dist/logging/createConsoleLogger.d.ts +4 -4
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/node/NodeEnvironmentPlugin.d.ts +2 -2
- package/dist/node/NodeTemplatePlugin.d.ts +1 -1
- package/dist/node/NodeWatchFileSystem.d.ts +3 -3
- package/dist/node/nodeConsole.d.ts +2 -2
- package/dist/rspack.d.ts +6 -15
- package/dist/rspackOptionsApply.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.d.ts +3 -3
- package/dist/sharing/ProvideSharedPlugin.d.ts +4 -4
- package/dist/sharing/SharePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +3 -3
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +15 -15
- package/dist/stats/DefaultStatsPresetPlugin.d.ts +1 -1
- package/dist/stats/DefaultStatsPrinterPlugin.d.ts +1 -1
- package/dist/stats/StatsFactory.d.ts +5 -5
- package/dist/stats/StatsPrinter.d.ts +3 -3
- package/dist/stats/statsFactoryUtils.d.ts +5 -5
- package/dist/swc.d.ts +2 -2
- package/dist/taps/compilation.d.ts +2 -2
- package/dist/taps/compiler.d.ts +1 -1
- package/dist/taps/contextModuleFactory.d.ts +1 -1
- package/dist/taps/index.d.ts +6 -6
- package/dist/taps/javascriptModules.d.ts +1 -1
- package/dist/taps/normalModuleFactory.d.ts +1 -1
- package/dist/taps/types.d.ts +3 -3
- package/dist/trace/index.d.ts +4 -4
- package/dist/trace/traceHookPlugin.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/createHash.d.ts +1 -1
- package/dist/util/createReadonlyMap.d.ts +1 -1
- package/dist/util/fs.d.ts +14 -14
- package/dist/util/hash/wasm-hash.d.ts +1 -1
- package/dist/util/identifier.d.ts +1 -1
- package/dist/util/index.d.ts +1 -2
- package/dist/util/source.d.ts +2 -2
- package/dist/util/validateConfig.d.ts +1 -1
- package/dist/worker.js +111 -111
- package/hot/dev-server.js +64 -64
- package/hot/emitter.js +11 -11
- package/hot/lazy-compilation-node.js +41 -41
- package/hot/lazy-compilation-web.js +52 -52
- package/hot/log-apply-result.js +36 -36
- package/hot/log.js +30 -30
- package/hot/only-dev-server.js +92 -92
- package/hot/poll.js +31 -31
- package/hot/signal.js +53 -53
- package/module.d.ts +215 -215
- 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (!upToDate()) {
|
|
36
|
+
check();
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
require("./log-apply-result")(updatedModules, updatedModules);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
+
this.events = {};
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
EventEmitter.prototype.on = function (eventName, callback) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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 !==
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
if (!compiling.has(data)) {
|
|
57
|
+
compiling.add(data);
|
|
58
|
+
updateEventSource();
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
return function () {
|
|
68
|
+
errorHandlers.delete(onError);
|
|
69
|
+
compiling.delete(data);
|
|
70
|
+
updateEventSource();
|
|
71
|
+
};
|
|
72
72
|
};
|
package/hot/log-apply-result.js
CHANGED
|
@@ -8,42 +8,42 @@
|
|
|
8
8
|
* @param {(string | number)[] | null} renewedModules renewed modules
|
|
9
9
|
*/
|
|
10
10
|
module.exports = function (updatedModules, renewedModules) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
var unacceptedModules = updatedModules.filter(function (moduleId) {
|
|
12
|
+
return renewedModules && renewedModules.indexOf(moduleId) < 0;
|
|
13
|
+
});
|
|
14
|
+
var log = require("./log");
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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 =
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
};
|