/** * The following code is modified based on * https://github.com/webpack/webpack-dev-server * * MIT Licensed * Author Tobias Koppers @sokra * Copyright (c) JS Foundation and other contributors * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE */ var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; // @ts-expect-error: No type definitions available for '@rspack/core/hot/emitter.js' import hotEmitter from '@rspack/core/hot/emitter.js'; /* Rspack dev server runtime client */ // @ts-expect-error: No type definitions available for '@rspack/core/hot/log.js' import webpackHotLog from '@rspack/core/hot/log.js'; import { createOverlay, formatProblem } from './overlay.js'; import socket from './socket.js'; import { defineProgressElement, isProgressSupported } from './progress.js'; import { log, setLogLevel } from './utils/log.js'; import sendMessage from './utils/sendMessage.js'; var decodeOverlayOptions = function (overlayOptions) { if (typeof overlayOptions === 'object') { ['warnings', 'errors', 'runtimeErrors'].forEach(function (property) { if (typeof overlayOptions[property] === 'string') { var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]); overlayOptions[property] = new Function('message', "var callback = ".concat(overlayFilterFunctionString, "\n\t\t\t\treturn callback(message)")); } }); } }; var parseURL = function (resourceQuery) { var result = {}; if (typeof resourceQuery === 'string' && resourceQuery !== '') { var searchParams = resourceQuery.slice(1).split('&'); for (var i = 0; i < searchParams.length; i++) { var pair = searchParams[i].split('='); result[pair[0]] = decodeURIComponent(pair[1]); } } else { // Else, get the url from the