restructured and simplified favicon

This commit is contained in:
Niki Wix Skaarup 2025-04-12 21:14:09 +02:00
parent 259ccfe851
commit 08c127f637
Signed by: nikiskaarup
GPG key ID: FC2F1B116F6E788C
28 changed files with 320 additions and 260 deletions

29
image-plugin.ts Normal file
View file

@ -0,0 +1,29 @@
import { plugin, type BunPlugin } from "bun";
const imageLoaderPlugin: BunPlugin = {
name: "image-loader",
setup(builder) {
builder.onLoad({ filter: /\.(png|jpg|jpeg|webp)/ }, async ({ path }) => {
try {
const file = Bun.file(path);
const bytes = await file.bytes();
return {
exports: { default: bytes },
loader: "object",
}
} catch (err) {
console.error(err);
if (err instanceof Error) {
throw new Error(`Failed to load file: ${err.message}`);
} else if (typeof err === 'string') {
throw new Error(`Failed to load file: ${err}`);
}
throw new Error("Failed to load file");
}
});
}
};
plugin(imageLoaderPlugin);
export default imageLoaderPlugin;