Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

compileCache.ts

17 lines745 Bytes

1// @effect-diagnostics nodeBuiltinImport:off
2import * as NodeModule from "node:module";
3import * as NodeOS from "node:os";
4import * as NodePath from "node:path";
5​
6// Linux /tmp is shared; macOS and Windows temp dirs are per user.
7// AppImage mounts change paths each launch, so Node's path-keyed cache would miss and accumulate copies.
8try {
9 if (!process.env.APPIMAGE) {
10 const cacheRoot =
11 // oxlint-disable-next-line t3code/no-global-process-runtime -- Loads before any Effect runtime.
12 process.platform === "linux"
13 ? process.env.XDG_CACHE_HOME || NodePath.join(NodeOS.homedir(), ".cache")
14 : NodeOS.tmpdir();
15 NodeModule.enableCompileCache(NodePath.join(cacheRoot, "t3code", "compile-cache"));
16 }
17} catch {}