Push balls to opponent's side online. That's it. That's the game.
google-balls-the-thrusting-production.up.railway.app
googleballs
1import type { BunPlugin } from "bun";
2import { cssTheme } from "./theme";
3
4function generateThemeCSS(): string {
5 const vars = Object.entries(cssTheme.colors)
6 .map(([name, value]) => ` --color-${name}: ${value};`)
7 .join("\n");
8 return `@theme {\n${vars}\n}\n`;
9}
10
11const VIRTUAL_PATH = "virtual:theme.css";
12const RESOLVED_PATH = "/__virtual__/theme.css";
13
14// @ts-ignore - hooks into bun-plugin-tailwind's import resolver to intercept virtual:theme.css
15const originalResolve = globalThis.__tw_resolve;
16// @ts-ignore
17globalThis.__tw_resolve = (id: string, base: string) => {
18 if (id === VIRTUAL_PATH) return RESOLVED_PATH;
19 return originalResolve?.(id, base);
20};
21
22// @ts-ignore - hooks into bun-plugin-tailwind's file reader to serve generated @theme CSS
23const originalReadFile = globalThis.__tw_readFile;
24// @ts-ignore
25globalThis.__tw_readFile = async (path: string, encoding: string) => {
26 if (path === RESOLVED_PATH) return generateThemeCSS();
27 return originalReadFile?.(path, encoding);
28};
29
30const themePlugin: BunPlugin = {
31 name: "tailwind-theme-generator",
32 setup() {},
33};
34
35export default themePlugin;