mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-04 08:04:37 +08:00
With SCRIPTC_CHECKER_SERVER=1 on Linux and macOS, the native compiler's checker connections go to a shared `tsc-ts --api --listen` server, which keeps the files it parsed for the next build. When the variable is unset, nothing changes. checkerServerName names the server by a digest of the tsc-ts executable's identity, the working directory, the file system callbacks, the timing flag and the TSC_TS_* environment. scriptc_ts7_attach takes the server's lock file with a non-blocking flock, connects to its socket in this user's private server directory ($XDG_RUNTIME_DIR/scriptc or /tmp/scriptc-<uid>), and starts the server when none answers: in its own process group, with its standard streams on /dev/null and no other descriptor of the build, with --idle-exit 300 and TSC_TS_LISTEN_MEMORY=2048 unless the environment sets it. A build that finds the server in use, cannot start or reach it, or gets no answer to a ping checks with its own tsc-ts process, as without the variable; so does a tsc-ts without --listen, which exits as it starts. The syntax-only source parser, which reads no libraries, always uses its own process and leaves the server to the program's checker.