Files
Laca-City/backend/node_modules/enhanced-resolve/lib/PnpPlugin.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

135 lines
3.9 KiB
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Maël Nison @arcanis
*/
"use strict";
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/**
* @typedef {object} PnpApiImpl
* @property {(packageName: string, issuer: string, options: { considerBuiltins: boolean }) => string | null} resolveToUnqualified resolve to unqualified
*/
module.exports = class PnpPlugin {
/**
* @param {string | ResolveStepHook} source source
* @param {PnpApiImpl} pnpApi pnpApi
* @param {string | ResolveStepHook} target target
* @param {string | ResolveStepHook} alternateTarget alternateTarget
*/
constructor(source, pnpApi, target, alternateTarget) {
this.source = source;
this.pnpApi = pnpApi;
this.target = target;
this.alternateTarget = alternateTarget;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
/** @type {ResolveStepHook} */
const target = resolver.ensureHook(this.target);
const alternateTarget = resolver.ensureHook(this.alternateTarget);
resolver
.getHook(this.source)
.tapAsync("PnpPlugin", (request, resolveContext, callback) => {
const req = request.request;
if (!req) return callback();
// The trailing slash indicates to PnP that this value is a folder rather than a file
const issuer = `${request.path}/`;
const packageMatch = /^(@[^/]+\/)?[^/]+/.exec(req);
if (!packageMatch) return callback();
const [packageName] = packageMatch;
const innerRequest = `.${req.slice(packageName.length)}`;
/** @type {string|undefined|null} */
let resolution;
/** @type {string|undefined|null} */
let apiResolution;
try {
resolution = this.pnpApi.resolveToUnqualified(packageName, issuer, {
considerBuiltins: false,
});
if (resolution === null) {
// This is either not a PnP managed issuer or it's a Node builtin
// Try to continue resolving with our alternatives
resolver.doResolve(
alternateTarget,
request,
"issuer is not managed by a pnpapi",
resolveContext,
(err, result) => {
if (err) return callback(err);
if (result) return callback(null, result);
// Skip alternatives
return callback(null, null);
},
);
return;
}
if (resolveContext.fileDependencies) {
apiResolution = this.pnpApi.resolveToUnqualified("pnpapi", issuer, {
considerBuiltins: false,
});
}
} catch (/** @type {unknown} */ error) {
if (
/** @type {Error & { code: string }} */
(error).code === "MODULE_NOT_FOUND" &&
/** @type {Error & { pnpCode: string }} */
(error).pnpCode === "UNDECLARED_DEPENDENCY"
) {
// This is not a PnP managed dependency.
// Try to continue resolving with our alternatives
if (resolveContext.log) {
resolveContext.log("request is not managed by the pnpapi");
for (const line of /** @type {Error} */ (error).message
.split("\n")
.filter(Boolean)) {
resolveContext.log(` ${line}`);
}
}
return callback();
}
return callback(/** @type {Error} */ (error));
}
if (resolution === packageName) return callback();
if (apiResolution && resolveContext.fileDependencies) {
resolveContext.fileDependencies.add(apiResolution);
}
/** @type {ResolveRequest} */
const obj = {
...request,
path: resolution,
request: innerRequest,
ignoreSymlinks: true,
fullySpecified: request.fullySpecified && innerRequest !== ".",
};
resolver.doResolve(
target,
obj,
`resolved by pnp to ${resolution}`,
resolveContext,
(err, result) => {
if (err) return callback(err);
if (result) return callback(null, result);
// Skip alternatives
return callback(null, null);
},
);
});
}
};