MCPcopy
hub / github.com/webpack/webpack-dev-server / decodeOverlayOptions

Function decodeOverlayOptions

client-src/index.js:53–79  ·  view source on GitHub ↗
(overlayOptions)

Source from the content-addressed store, hash-verified

51 * @param {boolean | RawOverlayOptions | OverlayOptions} overlayOptions overlay options
52 */
53const decodeOverlayOptions = (overlayOptions) => {
54 if (typeof overlayOptions === "object") {
55 const requiredOptions = ["warnings", "errors", "runtimeErrors"];
56
57 for (let i = 0; i < requiredOptions.length; i++) {
58 const property =
59 /** @type {keyof Omit<RawOverlayOptions, "trustedTypesPolicyName">} */
60 (requiredOptions[i]);
61
62 if (typeof overlayOptions[property] === "string") {
63 const overlayFilterFunctionString = decodeURIComponent(
64 overlayOptions[property],
65 );
66
67 /** @type {OverlayOptions} */
68 (overlayOptions)[property] = /** @type {(error: Error) => boolean} */ (
69 // eslint-disable-next-line no-new-func
70 new Function(
71 "message",
72 `var callback = ${overlayFilterFunctionString}
73 return callback(message)`,
74 )
75 );
76 }
77 }
78 }
79};
80
81/**
82 * @type {Status}

Callers 2

index.jsFile · 0.85
overlayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…