UNPKG

ttsc

Version:

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

63 lines (62 loc) 3.13 kB
import type { ITtscProjectPluginConfig } from "../../structures/ITtscProjectPluginConfig"; import type { ITtscLoadedNativePlugin } from "../../structures/internal/ITtscLoadedNativePlugin"; import type { ITtscParsedProjectConfig } from "../../structures/internal/ITtscParsedProjectConfig"; /** * Resolve, load, and build all native plugin sidecars for a TypeScript project. * * Reads the project config, discovers plugin entries (from tsconfig and package * auto-discovery), validates and composes their descriptors, then invokes * `buildSourcePlugin` to compile each Go source package into a cached binary. * Returns the ordered set of loaded native plugins alongside the parsed project * config. * * @param options.binary - Absolute path to the ttsc native helper binary. * @param options.cacheDir - Override the plugin binary cache directory. * @param options.cwd - Working directory for resolving relative paths. * @param options.entries - Explicit plugin entries; `false` disables all * plugins (skips both tsconfig entries and package auto-discovery). * @param options.env - Effective environment for source-plugin builds and the * `ttsx` descriptor child (`{ ...process.env, ...context.env }`). Defaults to * `process.env` for CLI callers, so ambient behavior is unchanged. * @param options.file - Path to the tsconfig/jsconfig file. * @param options.pluginConfigDir - Caller-declared anchor for plugin * config-file discovery (see `ITtscPluginFactoryContext.pluginConfigDir`). * @param options.projectRoot - Override the project root directory. * @param options.tsconfig - Alias for `file`. */ export declare function loadProjectPlugins(options: { binary: string; cacheDir?: string; cwd?: string; entries?: readonly ITtscProjectPluginConfig[] | false; env?: NodeJS.ProcessEnv; file?: string; onWatchInputs?: (inputs: readonly string[]) => void; pluginConfigDir?: string; projectRoot?: string; tsconfig?: string; }): { nativePlugins: ITtscLoadedNativePlugin[]; project: ITtscParsedProjectConfig; }; /** * Return `true` when the project has at least one enabled plugin entry. * * Used by callers that need to skip plugin-specific work when no plugins are * configured, without paying the full cost of `loadProjectPlugins`. * * @param entries - Explicit entries; `false` always returns `false`. */ export declare function hasProjectPluginEntries(project: ITtscParsedProjectConfig, entries?: readonly ITtscProjectPluginConfig[] | false): boolean; /** * The descriptor shim's emitted source. * * Exported so a regression can inspect the same bytes ttsx executes. This * template consumes its own escapes, so reading this file's text instead would * check characters no consumer ever sees — and a dropped backslash turns an * escape into the character it was escaping: a raw line terminator inside a * string literal, which stops the shim parsing and takes every descriptor load * with it. Its `@ttsc/lint` twin has carried that guard since the same defect * shipped there. */ export declare const PLUGIN_DESCRIPTOR_SHIM_SOURCE: string;