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.config.Environment marketplace)
    • 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
    • timeout

      public JavaScriptRewriteRpc.Builder timeout(Duration timeout)
    • log

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

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

      public JavaScriptRewriteRpc.Builder verboseLogging()
    • inspectBrk

      public JavaScriptRewriteRpc.Builder inspectBrk(@Nullable Integer 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:
      inspectBrk - The port for the Node.js inspector to listen on.
      Returns:
      This builder
    • inspectBrk

      public JavaScriptRewriteRpc.Builder inspectBrk()
    • profiler

      public JavaScriptRewriteRpc.Builder profiler(boolean profiler)
      Enable V8 CPU profiling for performance analysis. When enabled, the process will generate a CPU profile that can be analyzed to identify performance bottlenecks. The profile is saved in Chrome DevTools format (.cpuprofile) on shutdown.

      Profiling uses the V8 Inspector API and works with both npx and direct node execution modes. The profile file can be loaded in Chrome DevTools for analysis.

      Parameters:
      profiler - Whether to enable profiling
      Returns:
      This builder
    • profiler

      public JavaScriptRewriteRpc.Builder profiler()
    • maxHeapSize

      public JavaScriptRewriteRpc.Builder maxHeapSize(@Nullable Integer maxHeapSize)
      Set the maximum heap size for the Node.js process in megabytes. Default V8 heap size is approximately 1.5-2 GB on 64-bit systems. For large repositories with many source files, you may need to increase this.
      Parameters:
      maxHeapSize - Maximum heap size in megabytes (e.g., 4096 for 4GB)
      Returns:
      This builder
    • 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>