× Found 1 circular dependency! 1) components/blufi/xBlufi-wx-impl.js > components/blufi/xBlufi.js
22 lines
422 B
JavaScript
22 lines
422 B
JavaScript
// utils/pathUtils.js
|
|
const path = require("path");
|
|
|
|
let normalizeCount = 0;
|
|
const MAX_NORMALIZE_DEPTH = 20;
|
|
|
|
export function safeNormalize(p) {
|
|
if (normalizeCount++ > MAX_NORMALIZE_DEPTH) {
|
|
console.error("[Path Normalize] Maximum depth reached:", p);
|
|
return p;
|
|
}
|
|
|
|
try {
|
|
return path
|
|
.normalize(p)
|
|
.replace(/\\/g, "/")
|
|
.replace(/\/{2,}/g, "/");
|
|
} finally {
|
|
normalizeCount--;
|
|
}
|
|
}
|