Class JavaScriptRewriteRpc.Builder

java.lang.Object
org.openrewrite.javascript.rpc.JavaScriptRewriteRpc.Builder
All Implemented Interfaces:
Supplier<JavaScriptRewriteRpc>
Enclosing class:
JavaScriptRewriteRpc

public static class JavaScriptRewriteRpc.Builder extends Object implements Supplier<JavaScriptRewriteRpc>
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • marketplace

      public JavaScriptRewriteRpc.Builder marketplace(org.openrewrite.marketplace.RecipeMarketplace marketplace)
    • resolvers

      public JavaScriptRewriteRpc.Builder resolvers(List<org.openrewrite.marketplace.RecipeBundleResolver> resolvers)
    • recipeInstallDir

      public JavaScriptRewriteRpc.Builder recipeInstallDir(@Nullable Path recipeInstallDir)
    • npxPath

      public JavaScriptRewriteRpc.Builder npxPath(Path npxPath)
      Path to the `npx` executable, not just the directory it is installed in.
      Parameters:
      npxPath - The path to the `npx` executable.
      Returns:
      This builder
    • npxPath

      public JavaScriptRewriteRpc.Builder npxPath(Supplier<@Nullable Path> npxPathSupplier)
      Supplies the path to the `npx` executable. The supplier is invoked at most once, when the RPC is first started. Returning null uses the built-in default (same as not configuring the path at all). Exceptions thrown by the supplier propagate out of the RPC-start call.
      Parameters:
      npxPathSupplier - Supplier for the path to the `npx` executable
      Returns:
      This builder
    • timeout

      public JavaScriptRewriteRpc.Builder timeout(Duration timeout)
    • log

      public JavaScriptRewriteRpc.Builder log(@Nullable Path log)
    • metricsCsv

      public JavaScriptRewriteRpc.Builder metricsCsv(@Nullable Path metricsCsv)
    • environment

      public JavaScriptRewriteRpc.Builder environment(Map<String,String> environment)
    • traceRpcMessages

      public JavaScriptRewriteRpc.Builder traceRpcMessages(boolean verboseLogging)
      Enables info and debug level logging.
      Returns:
      This builder.
    • traceRpcMessages

      public JavaScriptRewriteRpc.Builder traceRpcMessages()
    • inspectBrk

      public JavaScriptRewriteRpc.Builder inspectBrk(Path rewriteSourcePath, int inspectBrk)
      Set the port for the Node.js inspector to listen on. When this is set, you can use an "Attach to Node.js/Chrome" run configuration in IDEA to debug the JavaScript Rewrite RPC process. The Rewrite RPC process will block waiting for this connection.
      Parameters:
      rewriteSourcePath - The path to either OpenRewrite TypeScript source code, or inside a node_modules folder e.g., @openrewrite/rewrite. When running a test from within this project, the value should be "rewrite" (since "rewrite-javascript/rewrite" contains the TypeScript source code).
      inspectBrk - The port for the Node.js inspector to listen on.
      Returns:
      This builder
    • inspectBrk

      public JavaScriptRewriteRpc.Builder inspectBrk(Path rewriteDistPath)
    • workingDirectory

      public JavaScriptRewriteRpc.Builder workingDirectory(@Nullable Path workingDirectory)
      Set the working directory for the Node.js process. This affects where profile logs and other output files are generated. If not set, the process inherits the current working directory.
      Parameters:
      workingDirectory - The working directory for the Node.js process
      Returns:
      This builder
    • get

      public JavaScriptRewriteRpc get()
      Specified by:
      get in interface Supplier<JavaScriptRewriteRpc>