webpack-dev-server 4.13.3 → 4.15.0
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/bin/webpack-dev-server.js +12 -2
- package/client/index.js +48 -15
- package/client/overlay/runtime-error.js +17 -1
- package/client/overlay/state-machine.js +9 -4
- package/client/overlay.js +33 -14
- package/lib/Server.js +44 -7
- package/lib/options.json +39 -15
- package/package.json +2 -2
- package/types/lib/Server.d.ts +209 -120
|
@@ -85,8 +85,18 @@ const runCli = (cli) => {
|
|
|
85
85
|
const pkgPath = require.resolve(`${cli.package}/package.json`);
|
|
86
86
|
// eslint-disable-next-line import/no-dynamic-require
|
|
87
87
|
const pkg = require(pkgPath);
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
|
|
89
|
+
if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
|
|
90
|
+
import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch(
|
|
91
|
+
(error) => {
|
|
92
|
+
console.error(error);
|
|
93
|
+
process.exitCode = 1;
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
} else {
|
|
97
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
98
|
+
require(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName]));
|
|
99
|
+
}
|
|
90
100
|
};
|
|
91
101
|
|
|
92
102
|
/**
|
package/client/index.js
CHANGED
|
@@ -15,12 +15,20 @@ import sendMessage from "./utils/sendMessage.js";
|
|
|
15
15
|
import reloadApp from "./utils/reloadApp.js";
|
|
16
16
|
import createSocketURL from "./utils/createSocketURL.js";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} OverlayOptions
|
|
20
|
+
* @property {boolean | (error: Error) => boolean} [warnings]
|
|
21
|
+
* @property {boolean | (error: Error) => boolean} [errors]
|
|
22
|
+
* @property {boolean | (error: Error) => boolean} [runtimeErrors]
|
|
23
|
+
* @property {string} [trustedTypesPolicyName]
|
|
24
|
+
*/
|
|
25
|
+
|
|
18
26
|
/**
|
|
19
27
|
* @typedef {Object} Options
|
|
20
28
|
* @property {boolean} hot
|
|
21
29
|
* @property {boolean} liveReload
|
|
22
30
|
* @property {boolean} progress
|
|
23
|
-
* @property {boolean |
|
|
31
|
+
* @property {boolean | OverlayOptions} overlay
|
|
24
32
|
* @property {string} [logging]
|
|
25
33
|
* @property {number} [reconnect]
|
|
26
34
|
*/
|
|
@@ -32,6 +40,23 @@ import createSocketURL from "./utils/createSocketURL.js";
|
|
|
32
40
|
* @property {string} [previousHash]
|
|
33
41
|
*/
|
|
34
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @param {boolean | { warnings?: boolean | string; errors?: boolean | string; runtimeErrors?: boolean | string; }} overlayOptions
|
|
45
|
+
*/
|
|
46
|
+
var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
|
|
47
|
+
if (typeof overlayOptions === "object") {
|
|
48
|
+
["warnings", "errors", "runtimeErrors"].forEach(function (property) {
|
|
49
|
+
if (typeof overlayOptions[property] === "string") {
|
|
50
|
+
var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);
|
|
51
|
+
|
|
52
|
+
// eslint-disable-next-line no-new-func
|
|
53
|
+
var overlayFilterFunction = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n return callback(message)"));
|
|
54
|
+
overlayOptions[property] = overlayFilterFunction;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
35
60
|
/**
|
|
36
61
|
* @type {Status}
|
|
37
62
|
*/
|
|
@@ -82,6 +107,7 @@ if (parsedResourceQuery.overlay) {
|
|
|
82
107
|
warnings: true,
|
|
83
108
|
runtimeErrors: true
|
|
84
109
|
}, options.overlay);
|
|
110
|
+
decodeOverlayOptions(options.overlay);
|
|
85
111
|
}
|
|
86
112
|
enabledFeatures.Overlay = true;
|
|
87
113
|
}
|
|
@@ -156,6 +182,7 @@ var onSocketMessage = {
|
|
|
156
182
|
return;
|
|
157
183
|
}
|
|
158
184
|
options.overlay = value;
|
|
185
|
+
decodeOverlayOptions(options.overlay);
|
|
159
186
|
},
|
|
160
187
|
/**
|
|
161
188
|
* @param {number} value
|
|
@@ -230,13 +257,16 @@ var onSocketMessage = {
|
|
|
230
257
|
for (var i = 0; i < printableWarnings.length; i++) {
|
|
231
258
|
log.warn(printableWarnings[i]);
|
|
232
259
|
}
|
|
233
|
-
var
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
260
|
+
var overlayWarningsSetting = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.warnings;
|
|
261
|
+
if (overlayWarningsSetting) {
|
|
262
|
+
var warningsToDisplay = typeof overlayWarningsSetting === "function" ? _warnings.filter(overlayWarningsSetting) : _warnings;
|
|
263
|
+
if (warningsToDisplay.length) {
|
|
264
|
+
overlay.send({
|
|
265
|
+
type: "BUILD_ERROR",
|
|
266
|
+
level: "warning",
|
|
267
|
+
messages: _warnings
|
|
268
|
+
});
|
|
269
|
+
}
|
|
240
270
|
}
|
|
241
271
|
if (params && params.preventReloading) {
|
|
242
272
|
return;
|
|
@@ -258,13 +288,16 @@ var onSocketMessage = {
|
|
|
258
288
|
for (var i = 0; i < printableErrors.length; i++) {
|
|
259
289
|
log.error(printableErrors[i]);
|
|
260
290
|
}
|
|
261
|
-
var
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
291
|
+
var overlayErrorsSettings = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.errors;
|
|
292
|
+
if (overlayErrorsSettings) {
|
|
293
|
+
var errorsToDisplay = typeof overlayErrorsSettings === "function" ? _errors.filter(overlayErrorsSettings) : _errors;
|
|
294
|
+
if (errorsToDisplay.length) {
|
|
295
|
+
overlay.send({
|
|
296
|
+
type: "BUILD_ERROR",
|
|
297
|
+
level: "error",
|
|
298
|
+
messages: _errors
|
|
299
|
+
});
|
|
300
|
+
}
|
|
268
301
|
}
|
|
269
302
|
},
|
|
270
303
|
/**
|
|
@@ -28,4 +28,20 @@ function listenToRuntimeError(callback) {
|
|
|
28
28
|
window.removeEventListener("error", callback);
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @callback UnhandledRejectionCallback
|
|
34
|
+
* @param {PromiseRejectionEvent} rejectionEvent
|
|
35
|
+
* @returns {void}
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {UnhandledRejectionCallback} callback
|
|
40
|
+
*/
|
|
41
|
+
function listenToUnhandledRejection(callback) {
|
|
42
|
+
window.addEventListener("unhandledrejection", callback);
|
|
43
|
+
return function cleanup() {
|
|
44
|
+
window.removeEventListener("unhandledrejection", callback);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export { listenToRuntimeError, listenToUnhandledRejection, parseErrorToStacks };
|
|
@@ -4,6 +4,7 @@ import createMachine from "./fsm.js";
|
|
|
4
4
|
* @typedef {Object} ShowOverlayData
|
|
5
5
|
* @property {'warning' | 'error'} level
|
|
6
6
|
* @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
|
|
7
|
+
* @property {'build' | 'runtime'} messageSource
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -22,7 +23,8 @@ var createOverlayMachine = function createOverlayMachine(options) {
|
|
|
22
23
|
initial: "hidden",
|
|
23
24
|
context: {
|
|
24
25
|
level: "error",
|
|
25
|
-
messages: []
|
|
26
|
+
messages: [],
|
|
27
|
+
messageSource: "build"
|
|
26
28
|
},
|
|
27
29
|
states: {
|
|
28
30
|
hidden: {
|
|
@@ -71,19 +73,22 @@ var createOverlayMachine = function createOverlayMachine(options) {
|
|
|
71
73
|
dismissMessages: function dismissMessages() {
|
|
72
74
|
return {
|
|
73
75
|
messages: [],
|
|
74
|
-
level: "error"
|
|
76
|
+
level: "error",
|
|
77
|
+
messageSource: "build"
|
|
75
78
|
};
|
|
76
79
|
},
|
|
77
80
|
appendMessages: function appendMessages(context, event) {
|
|
78
81
|
return {
|
|
79
82
|
messages: context.messages.concat(event.messages),
|
|
80
|
-
level: event.level || context.level
|
|
83
|
+
level: event.level || context.level,
|
|
84
|
+
messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
|
|
81
85
|
};
|
|
82
86
|
},
|
|
83
87
|
setMessages: function setMessages(context, event) {
|
|
84
88
|
return {
|
|
85
89
|
messages: event.messages,
|
|
86
|
-
level: event.level || context.level
|
|
90
|
+
level: event.level || context.level,
|
|
91
|
+
messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
|
|
87
92
|
};
|
|
88
93
|
},
|
|
89
94
|
hideOverlay: hideOverlay,
|
package/client/overlay.js
CHANGED
|
@@ -8,7 +8,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
8
8
|
|
|
9
9
|
import ansiHTML from "ansi-html-community";
|
|
10
10
|
import { encode } from "html-entities";
|
|
11
|
-
import { listenToRuntimeError, parseErrorToStacks } from "./overlay/runtime-error.js";
|
|
11
|
+
import { listenToRuntimeError, listenToUnhandledRejection, parseErrorToStacks } from "./overlay/runtime-error.js";
|
|
12
12
|
import createOverlayMachine from "./overlay/state-machine.js";
|
|
13
13
|
import { containerStyle, dismissButtonStyle, headerStyle, iframeStyle, msgStyles, msgTextStyle, msgTypeStyle } from "./overlay/styles.js";
|
|
14
14
|
var colors = {
|
|
@@ -59,7 +59,7 @@ function formatProblem(type, item) {
|
|
|
59
59
|
/**
|
|
60
60
|
* @typedef {Object} CreateOverlayOptions
|
|
61
61
|
* @property {string | null} trustedTypesPolicyName
|
|
62
|
-
* @property {boolean} [catchRuntimeError]
|
|
62
|
+
* @property {boolean | (error: Error) => void} [catchRuntimeError]
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -71,6 +71,8 @@ var createOverlay = function createOverlay(options) {
|
|
|
71
71
|
var iframeContainerElement;
|
|
72
72
|
/** @type {HTMLDivElement | null | undefined} */
|
|
73
73
|
var containerElement;
|
|
74
|
+
/** @type {HTMLDivElement | null | undefined} */
|
|
75
|
+
var headerElement;
|
|
74
76
|
/** @type {Array<(element: HTMLDivElement) => void>} */
|
|
75
77
|
var onLoadQueue = [];
|
|
76
78
|
/** @type {TrustedTypePolicy | undefined} */
|
|
@@ -112,7 +114,7 @@ var createOverlay = function createOverlay(options) {
|
|
|
112
114
|
iframeContainerElement.contentDocument.createElement("div");
|
|
113
115
|
contentElement.id = "webpack-dev-server-client-overlay-div";
|
|
114
116
|
applyStyle(contentElement, containerStyle);
|
|
115
|
-
|
|
117
|
+
headerElement = document.createElement("div");
|
|
116
118
|
headerElement.innerText = "Compiled with problems:";
|
|
117
119
|
applyStyle(headerElement, headerStyle);
|
|
118
120
|
var closeButtonElement = document.createElement("button");
|
|
@@ -178,9 +180,11 @@ var createOverlay = function createOverlay(options) {
|
|
|
178
180
|
* @param {string} type
|
|
179
181
|
* @param {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
|
|
180
182
|
* @param {string | null} trustedTypesPolicyName
|
|
183
|
+
* @param {'build' | 'runtime'} messageSource
|
|
181
184
|
*/
|
|
182
|
-
function show(type, messages, trustedTypesPolicyName) {
|
|
185
|
+
function show(type, messages, trustedTypesPolicyName, messageSource) {
|
|
183
186
|
ensureOverlayExists(function () {
|
|
187
|
+
headerElement.innerText = messageSource === "runtime" ? "Uncaught runtime errors:" : "Compiled with problems:";
|
|
184
188
|
messages.forEach(function (message) {
|
|
185
189
|
var entryElement = document.createElement("div");
|
|
186
190
|
var msgStyle = type === "warning" ? msgStyles.warning : msgStyles.error;
|
|
@@ -221,12 +225,30 @@ var createOverlay = function createOverlay(options) {
|
|
|
221
225
|
showOverlay: function showOverlay(_ref) {
|
|
222
226
|
var _ref$level = _ref.level,
|
|
223
227
|
level = _ref$level === void 0 ? "error" : _ref$level,
|
|
224
|
-
messages = _ref.messages
|
|
225
|
-
|
|
228
|
+
messages = _ref.messages,
|
|
229
|
+
messageSource = _ref.messageSource;
|
|
230
|
+
return show(level, messages, options.trustedTypesPolicyName, messageSource);
|
|
226
231
|
},
|
|
227
232
|
hideOverlay: hide
|
|
228
233
|
});
|
|
229
234
|
if (options.catchRuntimeError) {
|
|
235
|
+
/**
|
|
236
|
+
* @param {Error | undefined} error
|
|
237
|
+
* @param {string} fallbackMessage
|
|
238
|
+
*/
|
|
239
|
+
var handleError = function handleError(error, fallbackMessage) {
|
|
240
|
+
var errorObject = error instanceof Error ? error : new Error(error || fallbackMessage);
|
|
241
|
+
var shouldDisplay = typeof options.catchRuntimeError === "function" ? options.catchRuntimeError(errorObject) : true;
|
|
242
|
+
if (shouldDisplay) {
|
|
243
|
+
overlayService.send({
|
|
244
|
+
type: "RUNTIME_ERROR",
|
|
245
|
+
messages: [{
|
|
246
|
+
message: errorObject.message,
|
|
247
|
+
stack: parseErrorToStacks(errorObject)
|
|
248
|
+
}]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
};
|
|
230
252
|
listenToRuntimeError(function (errorEvent) {
|
|
231
253
|
// error property may be empty in older browser like IE
|
|
232
254
|
var error = errorEvent.error,
|
|
@@ -234,14 +256,11 @@ var createOverlay = function createOverlay(options) {
|
|
|
234
256
|
if (!error && !message) {
|
|
235
257
|
return;
|
|
236
258
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
stack: parseErrorToStacks(errorObject)
|
|
243
|
-
}]
|
|
244
|
-
});
|
|
259
|
+
handleError(error, message);
|
|
260
|
+
});
|
|
261
|
+
listenToUnhandledRejection(function (promiseRejectionEvent) {
|
|
262
|
+
var reason = promiseRejectionEvent.reason;
|
|
263
|
+
handleError(reason, "Unknown promise rejection reason");
|
|
245
264
|
});
|
|
246
265
|
}
|
|
247
266
|
return overlayService;
|
package/lib/Server.js
CHANGED
|
@@ -154,10 +154,14 @@ const schema = require("./options.json");
|
|
|
154
154
|
* @property {string} [username]
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
159
|
+
*/
|
|
160
|
+
|
|
157
161
|
/**
|
|
158
162
|
* @typedef {Object} ClientConfiguration
|
|
159
163
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
160
|
-
* @property {boolean | { warnings?:
|
|
164
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
161
165
|
* @property {boolean} [progress]
|
|
162
166
|
* @property {boolean | number} [reconnect]
|
|
163
167
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -236,6 +240,16 @@ const memoize = (fn) => {
|
|
|
236
240
|
|
|
237
241
|
const getExpress = memoize(() => require("express"));
|
|
238
242
|
|
|
243
|
+
/**
|
|
244
|
+
*
|
|
245
|
+
* @param {OverlayMessageOptions} [setting]
|
|
246
|
+
* @returns
|
|
247
|
+
*/
|
|
248
|
+
const encodeOverlaySettings = (setting) =>
|
|
249
|
+
typeof setting === "function"
|
|
250
|
+
? encodeURIComponent(setting.toString())
|
|
251
|
+
: setting;
|
|
252
|
+
|
|
239
253
|
class Server {
|
|
240
254
|
/**
|
|
241
255
|
* @param {Configuration | Compiler | MultiCompiler} options
|
|
@@ -654,12 +668,19 @@ class Server {
|
|
|
654
668
|
}
|
|
655
669
|
|
|
656
670
|
if (typeof client.overlay !== "undefined") {
|
|
657
|
-
|
|
658
|
-
"overlay",
|
|
671
|
+
const overlayString =
|
|
659
672
|
typeof client.overlay === "boolean"
|
|
660
673
|
? String(client.overlay)
|
|
661
|
-
: JSON.stringify(
|
|
662
|
-
|
|
674
|
+
: JSON.stringify({
|
|
675
|
+
...client.overlay,
|
|
676
|
+
errors: encodeOverlaySettings(client.overlay.errors),
|
|
677
|
+
warnings: encodeOverlaySettings(client.overlay.warnings),
|
|
678
|
+
runtimeErrors: encodeOverlaySettings(
|
|
679
|
+
client.overlay.runtimeErrors
|
|
680
|
+
),
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
searchParams.set("overlay", overlayString);
|
|
663
684
|
}
|
|
664
685
|
|
|
665
686
|
if (typeof client.reconnect !== "undefined") {
|
|
@@ -2627,11 +2648,27 @@ class Server {
|
|
|
2627
2648
|
/** @type {ClientConfiguration} */
|
|
2628
2649
|
(this.options.client).overlay
|
|
2629
2650
|
) {
|
|
2651
|
+
const overlayConfig = /** @type {ClientConfiguration} */ (
|
|
2652
|
+
this.options.client
|
|
2653
|
+
).overlay;
|
|
2654
|
+
|
|
2630
2655
|
this.sendMessage(
|
|
2631
2656
|
[client],
|
|
2632
2657
|
"overlay",
|
|
2633
|
-
|
|
2634
|
-
|
|
2658
|
+
typeof overlayConfig === "object"
|
|
2659
|
+
? {
|
|
2660
|
+
...overlayConfig,
|
|
2661
|
+
errors:
|
|
2662
|
+
overlayConfig.errors &&
|
|
2663
|
+
encodeOverlaySettings(overlayConfig.errors),
|
|
2664
|
+
warnings:
|
|
2665
|
+
overlayConfig.warnings &&
|
|
2666
|
+
encodeOverlaySettings(overlayConfig.warnings),
|
|
2667
|
+
runtimeErrors:
|
|
2668
|
+
overlayConfig.runtimeErrors &&
|
|
2669
|
+
encodeOverlaySettings(overlayConfig.runtimeErrors),
|
|
2670
|
+
}
|
|
2671
|
+
: overlayConfig
|
|
2635
2672
|
);
|
|
2636
2673
|
}
|
|
2637
2674
|
|
package/lib/options.json
CHANGED
|
@@ -98,25 +98,49 @@
|
|
|
98
98
|
"additionalProperties": false,
|
|
99
99
|
"properties": {
|
|
100
100
|
"errors": {
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
"anyOf": [
|
|
102
|
+
{
|
|
103
|
+
"description": "Enables a full-screen overlay in the browser when there are compiler errors.",
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"cli": {
|
|
106
|
+
"negatedDescription": "Disables the full-screen overlay in the browser when there are compiler errors."
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"instanceof": "Function",
|
|
111
|
+
"description": "Filter compiler errors. Return true to include and return false to exclude."
|
|
112
|
+
}
|
|
113
|
+
]
|
|
106
114
|
},
|
|
107
115
|
"warnings": {
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
"anyOf": [
|
|
117
|
+
{
|
|
118
|
+
"description": "Enables a full-screen overlay in the browser when there are compiler warnings.",
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"cli": {
|
|
121
|
+
"negatedDescription": "Disables the full-screen overlay in the browser when there are compiler warnings."
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"instanceof": "Function",
|
|
126
|
+
"description": "Filter compiler warnings. Return true to include and return false to exclude."
|
|
127
|
+
}
|
|
128
|
+
]
|
|
113
129
|
},
|
|
114
130
|
"runtimeErrors": {
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
131
|
+
"anyOf": [
|
|
132
|
+
{
|
|
133
|
+
"description": "Enables a full-screen overlay in the browser when there are uncaught runtime errors.",
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"cli": {
|
|
136
|
+
"negatedDescription": "Disables the full-screen overlay in the browser when there are uncaught runtime errors."
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"instanceof": "Function",
|
|
141
|
+
"description": "Filter uncaught runtime errors. Return true to include and return false to exclude."
|
|
142
|
+
}
|
|
143
|
+
]
|
|
120
144
|
},
|
|
121
145
|
"trustedTypesPolicyName": {
|
|
122
146
|
"description": "The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-dev-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
5
|
"bin": "bin/webpack-dev-server.js",
|
|
6
6
|
"main": "lib/Server.js",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"typescript": "^4.9.3",
|
|
130
130
|
"url-loader": "^4.1.1",
|
|
131
131
|
"wait-for-expect": "^3.0.2",
|
|
132
|
-
"webpack": "^5.
|
|
132
|
+
"webpack": "^5.81.0",
|
|
133
133
|
"webpack-cli": "^4.7.2",
|
|
134
134
|
"webpack-merge": "^5.8.0"
|
|
135
135
|
},
|
package/types/lib/Server.d.ts
CHANGED
|
@@ -139,10 +139,13 @@ declare class Server {
|
|
|
139
139
|
* @property {string} [protocol]
|
|
140
140
|
* @property {string} [username]
|
|
141
141
|
*/
|
|
142
|
+
/**
|
|
143
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
144
|
+
*/
|
|
142
145
|
/**
|
|
143
146
|
* @typedef {Object} ClientConfiguration
|
|
144
147
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
145
|
-
* @property {boolean | { warnings?:
|
|
148
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
146
149
|
* @property {boolean} [progress]
|
|
147
150
|
* @property {boolean | number} [reconnect]
|
|
148
151
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -294,10 +297,13 @@ declare class Server {
|
|
|
294
297
|
* @property {string} [protocol]
|
|
295
298
|
* @property {string} [username]
|
|
296
299
|
*/
|
|
300
|
+
/**
|
|
301
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
302
|
+
*/
|
|
297
303
|
/**
|
|
298
304
|
* @typedef {Object} ClientConfiguration
|
|
299
305
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
300
|
-
* @property {boolean | { warnings?:
|
|
306
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
301
307
|
* @property {boolean} [progress]
|
|
302
308
|
* @property {boolean | number} [reconnect]
|
|
303
309
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -454,10 +460,13 @@ declare class Server {
|
|
|
454
460
|
* @property {string} [protocol]
|
|
455
461
|
* @property {string} [username]
|
|
456
462
|
*/
|
|
463
|
+
/**
|
|
464
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
465
|
+
*/
|
|
457
466
|
/**
|
|
458
467
|
* @typedef {Object} ClientConfiguration
|
|
459
468
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
460
|
-
* @property {boolean | { warnings?:
|
|
469
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
461
470
|
* @property {boolean} [progress]
|
|
462
471
|
* @property {boolean | number} [reconnect]
|
|
463
472
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -550,9 +559,6 @@ declare class Server {
|
|
|
550
559
|
simpleType: string;
|
|
551
560
|
multiple: boolean;
|
|
552
561
|
};
|
|
553
|
-
/**
|
|
554
|
-
* @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
|
|
555
|
-
*/
|
|
556
562
|
"client-reconnect": {
|
|
557
563
|
configs: (
|
|
558
564
|
| {
|
|
@@ -613,7 +619,7 @@ declare class Server {
|
|
|
613
619
|
}[];
|
|
614
620
|
description: string;
|
|
615
621
|
simpleType: string;
|
|
616
|
-
multiple: boolean;
|
|
622
|
+
/** @type {T} */ multiple: boolean;
|
|
617
623
|
};
|
|
618
624
|
"client-web-socket-url-password": {
|
|
619
625
|
configs: {
|
|
@@ -648,28 +654,27 @@ declare class Server {
|
|
|
648
654
|
simpleType: string;
|
|
649
655
|
multiple: boolean;
|
|
650
656
|
};
|
|
651
|
-
/**
|
|
652
|
-
* @private
|
|
653
|
-
* @type {RequestHandler[]}
|
|
654
|
-
*/
|
|
655
657
|
"client-web-socket-url-protocol": {
|
|
656
658
|
configs: (
|
|
657
659
|
| {
|
|
658
660
|
description: string;
|
|
659
661
|
multiple: boolean;
|
|
660
662
|
path: string;
|
|
661
|
-
/**
|
|
662
|
-
* @private
|
|
663
|
-
* @type {string | undefined}
|
|
664
|
-
*/
|
|
665
663
|
type: string;
|
|
666
664
|
values: string[];
|
|
667
665
|
}
|
|
668
666
|
| {
|
|
669
667
|
description: string;
|
|
668
|
+
/**
|
|
669
|
+
* @private
|
|
670
|
+
* @type {RequestHandler[]}
|
|
671
|
+
*/
|
|
670
672
|
multiple: boolean;
|
|
671
673
|
path: string;
|
|
672
674
|
type: string;
|
|
675
|
+
/**
|
|
676
|
+
* @type {Socket[]}
|
|
677
|
+
*/
|
|
673
678
|
}
|
|
674
679
|
)[];
|
|
675
680
|
description: string;
|
|
@@ -776,6 +781,9 @@ declare class Server {
|
|
|
776
781
|
simpleType: string;
|
|
777
782
|
multiple: boolean;
|
|
778
783
|
};
|
|
784
|
+
/**
|
|
785
|
+
* @type {string | undefined}
|
|
786
|
+
*/
|
|
779
787
|
"https-ca": {
|
|
780
788
|
configs: {
|
|
781
789
|
type: string;
|
|
@@ -809,15 +817,12 @@ declare class Server {
|
|
|
809
817
|
simpleType: string;
|
|
810
818
|
multiple: boolean;
|
|
811
819
|
};
|
|
812
|
-
/**
|
|
813
|
-
* @type {string[]}
|
|
814
|
-
*/
|
|
815
820
|
"https-cacert-reset": {
|
|
816
821
|
configs: {
|
|
817
822
|
description: string;
|
|
818
823
|
multiple: boolean;
|
|
819
824
|
path: string;
|
|
820
|
-
|
|
825
|
+
type: string;
|
|
821
826
|
}[];
|
|
822
827
|
description: string;
|
|
823
828
|
multiple: boolean;
|
|
@@ -827,7 +832,7 @@ declare class Server {
|
|
|
827
832
|
configs: {
|
|
828
833
|
type: string;
|
|
829
834
|
multiple: boolean;
|
|
830
|
-
description: string;
|
|
835
|
+
/** @type {ClientConfiguration} */ description: string;
|
|
831
836
|
path: string;
|
|
832
837
|
}[];
|
|
833
838
|
description: string;
|
|
@@ -887,7 +892,7 @@ declare class Server {
|
|
|
887
892
|
}[];
|
|
888
893
|
description: string;
|
|
889
894
|
multiple: boolean;
|
|
890
|
-
simpleType: string;
|
|
895
|
+
/** @type {string} */ simpleType: string;
|
|
891
896
|
};
|
|
892
897
|
"https-passphrase": {
|
|
893
898
|
configs: {
|
|
@@ -947,12 +952,6 @@ declare class Server {
|
|
|
947
952
|
values: boolean[];
|
|
948
953
|
multiple: boolean;
|
|
949
954
|
description: string;
|
|
950
|
-
/**
|
|
951
|
-
* prependEntry Method for webpack 4
|
|
952
|
-
* @param {any} originalEntry
|
|
953
|
-
* @param {any} newAdditionalEntries
|
|
954
|
-
* @returns {any}
|
|
955
|
-
*/
|
|
956
955
|
path: string;
|
|
957
956
|
}
|
|
958
957
|
)[];
|
|
@@ -970,6 +969,12 @@ declare class Server {
|
|
|
970
969
|
}[];
|
|
971
970
|
description: string;
|
|
972
971
|
simpleType: string;
|
|
972
|
+
/**
|
|
973
|
+
* prependEntry Method for webpack 4
|
|
974
|
+
* @param {any} originalEntry
|
|
975
|
+
* @param {any} newAdditionalEntries
|
|
976
|
+
* @returns {any}
|
|
977
|
+
*/
|
|
973
978
|
multiple: boolean;
|
|
974
979
|
};
|
|
975
980
|
"magic-html": {
|
|
@@ -993,9 +998,10 @@ declare class Server {
|
|
|
993
998
|
path: string;
|
|
994
999
|
}
|
|
995
1000
|
| {
|
|
1001
|
+
/** @type {any} */
|
|
996
1002
|
type: string;
|
|
997
1003
|
multiple: boolean;
|
|
998
|
-
description: string;
|
|
1004
|
+
/** @type {any} */ description: string;
|
|
999
1005
|
negatedDescription: string;
|
|
1000
1006
|
path: string;
|
|
1001
1007
|
}
|
|
@@ -1253,7 +1259,7 @@ declare class Server {
|
|
|
1253
1259
|
type: string;
|
|
1254
1260
|
values: string[];
|
|
1255
1261
|
}[];
|
|
1256
|
-
|
|
1262
|
+
description: string;
|
|
1257
1263
|
multiple: boolean;
|
|
1258
1264
|
simpleType: string;
|
|
1259
1265
|
};
|
|
@@ -1293,7 +1299,7 @@ declare class Server {
|
|
|
1293
1299
|
type: string;
|
|
1294
1300
|
multiple: boolean;
|
|
1295
1301
|
description: string;
|
|
1296
|
-
path: string
|
|
1302
|
+
path: string;
|
|
1297
1303
|
}[];
|
|
1298
1304
|
description: string;
|
|
1299
1305
|
simpleType: string;
|
|
@@ -1319,8 +1325,9 @@ declare class Server {
|
|
|
1319
1325
|
}[];
|
|
1320
1326
|
description: string;
|
|
1321
1327
|
simpleType: string;
|
|
1322
|
-
multiple: boolean
|
|
1328
|
+
multiple: boolean /** @type {any} */;
|
|
1323
1329
|
};
|
|
1330
|
+
/** @type {any} */
|
|
1324
1331
|
"static-serve-index": {
|
|
1325
1332
|
configs: {
|
|
1326
1333
|
type: string;
|
|
@@ -1610,10 +1617,13 @@ declare class Server {
|
|
|
1610
1617
|
* @property {string} [protocol]
|
|
1611
1618
|
* @property {string} [username]
|
|
1612
1619
|
*/
|
|
1620
|
+
/**
|
|
1621
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
1622
|
+
*/
|
|
1613
1623
|
/**
|
|
1614
1624
|
* @typedef {Object} ClientConfiguration
|
|
1615
1625
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
1616
|
-
* @property {boolean | { warnings?:
|
|
1626
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
1617
1627
|
* @property {boolean} [progress]
|
|
1618
1628
|
* @property {boolean | number} [reconnect]
|
|
1619
1629
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -1759,10 +1769,13 @@ declare class Server {
|
|
|
1759
1769
|
* @property {string} [protocol]
|
|
1760
1770
|
* @property {string} [username]
|
|
1761
1771
|
*/
|
|
1772
|
+
/**
|
|
1773
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
1774
|
+
*/
|
|
1762
1775
|
/**
|
|
1763
1776
|
* @typedef {Object} ClientConfiguration
|
|
1764
1777
|
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
1765
|
-
* @property {boolean | { warnings?:
|
|
1778
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
1766
1779
|
* @property {boolean} [progress]
|
|
1767
1780
|
* @property {boolean | number} [reconnect]
|
|
1768
1781
|
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
@@ -1824,25 +1837,158 @@ declare class Server {
|
|
|
1824
1837
|
additionalProperties: boolean;
|
|
1825
1838
|
properties: {
|
|
1826
1839
|
errors: {
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1840
|
+
anyOf: (
|
|
1841
|
+
| {
|
|
1842
|
+
description: string;
|
|
1843
|
+
type: string;
|
|
1844
|
+
cli: {
|
|
1845
|
+
negatedDescription: string;
|
|
1846
|
+
};
|
|
1847
|
+
instanceof?: undefined;
|
|
1848
|
+
}
|
|
1849
|
+
| {
|
|
1850
|
+
instanceof: string;
|
|
1851
|
+
/**
|
|
1852
|
+
* @typedef {Object} WebSocketServerConfiguration
|
|
1853
|
+
* @property {"sockjs" | "ws" | string | Function} [type]
|
|
1854
|
+
* @property {Record<string, any>} [options]
|
|
1855
|
+
*/
|
|
1856
|
+
/**
|
|
1857
|
+
* @typedef {(import("ws").WebSocket | import("sockjs").Connection & { send: import("ws").WebSocket["send"], terminate: import("ws").WebSocket["terminate"], ping: import("ws").WebSocket["ping"] }) & { isAlive?: boolean }} ClientConnection
|
|
1858
|
+
*/
|
|
1859
|
+
/**
|
|
1860
|
+
* @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer
|
|
1861
|
+
*/
|
|
1862
|
+
/**
|
|
1863
|
+
* @typedef {{ implementation: WebSocketServer, clients: ClientConnection[] }} WebSocketServerImplementation
|
|
1864
|
+
*/
|
|
1865
|
+
/**
|
|
1866
|
+
* @callback ByPass
|
|
1867
|
+
* @param {Request} req
|
|
1868
|
+
* @param {Response} res
|
|
1869
|
+
* @param {ProxyConfigArrayItem} proxyConfig
|
|
1870
|
+
*/
|
|
1871
|
+
/**
|
|
1872
|
+
* @typedef {{ path?: HttpProxyMiddlewareOptionsFilter | undefined, context?: HttpProxyMiddlewareOptionsFilter | undefined } & { bypass?: ByPass } & HttpProxyMiddlewareOptions } ProxyConfigArrayItem
|
|
1873
|
+
*/
|
|
1874
|
+
/**
|
|
1875
|
+
* @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray
|
|
1876
|
+
*/
|
|
1877
|
+
/**
|
|
1878
|
+
* @typedef {{ [url: string]: string | ProxyConfigArrayItem }} ProxyConfigMap
|
|
1879
|
+
*/
|
|
1880
|
+
/**
|
|
1881
|
+
* @typedef {Object} OpenApp
|
|
1882
|
+
* @property {string} [name]
|
|
1883
|
+
* @property {string[]} [arguments]
|
|
1884
|
+
*/
|
|
1885
|
+
/**
|
|
1886
|
+
* @typedef {Object} Open
|
|
1887
|
+
* @property {string | string[] | OpenApp} [app]
|
|
1888
|
+
* @property {string | string[]} [target]
|
|
1889
|
+
*/
|
|
1890
|
+
/**
|
|
1891
|
+
* @typedef {Object} NormalizedOpen
|
|
1892
|
+
* @property {string} target
|
|
1893
|
+
* @property {import("open").Options} options
|
|
1894
|
+
*/
|
|
1895
|
+
/**
|
|
1896
|
+
* @typedef {Object} WebSocketURL
|
|
1897
|
+
* @property {string} [hostname]
|
|
1898
|
+
* @property {string} [password]
|
|
1899
|
+
* @property {string} [pathname]
|
|
1900
|
+
* @property {number | string} [port]
|
|
1901
|
+
* @property {string} [protocol]
|
|
1902
|
+
* @property {string} [username]
|
|
1903
|
+
*/
|
|
1904
|
+
/**
|
|
1905
|
+
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
1906
|
+
*/
|
|
1907
|
+
/**
|
|
1908
|
+
* @typedef {Object} ClientConfiguration
|
|
1909
|
+
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
1910
|
+
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
1911
|
+
* @property {boolean} [progress]
|
|
1912
|
+
* @property {boolean | number} [reconnect]
|
|
1913
|
+
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
1914
|
+
* @property {string | WebSocketURL} [webSocketURL]
|
|
1915
|
+
*/
|
|
1916
|
+
/**
|
|
1917
|
+
* @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
|
|
1918
|
+
*/
|
|
1919
|
+
/**
|
|
1920
|
+
* @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
|
|
1921
|
+
*/
|
|
1922
|
+
/**
|
|
1923
|
+
* @typedef {Object} Configuration
|
|
1924
|
+
* @property {boolean | string} [ipc]
|
|
1925
|
+
* @property {Host} [host]
|
|
1926
|
+
* @property {Port} [port]
|
|
1927
|
+
* @property {boolean | "only"} [hot]
|
|
1928
|
+
* @property {boolean} [liveReload]
|
|
1929
|
+
* @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
|
|
1930
|
+
* @property {boolean} [compress]
|
|
1931
|
+
* @property {boolean} [magicHtml]
|
|
1932
|
+
* @property {"auto" | "all" | string | string[]} [allowedHosts]
|
|
1933
|
+
* @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
|
|
1934
|
+
* @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
|
|
1935
|
+
* @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
|
|
1936
|
+
* @property {boolean | string | Static | Array<string | Static>} [static]
|
|
1937
|
+
* @property {boolean | ServerOptions} [https]
|
|
1938
|
+
* @property {boolean} [http2]
|
|
1939
|
+
* @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
|
|
1940
|
+
* @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
|
|
1941
|
+
* @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy]
|
|
1942
|
+
* @property {boolean | string | Open | Array<string | Open>} [open]
|
|
1943
|
+
* @property {boolean} [setupExitSignals]
|
|
1944
|
+
* @property {boolean | ClientConfiguration} [client]
|
|
1945
|
+
* @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
|
|
1946
|
+
* @property {(devServer: Server) => void} [onAfterSetupMiddleware]
|
|
1947
|
+
* @property {(devServer: Server) => void} [onBeforeSetupMiddleware]
|
|
1948
|
+
* @property {(devServer: Server) => void} [onListening]
|
|
1949
|
+
* @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
|
|
1950
|
+
*/
|
|
1951
|
+
description: string;
|
|
1952
|
+
type?: undefined;
|
|
1953
|
+
cli?: undefined;
|
|
1954
|
+
}
|
|
1955
|
+
)[];
|
|
1832
1956
|
};
|
|
1833
1957
|
warnings: {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1958
|
+
anyOf: (
|
|
1959
|
+
| {
|
|
1960
|
+
description: string;
|
|
1961
|
+
type: string;
|
|
1962
|
+
cli: {
|
|
1963
|
+
negatedDescription: string;
|
|
1964
|
+
};
|
|
1965
|
+
instanceof?: undefined;
|
|
1966
|
+
}
|
|
1967
|
+
| {
|
|
1968
|
+
instanceof: string;
|
|
1969
|
+
description: string;
|
|
1970
|
+
type?: undefined;
|
|
1971
|
+
cli?: undefined;
|
|
1972
|
+
}
|
|
1973
|
+
)[];
|
|
1839
1974
|
};
|
|
1840
1975
|
runtimeErrors: {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1976
|
+
anyOf: (
|
|
1977
|
+
| {
|
|
1978
|
+
description: string;
|
|
1979
|
+
type: string;
|
|
1980
|
+
cli: {
|
|
1981
|
+
negatedDescription: string;
|
|
1982
|
+
};
|
|
1983
|
+
instanceof?: undefined;
|
|
1984
|
+
}
|
|
1985
|
+
| {
|
|
1986
|
+
instanceof: string;
|
|
1987
|
+
description: string;
|
|
1988
|
+
type?: undefined;
|
|
1989
|
+
cli?: undefined;
|
|
1990
|
+
}
|
|
1991
|
+
)[];
|
|
1846
1992
|
};
|
|
1847
1993
|
trustedTypesPolicyName: {
|
|
1848
1994
|
description: string;
|
|
@@ -1869,69 +2015,6 @@ declare class Server {
|
|
|
1869
2015
|
anyOf: (
|
|
1870
2016
|
| {
|
|
1871
2017
|
type: string;
|
|
1872
|
-
/**
|
|
1873
|
-
* @typedef {Object} Open
|
|
1874
|
-
* @property {string | string[] | OpenApp} [app]
|
|
1875
|
-
* @property {string | string[]} [target]
|
|
1876
|
-
*/
|
|
1877
|
-
/**
|
|
1878
|
-
* @typedef {Object} NormalizedOpen
|
|
1879
|
-
* @property {string} target
|
|
1880
|
-
* @property {import("open").Options} options
|
|
1881
|
-
*/
|
|
1882
|
-
/**
|
|
1883
|
-
* @typedef {Object} WebSocketURL
|
|
1884
|
-
* @property {string} [hostname]
|
|
1885
|
-
* @property {string} [password]
|
|
1886
|
-
* @property {string} [pathname]
|
|
1887
|
-
* @property {number | string} [port]
|
|
1888
|
-
* @property {string} [protocol]
|
|
1889
|
-
* @property {string} [username]
|
|
1890
|
-
*/
|
|
1891
|
-
/**
|
|
1892
|
-
* @typedef {Object} ClientConfiguration
|
|
1893
|
-
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
1894
|
-
* @property {boolean | { warnings?: boolean, errors?: boolean, runtimeErrors?: boolean }} [overlay]
|
|
1895
|
-
* @property {boolean} [progress]
|
|
1896
|
-
* @property {boolean | number} [reconnect]
|
|
1897
|
-
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
1898
|
-
* @property {string | WebSocketURL} [webSocketURL]
|
|
1899
|
-
*/
|
|
1900
|
-
/**
|
|
1901
|
-
* @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
|
|
1902
|
-
*/
|
|
1903
|
-
/**
|
|
1904
|
-
* @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
|
|
1905
|
-
*/
|
|
1906
|
-
/**
|
|
1907
|
-
* @typedef {Object} Configuration
|
|
1908
|
-
* @property {boolean | string} [ipc]
|
|
1909
|
-
* @property {Host} [host]
|
|
1910
|
-
* @property {Port} [port]
|
|
1911
|
-
* @property {boolean | "only"} [hot]
|
|
1912
|
-
* @property {boolean} [liveReload]
|
|
1913
|
-
* @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
|
|
1914
|
-
* @property {boolean} [compress]
|
|
1915
|
-
* @property {boolean} [magicHtml]
|
|
1916
|
-
* @property {"auto" | "all" | string | string[]} [allowedHosts]
|
|
1917
|
-
* @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
|
|
1918
|
-
* @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
|
|
1919
|
-
* @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
|
|
1920
|
-
* @property {boolean | string | Static | Array<string | Static>} [static]
|
|
1921
|
-
* @property {boolean | ServerOptions} [https]
|
|
1922
|
-
* @property {boolean} [http2]
|
|
1923
|
-
* @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
|
|
1924
|
-
* @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
|
|
1925
|
-
* @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy]
|
|
1926
|
-
* @property {boolean | string | Open | Array<string | Open>} [open]
|
|
1927
|
-
* @property {boolean} [setupExitSignals]
|
|
1928
|
-
* @property {boolean | ClientConfiguration} [client]
|
|
1929
|
-
* @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
|
|
1930
|
-
* @property {(devServer: Server) => void} [onAfterSetupMiddleware]
|
|
1931
|
-
* @property {(devServer: Server) => void} [onBeforeSetupMiddleware]
|
|
1932
|
-
* @property {(devServer: Server) => void} [onListening]
|
|
1933
|
-
* @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
|
|
1934
|
-
*/
|
|
1935
2018
|
cli: {
|
|
1936
2019
|
negatedDescription: string;
|
|
1937
2020
|
};
|
|
@@ -2069,6 +2152,10 @@ declare class Server {
|
|
|
2069
2152
|
negatedDescription: string;
|
|
2070
2153
|
};
|
|
2071
2154
|
};
|
|
2155
|
+
/**
|
|
2156
|
+
* @private
|
|
2157
|
+
* @type {string | undefined}
|
|
2158
|
+
*/
|
|
2072
2159
|
ca: {
|
|
2073
2160
|
anyOf: (
|
|
2074
2161
|
| {
|
|
@@ -2332,6 +2419,7 @@ declare class Server {
|
|
|
2332
2419
|
| {
|
|
2333
2420
|
type: string;
|
|
2334
2421
|
description: string;
|
|
2422
|
+
/** @type {{ type: WebSocketServerConfiguration["type"], options: NonNullable<WebSocketServerConfiguration["options"]> }} */
|
|
2335
2423
|
link: string;
|
|
2336
2424
|
cli?: undefined;
|
|
2337
2425
|
}
|
|
@@ -2366,7 +2454,7 @@ declare class Server {
|
|
|
2366
2454
|
}
|
|
2367
2455
|
| {
|
|
2368
2456
|
enum: string[];
|
|
2369
|
-
type?: undefined;
|
|
2457
|
+
/** @type {string} */ type?: undefined;
|
|
2370
2458
|
cli?: undefined;
|
|
2371
2459
|
}
|
|
2372
2460
|
)[];
|
|
@@ -2433,7 +2521,7 @@ declare class Server {
|
|
|
2433
2521
|
}
|
|
2434
2522
|
| {
|
|
2435
2523
|
$ref: string;
|
|
2436
|
-
|
|
2524
|
+
type?: undefined;
|
|
2437
2525
|
items?: undefined;
|
|
2438
2526
|
}
|
|
2439
2527
|
)[];
|
|
@@ -2570,7 +2658,7 @@ declare class Server {
|
|
|
2570
2658
|
}
|
|
2571
2659
|
)[];
|
|
2572
2660
|
description: string;
|
|
2573
|
-
|
|
2661
|
+
link: string;
|
|
2574
2662
|
};
|
|
2575
2663
|
Server: {
|
|
2576
2664
|
anyOf: {
|
|
@@ -2590,7 +2678,7 @@ declare class Server {
|
|
|
2590
2678
|
};
|
|
2591
2679
|
ServerString: {
|
|
2592
2680
|
type: string;
|
|
2593
|
-
minLength: number;
|
|
2681
|
+
/** @type {string} */ minLength: number;
|
|
2594
2682
|
cli: {
|
|
2595
2683
|
exclude: boolean;
|
|
2596
2684
|
};
|
|
@@ -2786,6 +2874,7 @@ declare class Server {
|
|
|
2786
2874
|
)[];
|
|
2787
2875
|
description: string;
|
|
2788
2876
|
};
|
|
2877
|
+
/** @type {NormalizedStatic} */
|
|
2789
2878
|
pfx: {
|
|
2790
2879
|
anyOf: (
|
|
2791
2880
|
| {
|
|
@@ -3059,7 +3148,6 @@ declare class Server {
|
|
|
3059
3148
|
};
|
|
3060
3149
|
};
|
|
3061
3150
|
additionalProperties: boolean;
|
|
3062
|
-
/** @type {ServerOptions} */
|
|
3063
3151
|
properties: {
|
|
3064
3152
|
allowedHosts: {
|
|
3065
3153
|
$ref: string;
|
|
@@ -3121,7 +3209,6 @@ declare class Server {
|
|
|
3121
3209
|
proxy: {
|
|
3122
3210
|
$ref: string;
|
|
3123
3211
|
};
|
|
3124
|
-
/** @type {any} */
|
|
3125
3212
|
server: {
|
|
3126
3213
|
$ref: string;
|
|
3127
3214
|
};
|
|
@@ -3502,6 +3589,7 @@ declare namespace Server {
|
|
|
3502
3589
|
Open,
|
|
3503
3590
|
NormalizedOpen,
|
|
3504
3591
|
WebSocketURL,
|
|
3592
|
+
OverlayMessageOptions,
|
|
3505
3593
|
ClientConfiguration,
|
|
3506
3594
|
Headers,
|
|
3507
3595
|
Middleware,
|
|
@@ -3720,14 +3808,15 @@ type WebSocketURL = {
|
|
|
3720
3808
|
protocol?: string | undefined;
|
|
3721
3809
|
username?: string | undefined;
|
|
3722
3810
|
};
|
|
3811
|
+
type OverlayMessageOptions = boolean | ((error: Error) => void);
|
|
3723
3812
|
type ClientConfiguration = {
|
|
3724
3813
|
logging?: "none" | "error" | "warn" | "info" | "log" | "verbose" | undefined;
|
|
3725
3814
|
overlay?:
|
|
3726
3815
|
| boolean
|
|
3727
3816
|
| {
|
|
3728
|
-
warnings?:
|
|
3729
|
-
errors?:
|
|
3730
|
-
runtimeErrors?:
|
|
3817
|
+
warnings?: OverlayMessageOptions | undefined;
|
|
3818
|
+
errors?: OverlayMessageOptions | undefined;
|
|
3819
|
+
runtimeErrors?: OverlayMessageOptions | undefined;
|
|
3731
3820
|
}
|
|
3732
3821
|
| undefined;
|
|
3733
3822
|
progress?: boolean | undefined;
|