import * as rpc from "vscode-jsonrpc/node"; import { RewriteRpc } from "./rewrite-rpc"; import { RecipeMarketplace } from "../marketplace"; export interface JavaRpcOptions { /** Explicit classpath override. Falls back to env var, then test-classpath.txt. */ classpath?: string; /** JAVA_HOME to use. Falls back to process.env.JAVA_HOME, then `java` on PATH. */ javaHome?: string; /** Optional logger forwarded to the underlying RewriteRpc instance. */ logger?: rpc.Logger; /** Optional path to a marketplace CSV — passed via `--marketplace=` to the Java process. */ marketplaceCsv?: string; /** Enable RPC tracing on the Java side (passed as `--trace`). */ trace?: boolean; /** * Pre-built {@link RecipeMarketplace} for the TS-side {@link RewriteRpc} instance * only. Does NOT configure the Java side — for that, use {@link marketplaceCsv}. */ marketplace?: RecipeMarketplace; } /** * Test-only wrapper around a spawned `org.openrewrite.maven.rpc.JavaRewriteRpc` process, * exposing a {@link RewriteRpc} client wired to its stdio over JSON-RPC. * * Typical use: * ``` * const server = await JavaRpcTestServer.start(); * try { * const recipe = await server.rpc.prepareRecipe("org.openrewrite.text.FindAndReplace", {...}); * const result = await server.rpc.visit(parsed, recipe.editVisitor, ctx); * } finally { * await server.dispose(); * } * ``` */ export declare class JavaRpcTestServer { private readonly child; readonly rpc: RewriteRpc; private constructor(); /** Spawn the Java RPC server and connect a {@link RewriteRpc} client to its stdio. */ static start(opts?: JavaRpcOptions): Promise; /** * Reset accumulated state on both the Java side and the TS-side * {@link RewriteRpc} caches so the next test starts clean. */ reset(): Promise; /** * End the JSON-RPC connection and wait for the Java process to exit. Falls back * to SIGKILL after a short grace period to ensure no orphan JVMs are left behind. */ dispose(): Promise; } /** * Find the classpath for spawning the Java RPC server. * * Resolution order: * 1. `REWRITE_JAVASCRIPT_CLASSPATH` environment variable. * 2. `test-classpath.txt` written by the `:rewrite-javascript:generateTestClasspath` * Gradle task. Walks up from this source file (works both when running directly * via vitest and when running from `dist/`). * * @returns the classpath string, or `undefined` if no source is configured. */ export declare function findTestClasspath(): string | undefined; //# sourceMappingURL=java-rpc-client.d.ts.map