@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, 04:45 UTC

main
ts 27 lines 1.05 KB
Raw
1 import { isRegisterHooksSupported } from "alchemy/Util/Node";
2
3 /**
4 * The real node binary tests spawn, and ITS version — not bun's emulated
5 * `process.versions.node`, which is what the version gates would
6 * consult by default. Gating on the wrong runtime made the node-launcher
7 * tests run (and fail with zero diagnostics) on machines whose PATH node
8 * is older than the version bun reports.
9 */
10 export const nodePath = typeof Bun !== "undefined" ? Bun.which("node") : null;
11
12 export const nodeVersion: string | null = (() => {
13 if (nodePath === null) return null;
14 try {
15 const probe = Bun.spawnSync([nodePath, "-p", "process.versions.node"]);
16 const version = probe.stdout.toString().trim();
17 return probe.exitCode === 0 && version.length > 0 ? version : null;
18 } catch {
19 return null;
20 }
21 })();
22
23 /**
24 * Whether the spawned node can run alchemy's dev-mode source path: hooks
25 * capable implies `.ts` capable (transform flag below v26, native from v26).
26 */
27 export const nodeSupportsDevMode = nodeVersion !== null && isRegisterHooksSupported(nodeVersion);