including-modules

This commit is contained in:
Kismet Hasanaj
2026-05-03 00:14:08 +02:00
parent ec83a0d879
commit 39a8a128be
20434 changed files with 3906546 additions and 3 deletions
+18
View File
@@ -0,0 +1,18 @@
export function normalizedAssetPrefix(assetPrefix) {
// remove all leading slashes and trailing slashes
const escapedAssetPrefix = assetPrefix?.replace(/^\/+|\/+$/g, '') || false;
// if an assetPrefix was '/', we return empty string
// because it could be an unnecessary trailing slash
if (!escapedAssetPrefix) {
return '';
}
if (URL.canParse(escapedAssetPrefix)) {
const url = new URL(escapedAssetPrefix).toString();
return url.endsWith('/') ? url.slice(0, -1) : url;
}
// assuming assetPrefix here is a pathname-style,
// restore the leading slash
return `/${escapedAssetPrefix}`;
}
//# sourceMappingURL=normalized-asset-prefix.js.map