Files
Laca-City/backend/node_modules/fs-monkey/docs/api/patchRequire.md
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

56 lines
1.6 KiB
Markdown

# `patchRequire(vol[, unixifyPaths[, Module]])`
Patches Node's `module` module to use a given *fs-like* object `vol` for module loading.
- `vol` - fs-like object
- `unixifyPaths` *(optional)* - whether to convert Windows paths to unix style paths, defaults to `false`.
- `Module` *(optional)* - a module to patch, defaults to `require('module')`
Monkey-patches the `require` function in Node, this way you can make
Node.js to *require* modules from your custom filesystem.
It expects an object with three filesystem methods implemented that are
needed for the `require` function to work.
```js
let vol = {
readFileSync: () => {},
realpathSync: () => {},
statSync: () => {},
};
```
If you want to make Node.js to *require* your files from memory, you
don't need to implement those functions yourself, just use the
[`memfs`](https://github.com/streamich/memfs) package:
```js
import {vol} from 'memfs';
import {patchRequire} from 'fs-monkey';
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
patchRequire(vol);
require('/foo/bar'); // obi trice
```
Now the `require` function will only load the files from the `vol` file
system, but not from the actual filesystem on the disk.
If you want the `require` function to load modules from both file
systems, use the [`unionfs`](https://github.com/streamich/unionfs) package
to combine both filesystems into a union:
```js
import {vol} from 'memfs';
import {patchRequire} from 'fs-monkey';
import {ufs} from 'unionfs';
import * as fs from 'fs';
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
ufs
.use(vol)
.use(fs);
patchRequire(ufs);
require('/foo/bar.js'); // obi trice
```