Files
Laca-City/backend/node_modules/webpack/lib/node/nodeConsole.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

169 lines
4.4 KiB
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const truncateArgs = require("../logging/truncateArgs");
/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */
/** @typedef {import("../logging/createConsoleLogger").LoggerConsole} LoggerConsole */
/* eslint-disable no-console */
/**
* @param {object} options options
* @param {boolean=} options.colors colors
* @param {boolean=} options.appendOnly append only
* @param {NonNullable<InfrastructureLogging["stream"]>} options.stream stream
* @returns {LoggerConsole} logger function
*/
module.exports = ({ colors, appendOnly, stream }) => {
/** @type {string[] | undefined} */
let currentStatusMessage;
let hasStatusMessage = false;
let currentIndent = "";
let currentCollapsed = 0;
/**
* @param {string} str string
* @param {string} prefix prefix
* @param {string} colorPrefix color prefix
* @param {string} colorSuffix color suffix
* @returns {string} indented string
*/
const indent = (str, prefix, colorPrefix, colorSuffix) => {
if (str === "") return str;
prefix = currentIndent + prefix;
if (colors) {
return (
prefix +
colorPrefix +
str.replace(/\n/g, `${colorSuffix}\n${prefix}${colorPrefix}`) +
colorSuffix
);
}
return prefix + str.replace(/\n/g, `\n${prefix}`);
};
const clearStatusMessage = () => {
if (hasStatusMessage) {
stream.write("\u001B[2K\r");
hasStatusMessage = false;
}
};
const writeStatusMessage = () => {
if (!currentStatusMessage) return;
const l = stream.columns || 40;
const args = truncateArgs(currentStatusMessage, l - 1);
const str = args.join(" ");
const coloredStr = `\u001B[1m${str}\u001B[39m\u001B[22m`;
stream.write(`\u001B[2K\r${coloredStr}`);
hasStatusMessage = true;
};
/**
* @param {string} prefix prefix
* @param {string} colorPrefix color prefix
* @param {string} colorSuffix color suffix
* @returns {(...args: EXPECTED_ANY[]) => void} function to write with colors
*/
const writeColored =
(prefix, colorPrefix, colorSuffix) =>
(...args) => {
if (currentCollapsed > 0) return;
clearStatusMessage();
const str = indent(
util.format(...args),
prefix,
colorPrefix,
colorSuffix
);
stream.write(`${str}\n`);
writeStatusMessage();
};
const writeGroupMessage = writeColored(
"<-> ",
"\u001B[1m\u001B[36m",
"\u001B[39m\u001B[22m"
);
const writeGroupCollapsedMessage = writeColored(
"<+> ",
"\u001B[1m\u001B[36m",
"\u001B[39m\u001B[22m"
);
return {
log: writeColored(" ", "\u001B[1m", "\u001B[22m"),
debug: writeColored(" ", "", ""),
trace: writeColored(" ", "", ""),
info: writeColored("<i> ", "\u001B[1m\u001B[32m", "\u001B[39m\u001B[22m"),
warn: writeColored("<w> ", "\u001B[1m\u001B[33m", "\u001B[39m\u001B[22m"),
error: writeColored("<e> ", "\u001B[1m\u001B[31m", "\u001B[39m\u001B[22m"),
logTime: writeColored(
"<t> ",
"\u001B[1m\u001B[35m",
"\u001B[39m\u001B[22m"
),
group: (...args) => {
writeGroupMessage(...args);
if (currentCollapsed > 0) {
currentCollapsed++;
} else {
currentIndent += " ";
}
},
groupCollapsed: (...args) => {
writeGroupCollapsedMessage(...args);
currentCollapsed++;
},
groupEnd: () => {
if (currentCollapsed > 0) {
currentCollapsed--;
} else if (currentIndent.length >= 2) {
currentIndent = currentIndent.slice(0, -2);
}
},
profile: console.profile && (name => console.profile(name)),
profileEnd: console.profileEnd && (name => console.profileEnd(name)),
clear:
/** @type {() => void} */
(
!appendOnly &&
console.clear &&
(() => {
clearStatusMessage();
console.clear();
writeStatusMessage();
})
),
status: appendOnly
? writeColored("<s> ", "", "")
: (name, ...args) => {
args = args.filter(Boolean);
if (name === undefined && args.length === 0) {
clearStatusMessage();
currentStatusMessage = undefined;
} else if (
typeof name === "string" &&
name.startsWith("[webpack.Progress] ")
) {
currentStatusMessage = [name.slice(19), ...args];
writeStatusMessage();
} else if (name === "[webpack.Progress]") {
currentStatusMessage = [...args];
writeStatusMessage();
} else {
currentStatusMessage = [name, ...args];
writeStatusMessage();
}
}
};
};