Files
Laca-City/backend/node_modules/webpack/lib/javascript/CommonJsChunkFormatPlugin.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

161 lines
4.5 KiB
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource, RawSource } = require("webpack-sources");
const RuntimeGlobals = require("../RuntimeGlobals");
const Template = require("../Template");
const { getUndoPath } = require("../util/identifier");
const {
getChunkFilenameTemplate,
getCompilationHooks
} = require("./JavascriptModulesPlugin");
const {
generateEntryStartup,
updateHashForEntryStartup
} = require("./StartupHelpers");
/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Entrypoint")} Entrypoint */
const PLUGIN_NAME = "CommonJsChunkFormatPlugin";
class CommonJsChunkFormatPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
compilation.hooks.additionalChunkRuntimeRequirements.tap(
PLUGIN_NAME,
(chunk, set, { chunkGraph }) => {
if (chunk.hasRuntime()) return;
if (chunkGraph.getNumberOfEntryModules(chunk) > 0) {
set.add(RuntimeGlobals.require);
set.add(RuntimeGlobals.startupEntrypoint);
set.add(RuntimeGlobals.externalInstallChunk);
}
}
);
const hooks = getCompilationHooks(compilation);
hooks.renderChunk.tap(PLUGIN_NAME, (modules, renderContext) => {
const { chunk, chunkGraph, runtimeTemplate } = renderContext;
const source = new ConcatSource();
source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`);
source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`);
source.add("exports.modules = ");
source.add(modules);
source.add(";\n");
const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder(chunk);
if (runtimeModules.length > 0) {
source.add("exports.runtime =\n");
source.add(
Template.renderChunkRuntimeModules(runtimeModules, renderContext)
);
}
const entries = [
...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
];
if (entries.length > 0) {
const runtimeChunk =
/** @type {Entrypoint} */
(entries[0][1]).getRuntimeChunk();
const currentOutputName = compilation
.getPath(
getChunkFilenameTemplate(chunk, compilation.outputOptions),
{
chunk,
contentHashType: "javascript"
}
)
.replace(/^\/+/g, "")
.split("/");
const runtimeOutputName = compilation
.getPath(
getChunkFilenameTemplate(
/** @type {Chunk} */
(runtimeChunk),
compilation.outputOptions
),
{
chunk: /** @type {Chunk} */ (runtimeChunk),
contentHashType: "javascript"
}
)
.replace(/^\/+/g, "")
.split("/");
// remove common parts
while (
currentOutputName.length > 1 &&
runtimeOutputName.length > 1 &&
currentOutputName[0] === runtimeOutputName[0]
) {
currentOutputName.shift();
runtimeOutputName.shift();
}
const last = runtimeOutputName.join("/");
// create final path
const runtimePath =
getUndoPath(currentOutputName.join("/"), last, true) + last;
const entrySource = new ConcatSource();
entrySource.add(
`(${
runtimeTemplate.supportsArrowFunction() ? "() => " : "function() "
}{\n`
);
entrySource.add("var exports = {};\n");
entrySource.add(source);
entrySource.add(";\n\n// load runtime\n");
entrySource.add(
`var ${RuntimeGlobals.require} = require(${JSON.stringify(
runtimePath
)});\n`
);
entrySource.add(`${RuntimeGlobals.externalInstallChunk}(exports);\n`);
const startupSource = new RawSource(
generateEntryStartup(
chunkGraph,
runtimeTemplate,
entries,
chunk,
false
)
);
entrySource.add(
hooks.renderStartup.call(
startupSource,
entries[entries.length - 1][0],
{
...renderContext,
inlined: false
}
)
);
entrySource.add("\n})()");
return entrySource;
}
return source;
});
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, { chunkGraph }) => {
if (chunk.hasRuntime()) return;
hash.update(PLUGIN_NAME);
hash.update("1");
const entries = [
...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
];
updateHashForEntryStartup(hash, chunkGraph, entries, chunk);
});
});
}
}
module.exports = CommonJsChunkFormatPlugin;