@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 07:15 UTC

main
ts 44 lines 1.38 KB
Raw
1 import type { Plugin } from "vite";
2 import { defineConfig } from "waku/config";
3
4 /**
5 * Real user config file, loaded NATIVELY by the integration (the same
6 * `vite.runnerImport("/waku.config")` semantics as waku's own CLI — see
7 * packages/frontend-frameworks/src/waku/Waku.ts `loadUserConfigFile`). Both settings here are
8 * user-observable and only work if this file is honored:
9 *
10 * - `rscBase` moves waku's RSC endpoint/payload base from the default `RSC`
11 * to `custom-rsc` (asserted against the SSG payload path in the smoke
12 * test).
13 * - the user vite plugin serves a virtual module imported by
14 * `src/pages/config-marker.tsx` — if the file were replaced instead of
15 * merged, the import would not resolve and build/dev would fail outright.
16 */
17
18 export const USER_CONFIG_MARKER = "hello-from-waku-config";
19
20 const VIRTUAL_ID = "virtual:fixtures-waku/user-config-marker";
21 const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_ID}`;
22
23 const userConfigMarkerPlugin = (): Plugin => ({
24 name: "fixtures-waku:user-config-marker",
25 resolveId(id) {
26 if (id === VIRTUAL_ID) {
27 return RESOLVED_VIRTUAL_ID;
28 }
29 return;
30 },
31 load(id) {
32 if (id === RESOLVED_VIRTUAL_ID) {
33 return `export const marker = ${JSON.stringify(USER_CONFIG_MARKER)};`;
34 }
35 return;
36 },
37 });
38
39 export default defineConfig({
40 rscBase: "custom-rsc",
41 vite: {
42 plugins: [userConfigMarkerPlugin()],
43 },
44 });