consolidate build scripts, reorganize source into src/ directory, fix favicon injection

This commit is contained in:
Nystik
2026-03-20 23:46:17 +01:00
parent 2add5238b8
commit 0747a4540d
56 changed files with 46 additions and 45 deletions

24
src/shims/url.js Normal file
View File

@@ -0,0 +1,24 @@
export const urlShim = {
URL: globalThis.URL,
URLSearchParams: globalThis.URLSearchParams,
pathToFileURL(p) {
// Return an object with .href matching Node's url.pathToFileURL behavior
const encoded = encodeURI(p.replace(/\\/g, "/"));
const href = "file:///" + encoded.replace(/^\/+/, "");
return { href, toString: () => href };
},
fileURLToPath(url) {
let str = typeof url === "string" ? url : url.href || url.toString();
if (str.startsWith("file:///")) {
str = str.slice(8);
} else if (str.startsWith("file://")) {
str = str.slice(7);
}
return decodeURI(str);
},
};