webpack-dev-server 5.0.2 → 5.2.2

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.
@@ -53,6 +53,7 @@ if (typeof Object.create === 'function') {
53
53
  \**********************************/
54
54
  /***/ (function(module) {
55
55
 
56
+ 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); }
56
57
  /**
57
58
  * Helpers.
58
59
  */
@@ -80,7 +81,7 @@ var y = d * 365.25;
80
81
 
81
82
  module.exports = function (val, options) {
82
83
  options = options || {};
83
- var type = typeof val;
84
+ var type = _typeof(val);
84
85
  if (type === 'string' && val.length > 0) {
85
86
  return parse(val);
86
87
  } else if (type === 'number' && isFinite(val)) {
@@ -1347,6 +1348,7 @@ module.exports = function (availableTransports) {
1347
1348
 
1348
1349
 
1349
1350
  // pulled specific shims from https://github.com/es-shims/es5-shim
1351
+ 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); }
1350
1352
  var ArrayPrototype = Array.prototype;
1351
1353
  var ObjectPrototype = Object.prototype;
1352
1354
  var FunctionPrototype = Function.prototype;
@@ -1584,7 +1586,7 @@ var properlyBoxesContext = function properlyBoxed(method) {
1584
1586
  var properlyBoxesStrict = true;
1585
1587
  if (method) {
1586
1588
  method.call('foo', function (_, __, context) {
1587
- if (typeof context !== 'object') {
1589
+ if (_typeof(context) !== 'object') {
1588
1590
  properlyBoxesNonStrict = false;
1589
1591
  }
1590
1592
  });
@@ -3133,7 +3135,7 @@ module.exports = XHRCorsObject;
3133
3135
 
3134
3136
  var EventEmitter = (__webpack_require__(/*! events */ "./node_modules/sockjs-client/lib/event/emitter.js").EventEmitter),
3135
3137
  inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");
3136
- function XHRFake( /* method, url, payload, opts */
3138
+ function XHRFake(/* method, url, payload, opts */
3137
3139
  ) {
3138
3140
  var self = this;
3139
3141
  EventEmitter.call(this);
@@ -3618,6 +3620,7 @@ if (!isChromePackagedApp) {
3618
3620
  "use strict";
3619
3621
 
3620
3622
 
3623
+ 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); }
3621
3624
  var eventUtils = __webpack_require__(/*! ./event */ "./node_modules/sockjs-client/lib/utils/event.js"),
3622
3625
  browser = __webpack_require__(/*! ./browser */ "./node_modules/sockjs-client/lib/utils/browser.js");
3623
3626
  var debug = function debug() {};
@@ -3787,7 +3790,7 @@ module.exports.iframeEnabled = false;
3787
3790
  if (__webpack_require__.g.document) {
3788
3791
  // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered with
3789
3792
  // huge delay, or not at all.
3790
- module.exports.iframeEnabled = (typeof __webpack_require__.g.postMessage === 'function' || typeof __webpack_require__.g.postMessage === 'object') && !browser.isKonqueror();
3793
+ module.exports.iframeEnabled = (typeof __webpack_require__.g.postMessage === 'function' || _typeof(__webpack_require__.g.postMessage) === 'object') && !browser.isKonqueror();
3791
3794
  }
3792
3795
 
3793
3796
  /***/ }),
@@ -3826,9 +3829,10 @@ module.exports = logObject;
3826
3829
  "use strict";
3827
3830
 
3828
3831
 
3832
+ 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); }
3829
3833
  module.exports = {
3830
3834
  isObject: function isObject(obj) {
3831
- var type = typeof obj;
3835
+ var type = _typeof(obj);
3832
3836
  return type === 'function' || type === 'object' && !!obj;
3833
3837
  },
3834
3838
  extend: function extend(obj) {
@@ -4010,14 +4014,15 @@ module.exports = '1.6.1';
4010
4014
  "use strict";
4011
4015
 
4012
4016
 
4017
+ function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "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; }, _typeof2(o); }
4013
4018
  function _typeof(obj) {
4014
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
4019
+ if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
4015
4020
  _typeof = function _typeof(obj) {
4016
- return typeof obj;
4021
+ return _typeof2(obj);
4017
4022
  };
4018
4023
  } else {
4019
4024
  _typeof = function _typeof(obj) {
4020
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
4025
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
4021
4026
  };
4022
4027
  }
4023
4028
  return _typeof(obj);
@@ -4424,6 +4429,7 @@ module.exports = setup;
4424
4429
  "use strict";
4425
4430
 
4426
4431
 
4432
+ 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); }
4427
4433
  var required = __webpack_require__(/*! requires-port */ "./node_modules/requires-port/index.js"),
4428
4434
  qs = __webpack_require__(/*! querystringify */ "./node_modules/querystringify/index.js"),
4429
4435
  controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,
@@ -4506,7 +4512,7 @@ function lolcation(loc) {
4506
4512
  var location = globalVar.location || {};
4507
4513
  loc = loc || location;
4508
4514
  var finaldestination = {},
4509
- type = typeof loc,
4515
+ type = _typeof(loc),
4510
4516
  key;
4511
4517
  if ('blob:' === loc.protocol) {
4512
4518
  finaldestination = new Url(unescape(loc.pathname), {});
@@ -4658,7 +4664,7 @@ function Url(address, location, parser) {
4658
4664
  index,
4659
4665
  key,
4660
4666
  instructions = rules.slice(),
4661
- type = typeof location,
4667
+ type = _typeof(location),
4662
4668
  url = this,
4663
4669
  i = 0;
4664
4670
 
@@ -4910,7 +4916,7 @@ function toString(stringify) {
4910
4916
  host += ':';
4911
4917
  }
4912
4918
  result += host + url.pathname;
4913
- query = 'object' === typeof url.query ? stringify(url.query) : url.query;
4919
+ query = 'object' === _typeof(url.query) ? stringify(url.query) : url.query;
4914
4920
  if (query) result += '?' !== query.charAt(0) ? '?' + query : query;
4915
4921
  if (url.hash) result += url.hash;
4916
4922
  return result;
@@ -5013,7 +5019,7 @@ module.exports = Url;
5013
5019
  /******/
5014
5020
  /************************************************************************/
5015
5021
  var __webpack_exports__ = {};
5016
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
5022
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
5017
5023
  !function() {
5018
5024
  "use strict";
5019
5025
  /*!***************************************************!*\
package/client/overlay.js CHANGED
@@ -1,16 +1,358 @@
1
+ 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); }
1
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
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); }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ 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
7
  // The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
7
8
  // They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware).
8
9
 
9
10
  import ansiHTML from "ansi-html-community";
10
- import { encode } from "html-entities";
11
- import { listenToRuntimeError, listenToUnhandledRejection, parseErrorToStacks } from "./overlay/runtime-error.js";
12
- import createOverlayMachine from "./overlay/state-machine.js";
13
- import { containerStyle, dismissButtonStyle, headerStyle, iframeStyle, msgStyles, msgTextStyle, msgTypeStyle } from "./overlay/styles.js";
11
+
12
+ /**
13
+ * @type {(input: string, position: number) => string}
14
+ */
15
+ var getCodePoint = String.prototype.codePointAt ? function (input, position) {
16
+ return input.codePointAt(position);
17
+ } : function (input, position) {
18
+ return (input.charCodeAt(position) - 0xd800) * 0x400 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000;
19
+ };
20
+
21
+ /**
22
+ * @param {string} macroText
23
+ * @param {RegExp} macroRegExp
24
+ * @param {(input: string) => string} macroReplacer
25
+ * @returns {string}
26
+ */
27
+ var replaceUsingRegExp = function replaceUsingRegExp(macroText, macroRegExp, macroReplacer) {
28
+ macroRegExp.lastIndex = 0;
29
+ var replaceMatch = macroRegExp.exec(macroText);
30
+ var replaceResult;
31
+ if (replaceMatch) {
32
+ replaceResult = "";
33
+ var replaceLastIndex = 0;
34
+ do {
35
+ if (replaceLastIndex !== replaceMatch.index) {
36
+ replaceResult += macroText.substring(replaceLastIndex, replaceMatch.index);
37
+ }
38
+ var replaceInput = replaceMatch[0];
39
+ replaceResult += macroReplacer(replaceInput);
40
+ replaceLastIndex = replaceMatch.index + replaceInput.length;
41
+ // eslint-disable-next-line no-cond-assign
42
+ } while (replaceMatch = macroRegExp.exec(macroText));
43
+ if (replaceLastIndex !== macroText.length) {
44
+ replaceResult += macroText.substring(replaceLastIndex);
45
+ }
46
+ } else {
47
+ replaceResult = macroText;
48
+ }
49
+ return replaceResult;
50
+ };
51
+ var references = {
52
+ "<": "&lt;",
53
+ ">": "&gt;",
54
+ '"': "&quot;",
55
+ "'": "&apos;",
56
+ "&": "&amp;"
57
+ };
58
+
59
+ /**
60
+ * @param {string} text text
61
+ * @returns {string}
62
+ */
63
+ function encode(text) {
64
+ if (!text) {
65
+ return "";
66
+ }
67
+ return replaceUsingRegExp(text, /[<>'"&]/g, function (input) {
68
+ var result = references[input];
69
+ if (!result) {
70
+ var code = input.length > 1 ? getCodePoint(input, 0) : input.charCodeAt(0);
71
+ result = "&#".concat(code, ";");
72
+ }
73
+ return result;
74
+ });
75
+ }
76
+
77
+ /**
78
+ * @typedef {Object} StateDefinitions
79
+ * @property {{[event: string]: { target: string; actions?: Array<string> }}} [on]
80
+ */
81
+
82
+ /**
83
+ * @typedef {Object} Options
84
+ * @property {{[state: string]: StateDefinitions}} states
85
+ * @property {object} context;
86
+ * @property {string} initial
87
+ */
88
+
89
+ /**
90
+ * @typedef {Object} Implementation
91
+ * @property {{[actionName: string]: (ctx: object, event: any) => object}} actions
92
+ */
93
+
94
+ /**
95
+ * A simplified `createMachine` from `@xstate/fsm` with the following differences:
96
+ *
97
+ * - the returned machine is technically a "service". No `interpret(machine).start()` is needed.
98
+ * - the state definition only support `on` and target must be declared with { target: 'nextState', actions: [] } explicitly.
99
+ * - event passed to `send` must be an object with `type` property.
100
+ * - actions implementation will be [assign action](https://xstate.js.org/docs/guides/context.html#assign-action) if you return any value.
101
+ * Do not return anything if you just want to invoke side effect.
102
+ *
103
+ * The goal of this custom function is to avoid installing the entire `'xstate/fsm'` package, while enabling modeling using
104
+ * state machine. You can copy the first parameter into the editor at https://stately.ai/viz to visualize the state machine.
105
+ *
106
+ * @param {Options} options
107
+ * @param {Implementation} implementation
108
+ */
109
+ function createMachine(_ref, _ref2) {
110
+ var states = _ref.states,
111
+ context = _ref.context,
112
+ initial = _ref.initial;
113
+ var actions = _ref2.actions;
114
+ var currentState = initial;
115
+ var currentContext = context;
116
+ return {
117
+ send: function send(event) {
118
+ var currentStateOn = states[currentState].on;
119
+ var transitionConfig = currentStateOn && currentStateOn[event.type];
120
+ if (transitionConfig) {
121
+ currentState = transitionConfig.target;
122
+ if (transitionConfig.actions) {
123
+ transitionConfig.actions.forEach(function (actName) {
124
+ var actionImpl = actions[actName];
125
+ var nextContextValue = actionImpl && actionImpl(currentContext, event);
126
+ if (nextContextValue) {
127
+ currentContext = _objectSpread(_objectSpread({}, currentContext), nextContextValue);
128
+ }
129
+ });
130
+ }
131
+ }
132
+ }
133
+ };
134
+ }
135
+
136
+ /**
137
+ * @typedef {Object} ShowOverlayData
138
+ * @property {'warning' | 'error'} level
139
+ * @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
140
+ * @property {'build' | 'runtime'} messageSource
141
+ */
142
+
143
+ /**
144
+ * @typedef {Object} CreateOverlayMachineOptions
145
+ * @property {(data: ShowOverlayData) => void} showOverlay
146
+ * @property {() => void} hideOverlay
147
+ */
148
+
149
+ /**
150
+ * @param {CreateOverlayMachineOptions} options
151
+ */
152
+ var createOverlayMachine = function createOverlayMachine(options) {
153
+ var hideOverlay = options.hideOverlay,
154
+ showOverlay = options.showOverlay;
155
+ return createMachine({
156
+ initial: "hidden",
157
+ context: {
158
+ level: "error",
159
+ messages: [],
160
+ messageSource: "build"
161
+ },
162
+ states: {
163
+ hidden: {
164
+ on: {
165
+ BUILD_ERROR: {
166
+ target: "displayBuildError",
167
+ actions: ["setMessages", "showOverlay"]
168
+ },
169
+ RUNTIME_ERROR: {
170
+ target: "displayRuntimeError",
171
+ actions: ["setMessages", "showOverlay"]
172
+ }
173
+ }
174
+ },
175
+ displayBuildError: {
176
+ on: {
177
+ DISMISS: {
178
+ target: "hidden",
179
+ actions: ["dismissMessages", "hideOverlay"]
180
+ },
181
+ BUILD_ERROR: {
182
+ target: "displayBuildError",
183
+ actions: ["appendMessages", "showOverlay"]
184
+ }
185
+ }
186
+ },
187
+ displayRuntimeError: {
188
+ on: {
189
+ DISMISS: {
190
+ target: "hidden",
191
+ actions: ["dismissMessages", "hideOverlay"]
192
+ },
193
+ RUNTIME_ERROR: {
194
+ target: "displayRuntimeError",
195
+ actions: ["appendMessages", "showOverlay"]
196
+ },
197
+ BUILD_ERROR: {
198
+ target: "displayBuildError",
199
+ actions: ["setMessages", "showOverlay"]
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }, {
205
+ actions: {
206
+ dismissMessages: function dismissMessages() {
207
+ return {
208
+ messages: [],
209
+ level: "error",
210
+ messageSource: "build"
211
+ };
212
+ },
213
+ appendMessages: function appendMessages(context, event) {
214
+ return {
215
+ messages: context.messages.concat(event.messages),
216
+ level: event.level || context.level,
217
+ messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
218
+ };
219
+ },
220
+ setMessages: function setMessages(context, event) {
221
+ return {
222
+ messages: event.messages,
223
+ level: event.level || context.level,
224
+ messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
225
+ };
226
+ },
227
+ hideOverlay: hideOverlay,
228
+ showOverlay: showOverlay
229
+ }
230
+ });
231
+ };
232
+
233
+ /**
234
+ *
235
+ * @param {Error} error
236
+ */
237
+ var parseErrorToStacks = function parseErrorToStacks(error) {
238
+ if (!error || !(error instanceof Error)) {
239
+ throw new Error("parseErrorToStacks expects Error object");
240
+ }
241
+ if (typeof error.stack === "string") {
242
+ return error.stack.split("\n").filter(function (stack) {
243
+ return stack !== "Error: ".concat(error.message);
244
+ });
245
+ }
246
+ };
247
+
248
+ /**
249
+ * @callback ErrorCallback
250
+ * @param {ErrorEvent} error
251
+ * @returns {void}
252
+ */
253
+
254
+ /**
255
+ * @param {ErrorCallback} callback
256
+ */
257
+ var listenToRuntimeError = function listenToRuntimeError(callback) {
258
+ window.addEventListener("error", callback);
259
+ return function cleanup() {
260
+ window.removeEventListener("error", callback);
261
+ };
262
+ };
263
+
264
+ /**
265
+ * @callback UnhandledRejectionCallback
266
+ * @param {PromiseRejectionEvent} rejectionEvent
267
+ * @returns {void}
268
+ */
269
+
270
+ /**
271
+ * @param {UnhandledRejectionCallback} callback
272
+ */
273
+ var listenToUnhandledRejection = function listenToUnhandledRejection(callback) {
274
+ window.addEventListener("unhandledrejection", callback);
275
+ return function cleanup() {
276
+ window.removeEventListener("unhandledrejection", callback);
277
+ };
278
+ };
279
+
280
+ // Styles are inspired by `react-error-overlay`
281
+
282
+ var msgStyles = {
283
+ error: {
284
+ backgroundColor: "rgba(206, 17, 38, 0.1)",
285
+ color: "#fccfcf"
286
+ },
287
+ warning: {
288
+ backgroundColor: "rgba(251, 245, 180, 0.1)",
289
+ color: "#fbf5b4"
290
+ }
291
+ };
292
+ var iframeStyle = {
293
+ position: "fixed",
294
+ top: 0,
295
+ left: 0,
296
+ right: 0,
297
+ bottom: 0,
298
+ width: "100vw",
299
+ height: "100vh",
300
+ border: "none",
301
+ "z-index": 9999999999
302
+ };
303
+ var containerStyle = {
304
+ position: "fixed",
305
+ boxSizing: "border-box",
306
+ left: 0,
307
+ top: 0,
308
+ right: 0,
309
+ bottom: 0,
310
+ width: "100vw",
311
+ height: "100vh",
312
+ fontSize: "large",
313
+ padding: "2rem 2rem 4rem 2rem",
314
+ lineHeight: "1.2",
315
+ whiteSpace: "pre-wrap",
316
+ overflow: "auto",
317
+ backgroundColor: "rgba(0, 0, 0, 0.9)",
318
+ color: "white"
319
+ };
320
+ var headerStyle = {
321
+ color: "#e83b46",
322
+ fontSize: "2em",
323
+ whiteSpace: "pre-wrap",
324
+ fontFamily: "sans-serif",
325
+ margin: "0 2rem 2rem 0",
326
+ flex: "0 0 auto",
327
+ maxHeight: "50%",
328
+ overflow: "auto"
329
+ };
330
+ var dismissButtonStyle = {
331
+ color: "#ffffff",
332
+ lineHeight: "1rem",
333
+ fontSize: "1.5rem",
334
+ padding: "1rem",
335
+ cursor: "pointer",
336
+ position: "absolute",
337
+ right: 0,
338
+ top: 0,
339
+ backgroundColor: "transparent",
340
+ border: "none"
341
+ };
342
+ var msgTypeStyle = {
343
+ color: "#e83b46",
344
+ fontSize: "1.2em",
345
+ marginBottom: "1rem",
346
+ fontFamily: "sans-serif"
347
+ };
348
+ var msgTextStyle = {
349
+ lineHeight: "1.5",
350
+ fontSize: "1rem",
351
+ fontFamily: "Menlo, Consolas, monospace"
352
+ };
353
+
354
+ // ANSI HTML
355
+
14
356
  var colors = {
15
357
  reset: ["transparent", "transparent"],
16
358
  black: "181818",
@@ -30,7 +372,7 @@ ansiHTML.setColors(colors);
30
372
  * @param {string | { file?: string, moduleName?: string, loc?: string, message?: string; stack?: string[] }} item
31
373
  * @returns {{ header: string, body: string }}
32
374
  */
33
- function formatProblem(type, item) {
375
+ var formatProblem = function formatProblem(type, item) {
34
376
  var header = type === "warning" ? "WARNING" : "ERROR";
35
377
  var body = "";
36
378
  if (typeof item === "string") {
@@ -54,7 +396,7 @@ function formatProblem(type, item) {
54
396
  header: header,
55
397
  body: body
56
398
  };
57
- }
399
+ };
58
400
 
59
401
  /**
60
402
  * @typedef {Object} CreateOverlayOptions
@@ -107,10 +449,10 @@ var createOverlay = function createOverlay(options) {
107
449
  applyStyle(iframeContainerElement, iframeStyle);
108
450
  iframeContainerElement.onload = function () {
109
451
  var contentElement = /** @type {Document} */
110
- ( /** @type {HTMLIFrameElement} */
452
+ (/** @type {HTMLIFrameElement} */
111
453
  iframeContainerElement.contentDocument).createElement("div");
112
454
  containerElement = /** @type {Document} */
113
- ( /** @type {HTMLIFrameElement} */
455
+ (/** @type {HTMLIFrameElement} */
114
456
  iframeContainerElement.contentDocument).createElement("div");
115
457
  contentElement.id = "webpack-dev-server-client-overlay-div";
116
458
  applyStyle(contentElement, containerStyle);
@@ -132,10 +474,10 @@ var createOverlay = function createOverlay(options) {
132
474
  contentElement.appendChild(containerElement);
133
475
 
134
476
  /** @type {Document} */
135
- ( /** @type {HTMLIFrameElement} */
477
+ (/** @type {HTMLIFrameElement} */
136
478
  iframeContainerElement.contentDocument).body.appendChild(contentElement);
137
479
  onLoadQueue.forEach(function (onLoad) {
138
- onLoad( /** @type {HTMLDivElement} */contentElement);
480
+ onLoad(/** @type {HTMLDivElement} */contentElement);
139
481
  });
140
482
  onLoadQueue = [];
141
483
 
@@ -222,11 +564,11 @@ var createOverlay = function createOverlay(options) {
222
564
  }, trustedTypesPolicyName);
223
565
  }
224
566
  var overlayService = createOverlayMachine({
225
- showOverlay: function showOverlay(_ref) {
226
- var _ref$level = _ref.level,
227
- level = _ref$level === void 0 ? "error" : _ref$level,
228
- messages = _ref.messages,
229
- messageSource = _ref.messageSource;
567
+ showOverlay: function showOverlay(_ref3) {
568
+ var _ref3$level = _ref3.level,
569
+ level = _ref3$level === void 0 ? "error" : _ref3$level,
570
+ messages = _ref3.messages,
571
+ messageSource = _ref3.messageSource;
230
572
  return show(level, messages, options.trustedTypesPolicyName, messageSource);
231
573
  },
232
574
  hideOverlay: hide
@@ -256,6 +598,11 @@ var createOverlay = function createOverlay(options) {
256
598
  if (!error && !message) {
257
599
  return;
258
600
  }
601
+
602
+ // if error stack indicates a React error boundary caught the error, do not show overlay.
603
+ if (error && error.stack && error.stack.includes("invokeGuardedCallbackDev")) {
604
+ return;
605
+ }
259
606
  handleError(error, message);
260
607
  });
261
608
  listenToUnhandledRejection(function (promiseRejectionEvent) {