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 | import * as NodeModule from "node:module"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Schema from "effect/Schema"; |
| 4 | |
| 5 | class CompileCacheFlushError extends Schema.TaggedError<CompileCacheFlushError>()( |
| 6 | "CompileCacheFlushError", |
| 7 | { cause: Schema.Defect() }, |
| 8 | ) { |
| 9 | override get message(): string { |
| 10 | return "Could not flush the module compile cache."; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | // Windows force-kills on quit; persist the cache after startup. |
| 15 | export const flushCompileCache = Effect.try({ |
| 16 | try: () => { |
| 17 | if (!Reflect.get(globalThis, Symbol.for("t3code.preparedServerCache"))) { |
| 18 | NodeModule.flushCompileCache(); |
| 19 | } |
| 20 | }, |
| 21 | catch: (cause) => new CompileCacheFlushError({ cause }), |
| 22 | }).pipe(Effect.ignore); |