@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
22 lines (20 loc) • 1.2 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
let node_path = require("node:path");
//#region src/utils/resolveRelativePath.ts
const resolveRelativePath = (path, sourcePath, baseDir) => {
if ((0, node_path.isAbsolute)(path)) {
const normalizedResult = (0, node_path.normalize)(path);
const normalizedBaseDir = (0, node_path.normalize)(baseDir);
if (path.startsWith("/") && !normalizedResult.startsWith(normalizedBaseDir)) {
const relativeToBase = (0, node_path.resolve)(baseDir, path.substring(1));
if (!path.startsWith("/usr/") && !path.startsWith("/etc/") && !path.startsWith("/var/") && !path.startsWith("/home/") && !path.startsWith("/Users/") && !path.startsWith("/tmp/") && !path.startsWith("/private/") && !path.startsWith("/opt/")) return relativeToBase;
}
return normalizedResult;
}
if (path.startsWith("./") || path.startsWith("../")) return (0, node_path.resolve)((0, node_path.dirname)(sourcePath), path);
return (0, node_path.resolve)(baseDir, path);
};
//#endregion
exports.resolveRelativePath = resolveRelativePath;
//# sourceMappingURL=resolveRelativePath.cjs.map