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, 03:37 UTC
| 1 | // @effect-diagnostics nodeBuiltinImport:off |
| 2 | import * as NodeModule from "node:module"; |
| 3 | import * as NodeOS from "node:os"; |
| 4 | import * as NodePath from "node:path"; |
| 5 | import { enablePreparedServerCache } from "../../../scripts/lib/server-compile-cache.ts"; |
| 6 | |
| 7 | // Linux /tmp is shared; macOS and Windows temp dirs are per user. |
| 8 | // AppImage mounts change paths each launch, so Node's path-keyed cache would miss and accumulate copies. |
| 9 | try { |
| 10 | if (!process.env.APPIMAGE || process.env.ELECTRON_RUN_AS_NODE === "1") { |
| 11 | const cacheRoot = |
| 12 | // oxlint-disable-next-line t3code/no-global-process-runtime -- Loads before any Effect runtime. |
| 13 | process.platform === "linux" |
| 14 | ? process.env.XDG_CACHE_HOME || NodePath.join(NodeOS.homedir(), ".cache") |
| 15 | : NodeOS.tmpdir(); |
| 16 | const directory = NodePath.join(cacheRoot, "t3code", "compile-cache"); |
| 17 | const prepared = |
| 18 | process.env.ELECTRON_RUN_AS_NODE === "1" && |
| 19 | enablePreparedServerCache(process.argv[1] ?? "", directory); |
| 20 | if (!prepared && !process.env.APPIMAGE) { |
| 21 | NodeModule.enableCompileCache(directory); |
| 22 | } |
| 23 | } |
| 24 | } catch {} |