webpack-dev-server 5.2.2 → 5.2.3
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/README.md +4 -4
- package/bin/webpack-dev-server.js +17 -16
- package/client/clients/SockJSClient.js +18 -20
- package/client/clients/WebSocketClient.js +17 -11
- package/client/index.js +111 -72
- package/client/modules/logger/index.js +42 -35
- package/client/modules/sockjs-client/index.js +0 -1
- package/client/overlay.js +129 -79
- package/client/progress.js +40 -13
- package/client/socket.js +17 -13
- package/client/utils/log.js +1 -1
- package/client/utils/sendMessage.js +5 -3
- package/lib/Server.js +336 -317
- package/lib/getPort.js +21 -22
- package/lib/servers/BaseServer.js +1 -1
- package/lib/servers/SockJSServer.js +16 -14
- package/lib/servers/WebsocketServer.js +17 -22
- package/package.json +36 -31
- package/types/bin/webpack-dev-server.d.ts +1 -1
- package/types/lib/Server.d.ts +216 -149
- package/types/lib/getPort.d.ts +3 -3
- package/types/lib/servers/BaseServer.d.ts +1 -1
package/client/index.js
CHANGED
|
@@ -5,53 +5,72 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
7
|
/* global __resourceQuery, __webpack_hash__ */
|
|
8
|
-
|
|
9
|
-
import webpackHotLog from "webpack/hot/log.js";
|
|
8
|
+
// @ts-expect-error
|
|
10
9
|
import hotEmitter from "webpack/hot/emitter.js";
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
import webpackHotLog from "webpack/hot/log.js";
|
|
12
|
+
import { createOverlay, formatProblem } from "./overlay.js";
|
|
13
|
+
import { defineProgressElement, isProgressSupported } from "./progress.js";
|
|
11
14
|
import socket from "./socket.js";
|
|
12
|
-
import { formatProblem, createOverlay } from "./overlay.js";
|
|
13
15
|
import { log, setLogLevel } from "./utils/log.js";
|
|
14
16
|
import sendMessage from "./utils/sendMessage.js";
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line jsdoc/no-restricted-syntax
|
|
19
|
+
/** @typedef {any} EXPECTED_ANY */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} RawOverlayOptions
|
|
23
|
+
* @property {string=} warnings warnings
|
|
24
|
+
* @property {string=} errors errors
|
|
25
|
+
* @property {string=} runtimeErrors runtime errors
|
|
26
|
+
* @property {string=} trustedTypesPolicyName trusted types policy name
|
|
27
|
+
*/
|
|
16
28
|
|
|
17
29
|
/**
|
|
18
|
-
* @typedef {
|
|
19
|
-
* @property {boolean | (error: Error) => boolean}
|
|
20
|
-
* @property {boolean | (error: Error) => boolean}
|
|
21
|
-
* @property {boolean | (error: Error) => boolean}
|
|
22
|
-
* @property {string}
|
|
30
|
+
* @typedef {object} OverlayOptions
|
|
31
|
+
* @property {(boolean | ((error: Error) => boolean))=} warnings warnings
|
|
32
|
+
* @property {(boolean | ((error: Error) => boolean))=} errors errors
|
|
33
|
+
* @property {(boolean | ((error: Error) => boolean))=} runtimeErrors runtime errors
|
|
34
|
+
* @property {string=} trustedTypesPolicyName trusted types policy name
|
|
23
35
|
*/
|
|
24
36
|
|
|
37
|
+
/** @typedef {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} LogLevel */
|
|
38
|
+
|
|
25
39
|
/**
|
|
26
|
-
* @typedef {
|
|
27
|
-
* @property {boolean} hot
|
|
28
|
-
* @property {boolean} liveReload
|
|
29
|
-
* @property {boolean} progress
|
|
30
|
-
* @property {boolean | OverlayOptions} overlay
|
|
31
|
-
* @property {
|
|
32
|
-
* @property {number}
|
|
40
|
+
* @typedef {object} Options
|
|
41
|
+
* @property {boolean} hot true when hot enabled, otherwise false
|
|
42
|
+
* @property {boolean} liveReload true when live reload enabled, otherwise false
|
|
43
|
+
* @property {boolean} progress true when need to show progress, otherwise false
|
|
44
|
+
* @property {boolean | OverlayOptions} overlay overlay options
|
|
45
|
+
* @property {LogLevel=} logging logging level
|
|
46
|
+
* @property {number=} reconnect count of allowed reconnection
|
|
33
47
|
*/
|
|
34
48
|
|
|
35
49
|
/**
|
|
36
|
-
* @typedef {
|
|
37
|
-
* @property {boolean} isUnloading
|
|
38
|
-
* @property {string} currentHash
|
|
39
|
-
* @property {string}
|
|
50
|
+
* @typedef {object} Status
|
|
51
|
+
* @property {boolean} isUnloading true when unloaded, otherwise false
|
|
52
|
+
* @property {string} currentHash current hash
|
|
53
|
+
* @property {string=} previousHash previous hash
|
|
40
54
|
*/
|
|
41
55
|
|
|
42
56
|
/**
|
|
43
|
-
* @param {boolean |
|
|
57
|
+
* @param {boolean | RawOverlayOptions | OverlayOptions} overlayOptions overlay options
|
|
44
58
|
*/
|
|
45
59
|
var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
|
|
46
60
|
if (_typeof(overlayOptions) === "object") {
|
|
47
|
-
["warnings", "errors", "runtimeErrors"]
|
|
61
|
+
var requiredOptions = ["warnings", "errors", "runtimeErrors"];
|
|
62
|
+
for (var i = 0; i < requiredOptions.length; i++) {
|
|
63
|
+
var property = /** @type {keyof Omit<RawOverlayOptions, "trustedTypesPolicyName">} */
|
|
64
|
+
requiredOptions[i];
|
|
48
65
|
if (typeof overlayOptions[property] === "string") {
|
|
49
66
|
var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);
|
|
50
67
|
|
|
68
|
+
/** @type {OverlayOptions} */
|
|
69
|
+
overlayOptions[property] = /** @type {(error: Error) => boolean} */
|
|
51
70
|
// eslint-disable-next-line no-new-func
|
|
52
|
-
|
|
71
|
+
new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n return callback(message)"));
|
|
53
72
|
}
|
|
54
|
-
}
|
|
73
|
+
}
|
|
55
74
|
}
|
|
56
75
|
};
|
|
57
76
|
|
|
@@ -60,18 +79,17 @@ var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
|
|
|
60
79
|
*/
|
|
61
80
|
var status = {
|
|
62
81
|
isUnloading: false,
|
|
63
|
-
// eslint-disable-next-line camelcase
|
|
64
82
|
currentHash: __webpack_hash__
|
|
65
83
|
};
|
|
66
84
|
|
|
67
85
|
/**
|
|
68
|
-
* @returns {string}
|
|
86
|
+
* @returns {string} current script source
|
|
69
87
|
*/
|
|
70
88
|
var getCurrentScriptSource = function getCurrentScriptSource() {
|
|
71
89
|
// `document.currentScript` is the most accurate way to find the current script,
|
|
72
90
|
// but is not supported in all browsers.
|
|
73
91
|
if (document.currentScript) {
|
|
74
|
-
return document.currentScript.getAttribute("src");
|
|
92
|
+
return /** @type {string} */document.currentScript.getAttribute("src");
|
|
75
93
|
}
|
|
76
94
|
|
|
77
95
|
// Fallback to getting all scripts running in the document.
|
|
@@ -88,17 +106,22 @@ var getCurrentScriptSource = function getCurrentScriptSource() {
|
|
|
88
106
|
throw new Error("[webpack-dev-server] Failed to get current script source.");
|
|
89
107
|
};
|
|
90
108
|
|
|
109
|
+
/** @typedef {{ hot?: string, ["live-reload"]?: string, progress?: string, reconnect?: string, logging?: LogLevel, overlay?: string, fromCurrentScript?: boolean }} AdditionalParsedURL */
|
|
110
|
+
/** @typedef {Partial<URL> & AdditionalParsedURL} ParsedURL */
|
|
111
|
+
|
|
91
112
|
/**
|
|
92
|
-
* @param {string} resourceQuery
|
|
93
|
-
* @returns {
|
|
113
|
+
* @param {string} resourceQuery resource query
|
|
114
|
+
* @returns {ParsedURL} parsed URL
|
|
94
115
|
*/
|
|
95
116
|
var parseURL = function parseURL(resourceQuery) {
|
|
96
|
-
/** @type {
|
|
117
|
+
/** @type {ParsedURL} */
|
|
97
118
|
var result = {};
|
|
98
119
|
if (typeof resourceQuery === "string" && resourceQuery !== "") {
|
|
99
120
|
var searchParams = resourceQuery.slice(1).split("&");
|
|
100
121
|
for (var i = 0; i < searchParams.length; i++) {
|
|
101
122
|
var pair = searchParams[i].split("=");
|
|
123
|
+
|
|
124
|
+
/** @type {EXPECTED_ANY} */
|
|
102
125
|
result[pair[0]] = decodeURIComponent(pair[1]);
|
|
103
126
|
}
|
|
104
127
|
} else {
|
|
@@ -110,7 +133,7 @@ var parseURL = function parseURL(resourceQuery) {
|
|
|
110
133
|
// is to allow parsing of path-relative or protocol-relative URLs,
|
|
111
134
|
// and will have no effect if `scriptSource` is a fully valid URL.
|
|
112
135
|
scriptSourceURL = new URL(scriptSource, self.location.href);
|
|
113
|
-
} catch (
|
|
136
|
+
} catch (_err) {
|
|
114
137
|
// URL parsing failed, do nothing.
|
|
115
138
|
// We will still proceed to see if we can recover using `resourceQuery`
|
|
116
139
|
}
|
|
@@ -122,6 +145,10 @@ var parseURL = function parseURL(resourceQuery) {
|
|
|
122
145
|
return result;
|
|
123
146
|
};
|
|
124
147
|
var parsedResourceQuery = parseURL(__resourceQuery);
|
|
148
|
+
|
|
149
|
+
/** @typedef {{ ["Hot Module Replacement"]: boolean, ["Live Reloading"]: boolean, Progress: boolean, Overlay: boolean }} Features */
|
|
150
|
+
|
|
151
|
+
/** @type {Features} */
|
|
125
152
|
var enabledFeatures = {
|
|
126
153
|
"Hot Module Replacement": false,
|
|
127
154
|
"Live Reloading": false,
|
|
@@ -151,8 +178,8 @@ if (parsedResourceQuery.progress === "true") {
|
|
|
151
178
|
if (parsedResourceQuery.overlay) {
|
|
152
179
|
try {
|
|
153
180
|
options.overlay = JSON.parse(parsedResourceQuery.overlay);
|
|
154
|
-
} catch (
|
|
155
|
-
log.error("Error parsing overlay options from resource query:",
|
|
181
|
+
} catch (err) {
|
|
182
|
+
log.error("Error parsing overlay options from resource query:", err);
|
|
156
183
|
}
|
|
157
184
|
|
|
158
185
|
// Fill in default "true" params for partially-specified objects.
|
|
@@ -174,7 +201,7 @@ if (typeof parsedResourceQuery.reconnect !== "undefined") {
|
|
|
174
201
|
}
|
|
175
202
|
|
|
176
203
|
/**
|
|
177
|
-
* @param {
|
|
204
|
+
* @param {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} level level
|
|
178
205
|
*/
|
|
179
206
|
var setAllLogLevel = function setAllLogLevel(level) {
|
|
180
207
|
// This is needed because the HMR logger operate separately from dev server logger
|
|
@@ -184,6 +211,10 @@ var setAllLogLevel = function setAllLogLevel(level) {
|
|
|
184
211
|
if (options.logging) {
|
|
185
212
|
setAllLogLevel(options.logging);
|
|
186
213
|
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @param {Features} features features
|
|
217
|
+
*/
|
|
187
218
|
var logEnabledFeatures = function logEnabledFeatures(features) {
|
|
188
219
|
var listEnabledFeatures = Object.keys(features);
|
|
189
220
|
if (!features || listEnabledFeatures.length === 0) {
|
|
@@ -193,7 +224,7 @@ var logEnabledFeatures = function logEnabledFeatures(features) {
|
|
|
193
224
|
|
|
194
225
|
// Server started: Hot Module Replacement enabled, Live Reloading enabled, Overlay disabled.
|
|
195
226
|
for (var i = 0; i < listEnabledFeatures.length; i++) {
|
|
196
|
-
var key = listEnabledFeatures[i];
|
|
227
|
+
var key = /** @type {keyof Features} */listEnabledFeatures[i];
|
|
197
228
|
logString += " ".concat(key, " ").concat(features[key] ? "enabled" : "disabled", ",");
|
|
198
229
|
}
|
|
199
230
|
// replace last comma with a period
|
|
@@ -215,8 +246,8 @@ var overlay = typeof window !== "undefined" ? createOverlay(_typeof(options.over
|
|
|
215
246
|
};
|
|
216
247
|
|
|
217
248
|
/**
|
|
218
|
-
* @param {Options} options
|
|
219
|
-
* @param {Status} currentStatus
|
|
249
|
+
* @param {Options} options options
|
|
250
|
+
* @param {Status} currentStatus current status
|
|
220
251
|
*/
|
|
221
252
|
var reloadApp = function reloadApp(_ref, currentStatus) {
|
|
222
253
|
var hot = _ref.hot,
|
|
@@ -232,8 +263,8 @@ var reloadApp = function reloadApp(_ref, currentStatus) {
|
|
|
232
263
|
}
|
|
233
264
|
|
|
234
265
|
/**
|
|
235
|
-
* @param {Window} rootWindow
|
|
236
|
-
* @param {number} intervalId
|
|
266
|
+
* @param {Window} rootWindow root window
|
|
267
|
+
* @param {number} intervalId interval id
|
|
237
268
|
*/
|
|
238
269
|
function applyReload(rootWindow, intervalId) {
|
|
239
270
|
clearInterval(intervalId);
|
|
@@ -245,7 +276,18 @@ var reloadApp = function reloadApp(_ref, currentStatus) {
|
|
|
245
276
|
var allowToLiveReload = search.indexOf("webpack-dev-server-live-reload=false") === -1;
|
|
246
277
|
if (hot && allowToHot) {
|
|
247
278
|
log.info("App hot update...");
|
|
248
|
-
|
|
279
|
+
if (typeof EventTarget !== "undefined" && hotEmitter instanceof EventTarget) {
|
|
280
|
+
var event = new CustomEvent("webpackHotUpdate", {
|
|
281
|
+
detail: {
|
|
282
|
+
currentHash: currentStatus.currentHash
|
|
283
|
+
},
|
|
284
|
+
bubbles: true,
|
|
285
|
+
cancelable: false
|
|
286
|
+
});
|
|
287
|
+
hotEmitter.dispatchEvent(event);
|
|
288
|
+
} else {
|
|
289
|
+
hotEmitter.emit("webpackHotUpdate", currentStatus.currentHash);
|
|
290
|
+
}
|
|
249
291
|
if (typeof self !== "undefined" && self.window) {
|
|
250
292
|
// broadcast update to window
|
|
251
293
|
self.postMessage("webpackHotUpdate".concat(currentStatus.currentHash), "*");
|
|
@@ -253,6 +295,7 @@ var reloadApp = function reloadApp(_ref, currentStatus) {
|
|
|
253
295
|
}
|
|
254
296
|
// allow refreshing the page only if liveReload isn't disabled
|
|
255
297
|
else if (liveReload && allowToLiveReload) {
|
|
298
|
+
/** @type {Window} */
|
|
256
299
|
var rootWindow = self;
|
|
257
300
|
|
|
258
301
|
// use parent window for reload (in case we're in an iframe with no valid src)
|
|
@@ -273,13 +316,11 @@ var reloadApp = function reloadApp(_ref, currentStatus) {
|
|
|
273
316
|
var ansiRegex = new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|"), "g");
|
|
274
317
|
|
|
275
318
|
/**
|
|
276
|
-
*
|
|
277
319
|
* Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
|
278
320
|
* Adapted from code originally released by Sindre Sorhus
|
|
279
321
|
* Licensed the MIT License
|
|
280
|
-
*
|
|
281
|
-
* @
|
|
282
|
-
* @return {string}
|
|
322
|
+
* @param {string} string string
|
|
323
|
+
* @returns {string} string without ansi
|
|
283
324
|
*/
|
|
284
325
|
var stripAnsi = function stripAnsi(string) {
|
|
285
326
|
if (typeof string !== "string") {
|
|
@@ -312,7 +353,7 @@ var onSocketMessage = {
|
|
|
312
353
|
sendMessage("Invalid");
|
|
313
354
|
},
|
|
314
355
|
/**
|
|
315
|
-
* @param {string} hash
|
|
356
|
+
* @param {string} hash hash
|
|
316
357
|
*/
|
|
317
358
|
hash: function hash(_hash) {
|
|
318
359
|
status.previousHash = status.currentHash;
|
|
@@ -320,7 +361,7 @@ var onSocketMessage = {
|
|
|
320
361
|
},
|
|
321
362
|
logging: setAllLogLevel,
|
|
322
363
|
/**
|
|
323
|
-
* @param {boolean} value
|
|
364
|
+
* @param {boolean} value overlay value
|
|
324
365
|
*/
|
|
325
366
|
overlay: function overlay(value) {
|
|
326
367
|
if (typeof document === "undefined") {
|
|
@@ -330,7 +371,7 @@ var onSocketMessage = {
|
|
|
330
371
|
decodeOverlayOptions(options.overlay);
|
|
331
372
|
},
|
|
332
373
|
/**
|
|
333
|
-
* @param {number} value
|
|
374
|
+
* @param {number} value reconnect value
|
|
334
375
|
*/
|
|
335
376
|
reconnect: function reconnect(value) {
|
|
336
377
|
if (parsedResourceQuery.reconnect === "false") {
|
|
@@ -339,29 +380,27 @@ var onSocketMessage = {
|
|
|
339
380
|
options.reconnect = value;
|
|
340
381
|
},
|
|
341
382
|
/**
|
|
342
|
-
* @param {boolean} value
|
|
383
|
+
* @param {boolean} value progress value
|
|
343
384
|
*/
|
|
344
385
|
progress: function progress(value) {
|
|
345
386
|
options.progress = value;
|
|
346
387
|
},
|
|
347
388
|
/**
|
|
348
|
-
* @param {{ pluginName?: string, percent:
|
|
389
|
+
* @param {{ pluginName?: string, percent: string, msg: string }} data date with progress
|
|
349
390
|
*/
|
|
350
391
|
"progress-update": function progressUpdate(data) {
|
|
351
392
|
if (options.progress) {
|
|
352
393
|
log.info("".concat(data.pluginName ? "[".concat(data.pluginName, "] ") : "").concat(data.percent, "% - ").concat(data.msg, "."));
|
|
353
394
|
}
|
|
354
|
-
if (isProgressSupported()) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
document.body.appendChild(progress);
|
|
361
|
-
}
|
|
362
|
-
progress.setAttribute("progress", data.percent);
|
|
363
|
-
progress.setAttribute("type", options.progress);
|
|
395
|
+
if (isProgressSupported() && typeof options.progress === "string") {
|
|
396
|
+
var progress = document.querySelector("wds-progress");
|
|
397
|
+
if (!progress) {
|
|
398
|
+
defineProgressElement();
|
|
399
|
+
progress = document.createElement("wds-progress");
|
|
400
|
+
document.body.appendChild(progress);
|
|
364
401
|
}
|
|
402
|
+
progress.setAttribute("progress", data.percent);
|
|
403
|
+
progress.setAttribute("type", options.progress);
|
|
365
404
|
}
|
|
366
405
|
sendMessage("Progress", data);
|
|
367
406
|
},
|
|
@@ -384,15 +423,15 @@ var onSocketMessage = {
|
|
|
384
423
|
reloadApp(options, status);
|
|
385
424
|
},
|
|
386
425
|
/**
|
|
387
|
-
* @param {string} file
|
|
426
|
+
* @param {string} file changed file
|
|
388
427
|
*/
|
|
389
428
|
"static-changed": function staticChanged(file) {
|
|
390
429
|
log.info("".concat(file ? "\"".concat(file, "\"") : "Content", " from static directory was changed. Reloading..."));
|
|
391
430
|
self.location.reload();
|
|
392
431
|
},
|
|
393
432
|
/**
|
|
394
|
-
* @param {Error[]} warnings
|
|
395
|
-
* @param {
|
|
433
|
+
* @param {Error[]} warnings warnings
|
|
434
|
+
* @param {{ preventReloading: boolean }=} params extra params
|
|
396
435
|
*/
|
|
397
436
|
warnings: function warnings(_warnings, params) {
|
|
398
437
|
log.warn("Warnings while compiling.");
|
|
@@ -423,7 +462,7 @@ var onSocketMessage = {
|
|
|
423
462
|
reloadApp(options, status);
|
|
424
463
|
},
|
|
425
464
|
/**
|
|
426
|
-
* @param {Error[]} errors
|
|
465
|
+
* @param {Error[]} errors errors
|
|
427
466
|
*/
|
|
428
467
|
errors: function errors(_errors) {
|
|
429
468
|
log.error("Errors while compiling. Reload prevented.");
|
|
@@ -450,7 +489,7 @@ var onSocketMessage = {
|
|
|
450
489
|
}
|
|
451
490
|
},
|
|
452
491
|
/**
|
|
453
|
-
* @param {Error} error
|
|
492
|
+
* @param {Error} error error
|
|
454
493
|
*/
|
|
455
494
|
error: function error(_error) {
|
|
456
495
|
log.error(_error);
|
|
@@ -467,12 +506,12 @@ var onSocketMessage = {
|
|
|
467
506
|
};
|
|
468
507
|
|
|
469
508
|
/**
|
|
470
|
-
* @param {{ protocol?: string, auth?: string, hostname?: string, port?: string, pathname?: string, search?: string, hash?: string, slashes?: boolean }} objURL
|
|
471
|
-
* @returns {string}
|
|
509
|
+
* @param {{ protocol?: string, auth?: string, hostname?: string, port?: string, pathname?: string, search?: string, hash?: string, slashes?: boolean }} objURL object URL
|
|
510
|
+
* @returns {string} formatted url
|
|
472
511
|
*/
|
|
473
512
|
var formatURL = function formatURL(objURL) {
|
|
474
513
|
var protocol = objURL.protocol || "";
|
|
475
|
-
if (protocol && protocol.
|
|
514
|
+
if (protocol && protocol.slice(-1) !== ":") {
|
|
476
515
|
protocol += ":";
|
|
477
516
|
}
|
|
478
517
|
var auth = objURL.auth || "";
|
|
@@ -507,8 +546,8 @@ var formatURL = function formatURL(objURL) {
|
|
|
507
546
|
}
|
|
508
547
|
pathname = pathname.replace(/[?#]/g,
|
|
509
548
|
/**
|
|
510
|
-
* @param {string} match
|
|
511
|
-
* @returns {string}
|
|
549
|
+
* @param {string} match matched string
|
|
550
|
+
* @returns {string} encoded URI component
|
|
512
551
|
*/
|
|
513
552
|
function (match) {
|
|
514
553
|
return encodeURIComponent(match);
|
|
@@ -518,8 +557,8 @@ var formatURL = function formatURL(objURL) {
|
|
|
518
557
|
};
|
|
519
558
|
|
|
520
559
|
/**
|
|
521
|
-
* @param {
|
|
522
|
-
* @returns {string}
|
|
560
|
+
* @param {ParsedURL} parsedURL parsed URL
|
|
561
|
+
* @returns {string} socket URL
|
|
523
562
|
*/
|
|
524
563
|
var createSocketURL = function createSocketURL(parsedURL) {
|
|
525
564
|
var hostname = parsedURL.hostname;
|
|
@@ -588,4 +627,4 @@ var createSocketURL = function createSocketURL(parsedURL) {
|
|
|
588
627
|
};
|
|
589
628
|
var socketURL = createSocketURL(parsedResourceQuery);
|
|
590
629
|
socket(socketURL, onSocketMessage, options.reconnect);
|
|
591
|
-
export { getCurrentScriptSource, parseURL
|
|
630
|
+
export { createSocketURL, getCurrentScriptSource, parseURL };
|
|
@@ -12,6 +12,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12
12
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13
13
|
/* harmony export */ SyncBailHook: function() { return /* binding */ SyncBailHook; }
|
|
14
14
|
/* harmony export */ });
|
|
15
|
+
/**
|
|
16
|
+
* @returns {SyncBailHook} mocked sync bail hook
|
|
17
|
+
* @constructor
|
|
18
|
+
*/
|
|
15
19
|
function SyncBailHook() {
|
|
16
20
|
return {
|
|
17
21
|
call: function call() {}
|
|
@@ -21,7 +25,6 @@ function SyncBailHook() {
|
|
|
21
25
|
/**
|
|
22
26
|
* Client stub for tapable SyncBailHook
|
|
23
27
|
*/
|
|
24
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
/***/ }),
|
|
@@ -141,9 +144,11 @@ module.exports.LogType = LogType;
|
|
|
141
144
|
var LOG_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger raw log method");
|
|
142
145
|
var TIMERS_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger times");
|
|
143
146
|
var TIMERS_AGGREGATES_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger aggregated times");
|
|
147
|
+
|
|
148
|
+
/** @typedef {EXPECTED_ANY[]} Args */
|
|
144
149
|
var WebpackLogger = /*#__PURE__*/function () {
|
|
145
150
|
/**
|
|
146
|
-
* @param {(type: LogTypeEnum, args?:
|
|
151
|
+
* @param {(type: LogTypeEnum, args?: Args) => void} log log function
|
|
147
152
|
* @param {(name: string | (() => string)) => WebpackLogger} getChildLogger function to create child logger
|
|
148
153
|
*/
|
|
149
154
|
function WebpackLogger(log, getChildLogger) {
|
|
@@ -153,7 +158,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
/**
|
|
156
|
-
* @param {
|
|
161
|
+
* @param {Args} args args
|
|
157
162
|
*/
|
|
158
163
|
return _createClass(WebpackLogger, [{
|
|
159
164
|
key: "error",
|
|
@@ -165,7 +170,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
/**
|
|
168
|
-
* @param {
|
|
173
|
+
* @param {Args} args args
|
|
169
174
|
*/
|
|
170
175
|
}, {
|
|
171
176
|
key: "warn",
|
|
@@ -177,7 +182,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
/**
|
|
180
|
-
* @param {
|
|
185
|
+
* @param {Args} args args
|
|
181
186
|
*/
|
|
182
187
|
}, {
|
|
183
188
|
key: "info",
|
|
@@ -189,7 +194,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
/**
|
|
192
|
-
* @param {
|
|
197
|
+
* @param {Args} args args
|
|
193
198
|
*/
|
|
194
199
|
}, {
|
|
195
200
|
key: "log",
|
|
@@ -201,7 +206,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
/**
|
|
204
|
-
* @param {
|
|
209
|
+
* @param {Args} args args
|
|
205
210
|
*/
|
|
206
211
|
}, {
|
|
207
212
|
key: "debug",
|
|
@@ -214,7 +219,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
214
219
|
|
|
215
220
|
/**
|
|
216
221
|
* @param {EXPECTED_ANY} assertion assertion
|
|
217
|
-
* @param {
|
|
222
|
+
* @param {Args} args args
|
|
218
223
|
*/
|
|
219
224
|
}, {
|
|
220
225
|
key: "assert",
|
|
@@ -238,7 +243,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
/**
|
|
241
|
-
* @param {
|
|
246
|
+
* @param {Args} args args
|
|
242
247
|
*/
|
|
243
248
|
}, {
|
|
244
249
|
key: "status",
|
|
@@ -250,7 +255,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
250
255
|
}
|
|
251
256
|
|
|
252
257
|
/**
|
|
253
|
-
* @param {
|
|
258
|
+
* @param {Args} args args
|
|
254
259
|
*/
|
|
255
260
|
}, {
|
|
256
261
|
key: "group",
|
|
@@ -262,7 +267,7 @@ var WebpackLogger = /*#__PURE__*/function () {
|
|
|
262
267
|
}
|
|
263
268
|
|
|
264
269
|
/**
|
|
265
|
-
* @param {
|
|
270
|
+
* @param {Args} args args
|
|
266
271
|
*/
|
|
267
272
|
}, {
|
|
268
273
|
key: "groupCollapsed",
|
|
@@ -471,26 +476,27 @@ var _require = __webpack_require__(/*! ./Logger */ "./node_modules/webpack/lib/l
|
|
|
471
476
|
/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */
|
|
472
477
|
/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */
|
|
473
478
|
/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */
|
|
479
|
+
/** @typedef {import("./Logger").Args} Args */
|
|
474
480
|
|
|
475
481
|
/** @typedef {(item: string) => boolean} FilterFunction */
|
|
476
|
-
/** @typedef {(value: string, type: LogTypeEnum, args?:
|
|
482
|
+
/** @typedef {(value: string, type: LogTypeEnum, args?: Args) => void} LoggingFunction */
|
|
477
483
|
|
|
478
484
|
/**
|
|
479
485
|
* @typedef {object} LoggerConsole
|
|
480
486
|
* @property {() => void} clear
|
|
481
487
|
* @property {() => void} trace
|
|
482
|
-
* @property {(...args:
|
|
483
|
-
* @property {(...args:
|
|
484
|
-
* @property {(...args:
|
|
485
|
-
* @property {(...args:
|
|
486
|
-
* @property {(...args:
|
|
487
|
-
* @property {(...args:
|
|
488
|
-
* @property {(...args:
|
|
489
|
-
* @property {(...args:
|
|
490
|
-
* @property {(...args:
|
|
491
|
-
* @property {(...args:
|
|
492
|
-
* @property {(...args:
|
|
493
|
-
* @property {(...args:
|
|
488
|
+
* @property {(...args: Args) => void} info
|
|
489
|
+
* @property {(...args: Args) => void} log
|
|
490
|
+
* @property {(...args: Args) => void} warn
|
|
491
|
+
* @property {(...args: Args) => void} error
|
|
492
|
+
* @property {(...args: Args) => void=} debug
|
|
493
|
+
* @property {(...args: Args) => void=} group
|
|
494
|
+
* @property {(...args: Args) => void=} groupCollapsed
|
|
495
|
+
* @property {(...args: Args) => void=} groupEnd
|
|
496
|
+
* @property {(...args: Args) => void=} status
|
|
497
|
+
* @property {(...args: Args) => void=} profile
|
|
498
|
+
* @property {(...args: Args) => void=} profileEnd
|
|
499
|
+
* @property {(...args: Args) => void=} logTime
|
|
494
500
|
*/
|
|
495
501
|
|
|
496
502
|
/**
|
|
@@ -554,13 +560,13 @@ module.exports = function (_ref) {
|
|
|
554
560
|
|
|
555
561
|
typeof debug === "boolean" ? [function () {
|
|
556
562
|
return debug;
|
|
557
|
-
}] : /** @type {FilterItemTypes[]} */
|
|
563
|
+
}] : /** @type {FilterItemTypes[]} */_toConsumableArray(Array.isArray(debug) ? debug : [debug]).map(filterToFunction);
|
|
558
564
|
var loglevel = LogLevel["".concat(level)] || 0;
|
|
559
565
|
|
|
560
566
|
/**
|
|
561
567
|
* @param {string} name name of the logger
|
|
562
568
|
* @param {LogTypeEnum} type type of the log entry
|
|
563
|
-
* @param {
|
|
569
|
+
* @param {Args=} args arguments of the log entry
|
|
564
570
|
* @returns {void}
|
|
565
571
|
*/
|
|
566
572
|
var logger = function logger(name, type, args) {
|
|
@@ -720,6 +726,15 @@ var currentDefaultLoggerOptions = {
|
|
|
720
726
|
};
|
|
721
727
|
var currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
|
|
722
728
|
|
|
729
|
+
/**
|
|
730
|
+
* @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
|
|
731
|
+
* @returns {void}
|
|
732
|
+
*/
|
|
733
|
+
module.exports.configureDefaultLogger = function (options) {
|
|
734
|
+
_extends(currentDefaultLoggerOptions, options);
|
|
735
|
+
currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
|
|
736
|
+
};
|
|
737
|
+
|
|
723
738
|
/**
|
|
724
739
|
* @param {string} name name of the logger
|
|
725
740
|
* @returns {Logger} a logger
|
|
@@ -733,15 +748,6 @@ module.exports.getLogger = function (name) {
|
|
|
733
748
|
return module.exports.getLogger("".concat(name, "/").concat(childName));
|
|
734
749
|
});
|
|
735
750
|
};
|
|
736
|
-
|
|
737
|
-
/**
|
|
738
|
-
* @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
|
|
739
|
-
* @returns {void}
|
|
740
|
-
*/
|
|
741
|
-
module.exports.configureDefaultLogger = function (options) {
|
|
742
|
-
_extends(currentDefaultLoggerOptions, options);
|
|
743
|
-
currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
|
|
744
|
-
};
|
|
745
751
|
module.exports.hooks = {
|
|
746
752
|
log: new SyncBailHook(["origin", "type", "args"])
|
|
747
753
|
};
|
|
@@ -815,6 +821,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
815
821
|
/* harmony export */ "default": function() { return /* reexport default export from named module */ webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__; }
|
|
816
822
|
/* harmony export */ });
|
|
817
823
|
/* harmony import */ var webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack/lib/logging/runtime.js */ "./node_modules/webpack/lib/logging/runtime.js");
|
|
824
|
+
// @ts-expect-error
|
|
818
825
|
|
|
819
826
|
}();
|
|
820
827
|
var __webpack_export_target__ = exports;
|
|
@@ -5031,7 +5031,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5031
5031
|
/* harmony export */ });
|
|
5032
5032
|
/* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sockjs-client */ "./node_modules/sockjs-client/lib/entry.js");
|
|
5033
5033
|
/* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
|
|
5034
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5035
5034
|
|
|
5036
5035
|
}();
|
|
5037
5036
|
/******/ return __webpack_exports__;
|