"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.timeMiddleware = void 0;
const utils_1 = require("../../utils");
const logTime = utils_1.createDebugger('vite:time');
function timeMiddleware(root) {
    return (req, res, next) => {
        const start = Date.now();
        const end = res.end;
        res.end = (...args) => {
            logTime(`${utils_1.timeFrom(start)} ${utils_1.prettifyUrl(req.url, root)}`);
            // @ts-ignore
            return end.call(res, ...args);
        };
        next();
    };
}
exports.timeMiddleware = timeMiddleware;
//# sourceMappingURL=time.js.map