Files
klz-cables.com/.pnpm-store/v10/files/72/24a333bf6154bd78088c4dd386468a6769ba282e618f62548927cf11607550d467efaf2983fb97e5c172183cf32a8514baf232c2b87397eec9823ca4a108e4
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

22 lines
954 B
Plaintext

import path from 'path';
/**
* Returns the path that navigates from the import map file to the base directory.
* This can then be prepended to relative paths in the import map to get the full, absolute path.
*/ export function getImportMapToBaseDirPath({ baseDir, importMapPath }) {
const importMapDir = path.dirname(importMapPath);
// 1. Direct relative path from `importMapDir` -> `baseDir`
let relativePath = path.relative(importMapDir, baseDir).replace(/\\/g, '/');
// 2. If they're the same directory, path.relative will be "", so use "./"
if (!relativePath) {
relativePath = './';
} else if (!relativePath.startsWith('.') && !relativePath.startsWith('/')) {
relativePath = `./${relativePath}`;
}
// 3. For consistency ensure a trailing slash
if (!relativePath.endsWith('/')) {
relativePath += '/';
}
return relativePath;
}
//# sourceMappingURL=getImportMapToBaseDirPath.js.map