✨ 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
98 lines
2.4 KiB
JavaScript
98 lines
2.4 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Tobias Koppers @sokra
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const { STAGE_ADVANCED } = require("../OptimizationStages");
|
|
|
|
/** @typedef {import("../Chunk")} Chunk */
|
|
/** @typedef {import("../Compiler")} Compiler */
|
|
|
|
/**
|
|
* @typedef {object} AggressiveMergingPluginOptions
|
|
* @property {number=} minSizeReduce minimal size reduction to trigger merging
|
|
*/
|
|
|
|
const PLUGIN_NAME = "AggressiveMergingPlugin";
|
|
|
|
class AggressiveMergingPlugin {
|
|
/**
|
|
* @param {AggressiveMergingPluginOptions=} options options object
|
|
*/
|
|
constructor(options) {
|
|
if (
|
|
(options !== undefined && typeof options !== "object") ||
|
|
Array.isArray(options)
|
|
) {
|
|
throw new Error(
|
|
"Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/"
|
|
);
|
|
}
|
|
this.options = options || {};
|
|
}
|
|
|
|
/**
|
|
* Apply the plugin
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @returns {void}
|
|
*/
|
|
apply(compiler) {
|
|
const options = this.options;
|
|
const minSizeReduce = options.minSizeReduce || 1.5;
|
|
|
|
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
compilation.hooks.optimizeChunks.tap(
|
|
{
|
|
name: PLUGIN_NAME,
|
|
stage: STAGE_ADVANCED
|
|
},
|
|
chunks => {
|
|
const chunkGraph = compilation.chunkGraph;
|
|
/** @type {{a: Chunk, b: Chunk, improvement: number}[]} */
|
|
const combinations = [];
|
|
for (const a of chunks) {
|
|
if (a.canBeInitial()) continue;
|
|
for (const b of chunks) {
|
|
if (b.canBeInitial()) continue;
|
|
if (b === a) break;
|
|
if (!chunkGraph.canChunksBeIntegrated(a, b)) {
|
|
continue;
|
|
}
|
|
const aSize = chunkGraph.getChunkSize(b, {
|
|
chunkOverhead: 0
|
|
});
|
|
const bSize = chunkGraph.getChunkSize(a, {
|
|
chunkOverhead: 0
|
|
});
|
|
const abSize = chunkGraph.getIntegratedChunksSize(b, a, {
|
|
chunkOverhead: 0
|
|
});
|
|
const improvement = (aSize + bSize) / abSize;
|
|
combinations.push({
|
|
a,
|
|
b,
|
|
improvement
|
|
});
|
|
}
|
|
}
|
|
|
|
combinations.sort((a, b) => b.improvement - a.improvement);
|
|
|
|
const pair = combinations[0];
|
|
|
|
if (!pair) return;
|
|
if (pair.improvement < minSizeReduce) return;
|
|
|
|
chunkGraph.integrateChunks(pair.b, pair.a);
|
|
compilation.chunks.delete(pair.a);
|
|
return true;
|
|
}
|
|
);
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = AggressiveMergingPlugin;
|