ttsc
Version:
General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.
48 lines (47 loc) • 2.52 kB
TypeScript
import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin";
/**
* Resolve the caller-declared plugin config anchor to an absolute path, or
* `undefined` when the caller did not declare one.
*
* The anchor exists for embedders that compile through a generated tsconfig
* outside the project (the bundler adapters' alias overlay): they set
* `pluginConfigDir` to the real project directory and every native plugin spawn
* forwards it as `TTSC_PLUGIN_CONFIG_DIR`, so config-file discovery walks the
* project instead of the wrapper's temp-dir ancestry. Callers that point at a
* user-authored tsconfig (even a wrapper outside the project) leave it unset,
* keeping discovery anchored at the tsconfig's own directory.
*/
export declare function resolvePluginConfigDir(options: {
cwd?: string;
pluginConfigDir?: string;
}): string | undefined;
/**
* Reports whether the given transform source is linked into another compiler
* host instead of owning the process itself.
*/
export declare function isLinkedTransform(plugin: ITtscLoadedNativePlugin): boolean;
/**
* Verifies that all transform plugins in `plugins` either resolve to the same
* native binary (the common case) after linked sources are removed from the
* compiler-owner set.
*
* Two callers exist with subtly different error wording: the build path
* (`runBuild.ts`) reports "multiple compiler native backends cannot share one
* emit pass" while the source-to-source path (`transformProjectInMemory.ts`)
* reports "cannot share one source-to-source pass". The `pass` argument selects
* the appropriate phrase so the error message remains diagnostic-grade instead
* of generic.
*/
export declare function assertSharedHostCompatibility(plugins: readonly ITtscLoadedNativePlugin[], pass: "emit" | "source-to-source"): void;
/**
* Picks the native binary that must own the compiler pass. Linked transform
* sources ride inside a host that uses driver.LoadProgram, so an executable
* transform wins when one is present.
*/
export declare function selectSharedHostPlugin(plugins: readonly ITtscLoadedNativePlugin[]): ITtscLoadedNativePlugin;
/**
* Return every plugin whose transform source is linked into another host binary
* rather than owning the process. The host binary passes these via
* `TTSC_LINKED_PLUGINS_JSON` so their Go code runs inside the same process.
*/
export declare function linkedTransformPlugins(plugins: readonly ITtscLoadedNativePlugin[]): ITtscLoadedNativePlugin[];