Class JsPlugin

java.lang.Object
io.deephaven.plugin.PluginBase
io.deephaven.plugin.js.JsPlugin
All Implemented Interfaces:
Plugin, Registration

@Immutable public abstract class JsPlugin extends PluginBase
A JS plugin is a Plugin that allows for custom javascript and related content to be served, see io.deephaven.plugin.js.

For example, if the following JS plugin was the only JS plugin installed

 JsPlugin.builder()
         .name("foo")
         .version("1.0.0")
         .main(Path.of("dist/index.js"))
         .path(Path.of("/path-to/my-plugin"))
         .build()
 
the manifest served at "js-plugins/manifest.json" would be equivalent to
 {
   "plugins": [
     {
       "name": "foo",
       "version": "1.0.0",
       "main": "dist/index.js"
     }
   ]
 }
 
and all files of the form "/path-to/my-plugin/{somePath}" would be served at "js-plugins/foo/{somePath}".
  • Constructor Details

    • JsPlugin

      public JsPlugin()
  • Method Details

    • builder

      public static JsPlugin.Builder builder()
    • name

      public abstract String name()
      The JS plugin name. The JS plugin contents will be served under the URL path "js-plugins/{name}/", as well as included as the "name" field for the manifest entry in "js-plugins/manifest.json". The "/" character will not be URL encoded - the name "@example/foo" would be served under the URL path "js-plugins/@example/foo/".
      Returns:
      the name
    • version

      public abstract String version()
      The JS plugin version. Will be included as the "version" field for the manifest entry in "js-plugins/manifest.json".
      Returns:
      the version
    • main

      public abstract Path main()
      The main JS file path, specified relative to path(). The main JS file must exist (Files.isRegularFile(root().resolve(main()))) and must be included in paths(). Will be included as the "main" field for the manifest entry in "js-plugins/manifest.json".
      Returns:
      the main JS file path
    • path

      public abstract Path path()
      The directory path of the resources to serve. The resources will be served via the URL path "js-plugins/{name}/{relativeToPath}". The path must exist (Files.isDirectory(path())).
      Returns:
      the path
    • paths

      @Default public Paths paths()
      The subset of resources from path() to serve. Production installations should preferably be packaged with the exact resources necessary (and thus served with Paths.all()). During development, other subsets may be useful if path() contains content unrelated to the JS content. By default, is Paths.all().
      Returns:
      the paths
    • walk

      public final <T, V extends Plugin.Visitor<T>> T walk(V visitor)