UNPKG

ttsc

Version:

General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.

60 lines (59 loc) 2.51 kB
import type { ITtscProjectPluginConfig } from "../ITtscProjectPluginConfig"; /** * Internal options shared by the CLI build, single-file emit, and runtime * paths. */ export interface TtscCommonOptions { /** * Explicit TypeScript-Go executable. * * When supplied, ttsc skips package-based tsgo resolution and shells out to * this binary directly. */ binary?: string; /** Working directory for config discovery and relative file paths. */ cwd?: string; /** Project root override for generated tsconfig wrappers. */ projectRoot?: string; /** * Directory that anchors plugin config-file discovery and relative * `configFile` resolution (forwarded to plugin processes as * `TTSC_PLUGIN_CONFIG_DIR`). Set by build integrations that compile through a * generated tsconfig outside the project; when omitted, plugins anchor at the * tsconfig's own directory. */ pluginConfigDir?: string; /** Environment variables merged over `process.env` for child processes. */ env?: NodeJS.ProcessEnv; /** Explicit root directory for compiled source-plugin cache artifacts. */ cacheDir?: string; /** Normalize compiler output so diagnostics can be parsed structurally. */ structuredDiagnostics?: boolean; /** * Run TypeScript-Go single-threaded — one checker, serial parse/check/emit. * Mirrors `tsgo --singleThreaded`. Useful for deterministic debugging and CI * repro. */ singleThreaded?: boolean; /** * Type-checker pool size, mirroring `tsgo --checkers`. `undefined` leaves * TypeScript-Go's default; ignored when `singleThreaded` is set. */ checkers?: number; /** * CLI tokens ttsc did not recognize as its own, forwarded verbatim to the * underlying `tsgo` invocation. This is how a tsgo flag ttsc has no first- * class option for (`--strict`, `--target es2020`, `--listFiles`, …) still * reaches the compiler: ttsc owns its own flags and lets tsgo — which has the * complete, arity-aware option parser — handle the rest. */ passthrough?: readonly string[]; /** * Override project plugin loading for this invocation. * * - `false`: ignore `compilerOptions.plugins` completely. * - Array: use these plugin entries instead of the project config entries. * - `undefined`: use the project config entries as written. */ plugins?: readonly ITtscProjectPluginConfig[] | false; }