Files
klz-cables.com/.pnpm-store/v10/files/c0/e1abfe3022fbcc3ca91dd847a831b15052afa3a831442f86e37c33e5ea2dceaa7a26ddd63c34a2dd8085c0994c57e0ca4114a79bfd06de3d62d585a6b1f811
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

67 lines
1.4 KiB
Plaintext

"use strict";
/* global __resourceQuery */
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
/**
* @param {Error} err error
*/
function errorHandler(err) {
err.message =
"Problem communicating active modules to the server: " + err.message;
options.onError(err);
}
/** @type {Promise<import("http") | import("https")>} */
var mod = require("./load-http")(urlBase.startsWith("https"));
/** @type {import("http").ClientRequest} */
var request;
/** @type {import("http").IncomingMessage} */
var response;
mod.then(function (client) {
request = client.request(
urlBase + data,
{
agent: false,
headers: { accept: "text/event-stream" }
},
function (res) {
response = res;
response.on("error", errorHandler);
if (!options.active && !options.module.hot) {
console.log(
"Hot Module Replacement is not enabled. Waiting for process restart..."
);
}
}
);
request.on("error", errorHandler);
request.end();
});
return function () {
if (response) {
response.destroy();
}
};
};
/**
* @param {string} value new url value
*/
exports.setUrl = function (value) {
urlBase = value;
};