UNPKG

ttsc

Version:

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

42 lines (41 loc) 1.39 kB
/** * Resolve the consumer project's native TypeScript (`tsc`) binary and metadata. * * Resolution order: * * 1. `opts.binary` or `TTSC_TSGO_BINARY` env var — must be an existing absolute * path; returns `{ binary, packageJson: "", packageRoot, version: "custom" * }`. * 2. `typescript` resolved from the project `cwd`. * 3. `typescript` resolved from `opts.resolveFrom` (for test harnesses and * embedders that anchor to a different directory). * * Throws a descriptive error when the package or platform binary is missing so * callers never have to reason about undefined binary paths. */ export declare function resolveTsgo(opts?: { /** Explicit path to a native `tsc` binary; bypasses package resolution. */ binary?: string; /** Directory from which to discover `typescript`. */ cwd?: string; env?: NodeJS.ProcessEnv; /** * Fallback resolution anchor used when the package is not found at `cwd`. * Useful in test harnesses that install the package into a different tree. */ resolveFrom?: string; }): { binary: string; packageJson: string; packageRoot: string; version: string; gitHead?: undefined; platformPackageJson?: undefined; } | { binary: string; gitHead: string | undefined; packageJson: string; packageRoot: string; platformPackageJson: string; version: string; };